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,223 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
import PromptEditorTagPanel from '@/components/PromptEditorTagPanel.vue';
|
|
5
|
+
import { useWorkflowStore } from '@/stores/workflow';
|
|
6
|
+
import workflow_utils from '@/workflow/utils/workflow_utils';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* VarSelectField —— 单变量选择器
|
|
10
|
+
*
|
|
11
|
+
* 与 VarInsertField 的区别:VarInsertField 允许文本 + 变量混排,
|
|
12
|
+
* 而这里只能选中一个上游变量。空状态显示 placeholder,选中后
|
|
13
|
+
* 展示一颗带类型色的 pill;点击 pill 上的 × 清空。
|
|
14
|
+
*
|
|
15
|
+
* v-model 仍是 `{{#nodeId.field#}}` 模板字符串(保持与后端
|
|
16
|
+
* VariableResolver 的契约),空值为 ''。
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
interface Props {
|
|
20
|
+
modelValue?: string;
|
|
21
|
+
nodeId: string;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
size?: 'small' | 'middle' | 'large';
|
|
24
|
+
bordered?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
28
|
+
modelValue: '',
|
|
29
|
+
placeholder: '选择变量',
|
|
30
|
+
size: 'small',
|
|
31
|
+
bordered: true,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const emit = defineEmits<{
|
|
35
|
+
(e: 'update:modelValue', v: string): void;
|
|
36
|
+
}>();
|
|
37
|
+
|
|
38
|
+
const workflowStore = useWorkflowStore();
|
|
39
|
+
|
|
40
|
+
const triggerRef = ref<HTMLElement | null>(null);
|
|
41
|
+
const panelOpen = ref(false);
|
|
42
|
+
|
|
43
|
+
/** `{{#nodeId.field#}}` → ["nodeId","field"],非合法模板则 null */
|
|
44
|
+
const selector = computed<string[] | null>(() => {
|
|
45
|
+
const v = (props.modelValue ?? '').trim();
|
|
46
|
+
const m = v.match(/^\{\{#([^}]+)#\}\}$/);
|
|
47
|
+
if (!m) return null;
|
|
48
|
+
const parts = m[1].split('.');
|
|
49
|
+
return parts.length >= 2 ? parts : null;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const pillLabel = computed(() => {
|
|
53
|
+
const sel = selector.value;
|
|
54
|
+
if (!sel) return '';
|
|
55
|
+
return workflow_utils.getVariableLabel(sel) || sel.join('.');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const pillType = computed(() => {
|
|
59
|
+
const sel = selector.value;
|
|
60
|
+
if (!sel || sel.length < 2) return '';
|
|
61
|
+
const [nodeId, ...rest] = sel;
|
|
62
|
+
const node = workflowStore.getNodeById(nodeId);
|
|
63
|
+
if (!node?.data) return '';
|
|
64
|
+
const outputs = workflow_utils.getOutputList(node.data) || [];
|
|
65
|
+
let cur: any = outputs.find((o: any) => o.name === rest[0]);
|
|
66
|
+
for (let i = 1; i < rest.length; i++) {
|
|
67
|
+
if (!cur?.children) return cur?.type ?? '';
|
|
68
|
+
cur = cur.children.find((c: any) => c.name === rest[i]);
|
|
69
|
+
}
|
|
70
|
+
return cur?.type ?? '';
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const pillIconChar = computed(() => (pillType.value?.[0] ?? '·').toUpperCase());
|
|
74
|
+
|
|
75
|
+
function openPanel(e: MouseEvent) {
|
|
76
|
+
e.preventDefault();
|
|
77
|
+
e.stopPropagation();
|
|
78
|
+
panelOpen.value = true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function closePanel() {
|
|
82
|
+
panelOpen.value = false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function onSelect(variableSelector: string[]) {
|
|
86
|
+
emit('update:modelValue', `{{#${variableSelector.join('.')}#}}`);
|
|
87
|
+
closePanel();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function clear(e: MouseEvent) {
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
e.stopPropagation();
|
|
93
|
+
emit('update:modelValue', '');
|
|
94
|
+
}
|
|
95
|
+
</script>
|
|
96
|
+
|
|
97
|
+
<template>
|
|
98
|
+
<div
|
|
99
|
+
ref="triggerRef"
|
|
100
|
+
class="wf-vsf"
|
|
101
|
+
:class="[
|
|
102
|
+
`wf-vsf-${size}`,
|
|
103
|
+
{ 'wf-vsf-borderless': !bordered, 'wf-vsf-filled': !!selector },
|
|
104
|
+
]"
|
|
105
|
+
@click="openPanel"
|
|
106
|
+
>
|
|
107
|
+
<template v-if="selector">
|
|
108
|
+
<span class="wf-vsf-pill" :data-type="pillType" :title="selector.join('.')">
|
|
109
|
+
<span class="wf-vsf-pill-icon">{{ pillIconChar }}</span>
|
|
110
|
+
<span class="wf-vsf-pill-label">{{ pillLabel }}</span>
|
|
111
|
+
<span class="wf-vsf-pill-close" title="清除" @click="clear">×</span>
|
|
112
|
+
</span>
|
|
113
|
+
</template>
|
|
114
|
+
<span v-else class="wf-vsf-placeholder">{{ placeholder }}</span>
|
|
115
|
+
|
|
116
|
+
<PromptEditorTagPanel
|
|
117
|
+
:show="panelOpen"
|
|
118
|
+
:node-id="nodeId"
|
|
119
|
+
:target-element="triggerRef"
|
|
120
|
+
@close="closePanel"
|
|
121
|
+
@select="onSelect"
|
|
122
|
+
/>
|
|
123
|
+
</div>
|
|
124
|
+
</template>
|
|
125
|
+
|
|
126
|
+
<style scoped>
|
|
127
|
+
.wf-vsf {
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
width: 100%;
|
|
131
|
+
min-height: 24px;
|
|
132
|
+
padding: 2px 6px;
|
|
133
|
+
background: #ffffff;
|
|
134
|
+
border: 1px solid #e5e7eb;
|
|
135
|
+
border-radius: 4px;
|
|
136
|
+
cursor: pointer;
|
|
137
|
+
transition: border-color 0.15s, box-shadow 0.15s;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.wf-vsf:hover {
|
|
141
|
+
border-color: #a5b4fc;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.wf-vsf-filled {
|
|
145
|
+
background: #f9fafb;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.wf-vsf-borderless {
|
|
149
|
+
border-color: transparent;
|
|
150
|
+
background: transparent;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.wf-vsf-borderless:hover {
|
|
154
|
+
border-color: transparent;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.wf-vsf-small { min-height: 24px; font-size: 13px; }
|
|
158
|
+
.wf-vsf-middle { min-height: 32px; font-size: 14px; }
|
|
159
|
+
.wf-vsf-large { min-height: 40px; font-size: 15px; }
|
|
160
|
+
|
|
161
|
+
.wf-vsf-placeholder {
|
|
162
|
+
color: #9ca3af;
|
|
163
|
+
font-size: 12px;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.wf-vsf-pill {
|
|
167
|
+
display: inline-flex;
|
|
168
|
+
align-items: center;
|
|
169
|
+
gap: 3px;
|
|
170
|
+
padding: 0 3px 0 2px;
|
|
171
|
+
font-size: 12px;
|
|
172
|
+
line-height: 1.4;
|
|
173
|
+
color: #1f2937;
|
|
174
|
+
background: #eef2ff;
|
|
175
|
+
border: 1px solid #c7d2fe;
|
|
176
|
+
border-radius: 4px;
|
|
177
|
+
user-select: none;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.wf-vsf-pill-icon {
|
|
181
|
+
display: inline-flex;
|
|
182
|
+
align-items: center;
|
|
183
|
+
justify-content: center;
|
|
184
|
+
width: 12px;
|
|
185
|
+
height: 12px;
|
|
186
|
+
font-size: 8px;
|
|
187
|
+
font-weight: 700;
|
|
188
|
+
color: #ffffff;
|
|
189
|
+
background: #6366f1;
|
|
190
|
+
border-radius: 2px;
|
|
191
|
+
text-transform: uppercase;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.wf-vsf-pill[data-type='string'] .wf-vsf-pill-icon { background: #3b82f6; }
|
|
195
|
+
.wf-vsf-pill[data-type='number'] .wf-vsf-pill-icon { background: #f59e0b; }
|
|
196
|
+
.wf-vsf-pill[data-type='boolean'] .wf-vsf-pill-icon { background: #10b981; }
|
|
197
|
+
.wf-vsf-pill[data-type='array'] .wf-vsf-pill-icon { background: #a855f7; }
|
|
198
|
+
.wf-vsf-pill[data-type='object'] .wf-vsf-pill-icon { background: #6b7280; }
|
|
199
|
+
.wf-vsf-pill[data-type='file'] .wf-vsf-pill-icon { background: #ef4444; }
|
|
200
|
+
|
|
201
|
+
.wf-vsf-pill-label {
|
|
202
|
+
color: #4338ca;
|
|
203
|
+
font-weight: 500;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.wf-vsf-pill-close {
|
|
207
|
+
display: inline-flex;
|
|
208
|
+
align-items: center;
|
|
209
|
+
justify-content: center;
|
|
210
|
+
width: 12px;
|
|
211
|
+
height: 12px;
|
|
212
|
+
font-size: 12px;
|
|
213
|
+
line-height: 1;
|
|
214
|
+
color: #6366f1;
|
|
215
|
+
border-radius: 50%;
|
|
216
|
+
cursor: pointer;
|
|
217
|
+
transition: background 0.15s;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.wf-vsf-pill-close:hover {
|
|
221
|
+
background: #c7d2fe;
|
|
222
|
+
}
|
|
223
|
+
</style>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
readonly: {
|
|
6
|
+
type: Boolean,
|
|
7
|
+
default: () => false,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
const targetElement = ref(null);
|
|
11
|
+
const showAttr = ref<boolean>(false);
|
|
12
|
+
const formState: any = defineModel();
|
|
13
|
+
|
|
14
|
+
const checkAttr = (event: any) => {
|
|
15
|
+
const element = event.currentTarget;
|
|
16
|
+
targetElement.value = element;
|
|
17
|
+
showAttr.value = true;
|
|
18
|
+
};
|
|
19
|
+
const closeAttrPanel = () => {
|
|
20
|
+
showAttr.value = false;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const selectAttr = (variableSelector: any, tag: any, node: any) => {
|
|
24
|
+
formState.value.queryVariableSelector = variableSelector;
|
|
25
|
+
showAttr.value = false;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const getVarLabel = (variableSelector) => {
|
|
29
|
+
return '';
|
|
30
|
+
};
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<div>
|
|
35
|
+
<div
|
|
36
|
+
v-if="readonly"
|
|
37
|
+
@click="checkAttr($event)"
|
|
38
|
+
class="flex h-8 w-full cursor-pointer items-center rounded-lg border p-1"
|
|
39
|
+
>
|
|
40
|
+
<a-tag class="text-primary">
|
|
41
|
+
{{ getVarLabel(formState.variableSelector) }}
|
|
42
|
+
</a-tag>
|
|
43
|
+
</div>
|
|
44
|
+
<a-input v-else v-model:value="formState.value" />
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<style scoped></style>
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
DownOutlined,
|
|
6
|
+
QuestionCircleOutlined,
|
|
7
|
+
RightOutlined,
|
|
8
|
+
} from '@ant-design/icons-vue';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* WfField —— 对标 Dify 的 Field 组件
|
|
12
|
+
* 统一提供:title / tooltip / operations(右上角操作区)/ children 四部分
|
|
13
|
+
* 减少 nodeCard 里重复的 `.wf-config-section-title` 结构
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <WfField title="模型" required :warning="hasWarning">
|
|
17
|
+
* <ModelPickerPopover v-model="formState.model" />
|
|
18
|
+
* <template #operations>
|
|
19
|
+
* <a-button size="small">使用默认</a-button>
|
|
20
|
+
* </template>
|
|
21
|
+
* <template #tooltip>选择要调用的 LLM 模型</template>
|
|
22
|
+
* </WfField>
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
interface Props {
|
|
26
|
+
title?: string;
|
|
27
|
+
/** 副标题时字号收敛 */
|
|
28
|
+
isSubtitle?: boolean;
|
|
29
|
+
/** 是否必填(标题后加 *) */
|
|
30
|
+
required?: boolean;
|
|
31
|
+
/** 是否显示警告点(标题后加红点) */
|
|
32
|
+
warning?: boolean;
|
|
33
|
+
/** 支持折叠 */
|
|
34
|
+
foldable?: boolean;
|
|
35
|
+
/** 折叠默认状态 */
|
|
36
|
+
defaultFold?: boolean;
|
|
37
|
+
/** 内联布局:title 左、children 右(不占单独行) */
|
|
38
|
+
inline?: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
42
|
+
title: '',
|
|
43
|
+
isSubtitle: false,
|
|
44
|
+
required: false,
|
|
45
|
+
warning: false,
|
|
46
|
+
foldable: false,
|
|
47
|
+
defaultFold: false,
|
|
48
|
+
inline: false,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const folded = ref(props.defaultFold);
|
|
52
|
+
const showBody = computed(() => !props.foldable || !folded.value);
|
|
53
|
+
|
|
54
|
+
const toggleFold = () => {
|
|
55
|
+
if (props.foldable) folded.value = !folded.value;
|
|
56
|
+
};
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<template>
|
|
60
|
+
<div class="wf-field" :class="{ 'wf-field-inline': inline }">
|
|
61
|
+
<div
|
|
62
|
+
v-if="title || $slots.title || $slots.operations || $slots.tooltip"
|
|
63
|
+
class="wf-field-header"
|
|
64
|
+
:class="{ 'wf-field-header-clickable': foldable }"
|
|
65
|
+
@click="toggleFold"
|
|
66
|
+
>
|
|
67
|
+
<div class="wf-field-title-wrap">
|
|
68
|
+
<RightOutlined
|
|
69
|
+
v-if="foldable && folded"
|
|
70
|
+
class="wf-field-fold-icon"
|
|
71
|
+
/>
|
|
72
|
+
<DownOutlined
|
|
73
|
+
v-else-if="foldable"
|
|
74
|
+
class="wf-field-fold-icon"
|
|
75
|
+
/>
|
|
76
|
+
<div
|
|
77
|
+
class="wf-field-title"
|
|
78
|
+
:class="{ 'wf-field-title-sub': isSubtitle }"
|
|
79
|
+
>
|
|
80
|
+
<slot name="title">{{ title }}</slot>
|
|
81
|
+
<span v-if="required" class="wf-field-required">*</span>
|
|
82
|
+
<span v-if="warning" class="wf-field-warning-dot" />
|
|
83
|
+
<a-tooltip v-if="$slots.tooltip">
|
|
84
|
+
<template #title>
|
|
85
|
+
<slot name="tooltip" />
|
|
86
|
+
</template>
|
|
87
|
+
<QuestionCircleOutlined class="wf-field-help-icon" />
|
|
88
|
+
</a-tooltip>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
<div v-if="$slots.operations" class="wf-field-operations" @click.stop>
|
|
92
|
+
<slot name="operations" />
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
<div v-if="showBody" class="wf-field-body" :class="{ 'wf-field-body-titled': title || $slots.title }">
|
|
96
|
+
<slot />
|
|
97
|
+
</div>
|
|
98
|
+
<div v-if="$slots.hint && showBody" class="wf-field-hint">
|
|
99
|
+
<slot name="hint" />
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
</template>
|
|
103
|
+
|
|
104
|
+
<style scoped>
|
|
105
|
+
.wf-field {
|
|
106
|
+
display: flex;
|
|
107
|
+
flex-direction: column;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.wf-field + .wf-field {
|
|
111
|
+
margin-top: 12px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.wf-field-inline {
|
|
115
|
+
flex-direction: row;
|
|
116
|
+
align-items: center;
|
|
117
|
+
justify-content: space-between;
|
|
118
|
+
gap: 8px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.wf-field-inline .wf-field-body {
|
|
122
|
+
flex: 0 1 auto;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.wf-field-header {
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
justify-content: space-between;
|
|
129
|
+
gap: 8px;
|
|
130
|
+
min-height: 20px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.wf-field-header-clickable {
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
user-select: none;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.wf-field-title-wrap {
|
|
139
|
+
display: flex;
|
|
140
|
+
align-items: center;
|
|
141
|
+
gap: 4px;
|
|
142
|
+
min-width: 0;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.wf-field-fold-icon {
|
|
146
|
+
font-size: 10px;
|
|
147
|
+
color: #9ca3af;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.wf-field-title {
|
|
151
|
+
display: inline-flex;
|
|
152
|
+
align-items: center;
|
|
153
|
+
gap: 4px;
|
|
154
|
+
font-size: 12px;
|
|
155
|
+
font-weight: 600;
|
|
156
|
+
line-height: 1.4;
|
|
157
|
+
color: #1f2937;
|
|
158
|
+
text-transform: uppercase;
|
|
159
|
+
letter-spacing: 0.3px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.wf-field-title-sub {
|
|
163
|
+
font-size: 11px;
|
|
164
|
+
color: #4b5563;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.wf-field-required {
|
|
168
|
+
color: #ef4444;
|
|
169
|
+
font-weight: 700;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.wf-field-warning-dot {
|
|
173
|
+
display: inline-block;
|
|
174
|
+
width: 6px;
|
|
175
|
+
height: 6px;
|
|
176
|
+
background: #ef4444;
|
|
177
|
+
border-radius: 50%;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.wf-field-help-icon {
|
|
181
|
+
font-size: 12px;
|
|
182
|
+
color: #9ca3af;
|
|
183
|
+
cursor: help;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.wf-field-help-icon:hover {
|
|
187
|
+
color: #4b5563;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.wf-field-operations {
|
|
191
|
+
display: flex;
|
|
192
|
+
align-items: center;
|
|
193
|
+
gap: 4px;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.wf-field-body-titled {
|
|
197
|
+
margin-top: 6px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.wf-field-hint {
|
|
201
|
+
margin-top: 4px;
|
|
202
|
+
font-size: 11px;
|
|
203
|
+
line-height: 1.5;
|
|
204
|
+
color: #9ca3af;
|
|
205
|
+
}
|
|
206
|
+
</style>
|