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.
Files changed (169) hide show
  1. package/package.json +30 -0
  2. package/pnpm-workspace.yaml +3 -0
  3. package/src/agent-flow/adapter/backend.ts +99 -0
  4. package/src/agent-flow/components/ChatIframePanel.vue +773 -0
  5. package/src/agent-flow/components/DatasetItemCard.vue +313 -0
  6. package/src/agent-flow/components/MemoryWindow.vue +104 -0
  7. package/src/agent-flow/components/PromptEditor.vue +804 -0
  8. package/src/agent-flow/components/PromptEditorTagPanel.vue +460 -0
  9. package/src/agent-flow/components/SvgIcon.vue +32 -0
  10. package/src/agent-flow/components/ToolItemCard.vue +169 -0
  11. package/src/agent-flow/components/VariableCard.vue +161 -0
  12. package/src/agent-flow/components/VariableSelector.vue +162 -0
  13. package/src/agent-flow/components/chat-iframe-types.ts +35 -0
  14. package/src/agent-flow/components/stubs/DatasetChooser.vue +70 -0
  15. package/src/agent-flow/components/stubs/Embedding.vue +22 -0
  16. package/src/agent-flow/components/stubs/ModelSelect.vue +24 -0
  17. package/src/agent-flow/components/stubs/RestfulSelectCard.vue +24 -0
  18. package/src/agent-flow/components/stubs/ToolChooser.vue +96 -0
  19. package/src/agent-flow/components/stubs/TriggersItemCard.vue +126 -0
  20. package/src/agent-flow/components/stubs/VariableModal.vue +115 -0
  21. package/src/agent-flow/index.ts +73 -0
  22. package/src/agent-flow/stores/workflow.ts +72 -0
  23. package/src/agent-flow/utils/langUtils.ts +173 -0
  24. package/src/agent-flow/workflow/Ability.vue +65 -0
  25. package/src/agent-flow/workflow/AuthorizationItem.vue +101 -0
  26. package/src/agent-flow/workflow/ConversationVar.vue +42 -0
  27. package/src/agent-flow/workflow/CustomEdge.vue +94 -0
  28. package/src/agent-flow/workflow/EnvironmentVar.vue +40 -0
  29. package/src/agent-flow/workflow/FlowDesigner.vue +2802 -0
  30. package/src/agent-flow/workflow/Icon.vue +179 -0
  31. package/src/agent-flow/workflow/NodeConfig.vue +509 -0
  32. package/src/agent-flow/workflow/NodeConfigCard.vue +460 -0
  33. package/src/agent-flow/workflow/NodeHandle.vue +147 -0
  34. package/src/agent-flow/workflow/NodeHeaderToolbar.vue +77 -0
  35. package/src/agent-flow/workflow/NodeHoverToolbar.vue +176 -0
  36. package/src/agent-flow/workflow/OutputItemCard.vue +668 -0
  37. package/src/agent-flow/workflow/ParamTableItem.vue +200 -0
  38. package/src/agent-flow/workflow/StructTable.vue +202 -0
  39. package/src/agent-flow/workflow/VarInsertField.vue +517 -0
  40. package/src/agent-flow/workflow/VarSelectField.vue +223 -0
  41. package/src/agent-flow/workflow/VariableSelectorItem.vue +48 -0
  42. package/src/agent-flow/workflow/WfField.vue +206 -0
  43. package/src/agent-flow/workflow/_config-base.css +470 -0
  44. package/src/agent-flow/workflow/composables/useNode.js +55 -0
  45. package/src/agent-flow/workflow/index.vue +53 -0
  46. package/src/agent-flow/workflow/nodeCard/AgentNodeCard.vue +180 -0
  47. package/src/agent-flow/workflow/nodeCard/AnswerNodeCard.vue +65 -0
  48. package/src/agent-flow/workflow/nodeCard/ClassifierCard.vue +152 -0
  49. package/src/agent-flow/workflow/nodeCard/CodeNodeCard.vue +139 -0
  50. package/src/agent-flow/workflow/nodeCard/ConditionNodeCard.vue +323 -0
  51. package/src/agent-flow/workflow/nodeCard/DocumentExtractorCard.vue +83 -0
  52. package/src/agent-flow/workflow/nodeCard/EndNodeCard.vue +123 -0
  53. package/src/agent-flow/workflow/nodeCard/HttpNodeCard.vue +451 -0
  54. package/src/agent-flow/workflow/nodeCard/HumanInputCard.vue +152 -0
  55. package/src/agent-flow/workflow/nodeCard/IterationCard.vue +66 -0
  56. package/src/agent-flow/workflow/nodeCard/KnowledgeRetrievalCard.vue +48 -0
  57. package/src/agent-flow/workflow/nodeCard/LLMNodeCard.vue +206 -0
  58. package/src/agent-flow/workflow/nodeCard/ListOperatorCard.vue +188 -0
  59. package/src/agent-flow/workflow/nodeCard/ParameterExtractorCard.vue +352 -0
  60. package/src/agent-flow/workflow/nodeCard/ServiceApiNodeCard.vue +188 -0
  61. package/src/agent-flow/workflow/nodeCard/StartNodeCard.vue +216 -0
  62. package/src/agent-flow/workflow/nodeCard/VariableAssignerCard.vue +125 -0
  63. package/src/agent-flow/workflow/nodeCard/VariableNodeCard.vue +121 -0
  64. package/src/agent-flow/workflow/nodes/AgentNode.vue +122 -0
  65. package/src/agent-flow/workflow/nodes/AnswerNode.vue +99 -0
  66. package/src/agent-flow/workflow/nodes/ClassifierNode.vue +199 -0
  67. package/src/agent-flow/workflow/nodes/CodeNode.vue +152 -0
  68. package/src/agent-flow/workflow/nodes/ConditionNode.vue +232 -0
  69. package/src/agent-flow/workflow/nodes/DocumentExtractorNode.vue +96 -0
  70. package/src/agent-flow/workflow/nodes/EndNode.vue +119 -0
  71. package/src/agent-flow/workflow/nodes/FileUploadNode.vue +97 -0
  72. package/src/agent-flow/workflow/nodes/HttpNode.vue +204 -0
  73. package/src/agent-flow/workflow/nodes/HumanInputNode.vue +110 -0
  74. package/src/agent-flow/workflow/nodes/IterationNode.vue +98 -0
  75. package/src/agent-flow/workflow/nodes/KnowledgeRetrievalNode.vue +253 -0
  76. package/src/agent-flow/workflow/nodes/LLMNode.vue +134 -0
  77. package/src/agent-flow/workflow/nodes/ListOperatorNode.vue +111 -0
  78. package/src/agent-flow/workflow/nodes/LoopNode.vue +94 -0
  79. package/src/agent-flow/workflow/nodes/ParameterExtractorNode.vue +147 -0
  80. package/src/agent-flow/workflow/nodes/ServiceApiNode.vue +161 -0
  81. package/src/agent-flow/workflow/nodes/StartNode.vue +199 -0
  82. package/src/agent-flow/workflow/nodes/TemplateNode.vue +103 -0
  83. package/src/agent-flow/workflow/nodes/UserInputNode.vue +92 -0
  84. package/src/agent-flow/workflow/nodes/VariableAssignerNode.vue +145 -0
  85. package/src/agent-flow/workflow/nodes/VariableNode.vue +130 -0
  86. package/src/agent-flow/workflow/nodes/_node-base.css +338 -0
  87. package/src/agent-flow/workflow/utils/node_card_form.ts +335 -0
  88. package/src/agent-flow/workflow/utils/node_config.ts +63 -0
  89. package/src/agent-flow/workflow/utils/workflow_utils.ts +151 -0
  90. package/src/agent-studio/adapters/springAgentStart.ts +390 -0
  91. package/src/agent-studio/api/index.ts +1 -0
  92. package/src/agent-studio/api/types.ts +173 -0
  93. package/src/agent-studio/components/AgentApiDocs.vue +500 -0
  94. package/src/agent-studio/components/AgentAppsPage.vue +1601 -0
  95. package/src/agent-studio/components/AgentCardGrid.vue +259 -0
  96. package/src/agent-studio/components/AgentChatPage.vue +553 -0
  97. package/src/agent-studio/components/AgentDebugPanel.vue +350 -0
  98. package/src/agent-studio/components/AgentLogsPanel.vue +391 -0
  99. package/src/agent-studio/components/AgentMonitorPanel.vue +204 -0
  100. package/src/agent-studio/components/AgentOrchestrate.vue +505 -0
  101. package/src/agent-studio/components/AgentPromptEditor.vue +237 -0
  102. package/src/agent-studio/components/AgentStudioShell.vue +227 -0
  103. package/src/agent-studio/components/AgentToolsPanel.vue +394 -0
  104. package/src/agent-studio/components/AgentVariablesPanel.vue +205 -0
  105. package/src/agent-studio/components/ApiKeyManager.vue +251 -0
  106. package/src/agent-studio/components/AppDesignDrawer.vue +3391 -0
  107. package/src/agent-studio/components/CreateAppModal.vue +737 -0
  108. package/src/agent-studio/components/SparkChart.vue +200 -0
  109. package/src/agent-studio/components/VariableEditorModal.vue +499 -0
  110. package/src/agent-studio/composables/useAgentStudio.ts +347 -0
  111. package/src/agent-studio/index.ts +60 -0
  112. package/src/agent-studio/panels/DrawerFlowDesigner.vue +203 -0
  113. package/src/agent-studio/panels/LogAnnotationPanel.vue +490 -0
  114. package/src/agent-studio/panels/MonitorPanel.vue +535 -0
  115. package/src/agent-studio/types.ts +242 -0
  116. package/src/index.ts +155 -0
  117. package/src/knowledge-hub/adapters/springAgentStart.ts +472 -0
  118. package/src/knowledge-hub/components/AddDocumentsWizard.vue +1452 -0
  119. package/src/knowledge-hub/components/CreateDatasetWizard.vue +1723 -0
  120. package/src/knowledge-hub/components/DatasetCardGrid.vue +467 -0
  121. package/src/knowledge-hub/components/DatasetDetailDrawer.vue +888 -0
  122. package/src/knowledge-hub/components/DatasetPicker.vue +65 -0
  123. package/src/knowledge-hub/components/DatasetPickerModal.vue +526 -0
  124. package/src/knowledge-hub/components/DatasetSettingsPanel.vue +908 -0
  125. package/src/knowledge-hub/components/DatasetSidebar.vue +781 -0
  126. package/src/knowledge-hub/components/DocumentChunksView.vue +802 -0
  127. package/src/knowledge-hub/components/DocumentTable.vue +552 -0
  128. package/src/knowledge-hub/components/HitTestingPanel.vue +74 -0
  129. package/src/knowledge-hub/components/KnowledgeApp.vue +66 -0
  130. package/src/knowledge-hub/components/KnowledgeHubApp.vue +504 -0
  131. package/src/knowledge-hub/components/RecallTestingPanelV2.vue +515 -0
  132. package/src/knowledge-hub/components/RetrievalConfigPopover.vue +270 -0
  133. package/src/knowledge-hub/components/RetrievalMethodPicker.vue +547 -0
  134. package/src/knowledge-hub/components/RetrievedList.vue +24 -0
  135. package/src/knowledge-hub/components/internal/KhDialog.vue +195 -0
  136. package/src/knowledge-hub/composables/useKnowledge.ts +89 -0
  137. package/src/knowledge-hub/i18n/index.ts +2 -0
  138. package/src/knowledge-hub/i18n/messages.ts +422 -0
  139. package/src/knowledge-hub/i18n/useKhI18n.ts +107 -0
  140. package/src/knowledge-hub/index.ts +46 -0
  141. package/src/knowledge-hub/styles/index.css +4 -0
  142. package/src/knowledge-hub/styles/tokens.css +138 -0
  143. package/src/knowledge-hub/types/api.ts +213 -0
  144. package/src/knowledge-hub/types/dataset.ts +88 -0
  145. package/src/knowledge-hub/types/document.ts +45 -0
  146. package/src/knowledge-hub/types/index.ts +9 -0
  147. package/src/knowledge-hub/types/retrieval.ts +46 -0
  148. package/src/provider-hub/components/CredentialForm.vue +103 -0
  149. package/src/provider-hub/components/DefaultModelsPanel.vue +270 -0
  150. package/src/provider-hub/components/GroupedModelSelect.vue +445 -0
  151. package/src/provider-hub/components/ModelCardGrid.vue +332 -0
  152. package/src/provider-hub/components/ModelParameterDrawer.vue +739 -0
  153. package/src/provider-hub/components/ModelPickerPopover.vue +1282 -0
  154. package/src/provider-hub/components/ProviderApp.vue +159 -0
  155. package/src/provider-hub/components/ProviderCredentialModal.vue +321 -0
  156. package/src/provider-hub/components/ProviderGallery.vue +131 -0
  157. package/src/provider-hub/components/ProviderHubShell.vue +1992 -0
  158. package/src/provider-hub/components/ProviderIcon.vue +130 -0
  159. package/src/provider-hub/composables/useProviderHub.ts +358 -0
  160. package/src/provider-hub/index.ts +43 -0
  161. package/src/provider-hub/svg/MiniMax.svg +1 -0
  162. package/src/provider-hub/svg/Volcengine.svg +1 -0
  163. package/src/provider-hub/svg/Zhipu.svg +1 -0
  164. package/src/provider-hub/svg/deepseek.svg +1 -0
  165. package/src/provider-hub/svg/moonshot.svg +1 -0
  166. package/src/provider-hub/svg/openai.svg +1 -0
  167. package/src/provider-hub/svg/qwen.svg +1 -0
  168. package/src/provider-hub/svg/siliconflow.svg +1 -0
  169. package/src/provider-hub/types.ts +256 -0
@@ -0,0 +1,323 @@
1
+ <script setup lang="ts">
2
+ import { h } from 'vue';
3
+
4
+ import {
5
+ DeleteOutlined,
6
+ PlusCircleOutlined,
7
+ PlusOutlined,
8
+ } from '@ant-design/icons-vue';
9
+ import { VueDraggableNext } from 'vue-draggable-next';
10
+
11
+ import VariableSelector from '@/components/VariableSelector.vue';
12
+ import langUtils from '@/utils/langUtils';
13
+ import WfField from '@/workflow/WfField.vue';
14
+ import workflow_utils from '@/workflow/utils/workflow_utils';
15
+
16
+ defineProps<{ nodeId?: string }>();
17
+
18
+ const formState: any = defineModel();
19
+ const conditionOperators: any = workflow_utils.conditionOperators;
20
+
21
+ const CASE_COLORS = [
22
+ '#f97316',
23
+ '#f59e0b',
24
+ '#eab308',
25
+ '#22c55e',
26
+ '#14b8a6',
27
+ '#06b6d4',
28
+ '#3b82f6',
29
+ '#6366f1',
30
+ '#8b5cf6',
31
+ '#a855f7',
32
+ '#ec4899',
33
+ ];
34
+
35
+ const getColor = (index: number) => CASE_COLORS[index % CASE_COLORS.length];
36
+
37
+ const addCase = () => {
38
+ if (!Array.isArray(formState.value.cases)) formState.value.cases = [];
39
+ const len = formState.value.cases.length;
40
+ formState.value.cases.push({
41
+ id: langUtils.getId('case'),
42
+ name: '',
43
+ caseId: 'true',
44
+ color: getColor(len),
45
+ logicalOperator: 'and',
46
+ conditions: [
47
+ {
48
+ variableSelector: [],
49
+ operator: 'CONTAINS',
50
+ value: '',
51
+ },
52
+ ],
53
+ });
54
+ };
55
+
56
+ const removeCase = (index: number) => {
57
+ formState.value.cases.splice(index, 1);
58
+ };
59
+
60
+ const addCondition = (caseItem: any) => {
61
+ caseItem.conditions.push({
62
+ variableSelector: [],
63
+ operator: 'CONTAINS',
64
+ value: '',
65
+ });
66
+ };
67
+
68
+ const removeCondition = (caseItem: any, condIndex: number) => {
69
+ caseItem.conditions.splice(condIndex, 1);
70
+ };
71
+
72
+ // Case 级别的 AND / OR 切换:一次改整案的 logicalOperator,与
73
+ // `ConditionNode.getCaseSummary` 展示的连接词保持一致。
74
+ const toggleLogicalOperator = (caseItem: any) => {
75
+ const current = (caseItem.logicalOperator || 'and').toLowerCase();
76
+ caseItem.logicalOperator = current === 'and' ? 'or' : 'and';
77
+ };
78
+ </script>
79
+
80
+ <template>
81
+ <div class="wf-config-section">
82
+ <WfField title="分支条件">
83
+ <template #tooltip>
84
+ 按顺序判断,第一个满足的分支生效。ELSE 分支从画布右侧默认输出走。
85
+ </template>
86
+ <template #operations>
87
+ <a-button
88
+ :icon="h(PlusOutlined)"
89
+ size="small"
90
+ type="primary"
91
+ @click="addCase"
92
+ />
93
+ </template>
94
+ </WfField>
95
+
96
+ <div
97
+ v-if="!formState.cases || formState.cases.length === 0"
98
+ class="cond-empty"
99
+ >
100
+ 尚未添加分支,点击右上角 + 添加
101
+ </div>
102
+
103
+ <VueDraggableNext
104
+ v-model="formState.cases"
105
+ item-key="id"
106
+ :animation="200"
107
+ ghost-class="cond-ghost"
108
+ chosen-class="cond-chosen"
109
+ class="cond-cases"
110
+ >
111
+ <div
112
+ v-for="(item, index) in formState.cases"
113
+ :key="item.id"
114
+ class="cond-case"
115
+ :style="{ borderLeftColor: item.color || getColor(index) }"
116
+ >
117
+ <div class="cond-case-head">
118
+ <div class="cond-case-title">
119
+ <span class="cond-case-badge">
120
+ {{ index === 0 ? 'IF' : 'ELIF' }}
121
+ </span>
122
+ <span class="cond-case-tag">CASE {{ index + 1 }}</span>
123
+ </div>
124
+ <a-button
125
+ :icon="h(DeleteOutlined)"
126
+ size="small"
127
+ type="text"
128
+ danger
129
+ @click="removeCase(index)"
130
+ />
131
+ </div>
132
+
133
+ <div class="cond-condition-list">
134
+ <template
135
+ v-for="(cond, condIndex) in item.conditions"
136
+ :key="condIndex"
137
+ >
138
+ <!-- 相邻条件之间的 AND / OR 连接词:点击可整案切换 —— Dify parity
139
+ 这里的逻辑操作符是 case 级别(所有条件共享一个),而不是每对
140
+ 相邻条件独立设置。 -->
141
+ <button
142
+ v-if="condIndex > 0"
143
+ type="button"
144
+ class="cond-logical-op"
145
+ :class="{
146
+ 'cond-logical-op-or': (item.logicalOperator || 'and') === 'or',
147
+ }"
148
+ @click="toggleLogicalOperator(item)"
149
+ :title="'点击切换 AND / OR'"
150
+ >
151
+ {{ (item.logicalOperator || 'and').toUpperCase() }}
152
+ </button>
153
+
154
+ <div class="cond-condition">
155
+ <div class="cond-condition-row">
156
+ <VariableSelector
157
+ v-model="cond.variableSelector"
158
+ :node-id="nodeId"
159
+ placeholder="选择变量"
160
+ style="flex: 1"
161
+ />
162
+ <a-select
163
+ v-model:value="cond.operator"
164
+ :options="conditionOperators"
165
+ size="small"
166
+ style="width: 110px"
167
+ />
168
+ </div>
169
+ <div class="cond-condition-value">
170
+ <a-input v-model:value="cond.value" placeholder="比较值" />
171
+ <a-button
172
+ v-if="item.conditions.length > 1"
173
+ :icon="h(DeleteOutlined)"
174
+ size="small"
175
+ type="text"
176
+ danger
177
+ @click="removeCondition(item, condIndex)"
178
+ />
179
+ </div>
180
+ </div>
181
+ </template>
182
+ </div>
183
+
184
+ <a-button
185
+ :icon="h(PlusCircleOutlined)"
186
+ size="small"
187
+ type="link"
188
+ @click="addCondition(item)"
189
+ >
190
+ 添加条件
191
+ </a-button>
192
+ </div>
193
+ </VueDraggableNext>
194
+
195
+ </div>
196
+ </template>
197
+
198
+ <style scoped>
199
+ .cond-empty {
200
+ padding: 12px;
201
+ text-align: center;
202
+ font-size: 12px;
203
+ color: #9ca3af;
204
+ background: #f9fafb;
205
+ border: 1px dashed #e5e7eb;
206
+ border-radius: 6px;
207
+ }
208
+
209
+ .cond-cases {
210
+ display: flex;
211
+ flex-direction: column;
212
+ gap: 10px;
213
+ }
214
+
215
+ .cond-case {
216
+ display: flex;
217
+ flex-direction: column;
218
+ gap: 6px;
219
+ padding: 8px 10px;
220
+ background: #ffffff;
221
+ border: 1px solid #f0f0f0;
222
+ border-left: 3px solid #d1d5db;
223
+ border-radius: 6px;
224
+ cursor: move;
225
+ transition: box-shadow 0.15s;
226
+ }
227
+
228
+ .cond-case:hover {
229
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
230
+ }
231
+
232
+ .cond-case-head {
233
+ display: flex;
234
+ align-items: center;
235
+ justify-content: space-between;
236
+ }
237
+
238
+ .cond-case-title {
239
+ display: flex;
240
+ align-items: center;
241
+ gap: 8px;
242
+ }
243
+
244
+ .cond-case-badge {
245
+ padding: 2px 8px;
246
+ font-size: 11px;
247
+ font-weight: 700;
248
+ color: #ffffff;
249
+ background: #6366f1;
250
+ border-radius: 4px;
251
+ }
252
+
253
+ .cond-case-tag {
254
+ font-size: 11px;
255
+ color: #9ca3af;
256
+ }
257
+
258
+ .cond-condition-list {
259
+ display: flex;
260
+ flex-direction: column;
261
+ gap: 6px;
262
+ }
263
+
264
+ .cond-condition {
265
+ display: flex;
266
+ flex-direction: column;
267
+ gap: 4px;
268
+ padding: 6px;
269
+ background: #f9fafb;
270
+ border-radius: 4px;
271
+ }
272
+
273
+ /* 条件之间的 AND / OR 连接钮:一颗药丸样式,AND 走 accent 蓝、OR 走琥珀色以示区别 */
274
+ .cond-logical-op {
275
+ align-self: flex-start;
276
+ margin: 2px 0 2px 12px;
277
+ padding: 1px 10px;
278
+ font-size: 10px;
279
+ font-weight: 700;
280
+ letter-spacing: 0.6px;
281
+ color: #4338ca;
282
+ background: #eef2ff;
283
+ border: 1px solid #c7d2fe;
284
+ border-radius: 999px;
285
+ cursor: pointer;
286
+ transition: background 0.15s, border-color 0.15s, color 0.15s;
287
+ line-height: 16px;
288
+ }
289
+ .cond-logical-op:hover {
290
+ background: #e0e7ff;
291
+ border-color: #a5b4fc;
292
+ }
293
+ .cond-logical-op-or {
294
+ color: #b45309;
295
+ background: #fef3c7;
296
+ border-color: #fcd34d;
297
+ }
298
+ .cond-logical-op-or:hover {
299
+ background: #fde68a;
300
+ border-color: #fbbf24;
301
+ }
302
+
303
+ .cond-condition-row {
304
+ display: flex;
305
+ align-items: center;
306
+ gap: 6px;
307
+ }
308
+
309
+ .cond-condition-value {
310
+ display: flex;
311
+ align-items: center;
312
+ gap: 6px;
313
+ }
314
+
315
+ .cond-ghost {
316
+ opacity: 0.4;
317
+ background: #f1f5f9;
318
+ }
319
+
320
+ .cond-chosen {
321
+ background: #eef2ff;
322
+ }
323
+ </style>
@@ -0,0 +1,83 @@
1
+ <script setup lang="ts">
2
+ import VariableSelector from '@/components/VariableSelector.vue';
3
+ import WfField from '@/workflow/WfField.vue';
4
+
5
+ defineProps<{ nodeId?: string }>();
6
+
7
+ const formState: any = defineModel();
8
+
9
+ const EXTRACT_MODES = [
10
+ { value: 'text', label: '纯文本' },
11
+ { value: 'markdown', label: 'Markdown' },
12
+ { value: 'json', label: '智能结构化 (JSON)' },
13
+ ];
14
+
15
+ const SPLIT_MODES = [
16
+ { value: 'none', label: '不切分' },
17
+ { value: 'paragraph', label: '按段落' },
18
+ { value: 'page', label: '按页' },
19
+ { value: 'length', label: '按长度' },
20
+ ];
21
+ </script>
22
+
23
+ <template>
24
+ <div class="wf-config-section">
25
+ <WfField title="源文件" required>
26
+ <template #tooltip>
27
+ 从上游变量选择 File 类型的变量,节点会提取其中的文本内容。
28
+ </template>
29
+ <VariableSelector
30
+ v-model="formState.variableSelector"
31
+ :node-id="nodeId"
32
+ placeholder="选择文件变量"
33
+ />
34
+ </WfField>
35
+ </div>
36
+
37
+ <div class="wf-config-section">
38
+ <WfField title="提取模式" is-subtitle>
39
+ <template #tooltip>
40
+ 纯文本:直接返回文本;Markdown:保留结构标题;智能结构化:让 LLM 提取键值对。
41
+ </template>
42
+ <a-select
43
+ v-model:value="formState.extractMode"
44
+ :options="EXTRACT_MODES"
45
+ style="width: 100%"
46
+ />
47
+ </WfField>
48
+
49
+ <WfField title="切分策略" is-subtitle>
50
+ <template #tooltip>
51
+ 对于长文档,可以按段落或按页切分为多个片段。
52
+ </template>
53
+ <a-select
54
+ v-model:value="formState.splitMode"
55
+ :options="SPLIT_MODES"
56
+ style="width: 100%"
57
+ />
58
+ </WfField>
59
+
60
+ <WfField
61
+ v-if="formState.splitMode === 'length'"
62
+ title="每段最大字符数"
63
+ is-subtitle
64
+ >
65
+ <a-input-number
66
+ v-model:value="formState.chunkSize"
67
+ :min="100"
68
+ :step="100"
69
+ style="width: 100%"
70
+ />
71
+ </WfField>
72
+ </div>
73
+
74
+ <div class="wf-config-section">
75
+ <WfField title="支持格式" is-subtitle inline>
76
+ <template #operations>
77
+ <span style="font-size: 11px; color: #6b7280">
78
+ PDF · DOCX · TXT · MD · HTML
79
+ </span>
80
+ </template>
81
+ </WfField>
82
+ </div>
83
+ </template>
@@ -0,0 +1,123 @@
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 addOutput = () => {
14
+ if (!Array.isArray(formState.value.output)) formState.value.output = [];
15
+ formState.value.output.push({
16
+ type: 'string',
17
+ name: '',
18
+ value: '',
19
+ description: '',
20
+ variableSelector: [],
21
+ });
22
+ };
23
+
24
+ const removeOutput = (index: number) => {
25
+ formState.value.output.splice(index, 1);
26
+ };
27
+
28
+ const TYPES = ['string', 'number', 'boolean', 'array', 'object'];
29
+ </script>
30
+
31
+ <template>
32
+ <div class="wf-config-section">
33
+ <WfField title="输出变量" required>
34
+ <template #tooltip>
35
+ 工作流结束时返回的字段,通常从上游节点选取变量。
36
+ </template>
37
+ <template #operations>
38
+ <a-button
39
+ :icon="h(PlusOutlined)"
40
+ size="small"
41
+ type="primary"
42
+ @click="addOutput"
43
+ />
44
+ </template>
45
+
46
+ <div
47
+ v-if="!formState.output || formState.output.length === 0"
48
+ class="end-empty"
49
+ >
50
+ 尚未配置输出,点击右上角 + 添加
51
+ </div>
52
+
53
+ <div class="end-output-list">
54
+ <div
55
+ v-for="(it, index) in formState.output"
56
+ :key="index"
57
+ class="end-output-item"
58
+ >
59
+ <div class="end-output-row">
60
+ <a-input
61
+ v-model:value="it.name"
62
+ placeholder="变量名"
63
+ size="small"
64
+ style="flex: 1"
65
+ />
66
+ <a-select
67
+ v-model:value="it.type"
68
+ :options="TYPES.map((t) => ({ value: t, label: t }))"
69
+ size="small"
70
+ style="width: 96px"
71
+ />
72
+ <a-button
73
+ :icon="h(DeleteOutlined)"
74
+ size="small"
75
+ type="text"
76
+ danger
77
+ @click="removeOutput(index)"
78
+ />
79
+ </div>
80
+ <VariableSelector
81
+ v-model="it.variableSelector"
82
+ :node-id="nodeId"
83
+ placeholder="选择上游变量"
84
+ />
85
+ </div>
86
+ </div>
87
+ </WfField>
88
+ </div>
89
+ </template>
90
+
91
+ <style scoped>
92
+ .end-empty {
93
+ padding: 12px;
94
+ text-align: center;
95
+ font-size: 12px;
96
+ color: #9ca3af;
97
+ background: #f9fafb;
98
+ border: 1px dashed #e5e7eb;
99
+ border-radius: 6px;
100
+ }
101
+
102
+ .end-output-list {
103
+ display: flex;
104
+ flex-direction: column;
105
+ gap: 8px;
106
+ }
107
+
108
+ .end-output-item {
109
+ display: flex;
110
+ flex-direction: column;
111
+ gap: 6px;
112
+ padding: 8px;
113
+ background: #f9fafb;
114
+ border: 1px solid #f0f0f0;
115
+ border-radius: 6px;
116
+ }
117
+
118
+ .end-output-row {
119
+ display: flex;
120
+ align-items: center;
121
+ gap: 6px;
122
+ }
123
+ </style>