Skip to content

Commit ea21be1

Browse files
feat: Batch deletion tool
1 parent f275442 commit ea21be1

13 files changed

Lines changed: 697 additions & 488 deletions

File tree

ui/src/api/tool/tool.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,34 @@ const getMcpTools: (
300300
) => Promise<Result<any>> = (tool_id, mcp_servers, loading) => {
301301
return post(`${prefix.value}/${tool_id}/mcp_tools`, { mcp_servers }, {}, loading)
302302
}
303+
304+
/**
305+
* 批量删除工具
306+
* @param 参数 knowledge_id,
307+
* {
308+
"id_list": [String]
309+
}
310+
*/
311+
const delMulTool: (data: any, loading?: Ref<boolean>) => Promise<Result<boolean>> = (
312+
data,
313+
loading,
314+
) => {
315+
return put(`${prefix.value}/tool/batch_delete`, { id_list: data }, undefined, loading)
316+
}
317+
/**
318+
* 批量删除工具
319+
* @param 参数 knowledge_id,
320+
* {
321+
"id_list": [String]
322+
"folder_id": string
323+
}
324+
*/
325+
const putMulMoveTool: (data: any, loading?: Ref<boolean>) => Promise<Result<boolean>> = (
326+
data,
327+
loading,
328+
) => {
329+
return put(`${prefix.value}/tool/batch_move`, data, undefined, loading)
330+
}
303331
export default {
304332
getToolList,
305333
getAllToolList,
@@ -328,4 +356,6 @@ export default {
328356
debugToolWorkflow,
329357
generateCode,
330358
getMcpTools,
359+
delMulTool,
360+
putMulMoveTool
331361
}

ui/src/components/ai-chat/index.scss

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,6 @@
4242
.is-selected {
4343
background: rgba(var(--el-text-color-primary-rgb), 0.08);
4444
}
45-
.mul-operation {
46-
position: fixed;
47-
bottom: 0;
48-
right: 0;
49-
padding: 16px 24px;
50-
box-sizing: border-box;
51-
background: #ffffff;
52-
z-index: 22;
53-
box-shadow: 0px -2px 4px 0px rgba(var(--el-text-color-primary-rgb), 0.08);
54-
}
5545
}
5646

5747
.chat-width {

ui/src/components/app-icon/index.ts

Lines changed: 64 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -580,53 +580,74 @@ export const iconMap: any = {
580580
},
581581
},
582582
'app-unlink': {
583-
iconReader: () => {
584-
return h('i', [
585-
h(
586-
'svg',
587-
{
588-
style: { height: '100%', width: '100%' },
589-
viewBox: '0 0 16 16',
590-
fill: 'none',
591-
xmlns: 'http://www.w3.org/2000/svg',
592-
},
593-
[
594-
h('g', { 'clip-path': 'url(#clip0_10754_9765)' }, [
595-
h('path', {
596-
d: 'M1.23567 0.764126L0.76429 1.23549C0.634122 1.36565 0.634122 1.57668 0.76429 1.70685L13.9629 14.905C14.0931 15.0351 14.3042 15.0351 14.4343 14.905L14.9057 14.4336C15.0359 14.3034 15.0359 14.0924 14.9057 13.9622L1.70705 0.764126C1.57688 0.633963 1.36584 0.633963 1.23567 0.764126Z',
597-
fill: 'currentColor',
598-
}),
599-
h('path', {
600-
d: 'M9.77756 6.94871V3.33311C9.77756 3.22403 9.69895 3.1333 9.59528 3.11448L9.55534 3.1109H5.93959L4.60626 1.77762H9.55534C10.3858 1.77762 11.0643 2.42839 11.1086 3.24777L11.1109 3.33311V8.28199L9.77756 6.94871Z',
601-
fill: 'currentColor',
602-
}),
603-
h('path', {
604-
d: 'M0.888669 3.71681V8.66623L0.890971 8.75157C0.93528 9.57095 1.61375 10.2217 2.44422 10.2217H4.17756C4.32483 10.2217 4.44422 10.1023 4.44422 9.95506V9.15509C4.44422 9.00782 4.32483 8.88844 4.17756 8.88844H2.44422L2.40428 8.88486C2.30061 8.86604 2.222 8.77531 2.222 8.66623V5.05009L0.888669 3.71681Z',
605-
fill: 'currentColor',
606-
}),
607-
h('path', {
608-
d: 'M5.33311 8.16107V12.6661L5.33542 12.7514C5.37972 13.5708 6.0582 14.2216 6.88867 14.2216H11.3938L10.0605 12.8883H6.88867L6.84872 12.8847C6.74506 12.8659 6.66645 12.7751 6.66645 12.6661V9.49435L5.33311 8.16107Z',
609-
fill: 'currentColor',
610-
}),
611-
h('path', {
612-
d: 'M8.60626 5.77746L8.88867 6.05986V6.04411C8.88867 5.89684 8.76928 5.77746 8.622 5.77746H8.60626Z',
613-
fill: 'currentColor',
614-
}),
583+
iconReader: () => {
584+
return h('i', [
585+
h(
586+
'svg',
587+
{
588+
style: { height: '100%', width: '100%' },
589+
viewBox: '0 0 16 16',
590+
fill: 'none',
591+
xmlns: 'http://www.w3.org/2000/svg',
592+
},
593+
[
594+
h('g', { 'clip-path': 'url(#clip0_10754_9765)' }, [
595+
h('path', {
596+
d: 'M1.23567 0.764126L0.76429 1.23549C0.634122 1.36565 0.634122 1.57668 0.76429 1.70685L13.9629 14.905C14.0931 15.0351 14.3042 15.0351 14.4343 14.905L14.9057 14.4336C15.0359 14.3034 15.0359 14.0924 14.9057 13.9622L1.70705 0.764126C1.57688 0.633963 1.36584 0.633963 1.23567 0.764126Z',
597+
fill: 'currentColor',
598+
}),
599+
h('path', {
600+
d: 'M9.77756 6.94871V3.33311C9.77756 3.22403 9.69895 3.1333 9.59528 3.11448L9.55534 3.1109H5.93959L4.60626 1.77762H9.55534C10.3858 1.77762 11.0643 2.42839 11.1086 3.24777L11.1109 3.33311V8.28199L9.77756 6.94871Z',
601+
fill: 'currentColor',
602+
}),
603+
h('path', {
604+
d: 'M0.888669 3.71681V8.66623L0.890971 8.75157C0.93528 9.57095 1.61375 10.2217 2.44422 10.2217H4.17756C4.32483 10.2217 4.44422 10.1023 4.44422 9.95506V9.15509C4.44422 9.00782 4.32483 8.88844 4.17756 8.88844H2.44422L2.40428 8.88486C2.30061 8.86604 2.222 8.77531 2.222 8.66623V5.05009L0.888669 3.71681Z',
605+
fill: 'currentColor',
606+
}),
607+
h('path', {
608+
d: 'M5.33311 8.16107V12.6661L5.33542 12.7514C5.37972 13.5708 6.0582 14.2216 6.88867 14.2216H11.3938L10.0605 12.8883H6.88867L6.84872 12.8847C6.74506 12.8659 6.66645 12.7751 6.66645 12.6661V9.49435L5.33311 8.16107Z',
609+
fill: 'currentColor',
610+
}),
611+
h('path', {
612+
d: 'M8.60626 5.77746L8.88867 6.05986V6.04411C8.88867 5.89684 8.76928 5.77746 8.622 5.77746H8.60626Z',
613+
fill: 'currentColor',
614+
}),
615+
h('path', {
616+
d: 'M15.5542 12.7251L14.222 11.393V7.33295C14.222 7.22386 14.1434 7.13313 14.0397 7.11431L13.9998 7.11073H12.2664C12.1192 7.11073 11.9998 6.99135 11.9998 6.84408V6.04411C11.9998 5.89684 12.1192 5.77746 12.2664 5.77746H13.9998C14.8303 5.77746 15.5087 6.42822 15.553 7.2476L15.5553 7.33295V12.6661C15.5553 12.6858 15.555 12.7055 15.5542 12.7251Z',
617+
fill: 'currentColor',
618+
}),
619+
]),
620+
h('defs', [
621+
h('clipPath', { id: 'clip0_10754_9765' }, [
622+
h('rect', { width: '16', height: '15.9993', fill: 'currentColor' }),
623+
]),
624+
]),
625+
],
626+
),
627+
])
628+
},
629+
},
630+
'app-batch-delete': {
631+
iconReader: () => {
632+
return h('i', [
633+
h(
634+
'svg',
635+
{
636+
style: { height: '100%', width: '100%' },
637+
viewBox: '0 0 1024 1024',
638+
version: '1.1',
639+
xmlns: 'http://www.w3.org/2000/svg',
640+
},
641+
[
615642
h('path', {
616-
d: 'M15.5542 12.7251L14.222 11.393V7.33295C14.222 7.22386 14.1434 7.13313 14.0397 7.11431L13.9998 7.11073H12.2664C12.1192 7.11073 11.9998 6.99135 11.9998 6.84408V6.04411C11.9998 5.89684 12.1192 5.77746 12.2664 5.77746H13.9998C14.8303 5.77746 15.5087 6.42822 15.553 7.2476L15.5553 7.33295V12.6661C15.5553 12.6858 15.555 12.7055 15.5542 12.7251Z',
643+
d: 'M597.333333 106.666667h277.333334a42.666667 42.666667 0 0 1 42.666666 42.666666V426.666667a42.666667 42.666667 0 0 1-42.666666 42.666666H597.333333a42.666667 42.666667 0 0 1-42.666666-42.666666V149.333333a42.666667 42.666667 0 0 1 42.666666-42.666666zM640 384h192V192H640V384zM149.333333 554.666667H426.666667a42.666667 42.666667 0 0 1 42.666666 42.666666v277.333334a42.666667 42.666667 0 0 1-42.666666 42.666666H149.333333a42.666667 42.666667 0 0 1-42.666666-42.666666V597.333333a42.666667 42.666667 0 0 1 42.666666-42.666666z m42.666667 277.333333H384V640H192v192z m682.666667-277.333333H597.333333a42.666667 42.666667 0 0 0-42.666666 42.666666v277.333334a42.666667 42.666667 0 0 0 42.666666 42.666666h277.333334a42.666667 42.666667 0 0 0 42.666666-42.666666V597.333333a42.666667 42.666667 0 0 0-42.666666-42.666666zM640 832V640h192v192H640zM107.306667 300.202667a21.333333 21.333333 0 0 1 0-30.208l30.165333-30.165334a21.333333 21.333333 0 0 1 30.165333 0L243.072 315.306667 409.002667 149.333333a21.333333 21.333333 0 0 1 30.165333 0l30.165333 30.165334a21.333333 21.333333 0 0 1 0 30.165333l-211.2 211.2a21.333333 21.333333 0 0 1-30.165333 0L107.306667 300.202667z',
617644
fill: 'currentColor',
618645
}),
619-
]),
620-
h('defs', [
621-
h('clipPath', { id: 'clip0_10754_9765' }, [
622-
h('rect', { width: '16', height: '15.9993', fill: 'currentColor' }),
623-
]),
624-
]),
625-
],
626-
),
627-
])
646+
],
647+
),
648+
])
649+
},
628650
},
629-
},
630651
// 动态加载的图标
631652
...dynamicIcons,
632653
}

ui/src/components/card-box/index.vue

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@
3838
<slot name="footer"></slot>
3939
</div>
4040
<div @mouseenter="subHoveredEnter">
41-
<slot name="mouseEnter" v-if="$slots.mouseEnter && show" />
41+
<slot name="mouseEnter" v-if="$slots.mouseEnter && show" />
4242
</div>
4343
</div>
4444
</el-card>
4545
</template>
4646
<script setup lang="ts">
47-
import { ref, useSlots } from 'vue'
47+
import { ref, watch } from 'vue'
4848
import { t } from '@/locales'
4949
defineOptions({ name: 'CardBox' })
5050
const props = withDefaults(
@@ -61,14 +61,25 @@ const props = withDefaults(
6161
* 是否展示icon
6262
*/
6363
showIcon?: boolean
64+
disabled?: boolean
6465
}>(),
65-
{ title: t('common.title'), description: '', showIcon: true, border: true },
66+
{ title: t('common.title'), description: '', showIcon: true, border: true, disabled: false },
6667
)
6768
69+
watch(
70+
() => props.disabled,
71+
(val) => {
72+
if (val) {
73+
show.value = false
74+
subHovered.value = false
75+
}
76+
},
77+
)
6878
const show = ref(false)
6979
// card上面存在dropdown菜单
7080
const subHovered = ref(false)
7181
function cardEnter() {
82+
if (props.disabled) return
7283
show.value = true
7384
subHovered.value = false
7485
}

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

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,14 @@ const treeRef = ref()
5252
const loading = ref(false)
5353
const dialogVisible = ref(false)
5454
const folderList = ref<any[]>([])
55-
const detail = ref<any>({})
55+
const detail = ref<any>(null) // 保存交互所需信息:批量操作是id_list
5656
const selectForderId = ref<any>('')
5757
const currentNodeKey = ref<string>('')
58+
const isBatch = ref(false)
5859
5960
watch(dialogVisible, (bool) => {
6061
if (!bool) {
61-
detail.value = {}
62+
detail.value = null
6263
selectForderId.value = ''
6364
folderList.value = []
6465
currentNodeKey.value = ''
@@ -70,6 +71,7 @@ const isFolder = ref<boolean>(false)
7071
7172
const open = (data: any, is_folder?: any) => {
7273
detail.value = data
74+
isBatch.value = data?.id_list
7375
isFolder.value = is_folder
7476
getFolder()
7577
dialogVisible.value = true
@@ -124,11 +126,19 @@ const submitHandle = async () => {
124126
})
125127
}
126128
} else if (props.source === SourceTypeEnum.TOOL) {
127-
ToolApi.putTool(detail.value.id, obj, loading).then(() => {
128-
MsgSuccess(t('common.saveSuccess'))
129-
emit('refresh', detail.value)
130-
dialogVisible.value = false
131-
})
129+
if (isBatch.value) {
130+
ToolApi.putMulMoveTool(obj, loading).then(() => {
131+
MsgSuccess(t('common.saveSuccess'))
132+
emit('refresh')
133+
dialogVisible.value = false
134+
})
135+
} else {
136+
ToolApi.putTool(detail.value.id, obj, loading).then(() => {
137+
MsgSuccess(t('common.saveSuccess'))
138+
emit('refresh', detail.value)
139+
dialogVisible.value = false
140+
})
141+
}
132142
} else if (props.source === SourceTypeEnum.APPLICATION) {
133143
ApplicationApi.moveApplication(detail.value.id, obj.folder_id, loading).then((res) => {
134144
MsgSuccess(t('common.saveSuccess'))

ui/src/locales/lang/en-US/common.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default {
3838
paramSetting: 'Parameter Settings',
3939
name: 'Name',
4040
creator: 'Creator',
41-
createdIn:'created in',
41+
createdIn: 'created in',
4242
author: 'Author',
4343
debug: 'Debug',
4444
required: 'Required',
@@ -113,6 +113,7 @@ export default {
113113
username: 'username',
114114
importCreate: 'Import Create',
115115
detail: 'Detail',
116+
total: 'Total',
116117
selected: 'Selected',
117118
notFound: {
118119
title: '404',

ui/src/locales/lang/zh-CN/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export default {
114114
username: '用户名',
115115
importCreate: '导入创建',
116116
detail: '详情',
117+
total: '共',
117118
selected: '已选',
118119
notFound: {
119120
title: '404',

ui/src/locales/lang/zh-Hant/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export default {
113113
username: '用戶名',
114114
importCreate: '導入創建',
115115
detail: '详情',
116+
total: '共',
116117
selected: '已選',
117118
notFound: {
118119
title: '404',

ui/src/styles/component.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@
55
.el-select__wrapper {
66
box-shadow: none !important;
77
border-radius: 0 var(--el-border-radius-base) var(--el-border-radius-base) 0;
8+
min-height: 30px !important;
89
}
910
.el-input__wrapper {
1011
box-shadow: none !important;
1112
border-radius: 0 var(--el-border-radius-base) var(--el-border-radius-base) 0;
1213
}
14+
.el-input__inner {
15+
height: 28px !important;
16+
}
1317
&__left {
1418
border-right: 1px solid var(--el-border-color);
1519
.el-select__wrapper {
@@ -393,3 +397,17 @@
393397
color: var(--el-color-primary-light-5);
394398
}
395399
}
400+
401+
// 批量操作拦
402+
.mul-operation {
403+
position: fixed;
404+
margin-left: var(--sidebar-width);
405+
bottom: 0;
406+
right: 0;
407+
width: calc(100% - var(--sidebar-width));
408+
padding: 16px 24px;
409+
box-sizing: border-box;
410+
background: #ffffff;
411+
z-index: 22;
412+
box-shadow: 0px -2px 4px 0px rgba(var(--el-text-color-primary-rgb), 0.08);
413+
}

ui/src/views/application/template-store/TemplateStoreDialog.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ defineExpose({ open })
301301
302302
&.is-active {
303303
color: var(--el-color-primary);
304+
// TODO
304305
background-color: #3370ff1a;
305306
}
306307
}

0 commit comments

Comments
 (0)