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,200 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { DeleteOutlined, PlusOutlined } from '@ant-design/icons-vue';
|
|
3
|
+
|
|
4
|
+
import VarSelectField from './VarSelectField.vue';
|
|
5
|
+
|
|
6
|
+
defineProps({
|
|
7
|
+
name: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: '',
|
|
10
|
+
},
|
|
11
|
+
/** 当前节点 id —— 变量插入面板需要,用来查询上游节点输出。 */
|
|
12
|
+
nodeId: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: '',
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const formState: any = defineModel();
|
|
19
|
+
|
|
20
|
+
function addItem() {
|
|
21
|
+
if (!Array.isArray(formState.value)) formState.value = [];
|
|
22
|
+
formState.value.push({ name: '', value: '', type: 'text' });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function removeItem(index: number) {
|
|
26
|
+
formState.value.splice(index, 1);
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<div class="wf-param-table">
|
|
32
|
+
<div class="wf-param-table-header">
|
|
33
|
+
<div class="wf-param-cell wf-param-cell-key">键</div>
|
|
34
|
+
<div v-if="name === 'FORM_DATA'" class="wf-param-cell wf-param-cell-type">
|
|
35
|
+
类型
|
|
36
|
+
</div>
|
|
37
|
+
<div class="wf-param-cell wf-param-cell-value">值</div>
|
|
38
|
+
<div class="wf-param-cell wf-param-cell-action">
|
|
39
|
+
<button class="wf-param-add" title="添加" @click="addItem">
|
|
40
|
+
<PlusOutlined />
|
|
41
|
+
</button>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<div v-if="!formState || formState.length === 0" class="wf-param-empty">
|
|
46
|
+
暂无条目,点击 + 添加
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div
|
|
50
|
+
v-for="(it, index) in formState"
|
|
51
|
+
:key="index"
|
|
52
|
+
class="wf-param-table-row"
|
|
53
|
+
>
|
|
54
|
+
<div class="wf-param-cell wf-param-cell-key">
|
|
55
|
+
<a-input
|
|
56
|
+
v-model:value="it.name"
|
|
57
|
+
:bordered="false"
|
|
58
|
+
size="small"
|
|
59
|
+
placeholder="key"
|
|
60
|
+
/>
|
|
61
|
+
</div>
|
|
62
|
+
<div v-if="name === 'FORM_DATA'" class="wf-param-cell wf-param-cell-type">
|
|
63
|
+
<a-select
|
|
64
|
+
v-model:value="it.type"
|
|
65
|
+
:bordered="false"
|
|
66
|
+
size="small"
|
|
67
|
+
style="width: 100%"
|
|
68
|
+
>
|
|
69
|
+
<a-select-option value="TEXT">text</a-select-option>
|
|
70
|
+
<a-select-option value="FILE">file</a-select-option>
|
|
71
|
+
</a-select>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="wf-param-cell wf-param-cell-value">
|
|
74
|
+
<VarSelectField
|
|
75
|
+
v-model="it.value"
|
|
76
|
+
:node-id="nodeId"
|
|
77
|
+
:bordered="false"
|
|
78
|
+
size="small"
|
|
79
|
+
placeholder="选择变量"
|
|
80
|
+
/>
|
|
81
|
+
</div>
|
|
82
|
+
<div class="wf-param-cell wf-param-cell-action">
|
|
83
|
+
<button class="wf-param-del" title="删除" @click="removeItem(index)">
|
|
84
|
+
<DeleteOutlined />
|
|
85
|
+
</button>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
</template>
|
|
90
|
+
|
|
91
|
+
<style scoped>
|
|
92
|
+
.wf-param-table {
|
|
93
|
+
border: 1px solid #e5e7eb;
|
|
94
|
+
border-radius: 6px;
|
|
95
|
+
overflow: hidden;
|
|
96
|
+
background: #ffffff;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.wf-param-table-header {
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
padding: 4px 0;
|
|
103
|
+
background: #f9fafb;
|
|
104
|
+
border-bottom: 1px solid #f0f0f0;
|
|
105
|
+
font-size: 11px;
|
|
106
|
+
font-weight: 600;
|
|
107
|
+
color: #6b7280;
|
|
108
|
+
text-transform: uppercase;
|
|
109
|
+
letter-spacing: 0.3px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.wf-param-table-row {
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
border-bottom: 1px solid #f3f4f6;
|
|
116
|
+
transition: background 0.12s;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.wf-param-table-row:last-child {
|
|
120
|
+
border-bottom: 0;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.wf-param-table-row:hover {
|
|
124
|
+
background: #f9fafb;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.wf-param-cell {
|
|
128
|
+
padding: 4px 8px;
|
|
129
|
+
min-width: 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.wf-param-cell-key {
|
|
133
|
+
flex: 1;
|
|
134
|
+
min-width: 60px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.wf-param-cell-type {
|
|
138
|
+
width: 88px;
|
|
139
|
+
border-left: 1px solid #f0f0f0;
|
|
140
|
+
border-right: 1px solid #f0f0f0;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.wf-param-cell-value {
|
|
144
|
+
flex: 2;
|
|
145
|
+
min-width: 80px;
|
|
146
|
+
border-left: 1px solid #f0f0f0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.wf-param-cell-action {
|
|
150
|
+
width: 32px;
|
|
151
|
+
display: flex;
|
|
152
|
+
align-items: center;
|
|
153
|
+
justify-content: center;
|
|
154
|
+
border-left: 1px solid #f0f0f0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.wf-param-cell :deep(.ant-input),
|
|
158
|
+
.wf-param-cell :deep(.ant-select-selector) {
|
|
159
|
+
padding: 0 !important;
|
|
160
|
+
background: transparent !important;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.wf-param-cell :deep(.ant-input:focus),
|
|
164
|
+
.wf-param-cell :deep(.ant-select-focused .ant-select-selector) {
|
|
165
|
+
box-shadow: none !important;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.wf-param-add,
|
|
169
|
+
.wf-param-del {
|
|
170
|
+
display: inline-flex;
|
|
171
|
+
align-items: center;
|
|
172
|
+
justify-content: center;
|
|
173
|
+
width: 20px;
|
|
174
|
+
height: 20px;
|
|
175
|
+
color: #6b7280;
|
|
176
|
+
background: transparent;
|
|
177
|
+
border: none;
|
|
178
|
+
border-radius: 4px;
|
|
179
|
+
cursor: pointer;
|
|
180
|
+
font-size: 11px;
|
|
181
|
+
transition: background 0.15s, color 0.15s;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.wf-param-add:hover {
|
|
185
|
+
color: #4338ca;
|
|
186
|
+
background: #eef2ff;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.wf-param-del:hover {
|
|
190
|
+
color: #dc2626;
|
|
191
|
+
background: #fef2f2;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.wf-param-empty {
|
|
195
|
+
padding: 12px;
|
|
196
|
+
text-align: center;
|
|
197
|
+
font-size: 12px;
|
|
198
|
+
color: #9ca3af;
|
|
199
|
+
}
|
|
200
|
+
</style>
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { onMounted, ref, watch } from 'vue';
|
|
3
|
+
|
|
4
|
+
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons-vue';
|
|
5
|
+
|
|
6
|
+
const emit = defineEmits(['update']);
|
|
7
|
+
|
|
8
|
+
const visible = ref<boolean>(false);
|
|
9
|
+
const model: any = defineModel();
|
|
10
|
+
const formState: any = ref({});
|
|
11
|
+
|
|
12
|
+
function treeDataToSchema(treeData: any) {
|
|
13
|
+
const result: any = {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {},
|
|
16
|
+
required: [],
|
|
17
|
+
additionalProperties: false,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
treeData.forEach((item: any) => {
|
|
21
|
+
const property: any = {
|
|
22
|
+
type: item.type,
|
|
23
|
+
description: item.description,
|
|
24
|
+
label: item.description,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
if (item.type === 'object' && item.children) {
|
|
28
|
+
property.additionalProperties = false;
|
|
29
|
+
property.properties =
|
|
30
|
+
item.children.length > 0
|
|
31
|
+
? treeDataToSchema(item.children).properties
|
|
32
|
+
: {};
|
|
33
|
+
property.required = [];
|
|
34
|
+
}
|
|
35
|
+
result.properties[item.name] = property;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function schemaToTreeData(schema: any): any[] {
|
|
42
|
+
if (!schema.properties) return [];
|
|
43
|
+
|
|
44
|
+
return Object.entries(schema.properties).map(
|
|
45
|
+
([name, prop]: [string, any]) => {
|
|
46
|
+
const item: any = {
|
|
47
|
+
description: prop.description || '',
|
|
48
|
+
name,
|
|
49
|
+
type: prop.type,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
if (prop.type === 'object' && prop.properties) {
|
|
53
|
+
item.children = schemaToTreeData(prop);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return item;
|
|
57
|
+
},
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const treeData = ref([
|
|
62
|
+
{
|
|
63
|
+
description: '分类',
|
|
64
|
+
name: 'category',
|
|
65
|
+
type: 'string',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
description: '意图',
|
|
69
|
+
name: 'intention',
|
|
70
|
+
type: 'string',
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
{
|
|
74
|
+
description: '参数',
|
|
75
|
+
name: 'parameter',
|
|
76
|
+
type: 'object',
|
|
77
|
+
children: [],
|
|
78
|
+
},
|
|
79
|
+
]);
|
|
80
|
+
|
|
81
|
+
const toAddItem = (item: any) => {
|
|
82
|
+
visible.value = true;
|
|
83
|
+
};
|
|
84
|
+
const toEditItem = (item: any) => {
|
|
85
|
+
formState.value = { ...item };
|
|
86
|
+
visible.value = true;
|
|
87
|
+
};
|
|
88
|
+
const removeItem = (item: any) => {};
|
|
89
|
+
const submitForm = () => {
|
|
90
|
+
visible.value = false;
|
|
91
|
+
};
|
|
92
|
+
const closePanel = () => {
|
|
93
|
+
visible.value = false;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// 监听 model -> 更新 treeData
|
|
97
|
+
watch(
|
|
98
|
+
model,
|
|
99
|
+
(newData) => {
|
|
100
|
+
treeData.value = schemaToTreeData(newData);
|
|
101
|
+
},
|
|
102
|
+
{ deep: true },
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
watch(
|
|
106
|
+
treeData,
|
|
107
|
+
(newData) => {
|
|
108
|
+
emit('update', newData);
|
|
109
|
+
model.value = treeDataToSchema(newData);
|
|
110
|
+
},
|
|
111
|
+
{ deep: true },
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
onMounted(() => {
|
|
115
|
+
emit('update', treeData.value);
|
|
116
|
+
// model.value = treeDataToSchema(treeData.value);
|
|
117
|
+
});
|
|
118
|
+
</script>
|
|
119
|
+
|
|
120
|
+
<template>
|
|
121
|
+
<div>
|
|
122
|
+
<a-table
|
|
123
|
+
size="small"
|
|
124
|
+
:data-source="treeData"
|
|
125
|
+
:row-selection="rowSelection"
|
|
126
|
+
:pagination="false"
|
|
127
|
+
>
|
|
128
|
+
<a-table-column data-index="name" title="名称" />
|
|
129
|
+
<a-table-column data-index="description" title="描述" />
|
|
130
|
+
<a-table-column data-index="type" title="类型" />
|
|
131
|
+
<a-table-column data-index="action">
|
|
132
|
+
<template #title>
|
|
133
|
+
<span>操作</span>
|
|
134
|
+
<a class="vben-link" @click="toAddItem">
|
|
135
|
+
<PlusOutlined />
|
|
136
|
+
</a>
|
|
137
|
+
</template>
|
|
138
|
+
</a-table-column>
|
|
139
|
+
<template #bodyCell="{ column, text, record }">
|
|
140
|
+
<template v-if="column.dataIndex === 'name'">
|
|
141
|
+
<a class="vben-link" @click="toEditItem(record)">
|
|
142
|
+
{{ text }}
|
|
143
|
+
</a>
|
|
144
|
+
</template>
|
|
145
|
+
<template v-if="column.dataIndex === 'action'">
|
|
146
|
+
<div class="flex gap-2">
|
|
147
|
+
<a-popconfirm title="确定要删除吗?" @confirm="removeItem(record)">
|
|
148
|
+
<a class="vben-link text-red-800">
|
|
149
|
+
<MinusCircleOutlined />
|
|
150
|
+
</a>
|
|
151
|
+
</a-popconfirm>
|
|
152
|
+
<a
|
|
153
|
+
class="vben-link"
|
|
154
|
+
v-if="record.type === 'object'"
|
|
155
|
+
@click="toAddItem(record)"
|
|
156
|
+
>
|
|
157
|
+
<PlusOutlined />
|
|
158
|
+
</a>
|
|
159
|
+
</div>
|
|
160
|
+
</template>
|
|
161
|
+
</template>
|
|
162
|
+
</a-table>
|
|
163
|
+
<div class="w-full text-center">
|
|
164
|
+
<a-popover v-model:open="visible" title="结构化数据定义" trigger="click">
|
|
165
|
+
<template #content>
|
|
166
|
+
<div>
|
|
167
|
+
<a-form
|
|
168
|
+
:model="formState"
|
|
169
|
+
name="basic"
|
|
170
|
+
:label-col="{ span: 6 }"
|
|
171
|
+
:wrapper-col="{ span: 16 }"
|
|
172
|
+
autocomplete="off"
|
|
173
|
+
layout="horizontal"
|
|
174
|
+
>
|
|
175
|
+
<a-form-item label="名称" name="name">
|
|
176
|
+
<a-input v-model:value="formState.name" />
|
|
177
|
+
</a-form-item>
|
|
178
|
+
<a-form-item label="描述" name="modelId">
|
|
179
|
+
<a-input v-model:value="formState.description" />
|
|
180
|
+
</a-form-item>
|
|
181
|
+
<a-form-item label="类型" name="type">
|
|
182
|
+
<a-input v-model:value="formState.type" />
|
|
183
|
+
</a-form-item>
|
|
184
|
+
<a-form-item label="示例" name="type">
|
|
185
|
+
<a-input v-model:value="formState.example" />
|
|
186
|
+
</a-form-item>
|
|
187
|
+
</a-form>
|
|
188
|
+
<div class="flex justify-end gap-2 pb-2 text-right">
|
|
189
|
+
<a-button size="small" @click="closePanel"> 关闭 </a-button>
|
|
190
|
+
<a-button type="primary" size="small" @click="submitForm">
|
|
191
|
+
确定
|
|
192
|
+
</a-button>
|
|
193
|
+
</div>
|
|
194
|
+
</div>
|
|
195
|
+
</template>
|
|
196
|
+
<a-button />
|
|
197
|
+
</a-popover>
|
|
198
|
+
</div>
|
|
199
|
+
</div>
|
|
200
|
+
</template>
|
|
201
|
+
|
|
202
|
+
<style scoped></style>
|