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,352 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { h, reactive, ref, watchEffect } from 'vue';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
DeleteOutlined,
|
|
6
|
+
EditOutlined,
|
|
7
|
+
PlusOutlined,
|
|
8
|
+
} from '@ant-design/icons-vue';
|
|
9
|
+
|
|
10
|
+
import PromptEditor from '@/components/PromptEditor.vue';
|
|
11
|
+
import VariableSelector from '@/components/VariableSelector.vue';
|
|
12
|
+
import ModelPickerPopover from '../../../provider-hub/components/ModelPickerPopover.vue';
|
|
13
|
+
import WfField from '@/workflow/WfField.vue';
|
|
14
|
+
|
|
15
|
+
defineProps<{ nodeId?: string }>();
|
|
16
|
+
|
|
17
|
+
const formState: any = defineModel();
|
|
18
|
+
|
|
19
|
+
const PARAM_TYPES = [
|
|
20
|
+
{ value: 'string', label: 'String' },
|
|
21
|
+
{ value: 'number', label: 'Number' },
|
|
22
|
+
{ value: 'boolean', label: 'Boolean' },
|
|
23
|
+
{ value: 'array', label: 'Array' },
|
|
24
|
+
{ value: 'object', label: 'Object' },
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
const TYPE_META: Record<string, { label: string; color: string; bg: string }> =
|
|
28
|
+
{
|
|
29
|
+
string: { label: 'Str', color: '#2563eb', bg: '#dbeafe' },
|
|
30
|
+
number: { label: 'Num', color: '#7c3aed', bg: '#ede9fe' },
|
|
31
|
+
boolean: { label: 'Bool', color: '#16a34a', bg: '#dcfce7' },
|
|
32
|
+
array: { label: 'Arr', color: '#ea580c', bg: '#ffedd5' },
|
|
33
|
+
object: { label: 'Obj', color: '#db2777', bg: '#fce7f3' },
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const typeMeta = (t: string) => TYPE_META[t] || TYPE_META.string;
|
|
37
|
+
|
|
38
|
+
// 兼容历史数据:早期保存的节点没有 systemPrompt,进入面板时补一个默认
|
|
39
|
+
// 结构,保证 PromptEditor 的 v-model 有对象可写。
|
|
40
|
+
watchEffect(() => {
|
|
41
|
+
if (formState.value && !formState.value.systemPrompt) {
|
|
42
|
+
formState.value.systemPrompt = {
|
|
43
|
+
id: 'prompt_template',
|
|
44
|
+
role: 'system',
|
|
45
|
+
text: '',
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const modalOpen = ref(false);
|
|
51
|
+
const editingIndex = ref<number>(-1);
|
|
52
|
+
const form = reactive<{
|
|
53
|
+
name: string;
|
|
54
|
+
type: string;
|
|
55
|
+
description: string;
|
|
56
|
+
required: boolean;
|
|
57
|
+
}>({
|
|
58
|
+
name: '',
|
|
59
|
+
type: 'string',
|
|
60
|
+
description: '',
|
|
61
|
+
required: false,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
function openModal(index?: number) {
|
|
65
|
+
if (typeof index === 'number') {
|
|
66
|
+
const src = formState.value.parameters[index] || {};
|
|
67
|
+
editingIndex.value = index;
|
|
68
|
+
form.name = src.name || '';
|
|
69
|
+
form.type = src.type || 'string';
|
|
70
|
+
form.description = src.description || '';
|
|
71
|
+
form.required = !!src.required;
|
|
72
|
+
} else {
|
|
73
|
+
editingIndex.value = -1;
|
|
74
|
+
form.name = '';
|
|
75
|
+
form.type = 'string';
|
|
76
|
+
form.description = '';
|
|
77
|
+
form.required = false;
|
|
78
|
+
}
|
|
79
|
+
modalOpen.value = true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function submitParam() {
|
|
83
|
+
if (!Array.isArray(formState.value.parameters)) {
|
|
84
|
+
formState.value.parameters = [];
|
|
85
|
+
}
|
|
86
|
+
const payload = {
|
|
87
|
+
name: form.name.trim(),
|
|
88
|
+
type: form.type,
|
|
89
|
+
description: form.description,
|
|
90
|
+
required: form.required,
|
|
91
|
+
};
|
|
92
|
+
if (!payload.name) return;
|
|
93
|
+
if (editingIndex.value >= 0) {
|
|
94
|
+
formState.value.parameters[editingIndex.value] = payload;
|
|
95
|
+
} else {
|
|
96
|
+
formState.value.parameters.push(payload);
|
|
97
|
+
}
|
|
98
|
+
modalOpen.value = false;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function removeParam(index: number) {
|
|
102
|
+
formState.value.parameters.splice(index, 1);
|
|
103
|
+
}
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<template>
|
|
107
|
+
<a-modal
|
|
108
|
+
v-model:open="modalOpen"
|
|
109
|
+
:title="editingIndex >= 0 ? '编辑抽取参数' : '新增抽取参数'"
|
|
110
|
+
width="480px"
|
|
111
|
+
:ok-text="editingIndex >= 0 ? '保存' : '添加'"
|
|
112
|
+
cancel-text="取消"
|
|
113
|
+
:ok-button-props="{ disabled: !form.name.trim() }"
|
|
114
|
+
@ok="submitParam"
|
|
115
|
+
>
|
|
116
|
+
<a-form
|
|
117
|
+
layout="vertical"
|
|
118
|
+
:model="form"
|
|
119
|
+
autocomplete="off"
|
|
120
|
+
style="padding-top: 8px"
|
|
121
|
+
>
|
|
122
|
+
<a-form-item label="参数名" required>
|
|
123
|
+
<a-input v-model:value="form.name" placeholder="例如 city" />
|
|
124
|
+
</a-form-item>
|
|
125
|
+
<a-form-item label="类型">
|
|
126
|
+
<a-select v-model:value="form.type" :options="PARAM_TYPES" />
|
|
127
|
+
</a-form-item>
|
|
128
|
+
<a-form-item label="描述">
|
|
129
|
+
<a-textarea
|
|
130
|
+
v-model:value="form.description"
|
|
131
|
+
placeholder="字段说明,用于帮助模型准确抽取,例如:用户所在城市名"
|
|
132
|
+
:auto-size="{ minRows: 2, maxRows: 4 }"
|
|
133
|
+
/>
|
|
134
|
+
</a-form-item>
|
|
135
|
+
<a-form-item>
|
|
136
|
+
<a-checkbox v-model:checked="form.required">必填</a-checkbox>
|
|
137
|
+
</a-form-item>
|
|
138
|
+
</a-form>
|
|
139
|
+
</a-modal>
|
|
140
|
+
|
|
141
|
+
<div class="wf-config-section">
|
|
142
|
+
<WfField title="输入变量" required>
|
|
143
|
+
<VariableSelector
|
|
144
|
+
v-model="formState.inputVariableSelector"
|
|
145
|
+
:node-id="nodeId"
|
|
146
|
+
placeholder="选择输入文本变量"
|
|
147
|
+
/>
|
|
148
|
+
</WfField>
|
|
149
|
+
|
|
150
|
+
<WfField title="模型" required>
|
|
151
|
+
<ModelPickerPopover
|
|
152
|
+
v-model="formState.model"
|
|
153
|
+
model-type="LLM"
|
|
154
|
+
placeholder="点击选择模型"
|
|
155
|
+
:width="440"
|
|
156
|
+
/>
|
|
157
|
+
</WfField>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<!-- SYSTEM 提示词:用于指导抽取任务的上下文/风格;schema 约束仍由后端注入 -->
|
|
161
|
+
<PromptEditor
|
|
162
|
+
v-if="formState.systemPrompt"
|
|
163
|
+
class="wf-config-prompt"
|
|
164
|
+
title="SYSTEM"
|
|
165
|
+
:node-id="nodeId"
|
|
166
|
+
v-model="formState.systemPrompt.text"
|
|
167
|
+
placeholder="可选:补充抽取任务的背景/规则,例如:若字段缺失请返回 null"
|
|
168
|
+
/>
|
|
169
|
+
|
|
170
|
+
<div class="wf-config-section">
|
|
171
|
+
<WfField title="抽取参数">
|
|
172
|
+
<template #tooltip>
|
|
173
|
+
为每个字段定义名称、类型与说明;模型会按此结构从输入中抽取值。
|
|
174
|
+
</template>
|
|
175
|
+
<template #operations>
|
|
176
|
+
<a-button
|
|
177
|
+
:icon="h(PlusOutlined)"
|
|
178
|
+
size="small"
|
|
179
|
+
type="primary"
|
|
180
|
+
@click="openModal()"
|
|
181
|
+
/>
|
|
182
|
+
</template>
|
|
183
|
+
|
|
184
|
+
<div
|
|
185
|
+
v-if="!formState.parameters || formState.parameters.length === 0"
|
|
186
|
+
class="param-empty"
|
|
187
|
+
@click="openModal()"
|
|
188
|
+
>
|
|
189
|
+
<PlusOutlined class="param-empty-icon" />
|
|
190
|
+
<span>点击添加待抽取的参数</span>
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
<div v-else class="param-list">
|
|
194
|
+
<div
|
|
195
|
+
v-for="(p, index) in formState.parameters"
|
|
196
|
+
:key="index"
|
|
197
|
+
class="param-item"
|
|
198
|
+
@click="openModal(index)"
|
|
199
|
+
>
|
|
200
|
+
<div class="param-left">
|
|
201
|
+
<span
|
|
202
|
+
class="param-type-badge"
|
|
203
|
+
:style="{
|
|
204
|
+
color: typeMeta(p.type).color,
|
|
205
|
+
background: typeMeta(p.type).bg,
|
|
206
|
+
}"
|
|
207
|
+
>
|
|
208
|
+
{{ typeMeta(p.type).label }}
|
|
209
|
+
</span>
|
|
210
|
+
<div class="param-text">
|
|
211
|
+
<div class="param-name">
|
|
212
|
+
{{ p.name || '未命名参数' }}
|
|
213
|
+
<span v-if="p.required" class="param-required">*</span>
|
|
214
|
+
</div>
|
|
215
|
+
<div v-if="p.description" class="param-desc">
|
|
216
|
+
{{ p.description }}
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
<div class="param-right" @click.stop>
|
|
221
|
+
<a-button
|
|
222
|
+
:icon="h(EditOutlined)"
|
|
223
|
+
size="small"
|
|
224
|
+
type="text"
|
|
225
|
+
@click="openModal(index)"
|
|
226
|
+
/>
|
|
227
|
+
<a-button
|
|
228
|
+
:icon="h(DeleteOutlined)"
|
|
229
|
+
size="small"
|
|
230
|
+
type="text"
|
|
231
|
+
danger
|
|
232
|
+
@click="removeParam(index)"
|
|
233
|
+
/>
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
</div>
|
|
237
|
+
</WfField>
|
|
238
|
+
</div>
|
|
239
|
+
</template>
|
|
240
|
+
|
|
241
|
+
<style scoped>
|
|
242
|
+
.param-empty {
|
|
243
|
+
display: flex;
|
|
244
|
+
align-items: center;
|
|
245
|
+
justify-content: center;
|
|
246
|
+
gap: 6px;
|
|
247
|
+
padding: 16px;
|
|
248
|
+
font-size: 12px;
|
|
249
|
+
color: #9ca3af;
|
|
250
|
+
background: #fafafa;
|
|
251
|
+
border: 1px dashed #e5e7eb;
|
|
252
|
+
border-radius: 8px;
|
|
253
|
+
cursor: pointer;
|
|
254
|
+
transition:
|
|
255
|
+
color 0.15s,
|
|
256
|
+
border-color 0.15s,
|
|
257
|
+
background 0.15s;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.param-empty:hover {
|
|
261
|
+
color: #eab308;
|
|
262
|
+
border-color: #eab308;
|
|
263
|
+
background: #fefce8;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.param-empty-icon {
|
|
267
|
+
font-size: 12px;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.param-list {
|
|
271
|
+
display: flex;
|
|
272
|
+
flex-direction: column;
|
|
273
|
+
gap: 6px;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.param-item {
|
|
277
|
+
display: flex;
|
|
278
|
+
align-items: center;
|
|
279
|
+
justify-content: space-between;
|
|
280
|
+
gap: 8px;
|
|
281
|
+
padding: 6px 10px;
|
|
282
|
+
background: #f9fafb;
|
|
283
|
+
border: 1px solid #f0f0f0;
|
|
284
|
+
border-radius: 6px;
|
|
285
|
+
cursor: pointer;
|
|
286
|
+
transition:
|
|
287
|
+
background 0.15s,
|
|
288
|
+
border-color 0.15s;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.param-item:hover {
|
|
292
|
+
background: #f3f4f6;
|
|
293
|
+
border-color: #e5e7eb;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.param-left {
|
|
297
|
+
display: flex;
|
|
298
|
+
align-items: center;
|
|
299
|
+
gap: 8px;
|
|
300
|
+
min-width: 0;
|
|
301
|
+
flex: 1;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.param-text {
|
|
305
|
+
min-width: 0;
|
|
306
|
+
flex: 1;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.param-name {
|
|
310
|
+
font-size: 12px;
|
|
311
|
+
font-weight: 500;
|
|
312
|
+
color: #1f2937;
|
|
313
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
314
|
+
white-space: nowrap;
|
|
315
|
+
overflow: hidden;
|
|
316
|
+
text-overflow: ellipsis;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.param-required {
|
|
320
|
+
margin-left: 2px;
|
|
321
|
+
color: #ef4444;
|
|
322
|
+
font-weight: 700;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.param-desc {
|
|
326
|
+
font-size: 11px;
|
|
327
|
+
color: #9ca3af;
|
|
328
|
+
white-space: nowrap;
|
|
329
|
+
overflow: hidden;
|
|
330
|
+
text-overflow: ellipsis;
|
|
331
|
+
margin-top: 1px;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.param-type-badge {
|
|
335
|
+
flex-shrink: 0;
|
|
336
|
+
min-width: 34px;
|
|
337
|
+
padding: 2px 6px;
|
|
338
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
339
|
+
font-size: 11px;
|
|
340
|
+
font-weight: 600;
|
|
341
|
+
line-height: 16px;
|
|
342
|
+
text-align: center;
|
|
343
|
+
border-radius: 4px;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.param-right {
|
|
347
|
+
display: flex;
|
|
348
|
+
align-items: center;
|
|
349
|
+
gap: 2px;
|
|
350
|
+
flex-shrink: 0;
|
|
351
|
+
}
|
|
352
|
+
</style>
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
import WfField from '@/workflow/WfField.vue';
|
|
5
|
+
|
|
6
|
+
import ParamTableItem from '../ParamTableItem.vue';
|
|
7
|
+
|
|
8
|
+
defineProps<{
|
|
9
|
+
/** 当前节点 id —— 变量插入面板需要,用于查询上游节点输出。 */
|
|
10
|
+
nodeId?: string;
|
|
11
|
+
}>();
|
|
12
|
+
|
|
13
|
+
const formState: any = defineModel();
|
|
14
|
+
|
|
15
|
+
const METHODS = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'] as const;
|
|
16
|
+
|
|
17
|
+
const methodStyle = computed(() => {
|
|
18
|
+
const method = (formState.value.method || 'GET').toUpperCase();
|
|
19
|
+
const colors: Record<string, string> = {
|
|
20
|
+
GET: '#2563eb',
|
|
21
|
+
POST: '#059669',
|
|
22
|
+
PUT: '#d97706',
|
|
23
|
+
DELETE: '#dc2626',
|
|
24
|
+
PATCH: '#7c3aed',
|
|
25
|
+
};
|
|
26
|
+
return { '--http-method-color': colors[method] || '#6b7280' };
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const nonEmptyCount = (rows: any) =>
|
|
30
|
+
Array.isArray(rows) ? rows.filter((r) => r && r.name).length : 0;
|
|
31
|
+
const headerCount = computed(() => nonEmptyCount(formState.value.headers));
|
|
32
|
+
const paramCount = computed(() => nonEmptyCount(formState.value.parameters));
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<!-- 接口地址 + 方法 + 超时 一体化 -->
|
|
37
|
+
<div class="wf-config-section">
|
|
38
|
+
<WfField title="接口地址" required>
|
|
39
|
+
<div class="wf-http-url" :style="methodStyle">
|
|
40
|
+
<a-select
|
|
41
|
+
v-model:value="formState.method"
|
|
42
|
+
:bordered="false"
|
|
43
|
+
size="small"
|
|
44
|
+
class="wf-http-method"
|
|
45
|
+
>
|
|
46
|
+
<a-select-option v-for="m in METHODS" :key="m" :value="m">
|
|
47
|
+
{{ m }}
|
|
48
|
+
</a-select-option>
|
|
49
|
+
</a-select>
|
|
50
|
+
<a-input
|
|
51
|
+
v-model:value="formState.url"
|
|
52
|
+
:bordered="false"
|
|
53
|
+
class="wf-http-url-input"
|
|
54
|
+
placeholder="/api/service/endpoint 或 https://..."
|
|
55
|
+
/>
|
|
56
|
+
<a-tooltip title="请求超时(秒),1-600">
|
|
57
|
+
<div class="wf-http-timeout">
|
|
58
|
+
<span class="wf-http-timeout-label">⏱</span>
|
|
59
|
+
<a-input-number
|
|
60
|
+
v-model:value="formState.timeoutSeconds"
|
|
61
|
+
:min="1"
|
|
62
|
+
:max="600"
|
|
63
|
+
:step="1"
|
|
64
|
+
:controls="false"
|
|
65
|
+
:bordered="false"
|
|
66
|
+
size="small"
|
|
67
|
+
placeholder="30"
|
|
68
|
+
class="wf-http-timeout-input"
|
|
69
|
+
/>
|
|
70
|
+
<span class="wf-http-timeout-suffix">s</span>
|
|
71
|
+
</div>
|
|
72
|
+
</a-tooltip>
|
|
73
|
+
</div>
|
|
74
|
+
</WfField>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<!-- 头部参数 -->
|
|
78
|
+
<div class="wf-config-section">
|
|
79
|
+
<WfField title="头部参数" foldable :default-fold="headerCount === 0">
|
|
80
|
+
<template v-if="headerCount > 0" #operations>
|
|
81
|
+
<span class="wf-http-badge">{{ headerCount }}</span>
|
|
82
|
+
</template>
|
|
83
|
+
<ParamTableItem v-model="formState.headers" name="headers" :node-id="nodeId" />
|
|
84
|
+
</WfField>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<!-- 请求参数 -->
|
|
88
|
+
<div class="wf-config-section">
|
|
89
|
+
<WfField title="请求参数" foldable :default-fold="paramCount === 0">
|
|
90
|
+
<template v-if="paramCount > 0" #operations>
|
|
91
|
+
<span class="wf-http-badge">{{ paramCount }}</span>
|
|
92
|
+
</template>
|
|
93
|
+
<ParamTableItem
|
|
94
|
+
v-model="formState.parameters"
|
|
95
|
+
name="parameters"
|
|
96
|
+
:node-id="nodeId"
|
|
97
|
+
/>
|
|
98
|
+
</WfField>
|
|
99
|
+
</div>
|
|
100
|
+
</template>
|
|
101
|
+
|
|
102
|
+
<style scoped>
|
|
103
|
+
.wf-http-url {
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: stretch;
|
|
106
|
+
background: #ffffff;
|
|
107
|
+
border: 1px solid #e5e7eb;
|
|
108
|
+
border-radius: 6px;
|
|
109
|
+
overflow: hidden;
|
|
110
|
+
transition: border-color 0.15s, box-shadow 0.15s;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.wf-http-url:focus-within {
|
|
114
|
+
border-color: #6366f1;
|
|
115
|
+
box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.wf-http-method {
|
|
119
|
+
flex: none;
|
|
120
|
+
width: 88px;
|
|
121
|
+
border-right: 1px solid #e5e7eb;
|
|
122
|
+
background: color-mix(in srgb, var(--http-method-color) 10%, transparent);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.wf-http-method :deep(.ant-select-selector) {
|
|
126
|
+
padding: 0 8px !important;
|
|
127
|
+
font-weight: 700;
|
|
128
|
+
color: var(--http-method-color);
|
|
129
|
+
font-size: 12px;
|
|
130
|
+
letter-spacing: 0.4px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.wf-http-url-input {
|
|
134
|
+
flex: 1;
|
|
135
|
+
min-width: 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.wf-http-timeout {
|
|
139
|
+
display: flex;
|
|
140
|
+
align-items: center;
|
|
141
|
+
flex: none;
|
|
142
|
+
padding: 0 8px;
|
|
143
|
+
gap: 2px;
|
|
144
|
+
color: #6b7280;
|
|
145
|
+
background: #fafafa;
|
|
146
|
+
border-left: 1px solid #e5e7eb;
|
|
147
|
+
font-size: 11px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.wf-http-timeout-label {
|
|
151
|
+
font-size: 12px;
|
|
152
|
+
opacity: 0.7;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.wf-http-timeout-input {
|
|
156
|
+
width: 42px;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.wf-http-timeout-input :deep(.ant-input-number-input) {
|
|
160
|
+
padding: 0 !important;
|
|
161
|
+
height: 30px;
|
|
162
|
+
font-size: 12px;
|
|
163
|
+
text-align: right;
|
|
164
|
+
color: #1f2937;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.wf-http-timeout-suffix {
|
|
168
|
+
font-size: 11px;
|
|
169
|
+
color: #9ca3af;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.wf-http-badge {
|
|
173
|
+
display: inline-flex;
|
|
174
|
+
align-items: center;
|
|
175
|
+
justify-content: center;
|
|
176
|
+
min-width: 18px;
|
|
177
|
+
padding: 0 6px;
|
|
178
|
+
height: 18px;
|
|
179
|
+
font-size: 10px;
|
|
180
|
+
font-weight: 600;
|
|
181
|
+
color: #4338ca;
|
|
182
|
+
background: #eef2ff;
|
|
183
|
+
border-radius: 9px;
|
|
184
|
+
letter-spacing: 0.2px;
|
|
185
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
186
|
+
text-transform: none;
|
|
187
|
+
}
|
|
188
|
+
</style>
|