mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 20:25:12 +00:00
(feature)(webapp) change agent tool enum value (#454)
This commit is contained in:
@@ -146,7 +146,7 @@ const ChatMsg: React.FC<Props> = ({ queryId, data, chartIndex, triggerResize })
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onLoadData = async (value: any, extraFilter?: any) => {
|
const onLoadData = async (value: any) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const res: any = await queryData({
|
const res: any = await queryData({
|
||||||
...chatContext,
|
...chatContext,
|
||||||
|
|||||||
@@ -113,7 +113,8 @@ const ToolModal: React.FC<Props> = ({ editTool, onSaveTool, onCancel }) => {
|
|||||||
<FormItem name="name" label="名称">
|
<FormItem name="name" label="名称">
|
||||||
<Input placeholder="请输入工具名称" />
|
<Input placeholder="请输入工具名称" />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
{(toolType === AgentToolTypeEnum.RULE || toolType === AgentToolTypeEnum.LLM_S2SQL) && (
|
{(toolType === AgentToolTypeEnum.NL2SQL_RULE ||
|
||||||
|
toolType === AgentToolTypeEnum.NL2SQL_LLM) && (
|
||||||
<FormItem name="modelIds" label="主题域">
|
<FormItem name="modelIds" label="主题域">
|
||||||
<Select
|
<Select
|
||||||
options={modelList.map((model) => ({ label: model.name, value: model.id }))}
|
options={modelList.map((model) => ({ label: model.name, value: model.id }))}
|
||||||
@@ -122,7 +123,7 @@ const ToolModal: React.FC<Props> = ({ editTool, onSaveTool, onCancel }) => {
|
|||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
{toolType === AgentToolTypeEnum.LLM_S2SQL && (
|
{toolType === AgentToolTypeEnum.NL2SQL_LLM && (
|
||||||
<FormItem name="exampleQuestions" label="示例问题">
|
<FormItem name="exampleQuestions" label="示例问题">
|
||||||
<div className={styles.paramsSection}>
|
<div className={styles.paramsSection}>
|
||||||
{examples.map((example) => {
|
{examples.map((example) => {
|
||||||
@@ -158,7 +159,7 @@ const ToolModal: React.FC<Props> = ({ editTool, onSaveTool, onCancel }) => {
|
|||||||
</div>
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
{toolType === AgentToolTypeEnum.INTERPRET && (
|
{toolType === AgentToolTypeEnum.ANALYTICS && (
|
||||||
<>
|
<>
|
||||||
<FormItem name="modelId" label="主题域">
|
<FormItem name="modelId" label="主题域">
|
||||||
<Select
|
<Select
|
||||||
@@ -240,7 +241,7 @@ const ToolModal: React.FC<Props> = ({ editTool, onSaveTool, onCancel }) => {
|
|||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
{toolType === AgentToolTypeEnum.RULE && (
|
{toolType === AgentToolTypeEnum.NL2SQL_RULE && (
|
||||||
<FormItem name="queryTypes" label="查询模式">
|
<FormItem name="queryTypes" label="查询模式">
|
||||||
<Select
|
<Select
|
||||||
placeholder="请选择查询模式"
|
placeholder="请选择查询模式"
|
||||||
|
|||||||
@@ -2,48 +2,44 @@ export type MetricOptionType = {
|
|||||||
id: string;
|
id: string;
|
||||||
metricId?: number;
|
metricId?: number;
|
||||||
modelId?: number;
|
modelId?: number;
|
||||||
}
|
};
|
||||||
|
|
||||||
export enum AgentToolTypeEnum {
|
export enum AgentToolTypeEnum {
|
||||||
RULE = 'RULE',
|
NL2SQL_RULE = 'NL2SQL_RULE',
|
||||||
LLM_S2SQL = 'LLM_S2SQL',
|
NL2SQL_LLM = 'NL2SQL_LLM',
|
||||||
PLUGIN = 'PLUGIN',
|
PLUGIN = 'PLUGIN',
|
||||||
INTERPRET = 'INTERPRET'
|
ANALYTICS = 'ANALYTICS',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AGENT_TOOL_TYPE_LIST = [
|
export const AGENT_TOOL_TYPE_LIST = [
|
||||||
{
|
{
|
||||||
label: '规则语义解析',
|
label: '规则语义解析',
|
||||||
value: AgentToolTypeEnum.RULE
|
value: AgentToolTypeEnum.NL2SQL_RULE,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '大模型语义解析',
|
label: '大模型语义解析',
|
||||||
value: AgentToolTypeEnum.LLM_S2SQL
|
value: AgentToolTypeEnum.NL2SQL_LLM,
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '大模型指标解读',
|
|
||||||
value: AgentToolTypeEnum.INTERPRET
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '第三方插件',
|
label: '第三方插件',
|
||||||
value: AgentToolTypeEnum.PLUGIN
|
value: AgentToolTypeEnum.PLUGIN,
|
||||||
},
|
},
|
||||||
]
|
];
|
||||||
|
|
||||||
export enum QueryModeEnum {
|
export enum QueryModeEnum {
|
||||||
METRIC = 'METRIC',
|
METRIC = 'METRIC',
|
||||||
TAG = 'TAG'
|
TAG = 'TAG',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const QUERY_MODE_LIST = [
|
export const QUERY_MODE_LIST = [
|
||||||
{
|
{
|
||||||
label: '指标模式',
|
label: '指标模式',
|
||||||
value: QueryModeEnum.METRIC
|
value: QueryModeEnum.METRIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '标签模式',
|
label: '标签模式',
|
||||||
value: QueryModeEnum.TAG
|
value: QueryModeEnum.TAG,
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export type AgentToolType = {
|
export type AgentToolType = {
|
||||||
@@ -55,11 +51,11 @@ export type AgentToolType = {
|
|||||||
metricOptions?: MetricOptionType[];
|
metricOptions?: MetricOptionType[];
|
||||||
exampleQuestions?: string[];
|
exampleQuestions?: string[];
|
||||||
modelIds?: number[];
|
modelIds?: number[];
|
||||||
}
|
};
|
||||||
|
|
||||||
export type AgentConfigType = {
|
export type AgentConfigType = {
|
||||||
tools: AgentToolType[];
|
tools: AgentToolType[];
|
||||||
}
|
};
|
||||||
|
|
||||||
export type AgentType = {
|
export type AgentType = {
|
||||||
id?: number;
|
id?: number;
|
||||||
@@ -73,7 +69,7 @@ export type AgentType = {
|
|||||||
status?: 0 | 1;
|
status?: 0 | 1;
|
||||||
enableSearch?: 0 | 1;
|
enableSearch?: 0 | 1;
|
||||||
agentConfig?: AgentConfigType;
|
agentConfig?: AgentConfigType;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type ModelType = {
|
export type ModelType = {
|
||||||
id: number | string;
|
id: number | string;
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ const DetailModal: React.FC<Props> = ({ detail, onSubmit, onCancel }) => {
|
|||||||
}))}
|
}))}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
setPluginType(value);
|
setPluginType(value);
|
||||||
if (value === PluginTypeEnum.LLM_S2SQL) {
|
if (value === PluginTypeEnum.NL2SQL_LLM) {
|
||||||
form.setFieldsValue({ parseMode: ParseModeEnum.FUNCTION_CALL });
|
form.setFieldsValue({ parseMode: ParseModeEnum.FUNCTION_CALL });
|
||||||
setFunctionParams([
|
setFunctionParams([
|
||||||
{
|
{
|
||||||
@@ -243,7 +243,7 @@ const DetailModal: React.FC<Props> = ({ detail, onSubmit, onCancel }) => {
|
|||||||
<FormItem name="pattern" label="函数描述">
|
<FormItem name="pattern" label="函数描述">
|
||||||
<TextArea placeholder="请输入函数描述,多个描述换行分隔" allowClear />
|
<TextArea placeholder="请输入函数描述,多个描述换行分隔" allowClear />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
{/* <FormItem name="params" label="函数参数" hidden={pluginType === PluginTypeEnum.LLM_S2SQL}>
|
{/* <FormItem name="params" label="函数参数" hidden={pluginType === PluginTypeEnum.NL2SQL_LLM}>
|
||||||
<div className={styles.paramsSection}>
|
<div className={styles.paramsSection}>
|
||||||
{functionParams.map((functionParam: FunctionParamFormItemType) => {
|
{functionParams.map((functionParam: FunctionParamFormItemType) => {
|
||||||
const { id, name, type, description } = functionParam;
|
const { id, name, type, description } = functionParam;
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
export const PLUGIN_TYPE_MAP = {
|
export const PLUGIN_TYPE_MAP = {
|
||||||
WEB_PAGE: 'Web页面',
|
WEB_PAGE: 'Web页面',
|
||||||
WEB_SERVICE: 'Web服务',
|
WEB_SERVICE: 'Web服务',
|
||||||
// LLM_S2SQL: 'LLM语义解析',
|
|
||||||
// CONTENT_INTERPRET: '内容解读',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PARSE_MODE_MAP = {
|
export const PARSE_MODE_MAP = {
|
||||||
|
|||||||
@@ -4,23 +4,23 @@ export type PluginConfigType = {
|
|||||||
paramOptions: any;
|
paramOptions: any;
|
||||||
valueParams: any;
|
valueParams: any;
|
||||||
forwardParam: any;
|
forwardParam: any;
|
||||||
}
|
};
|
||||||
|
|
||||||
export enum PluginTypeEnum {
|
export enum PluginTypeEnum {
|
||||||
WEB_PAGE = 'WEB_PAGE',
|
WEB_PAGE = 'WEB_PAGE',
|
||||||
WEB_SERVICE = 'WEB_SERVICE',
|
WEB_SERVICE = 'WEB_SERVICE',
|
||||||
LLM_S2SQL = 'LLM_S2SQL'
|
NL2SQL_LLM = 'NL2SQL_LLM',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum ParseModeEnum {
|
export enum ParseModeEnum {
|
||||||
EMBEDDING_RECALL = 'EMBEDDING_RECALL',
|
EMBEDDING_RECALL = 'EMBEDDING_RECALL',
|
||||||
FUNCTION_CALL = 'FUNCTION_CALL'
|
FUNCTION_CALL = 'FUNCTION_CALL',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum ParamTypeEnum {
|
export enum ParamTypeEnum {
|
||||||
CUSTOM = 'CUSTOM',
|
CUSTOM = 'CUSTOM',
|
||||||
SEMANTIC = 'SEMANTIC',
|
SEMANTIC = 'SEMANTIC',
|
||||||
FORWARD = 'FORWARD'
|
FORWARD = 'FORWARD',
|
||||||
}
|
}
|
||||||
|
|
||||||
export type PluginType = {
|
export type PluginType = {
|
||||||
@@ -32,7 +32,7 @@ export type PluginType = {
|
|||||||
parseModeConfig: string;
|
parseModeConfig: string;
|
||||||
name: string;
|
name: string;
|
||||||
config: PluginConfigType;
|
config: PluginConfigType;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type ModelType = {
|
export type ModelType = {
|
||||||
id: number | string;
|
id: number | string;
|
||||||
@@ -49,20 +49,20 @@ export type DimensionType = {
|
|||||||
|
|
||||||
export type FunctionParamType = {
|
export type FunctionParamType = {
|
||||||
type: string;
|
type: string;
|
||||||
properties: Record<string, { type: string, description: string }>;
|
properties: Record<string, { type: string; description: string }>;
|
||||||
required: string[];
|
required: string[];
|
||||||
}
|
};
|
||||||
|
|
||||||
export type FunctionType = {
|
export type FunctionType = {
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
parameters: FunctionParamType;
|
parameters: FunctionParamType;
|
||||||
examples: string[];
|
examples: string[];
|
||||||
}
|
};
|
||||||
|
|
||||||
export type FunctionParamFormItemType = {
|
export type FunctionParamFormItemType = {
|
||||||
id: string;
|
id: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
type?: string;
|
type?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
}
|
};
|
||||||
|
|||||||
47
webapp/pnpm-lock.yaml
generated
47
webapp/pnpm-lock.yaml
generated
@@ -307,8 +307,8 @@ importers:
|
|||||||
specifier: ^2.0.4
|
specifier: ^2.0.4
|
||||||
version: 2.0.4
|
version: 2.0.4
|
||||||
'@antv/g6':
|
'@antv/g6':
|
||||||
specifier: ^4.8.14
|
specifier: ^4.8.23
|
||||||
version: 4.8.22
|
version: 4.8.23
|
||||||
'@antv/g6-core':
|
'@antv/g6-core':
|
||||||
specifier: ^0.8.23
|
specifier: ^0.8.23
|
||||||
version: 0.8.23
|
version: 0.8.23
|
||||||
@@ -1152,21 +1152,6 @@ packages:
|
|||||||
lodash: 4.17.21
|
lodash: 4.17.21
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@antv/g6-core@0.8.22:
|
|
||||||
resolution: {integrity: sha512-tH7fO/xCZQnkMqc3N3mkMMpYbOTrcnZChDoSCdDM8ttQ1imK0anObnhdnVkjess7zJ230ySsX8UaE+lzoKFSbg==}
|
|
||||||
dependencies:
|
|
||||||
'@antv/algorithm': 0.1.26
|
|
||||||
'@antv/dom-util': 2.0.4
|
|
||||||
'@antv/event-emitter': 0.1.3
|
|
||||||
'@antv/g-base': 0.5.15
|
|
||||||
'@antv/g-math': 0.1.9
|
|
||||||
'@antv/matrix-util': 3.1.0-beta.3
|
|
||||||
'@antv/path-util': 2.0.15
|
|
||||||
'@antv/util': 2.0.17
|
|
||||||
ml-matrix: 6.10.4
|
|
||||||
tslib: 2.6.2
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@antv/g6-core@0.8.23:
|
/@antv/g6-core@0.8.23:
|
||||||
resolution: {integrity: sha512-JWdnba5Bx4/hLhbIQeyvdgh68SDYZisveukuBifxLKODCNJNKTopmWf1w6tU+RxAT2k5ByXkTGWQE1IkIL8O+Q==}
|
resolution: {integrity: sha512-JWdnba5Bx4/hLhbIQeyvdgh68SDYZisveukuBifxLKODCNJNKTopmWf1w6tU+RxAT2k5ByXkTGWQE1IkIL8O+Q==}
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -1182,16 +1167,16 @@ packages:
|
|||||||
tslib: 2.6.2
|
tslib: 2.6.2
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@antv/g6-element@0.8.22:
|
/@antv/g6-element@0.8.23:
|
||||||
resolution: {integrity: sha512-rTJgaFDeaiHEF5d+hdJEGbh+Z272bi+Zzu5aTDWCtFFgxtosdeOQGWdyhIEeLCstRvlP3RaaztBIsSZm5BWFsA==}
|
resolution: {integrity: sha512-KdJOiu4D7UExsYjKOJUcd7YCD/gCfxqHOlS01zkyOqsaindWVLdshBAZWXc2zgzVwHS/fadxwUI+DcllsRkH0g==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@antv/g-base': 0.5.15
|
'@antv/g-base': 0.5.15
|
||||||
'@antv/g6-core': 0.8.22
|
'@antv/g6-core': 0.8.23
|
||||||
'@antv/util': 2.0.17
|
'@antv/util': 2.0.17
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@antv/g6-pc@0.8.22:
|
/@antv/g6-pc@0.8.23:
|
||||||
resolution: {integrity: sha512-sG17yhA4lXyiLddL/IlCqysbxw3pRspukwaxJ6W5tfDAdM2o04Odf60ppvPekQh/EF6nIZ95qcDl03v3z6NXZw==}
|
resolution: {integrity: sha512-8H5n1U8T4pyBcoaEKB8g4TRKycHtONSA+qOeFMq7XIDh1DCn0tUF1uLvwj096Zp+/bUXtAfaRvg+n1KKyCVZ0w==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@ant-design/colors': 4.0.5
|
'@ant-design/colors': 4.0.5
|
||||||
'@antv/algorithm': 0.1.26
|
'@antv/algorithm': 0.1.26
|
||||||
@@ -1202,8 +1187,8 @@ packages:
|
|||||||
'@antv/g-math': 0.1.9
|
'@antv/g-math': 0.1.9
|
||||||
'@antv/g-svg': 0.5.7
|
'@antv/g-svg': 0.5.7
|
||||||
'@antv/g6-core': 0.8.23
|
'@antv/g6-core': 0.8.23
|
||||||
'@antv/g6-element': 0.8.22
|
'@antv/g6-element': 0.8.23
|
||||||
'@antv/g6-plugin': 0.8.22
|
'@antv/g6-plugin': 0.8.23
|
||||||
'@antv/hierarchy': 0.6.11
|
'@antv/hierarchy': 0.6.11
|
||||||
'@antv/layout': 0.3.23(dagre@0.8.5)
|
'@antv/layout': 0.3.23(dagre@0.8.5)
|
||||||
'@antv/matrix-util': 3.1.0-beta.3
|
'@antv/matrix-util': 3.1.0-beta.3
|
||||||
@@ -1216,15 +1201,15 @@ packages:
|
|||||||
ml-matrix: 6.10.4
|
ml-matrix: 6.10.4
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@antv/g6-plugin@0.8.22:
|
/@antv/g6-plugin@0.8.23:
|
||||||
resolution: {integrity: sha512-3Z9hnNYwkJ7BAMLRoymWgrgTRXG7EDC2OlDAoRBSUvv/0sLVu7/kvobN3cY3rJF5rNwYmyTYb43ZfbK2UV4GVQ==}
|
resolution: {integrity: sha512-DwhSuUc0a0foIM4nrhXR/+ooZafkVve0IEErldhsygKWLDSz/c9HRLON66OEdzQX7Ed1uE0SMcBUsIDe+wPQrw==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@antv/dom-util': 2.0.4
|
'@antv/dom-util': 2.0.4
|
||||||
'@antv/g-base': 0.5.15
|
'@antv/g-base': 0.5.15
|
||||||
'@antv/g-canvas': 0.5.14
|
'@antv/g-canvas': 0.5.14
|
||||||
'@antv/g-svg': 0.5.7
|
'@antv/g-svg': 0.5.7
|
||||||
'@antv/g6-core': 0.8.22
|
'@antv/g6-core': 0.8.23
|
||||||
'@antv/g6-element': 0.8.22
|
'@antv/g6-element': 0.8.23
|
||||||
'@antv/matrix-util': 3.1.0-beta.3
|
'@antv/matrix-util': 3.1.0-beta.3
|
||||||
'@antv/path-util': 2.0.15
|
'@antv/path-util': 2.0.15
|
||||||
'@antv/scale': 0.3.18
|
'@antv/scale': 0.3.18
|
||||||
@@ -1232,10 +1217,10 @@ packages:
|
|||||||
insert-css: 2.0.0
|
insert-css: 2.0.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@antv/g6@4.8.22:
|
/@antv/g6@4.8.23:
|
||||||
resolution: {integrity: sha512-ZbfmaK5H5vULGJUWZLIBJSorF3kSSeSZvvxbOJzzfB72zJ+Pjjtviq2BeiVV+HAZ3Ux7ogvIH6zcwRb1JrIO8g==}
|
resolution: {integrity: sha512-tsnJzlZCiOKvwAULGom6ppARutRmoAgV1wZzkOmDRm8ZdokUkpEYfb3faV6802VMs82DLP0zZ0KavapoK1q8hQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@antv/g6-pc': 0.8.22
|
'@antv/g6-pc': 0.8.23
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@antv/graphlib@1.2.0:
|
/@antv/graphlib@1.2.0:
|
||||||
|
|||||||
Reference in New Issue
Block a user