mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-15 22:46:49 +00:00
(feature)(webapp) modify view to dataSet
This commit is contained in:
@@ -37,9 +37,9 @@ const ToolModal: React.FC<Props> = ({ editTool, onSaveTool, onCancel }) => {
|
||||
node.title = node.name;
|
||||
node.value = node.type === 'DOMAIN' ? `DOMAIN_${node.id}` : node.id;
|
||||
node.checkable =
|
||||
node.type === 'VIEW' || (node.type === 'DOMAIN' && node.children?.length > 0);
|
||||
node.type === 'DATASET' || (node.type === 'DOMAIN' && node.children?.length > 0);
|
||||
});
|
||||
setModelList([{ title: '默认', value: -1, type: 'VIEW' }, ...treeData]);
|
||||
setModelList([{ title: '默认', value: -1, type: 'DATASET' }, ...treeData]);
|
||||
};
|
||||
|
||||
const initPluginList = async () => {
|
||||
@@ -105,10 +105,10 @@ const ToolModal: React.FC<Props> = ({ editTool, onSaveTool, onCancel }) => {
|
||||
</FormItem>
|
||||
{(toolType === AgentToolTypeEnum.NL2SQL_RULE ||
|
||||
toolType === AgentToolTypeEnum.NL2SQL_LLM) && (
|
||||
<FormItem name="viewIds" label="视图">
|
||||
<FormItem name="dataSetIds" label="数据集">
|
||||
<TreeSelect
|
||||
treeData={modelList}
|
||||
placeholder="请选择视图"
|
||||
placeholder="请选择数据集"
|
||||
multiple
|
||||
treeCheckable
|
||||
allowClear
|
||||
|
||||
@@ -19,7 +19,7 @@ export function deleteAgent(id: number) {
|
||||
}
|
||||
|
||||
export function getModelList() {
|
||||
return request<Result<ModelType[]>>('/api/chat/conf/getDomainViewTree', {
|
||||
return request<Result<ModelType[]>>('/api/chat/conf/getDomainDataSetTree', {
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ export type ModelType = {
|
||||
parentId: number;
|
||||
name: string;
|
||||
bizName: string;
|
||||
type: 'DOMAIN' | 'VIEW';
|
||||
type: 'DOMAIN' | 'DATASET';
|
||||
};
|
||||
|
||||
export type MetricType = {
|
||||
|
||||
@@ -42,9 +42,9 @@ const DetailModal: React.FC<Props> = ({ detail, onSubmit, onCancel }) => {
|
||||
node.title = node.name;
|
||||
node.value = node.type === 'DOMAIN' ? `DOMAIN_${node.id}` : node.id;
|
||||
node.checkable =
|
||||
node.type === 'VIEW' || (node.type === 'DOMAIN' && node.children?.length > 0);
|
||||
node.type === 'DATASET' || (node.type === 'DOMAIN' && node.children?.length > 0);
|
||||
});
|
||||
setModelList([{ title: '默认', value: -1, type: 'VIEW' }, ...treeData]);
|
||||
setModelList([{ title: '默认', value: -1, type: 'DATASET' }, ...treeData]);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -187,10 +187,10 @@ const DetailModal: React.FC<Props> = ({ detail, onSubmit, onCancel }) => {
|
||||
onCancel={onCancel}
|
||||
>
|
||||
<Form {...layout} form={form} style={{ maxWidth: 820 }}>
|
||||
<FormItem name="viewList" label="视图">
|
||||
<FormItem name="dataSetList" label="数据集">
|
||||
<TreeSelect
|
||||
treeData={modelList}
|
||||
placeholder="请选择视图"
|
||||
placeholder="请选择数据集"
|
||||
multiple
|
||||
treeCheckable
|
||||
allowClear
|
||||
@@ -243,64 +243,6 @@ const DetailModal: React.FC<Props> = ({ detail, onSubmit, onCancel }) => {
|
||||
<FormItem name="pattern" label="函数描述">
|
||||
<TextArea placeholder="请输入函数描述,多个描述换行分隔" allowClear />
|
||||
</FormItem>
|
||||
{/* <FormItem name="params" label="函数参数" hidden={pluginType === PluginTypeEnum.NL2SQL_LLM}>
|
||||
<div className={styles.paramsSection}>
|
||||
{functionParams.map((functionParam: FunctionParamFormItemType) => {
|
||||
const { id, name, type, description } = functionParam;
|
||||
return (
|
||||
<div className={styles.filterRow} key={id}>
|
||||
<Input
|
||||
placeholder="参数名称"
|
||||
value={name}
|
||||
className={styles.filterParamName}
|
||||
onChange={(e) => {
|
||||
functionParam.name = e.target.value;
|
||||
setFunctionParams([...functionParams]);
|
||||
}}
|
||||
allowClear
|
||||
/>
|
||||
<Select
|
||||
placeholder="参数类型"
|
||||
options={[
|
||||
{ label: '字符串', value: 'string' },
|
||||
{ label: '整型', value: 'int' },
|
||||
]}
|
||||
className={styles.filterParamValueField}
|
||||
allowClear
|
||||
value={type}
|
||||
onChange={(value) => {
|
||||
functionParam.type = value;
|
||||
setFunctionParams([...functionParams]);
|
||||
}}
|
||||
/>
|
||||
<Input
|
||||
placeholder="参数描述"
|
||||
value={description}
|
||||
className={styles.filterParamValueField}
|
||||
onChange={(e) => {
|
||||
functionParam.description = e.target.value;
|
||||
setFunctionParams([...functionParams]);
|
||||
}}
|
||||
allowClear
|
||||
/>
|
||||
<DeleteOutlined
|
||||
onClick={() => {
|
||||
setFunctionParams(functionParams.filter((item) => item.id !== id));
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<Button
|
||||
onClick={() => {
|
||||
setFunctionParams([...functionParams, { id: uuid() }]);
|
||||
}}
|
||||
>
|
||||
<PlusOutlined />
|
||||
新增函数参数
|
||||
</Button>
|
||||
</div>
|
||||
</FormItem> */}
|
||||
<FormItem name="exampleQuestions" label="示例问题">
|
||||
<div className={styles.paramsSection}>
|
||||
{examples.map((example) => {
|
||||
|
||||
@@ -57,9 +57,9 @@ const PluginManage = () => {
|
||||
key: 'name',
|
||||
},
|
||||
{
|
||||
title: '视图',
|
||||
dataIndex: 'viewList',
|
||||
key: 'viewList',
|
||||
title: '数据集',
|
||||
dataIndex: 'dataSetList',
|
||||
key: 'dataSetList',
|
||||
width: 200,
|
||||
render: (value: number[]) => {
|
||||
if (value?.includes(-1)) {
|
||||
|
||||
@@ -22,7 +22,7 @@ export function deletePlugin(id: number) {
|
||||
}
|
||||
|
||||
export function getModelList() {
|
||||
return request<Result<ModelType[]>>('/api/chat/conf/getDomainViewTree', {
|
||||
return request<Result<ModelType[]>>('/api/chat/conf/getDomainDataSetTree', {
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user