Skip to content

Commit c631d77

Browse files
feat: Add create MCP function (#3885)
Co-authored-by: wangdan-fit2cloud <[email protected]>
1 parent 1e00a6d commit c631d77

File tree

26 files changed

+251
-151
lines changed

26 files changed

+251
-151
lines changed

ui/src/assets/icon_tool_shop.svg

Lines changed: 3 additions & 0 deletions
Loading

ui/src/assets/node/icon_tool.svg

Lines changed: 0 additions & 3 deletions
This file was deleted.

ui/src/components/ai-chat/component/prologue-content/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
:source="prologue"
1818
:send-message="sendMessage"
1919
reasoning_content=""
20+
:type="type"
2021
></MdRenderer>
2122
</el-card>
2223
</div>
@@ -35,7 +36,6 @@ const props = defineProps<{
3536
sendMessage: (question: string, other_params_data?: any, chat?: chatType) => void
3637
}>()
3738
38-
3939
const showAvatar = computed(() => {
4040
return props.application.show_avatar == undefined ? true : props.application.show_avatar
4141
})
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<template>
2+
<el-avatar v-if="type == 'MCP'" shape="square" :size="size">
3+
<img src="@/assets/workflow/icon_mcp.svg" style="width: 75%" alt="" />
4+
</el-avatar>
5+
<el-avatar v-else class="avatar-green" shape="square" :size="size">
6+
<img src="@/assets/workflow/icon_tool.svg" style="width: 58%" alt="" />
7+
</el-avatar>
8+
</template>
9+
<script setup lang="ts">
10+
defineOptions({ name: 'ToolIcon' })
11+
const props = defineProps({
12+
type: {
13+
type: [String, Number],
14+
default: '',
15+
},
16+
size: {
17+
type: [String, Number],
18+
default: 32,
19+
},
20+
})
21+
</script>

ui/src/components/folder-breadcrumb/index.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<template>
2-
<el-breadcrumb separator-icon="ArrowRight" style="line-height: 22px">
3-
<h2 v-if="breadcrumbData?.length === 1" class="ellipsis" :title="breadcrumbData[0]?.name">
4-
{{ breadcrumbData[0]?.name }}
5-
</h2>
6-
<el-breadcrumb-item v-for="(item, index) in breadcrumbData" :key="index" v-else>
2+
<h2 v-if="breadcrumbData?.length === 1" class="ellipsis" :title="breadcrumbData[0]?.name">
3+
{{ breadcrumbData[0]?.name }}
4+
</h2>
5+
<el-breadcrumb separator-icon="ArrowRight" style="line-height: normal" class="mt-4" v-else>
6+
<el-breadcrumb-item v-for="(item, index) in breadcrumbData" :key="index">
77
<h5 class="ml-4 ellipsis" v-if="index === breadcrumbData.length - 1" :title="item.name">
88
{{ item.name }}
99
</h5>

ui/src/components/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import TagEllipsis from './tag-ellipsis/index.vue'
2323
import CardCheckbox from './card-checkbox/index.vue'
2424
import AiChat from './ai-chat/index.vue'
2525
import KnowledgeIcon from './app-icon/KnowledgeIcon.vue'
26+
import ToolIcon from './app-icon/ToolIcon.vue'
2627
import TagGroup from './tag-group/index.vue'
2728
import WorkspaceDropdown from './workspace-dropdown/index.vue'
2829
import FolderBreadcrumb from './folder-breadcrumb/index.vue'
@@ -52,6 +53,7 @@ export default {
5253
app.component('CardCheckbox', CardCheckbox)
5354
app.component('AiChat', AiChat)
5455
app.component('KnowledgeIcon', KnowledgeIcon)
56+
app.component('ToolIcon', ToolIcon)
5557
app.component('TagGroup', TagGroup)
5658
app.component('WorkspaceDropdown', WorkspaceDropdown)
5759
app.component('FolderBreadcrumb', FolderBreadcrumb)

ui/src/components/markdown/MdRenderer.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
<template v-for="(item, index) in md_view_list" :key="index">
66
<div
77
v-if="item.type === 'question'"
8-
@click="sendMessage ? sendMessage(item.content, 'new') : (content: string) => {}"
8+
@click="
9+
sendMessage && type !== 'log' ? sendMessage(item.content, 'new') : (content: string) => {}
10+
"
911
class="problem-button mt-4 mb-4 flex"
10-
:class="sendMessage ? 'cursor' : 'disabled'"
12+
:class="sendMessage && type !== 'log' ? 'cursor' : 'disabled'"
1113
>
1214
<AppIcon iconName="app-edit" class="mr-8" style="margin-top: 2px"></AppIcon>
1315
{{ item.content }}
@@ -61,6 +63,7 @@ config({
6163
tokens[idx].attrSet('target', '_blank')
6264
return md.renderer.renderToken(tokens, idx, options)
6365
}
66+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
6467
document.appendChild
6568
},
6669
})
@@ -74,6 +77,7 @@ const props = withDefaults(
7477
chat_record_id?: string
7578
runtime_node_id?: string
7679
disabled?: boolean
80+
type?: 'log' | 'ai-chat' | 'debug-ai-chat'
7781
}>(),
7882
{
7983
source: '',

ui/src/layout/components/breadcrumb/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
>
1212
<img :src="resetUrl(current?.icon, resetUrl('./favicon.ico'))" alt="" />
1313
</el-avatar>
14-
<LogoIcon
14+
<!-- <LogoIcon
1515
v-else-if="isApplication"
1616
height="28px"
1717
style="width: 28px; height: 28px; display: block"
1818
class="mr-8"
19-
/>
19+
/> -->
2020
<KnowledgeIcon v-else-if="isKnowledge" :type="current?.type" class="mr-8" />
2121

2222
<div class="ellipsis" :title="current?.name">{{ current?.name }}</div>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ export default {
6868
inputPlaceholder: 'Please enter parameter values',
6969
},
7070
mcp: {
71+
title: 'MCP Service',
7172
label: 'MCP Server Config',
7273
placeholder: 'Please enter MCP Server config',
7374
tip: 'Only supports SSE and Streamable HTTP calling methods',
75+
requiredMessage: 'Please enter MCP Server Config',
7476
},
7577
debug: {
7678
run: 'Run',

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ export default {
6464
inputPlaceholder: '请输入参数值',
6565
},
6666
mcp: {
67+
title: 'MCP 服务',
6768
label: 'MCP Server Config',
6869
placeholder: '请输入MCP Server配置',
6970
tip: '仅支持SSE、Streamable HTTP调用方式',
71+
requiredMessage: '请输入 MCP Server Config',
7072
},
7173
debug: {
7274
run: '运行',

0 commit comments

Comments
 (0)