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,237 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* 提示词 block from Dify's orchestrate tab. Textarea + "生成" chip (host wires
|
|
4
|
+
* up prompt-generation via `generate`) + variable insertion helpers.
|
|
5
|
+
*/
|
|
6
|
+
import { computed, ref } from 'vue';
|
|
7
|
+
|
|
8
|
+
import type { PromptVariable } from '../types';
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
modelValue: string;
|
|
12
|
+
variables?: PromptVariable[];
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
17
|
+
variables: () => [],
|
|
18
|
+
placeholder: '在这里写下你的提示词,输入「{」插入变量、输入「/」插入提示内容块',
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const emit = defineEmits<{
|
|
22
|
+
(e: 'update:modelValue', v: string): void;
|
|
23
|
+
(e: 'generate'): void;
|
|
24
|
+
}>();
|
|
25
|
+
|
|
26
|
+
const textarea = ref<HTMLTextAreaElement | null>(null);
|
|
27
|
+
const showVars = ref(false);
|
|
28
|
+
|
|
29
|
+
const insertableVars = computed(() =>
|
|
30
|
+
props.variables.filter((v) => v.key.trim().length > 0),
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
function onInput(e: Event) {
|
|
34
|
+
const t = e.target as HTMLTextAreaElement;
|
|
35
|
+
emit('update:modelValue', t.value);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function tokenOf(key: string): string {
|
|
39
|
+
// Split concatenation so the Vue template compiler doesn't misread the
|
|
40
|
+
// inner `{{` as a mustache when this helper is called from the template.
|
|
41
|
+
return '{' + '{#' + key + '#}' + '}';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function insertVariable(v: PromptVariable) {
|
|
45
|
+
const el = textarea.value;
|
|
46
|
+
const token = tokenOf(v.key);
|
|
47
|
+
if (!el) {
|
|
48
|
+
emit('update:modelValue', (props.modelValue ?? '') + token);
|
|
49
|
+
showVars.value = false;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const start = el.selectionStart ?? props.modelValue.length;
|
|
53
|
+
const end = el.selectionEnd ?? start;
|
|
54
|
+
const next = props.modelValue.slice(0, start) + token + props.modelValue.slice(end);
|
|
55
|
+
emit('update:modelValue', next);
|
|
56
|
+
showVars.value = false;
|
|
57
|
+
requestAnimationFrame(() => {
|
|
58
|
+
el.focus();
|
|
59
|
+
const caret = start + token.length;
|
|
60
|
+
el.setSelectionRange(caret, caret);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<template>
|
|
66
|
+
<div class="prompt-card">
|
|
67
|
+
<div class="prompt-head">
|
|
68
|
+
<div class="prompt-title">
|
|
69
|
+
提示词
|
|
70
|
+
<span class="prompt-help" title="用变量占位符 {{#key#}} 引用左侧变量">
|
|
71
|
+
ⓘ
|
|
72
|
+
</span>
|
|
73
|
+
</div>
|
|
74
|
+
<div class="prompt-head-actions">
|
|
75
|
+
<button
|
|
76
|
+
v-if="insertableVars.length > 0"
|
|
77
|
+
type="button"
|
|
78
|
+
class="prompt-chip"
|
|
79
|
+
@click="showVars = !showVars"
|
|
80
|
+
>
|
|
81
|
+
+ 变量
|
|
82
|
+
</button>
|
|
83
|
+
<button type="button" class="prompt-chip prompt-chip-primary" @click="emit('generate')">
|
|
84
|
+
✨ 生成
|
|
85
|
+
</button>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
<div class="prompt-body">
|
|
89
|
+
<textarea
|
|
90
|
+
ref="textarea"
|
|
91
|
+
:value="modelValue"
|
|
92
|
+
class="prompt-textarea"
|
|
93
|
+
:placeholder="placeholder"
|
|
94
|
+
rows="8"
|
|
95
|
+
@input="onInput"
|
|
96
|
+
/>
|
|
97
|
+
<div v-if="showVars" class="prompt-var-pop">
|
|
98
|
+
<div class="prompt-var-title">插入变量</div>
|
|
99
|
+
<button
|
|
100
|
+
v-for="v in insertableVars"
|
|
101
|
+
:key="v.key"
|
|
102
|
+
type="button"
|
|
103
|
+
class="prompt-var-item"
|
|
104
|
+
@click="insertVariable(v)"
|
|
105
|
+
>
|
|
106
|
+
<code>{{ tokenOf(v.key) }}</code>
|
|
107
|
+
<span class="prompt-var-item-label">{{ v.label || v.key }}</span>
|
|
108
|
+
</button>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
<div class="prompt-footer">
|
|
112
|
+
<span class="prompt-count">{{ modelValue?.length ?? 0 }} 字符</span>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
</template>
|
|
116
|
+
|
|
117
|
+
<style scoped>
|
|
118
|
+
.prompt-card {
|
|
119
|
+
padding: 12px 14px 8px;
|
|
120
|
+
background: #fff;
|
|
121
|
+
border: 1.5px solid #6366f1;
|
|
122
|
+
border-radius: 12px;
|
|
123
|
+
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
|
|
124
|
+
}
|
|
125
|
+
.prompt-head {
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
justify-content: space-between;
|
|
129
|
+
margin-bottom: 6px;
|
|
130
|
+
}
|
|
131
|
+
.prompt-title {
|
|
132
|
+
font-size: 13px;
|
|
133
|
+
font-weight: 600;
|
|
134
|
+
color: #334155;
|
|
135
|
+
}
|
|
136
|
+
.prompt-help {
|
|
137
|
+
margin-left: 4px;
|
|
138
|
+
color: #94a3b8;
|
|
139
|
+
font-size: 11px;
|
|
140
|
+
cursor: help;
|
|
141
|
+
}
|
|
142
|
+
.prompt-head-actions {
|
|
143
|
+
display: flex;
|
|
144
|
+
align-items: center;
|
|
145
|
+
gap: 6px;
|
|
146
|
+
}
|
|
147
|
+
.prompt-chip {
|
|
148
|
+
padding: 3px 10px;
|
|
149
|
+
border: 1px solid #e2e8f0;
|
|
150
|
+
border-radius: 999px;
|
|
151
|
+
background: #fff;
|
|
152
|
+
font-size: 12px;
|
|
153
|
+
color: #4338ca;
|
|
154
|
+
cursor: pointer;
|
|
155
|
+
transition: background 0.15s;
|
|
156
|
+
}
|
|
157
|
+
.prompt-chip:hover {
|
|
158
|
+
background: #eef2ff;
|
|
159
|
+
}
|
|
160
|
+
.prompt-chip-primary {
|
|
161
|
+
background: linear-gradient(135deg, #eef2ff, #e0e7ff);
|
|
162
|
+
border-color: #c7d2fe;
|
|
163
|
+
}
|
|
164
|
+
.prompt-body {
|
|
165
|
+
position: relative;
|
|
166
|
+
}
|
|
167
|
+
.prompt-textarea {
|
|
168
|
+
width: 100%;
|
|
169
|
+
min-height: 180px;
|
|
170
|
+
padding: 8px 4px;
|
|
171
|
+
border: none;
|
|
172
|
+
outline: none;
|
|
173
|
+
resize: vertical;
|
|
174
|
+
font-family: inherit;
|
|
175
|
+
font-size: 13px;
|
|
176
|
+
color: #0f172a;
|
|
177
|
+
background: transparent;
|
|
178
|
+
line-height: 1.6;
|
|
179
|
+
}
|
|
180
|
+
.prompt-textarea::placeholder {
|
|
181
|
+
color: #94a3b8;
|
|
182
|
+
}
|
|
183
|
+
.prompt-var-pop {
|
|
184
|
+
position: absolute;
|
|
185
|
+
top: 32px;
|
|
186
|
+
right: 8px;
|
|
187
|
+
min-width: 220px;
|
|
188
|
+
padding: 6px;
|
|
189
|
+
background: #fff;
|
|
190
|
+
border: 1px solid #e2e8f0;
|
|
191
|
+
border-radius: 10px;
|
|
192
|
+
box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
|
|
193
|
+
z-index: 5;
|
|
194
|
+
}
|
|
195
|
+
.prompt-var-title {
|
|
196
|
+
padding: 4px 8px;
|
|
197
|
+
font-size: 11px;
|
|
198
|
+
font-weight: 600;
|
|
199
|
+
color: #64748b;
|
|
200
|
+
}
|
|
201
|
+
.prompt-var-item {
|
|
202
|
+
display: flex;
|
|
203
|
+
width: 100%;
|
|
204
|
+
gap: 8px;
|
|
205
|
+
padding: 6px 8px;
|
|
206
|
+
border: none;
|
|
207
|
+
background: transparent;
|
|
208
|
+
border-radius: 6px;
|
|
209
|
+
font-size: 12px;
|
|
210
|
+
text-align: left;
|
|
211
|
+
cursor: pointer;
|
|
212
|
+
}
|
|
213
|
+
.prompt-var-item:hover {
|
|
214
|
+
background: #f1f5f9;
|
|
215
|
+
}
|
|
216
|
+
.prompt-var-item code {
|
|
217
|
+
padding: 1px 5px;
|
|
218
|
+
background: #eef2ff;
|
|
219
|
+
color: #4338ca;
|
|
220
|
+
border-radius: 4px;
|
|
221
|
+
font-size: 11px;
|
|
222
|
+
font-family: ui-monospace, monospace;
|
|
223
|
+
}
|
|
224
|
+
.prompt-var-item-label {
|
|
225
|
+
color: #475569;
|
|
226
|
+
}
|
|
227
|
+
.prompt-footer {
|
|
228
|
+
display: flex;
|
|
229
|
+
justify-content: flex-end;
|
|
230
|
+
padding-top: 4px;
|
|
231
|
+
border-top: 1px solid #f1f5f9;
|
|
232
|
+
}
|
|
233
|
+
.prompt-count {
|
|
234
|
+
font-size: 11px;
|
|
235
|
+
color: #94a3b8;
|
|
236
|
+
}
|
|
237
|
+
</style>
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* AgentStudioShell — Dify-style editor-page frame.
|
|
4
|
+
*
|
|
5
|
+
* ┌─────┬──────────────────────────────────────────────┐
|
|
6
|
+
* │ 🤖 │ │
|
|
7
|
+
* │ AAA │ │
|
|
8
|
+
* │ ─── │ default slot │
|
|
9
|
+
* │ 编排 │ (active tab content) │
|
|
10
|
+
* │ API │ │
|
|
11
|
+
* │ 日志 │ │
|
|
12
|
+
* │ 监测 │ │
|
|
13
|
+
* └─────┴──────────────────────────────────────────────┘
|
|
14
|
+
*
|
|
15
|
+
* The shell is presentation-only: the active tab is passed in via v-model:tab
|
|
16
|
+
* and rendered by the host via <slot :tab="tab">. Nav clicks fire `update:tab`.
|
|
17
|
+
*/
|
|
18
|
+
import { computed, markRaw } from 'vue';
|
|
19
|
+
import {
|
|
20
|
+
ApiOutlined,
|
|
21
|
+
AppstoreOutlined,
|
|
22
|
+
FileTextOutlined,
|
|
23
|
+
LineChartOutlined,
|
|
24
|
+
} from '@ant-design/icons-vue';
|
|
25
|
+
|
|
26
|
+
import type { StudioNavItem, StudioTab } from '../types';
|
|
27
|
+
|
|
28
|
+
interface Props {
|
|
29
|
+
/** The active tab id (v-model). */
|
|
30
|
+
tab: StudioTab;
|
|
31
|
+
/** The agent being edited — shown in the top-left cell. */
|
|
32
|
+
agentName: string;
|
|
33
|
+
agentType?: string;
|
|
34
|
+
/** Icon + background for the top-left avatar. */
|
|
35
|
+
icon?: string;
|
|
36
|
+
iconBg?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Override the default 4-nav set. If omitted, the shell shows Dify's canonical
|
|
39
|
+
* 编排 / 访问 API / 日志与标注 / 监测.
|
|
40
|
+
*/
|
|
41
|
+
nav?: StudioNavItem[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
45
|
+
icon: '🤖',
|
|
46
|
+
iconBg: '#EEF4FF',
|
|
47
|
+
agentType: 'AGENT',
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const emit = defineEmits<{
|
|
51
|
+
(e: 'update:tab', v: StudioTab): void;
|
|
52
|
+
(e: 'back'): void;
|
|
53
|
+
}>();
|
|
54
|
+
|
|
55
|
+
// Antd icons are frozen with markRaw so Vue doesn't wrap them in reactivity —
|
|
56
|
+
// they're stateless components and don't need to be observed.
|
|
57
|
+
const DEFAULT_NAV: StudioNavItem[] = [
|
|
58
|
+
{
|
|
59
|
+
id: 'orchestrate',
|
|
60
|
+
title: '编排',
|
|
61
|
+
icon: '',
|
|
62
|
+
iconComponent: markRaw(AppstoreOutlined),
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'api',
|
|
66
|
+
title: '访问 API',
|
|
67
|
+
icon: '',
|
|
68
|
+
iconComponent: markRaw(ApiOutlined),
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 'logs',
|
|
72
|
+
title: '日志与标注',
|
|
73
|
+
icon: '',
|
|
74
|
+
iconComponent: markRaw(FileTextOutlined),
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 'monitor',
|
|
78
|
+
title: '监测',
|
|
79
|
+
icon: '',
|
|
80
|
+
iconComponent: markRaw(LineChartOutlined),
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
const items = computed<StudioNavItem[]>(() => props.nav ?? DEFAULT_NAV);
|
|
85
|
+
</script>
|
|
86
|
+
|
|
87
|
+
<template>
|
|
88
|
+
<div class="studio-shell">
|
|
89
|
+
<!-- Left rail -->
|
|
90
|
+
<aside class="studio-rail">
|
|
91
|
+
<div class="studio-brand" @click="emit('back')" title="返回应用列表">
|
|
92
|
+
<div class="studio-brand-icon" :style="{ background: iconBg }">
|
|
93
|
+
{{ icon }}
|
|
94
|
+
</div>
|
|
95
|
+
<div class="studio-brand-meta">
|
|
96
|
+
<div class="studio-brand-name" :title="agentName">{{ agentName }}</div>
|
|
97
|
+
<div class="studio-brand-type">{{ agentType }}</div>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
<nav class="studio-nav">
|
|
101
|
+
<button
|
|
102
|
+
v-for="it in items"
|
|
103
|
+
:key="it.id"
|
|
104
|
+
type="button"
|
|
105
|
+
class="studio-nav-item"
|
|
106
|
+
:class="{ 'studio-nav-item-active': tab === it.id }"
|
|
107
|
+
@click="emit('update:tab', it.id)"
|
|
108
|
+
>
|
|
109
|
+
<component
|
|
110
|
+
:is="it.iconComponent"
|
|
111
|
+
v-if="it.iconComponent"
|
|
112
|
+
class="studio-nav-icon"
|
|
113
|
+
/>
|
|
114
|
+
<span v-else class="studio-nav-icon">{{ it.icon }}</span>
|
|
115
|
+
<span>{{ it.title }}</span>
|
|
116
|
+
</button>
|
|
117
|
+
</nav>
|
|
118
|
+
</aside>
|
|
119
|
+
|
|
120
|
+
<!-- Main pane — host renders the active tab -->
|
|
121
|
+
<main class="studio-main">
|
|
122
|
+
<slot :tab="tab" />
|
|
123
|
+
</main>
|
|
124
|
+
</div>
|
|
125
|
+
</template>
|
|
126
|
+
|
|
127
|
+
<style scoped>
|
|
128
|
+
.studio-shell {
|
|
129
|
+
display: flex;
|
|
130
|
+
min-height: 100%;
|
|
131
|
+
background: #f8fafc;
|
|
132
|
+
}
|
|
133
|
+
.studio-rail {
|
|
134
|
+
width: 208px;
|
|
135
|
+
flex-shrink: 0;
|
|
136
|
+
background: #fff;
|
|
137
|
+
border-right: 1px solid #e5e7eb;
|
|
138
|
+
padding: 14px 12px 20px;
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-direction: column;
|
|
141
|
+
gap: 8px;
|
|
142
|
+
}
|
|
143
|
+
.studio-brand {
|
|
144
|
+
display: flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
gap: 10px;
|
|
147
|
+
padding: 6px 4px 12px;
|
|
148
|
+
border-bottom: 1px solid #f1f5f9;
|
|
149
|
+
cursor: pointer;
|
|
150
|
+
}
|
|
151
|
+
.studio-brand-icon {
|
|
152
|
+
width: 40px;
|
|
153
|
+
height: 40px;
|
|
154
|
+
flex-shrink: 0;
|
|
155
|
+
display: flex;
|
|
156
|
+
align-items: center;
|
|
157
|
+
justify-content: center;
|
|
158
|
+
border-radius: 10px;
|
|
159
|
+
font-size: 20px;
|
|
160
|
+
}
|
|
161
|
+
.studio-brand-meta {
|
|
162
|
+
min-width: 0;
|
|
163
|
+
flex: 1;
|
|
164
|
+
}
|
|
165
|
+
.studio-brand-name {
|
|
166
|
+
font-size: 13px;
|
|
167
|
+
font-weight: 600;
|
|
168
|
+
color: #0f172a;
|
|
169
|
+
white-space: nowrap;
|
|
170
|
+
overflow: hidden;
|
|
171
|
+
text-overflow: ellipsis;
|
|
172
|
+
}
|
|
173
|
+
.studio-brand-type {
|
|
174
|
+
margin-top: 2px;
|
|
175
|
+
font-size: 10px;
|
|
176
|
+
font-weight: 600;
|
|
177
|
+
color: #94a3b8;
|
|
178
|
+
letter-spacing: 0.08em;
|
|
179
|
+
text-transform: uppercase;
|
|
180
|
+
}
|
|
181
|
+
.studio-nav {
|
|
182
|
+
margin-top: 6px;
|
|
183
|
+
display: flex;
|
|
184
|
+
flex-direction: column;
|
|
185
|
+
gap: 2px;
|
|
186
|
+
}
|
|
187
|
+
.studio-nav-item {
|
|
188
|
+
display: flex;
|
|
189
|
+
align-items: center;
|
|
190
|
+
gap: 10px;
|
|
191
|
+
padding: 8px 10px;
|
|
192
|
+
border: none;
|
|
193
|
+
background: transparent;
|
|
194
|
+
border-radius: 8px;
|
|
195
|
+
font-size: 13px;
|
|
196
|
+
color: #475569;
|
|
197
|
+
cursor: pointer;
|
|
198
|
+
text-align: left;
|
|
199
|
+
transition:
|
|
200
|
+
background 0.15s ease,
|
|
201
|
+
color 0.15s ease;
|
|
202
|
+
}
|
|
203
|
+
.studio-nav-item:hover {
|
|
204
|
+
background: #f1f5f9;
|
|
205
|
+
color: #0f172a;
|
|
206
|
+
}
|
|
207
|
+
.studio-nav-item-active {
|
|
208
|
+
background: #eef2ff;
|
|
209
|
+
color: #4338ca;
|
|
210
|
+
font-weight: 600;
|
|
211
|
+
}
|
|
212
|
+
.studio-nav-icon {
|
|
213
|
+
font-size: 15px;
|
|
214
|
+
line-height: 1;
|
|
215
|
+
display: inline-flex;
|
|
216
|
+
align-items: center;
|
|
217
|
+
justify-content: center;
|
|
218
|
+
color: inherit;
|
|
219
|
+
}
|
|
220
|
+
.studio-main {
|
|
221
|
+
flex: 1;
|
|
222
|
+
min-width: 0;
|
|
223
|
+
overflow: hidden;
|
|
224
|
+
display: flex;
|
|
225
|
+
flex-direction: column;
|
|
226
|
+
}
|
|
227
|
+
</style>
|