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,161 @@
1
+ <script setup lang="ts">
2
+ import { computed, nextTick, ref, watch } from 'vue';
3
+
4
+ import { Input } from 'ant-design-vue';
5
+
6
+ interface Parameter {
7
+ name: string;
8
+ type: string;
9
+ description?: string;
10
+ }
11
+
12
+ interface Props {
13
+ parameters?: Parameter[];
14
+ visible?: boolean;
15
+ position?: { x: number; y: number };
16
+ }
17
+
18
+ const props = withDefaults(defineProps<Props>(), {
19
+ parameters: () => [],
20
+ visible: false,
21
+ position: () => ({ x: 0, y: 0 }),
22
+ });
23
+
24
+ const emit = defineEmits<{
25
+ close: [];
26
+ parameterSelect: [parameter: string];
27
+ }>();
28
+
29
+ const searchKeyword = ref('');
30
+ const quickPanelInputRef = ref<HTMLInputElement>();
31
+
32
+ // 过滤后的参数列表
33
+ const filteredParameters = computed(() => {
34
+ if (!searchKeyword.value) {
35
+ return props.parameters;
36
+ }
37
+ return props.parameters.filter(
38
+ (param) =>
39
+ param.name?.toLowerCase().includes(searchKeyword.value.toLowerCase()) ||
40
+ param.type?.toLowerCase().includes(searchKeyword.value.toLowerCase()),
41
+ );
42
+ });
43
+
44
+ // 选择参数
45
+ const selectParameter = (parameter: any) => {
46
+ emit('parameterSelect', parameter);
47
+ };
48
+
49
+ // 关闭面板
50
+ const closePanel = () => {
51
+ searchKeyword.value = '';
52
+ emit('close');
53
+ };
54
+
55
+ // 当面板显示时聚焦搜索框
56
+ const focusSearch = () => {
57
+ nextTick(() => {
58
+ quickPanelInputRef.value?.focus();
59
+ });
60
+ };
61
+
62
+ // 监听面板显示状态
63
+ watch(
64
+ () => props.visible,
65
+ (visible) => {
66
+ if (visible) {
67
+ searchKeyword.value = '';
68
+ focusSearch();
69
+ }
70
+ },
71
+ );
72
+
73
+ defineExpose({
74
+ focusSearch,
75
+ });
76
+ </script>
77
+
78
+ <template>
79
+ <div
80
+ v-if="visible"
81
+ class="quick-panel fixed z-50 rounded-lg border border-gray-200 bg-white shadow-xl"
82
+ :style="{
83
+ left: `${position.x}px`,
84
+ top: `${position.y}px`,
85
+ transform: 'translateX(-50%)',
86
+ minWidth: '320px',
87
+ maxWidth: '400px',
88
+ }"
89
+ >
90
+ <div class="p-4">
91
+ <!-- 搜索框 -->
92
+ <div class="mb-3">
93
+ <Input
94
+ ref="quickPanelInputRef"
95
+ v-model:value="searchKeyword"
96
+ placeholder="🔍 搜索参数..."
97
+ size="small"
98
+ class="rounded-md border-gray-300 focus:border-blue-500 focus:ring-1 focus:ring-blue-500"
99
+ @keydown.enter.prevent
100
+ @keydown.escape="closePanel"
101
+ />
102
+ </div>
103
+
104
+ <!-- 参数列表 -->
105
+ <div class="max-h-64 overflow-y-auto">
106
+ <div
107
+ v-if="filteredParameters.length === 0"
108
+ class="flex flex-col items-center justify-center py-8 text-gray-500"
109
+ >
110
+ <div class="mb-2 text-3xl">📝</div>
111
+ <div class="text-sm">
112
+ {{ searchKeyword ? '未找到匹配的参数' : '暂无参数' }}
113
+ </div>
114
+ </div>
115
+ <div v-else class="space-y-1">
116
+ <div
117
+ v-for="parameter in filteredParameters"
118
+ :key="parameter.name"
119
+ class="group flex cursor-pointer items-center justify-between rounded-lg border border-transparent p-3 transition-all duration-200 hover:border-blue-200 hover:bg-blue-50"
120
+ @click="selectParameter(parameter)"
121
+ @mousedown.prevent
122
+ >
123
+ <div class="flex-1">
124
+ <div class="flex items-center space-x-2">
125
+ <div
126
+ class="text-sm font-semibold text-gray-800 group-hover:text-blue-700"
127
+ >
128
+ {{ parameter.name }}
129
+ </div>
130
+ <div
131
+ class="rounded-full bg-gray-100 px-2 py-1 text-xs text-gray-600 group-hover:bg-blue-100 group-hover:text-blue-600"
132
+ >
133
+ {{ parameter.type }}
134
+ </div>
135
+ </div>
136
+ <div
137
+ v-if="parameter.description"
138
+ class="mt-1 text-xs text-gray-500"
139
+ >
140
+ {{ parameter.description }}
141
+ </div>
142
+ </div>
143
+ <div class="ml-2 text-xs text-gray-400 group-hover:text-blue-500">
144
+ ↩ 插入
145
+ </div>
146
+ </div>
147
+ </div>
148
+ </div>
149
+
150
+ <!-- 提示信息 -->
151
+ <div
152
+ class="mt-4 flex items-center justify-between border-t border-gray-100 pt-3 text-xs text-gray-400"
153
+ >
154
+ <span>按 "/" 快速打开面板</span>
155
+ <span>按 "Esc" 关闭</span>
156
+ </div>
157
+ </div>
158
+ </div>
159
+ </template>
160
+
161
+ <style scoped></style>
@@ -0,0 +1,162 @@
1
+ <script setup lang="ts">
2
+ import { computed, ref } from 'vue';
3
+
4
+ import { LinkOutlined } from '@ant-design/icons-vue';
5
+
6
+ import PromptEditorTagPanel from '@/components/PromptEditorTagPanel.vue';
7
+ import workflow_utils from '@/workflow/utils/workflow_utils';
8
+
9
+ interface Props {
10
+ nodeId: string;
11
+ placeholder?: string;
12
+ disabled?: boolean;
13
+ }
14
+
15
+ const props = withDefaults(defineProps<Props>(), {
16
+ placeholder: '选择变量',
17
+ disabled: false,
18
+ });
19
+
20
+ const model: any = defineModel();
21
+
22
+ const targetElement = ref<HTMLElement | null>(null);
23
+ const showPanel = ref<boolean>(false);
24
+
25
+ const label = computed(() =>
26
+ model.value && model.value.length > 0
27
+ ? workflow_utils.getVariableLabel(model.value)
28
+ : '',
29
+ );
30
+
31
+ const openPanel = (event: MouseEvent) => {
32
+ if (props.disabled) return;
33
+ targetElement.value = event.currentTarget as HTMLElement;
34
+ showPanel.value = true;
35
+ };
36
+
37
+ const closePanel = () => {
38
+ showPanel.value = false;
39
+ };
40
+
41
+ const selectAttr = (variableSelector: any) => {
42
+ model.value = variableSelector;
43
+ showPanel.value = false;
44
+ };
45
+
46
+ const clear = (e: MouseEvent) => {
47
+ e.stopPropagation();
48
+ model.value = [];
49
+ };
50
+ </script>
51
+
52
+ <template>
53
+ <div class="wf-var-selector">
54
+ <div
55
+ ref="targetElement"
56
+ class="wf-var-selector-trigger"
57
+ :class="{ 'is-disabled': disabled, 'has-value': label }"
58
+ @click="openPanel"
59
+ >
60
+ <template v-if="label">
61
+ <LinkOutlined class="wf-var-selector-icon" />
62
+ <span class="wf-var-selector-value" :title="label">{{ label }}</span>
63
+ <span
64
+ v-if="!disabled"
65
+ class="wf-var-selector-clear"
66
+ @click="clear"
67
+ >
68
+ ×
69
+ </span>
70
+ </template>
71
+ <template v-else>
72
+ <LinkOutlined class="wf-var-selector-icon" />
73
+ <span class="wf-var-selector-placeholder">{{ placeholder }}</span>
74
+ </template>
75
+ </div>
76
+
77
+ <PromptEditorTagPanel
78
+ :show="showPanel"
79
+ :target-element="targetElement"
80
+ :node-id="nodeId"
81
+ @close="closePanel"
82
+ @select="selectAttr"
83
+ />
84
+ </div>
85
+ </template>
86
+
87
+ <style scoped>
88
+ .wf-var-selector {
89
+ width: 100%;
90
+ }
91
+
92
+ .wf-var-selector-trigger {
93
+ display: flex;
94
+ align-items: center;
95
+ gap: 6px;
96
+ padding: 4px 8px;
97
+ min-height: 28px;
98
+ background: #ffffff;
99
+ border: 1px solid #e5e7eb;
100
+ border-radius: 6px;
101
+ cursor: pointer;
102
+ transition: border-color 0.15s, background 0.15s;
103
+ }
104
+
105
+ .wf-var-selector-trigger:hover:not(.is-disabled) {
106
+ border-color: #6366f1;
107
+ background: #fafbff;
108
+ }
109
+
110
+ .wf-var-selector-trigger.has-value {
111
+ background: #eef2ff;
112
+ border-color: #c7d2fe;
113
+ }
114
+
115
+ .wf-var-selector-trigger.is-disabled {
116
+ cursor: not-allowed;
117
+ background: #f9fafb;
118
+ color: #9ca3af;
119
+ }
120
+
121
+ .wf-var-selector-icon {
122
+ flex: none;
123
+ font-size: 12px;
124
+ color: #6366f1;
125
+ }
126
+
127
+ .wf-var-selector-value {
128
+ flex: 1;
129
+ min-width: 0;
130
+ overflow: hidden;
131
+ text-overflow: ellipsis;
132
+ white-space: nowrap;
133
+ font-size: 12px;
134
+ color: #4338ca;
135
+ font-weight: 500;
136
+ }
137
+
138
+ .wf-var-selector-placeholder {
139
+ flex: 1;
140
+ font-size: 12px;
141
+ color: #9ca3af;
142
+ }
143
+
144
+ .wf-var-selector-clear {
145
+ flex: none;
146
+ width: 16px;
147
+ height: 16px;
148
+ display: inline-flex;
149
+ align-items: center;
150
+ justify-content: center;
151
+ font-size: 14px;
152
+ line-height: 1;
153
+ color: #6366f1;
154
+ border-radius: 50%;
155
+ transition: background 0.15s;
156
+ }
157
+
158
+ .wf-var-selector-clear:hover {
159
+ background: #c7d2fe;
160
+ color: #1e1b4b;
161
+ }
162
+ </style>
@@ -0,0 +1,35 @@
1
+ /**
2
+ * ChatIframePanel 相关的共享类型。抽出成独立 .ts 文件,
3
+ * 让 `.vue` 消费方能通过 `import type` 拿到(`<script setup>` 里的 export
4
+ * 无法被外部再导出,独立 ts 才能被 `export type ... from './x'` 转发)。
5
+ */
6
+
7
+ /** 一个可填写的调试变量 —— 与 START 节点 variables / AgentVariable 兼容 */
8
+ export interface ChatDebugVariable {
9
+ /** 参数键;写入 Dify inputs 时用这个名字 */
10
+ name: string;
11
+ /** 显示名 —— 不填走 name */
12
+ label?: string;
13
+ /** string / number / boolean / object / array / file;未识别按 string 处理 */
14
+ type?: string;
15
+ required?: boolean;
16
+ description?: string;
17
+ /** 默认值(string / number / boolean 生效;object/array 会尝试 JSON.parse) */
18
+ defaultValue?: unknown;
19
+ /** enum 类型的可选项(预留) */
20
+ options?: Array<{ label: string; value: string }>;
21
+ }
22
+
23
+ /** 承载给 FlowDesigner / AppDesignDrawer 的调试 iframe 配置 */
24
+ export interface ChatIframeConfig {
25
+ /** iframe 基础 URL;例如 `/chat/` 或 `http://localhost:5073/chat/` */
26
+ src: string;
27
+ /** 附加到 URL 的查询参数(difyApiKey / label 等) */
28
+ params?: Record<string, boolean | number | string | null | undefined>;
29
+ /** postMessage 下发给 iframe 的业务上下文 */
30
+ context?: Record<string, unknown>;
31
+ /** 顶部标题 */
32
+ title?: string;
33
+ /** localStorage 命名空间;不填自动生成 */
34
+ sessionKey?: string;
35
+ }
@@ -0,0 +1,70 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * Thin adapter between DatasetItemCard's imperative
4
+ * {@code showModal()} / {@code formSubmit} API and the shared
5
+ * {@link DatasetPickerModal}. Historically this file was a stand-alone stub
6
+ * that admitted "please replace me" — now the real picker lives in the
7
+ * knowledge-hub module and both the workflow KNOWLEDGE_RETRIEVAL node and the
8
+ * agent-studio 编排 knowledge card share the same UX.
9
+ */
10
+ import { computed, ref } from 'vue';
11
+
12
+ import DatasetPickerModal from '../../../knowledge-hub/components/DatasetPickerModal.vue';
13
+ import type { DatasetSummary } from '../../../knowledge-hub/types';
14
+
15
+ interface DatasetLike {
16
+ id: string;
17
+ name: string;
18
+ [key: string]: unknown;
19
+ }
20
+
21
+ const props = defineProps<{
22
+ /** Currently selected dataset objects (id + name at minimum). */
23
+ mainData?: DatasetLike[];
24
+ /** Optional tenant filter passed through to the catalog fetch. */
25
+ tenantId?: string;
26
+ }>();
27
+
28
+ const emit = defineEmits<{
29
+ (e: 'formSubmit', datasets: DatasetLike[]): void;
30
+ }>();
31
+
32
+ const open = ref(false);
33
+
34
+ const initialSelectedIds = computed(() =>
35
+ (props.mainData ?? []).map((d) => d.id).filter((id): id is string => !!id),
36
+ );
37
+
38
+ function showModal() {
39
+ open.value = true;
40
+ }
41
+ function hideModal() {
42
+ open.value = false;
43
+ }
44
+
45
+ function onPicked(datasets: DatasetSummary[]) {
46
+ // Preserve any callsite-specific fields (e.g. custom rerank overrides
47
+ // stashed on the row) by merging over the previous selection when the id
48
+ // matches, otherwise drop through with just the wire fields.
49
+ const prev = new Map(
50
+ (props.mainData ?? []).map((d) => [d.id, d] as const),
51
+ );
52
+ const merged: DatasetLike[] = datasets.map((d) => ({
53
+ ...(prev.get(d.id) ?? {}),
54
+ id: d.id,
55
+ name: d.name,
56
+ }));
57
+ emit('formSubmit', merged);
58
+ }
59
+
60
+ defineExpose({ showModal, hideModal });
61
+ </script>
62
+
63
+ <template>
64
+ <DatasetPickerModal
65
+ v-model:open="open"
66
+ :initial-selected-ids="initialSelectedIds"
67
+ :tenant-id="tenantId"
68
+ @submit="onPicked"
69
+ />
70
+ </template>
@@ -0,0 +1,22 @@
1
+ <script setup lang="ts">
2
+ defineProps<{ modelValue?: any }>();
3
+ </script>
4
+
5
+ <template>
6
+ <div class="agent-flow-stub">
7
+ <slot>
8
+ <span class="agent-flow-stub__hint">[Embedding stub — 请注入实现]</span>
9
+ </slot>
10
+ </div>
11
+ </template>
12
+
13
+ <style scoped>
14
+ .agent-flow-stub {
15
+ display: inline-block;
16
+ padding: 4px 8px;
17
+ border: 1px dashed #d1d5db;
18
+ border-radius: 4px;
19
+ color: #6b7280;
20
+ font-size: 12px;
21
+ }
22
+ </style>
@@ -0,0 +1,24 @@
1
+ <script setup lang="ts">
2
+ defineProps<{ modelValue?: any; modelType?: string }>();
3
+ defineEmits<{ (e: 'update:modelValue', v: any): void; (e: 'change', v: any): void }>();
4
+ defineExpose({ showModal: () => {}, hideModal: () => {} });
5
+ </script>
6
+
7
+ <template>
8
+ <div class="agent-flow-stub">
9
+ <slot>
10
+ <span class="agent-flow-stub__hint">[ModelSelect stub — 请注入实现]</span>
11
+ </slot>
12
+ </div>
13
+ </template>
14
+
15
+ <style scoped>
16
+ .agent-flow-stub {
17
+ display: inline-block;
18
+ padding: 4px 8px;
19
+ border: 1px dashed #d1d5db;
20
+ border-radius: 4px;
21
+ color: #6b7280;
22
+ font-size: 12px;
23
+ }
24
+ </style>
@@ -0,0 +1,24 @@
1
+ <script setup lang="ts">
2
+ defineProps<{ mainData?: any }>();
3
+ defineEmits<{ (e: 'formSubmit', v: any): void }>();
4
+ defineExpose({ showModal: () => {}, hideModal: () => {} });
5
+ </script>
6
+
7
+ <template>
8
+ <div class="agent-flow-stub">
9
+ <slot>
10
+ <span class="agent-flow-stub__hint">[RestfulSelectCard stub — 请注入实现]</span>
11
+ </slot>
12
+ </div>
13
+ </template>
14
+
15
+ <style scoped>
16
+ .agent-flow-stub {
17
+ display: inline-block;
18
+ padding: 4px 8px;
19
+ border: 1px dashed #d1d5db;
20
+ border-radius: 4px;
21
+ color: #6b7280;
22
+ font-size: 12px;
23
+ }
24
+ </style>
@@ -0,0 +1,96 @@
1
+ <script setup lang="ts">
2
+ import { ref } from 'vue';
3
+
4
+ import { ToolOutlined } from '@ant-design/icons-vue';
5
+
6
+ const emit = defineEmits<{ (e: 'formSubmit', v: any): void }>();
7
+
8
+ const open = ref(false);
9
+ const form = ref({ name: '', description: '' });
10
+
11
+ function showModal() {
12
+ form.value = { name: '', description: '' };
13
+ open.value = true;
14
+ }
15
+
16
+ function hideModal() {
17
+ open.value = false;
18
+ }
19
+
20
+ function submit() {
21
+ emit('formSubmit', { ...form.value, id: Date.now() });
22
+ open.value = false;
23
+ }
24
+
25
+ defineExpose({ showModal, hideModal });
26
+ </script>
27
+
28
+ <template>
29
+ <a-modal
30
+ v-model:open="open"
31
+ title="添加工具"
32
+ width="480px"
33
+ ok-text="添加"
34
+ cancel-text="取消"
35
+ @ok="submit"
36
+ >
37
+ <div class="wf-tool-chooser">
38
+ <div class="wf-tool-chooser-hint">
39
+ 当前是基础实现。真实场景下应对接后端 ToolService,展示 tool 分类
40
+ 列表并支持授权配置。
41
+ </div>
42
+
43
+ <a-form layout="vertical" :model="form">
44
+ <a-form-item label="工具名" required>
45
+ <a-input
46
+ v-model:value="form.name"
47
+ placeholder="例如 get_weather"
48
+ />
49
+ </a-form-item>
50
+ <a-form-item label="描述">
51
+ <a-textarea
52
+ v-model:value="form.description"
53
+ placeholder="给模型看的描述,告诉它这个工具能干什么"
54
+ :auto-size="{ minRows: 3, maxRows: 6 }"
55
+ />
56
+ </a-form-item>
57
+ </a-form>
58
+
59
+ <div class="wf-tool-chooser-preview">
60
+ <ToolOutlined style="color: #7c3aed; font-size: 24px" />
61
+ <div>
62
+ <div style="font-weight: 500">{{ form.name || '未命名工具' }}</div>
63
+ <div style="font-size: 11px; color: #6b7280">
64
+ {{ form.description || '尚未填写描述' }}
65
+ </div>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ </a-modal>
70
+ </template>
71
+
72
+ <style scoped>
73
+ .wf-tool-chooser {
74
+ display: flex;
75
+ flex-direction: column;
76
+ gap: 12px;
77
+ padding-top: 8px;
78
+ }
79
+
80
+ .wf-tool-chooser-hint {
81
+ padding: 8px 12px;
82
+ font-size: 12px;
83
+ color: #92400e;
84
+ background: #fef3c7;
85
+ border-radius: 6px;
86
+ }
87
+
88
+ .wf-tool-chooser-preview {
89
+ display: flex;
90
+ align-items: center;
91
+ gap: 12px;
92
+ padding: 12px;
93
+ background: #f3e8ff;
94
+ border-radius: 6px;
95
+ }
96
+ </style>