@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
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@yuku123/z-agent-frontend-component",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "z-agent 共享前端组件 - Agent 应用 / 编辑器 / 工作流 / LLM / AK / MCP / OSS / Skill / Script / Product / Usage 等页面",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"react",
|
|
8
|
+
"antd",
|
|
9
|
+
"agent",
|
|
10
|
+
"llm",
|
|
11
|
+
"workflow",
|
|
12
|
+
"logicflow",
|
|
13
|
+
"z-opc"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"author": {
|
|
17
|
+
"name": "zifang",
|
|
18
|
+
"email": "1340947819@qq.com"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://github.com/yuku123/z-opc-frontend/tree/main/packages/z-agent-frontend-component#readme",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/yuku123/z-opc-frontend.git",
|
|
24
|
+
"directory": "packages/z-agent-frontend-component"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/yuku123/z-opc-frontend/issues"
|
|
28
|
+
},
|
|
29
|
+
"main": "./dist/z-agent-frontend-component.umd.js",
|
|
30
|
+
"module": "./dist/z-agent-frontend-component.es.js",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"import": "./dist/z-agent-frontend-component.es.js",
|
|
34
|
+
"require": "./dist/z-agent-frontend-component.umd.js"
|
|
35
|
+
},
|
|
36
|
+
"./api": {
|
|
37
|
+
"import": "./dist/api.es.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"types": "./dist/index.d.ts",
|
|
41
|
+
"files": [
|
|
42
|
+
"dist",
|
|
43
|
+
"src",
|
|
44
|
+
"README.md"
|
|
45
|
+
],
|
|
46
|
+
"scripts": {
|
|
47
|
+
"dev": "vite",
|
|
48
|
+
"build": "vite build",
|
|
49
|
+
"preview": "vite preview"
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public",
|
|
53
|
+
"registry": "https://registry.npmjs.org/"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"react": "^19.2.0",
|
|
57
|
+
"react-dom": "^19.2.0",
|
|
58
|
+
"antd": "^6.3.3",
|
|
59
|
+
"@ant-design/icons": "^6.1.0",
|
|
60
|
+
"react-router-dom": "^7.13.1",
|
|
61
|
+
"react-markdown": "^10.1.0",
|
|
62
|
+
"remark-gfm": "^4.0.1",
|
|
63
|
+
"@logicflow/core": "^2.2.3",
|
|
64
|
+
"@logicflow/extension": "^2.2.3",
|
|
65
|
+
"echarts": "^5.4.3",
|
|
66
|
+
"echarts-for-react": "^3.0.6",
|
|
67
|
+
"@yuku123/z-frontend-common": "^0.1.1"
|
|
68
|
+
},
|
|
69
|
+
"dependencies": {
|
|
70
|
+
"axios": "^1.16.1"
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
74
|
+
"vite": "^6.2.0"
|
|
75
|
+
},
|
|
76
|
+
"style": "./dist/z-agent-frontend-component.css"
|
|
77
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 智能路由器:依据路由表把 agentApi.xxx() 翻译成真实的 HTTP 请求。
|
|
3
|
+
* 移植自主壳 src/services/apiRouter.ts (FEATURE015),保持兼容。
|
|
4
|
+
*/
|
|
5
|
+
import request, {authRequest, ctcRequest} from './request.js'
|
|
6
|
+
|
|
7
|
+
const Verb = {GET: 'GET', POST: 'POST', PUT: 'PUT', DELETE: 'DELETE'}
|
|
8
|
+
|
|
9
|
+
const ROUTES = {}
|
|
10
|
+
|
|
11
|
+
function reg(api, method, verb, path, transform) {
|
|
12
|
+
if (!ROUTES[api]) ROUTES[api] = {}
|
|
13
|
+
ROUTES[api][method] = {verb, path, transform}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function fillPath(path, args) {
|
|
17
|
+
let i = 0
|
|
18
|
+
return path.replace(/\{(\w+)\}/g, () => String(args[i++] ?? ''))
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function pickClient(verb, path) {
|
|
22
|
+
if (path.startsWith('/ctc/ac') || path.startsWith('/ctc/authorization') || path.startsWith('/ctc/surl')) {
|
|
23
|
+
return ctcRequest
|
|
24
|
+
}
|
|
25
|
+
if (path.startsWith('/auth/')) {
|
|
26
|
+
return authRequest
|
|
27
|
+
}
|
|
28
|
+
return request
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function makeApi(apiName) {
|
|
32
|
+
return new Proxy({}, {
|
|
33
|
+
get: (_t, prop) => {
|
|
34
|
+
if (prop === 'then' || typeof prop === 'symbol') return undefined
|
|
35
|
+
if (prop === 'toJSON' || prop === 'constructor' || prop === 'toString') {
|
|
36
|
+
return () => `[apiRouter:${apiName}]`
|
|
37
|
+
}
|
|
38
|
+
return async (...args) => {
|
|
39
|
+
const route = ROUTES[apiName]?.[prop]
|
|
40
|
+
if (!route) {
|
|
41
|
+
return {code: 200, message: 'ok', data: [], total: 0}
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
const path = fillPath(route.path, args)
|
|
45
|
+
const client = pickClient(route.verb, path)
|
|
46
|
+
const config = {}
|
|
47
|
+
if (route.verb === Verb.GET || route.verb === Verb.DELETE) {
|
|
48
|
+
if (args.length > 0 && typeof args[0] === 'object' && args[0] !== null) {
|
|
49
|
+
config.params = args[0]
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
if (args.length === 1) {
|
|
53
|
+
config.data = args[0]
|
|
54
|
+
} else if (args.length > 1) {
|
|
55
|
+
if (typeof args[0] === 'object' && args[0] !== null) {
|
|
56
|
+
config.data = args[0]
|
|
57
|
+
}
|
|
58
|
+
if (typeof args[1] === 'object' && args[1] !== null) {
|
|
59
|
+
config.params = args[1]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const resp = await client.request({
|
|
64
|
+
method: route.verb,
|
|
65
|
+
url: path,
|
|
66
|
+
...config,
|
|
67
|
+
})
|
|
68
|
+
return route.transform ? route.transform(resp, args) : resp
|
|
69
|
+
} catch (e) {
|
|
70
|
+
console.warn(`[apiRouter] ${apiName}.${prop} failed:`, e?.message || e)
|
|
71
|
+
return {code: 200, message: 'ok', data: [], total: 0}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export {reg}
|
package/src/api/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API 客户端入口: 注册路由表后导出 *Api 代理对象。
|
|
3
|
+
*
|
|
4
|
+
* 使用:
|
|
5
|
+
* import {agentApi, flowApi, llmApi} from '@yuku123/z-agent-frontend-component/api'
|
|
6
|
+
* import request from '@yuku123/z-agent-frontend-component/api' // 裸 axios 实例
|
|
7
|
+
*/
|
|
8
|
+
import './routes.js'
|
|
9
|
+
import {makeApi} from './apiRouter.js'
|
|
10
|
+
import request, {authRequest, ctcRequest} from './request.js'
|
|
11
|
+
|
|
12
|
+
export const agentApi = makeApi('agentApi')
|
|
13
|
+
export const flowApi = makeApi('flowApi')
|
|
14
|
+
export const llmApi = makeApi('llmApi')
|
|
15
|
+
export const mcpApi = makeApi('mcpApi')
|
|
16
|
+
export const scriptApi = makeApi('scriptApi')
|
|
17
|
+
export const skillApi = makeApi('skillApi')
|
|
18
|
+
export const productApi = makeApi('productApi')
|
|
19
|
+
export const sceneApi = makeApi('sceneApi')
|
|
20
|
+
export const ossApi = makeApi('ossApi')
|
|
21
|
+
|
|
22
|
+
export {authRequest, ctcRequest}
|
|
23
|
+
export default request
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 包内自用的 axios 实例 + umi-request 风格 shim。
|
|
3
|
+
*
|
|
4
|
+
* 兼容主壳 pages/ai/{ak,llm,usage} 的老调用:
|
|
5
|
+
* request('/ak/list', {method: 'GET', params: {akType}})
|
|
6
|
+
* request('/agent/app/page', {method: 'POST', body: JSON.stringify({...})})
|
|
7
|
+
* request('/ak/update', {method: 'POST', data: {...}})
|
|
8
|
+
*
|
|
9
|
+
* 行为与主壳 services/request.ts 保持一致:
|
|
10
|
+
* - baseURL = /api
|
|
11
|
+
* - 401 自动跳 /login
|
|
12
|
+
* - 业务 {code, data, message} 自动解包
|
|
13
|
+
* - 支持 umi 风格: (url, {method, params, body, data})
|
|
14
|
+
*/
|
|
15
|
+
import {createRequest} from '@yuku123/z-frontend-common'
|
|
16
|
+
|
|
17
|
+
const request = createRequest({baseURL: '/api', timeout: 15000})
|
|
18
|
+
const authRequest = createRequest({baseURL: '/api', timeout: 15000})
|
|
19
|
+
const ctcRequest = createRequest({baseURL: '/api', timeout: 15000})
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* umi-request 风格 shim: 把 (url, {method, params, body, data}) 转成 axios 调用。
|
|
23
|
+
* axios 实例本身支持 callable,但只接受 config object。
|
|
24
|
+
* 我们包一层函数,让它接受 (url, config) 并合成 config。
|
|
25
|
+
*/
|
|
26
|
+
function umiStyleWrap(axiosInstance) {
|
|
27
|
+
const callable = function (url, opts = {}) {
|
|
28
|
+
const config = {...opts}
|
|
29
|
+
// 兼容 body / data: body 是 umi 风格, data 是 axios 风格
|
|
30
|
+
if (config.body !== undefined) {
|
|
31
|
+
config.data = config.body
|
|
32
|
+
delete config.body
|
|
33
|
+
}
|
|
34
|
+
// 兼容 method 大小写
|
|
35
|
+
if (typeof config.method === 'string') {
|
|
36
|
+
config.method = config.method.toUpperCase()
|
|
37
|
+
}
|
|
38
|
+
// 把 url 放 config 里
|
|
39
|
+
config.url = url
|
|
40
|
+
return axiosInstance.request(config)
|
|
41
|
+
}
|
|
42
|
+
// 透传 axios 实例的所有方法
|
|
43
|
+
const methods = ['get', 'post', 'put', 'delete', 'patch', 'head', 'request', 'create', 'interceptors']
|
|
44
|
+
methods.forEach((m) => {
|
|
45
|
+
if (typeof axiosInstance[m] === 'function') {
|
|
46
|
+
callable[m] = axiosInstance[m].bind(axiosInstance)
|
|
47
|
+
} else {
|
|
48
|
+
callable[m] = axiosInstance[m]
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
return callable
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const umiRequest = umiStyleWrap(request)
|
|
55
|
+
const umiAuthRequest = umiStyleWrap(authRequest)
|
|
56
|
+
const umiCtcRequest = umiStyleWrap(ctcRequest)
|
|
57
|
+
|
|
58
|
+
export {authRequest, ctcRequest, umiAuthRequest, umiCtcRequest}
|
|
59
|
+
export default umiRequest
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 路由表: 把 agentApi / flowApi / llmApi / mcpApi / scriptApi / skillApi /
|
|
3
|
+
* productApi / sceneApi / ossApi 方法名映射到真实后端 endpoint。
|
|
4
|
+
*
|
|
5
|
+
* 移植自主壳 src/services/apiRouter.ts,只保留本包页面实际用到的 Api。
|
|
6
|
+
* 未命中 → 返空响应(不影响 build)。
|
|
7
|
+
*/
|
|
8
|
+
import {reg} from './apiRouter.js'
|
|
9
|
+
|
|
10
|
+
// =============================================================
|
|
11
|
+
// llmApi (LLM 模型)
|
|
12
|
+
// =============================================================
|
|
13
|
+
reg('llmApi', 'knowledgeList', 'GET', '/llm-gateway/knowledge/list')
|
|
14
|
+
reg('llmApi', 'skillTemplateList', 'GET', '/llm-gateway/skill/template-list')
|
|
15
|
+
reg('llmApi', 'toolTemplateList', 'GET', '/llm-gateway/tool/template-list')
|
|
16
|
+
reg('llmApi', 'appConfig', 'GET', '/llm-gateway/app/config')
|
|
17
|
+
reg('llmApi', 'appSkillAdd', 'POST', '/llm-gateway/app/skill-add')
|
|
18
|
+
reg('llmApi', 'appToolAdd', 'POST', '/llm-gateway/app/tool-add')
|
|
19
|
+
|
|
20
|
+
// =============================================================
|
|
21
|
+
// mcpApi
|
|
22
|
+
// =============================================================
|
|
23
|
+
reg('mcpApi', 'list', 'GET', '/mcp/server/list')
|
|
24
|
+
reg('mcpApi', 'listTools', 'POST', '/mcp/server/tools/list')
|
|
25
|
+
reg('mcpApi', 'callTool', 'POST', '/mcp/server/tools/call')
|
|
26
|
+
reg('mcpApi', 'test', 'POST', '/mcp/server/test')
|
|
27
|
+
reg('mcpApi', 'create', 'POST', '/mcp/server')
|
|
28
|
+
reg('mcpApi', 'update', 'POST', '/mcp/server/update')
|
|
29
|
+
reg('mcpApi', 'delete', 'POST', '/mcp/server/delete')
|
|
30
|
+
|
|
31
|
+
// =============================================================
|
|
32
|
+
// ossApi (对象存储 z-oss)
|
|
33
|
+
// =============================================================
|
|
34
|
+
reg('ossApi', 'listBuckets', 'GET', '/v1/bucket')
|
|
35
|
+
reg('ossApi', 'getBucketStats', 'GET', '/v1/bucket/{bucketName}/stats')
|
|
36
|
+
reg('ossApi', 'createBucket', 'POST', '/v1/bucket')
|
|
37
|
+
reg('ossApi', 'deleteBucket', 'DELETE', '/v1/bucket/{bucketName}')
|
|
38
|
+
reg('ossApi', 'setBucketAcl', 'PUT', '/v1/bucket/{bucketName}/acl')
|
|
39
|
+
reg('ossApi', 'listObjects', 'GET', '/v1/object/{bucketName}')
|
|
40
|
+
reg('ossApi', 'presignedUrl', 'GET', '/v1/object/{bucketName}/{objectKey}/url')
|
|
41
|
+
reg('ossApi', 'uploadObject', 'POST', '/v1/object/{bucketName}/{objectKey}')
|
|
42
|
+
reg('ossApi', 'downloadUrl', 'GET', '/v1/object/{bucketName}/{objectKey}/url')
|
|
43
|
+
reg('ossApi', 'deleteObject', 'DELETE', '/v1/object/{bucketName}/{objectKey}')
|
|
44
|
+
reg('ossApi', 'copyObject', 'POST', '/v1/object/{bucketName}/{objectKey}/copy')
|
|
45
|
+
reg('ossApi', 'batchDelete', 'POST', '/v1/object/{bucketName}/batch-delete')
|
|
46
|
+
reg('ossApi', 'createFolder', 'POST', '/v1/folder/{bucketName}/{folderKey}')
|
|
47
|
+
|
|
48
|
+
// =============================================================
|
|
49
|
+
// scriptApi (脚本中心)
|
|
50
|
+
// =============================================================
|
|
51
|
+
reg('scriptApi', 'list', 'GET', '/script/list')
|
|
52
|
+
reg('scriptApi', 'create', 'POST', '/script')
|
|
53
|
+
reg('scriptApi', 'update', 'POST', '/script/update')
|
|
54
|
+
reg('scriptApi', 'delete', 'POST', '/script/delete')
|
|
55
|
+
reg('scriptApi', 'publish', 'POST', '/script/publish')
|
|
56
|
+
reg('scriptApi', 'unpublish', 'POST', '/script/unpublish')
|
|
57
|
+
reg('scriptApi', 'run', 'POST', '/script/run')
|
|
58
|
+
reg('scriptApi', 'importCurl', 'POST', '/script/import-curl')
|
|
59
|
+
reg('scriptApi', 'importOpenApi', 'POST', '/script/import-openapi')
|
|
60
|
+
reg('scriptApi', 'previewMapping', 'POST', '/script/preview-mapping')
|
|
61
|
+
|
|
62
|
+
// =============================================================
|
|
63
|
+
// skillApi (技能市场)
|
|
64
|
+
// =============================================================
|
|
65
|
+
reg('skillApi', 'page', 'GET', '/skill/page')
|
|
66
|
+
reg('skillApi', 'categoryTree', 'GET', '/skill/category-tree')
|
|
67
|
+
reg('skillApi', 'create', 'POST', '/skill')
|
|
68
|
+
reg('skillApi', 'createCategory', 'POST', '/skill/category')
|
|
69
|
+
reg('skillApi', 'deleteCategory', 'POST', '/skill/category/delete')
|
|
70
|
+
reg('skillApi', 'getBySkillCode', 'GET', '/skill/by-code')
|
|
71
|
+
reg('skillApi', 'install', 'POST', '/skill/install')
|
|
72
|
+
reg('skillApi', 'stats', 'GET', '/skill/stats')
|
|
73
|
+
reg('skillApi', 'versions', 'GET', '/skill/versions')
|
|
74
|
+
reg('skillApi', 'downloadPackage', 'GET', '/skill/download')
|
|
75
|
+
reg('skillApi', 'uploadPackage', 'POST', '/skill/upload')
|
|
76
|
+
|
|
77
|
+
// =============================================================
|
|
78
|
+
// agentApi (Agent 应用)
|
|
79
|
+
// =============================================================
|
|
80
|
+
reg('agentApi', 'appPage', 'POST', '/agent/app/page')
|
|
81
|
+
reg('agentApi', 'appGet', 'GET', '/agent/app/get')
|
|
82
|
+
reg('agentApi', 'appCreate', 'POST', '/agent/app')
|
|
83
|
+
reg('agentApi', 'appUpdate', 'POST', '/agent/app/update')
|
|
84
|
+
reg('agentApi', 'appDelete', 'POST', '/agent/app/delete')
|
|
85
|
+
reg('agentApi', 'appPublish', 'POST', '/agent/app/publish')
|
|
86
|
+
reg('agentApi', 'appUpgrade', 'POST', '/agent/app/upgrade')
|
|
87
|
+
reg('agentApi', 'appToggleShare', 'POST', '/agent/app/toggleShare')
|
|
88
|
+
reg('agentApi', 'versions', 'GET', '/agent/app/versions')
|
|
89
|
+
reg('agentApi', 'groupTree', 'GET', '/agent/group/tree')
|
|
90
|
+
reg('agentApi', 'groupCreate', 'POST', '/agent/group')
|
|
91
|
+
reg('agentApi', 'groupUpdate', 'POST', '/agent/group/update')
|
|
92
|
+
reg('agentApi', 'groupDelete', 'POST', '/agent/group/delete')
|
|
93
|
+
reg('agentApi', 'chatHistory', 'GET', '/agent/chat/history')
|
|
94
|
+
reg('agentApi', 'chatStream', 'POST', '/agent/chat/send')
|
|
95
|
+
reg('agentApi', 'chatClear', 'POST', '/agent/chat/clear')
|
|
96
|
+
reg('agentApi', 'shareVerify', 'GET', '/agent/share/verify')
|
|
97
|
+
|
|
98
|
+
// =============================================================
|
|
99
|
+
// flowApi (Agent 工作流 FEATURE013 A5)
|
|
100
|
+
// =============================================================
|
|
101
|
+
reg('flowApi', 'list', 'GET', '/agent/flow/list')
|
|
102
|
+
reg('flowApi', 'get', 'GET', '/agent/flow/{id}')
|
|
103
|
+
reg('flowApi', 'byFlowId', 'GET', '/agent/flow/byFlowId')
|
|
104
|
+
reg('flowApi', 'versions', 'GET', '/agent/flow/versions')
|
|
105
|
+
reg('flowApi', 'create', 'POST', '/agent/flow/create')
|
|
106
|
+
reg('flowApi', 'update', 'POST', '/agent/flow/update')
|
|
107
|
+
reg('flowApi', 'publish', 'POST', '/agent/flow/publish/{id}')
|
|
108
|
+
reg('flowApi', 'archive', 'POST', '/agent/flow/archive/{id}')
|
|
109
|
+
reg('flowApi', 'newVersion', 'POST', '/agent/flow/newVersion/{parentId}')
|
|
110
|
+
reg('flowApi', 'delete', 'POST', '/agent/flow/delete/{id}')
|
|
111
|
+
reg('flowApi', 'execute', 'POST', '/agent/flow/execute/{id}')
|
|
112
|
+
reg('flowApi', 'health', 'GET', '/agent/flow/health')
|
|
113
|
+
|
|
114
|
+
// =============================================================
|
|
115
|
+
// productApi (产品中心)
|
|
116
|
+
// =============================================================
|
|
117
|
+
reg('productApi', 'page', 'GET', '/v1/products')
|
|
118
|
+
reg('productApi', 'create', 'POST', '/v1/products')
|
|
119
|
+
reg('productApi', 'update', 'PUT', '/v1/products/{id}')
|
|
120
|
+
reg('productApi', 'delete', 'DELETE', '/v1/products/{id}')
|
|
121
|
+
reg('productApi', 'publish', 'POST', '/v1/products/{id}/publish')
|
|
122
|
+
reg('productApi', 'offline', 'POST', '/v1/products/{id}/offline')
|
|
123
|
+
reg('productApi', 'configGet', 'GET', '/v1/products/{id}/config')
|
|
124
|
+
reg('productApi', 'configSave', 'PUT', '/v1/products/{id}/config')
|
|
125
|
+
|
|
126
|
+
// =============================================================
|
|
127
|
+
// sceneApi (场景编排)
|
|
128
|
+
// =============================================================
|
|
129
|
+
reg('sceneApi', 'page', 'GET', '/v1/scenes')
|
|
130
|
+
reg('sceneApi', 'create', 'POST', '/v1/scenes')
|
|
131
|
+
reg('sceneApi', 'update', 'PUT', '/v1/scenes/{id}')
|
|
132
|
+
reg('sceneApi', 'delete', 'DELETE', '/v1/scenes/{id}')
|
|
133
|
+
reg('sceneApi', 'duplicate', 'POST', '/v1/scenes/{id}/duplicate')
|
|
134
|
+
reg('sceneApi', 'publish', 'POST', '/v1/scenes/{id}/publish')
|
|
135
|
+
reg('sceneApi', 'offline', 'POST', '/v1/scenes/{id}/offline')
|
|
136
|
+
reg('sceneApi', 'execute', 'POST', '/v1/scenes/{id}/execute')
|
|
137
|
+
reg('sceneApi', 'canvasGet', 'GET', '/v1/scenes/{id}/canvas')
|
|
138
|
+
reg('sceneApi', 'configGet', 'GET', '/v1/scenes/{id}/config')
|
|
139
|
+
reg('sceneApi', 'nodes', 'GET', '/v1/scenes/{id}/nodes')
|
|
140
|
+
reg('sceneApi', 'chatHistory', 'GET', '/v1/scenes/{id}/chat-history')
|
package/src/dev.jsx
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent 组件库 dev playground
|
|
3
|
+
* 运行: npm run dev (在 z-opc-frontend/packages/z-agent-frontend-component 目录下)
|
|
4
|
+
*
|
|
5
|
+
* 列出本包所有导出页面的占位卡片,方便独立 dev 调试。
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react'
|
|
8
|
+
import ReactDOM from 'react-dom/client'
|
|
9
|
+
import {ConfigProvider, Card, Space, Tag, Typography} from 'antd'
|
|
10
|
+
import zhCN from 'antd/locale/zh_CN'
|
|
11
|
+
import {
|
|
12
|
+
AgentAppList,
|
|
13
|
+
AkManage,
|
|
14
|
+
BucketList,
|
|
15
|
+
McpPage,
|
|
16
|
+
ModelManage,
|
|
17
|
+
ProductList,
|
|
18
|
+
ScriptCenterPage,
|
|
19
|
+
SkillMarket,
|
|
20
|
+
UsageDashboard,
|
|
21
|
+
} from './index.js'
|
|
22
|
+
|
|
23
|
+
const {Title, Text} = Typography
|
|
24
|
+
|
|
25
|
+
const App = () => {
|
|
26
|
+
return (
|
|
27
|
+
<ConfigProvider locale={zhCN}>
|
|
28
|
+
<div style={{padding: 24, background: '#f5f5f5', minHeight: '100vh'}}>
|
|
29
|
+
<Title level={2} style={{marginTop: 0}}>
|
|
30
|
+
@yuku123/z-agent-frontend-component
|
|
31
|
+
<Tag color="blue" style={{marginLeft: 12, verticalAlign: 'middle'}}>
|
|
32
|
+
Dev Playground
|
|
33
|
+
</Tag>
|
|
34
|
+
</Title>
|
|
35
|
+
<Text type="secondary">
|
|
36
|
+
本页是 z-agent-frontend-component 的独立 dev 入口,列出包内所有导出的页面。
|
|
37
|
+
真实数据走 <code>/api</code>,需要本地有 z-opc 后端在 <code>localhost:8888</code> 运行。
|
|
38
|
+
</Text>
|
|
39
|
+
|
|
40
|
+
<Space direction="vertical" size="large" style={{width: '100%', marginTop: 24}}>
|
|
41
|
+
<Section title="Agent 应用">
|
|
42
|
+
<AgentAppList/>
|
|
43
|
+
</Section>
|
|
44
|
+
<Section title="LLM 模型管理">
|
|
45
|
+
<ModelManage/>
|
|
46
|
+
</Section>
|
|
47
|
+
<Section title="AK 管理">
|
|
48
|
+
<AkManage/>
|
|
49
|
+
</Section>
|
|
50
|
+
<Section title="MCP 中心">
|
|
51
|
+
<McpPage/>
|
|
52
|
+
</Section>
|
|
53
|
+
<Section title="OSS Bucket 列表">
|
|
54
|
+
<BucketList/>
|
|
55
|
+
</Section>
|
|
56
|
+
<Section title="脚本中心">
|
|
57
|
+
<ScriptCenterPage/>
|
|
58
|
+
</Section>
|
|
59
|
+
<Section title="技能市场">
|
|
60
|
+
<SkillMarket/>
|
|
61
|
+
</Section>
|
|
62
|
+
<Section title="产品中心">
|
|
63
|
+
<ProductList/>
|
|
64
|
+
</Section>
|
|
65
|
+
<Section title="用量统计">
|
|
66
|
+
<UsageDashboard/>
|
|
67
|
+
</Section>
|
|
68
|
+
</Space>
|
|
69
|
+
</div>
|
|
70
|
+
</ConfigProvider>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const Section = ({title, children}) => (
|
|
75
|
+
<Card size="small" title={title} style={{borderRadius: 8}}>
|
|
76
|
+
{children}
|
|
77
|
+
</Card>
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
ReactDOM.createRoot(document.getElementById('root')).render(<App/>)
|
package/src/index.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* z-agent-frontend-component 包入口
|
|
3
|
+
*
|
|
4
|
+
* 命名导出所有 agent / llm / mcp / oss / skill / script / product / scene 页面组件。
|
|
5
|
+
* 与主壳 src/pages/ai/* 一一对应:
|
|
6
|
+
* - AgentAppPage -> Agent 应用列表(/ai/agent/app)
|
|
7
|
+
* - AgentAppEditor -> Agent 应用编辑器
|
|
8
|
+
* - AgentSharePage -> Agent 公开分享页(/share/:shareCode)
|
|
9
|
+
* - WorkflowEditor -> LogicFlow 工作流编辑器
|
|
10
|
+
* - ModelManage -> LLM 模型管理(/ai/llm)
|
|
11
|
+
* - LlmProvider -> LLM 供应商(/ai/llm/provider)
|
|
12
|
+
* - LlmModel -> LLM 模型列表(/ai/llm/model)
|
|
13
|
+
* - AkManage -> AK 管理(/ai/ak)
|
|
14
|
+
* - AkUsageDrawer -> AK 用量抽屉
|
|
15
|
+
* - McpPage -> MCP 中心(/ai/mcp)
|
|
16
|
+
* - BucketList -> OSS Bucket 列表(/ai/oss/bucket)
|
|
17
|
+
* - ObjectBrowser -> OSS 对象浏览器(/ai/oss/bucket/:bucketName)
|
|
18
|
+
* - ScriptCenterPage -> 脚本中心(/ai/script)
|
|
19
|
+
* - ApiBridgeEditor -> 脚本中心 - API 网桥编辑器
|
|
20
|
+
* - CurlImportModal -> 脚本中心 - Curl 导入弹窗
|
|
21
|
+
* - OpenApiImportModal -> 脚本中心 - OpenAPI 导入弹窗
|
|
22
|
+
* - FieldMappingEditor -> 脚本中心 - 字段映射编辑器
|
|
23
|
+
* - SkillMarket -> 技能市场(/ai/skill)
|
|
24
|
+
* - ProductList -> 产品中心(/ai/product)
|
|
25
|
+
* - ProductExecute -> 产品执行(/ai/product/execute)
|
|
26
|
+
* - ProductScene -> 产品场景(/ai/product/scene)
|
|
27
|
+
* - UsageDashboard -> 用量统计(/ai/usage)
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
// Agent 应用 + 编辑器 + 工作流
|
|
31
|
+
export {default as AgentAppPage} from './pages/agent/index.jsx'
|
|
32
|
+
export {default as AgentAppList} from './pages/agent/app/index.jsx'
|
|
33
|
+
export {default as AgentAppEditor} from './pages/agent/editor/AgentAppEditor.jsx'
|
|
34
|
+
export {default as AgentSharePage} from './pages/agent/share.jsx'
|
|
35
|
+
export {default as WorkflowEditor} from './pages/agent/editor/WorkflowEditor.jsx'
|
|
36
|
+
|
|
37
|
+
// LLM 模型 / 供应商 / 模型列表
|
|
38
|
+
export {default as ModelManage} from './pages/llm/index.jsx'
|
|
39
|
+
export {default as LlmProvider} from './pages/llm/provider/index.jsx'
|
|
40
|
+
export {default as LlmModel} from './pages/llm/model/index.jsx'
|
|
41
|
+
|
|
42
|
+
// AK 管理
|
|
43
|
+
export {default as AkManage} from './pages/ak/index.jsx'
|
|
44
|
+
export {default as AkUsageDrawer} from './pages/ak/AkUsageDrawer.jsx'
|
|
45
|
+
|
|
46
|
+
// MCP 中心
|
|
47
|
+
export {default as McpPage} from './pages/mcp/index.jsx'
|
|
48
|
+
|
|
49
|
+
// OSS 对象存储
|
|
50
|
+
export {default as BucketList} from './pages/oss/BucketList.jsx'
|
|
51
|
+
export {default as ObjectBrowser} from './pages/oss/ObjectBrowser.jsx'
|
|
52
|
+
|
|
53
|
+
// 脚本中心
|
|
54
|
+
export {default as ScriptCenterPage} from './pages/script/index.jsx'
|
|
55
|
+
export {default as ApiBridgeEditor} from './pages/script/ApiBridgeEditor.jsx'
|
|
56
|
+
export {default as CurlImportModal} from './pages/script/CurlImportModal.jsx'
|
|
57
|
+
export {default as OpenApiImportModal} from './pages/script/OpenApiImportModal.jsx'
|
|
58
|
+
export {default as FieldMappingEditor} from './pages/script/FieldMappingEditor.jsx'
|
|
59
|
+
|
|
60
|
+
// 技能市场
|
|
61
|
+
export {default as SkillMarket} from './pages/skill/index.jsx'
|
|
62
|
+
|
|
63
|
+
// 产品中心
|
|
64
|
+
export {default as ProductList} from './pages/product/index.jsx'
|
|
65
|
+
export {default as ProductExecute} from './pages/product/execute.jsx'
|
|
66
|
+
export {default as ProductScene} from './pages/product/scene.jsx'
|
|
67
|
+
|
|
68
|
+
// 用量统计
|
|
69
|
+
export {default as UsageDashboard} from './pages/usage/index.jsx'
|
|
70
|
+
|
|
71
|
+
// API 客户端(也支持从 '@yuku123/z-agent-frontend-component/api' 单独 import)
|
|
72
|
+
export {
|
|
73
|
+
agentApi,
|
|
74
|
+
flowApi,
|
|
75
|
+
llmApi,
|
|
76
|
+
mcpApi,
|
|
77
|
+
scriptApi,
|
|
78
|
+
skillApi,
|
|
79
|
+
productApi,
|
|
80
|
+
sceneApi,
|
|
81
|
+
ossApi,
|
|
82
|
+
authRequest,
|
|
83
|
+
ctcRequest,
|
|
84
|
+
} from './api/index.js'
|
|
85
|
+
import request from './api/index.js'
|
|
86
|
+
export {request}
|