@yuku123/z-agent-frontend-component 0.1.1
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/README.md +66 -0
- package/dist/z-agent-frontend-component.css +1 -0
- package/dist/z-agent-frontend-component.es.js +9956 -0
- package/dist/z-agent-frontend-component.umd.js +219 -0
- package/package.json +77 -0
- package/src/api/apiRouter.js +78 -0
- package/src/api/index.js +23 -0
- package/src/api/request.js +59 -0
- package/src/api/routes.js +140 -0
- package/src/dev.jsx +80 -0
- package/src/index.js +86 -0
- package/src/pages/agent/app/index.jsx +2 -0
- package/src/pages/agent/editor/AgentAppEditor.jsx +456 -0
- package/src/pages/agent/editor/WorkflowEditor.jsx +495 -0
- package/src/pages/agent/editor/nodes/index.ts +225 -0
- package/src/pages/agent/index.jsx +1379 -0
- package/src/pages/agent/share.jsx +512 -0
- package/src/pages/ak/AkUsageDrawer.jsx +208 -0
- package/src/pages/ak/index.jsx +496 -0
- package/src/pages/llm/index.jsx +736 -0
- package/src/pages/llm/model/index.jsx +220 -0
- package/src/pages/llm/provider/index.jsx +173 -0
- package/src/pages/mcp/index.jsx +359 -0
- package/src/pages/oss/BucketList.jsx +320 -0
- package/src/pages/oss/ObjectBrowser.jsx +409 -0
- package/src/pages/product/execute.jsx +608 -0
- package/src/pages/product/index.jsx +628 -0
- package/src/pages/product/scene.jsx +746 -0
- package/src/pages/script/ApiBridgeEditor.jsx +255 -0
- package/src/pages/script/CurlImportModal.jsx +263 -0
- package/src/pages/script/FieldMappingEditor.jsx +131 -0
- package/src/pages/script/OpenApiImportModal.jsx +212 -0
- package/src/pages/script/index.jsx +532 -0
- package/src/pages/skill/index.jsx +1595 -0
- package/src/pages/trace/DebugPlayground.jsx +357 -0
- package/src/pages/trace/components/MetricsDashboard.jsx +164 -0
- package/src/pages/trace/components/RagFragments.jsx +134 -0
- package/src/pages/trace/components/Timeline.jsx +142 -0
- package/src/pages/trace/components/ToolCallTree.jsx +116 -0
- package/src/pages/trace/index.jsx +13 -0
- package/src/pages/usage/index.jsx +352 -0
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
import {useEffect, useState} from 'react'
|
|
2
|
+
import {
|
|
3
|
+
Alert,
|
|
4
|
+
Button,
|
|
5
|
+
Card,
|
|
6
|
+
Col,
|
|
7
|
+
Form,
|
|
8
|
+
Input,
|
|
9
|
+
InputNumber,
|
|
10
|
+
message,
|
|
11
|
+
Row,
|
|
12
|
+
Select,
|
|
13
|
+
Space,
|
|
14
|
+
Switch,
|
|
15
|
+
Tabs,
|
|
16
|
+
Tag,
|
|
17
|
+
Typography
|
|
18
|
+
} from 'antd'
|
|
19
|
+
import {
|
|
20
|
+
ApartmentOutlined,
|
|
21
|
+
ArrowLeftOutlined,
|
|
22
|
+
BookOutlined,
|
|
23
|
+
DatabaseOutlined,
|
|
24
|
+
DiffOutlined,
|
|
25
|
+
EyeOutlined,
|
|
26
|
+
MessageOutlined,
|
|
27
|
+
RobotOutlined,
|
|
28
|
+
RocketOutlined,
|
|
29
|
+
SaveOutlined,
|
|
30
|
+
ThunderboltOutlined
|
|
31
|
+
} from '@ant-design/icons'
|
|
32
|
+
import WorkflowEditor from './WorkflowEditor'
|
|
33
|
+
import {ErrorBoundary} from '@yuku123/z-frontend-common'
|
|
34
|
+
import {agentApi} from '../../../api'
|
|
35
|
+
|
|
36
|
+
const {TextArea} = Input
|
|
37
|
+
const {Text, Title} = Typography
|
|
38
|
+
|
|
39
|
+
const MODELS_BY_PROVIDER = {
|
|
40
|
+
ollama: [
|
|
41
|
+
{code: 'qwen2.5:7b-instruct-q4_K_M', name: 'Qwen 2.5 7B'},
|
|
42
|
+
{code: 'qwen3:8b', name: 'Qwen3 8B'},
|
|
43
|
+
{code: 'llama3:latest', name: 'Llama 3'},
|
|
44
|
+
{code: 'qwen2.5:14b-instruct-q4_K_M', name: 'Qwen 2.5 14B'},
|
|
45
|
+
],
|
|
46
|
+
openai: [
|
|
47
|
+
{code: 'gpt-4o', name: 'GPT-4o'},
|
|
48
|
+
{code: 'gpt-4o-mini', name: 'GPT-4o Mini'},
|
|
49
|
+
{code: 'gpt-4-turbo', name: 'GPT-4 Turbo'},
|
|
50
|
+
],
|
|
51
|
+
dashscope: [
|
|
52
|
+
{code: 'qwen-max', name: 'Qwen Max'},
|
|
53
|
+
{code: 'qwen-plus', name: 'Qwen Plus'},
|
|
54
|
+
{code: 'qwen-turbo', name: 'Qwen Turbo'},
|
|
55
|
+
],
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 三种应用类型:不同类型开放不同能力 tab
|
|
59
|
+
const MODE_CONFIG = {
|
|
60
|
+
chat: {
|
|
61
|
+
label: '对话', icon: <MessageOutlined/>, color: '#1677ff',
|
|
62
|
+
desc: '纯文本对话,配置 Prompt + 模型即可',
|
|
63
|
+
tabs: ['basic', 'prompt', 'modelParams', 'memory'],
|
|
64
|
+
tabLabels: {
|
|
65
|
+
basic: '基本信息', prompt: '系统提示词',
|
|
66
|
+
modelParams: '模型参数', memory: '记忆配置'
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
agent: {
|
|
70
|
+
label: '智能体', icon: <RobotOutlined/>, color: '#722ed1',
|
|
71
|
+
desc: '工具调用 + 技能 + 知识库,具备自主决策能力',
|
|
72
|
+
tabs: ['basic', 'prompt', 'modelParams', 'memory', 'tools', 'skills', 'variables', 'knowledge'],
|
|
73
|
+
tabLabels: {
|
|
74
|
+
basic: '基本信息', prompt: '系统提示词', modelParams: '模型参数', memory: '记忆配置',
|
|
75
|
+
tools: '工具配置', skills: '技能配置', variables: '变量配置', knowledge: '知识库'
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
workflow: {
|
|
79
|
+
label: '工作流', icon: <ApartmentOutlined/>, color: '#13c2c2',
|
|
80
|
+
desc: '可视化多步骤流程编排',
|
|
81
|
+
tabs: ['basic', 'modelParams', 'workflow'],
|
|
82
|
+
tabLabels: {
|
|
83
|
+
basic: '基本信息', modelParams: '模型参数', workflow: '流程编排'
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const AgentAppEditor = ({app, onBack, onSaved}) => {
|
|
89
|
+
const [localApp, setLocalApp] = useState(app)
|
|
90
|
+
const isPublished = localApp.status === 'PUBLISHED'
|
|
91
|
+
// 默认 chat,老数据无 agentMode 字段也走 chat
|
|
92
|
+
const appMode = localApp.agentMode || 'chat'
|
|
93
|
+
const modeDef = MODE_CONFIG[appMode] || MODE_CONFIG.chat
|
|
94
|
+
const [saving, setSaving] = useState(false)
|
|
95
|
+
const [upgrading, setUpgrading] = useState(false)
|
|
96
|
+
const [activeTab, setActiveTab] = useState(modeDef.tabs[0])
|
|
97
|
+
const [form] = Form.useForm()
|
|
98
|
+
const [workflowData, setWorkflowData] = useState(null)
|
|
99
|
+
|
|
100
|
+
// 当切换应用类型时,切换到对应类型的第一个 tab
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
if (activeTab && !modeDef.tabs.includes(activeTab)) {
|
|
103
|
+
setActiveTab(modeDef.tabs[0])
|
|
104
|
+
}
|
|
105
|
+
}, [appMode])
|
|
106
|
+
|
|
107
|
+
// 应用类型变更:保存到 localApp 状态(不立刻持久化,由用户点保存统一提交)
|
|
108
|
+
const handleModeChange = (newMode) => {
|
|
109
|
+
setLocalApp(prev => ({...prev, agentMode: newMode}))
|
|
110
|
+
form.setFieldsValue({agentMode: newMode})
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const handleSave = async () => {
|
|
114
|
+
try {
|
|
115
|
+
const values = await form.validateFields()
|
|
116
|
+
setSaving(true)
|
|
117
|
+
await agentApi.appUpdate({id: localApp.id, agentMode: appMode, ...values, workflowData})
|
|
118
|
+
message.success('保存成功')
|
|
119
|
+
onSaved?.()
|
|
120
|
+
} catch (e) {
|
|
121
|
+
if (!e.errorFields) message.error('保存失败')
|
|
122
|
+
} finally {
|
|
123
|
+
setSaving(false)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const handlePublish = async () => {
|
|
128
|
+
try {
|
|
129
|
+
await agentApi.appPublish(localApp.appCode)
|
|
130
|
+
message.success('发布成功')
|
|
131
|
+
onSaved?.()
|
|
132
|
+
} catch (e) {
|
|
133
|
+
message.error('发布失败')
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const handleUpgrade = async () => {
|
|
138
|
+
try {
|
|
139
|
+
setUpgrading(true)
|
|
140
|
+
const updated = await agentApi.appUpgrade(localApp.appCode)
|
|
141
|
+
const appData = updated?.data || updated
|
|
142
|
+
if (appData) {
|
|
143
|
+
setLocalApp(appData)
|
|
144
|
+
message.success(`已升级到 ${appData.version || '新'} 版本,可编辑后发布`)
|
|
145
|
+
}
|
|
146
|
+
} catch (e) {
|
|
147
|
+
message.error('升级失败:' + (e?.message || '未知错误'))
|
|
148
|
+
} finally {
|
|
149
|
+
setUpgrading(false)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return (
|
|
154
|
+
<div style={{height: '100%', display: 'flex', flexDirection: 'column'}}>
|
|
155
|
+
<div style={{
|
|
156
|
+
display: 'flex', alignItems: 'center', gap: 12,
|
|
157
|
+
padding: '12px 16px', borderBottom: '1px solid #f0f0f0',
|
|
158
|
+
background: '#fff', flexShrink: 0,
|
|
159
|
+
}}>
|
|
160
|
+
<Button type="text" icon={<ArrowLeftOutlined/>} onClick={onBack}/>
|
|
161
|
+
<Title level={5} style={{margin: 0, flex: 1, minWidth: 0}}>
|
|
162
|
+
<span style={{marginRight: 8}}>{localApp.appName}</span>
|
|
163
|
+
<Tag color={modeDef.color} style={{borderRadius: 20, marginRight: 4}}>
|
|
164
|
+
{modeDef.icon} {modeDef.label}
|
|
165
|
+
</Tag>
|
|
166
|
+
<Tag color={isPublished ? 'green' : 'default'} style={{borderRadius: 20}}>
|
|
167
|
+
{isPublished ? '已发布' : '草稿'}
|
|
168
|
+
</Tag>
|
|
169
|
+
</Title>
|
|
170
|
+
<div style={{flex: 1}}/>
|
|
171
|
+
{isPublished ? (
|
|
172
|
+
<Button icon={<DiffOutlined/>} loading={upgrading} onClick={handleUpgrade}>
|
|
173
|
+
升级到新草稿
|
|
174
|
+
</Button>
|
|
175
|
+
) : (
|
|
176
|
+
<Space>
|
|
177
|
+
<Button icon={<SaveOutlined/>} type="primary" ghost onClick={handleSave}
|
|
178
|
+
loading={saving}>保存</Button>
|
|
179
|
+
<Button icon={<RocketOutlined/>} type="primary" onClick={handlePublish}>发布</Button>
|
|
180
|
+
</Space>
|
|
181
|
+
)}
|
|
182
|
+
</div>
|
|
183
|
+
|
|
184
|
+
<div style={{flex: 1, overflow: 'auto', padding: 16, background: '#f5f5f5'}}>
|
|
185
|
+
{isPublished && (
|
|
186
|
+
<Alert
|
|
187
|
+
type="warning"
|
|
188
|
+
showIcon
|
|
189
|
+
icon={<EyeOutlined/>}
|
|
190
|
+
message="查看模式:当前为已发布版本,所有字段仅可浏览不可修改"
|
|
191
|
+
description="如需调整配置,请点击右上角「升级到新草稿」按钮,系统会基于当前版本创建一份可编辑的草稿。"
|
|
192
|
+
style={{marginBottom: 16, borderRadius: 8}}
|
|
193
|
+
/>
|
|
194
|
+
)}
|
|
195
|
+
|
|
196
|
+
{/* 应用类型选择(发布后只读) */}
|
|
197
|
+
<Card size="small" style={{marginBottom: 16, borderLeft: `3px solid ${modeDef.color}`}}
|
|
198
|
+
bodyStyle={{padding: '12px 16px'}}>
|
|
199
|
+
<div style={{display: 'flex', alignItems: 'center', gap: 16, flexWrap: 'wrap'}}>
|
|
200
|
+
<div style={{display: 'flex', alignItems: 'center', gap: 8, minWidth: 120}}>
|
|
201
|
+
<span style={{fontSize: 18, color: modeDef.color}}>{modeDef.icon}</span>
|
|
202
|
+
<div>
|
|
203
|
+
<Text strong style={{fontSize: 13}}>应用类型</Text>
|
|
204
|
+
<div>
|
|
205
|
+
<Text type="secondary" style={{fontSize: 12}}>{modeDef.label}模式</Text>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
<Select
|
|
210
|
+
value={appMode}
|
|
211
|
+
disabled={isPublished}
|
|
212
|
+
onChange={handleModeChange}
|
|
213
|
+
style={{flex: 1, maxWidth: 400}}
|
|
214
|
+
options={[
|
|
215
|
+
{
|
|
216
|
+
value: 'chat',
|
|
217
|
+
label: <span><MessageOutlined style={{color: '#1677ff'}}/> 对话 - 纯文本对话</span>
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
value: 'agent',
|
|
221
|
+
label: <span><RobotOutlined style={{color: '#722ed1'}}/> 智能体 - 工具调用 + 知识库</span>
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
value: 'workflow',
|
|
225
|
+
label: <span><ApartmentOutlined style={{color: '#13c2c2'}}/> 工作流 - 多步骤流程编排</span>
|
|
226
|
+
},
|
|
227
|
+
]}
|
|
228
|
+
/>
|
|
229
|
+
<Text type="secondary" style={{fontSize: 12}}>{modeDef.desc}</Text>
|
|
230
|
+
</div>
|
|
231
|
+
</Card>
|
|
232
|
+
|
|
233
|
+
<Card size="small">
|
|
234
|
+
<Tabs activeKey={activeTab} onChange={setActiveTab} style={{minHeight: 300}}>
|
|
235
|
+
{modeDef.tabs.map(tabKey => (
|
|
236
|
+
<Tabs.TabPane key={tabKey} tab={modeDef.tabLabels[tabKey] || tabKey}>
|
|
237
|
+
<Form form={form} layout="vertical"
|
|
238
|
+
initialValues={{
|
|
239
|
+
appName: localApp.appName,
|
|
240
|
+
description: localApp.description,
|
|
241
|
+
prompt: localApp.prompt,
|
|
242
|
+
modelProvider: localApp.modelProvider || 'ollama',
|
|
243
|
+
modelName: localApp.modelName || 'qwen2.5:7b-instruct-q4_K_M',
|
|
244
|
+
iconUrl: localApp.iconUrl,
|
|
245
|
+
tools: localApp.tools,
|
|
246
|
+
skillCodes: localApp.skillCodes,
|
|
247
|
+
variables: localApp.variables,
|
|
248
|
+
knowledgeIds: localApp.knowledgeIds,
|
|
249
|
+
temperature: localApp.temperature ?? 0.7,
|
|
250
|
+
topP: localApp.topP ?? 0.9,
|
|
251
|
+
maxTokens: localApp.maxTokens ?? 4096,
|
|
252
|
+
historyWindowSize: localApp.historyWindowSize ?? 50,
|
|
253
|
+
enableLongMemory: localApp.enableLongMemory ?? false,
|
|
254
|
+
memoryPrompt: localApp.memoryPrompt || '',
|
|
255
|
+
}}>
|
|
256
|
+
{/* 基本信息 */}
|
|
257
|
+
{tabKey === 'basic' && (
|
|
258
|
+
<Row gutter={16}>
|
|
259
|
+
<Col span={16}>
|
|
260
|
+
<Form.Item name="appName" label="应用名称" rules={[{required: true}]}>
|
|
261
|
+
<Input disabled={isPublished}/>
|
|
262
|
+
</Form.Item>
|
|
263
|
+
</Col>
|
|
264
|
+
<Col span={8}>
|
|
265
|
+
<Form.Item name="iconUrl" label="图标 URL">
|
|
266
|
+
<Input disabled={isPublished} placeholder="图片URL"/>
|
|
267
|
+
</Form.Item>
|
|
268
|
+
</Col>
|
|
269
|
+
<Col span={24}>
|
|
270
|
+
<Form.Item name="description" label="应用描述">
|
|
271
|
+
<TextArea rows={2} disabled={isPublished}/>
|
|
272
|
+
</Form.Item>
|
|
273
|
+
</Col>
|
|
274
|
+
<Col span={8}>
|
|
275
|
+
<Form.Item name="modelProvider" label="供应商"
|
|
276
|
+
rules={[{required: true}]}>
|
|
277
|
+
<Select disabled={isPublished} onChange={(val) => {
|
|
278
|
+
const models = MODELS_BY_PROVIDER[val] || []
|
|
279
|
+
if (models[0]) form.setFieldsValue({modelName: models[0].code})
|
|
280
|
+
}}>
|
|
281
|
+
<Select.Option value="ollama">Ollama</Select.Option>
|
|
282
|
+
<Select.Option value="openai">OpenAI</Select.Option>
|
|
283
|
+
<Select.Option value="dashscope">阿里通义</Select.Option>
|
|
284
|
+
</Select>
|
|
285
|
+
</Form.Item>
|
|
286
|
+
</Col>
|
|
287
|
+
<Col span={16}>
|
|
288
|
+
<Form.Item name="modelName" label="模型" rules={[{required: true}]}>
|
|
289
|
+
<Select disabled={isPublished}>
|
|
290
|
+
{(MODELS_BY_PROVIDER[form.getFieldValue?.('modelProvider') || localApp.modelProvider || 'ollama'] || []).map(m => (
|
|
291
|
+
<Select.Option key={m.code}
|
|
292
|
+
value={m.code}>{m.name}</Select.Option>
|
|
293
|
+
))}
|
|
294
|
+
</Select>
|
|
295
|
+
</Form.Item>
|
|
296
|
+
</Col>
|
|
297
|
+
</Row>
|
|
298
|
+
)}
|
|
299
|
+
|
|
300
|
+
{/* 系统提示词 */}
|
|
301
|
+
{tabKey === 'prompt' && (
|
|
302
|
+
<Form.Item name="prompt" label="系统提示词"
|
|
303
|
+
extra="定义 Agent 的身份、能力、行为规范和约束条件">
|
|
304
|
+
<TextArea rows={12} disabled={isPublished}
|
|
305
|
+
placeholder="你是智能助手,负责回答用户问题..."/>
|
|
306
|
+
</Form.Item>
|
|
307
|
+
)}
|
|
308
|
+
|
|
309
|
+
{/* 模型参数 */}
|
|
310
|
+
{tabKey === 'modelParams' && (
|
|
311
|
+
<div>
|
|
312
|
+
<Alert type="info" showIcon
|
|
313
|
+
message="模型参数控制生成行为。不同模型支持的参数范围略有差异。"
|
|
314
|
+
style={{marginBottom: 16, border: 'none', background: '#e6f4ff'}}/>
|
|
315
|
+
<Card size="small" style={{background: '#fafafa', marginBottom: 16}}>
|
|
316
|
+
<div style={{marginBottom: 12}}>
|
|
317
|
+
<Text strong><ThunderboltOutlined/> 采样参数</Text>
|
|
318
|
+
<Text type="secondary" style={{marginLeft: 8, fontSize: 12}}>
|
|
319
|
+
控制生成多样性和确定性
|
|
320
|
+
</Text>
|
|
321
|
+
</div>
|
|
322
|
+
<Row gutter={16}>
|
|
323
|
+
<Col span={8}>
|
|
324
|
+
<Form.Item name="temperature" label="Temperature 温度"
|
|
325
|
+
extra="0=确定性,2=高随机">
|
|
326
|
+
<InputNumber min={0} max={2} step={0.1}
|
|
327
|
+
disabled={isPublished}
|
|
328
|
+
style={{width: '100%'}}/>
|
|
329
|
+
</Form.Item>
|
|
330
|
+
</Col>
|
|
331
|
+
<Col span={8}>
|
|
332
|
+
<Form.Item name="topP" label="Top P 核采样"
|
|
333
|
+
extra="0-1,建议 0.9">
|
|
334
|
+
<InputNumber min={0} max={1} step={0.05}
|
|
335
|
+
disabled={isPublished}
|
|
336
|
+
style={{width: '100%'}}/>
|
|
337
|
+
</Form.Item>
|
|
338
|
+
</Col>
|
|
339
|
+
<Col span={8}>
|
|
340
|
+
<Form.Item name="maxTokens" label="Max Tokens 最大输出"
|
|
341
|
+
extra="单次响应最大 token 数">
|
|
342
|
+
<InputNumber min={100} max={128000} step={100}
|
|
343
|
+
disabled={isPublished}
|
|
344
|
+
style={{width: '100%'}}/>
|
|
345
|
+
</Form.Item>
|
|
346
|
+
</Col>
|
|
347
|
+
</Row>
|
|
348
|
+
</Card>
|
|
349
|
+
</div>
|
|
350
|
+
)}
|
|
351
|
+
|
|
352
|
+
{/* 记忆配置 */}
|
|
353
|
+
{tabKey === 'memory' && (
|
|
354
|
+
<div>
|
|
355
|
+
<Alert type="info" showIcon
|
|
356
|
+
message="记忆配置控制对话上下文管理"
|
|
357
|
+
style={{marginBottom: 16, border: 'none', background: '#e6f4ff'}}/>
|
|
358
|
+
<Card size="small" style={{background: '#fafafa', marginBottom: 16}}>
|
|
359
|
+
<div style={{marginBottom: 12}}>
|
|
360
|
+
<Text strong><DatabaseOutlined/> 历史窗口</Text>
|
|
361
|
+
<Text type="secondary" style={{marginLeft: 8, fontSize: 12}}>
|
|
362
|
+
保留最近 N 条对话消息作为上下文
|
|
363
|
+
</Text>
|
|
364
|
+
</div>
|
|
365
|
+
<Form.Item name="historyWindowSize" label="历史窗口大小">
|
|
366
|
+
<InputNumber min={0} max={100} disabled={isPublished}
|
|
367
|
+
style={{width: 200}}/>
|
|
368
|
+
</Form.Item>
|
|
369
|
+
</Card>
|
|
370
|
+
<Card size="small" style={{background: '#fafafa', marginBottom: 16}}>
|
|
371
|
+
<div style={{marginBottom: 12}}>
|
|
372
|
+
<Text strong><BookOutlined/> 长期记忆</Text>
|
|
373
|
+
<Text type="secondary" style={{marginLeft: 8, fontSize: 12}}>
|
|
374
|
+
跨会话持久化关键信息
|
|
375
|
+
</Text>
|
|
376
|
+
</div>
|
|
377
|
+
<Form.Item name="enableLongMemory" label="启用长期记忆"
|
|
378
|
+
valuePropName="checked">
|
|
379
|
+
<Switch disabled={isPublished}/>
|
|
380
|
+
</Form.Item>
|
|
381
|
+
<Form.Item name="memoryPrompt" label="记忆提示词"
|
|
382
|
+
extra="定义如何总结和存储对话内容">
|
|
383
|
+
<TextArea rows={3} disabled={isPublished}
|
|
384
|
+
placeholder="例:提取用户的偏好和关键事实,以 JSON 结构存储..."/>
|
|
385
|
+
</Form.Item>
|
|
386
|
+
</Card>
|
|
387
|
+
</div>
|
|
388
|
+
)}
|
|
389
|
+
|
|
390
|
+
{/* 工具配置 */}
|
|
391
|
+
{tabKey === 'tools' && (
|
|
392
|
+
<Form.Item name="tools" label="工具配置" extra="JSON 数组格式">
|
|
393
|
+
<TextArea rows={8} disabled={isPublished}
|
|
394
|
+
placeholder='[{"toolCode":"web-search","toolName":"网页搜索"}]'/>
|
|
395
|
+
</Form.Item>
|
|
396
|
+
)}
|
|
397
|
+
|
|
398
|
+
{/* 技能配置 */}
|
|
399
|
+
{tabKey === 'skills' && (
|
|
400
|
+
<Form.Item name="skillCodes" label="技能编码" extra="JSON 数组格式">
|
|
401
|
+
<TextArea rows={8} disabled={isPublished}
|
|
402
|
+
placeholder='["code-review", "data-analyzer"]'/>
|
|
403
|
+
</Form.Item>
|
|
404
|
+
)}
|
|
405
|
+
|
|
406
|
+
{/* 变量配置 */}
|
|
407
|
+
{tabKey === 'variables' && (
|
|
408
|
+
<Form.Item name="variables" label="变量配置" extra="JSON 数组格式">
|
|
409
|
+
<TextArea rows={8} disabled={isPublished}
|
|
410
|
+
placeholder='[{"name":"userName","label":"用户名","type":"string"}]'/>
|
|
411
|
+
</Form.Item>
|
|
412
|
+
)}
|
|
413
|
+
|
|
414
|
+
{/* 知识库 */}
|
|
415
|
+
{tabKey === 'knowledge' && (
|
|
416
|
+
<Form.Item name="knowledgeIds" label="知识库" extra="JSON 数组格式">
|
|
417
|
+
<TextArea rows={8} disabled={isPublished}
|
|
418
|
+
placeholder='[1, 2, 3]'/>
|
|
419
|
+
</Form.Item>
|
|
420
|
+
)}
|
|
421
|
+
|
|
422
|
+
{/* 工作流 */}
|
|
423
|
+
{tabKey === 'workflow' && (
|
|
424
|
+
<div>
|
|
425
|
+
<Alert type="info" showIcon
|
|
426
|
+
message="工作流模式使用轻量引擎,支持中断恢复。节点定义存储在应用配置中。"
|
|
427
|
+
style={{marginBottom: 16, border: 'none', background: '#e6f4ff'}}/>
|
|
428
|
+
<ErrorBoundary
|
|
429
|
+
fallbackTitle="流程编辑器加载失败"
|
|
430
|
+
fallbackDescription="LogicFlow 初始化异常。请重试,或切换到「对话」/「智能体」模式后重新切回工作流。"
|
|
431
|
+
onReset={() => setWorkflowData(null)}
|
|
432
|
+
>
|
|
433
|
+
<WorkflowEditor
|
|
434
|
+
readOnly={isPublished}
|
|
435
|
+
value={workflowData}
|
|
436
|
+
onChange={setWorkflowData}
|
|
437
|
+
// FEATURE013 A5: 把 appCode / appName 传给 WorkflowEditor,
|
|
438
|
+
// 让用户在画布上能直接保存到后端 z_agent_flow_definition
|
|
439
|
+
appCode={localApp.appCode}
|
|
440
|
+
flowName={localApp.appName}
|
|
441
|
+
/>
|
|
442
|
+
</ErrorBoundary>
|
|
443
|
+
</div>
|
|
444
|
+
)}
|
|
445
|
+
</Form>
|
|
446
|
+
</Tabs.TabPane>
|
|
447
|
+
))}
|
|
448
|
+
</Tabs>
|
|
449
|
+
</Card>
|
|
450
|
+
</div>
|
|
451
|
+
</div>
|
|
452
|
+
)
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
export default AgentAppEditor
|