vue-agent-start 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +30 -0
- package/pnpm-workspace.yaml +3 -0
- package/src/agent-flow/adapter/backend.ts +99 -0
- package/src/agent-flow/components/ChatIframePanel.vue +773 -0
- package/src/agent-flow/components/DatasetItemCard.vue +313 -0
- package/src/agent-flow/components/MemoryWindow.vue +104 -0
- package/src/agent-flow/components/PromptEditor.vue +804 -0
- package/src/agent-flow/components/PromptEditorTagPanel.vue +460 -0
- package/src/agent-flow/components/SvgIcon.vue +32 -0
- package/src/agent-flow/components/ToolItemCard.vue +169 -0
- package/src/agent-flow/components/VariableCard.vue +161 -0
- package/src/agent-flow/components/VariableSelector.vue +162 -0
- package/src/agent-flow/components/chat-iframe-types.ts +35 -0
- package/src/agent-flow/components/stubs/DatasetChooser.vue +70 -0
- package/src/agent-flow/components/stubs/Embedding.vue +22 -0
- package/src/agent-flow/components/stubs/ModelSelect.vue +24 -0
- package/src/agent-flow/components/stubs/RestfulSelectCard.vue +24 -0
- package/src/agent-flow/components/stubs/ToolChooser.vue +96 -0
- package/src/agent-flow/components/stubs/TriggersItemCard.vue +126 -0
- package/src/agent-flow/components/stubs/VariableModal.vue +115 -0
- package/src/agent-flow/index.ts +73 -0
- package/src/agent-flow/stores/workflow.ts +72 -0
- package/src/agent-flow/utils/langUtils.ts +173 -0
- package/src/agent-flow/workflow/Ability.vue +65 -0
- package/src/agent-flow/workflow/AuthorizationItem.vue +101 -0
- package/src/agent-flow/workflow/ConversationVar.vue +42 -0
- package/src/agent-flow/workflow/CustomEdge.vue +94 -0
- package/src/agent-flow/workflow/EnvironmentVar.vue +40 -0
- package/src/agent-flow/workflow/FlowDesigner.vue +2802 -0
- package/src/agent-flow/workflow/Icon.vue +179 -0
- package/src/agent-flow/workflow/NodeConfig.vue +509 -0
- package/src/agent-flow/workflow/NodeConfigCard.vue +460 -0
- package/src/agent-flow/workflow/NodeHandle.vue +147 -0
- package/src/agent-flow/workflow/NodeHeaderToolbar.vue +77 -0
- package/src/agent-flow/workflow/NodeHoverToolbar.vue +176 -0
- package/src/agent-flow/workflow/OutputItemCard.vue +668 -0
- package/src/agent-flow/workflow/ParamTableItem.vue +200 -0
- package/src/agent-flow/workflow/StructTable.vue +202 -0
- package/src/agent-flow/workflow/VarInsertField.vue +517 -0
- package/src/agent-flow/workflow/VarSelectField.vue +223 -0
- package/src/agent-flow/workflow/VariableSelectorItem.vue +48 -0
- package/src/agent-flow/workflow/WfField.vue +206 -0
- package/src/agent-flow/workflow/_config-base.css +470 -0
- package/src/agent-flow/workflow/composables/useNode.js +55 -0
- package/src/agent-flow/workflow/index.vue +53 -0
- package/src/agent-flow/workflow/nodeCard/AgentNodeCard.vue +180 -0
- package/src/agent-flow/workflow/nodeCard/AnswerNodeCard.vue +65 -0
- package/src/agent-flow/workflow/nodeCard/ClassifierCard.vue +152 -0
- package/src/agent-flow/workflow/nodeCard/CodeNodeCard.vue +139 -0
- package/src/agent-flow/workflow/nodeCard/ConditionNodeCard.vue +323 -0
- package/src/agent-flow/workflow/nodeCard/DocumentExtractorCard.vue +83 -0
- package/src/agent-flow/workflow/nodeCard/EndNodeCard.vue +123 -0
- package/src/agent-flow/workflow/nodeCard/HttpNodeCard.vue +451 -0
- package/src/agent-flow/workflow/nodeCard/HumanInputCard.vue +152 -0
- package/src/agent-flow/workflow/nodeCard/IterationCard.vue +66 -0
- package/src/agent-flow/workflow/nodeCard/KnowledgeRetrievalCard.vue +48 -0
- package/src/agent-flow/workflow/nodeCard/LLMNodeCard.vue +206 -0
- package/src/agent-flow/workflow/nodeCard/ListOperatorCard.vue +188 -0
- package/src/agent-flow/workflow/nodeCard/ParameterExtractorCard.vue +352 -0
- package/src/agent-flow/workflow/nodeCard/ServiceApiNodeCard.vue +188 -0
- package/src/agent-flow/workflow/nodeCard/StartNodeCard.vue +216 -0
- package/src/agent-flow/workflow/nodeCard/VariableAssignerCard.vue +125 -0
- package/src/agent-flow/workflow/nodeCard/VariableNodeCard.vue +121 -0
- package/src/agent-flow/workflow/nodes/AgentNode.vue +122 -0
- package/src/agent-flow/workflow/nodes/AnswerNode.vue +99 -0
- package/src/agent-flow/workflow/nodes/ClassifierNode.vue +199 -0
- package/src/agent-flow/workflow/nodes/CodeNode.vue +152 -0
- package/src/agent-flow/workflow/nodes/ConditionNode.vue +232 -0
- package/src/agent-flow/workflow/nodes/DocumentExtractorNode.vue +96 -0
- package/src/agent-flow/workflow/nodes/EndNode.vue +119 -0
- package/src/agent-flow/workflow/nodes/FileUploadNode.vue +97 -0
- package/src/agent-flow/workflow/nodes/HttpNode.vue +204 -0
- package/src/agent-flow/workflow/nodes/HumanInputNode.vue +110 -0
- package/src/agent-flow/workflow/nodes/IterationNode.vue +98 -0
- package/src/agent-flow/workflow/nodes/KnowledgeRetrievalNode.vue +253 -0
- package/src/agent-flow/workflow/nodes/LLMNode.vue +134 -0
- package/src/agent-flow/workflow/nodes/ListOperatorNode.vue +111 -0
- package/src/agent-flow/workflow/nodes/LoopNode.vue +94 -0
- package/src/agent-flow/workflow/nodes/ParameterExtractorNode.vue +147 -0
- package/src/agent-flow/workflow/nodes/ServiceApiNode.vue +161 -0
- package/src/agent-flow/workflow/nodes/StartNode.vue +199 -0
- package/src/agent-flow/workflow/nodes/TemplateNode.vue +103 -0
- package/src/agent-flow/workflow/nodes/UserInputNode.vue +92 -0
- package/src/agent-flow/workflow/nodes/VariableAssignerNode.vue +145 -0
- package/src/agent-flow/workflow/nodes/VariableNode.vue +130 -0
- package/src/agent-flow/workflow/nodes/_node-base.css +338 -0
- package/src/agent-flow/workflow/utils/node_card_form.ts +335 -0
- package/src/agent-flow/workflow/utils/node_config.ts +63 -0
- package/src/agent-flow/workflow/utils/workflow_utils.ts +151 -0
- package/src/agent-studio/adapters/springAgentStart.ts +390 -0
- package/src/agent-studio/api/index.ts +1 -0
- package/src/agent-studio/api/types.ts +173 -0
- package/src/agent-studio/components/AgentApiDocs.vue +500 -0
- package/src/agent-studio/components/AgentAppsPage.vue +1601 -0
- package/src/agent-studio/components/AgentCardGrid.vue +259 -0
- package/src/agent-studio/components/AgentChatPage.vue +553 -0
- package/src/agent-studio/components/AgentDebugPanel.vue +350 -0
- package/src/agent-studio/components/AgentLogsPanel.vue +391 -0
- package/src/agent-studio/components/AgentMonitorPanel.vue +204 -0
- package/src/agent-studio/components/AgentOrchestrate.vue +505 -0
- package/src/agent-studio/components/AgentPromptEditor.vue +237 -0
- package/src/agent-studio/components/AgentStudioShell.vue +227 -0
- package/src/agent-studio/components/AgentToolsPanel.vue +394 -0
- package/src/agent-studio/components/AgentVariablesPanel.vue +205 -0
- package/src/agent-studio/components/ApiKeyManager.vue +251 -0
- package/src/agent-studio/components/AppDesignDrawer.vue +3391 -0
- package/src/agent-studio/components/CreateAppModal.vue +737 -0
- package/src/agent-studio/components/SparkChart.vue +200 -0
- package/src/agent-studio/components/VariableEditorModal.vue +499 -0
- package/src/agent-studio/composables/useAgentStudio.ts +347 -0
- package/src/agent-studio/index.ts +60 -0
- package/src/agent-studio/panels/DrawerFlowDesigner.vue +203 -0
- package/src/agent-studio/panels/LogAnnotationPanel.vue +490 -0
- package/src/agent-studio/panels/MonitorPanel.vue +535 -0
- package/src/agent-studio/types.ts +242 -0
- package/src/index.ts +155 -0
- package/src/knowledge-hub/adapters/springAgentStart.ts +472 -0
- package/src/knowledge-hub/components/AddDocumentsWizard.vue +1452 -0
- package/src/knowledge-hub/components/CreateDatasetWizard.vue +1723 -0
- package/src/knowledge-hub/components/DatasetCardGrid.vue +467 -0
- package/src/knowledge-hub/components/DatasetDetailDrawer.vue +888 -0
- package/src/knowledge-hub/components/DatasetPicker.vue +65 -0
- package/src/knowledge-hub/components/DatasetPickerModal.vue +526 -0
- package/src/knowledge-hub/components/DatasetSettingsPanel.vue +908 -0
- package/src/knowledge-hub/components/DatasetSidebar.vue +781 -0
- package/src/knowledge-hub/components/DocumentChunksView.vue +802 -0
- package/src/knowledge-hub/components/DocumentTable.vue +552 -0
- package/src/knowledge-hub/components/HitTestingPanel.vue +74 -0
- package/src/knowledge-hub/components/KnowledgeApp.vue +66 -0
- package/src/knowledge-hub/components/KnowledgeHubApp.vue +504 -0
- package/src/knowledge-hub/components/RecallTestingPanelV2.vue +515 -0
- package/src/knowledge-hub/components/RetrievalConfigPopover.vue +270 -0
- package/src/knowledge-hub/components/RetrievalMethodPicker.vue +547 -0
- package/src/knowledge-hub/components/RetrievedList.vue +24 -0
- package/src/knowledge-hub/components/internal/KhDialog.vue +195 -0
- package/src/knowledge-hub/composables/useKnowledge.ts +89 -0
- package/src/knowledge-hub/i18n/index.ts +2 -0
- package/src/knowledge-hub/i18n/messages.ts +422 -0
- package/src/knowledge-hub/i18n/useKhI18n.ts +107 -0
- package/src/knowledge-hub/index.ts +46 -0
- package/src/knowledge-hub/styles/index.css +4 -0
- package/src/knowledge-hub/styles/tokens.css +138 -0
- package/src/knowledge-hub/types/api.ts +213 -0
- package/src/knowledge-hub/types/dataset.ts +88 -0
- package/src/knowledge-hub/types/document.ts +45 -0
- package/src/knowledge-hub/types/index.ts +9 -0
- package/src/knowledge-hub/types/retrieval.ts +46 -0
- package/src/provider-hub/components/CredentialForm.vue +103 -0
- package/src/provider-hub/components/DefaultModelsPanel.vue +270 -0
- package/src/provider-hub/components/GroupedModelSelect.vue +445 -0
- package/src/provider-hub/components/ModelCardGrid.vue +332 -0
- package/src/provider-hub/components/ModelParameterDrawer.vue +739 -0
- package/src/provider-hub/components/ModelPickerPopover.vue +1282 -0
- package/src/provider-hub/components/ProviderApp.vue +159 -0
- package/src/provider-hub/components/ProviderCredentialModal.vue +321 -0
- package/src/provider-hub/components/ProviderGallery.vue +131 -0
- package/src/provider-hub/components/ProviderHubShell.vue +1992 -0
- package/src/provider-hub/components/ProviderIcon.vue +130 -0
- package/src/provider-hub/composables/useProviderHub.ts +358 -0
- package/src/provider-hub/index.ts +43 -0
- package/src/provider-hub/svg/MiniMax.svg +1 -0
- package/src/provider-hub/svg/Volcengine.svg +1 -0
- package/src/provider-hub/svg/Zhipu.svg +1 -0
- package/src/provider-hub/svg/deepseek.svg +1 -0
- package/src/provider-hub/svg/moonshot.svg +1 -0
- package/src/provider-hub/svg/openai.svg +1 -0
- package/src/provider-hub/svg/qwen.svg +1 -0
- package/src/provider-hub/svg/siliconflow.svg +1 -0
- package/src/provider-hub/types.ts +256 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { getCurrentModel } from '@/adapter/backend';
|
|
3
|
+
import MemoryWindow from '@/components/MemoryWindow.vue';
|
|
4
|
+
import PromptEditor from '@/components/PromptEditor.vue';
|
|
5
|
+
import ToolItemCard from '@/components/ToolItemCard.vue';
|
|
6
|
+
import ModelPickerPopover from '../../../provider-hub/components/ModelPickerPopover.vue';
|
|
7
|
+
import WfField from '@/workflow/WfField.vue';
|
|
8
|
+
import workflow_utils from '@/workflow/utils/workflow_utils';
|
|
9
|
+
|
|
10
|
+
defineProps<{ nodeId?: string }>();
|
|
11
|
+
|
|
12
|
+
const formState: any = defineModel();
|
|
13
|
+
|
|
14
|
+
const loadDefaultModel = async () => {
|
|
15
|
+
const res: any = await getCurrentModel('LLM');
|
|
16
|
+
const data = res?.data ?? {};
|
|
17
|
+
if (!formState.value.model) formState.value.model = {};
|
|
18
|
+
formState.value.model.modelName = data.modelName;
|
|
19
|
+
formState.value.model.provider = data.provider ?? data.providerName;
|
|
20
|
+
formState.value.model.providerName = data.provider ?? data.providerName;
|
|
21
|
+
formState.value.model.modelProvider = data.provider ?? data.providerName;
|
|
22
|
+
formState.value.model.modelType = data.modelType ?? 'LLM';
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const OUTPUT_DEFAULTS = [
|
|
26
|
+
{ name: 'text', type: 'String', label: '生成内容' },
|
|
27
|
+
{ name: 'files', type: 'Array[File]', label: 'Agent 生成的文件' },
|
|
28
|
+
{ name: 'json', type: 'Array[Object]', label: 'Agent 生成的 JSON' },
|
|
29
|
+
];
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<div class="wf-config-section">
|
|
34
|
+
<WfField title="Agent 策略" required>
|
|
35
|
+
<template #tooltip>
|
|
36
|
+
推理循环的实现方式。ReAct 用观察-思考-行动多轮;FunctionCalling 由模型直接触发工具。
|
|
37
|
+
</template>
|
|
38
|
+
<a-select
|
|
39
|
+
v-model:value="formState.agentStrategy"
|
|
40
|
+
:options="workflow_utils.agentStrategy"
|
|
41
|
+
style="width: 100%"
|
|
42
|
+
/>
|
|
43
|
+
</WfField>
|
|
44
|
+
|
|
45
|
+
<WfField title="模型" required>
|
|
46
|
+
<template #operations>
|
|
47
|
+
<a-button type="link" size="small" @click="loadDefaultModel">
|
|
48
|
+
使用默认
|
|
49
|
+
</a-button>
|
|
50
|
+
</template>
|
|
51
|
+
<ModelPickerPopover
|
|
52
|
+
v-model="formState.model"
|
|
53
|
+
model-type="LLM"
|
|
54
|
+
placeholder="点击选择 Agent 模型"
|
|
55
|
+
:width="440"
|
|
56
|
+
/>
|
|
57
|
+
</WfField>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<div class="wf-config-section">
|
|
61
|
+
<WfField title="工具">
|
|
62
|
+
<template #tooltip>
|
|
63
|
+
Agent 可调用的工具集合,运行时按模型返回决定调用哪个。
|
|
64
|
+
</template>
|
|
65
|
+
<ToolItemCard v-model="formState" />
|
|
66
|
+
</WfField>
|
|
67
|
+
|
|
68
|
+
<WfField title="MCP Server" is-subtitle>
|
|
69
|
+
<template #tooltip>
|
|
70
|
+
追加 MCP Server 配置(JSON),会自动融合入工具集。
|
|
71
|
+
</template>
|
|
72
|
+
<a-textarea
|
|
73
|
+
v-model:value="formState.agentParameters.mcpServersConfig"
|
|
74
|
+
placeholder='{"servers": [...]}'
|
|
75
|
+
:auto-size="{ minRows: 3, maxRows: 8 }"
|
|
76
|
+
/>
|
|
77
|
+
</WfField>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<PromptEditor
|
|
81
|
+
class="wf-config-prompt"
|
|
82
|
+
title="SYSTEM"
|
|
83
|
+
:node-id="nodeId"
|
|
84
|
+
v-model="formState.systemPrompt.text"
|
|
85
|
+
/>
|
|
86
|
+
|
|
87
|
+
<PromptEditor
|
|
88
|
+
class="wf-config-prompt"
|
|
89
|
+
title="USER"
|
|
90
|
+
:node-id="nodeId"
|
|
91
|
+
v-model="formState.userPrompt.text"
|
|
92
|
+
/>
|
|
93
|
+
|
|
94
|
+
<div class="wf-config-section">
|
|
95
|
+
<WfField title="对话记忆">
|
|
96
|
+
<MemoryWindow v-model="formState.memory" />
|
|
97
|
+
</WfField>
|
|
98
|
+
|
|
99
|
+
<WfField title="最大迭代次数" is-subtitle>
|
|
100
|
+
<template #tooltip>
|
|
101
|
+
单次运行内 Agent 最多进行多少轮 think/act。防止死循环。
|
|
102
|
+
</template>
|
|
103
|
+
<div class="agent-slider-row">
|
|
104
|
+
<a-slider
|
|
105
|
+
v-model:value="formState.memory.windows"
|
|
106
|
+
:step="1"
|
|
107
|
+
:min="1"
|
|
108
|
+
:max="20"
|
|
109
|
+
style="flex: 1"
|
|
110
|
+
/>
|
|
111
|
+
<a-input-number
|
|
112
|
+
v-model:value="formState.memory.windows"
|
|
113
|
+
:min="1"
|
|
114
|
+
:max="20"
|
|
115
|
+
size="small"
|
|
116
|
+
style="width: 88px"
|
|
117
|
+
/>
|
|
118
|
+
</div>
|
|
119
|
+
</WfField>
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<div class="wf-config-section">
|
|
123
|
+
<WfField title="输出变量" foldable default-fold>
|
|
124
|
+
<div class="agent-output-list">
|
|
125
|
+
<div
|
|
126
|
+
v-for="it in OUTPUT_DEFAULTS"
|
|
127
|
+
:key="it.name"
|
|
128
|
+
class="agent-output-item"
|
|
129
|
+
>
|
|
130
|
+
<div class="agent-output-row">
|
|
131
|
+
<span class="agent-output-name">{{ it.name }}</span>
|
|
132
|
+
<a-tag>{{ it.type }}</a-tag>
|
|
133
|
+
</div>
|
|
134
|
+
<div class="agent-output-desc">{{ it.label }}</div>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</WfField>
|
|
138
|
+
</div>
|
|
139
|
+
</template>
|
|
140
|
+
|
|
141
|
+
<style scoped>
|
|
142
|
+
.agent-slider-row {
|
|
143
|
+
display: flex;
|
|
144
|
+
align-items: center;
|
|
145
|
+
gap: 12px;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.agent-output-list {
|
|
149
|
+
display: flex;
|
|
150
|
+
flex-direction: column;
|
|
151
|
+
gap: 6px;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.agent-output-item {
|
|
155
|
+
padding: 6px 10px;
|
|
156
|
+
background: #f9fafb;
|
|
157
|
+
border: 1px solid #f0f0f0;
|
|
158
|
+
border-radius: 6px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.agent-output-row {
|
|
162
|
+
display: flex;
|
|
163
|
+
align-items: center;
|
|
164
|
+
justify-content: space-between;
|
|
165
|
+
gap: 8px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.agent-output-name {
|
|
169
|
+
font-size: 12px;
|
|
170
|
+
font-weight: 500;
|
|
171
|
+
color: #1f2937;
|
|
172
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.agent-output-desc {
|
|
176
|
+
margin-top: 2px;
|
|
177
|
+
font-size: 11px;
|
|
178
|
+
color: #6b7280;
|
|
179
|
+
}
|
|
180
|
+
</style>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import PromptEditor from '@/components/PromptEditor.vue';
|
|
3
|
+
import WfField from '@/workflow/WfField.vue';
|
|
4
|
+
|
|
5
|
+
defineProps({
|
|
6
|
+
attrListGroup: {
|
|
7
|
+
type: Array,
|
|
8
|
+
default: () => [],
|
|
9
|
+
},
|
|
10
|
+
/** 当前节点 id —— 变量插入面板需要,由 NodeConfigCard 从 selectNode.id 传下来。 */
|
|
11
|
+
nodeId: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: '',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const formState: any = defineModel();
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<PromptEditor
|
|
22
|
+
class="wf-config-prompt"
|
|
23
|
+
title="ANSWER"
|
|
24
|
+
:node-id="nodeId"
|
|
25
|
+
v-model="formState.answer"
|
|
26
|
+
/>
|
|
27
|
+
|
|
28
|
+
<div class="wf-config-section">
|
|
29
|
+
<WfField title="输出" foldable default-fold>
|
|
30
|
+
<template #tooltip>
|
|
31
|
+
Answer 节点默认输出 <code>text</code> 字段,供下游节点引用。
|
|
32
|
+
</template>
|
|
33
|
+
<div class="answer-output">
|
|
34
|
+
<span class="answer-output-name">text</span>
|
|
35
|
+
<a-tag>string</a-tag>
|
|
36
|
+
<span class="answer-output-desc">回复文本</span>
|
|
37
|
+
</div>
|
|
38
|
+
</WfField>
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<style scoped>
|
|
43
|
+
.answer-output {
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
gap: 8px;
|
|
47
|
+
padding: 6px 10px;
|
|
48
|
+
background: #f9fafb;
|
|
49
|
+
border: 1px solid #f0f0f0;
|
|
50
|
+
border-radius: 6px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.answer-output-name {
|
|
54
|
+
font-size: 12px;
|
|
55
|
+
font-weight: 500;
|
|
56
|
+
color: #1f2937;
|
|
57
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.answer-output-desc {
|
|
61
|
+
margin-left: auto;
|
|
62
|
+
font-size: 11px;
|
|
63
|
+
color: #6b7280;
|
|
64
|
+
}
|
|
65
|
+
</style>
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { h } from 'vue';
|
|
3
|
+
|
|
4
|
+
import { DeleteOutlined, PlusOutlined } from '@ant-design/icons-vue';
|
|
5
|
+
|
|
6
|
+
import { getCurrentModel } from '@/adapter/backend';
|
|
7
|
+
import PromptEditor from '@/components/PromptEditor.vue';
|
|
8
|
+
import ModelPickerPopover from '../../../provider-hub/components/ModelPickerPopover.vue';
|
|
9
|
+
import WfField from '@/workflow/WfField.vue';
|
|
10
|
+
|
|
11
|
+
defineProps<{ nodeId?: string }>();
|
|
12
|
+
|
|
13
|
+
const formState: any = defineModel();
|
|
14
|
+
|
|
15
|
+
const loadDefaultModel = async () => {
|
|
16
|
+
const res: any = await getCurrentModel('LLM');
|
|
17
|
+
const data = res?.data ?? {};
|
|
18
|
+
if (!formState.value.model) formState.value.model = {};
|
|
19
|
+
formState.value.model.modelName = data.modelName;
|
|
20
|
+
formState.value.model.provider = data.provider ?? data.providerName;
|
|
21
|
+
formState.value.model.providerName = data.provider ?? data.providerName;
|
|
22
|
+
formState.value.model.modelProvider = data.provider ?? data.providerName;
|
|
23
|
+
formState.value.model.modelType = data.modelType ?? 'LLM';
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const addClass = () => {
|
|
27
|
+
if (!Array.isArray(formState.value.classes)) formState.value.classes = [];
|
|
28
|
+
formState.value.classes.push({
|
|
29
|
+
id: formState.value.classes.length + 1,
|
|
30
|
+
name: '',
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const removeClass = (index: number) => {
|
|
35
|
+
formState.value.classes.splice(index, 1);
|
|
36
|
+
};
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<template>
|
|
40
|
+
<div class="wf-config-section">
|
|
41
|
+
<WfField title="模型" required>
|
|
42
|
+
<template #operations>
|
|
43
|
+
<a-button type="link" size="small" @click="loadDefaultModel">
|
|
44
|
+
使用默认
|
|
45
|
+
</a-button>
|
|
46
|
+
</template>
|
|
47
|
+
<ModelPickerPopover
|
|
48
|
+
v-model="formState.model"
|
|
49
|
+
model-type="LLM"
|
|
50
|
+
placeholder="点击选择分类模型"
|
|
51
|
+
:width="440"
|
|
52
|
+
/>
|
|
53
|
+
</WfField>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<PromptEditor
|
|
57
|
+
class="wf-config-prompt"
|
|
58
|
+
title="INPUT"
|
|
59
|
+
:node-id="nodeId"
|
|
60
|
+
v-model="formState.query"
|
|
61
|
+
/>
|
|
62
|
+
|
|
63
|
+
<div class="wf-config-section">
|
|
64
|
+
<WfField title="分类定义" required>
|
|
65
|
+
<template #tooltip>
|
|
66
|
+
逐条描述每个类别;模型根据描述将输入归到匹配度最高的类。
|
|
67
|
+
</template>
|
|
68
|
+
<template #operations>
|
|
69
|
+
<a-button
|
|
70
|
+
:icon="h(PlusOutlined)"
|
|
71
|
+
size="small"
|
|
72
|
+
type="primary"
|
|
73
|
+
@click="addClass"
|
|
74
|
+
/>
|
|
75
|
+
</template>
|
|
76
|
+
|
|
77
|
+
<div
|
|
78
|
+
v-if="!formState.classes || formState.classes.length === 0"
|
|
79
|
+
class="classifier-empty"
|
|
80
|
+
>
|
|
81
|
+
至少配置一个分类,点击右上角 + 添加
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
<div class="classifier-list">
|
|
85
|
+
<div
|
|
86
|
+
v-for="(cls, index) in formState.classes"
|
|
87
|
+
:key="cls.id ?? index"
|
|
88
|
+
class="classifier-item"
|
|
89
|
+
>
|
|
90
|
+
<div class="classifier-item-head">
|
|
91
|
+
<span class="classifier-item-name">分类 {{ index + 1 }}</span>
|
|
92
|
+
<a-button
|
|
93
|
+
:icon="h(DeleteOutlined)"
|
|
94
|
+
size="small"
|
|
95
|
+
type="text"
|
|
96
|
+
danger
|
|
97
|
+
@click="removeClass(index)"
|
|
98
|
+
/>
|
|
99
|
+
</div>
|
|
100
|
+
<PromptEditor
|
|
101
|
+
:title="`CLASS ${index + 1}`"
|
|
102
|
+
:node-id="nodeId"
|
|
103
|
+
v-model="cls.name"
|
|
104
|
+
:show-toolbar="false"
|
|
105
|
+
min-height="60px"
|
|
106
|
+
max-height="120px"
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</WfField>
|
|
111
|
+
</div>
|
|
112
|
+
</template>
|
|
113
|
+
|
|
114
|
+
<style scoped>
|
|
115
|
+
.classifier-empty {
|
|
116
|
+
padding: 12px;
|
|
117
|
+
text-align: center;
|
|
118
|
+
font-size: 12px;
|
|
119
|
+
color: #9ca3af;
|
|
120
|
+
background: #f9fafb;
|
|
121
|
+
border: 1px dashed #e5e7eb;
|
|
122
|
+
border-radius: 6px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.classifier-list {
|
|
126
|
+
display: flex;
|
|
127
|
+
flex-direction: column;
|
|
128
|
+
gap: 10px;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.classifier-item {
|
|
132
|
+
display: flex;
|
|
133
|
+
flex-direction: column;
|
|
134
|
+
gap: 6px;
|
|
135
|
+
padding: 10px;
|
|
136
|
+
background: #f9fafb;
|
|
137
|
+
border: 1px solid #f0f0f0;
|
|
138
|
+
border-radius: 6px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.classifier-item-head {
|
|
142
|
+
display: flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
justify-content: space-between;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.classifier-item-name {
|
|
148
|
+
font-size: 12px;
|
|
149
|
+
font-weight: 500;
|
|
150
|
+
color: #4b5563;
|
|
151
|
+
}
|
|
152
|
+
</style>
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { h } from 'vue';
|
|
3
|
+
|
|
4
|
+
import { DeleteOutlined, PlusOutlined } from '@ant-design/icons-vue';
|
|
5
|
+
|
|
6
|
+
import VariableSelector from '@/components/VariableSelector.vue';
|
|
7
|
+
import WfField from '@/workflow/WfField.vue';
|
|
8
|
+
|
|
9
|
+
defineProps<{ nodeId?: string }>();
|
|
10
|
+
|
|
11
|
+
const formState: any = defineModel();
|
|
12
|
+
|
|
13
|
+
const LANGUAGES = [
|
|
14
|
+
{ value: 'python', label: 'Python' },
|
|
15
|
+
{ value: 'javascript', label: 'JavaScript' },
|
|
16
|
+
{ value: 'groovy', label: 'Groovy' },
|
|
17
|
+
{ value: 'jexl', label: 'JEXL' },
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
const addVariable = () => {
|
|
21
|
+
if (!Array.isArray(formState.value.variables)) formState.value.variables = [];
|
|
22
|
+
formState.value.variables.push({
|
|
23
|
+
variable: '',
|
|
24
|
+
value_selector: [],
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const removeVariable = (index: number) => {
|
|
29
|
+
formState.value.variables.splice(index, 1);
|
|
30
|
+
};
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<div class="wf-config-section">
|
|
35
|
+
<WfField title="输入变量">
|
|
36
|
+
<template #tooltip>
|
|
37
|
+
映射到代码函数的参数名,可从上游节点变量选择。
|
|
38
|
+
</template>
|
|
39
|
+
<template #operations>
|
|
40
|
+
<a-button
|
|
41
|
+
:icon="h(PlusOutlined)"
|
|
42
|
+
size="small"
|
|
43
|
+
type="primary"
|
|
44
|
+
@click="addVariable"
|
|
45
|
+
/>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<div
|
|
49
|
+
v-if="!formState.variables || formState.variables.length === 0"
|
|
50
|
+
class="code-empty"
|
|
51
|
+
>
|
|
52
|
+
暂无输入变量
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<div class="code-var-list">
|
|
56
|
+
<div
|
|
57
|
+
v-for="(v, index) in formState.variables"
|
|
58
|
+
:key="index"
|
|
59
|
+
class="code-var-row"
|
|
60
|
+
>
|
|
61
|
+
<a-input
|
|
62
|
+
v-model:value="v.variable"
|
|
63
|
+
placeholder="参数名"
|
|
64
|
+
size="small"
|
|
65
|
+
style="width: 120px"
|
|
66
|
+
/>
|
|
67
|
+
<VariableSelector
|
|
68
|
+
v-model="v.value_selector"
|
|
69
|
+
:node-id="nodeId"
|
|
70
|
+
placeholder="选择变量"
|
|
71
|
+
style="flex: 1"
|
|
72
|
+
/>
|
|
73
|
+
<a-button
|
|
74
|
+
:icon="h(DeleteOutlined)"
|
|
75
|
+
size="small"
|
|
76
|
+
type="text"
|
|
77
|
+
danger
|
|
78
|
+
@click="removeVariable(index)"
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</WfField>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<div class="wf-config-section">
|
|
86
|
+
<WfField title="语言" is-subtitle inline>
|
|
87
|
+
<template #operations>
|
|
88
|
+
<a-select
|
|
89
|
+
v-model:value="formState.code_language"
|
|
90
|
+
:options="LANGUAGES"
|
|
91
|
+
size="small"
|
|
92
|
+
style="width: 140px"
|
|
93
|
+
/>
|
|
94
|
+
</template>
|
|
95
|
+
</WfField>
|
|
96
|
+
|
|
97
|
+
<WfField title="脚本">
|
|
98
|
+
<template #tooltip>
|
|
99
|
+
必须返回一个字典(对象),会自动映射到本节点的输出变量。
|
|
100
|
+
</template>
|
|
101
|
+
<a-textarea
|
|
102
|
+
v-model:value="formState.code"
|
|
103
|
+
:auto-size="{ minRows: 8, maxRows: 20 }"
|
|
104
|
+
class="code-textarea"
|
|
105
|
+
placeholder="def main(arg1: str, arg2: str) -> dict: return { 'result': arg1 + arg2 }"
|
|
106
|
+
/>
|
|
107
|
+
</WfField>
|
|
108
|
+
</div>
|
|
109
|
+
</template>
|
|
110
|
+
|
|
111
|
+
<style scoped>
|
|
112
|
+
.code-empty {
|
|
113
|
+
padding: 12px;
|
|
114
|
+
text-align: center;
|
|
115
|
+
font-size: 12px;
|
|
116
|
+
color: #9ca3af;
|
|
117
|
+
background: #f9fafb;
|
|
118
|
+
border: 1px dashed #e5e7eb;
|
|
119
|
+
border-radius: 6px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.code-var-list {
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: column;
|
|
125
|
+
gap: 6px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.code-var-row {
|
|
129
|
+
display: flex;
|
|
130
|
+
align-items: center;
|
|
131
|
+
gap: 6px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.code-textarea :deep(textarea) {
|
|
135
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
136
|
+
font-size: 12px;
|
|
137
|
+
line-height: 1.5;
|
|
138
|
+
}
|
|
139
|
+
</style>
|