Skip to content

Commit 879d91f

Browse files
feat: Batch operation of intelligent agents and knowledge bases
1 parent 000532b commit 879d91f

File tree

15 files changed

+905
-551
lines changed

15 files changed

+905
-551
lines changed

ui/src/api/application/application.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,35 @@ const getFile: (application_id: string, params: any) => Promise<Result<any>> = (
423423
) => {
424424
return get(`/oss/get_url/${application_id}`, params)
425425
}
426+
427+
/**
428+
* 批量删除智能体
429+
* @param 参数
430+
* {
431+
"id_list": [String]
432+
}
433+
*/
434+
const delMulApplication: (data: any, loading?: Ref<boolean>) => Promise<Result<boolean>> = (
435+
data,
436+
loading,
437+
) => {
438+
return put(`${prefix.value}/batch_delete`, { id_list: data }, undefined, loading)
439+
}
440+
/**
441+
* 批量删除智能体
442+
* @param 参数
443+
* {
444+
"id_list": [String]
445+
"folder_id": string
446+
}
447+
*/
448+
const putMulMoveApplication: (data: any, loading?: Ref<boolean>) => Promise<Result<boolean>> = (
449+
data,
450+
loading,
451+
) => {
452+
return put(`${prefix.value}/batch_move`, data, undefined, loading)
453+
}
454+
426455
export default {
427456
getAllApplication,
428457
getApplication,
@@ -455,4 +484,6 @@ export default {
455484
topQuestions,
456485
getFile,
457486
moveApplication,
487+
delMulApplication,
488+
putMulMoveApplication,
458489
}

ui/src/api/knowledge/knowledge.ts

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const putKnowledge: (
8080
* 删除知识库
8181
* @param 参数 knowledge_id
8282
*/
83-
const delKnowledge: (knowledge_id: String, loading?: Ref<boolean>) => Promise<Result<boolean>> = (
83+
const delKnowledge: (knowledge_id: string, loading?: Ref<boolean>) => Promise<Result<boolean>> = (
8484
knowledge_id,
8585
loading,
8686
) => {
@@ -496,10 +496,10 @@ const postTransformWorkflow: (
496496

497497
/**
498498
* 导出知识库
499-
* @param knowledge_name
500-
* @param knowledge_id
501-
* @param loading
502-
* @returns
499+
* @param knowledge_name
500+
* @param knowledge_id
501+
* @param loading
502+
* @returns
503503
*/
504504
const exportKnowledgeBundle: (
505505
knowledge_name: string,
@@ -514,9 +514,9 @@ const exportKnowledgeBundle: (
514514

515515
/**
516516
* 导入知识库
517-
* @param data
518-
* @param loading
519-
* @returns
517+
* @param data
518+
* @param loading
519+
* @returns
520520
*/
521521
const importKnowledgeBundle: (
522522
data: any,
@@ -525,7 +525,33 @@ const importKnowledgeBundle: (
525525
return post(`${prefix.value}/import_knowledge`, data, undefined, loading)
526526
}
527527

528-
528+
/**
529+
* 批量删除知识库
530+
* @param 参数
531+
* {
532+
"id_list": [String]
533+
}
534+
*/
535+
const delMulKnowledge: (data: any, loading?: Ref<boolean>) => Promise<Result<boolean>> = (
536+
data,
537+
loading,
538+
) => {
539+
return put(`${prefix.value}/batch_delete`, { id_list: data }, undefined, loading)
540+
}
541+
/**
542+
* 批量删除知识库
543+
* @param 参数
544+
* {
545+
"id_list": [String]
546+
"folder_id": string
547+
}
548+
*/
549+
const putMulMoveKnowledge: (data: any, loading?: Ref<boolean>) => Promise<Result<boolean>> = (
550+
data,
551+
loading,
552+
) => {
553+
return put(`${prefix.value}/batch_move`, data, undefined, loading)
554+
}
529555

530556

531557
export default {
@@ -568,5 +594,7 @@ export default {
568594
importKnowledgeWorkflow,
569595
postTransformWorkflow,
570596
exportKnowledgeBundle,
571-
importKnowledgeBundle
597+
importKnowledgeBundle,
598+
delMulKnowledge,
599+
putMulMoveKnowledge,
572600
}

ui/src/api/system-resource-management/knowledge.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const putKnowledge: (
7272
* 删除知识库
7373
* @param 参数 knowledge_id
7474
*/
75-
const delKnowledge: (knowledge_id: String, loading?: Ref<boolean>) => Promise<Result<boolean>> = (
75+
const delKnowledge: (knowledge_id: string, loading?: Ref<boolean>) => Promise<Result<boolean>> = (
7676
knowledge_id,
7777
loading,
7878
) => {

ui/src/api/system-shared/knowledge.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const putKnowledge: (
7373
* 删除知识库
7474
* @param 参数 knowledge_id
7575
*/
76-
const delKnowledge: (knowledge_id: String, loading?: Ref<boolean>) => Promise<Result<boolean>> = (
76+
const delKnowledge: (knowledge_id: string, loading?: Ref<boolean>) => Promise<Result<boolean>> = (
7777
knowledge_id,
7878
loading,
7979
) => {

ui/src/api/tool/tool.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ const getMcpTools: (
303303

304304
/**
305305
* 批量删除工具
306-
* @param 参数 knowledge_id,
306+
* @param 参数
307307
* {
308308
"id_list": [String]
309309
}
@@ -316,7 +316,7 @@ const delMulTool: (data: any, loading?: Ref<boolean>) => Promise<Result<boolean>
316316
}
317317
/**
318318
* 批量删除工具
319-
* @param 参数 knowledge_id,
319+
* @param 参数
320320
* {
321321
"id_list": [String]
322322
"folder_id": string

ui/src/components/folder-tree/MoveToDialog.vue

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,26 @@ const submitHandle = async () => {
112112
dialogVisible.value = false
113113
})
114114
} else if (props.source === SourceTypeEnum.KNOWLEDGE) {
115-
if (detail.value.type === 2) {
116-
KnowledgeApi.putLarkKnowledge(detail.value.id, obj, loading).then(() => {
115+
if (isBatch.value) {
116+
ToolApi.putMulMoveTool(obj, loading).then(() => {
117117
MsgSuccess(t('common.saveSuccess'))
118-
emit('refresh', detail.value)
118+
emit('refresh')
119119
dialogVisible.value = false
120120
})
121121
} else {
122-
KnowledgeApi.putKnowledge(detail.value.id, obj, loading).then(() => {
123-
MsgSuccess(t('common.saveSuccess'))
124-
emit('refresh', detail.value)
125-
dialogVisible.value = false
126-
})
122+
if (detail.value.type === 2) {
123+
KnowledgeApi.putLarkKnowledge(detail.value.id, obj, loading).then(() => {
124+
MsgSuccess(t('common.saveSuccess'))
125+
emit('refresh', detail.value)
126+
dialogVisible.value = false
127+
})
128+
} else {
129+
KnowledgeApi.putKnowledge(detail.value.id, obj, loading).then(() => {
130+
MsgSuccess(t('common.saveSuccess'))
131+
emit('refresh', detail.value)
132+
dialogVisible.value = false
133+
})
134+
}
127135
}
128136
} else if (props.source === SourceTypeEnum.TOOL) {
129137
if (isBatch.value) {
@@ -140,11 +148,19 @@ const submitHandle = async () => {
140148
})
141149
}
142150
} else if (props.source === SourceTypeEnum.APPLICATION) {
143-
ApplicationApi.moveApplication(detail.value.id, obj.folder_id, loading).then((res) => {
144-
MsgSuccess(t('common.saveSuccess'))
145-
emit('refresh', detail.value)
146-
dialogVisible.value = false
147-
})
151+
if (isBatch.value) {
152+
ApplicationApi.putMulMoveApplication(obj, loading).then(() => {
153+
MsgSuccess(t('common.saveSuccess'))
154+
emit('refresh')
155+
dialogVisible.value = false
156+
})
157+
} else {
158+
ApplicationApi.moveApplication(detail.value.id, obj.folder_id, loading).then((res) => {
159+
MsgSuccess(t('common.saveSuccess'))
160+
emit('refresh', detail.value)
161+
dialogVisible.value = false
162+
})
163+
}
148164
}
149165
} else {
150166
MsgError(t('components.folder.requiredMessage'))

ui/src/locales/lang/en-US/views/application.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export default {
1818
},
1919
delete: {
2020
confirmTitle: 'Are you sure you want to delete this agent: ',
21+
confirmTitle2: 'agents?',
2122
confirmMessage:
2223
'Deleting this agent will no longer provide its services. Please proceed with caution.',
2324
resourceCountMessage:

ui/src/locales/lang/en-US/views/knowledge.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default {
1616
},
1717
delete: {
1818
confirmTitle: 'Confirm deletion of knowledge:',
19+
confirmTitle2: 'knowledges?',
1920
confirmMessage1: 'This knowledge is related with',
2021
confirmMessage2: 'agent. Deleting it will be irreversible, please proceed with caution.',
2122
resourceCountMessage:

ui/src/locales/lang/zh-CN/views/application.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export default {
1818
},
1919
delete: {
2020
confirmTitle: '是否删除智能体:',
21+
confirmTitle2: '个智能体?',
2122
confirmMessage: '删除后该智能体将不再提供服务,请谨慎操作。',
2223
resourceCountMessage: '此智能体关联 {count} 个资源,删除后无法使用,请谨慎操作。',
2324
},

ui/src/locales/lang/zh-CN/views/knowledge.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default {
1414
},
1515
delete: {
1616
confirmTitle: '是否删除知识库:',
17+
confirmTitle2: '个知识库?',
1718
confirmMessage1: '此知识库关联',
1819
confirmMessage2: '个智能体,删除后无法恢复,请谨慎操作。',
1920
resourceCountMessage: '此知识库关联 {count} 个资源,删除后无法使用,请谨慎操作。',

0 commit comments

Comments
 (0)