mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-14 22:25:19 +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);
|
||||
const res: any = await queryData({
|
||||
...chatContext,
|
||||
|
||||
@@ -113,7 +113,8 @@ const ToolModal: React.FC<Props> = ({ editTool, onSaveTool, onCancel }) => {
|
||||
<FormItem name="name" label="名称">
|
||||
<Input placeholder="请输入工具名称" />
|
||||
</FormItem>
|
||||
{(toolType === AgentToolTypeEnum.RULE || toolType === AgentToolTypeEnum.LLM_S2SQL) && (
|
||||
{(toolType === AgentToolTypeEnum.NL2SQL_RULE ||
|
||||
toolType === AgentToolTypeEnum.NL2SQL_LLM) && (
|
||||
<FormItem name="modelIds" label="主题域">
|
||||
<Select
|
||||
options={modelList.map((model) => ({ label: model.name, value: model.id }))}
|
||||
@@ -122,7 +123,7 @@ const ToolModal: React.FC<Props> = ({ editTool, onSaveTool, onCancel }) => {
|
||||
/>
|
||||
</FormItem>
|
||||
)}
|
||||
{toolType === AgentToolTypeEnum.LLM_S2SQL && (
|
||||
{toolType === AgentToolTypeEnum.NL2SQL_LLM && (
|
||||
<FormItem name="exampleQuestions" label="示例问题">
|
||||
<div className={styles.paramsSection}>
|
||||
{examples.map((example) => {
|
||||
@@ -158,7 +159,7 @@ const ToolModal: React.FC<Props> = ({ editTool, onSaveTool, onCancel }) => {
|
||||
</div>
|
||||
</FormItem>
|
||||
)}
|
||||
{toolType === AgentToolTypeEnum.INTERPRET && (
|
||||
{toolType === AgentToolTypeEnum.ANALYTICS && (
|
||||
<>
|
||||
<FormItem name="modelId" label="主题域">
|
||||
<Select
|
||||
@@ -240,7 +241,7 @@ const ToolModal: React.FC<Props> = ({ editTool, onSaveTool, onCancel }) => {
|
||||
/>
|
||||
</FormItem>
|
||||
)}
|
||||
{toolType === AgentToolTypeEnum.RULE && (
|
||||
{toolType === AgentToolTypeEnum.NL2SQL_RULE && (
|
||||
<FormItem name="queryTypes" label="查询模式">
|
||||
<Select
|
||||
placeholder="请选择查询模式"
|
||||
|
||||
@@ -2,48 +2,44 @@ export type MetricOptionType = {
|
||||
id: string;
|
||||
metricId?: number;
|
||||
modelId?: number;
|
||||
}
|
||||
};
|
||||
|
||||
export enum AgentToolTypeEnum {
|
||||
RULE = 'RULE',
|
||||
LLM_S2SQL = 'LLM_S2SQL',
|
||||
NL2SQL_RULE = 'NL2SQL_RULE',
|
||||
NL2SQL_LLM = 'NL2SQL_LLM',
|
||||
PLUGIN = 'PLUGIN',
|
||||
INTERPRET = 'INTERPRET'
|
||||
ANALYTICS = 'ANALYTICS',
|
||||
}
|
||||
|
||||
export const AGENT_TOOL_TYPE_LIST = [
|
||||
{
|
||||
label: '规则语义解析',
|
||||
value: AgentToolTypeEnum.RULE
|
||||
value: AgentToolTypeEnum.NL2SQL_RULE,
|
||||
},
|
||||
{
|
||||
label: '大模型语义解析',
|
||||
value: AgentToolTypeEnum.LLM_S2SQL
|
||||
},
|
||||
{
|
||||
label: '大模型指标解读',
|
||||
value: AgentToolTypeEnum.INTERPRET
|
||||
value: AgentToolTypeEnum.NL2SQL_LLM,
|
||||
},
|
||||
{
|
||||
label: '第三方插件',
|
||||
value: AgentToolTypeEnum.PLUGIN
|
||||
value: AgentToolTypeEnum.PLUGIN,
|
||||
},
|
||||
]
|
||||
];
|
||||
|
||||
export enum QueryModeEnum {
|
||||
METRIC = 'METRIC',
|
||||
TAG = 'TAG'
|
||||
TAG = 'TAG',
|
||||
}
|
||||
|
||||
export const QUERY_MODE_LIST = [
|
||||
{
|
||||
label: '指标模式',
|
||||
value: QueryModeEnum.METRIC
|
||||
value: QueryModeEnum.METRIC,
|
||||
},
|
||||
{
|
||||
label: '标签模式',
|
||||
value: QueryModeEnum.TAG
|
||||
}
|
||||
value: QueryModeEnum.TAG,
|
||||
},
|
||||
];
|
||||
|
||||
export type AgentToolType = {
|
||||
@@ -55,11 +51,11 @@ export type AgentToolType = {
|
||||
metricOptions?: MetricOptionType[];
|
||||
exampleQuestions?: string[];
|
||||
modelIds?: number[];
|
||||
}
|
||||
};
|
||||
|
||||
export type AgentConfigType = {
|
||||
tools: AgentToolType[];
|
||||
}
|
||||
};
|
||||
|
||||
export type AgentType = {
|
||||
id?: number;
|
||||
@@ -73,7 +69,7 @@ export type AgentType = {
|
||||
status?: 0 | 1;
|
||||
enableSearch?: 0 | 1;
|
||||
agentConfig?: AgentConfigType;
|
||||
}
|
||||
};
|
||||
|
||||
export type ModelType = {
|
||||
id: number | string;
|
||||
|
||||
@@ -216,7 +216,7 @@ const DetailModal: React.FC<Props> = ({ detail, onSubmit, onCancel }) => {
|
||||
}))}
|
||||
onChange={(value) => {
|
||||
setPluginType(value);
|
||||
if (value === PluginTypeEnum.LLM_S2SQL) {
|
||||
if (value === PluginTypeEnum.NL2SQL_LLM) {
|
||||
form.setFieldsValue({ parseMode: ParseModeEnum.FUNCTION_CALL });
|
||||
setFunctionParams([
|
||||
{
|
||||
@@ -243,7 +243,7 @@ const DetailModal: React.FC<Props> = ({ detail, onSubmit, onCancel }) => {
|
||||
<FormItem name="pattern" label="函数描述">
|
||||
<TextArea placeholder="请输入函数描述,多个描述换行分隔" allowClear />
|
||||
</FormItem>
|
||||
{/* <FormItem name="params" label="函数参数" hidden={pluginType === PluginTypeEnum.LLM_S2SQL}>
|
||||
{/* <FormItem name="params" label="函数参数" hidden={pluginType === PluginTypeEnum.NL2SQL_LLM}>
|
||||
<div className={styles.paramsSection}>
|
||||
{functionParams.map((functionParam: FunctionParamFormItemType) => {
|
||||
const { id, name, type, description } = functionParam;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
export const PLUGIN_TYPE_MAP = {
|
||||
WEB_PAGE: 'Web页面',
|
||||
WEB_SERVICE: 'Web服务',
|
||||
// LLM_S2SQL: 'LLM语义解析',
|
||||
// CONTENT_INTERPRET: '内容解读',
|
||||
}
|
||||
|
||||
export const PARSE_MODE_MAP = {
|
||||
|
||||
@@ -4,23 +4,23 @@ export type PluginConfigType = {
|
||||
paramOptions: any;
|
||||
valueParams: any;
|
||||
forwardParam: any;
|
||||
}
|
||||
};
|
||||
|
||||
export enum PluginTypeEnum {
|
||||
WEB_PAGE = 'WEB_PAGE',
|
||||
WEB_SERVICE = 'WEB_SERVICE',
|
||||
LLM_S2SQL = 'LLM_S2SQL'
|
||||
NL2SQL_LLM = 'NL2SQL_LLM',
|
||||
}
|
||||
|
||||
export enum ParseModeEnum {
|
||||
EMBEDDING_RECALL = 'EMBEDDING_RECALL',
|
||||
FUNCTION_CALL = 'FUNCTION_CALL'
|
||||
FUNCTION_CALL = 'FUNCTION_CALL',
|
||||
}
|
||||
|
||||
export enum ParamTypeEnum {
|
||||
CUSTOM = 'CUSTOM',
|
||||
SEMANTIC = 'SEMANTIC',
|
||||
FORWARD = 'FORWARD'
|
||||
FORWARD = 'FORWARD',
|
||||
}
|
||||
|
||||
export type PluginType = {
|
||||
@@ -32,7 +32,7 @@ export type PluginType = {
|
||||
parseModeConfig: string;
|
||||
name: string;
|
||||
config: PluginConfigType;
|
||||
}
|
||||
};
|
||||
|
||||
export type ModelType = {
|
||||
id: number | string;
|
||||
@@ -49,20 +49,20 @@ export type DimensionType = {
|
||||
|
||||
export type FunctionParamType = {
|
||||
type: string;
|
||||
properties: Record<string, { type: string, description: string }>;
|
||||
properties: Record<string, { type: string; description: string }>;
|
||||
required: string[];
|
||||
}
|
||||
};
|
||||
|
||||
export type FunctionType = {
|
||||
name: string;
|
||||
description: string;
|
||||
parameters: FunctionParamType;
|
||||
examples: string[];
|
||||
}
|
||||
};
|
||||
|
||||
export type FunctionParamFormItemType = {
|
||||
id: string;
|
||||
name?: string;
|
||||
type?: string;
|
||||
description?: string;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user