bailinghub 0.9.4 → 0.10.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.en.md +6 -6
- package/README.md +6 -6
- package/THIRD_PARTY_NOTICES.md +2 -2
- package/docker-compose.images.yml +2 -2
- package/docs/AGENT_CLIENT_QUICKSTART.en.md +1 -3
- package/docs/AGENT_CLIENT_QUICKSTART.md +1 -1
- package/docs/AGENT_CLIENT_RUNTIME_API.en.md +87 -2
- package/docs/AGENT_CLIENT_RUNTIME_API.md +36 -2
- package/docs/AGENT_KNOWLEDGE_API.en.md +77 -0
- package/docs/AGENT_KNOWLEDGE_API.md +86 -0
- package/docs/AGENT_TASK_CONTROL.md +4 -4
- package/docs/AGENT_TASK_CONTROL_FOUNDATION.md +1 -1
- package/docs/ARCHITECTURE.md +4 -0
- package/docs/CHANGELOG.en.md +24 -1
- package/docs/CHANGELOG.md +24 -1
- package/docs/COMPATIBILITY.en.md +27 -1
- package/docs/CONTRACT.en.md +1 -1
- package/docs/CONTRACT.md +1 -1
- package/docs/IMPLEMENTATION_STATUS.en.md +28 -15
- package/docs/IMPLEMENTATION_STATUS.md +28 -15
- package/docs/INDEPENDENT_VALIDATION.en.md +6 -4
- package/docs/INDEPENDENT_VALIDATION.md +6 -4
- package/docs/INTEGRATION_WALKTHROUGH.md +65 -0
- package/docs/MODEL_BILLING.en.md +2 -0
- package/docs/MODEL_BILLING.md +6 -2
- package/docs/MODEL_CONTINUATION.en.md +54 -0
- package/docs/MODEL_CONTINUATION.md +54 -0
- package/docs/MODEL_OUTPUT_BUDGET.en.md +69 -0
- package/docs/MODEL_OUTPUT_BUDGET.md +69 -0
- package/docs/OPERATIONS.en.md +16 -4
- package/docs/OPERATIONS.md +16 -4
- package/docs/QUICKSTART.md +1 -1
- package/docs/README.en.md +7 -0
- package/docs/README.md +7 -0
- package/docs/RELEASE_NOTES_NEXT.en.md +3 -3
- package/docs/RELEASE_NOTES_NEXT.md +3 -3
- package/docs/RELEASE_NOTES_v0.10.0.en.md +58 -0
- package/docs/RELEASE_NOTES_v0.10.0.md +58 -0
- package/docs/RELEASE_NOTES_v0.10.1.en.md +41 -0
- package/docs/RELEASE_NOTES_v0.10.1.md +41 -0
- package/docs/UPGRADE_PLAN.en.md +118 -0
- package/docs/UPGRADE_PLAN.md +124 -0
- package/docs/UPGRADE_v0.10.0.en.md +47 -0
- package/docs/UPGRADE_v0.10.0.md +47 -0
- package/docs/UPGRADE_v0.10.1.en.md +66 -0
- package/docs/UPGRADE_v0.10.1.md +66 -0
- package/docs//345/205/274/345/256/271/346/200/247/344/270/216/345/215/207/347/272/247.md +38 -22
- package/package.json +10 -5
- package/schemas/tool-definition.schema.json +13 -0
- package/scripts/check-doc-links.mjs +6 -0
- package/scripts/check-image-tags.sh +1 -1
- package/scripts/check-php-sdk-artifacts.mjs +152 -0
- package/scripts/check-php-sdk-artifacts.test.mjs +99 -0
- package/scripts/check-release-consistency.test.mjs +2 -2
- package/scripts/doctor-upgrade-plan.test.ts +205 -0
- package/scripts/doctor-upgrade-plan.ts +276 -0
- package/scripts/doctor.ts +4 -1
- package/scripts/e2e-console-approval-details.mjs +134 -0
- package/scripts/e2e-console-config-races.mjs +180 -0
- package/scripts/e2e-console-kb-audit.mjs +170 -0
- package/scripts/e2e-console-operations-audit.mjs +152 -0
- package/scripts/e2e-console-runtime-audit.mjs +179 -0
- package/scripts/e2e-console-settings-audit.mjs +125 -0
- package/scripts/e2e-console-troubleshooting-extra.mjs +267 -0
- package/scripts/e2e-console.mjs +476 -7
- package/scripts/install.sh +1 -1
- package/scripts/publish-images.sh +1 -1
- package/scripts/release-audit.mjs +9 -1
- package/scripts/sdk-declaration-contract-test.ts +34 -0
- package/scripts/sdk-p1-check.mjs +62 -26
- package/scripts/verify-github-repo.mjs +8 -0
- package/sdk/dotnet/Bailing.Connect/BailingConnect.cs +4 -4
- package/sdk/dotnet/README.md +8 -0
- package/sdk/dotnet/tests/Declaration/Declaration.csproj +11 -0
- package/sdk/dotnet/tests/Declaration/Program.cs +74 -0
- package/sdk/go/README.md +8 -0
- package/sdk/go/bailingconnect/connect.go +5 -5
- package/sdk/go/bailingconnect/declaration_test.go +107 -0
- package/sdk/java/README.md +13 -0
- package/sdk/java/src/main/java/com/bailing/connect/BailingConnect.java +4 -4
- package/sdk/java/tests/DeclarationTest.java +70 -0
- package/sdk/node/README.md +8 -0
- package/sdk/node/src/index.mjs +4 -4
- package/sdk/node/tests/declaration.test.mjs +41 -0
- package/sdk/php/README.md +16 -0
- package/sdk/php/src/Attributes/AiTool.php +4 -4
- package/sdk/php/src/SpecBuilder.php +8 -8
- package/sdk/php/tests/declaration-serialization.php +103 -0
- package/sdk/php7/README.md +14 -0
- package/sdk/php7/src/ToolDef.php +3 -3
- package/sdk/php7/src/ToolSpec.php +8 -13
- package/sdk/php7/tests/declaration-serialization.php +103 -0
- package/sdk/python/README.md +8 -0
- package/sdk/python/bailing_connect/__init__.py +6 -6
- package/sdk/python/tests/test_declaration.py +61 -0
- package/src/app/agent-client-runtime.test.ts +115 -2
- package/src/app/agent-client-runtime.ts +40 -11
- package/src/app/agent-knowledge.test.ts +171 -0
- package/src/app/agent-knowledge.ts +233 -0
- package/src/app/agent-tool-catalog-revision.test.ts +31 -0
- package/src/app/agent-tool-invocations.test.ts +7 -2
- package/src/app/agent-tool-invocations.ts +67 -7
- package/src/app/approval-continuations.test.ts +49 -1
- package/src/app/http.test.ts +16 -1
- package/src/app/http.ts +3 -3
- package/src/app/kernel-boot-recovery.mysql.test.ts +132 -0
- package/src/app/kernel-boot-recovery.test.ts +157 -0
- package/src/app/kernel.ts +12 -8
- package/src/app/readiness.mysql.test.ts +120 -0
- package/src/app/readiness.test.ts +111 -26
- package/src/app/readiness.ts +26 -22
- package/src/app/runtime-lifecycle.ts +34 -3
- package/src/app/tool-approvals.test.ts +83 -0
- package/src/app/tool-approvals.ts +25 -7
- package/src/app/tool-proxy-payload.test.ts +81 -0
- package/src/app/tool-proxy.ts +24 -2
- package/src/core/config/console-diagnostic-location.test.ts +36 -0
- package/src/core/config/console-form-guard.test.ts +69 -0
- package/src/core/config/console-task-location.test.ts +64 -0
- package/src/core/contracts/explicit-capability-values.test.ts +62 -0
- package/src/core/contracts/openapi-tools.ts +18 -7
- package/src/core/contracts/schema-readiness.ts +11 -0
- package/src/core/contracts/tool-annotations.ts +4 -4
- package/src/core/contracts/tool-definition.ts +26 -0
- package/src/core/contracts/tool-guidance.test.ts +77 -0
- package/src/core/contracts/tool-guidance.ts +31 -0
- package/src/core/contracts/tool-input-limits.ts +15 -0
- package/src/core/contracts/tools-idempotency.test.ts +90 -0
- package/src/core/contracts/tools.ts +52 -9
- package/src/core/runtime/agent-execution-memory.test.ts +64 -0
- package/src/core/runtime/agent-execution-memory.ts +63 -0
- package/src/core/state/state-contracts.ts +3 -0
- package/src/infrastructure/config/config-observability-ledger.ts +2 -0
- package/src/infrastructure/schema/schema-readiness.ts +29 -0
- package/src/infrastructure/state/state-mysql.ts +3 -0
- package/src/modules/usage/contracts.ts +7 -0
- package/src/modules/usage/http.ts +2 -0
- package/src/modules/usage/model-continuation.test.ts +109 -0
- package/src/modules/usage/model-gateway.ts +5 -1
- package/src/modules/usage/output-budget.mysql.test.ts +84 -0
- package/src/modules/usage/output-budget.test.ts +167 -0
- package/src/modules/usage/output-budget.ts +73 -0
- package/src/modules/usage/provider-stream.test.ts +22 -0
- package/src/modules/usage/provider.ts +2 -3
- package/src/modules/usage/repository.ts +6 -0
- package/src/modules/usage/test-harness.ts +4 -2
- package/src/routes/admin-approval-view.test.ts +109 -0
- package/src/routes/admin-approval-view.ts +36 -0
- package/src/routes/admin-readiness.test.ts +52 -0
- package/src/routes/admin-runtime-ux.test.ts +51 -0
- package/src/routes/admin-runtime-ux.ts +25 -0
- package/src/routes/admin-runtime.ts +36 -8
- package/src/routes/admin.ts +9 -0
- package/src/routes/agent-api.test.ts +80 -1
- package/src/routes/agent-api.ts +63 -4
- package/src/routes/agent-tool-detail.test.ts +140 -0
- package/src/routes/public-default.ts +1 -1
- package/src/services/kb-agent.test.ts +84 -0
- package/src/services/kb.ts +73 -0
- package/web/connect/bailing-connect-php.tgz +0 -0
- package/web/connect/bailing-connect-php7.tgz +0 -0
- package/web/console/assets/Accounts-CjIBO3sU.css +1 -0
- package/web/console/assets/Accounts-Dhyw-7wF.js +3 -0
- package/web/console/assets/AgentClients-BA0M26-I.css +1 -0
- package/web/console/assets/AgentClients-DWxb8-ko.js +1 -0
- package/web/console/assets/AgentTasks-DOyxANnx.css +1 -0
- package/web/console/assets/AgentTasks-DUHD4dzr.js +2 -0
- package/web/console/assets/Approvals-Brl-2uJq.css +1 -0
- package/web/console/assets/Approvals-CQx1YWxW.js +1 -0
- package/web/console/assets/Audit--QcdVlMh.js +1 -0
- package/web/console/assets/Audit-DAdmOnIs.css +1 -0
- package/web/console/assets/{BrandLockup-CffORQse.js → BrandLockup-DQcaW4Nt.js} +1 -1
- package/web/console/assets/Channels-DJJU3ksE.css +1 -0
- package/web/console/assets/Channels-cGS5WfQ-.js +105 -0
- package/web/console/assets/ChatEntries-BYpji27B.css +1 -0
- package/web/console/assets/ChatEntries-nh23Iz5O.js +7 -0
- package/web/console/assets/Clients-CX5EeYio.js +3 -0
- package/web/console/assets/Clients-CbZAou8E.css +1 -0
- package/web/console/assets/Cost-C6oQvz9P.css +1 -0
- package/web/console/assets/Cost-DOZfdNS9.js +1 -0
- package/web/console/assets/Credentials--aHs57yV.css +1 -0
- package/web/console/assets/Credentials-sy6W9Sac.js +1 -0
- package/web/console/assets/Diagnostics-CKs27Dnv.css +1 -0
- package/web/console/assets/Diagnostics-CyoM1XrZ.js +1 -0
- package/web/console/assets/Executors-2Upi6bOS.css +1 -0
- package/web/console/assets/Executors-BQqqiFwt.js +1 -0
- package/web/console/assets/HelpTip-DLlhaGQp.js +1 -0
- package/web/console/assets/HelpTip-bbDEyuqV.css +1 -0
- package/web/console/assets/Kb-5R3ce4UU.js +5 -0
- package/web/console/assets/Kb-BM_PYi11.css +1 -0
- package/web/console/assets/{Login-CGgLGTE1.js → Login-YKeUwdgo.js} +1 -1
- package/web/console/assets/Projects-DHwHrPT9.css +1 -0
- package/web/console/assets/Projects-Grgb6fOv.js +1 -0
- package/web/console/assets/Routes-DR_Yf02e.css +1 -0
- package/web/console/assets/Routes-DYgrXlRJ.js +138 -0
- package/web/console/assets/Runs-CwTddJJj.js +3 -0
- package/web/console/assets/Runs-D4FOvNfu.css +1 -0
- package/web/console/assets/Setup-Ca0b1d1-.css +1 -0
- package/web/console/assets/Setup-D_xUPNDq.js +1 -0
- package/web/console/assets/Shell-BTg8Vw_L.css +1 -0
- package/web/console/assets/Shell-Dfam2Uoj.js +1 -0
- package/web/console/assets/StorageBuckets-7QLBpV4a.css +1 -0
- package/web/console/assets/StorageBuckets-CP6e50wI.js +1 -0
- package/web/console/assets/SystemSettings-BRYKyJNa.js +1 -0
- package/web/console/assets/SystemSettings-HsXGx0aH.css +1 -0
- package/web/console/assets/SystemStatus-B-VfRsQd.css +1 -0
- package/web/console/assets/SystemStatus-CbPsDsGt.js +1 -0
- package/web/console/assets/Targets-1j4-g6rC.css +1 -0
- package/web/console/assets/Targets-C2LkR2AF.js +1 -0
- package/web/console/assets/Tools-C9HPJqJb.css +1 -0
- package/web/console/assets/Tools-C9JNJUS0.js +2 -0
- package/web/console/assets/Usage-D1Mv6vGY.js +1 -0
- package/web/console/assets/Usage-DMOzUsqh.css +1 -0
- package/web/console/assets/UsageAccess-77LmGCm6.js +1 -0
- package/web/console/assets/UsageAccess-C6ZGxEgJ.css +1 -0
- package/web/console/assets/{UsageHelp-CzS2gI40.js → UsageHelp-BmuiE1Ew.js} +1 -1
- package/web/console/assets/client-route-draft-DxZRxKPT.js +1 -0
- package/web/console/assets/console-location-Csv-xsnl.js +1 -0
- package/web/console/assets/form-guard-8GrFpry0.js +1 -0
- package/web/console/assets/{index-65JiiUr4.js → index-B_5UfiTw.js} +1 -1
- package/web/console/assets/index-MjZJEFIN.js +2 -0
- package/web/console/assets/{request-DKycpD7z.js → request-rqm6MT0s.js} +1 -1
- package/web/console/assets/runtime-feedback-gPfZVNvY.js +1 -0
- package/web/console/assets/{schema-SCiNxBlR.js → schema-o3mK4mid.js} +1 -1
- package/web/console/assets/task-page-location-DWiGtAln.js +1 -0
- package/web/console/assets/use-list-location-FvLFt0Tq.css +1 -0
- package/web/console/assets/use-list-location-cIPy2cKM.js +1 -0
- package/web/console/assets/use-unsaved-form-DScKD0h9.js +1 -0
- package/web/console/assets/{util-DZYfJ5Zo.js → util-B40VqOwl.js} +1 -1
- package/web/console/assets/{vendor-element-8cVcdt5T.js → vendor-element-BT8tHCFk.js} +1 -1
- package/web/console/assets/{vendor-mammoth-CnDA23N0.js → vendor-mammoth-CVIXVxTN.js} +1 -1
- package/web/console/assets/{vendor-vue-Co7x2FW6.js → vendor-vue-DhbG0vd4.js} +7 -7
- package/web/console/index.html +3 -3
- package/web-admin/package-lock.json +4 -4
- package/web-admin/package.json +1 -1
- package/web-admin/src/client-route-draft.ts +25 -0
- package/web-admin/src/components/AgentSetupPanel.vue +54 -41
- package/web-admin/src/components/HelpTip.vue +4 -1
- package/web-admin/src/components/ListLocationBar.vue +22 -0
- package/web-admin/src/components/NotificationOutboxPanel.vue +35 -7
- package/web-admin/src/console-entry.test.ts +26 -0
- package/web-admin/src/console-entry.ts +20 -0
- package/web-admin/src/console-location.ts +35 -0
- package/web-admin/src/form-guard.ts +35 -0
- package/web-admin/src/layout/Shell.vue +18 -65
- package/web-admin/src/onboarding-state.test.ts +174 -0
- package/web-admin/src/onboarding-state.ts +122 -0
- package/web-admin/src/pages/Accounts.vue +44 -24
- package/web-admin/src/pages/AgentClients.vue +47 -29
- package/web-admin/src/pages/AgentTasks.vue +57 -12
- package/web-admin/src/pages/Approvals.vue +105 -25
- package/web-admin/src/pages/Audit.vue +15 -6
- package/web-admin/src/pages/Channels.vue +136 -43
- package/web-admin/src/pages/ChatEntries.vue +96 -41
- package/web-admin/src/pages/Clients.vue +87 -26
- package/web-admin/src/pages/Cost.vue +15 -4
- package/web-admin/src/pages/Credentials.vue +63 -32
- package/web-admin/src/pages/Diagnostics.vue +103 -54
- package/web-admin/src/pages/Executors.vue +103 -40
- package/web-admin/src/pages/Kb.vue +278 -128
- package/web-admin/src/pages/Projects.vue +44 -16
- package/web-admin/src/pages/Routes.vue +168 -247
- package/web-admin/src/pages/Runs.vue +163 -91
- package/web-admin/src/pages/Setup.vue +182 -291
- package/web-admin/src/pages/StorageBuckets.vue +61 -25
- package/web-admin/src/pages/SystemSettings.vue +76 -51
- package/web-admin/src/pages/SystemStatus.vue +54 -30
- package/web-admin/src/pages/Targets.vue +45 -17
- package/web-admin/src/pages/Tools.vue +133 -68
- package/web-admin/src/pages/Usage.vue +64 -25
- package/web-admin/src/pages/UsageAccess.vue +11 -8
- package/web-admin/src/route-call-snippets.test.ts +82 -0
- package/web-admin/src/route-call-snippets.ts +178 -0
- package/web-admin/src/router.ts +11 -29
- package/web-admin/src/runtime-feedback.ts +43 -0
- package/web-admin/src/task-page-location.ts +66 -0
- package/web-admin/src/usage-output-budget.test.ts +26 -0
- package/web-admin/src/usage-output-budget.ts +46 -0
- package/web-admin/src/use-list-location.ts +24 -0
- package/web-admin/src/use-unsaved-form.ts +38 -0
- package/web-admin/tests/model-output-budget.browser.mjs +69 -0
- package/web/console/assets/Accounts-Bervi5JU.css +0 -1
- package/web/console/assets/Accounts-Dhj6PjXP.js +0 -3
- package/web/console/assets/AgentClients-CMy8StAH.js +0 -1
- package/web/console/assets/AgentClients-i52AI6YV.css +0 -1
- package/web/console/assets/AgentTasks-BsG850Il.css +0 -1
- package/web/console/assets/AgentTasks-DA1xZdmP.js +0 -2
- package/web/console/assets/Approvals-DIsd7R8N.js +0 -1
- package/web/console/assets/Approvals-DlTSHl_7.css +0 -1
- package/web/console/assets/Audit-AUDABLTX.js +0 -1
- package/web/console/assets/Audit-CSu6_3oD.css +0 -1
- package/web/console/assets/Channels-B8rjsM0S.js +0 -105
- package/web/console/assets/Channels-CCn0L1jg.css +0 -1
- package/web/console/assets/ChatEntries-DsYtcXN6.css +0 -1
- package/web/console/assets/ChatEntries-iZjJMEUZ.js +0 -7
- package/web/console/assets/Clients-CSHIsaWU.css +0 -1
- package/web/console/assets/Clients-CwgpGCSD.js +0 -3
- package/web/console/assets/Cost-B2tNxu71.js +0 -1
- package/web/console/assets/Cost-CjT39DSZ.css +0 -1
- package/web/console/assets/Credentials-BuwFB-fV.js +0 -1
- package/web/console/assets/Credentials-ioLP0qYN.css +0 -1
- package/web/console/assets/Diagnostics-Ya05PTDp.css +0 -1
- package/web/console/assets/Diagnostics-z5glms11.js +0 -1
- package/web/console/assets/Executors-Bc4SvjeH.js +0 -1
- package/web/console/assets/Executors-CjhEM54c.css +0 -1
- package/web/console/assets/HelpTip-CA6Bm7Nx.css +0 -1
- package/web/console/assets/HelpTip-Dtdt2tKR.js +0 -1
- package/web/console/assets/Kb-BRbRHxLy.js +0 -5
- package/web/console/assets/Kb-CzIzd9xr.css +0 -1
- package/web/console/assets/Projects-Bm8AjsNx.css +0 -1
- package/web/console/assets/Projects-CPWw3con.js +0 -1
- package/web/console/assets/Routes-CMIaE0Bx.js +0 -124
- package/web/console/assets/Routes-CyXV4Pba.css +0 -1
- package/web/console/assets/Runs-B8HuE700.js +0 -3
- package/web/console/assets/Runs-Bv6CV_Hk.css +0 -1
- package/web/console/assets/Setup-D7nxgn-9.css +0 -1
- package/web/console/assets/Setup-G8RKzliR.js +0 -1
- package/web/console/assets/Shell-DimHgraJ.js +0 -1
- package/web/console/assets/Shell-ykb-tUfo.css +0 -1
- package/web/console/assets/StorageBuckets-CVgpZRWY.css +0 -1
- package/web/console/assets/StorageBuckets-CiVYXIE2.js +0 -1
- package/web/console/assets/SystemSettings-BjiHyrXO.css +0 -1
- package/web/console/assets/SystemSettings-DF8sZNen.js +0 -1
- package/web/console/assets/SystemStatus-BlHywK13.js +0 -1
- package/web/console/assets/SystemStatus-I11I67rw.css +0 -1
- package/web/console/assets/Targets-BXaoPoAJ.js +0 -1
- package/web/console/assets/Targets-DTb5tn6z.css +0 -1
- package/web/console/assets/Tools-B22lNHXq.js +0 -2
- package/web/console/assets/Tools-DU8ei6sd.css +0 -1
- package/web/console/assets/Usage-C02EzoI2.js +0 -1
- package/web/console/assets/Usage-CAeDGjrb.css +0 -1
- package/web/console/assets/UsageAccess-CGGaWTuj.css +0 -1
- package/web/console/assets/UsageAccess-DOb-cyPE.js +0 -1
- package/web/console/assets/index-CK0ZCTZv.js +0 -2
|
@@ -21,7 +21,11 @@
|
|
|
21
21
|
</div>
|
|
22
22
|
</template>
|
|
23
23
|
|
|
24
|
-
<
|
|
24
|
+
<el-alert v-if="error" title="成本数据读取失败" type="error" :closable="false" show-icon style="margin-bottom: 12px">
|
|
25
|
+
<template #default>{{ error }}{{ data ? `;以下为上次读取的 ${data.days} 天旧快照。` : ';请点击刷新重试。' }}</template>
|
|
26
|
+
</el-alert>
|
|
27
|
+
<div v-if="!data && loading" v-loading="loading" style="min-height: 140px" />
|
|
28
|
+
<div v-if="data" v-loading="loading" class="cost-page">
|
|
25
29
|
<section class="overview">
|
|
26
30
|
<div class="metric primary">
|
|
27
31
|
<span>总花费</span>
|
|
@@ -161,6 +165,8 @@ const router = useRouter();
|
|
|
161
165
|
const data = ref<CostData | null>(null);
|
|
162
166
|
const days = ref(30);
|
|
163
167
|
const loading = ref(false);
|
|
168
|
+
const error = ref('');
|
|
169
|
+
let loadGeneration = 0;
|
|
164
170
|
|
|
165
171
|
const total = computed(() => data.value?.total ?? { jobs: 0, cost_usd: 0, tokens: 0 });
|
|
166
172
|
const hasCost = computed(() => total.value.cost_usd > 0);
|
|
@@ -188,9 +194,14 @@ const headlineDesc = computed(() => {
|
|
|
188
194
|
});
|
|
189
195
|
|
|
190
196
|
async function load(): Promise<void> {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
197
|
+
const generation = ++loadGeneration;
|
|
198
|
+
loading.value = true; error.value = '';
|
|
199
|
+
try {
|
|
200
|
+
const value = await api<CostData>('/admin/api/cost?days=' + days.value);
|
|
201
|
+
if (generation === loadGeneration) data.value = value;
|
|
202
|
+
} catch (e) {
|
|
203
|
+
if (generation === loadGeneration) error.value = (e as Error).message;
|
|
204
|
+
} finally { if (generation === loadGeneration) loading.value = false; }
|
|
194
205
|
}
|
|
195
206
|
function usd(v: number): string {
|
|
196
207
|
const n = Number(v) || 0;
|
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
<p>中枢调用外部模型服务的出站凭证。路由大脑、图片理解、语音转写、文件理解、知识库向量化都只按凭证名引用,API Key 不进入业务配置。</p>
|
|
6
6
|
<p>一条凭证只定义一个主用途:生成/理解,或向量化。若同一个平台 Key 同时用于两类场景,建议建两条凭证,分别设置默认模型。</p>
|
|
7
7
|
</HelpTip>
|
|
8
|
-
<el-button type="primary" style="margin-left: auto" @click="openCreate">新建凭证</el-button></div>
|
|
8
|
+
<el-button v-if="canWrite" type="primary" style="margin-left: auto" @click="openCreate">新建凭证</el-button></div>
|
|
9
9
|
</template>
|
|
10
|
-
<el-
|
|
11
|
-
|
|
10
|
+
<el-alert v-if="listError" :title="listError" type="error" :closable="false" show-icon><el-button link :disabled="listLoading" @click="load">重新读取</el-button></el-alert>
|
|
11
|
+
<ListLocationBar v-model="listQuery" :count="locatedRows.length" :total="list.length" :focus="listFocus" :return-to="listReturnTo" @clear="clearListLocation" />
|
|
12
|
+
<el-empty v-if="!listLoading && !listError && !list.length" description="还没有凭证:llm 路由与知识库都需要先配一把">
|
|
13
|
+
<el-button v-if="canWrite" type="primary" @click="openCreate">添加第一把</el-button>
|
|
12
14
|
</el-empty>
|
|
13
|
-
<el-table v-else :data="
|
|
15
|
+
<el-table v-else v-loading="listLoading" :data="locatedRows" :empty-text="listQuery || listFocus ? '没有匹配的对象,请调整或清除筛选' : '暂无数据'">
|
|
14
16
|
<el-table-column label="凭证" min-width="240" show-overflow-tooltip>
|
|
15
17
|
<template #default="{ row }">
|
|
16
18
|
<div class="cred-main">
|
|
@@ -38,9 +40,9 @@
|
|
|
38
40
|
<el-table-column label="最近使用" width="140"><template #default="{ row }"><span class="muted">{{ lastUsedLabel(row.last_used_at) }}</span></template></el-table-column>
|
|
39
41
|
<el-table-column width="160" align="right">
|
|
40
42
|
<template #default="{ row }">
|
|
41
|
-
<el-button link type="primary" @click="openVerify(row)">验证</el-button>
|
|
42
|
-
<el-button link type="primary" @click="openEdit(row)">编辑</el-button>
|
|
43
|
-
<el-popconfirm title="删除该凭证?引用它的路由/知识库会立即失效。" width="250" @confirm="del(row.name)">
|
|
43
|
+
<el-button link type="primary" v-if="canWrite" @click="openVerify(row)">验证</el-button>
|
|
44
|
+
<el-button v-if="canWrite" link type="primary" @click="openEdit(row)">编辑</el-button>
|
|
45
|
+
<el-popconfirm v-if="canWrite" title="删除该凭证?引用它的路由/知识库会立即失效。" width="250" @confirm="del(row.name)">
|
|
44
46
|
<template #reference><el-button link type="danger">删</el-button></template>
|
|
45
47
|
</el-popconfirm>
|
|
46
48
|
</template>
|
|
@@ -48,25 +50,27 @@
|
|
|
48
50
|
</el-table>
|
|
49
51
|
</el-card>
|
|
50
52
|
|
|
51
|
-
<el-drawer v-model="open" :title="editing ? '编辑凭证' : '新建凭证'" size="480px">
|
|
52
|
-
<el-
|
|
53
|
+
<el-drawer v-model="open" :title="editing ? '编辑凭证' : '新建凭证'" size="480px" :before-close="formGuard.beforeClose">
|
|
54
|
+
<el-alert v-if="saveError" :title="saveError" type="error" :closable="false" show-icon />
|
|
55
|
+
<el-form name="model-credential-settings" autocomplete="off" label-position="top" :disabled="saving || !canWrite">
|
|
53
56
|
<el-tabs v-model="credFormTab" class="console-tabs">
|
|
54
57
|
<el-tab-pane label="基础" name="basic">
|
|
55
58
|
<el-form-item>
|
|
56
59
|
<template #label>{{ fieldTitle('name', '名称') }} <span v-if="fieldRequired('name')" class="field-required">*</span> <HelpTip :title="fieldTitle('name', '名称')">
|
|
57
60
|
<p>{{ fieldDesc('name', '凭证稳定标识,路由和知识库按该名称引用。') }}</p>
|
|
58
61
|
</HelpTip></template>
|
|
59
|
-
<el-input v-model="form.name" :disabled="editing" placeholder="如 dashscope-main / openrouter-prod" class="mono" />
|
|
62
|
+
<el-input v-model="form.name" name="model-credential-name" autocomplete="off" :disabled="editing" placeholder="如 dashscope-main / openrouter-prod" class="mono" />
|
|
60
63
|
</el-form-item>
|
|
61
64
|
<el-form-item>
|
|
62
|
-
<template #label>平台 <span class="field-required">*</span
|
|
63
|
-
|
|
65
|
+
<template #label>平台 <span class="field-required">*</span> <HelpTip title="模型平台">
|
|
66
|
+
<p>选择平台后自动填入 Base URL,并提供常用模型建议;自定义平台可手动填写。</p>
|
|
67
|
+
<p v-if="curProvider?.note">{{ curProvider.note }}</p>
|
|
68
|
+
<p v-if="curProvider?.keyUrl">获取 API Key:{{ curProvider.keyUrl }}</p>
|
|
69
|
+
</HelpTip></template>
|
|
70
|
+
<el-select v-model="form.platform" filterable style="width: 100%" placeholder="选择平台" @change="onPlatform">
|
|
64
71
|
<el-option v-for="p in providers" :key="p.id" :value="p.id" :label="p.label" />
|
|
65
72
|
<el-option :value="CUSTOM" label="自定义(手填 Base URL 与模型)" />
|
|
66
73
|
</el-select>
|
|
67
|
-
<div v-if="curProvider && (curProvider.note || curProvider.keyUrl)" class="muted hint">
|
|
68
|
-
<span v-if="curProvider.note">{{ curProvider.note }}</span><span v-if="curProvider.keyUrl"> 取 Key:{{ curProvider.keyUrl }}</span>
|
|
69
|
-
</div>
|
|
70
74
|
</el-form-item>
|
|
71
75
|
<el-form-item>
|
|
72
76
|
<template #label>{{ fieldTitle('kind', '用途') }} <HelpTip title="用途怎么选">
|
|
@@ -75,12 +79,12 @@
|
|
|
75
79
|
<p>• <b>生成/理解类</b>:文本对话、图片理解、语音转写/音频理解、文件/长文档理解,属于让模型“理解输入并生成结果”的通道;</p>
|
|
76
80
|
<p>• <b>向量化</b>:知识库与工具语义检索使用的 embedding,走 <code>/embeddings</code>,是另一条通道。</p>
|
|
77
81
|
<p>如果同一个 API Key 两边都要用,建两条凭证即可,例如 <code>dashscope-main</code> 和 <code>dashscope-embedding</code>,Base URL 与 API Key 可以相同,但默认模型和引用位置分开。</p>
|
|
82
|
+
<p v-if="capHint">{{ capHint }}</p>
|
|
78
83
|
</HelpTip></template>
|
|
79
|
-
<el-radio-group v-model="credKind" class="kind-radios">
|
|
80
|
-
<el-radio value="chat"
|
|
81
|
-
<el-radio value="embedding"
|
|
84
|
+
<el-radio-group v-model="credKind" class="kind-radios" @change="form.default_model = ''">
|
|
85
|
+
<el-radio value="chat">生成/理解类</el-radio>
|
|
86
|
+
<el-radio value="embedding">向量化</el-radio>
|
|
82
87
|
</el-radio-group>
|
|
83
|
-
<div v-if="capHint" class="muted hint">{{ capHint }}</div>
|
|
84
88
|
</el-form-item>
|
|
85
89
|
</el-tab-pane>
|
|
86
90
|
<el-tab-pane label="连接与模型" name="connection">
|
|
@@ -89,20 +93,21 @@
|
|
|
89
93
|
<p>{{ fieldDesc('base_url', '模型服务的 OpenAI 兼容接口前缀。') }}</p>
|
|
90
94
|
<p>选平台会自动填入默认值;多地域或代理网关可按需修改。</p>
|
|
91
95
|
</HelpTip></template>
|
|
92
|
-
<el-input v-model="form.base_url" placeholder="https://…/v1" class="mono" />
|
|
96
|
+
<el-input v-model="form.base_url" name="model-service-base-url" type="url" autocomplete="off" placeholder="https://…/v1" class="mono" />
|
|
93
97
|
</el-form-item>
|
|
94
98
|
<el-form-item>
|
|
95
99
|
<template #label>{{ fieldTitle('api_key', 'API Key') }} <span v-if="fieldRequired('api_key')" class="field-required">*</span> <HelpTip :title="fieldTitle('api_key', 'API Key')">
|
|
96
100
|
<p>{{ fieldDesc('api_key', '中枢出站调用模型服务时使用的密钥。') }}</p>
|
|
97
101
|
<p>编辑时留空表示保留原值;保存后列表只显示掩码。</p>
|
|
98
102
|
</HelpTip></template>
|
|
99
|
-
<el-input v-model="form.api_key" type="password" show-password autocomplete="
|
|
103
|
+
<el-input v-model="form.api_key" name="model-service-api-key" type="password" show-password autocomplete="new-password" />
|
|
100
104
|
</el-form-item>
|
|
101
105
|
<el-form-item>
|
|
102
106
|
<template #label>{{ fieldTitle('default_model', '默认模型') }} <HelpTip :title="fieldTitle('default_model', '默认模型')">
|
|
103
107
|
<p>{{ fieldDesc('default_model', '路由或知识库未显式指定模型时使用的默认模型。') }}</p>
|
|
104
108
|
<p>生成/理解凭证建议填一个常用文本模型,向量化凭证必须填 embedding 模型。</p>
|
|
105
109
|
<p>视觉、语音、文件等专项模型可在「触发路由」里按场景单独覆盖;这里的默认模型只是兜底。</p>
|
|
110
|
+
<p v-if="curProvider?.freeModel">该平台模型较多,部分模型可能需要接入点 ID;列表只提供常用建议,也可直接手填。</p>
|
|
106
111
|
</HelpTip></template>
|
|
107
112
|
<el-select v-model="form.default_model" filterable allow-create default-first-option clearable style="width: 100%"
|
|
108
113
|
:placeholder="modelGroups.length ? '选一个,或手填模型名' : '手填模型名'">
|
|
@@ -110,7 +115,6 @@
|
|
|
110
115
|
<el-option v-for="mname in g.models" :key="mname" :value="mname" :label="g.tag ? mname + ' · ' + g.tag : mname" />
|
|
111
116
|
</el-option-group>
|
|
112
117
|
</el-select>
|
|
113
|
-
<div v-if="curProvider?.freeModel" class="muted hint">该平台模型很多/可能需接入点 ID,列表只是常用建议,可直接手填</div>
|
|
114
118
|
<el-alert v-if="modelIdHasWhitespace(form.default_model)" type="warning" :closable="false" show-icon class="model-id-alert"
|
|
115
119
|
title="模型 ID 含空白字符,可能填入了展示名称;请优先从平台文档或 /models 复制精确 ID。" />
|
|
116
120
|
</el-form-item>
|
|
@@ -126,8 +130,9 @@
|
|
|
126
130
|
</el-tabs>
|
|
127
131
|
</el-form>
|
|
128
132
|
<template #footer>
|
|
129
|
-
<
|
|
130
|
-
<el-button
|
|
133
|
+
<span v-if="formGuard.dirty.value" class="muted" style="margin-right:12px">有未保存修改</span>
|
|
134
|
+
<el-button :disabled="saving" @click="closeForm">取消</el-button>
|
|
135
|
+
<el-button type="primary" :loading="saving" :disabled="!canWrite" @click="save">保存</el-button>
|
|
131
136
|
</template>
|
|
132
137
|
</el-drawer>
|
|
133
138
|
|
|
@@ -174,20 +179,29 @@
|
|
|
174
179
|
</template>
|
|
175
180
|
|
|
176
181
|
<script setup lang="ts">
|
|
177
|
-
import
|
|
182
|
+
import ListLocationBar from '../components/ListLocationBar.vue';
|
|
183
|
+
import { useListLocation } from '../use-list-location';
|
|
184
|
+
import { computed, onMounted, reactive, ref } from 'vue';
|
|
178
185
|
import { ElMessage } from 'element-plus/es/components/message/index';
|
|
179
186
|
import { ElMessageBox } from 'element-plus/es/components/message-box/index';
|
|
180
187
|
import { api } from '../request';
|
|
181
188
|
import { fmtTime } from '../util';
|
|
182
189
|
import { LLM_PROVIDERS, CUSTOM_PROVIDER, detectProvider } from '../llm-catalog';
|
|
183
190
|
import HelpTip from '../components/HelpTip.vue';
|
|
191
|
+
import { useUnsavedForm } from '../use-unsaved-form';
|
|
192
|
+
import { useMe } from '../store';
|
|
184
193
|
import { schemaDescription, schemaRequired, schemaTitle, useConfigSchema } from '../schema';
|
|
185
194
|
|
|
186
195
|
const KIND: Record<string, string> = { both: '复合凭证', chat: '生成/理解', embedding: '向量化' };
|
|
187
196
|
const CUSTOM = CUSTOM_PROVIDER;
|
|
188
197
|
const providers = LLM_PROVIDERS;
|
|
189
198
|
const credentialSchema = useConfigSchema('credential');
|
|
199
|
+
const me = useMe();
|
|
200
|
+
const canWrite = computed(() => me.can('credentials:write'));
|
|
201
|
+
const saveError = ref('');
|
|
190
202
|
const list = ref<any[]>([]);
|
|
203
|
+
const listLoading = ref(false), listError = ref('');
|
|
204
|
+
const { keyword: listQuery, focus: listFocus, rows: locatedRows, returnTo: listReturnTo, clear: clearListLocation } = useListLocation(list, { id: r => String(r.name), text: r => `${r.name} ${r.kind || ""}` });
|
|
191
205
|
const open = ref(false);
|
|
192
206
|
const editing = ref(false);
|
|
193
207
|
const saving = ref(false);
|
|
@@ -197,6 +211,9 @@ const verifyResult = ref<any | null>(null);
|
|
|
197
211
|
const credFormTab = ref<'basic' | 'connection' | 'publish'>('basic');
|
|
198
212
|
const blank = { name: '', platform: 'dashscope', base_url: '', api_key: '', default_model: '', description: '' };
|
|
199
213
|
const form = reactive({ ...blank });
|
|
214
|
+
const formGuard = useUnsavedForm({ active: () => open.value, saving: () => saving.value, snapshot: () => ({ form, kind: credKind.value }), name: '模型凭证配置' });
|
|
215
|
+
async function closeForm(): Promise<void> { if (await formGuard.confirmLeave()) open.value = false; }
|
|
216
|
+
|
|
200
217
|
const verifyForm = reactive({
|
|
201
218
|
name: '',
|
|
202
219
|
base_url: '',
|
|
@@ -285,11 +302,19 @@ function onPlatform(): void {
|
|
|
285
302
|
form.default_model = ''; // 平台变了模型清空,避免串台
|
|
286
303
|
applyPlatformCaps();
|
|
287
304
|
}
|
|
288
|
-
watch(credKind, () => { form.default_model = ''; });
|
|
289
305
|
|
|
290
|
-
async function load(): Promise<void> {
|
|
291
|
-
|
|
292
|
-
|
|
306
|
+
async function load(): Promise<void> {
|
|
307
|
+
if (listLoading.value) return;
|
|
308
|
+
listLoading.value = true;
|
|
309
|
+
try {
|
|
310
|
+
list.value = await api('/admin/api/credentials');
|
|
311
|
+
listError.value = '';
|
|
312
|
+
} catch { listError.value = list.value.length ? '模型凭证列表刷新失败,当前保留旧快照。' : '模型凭证列表读取失败,请重试。'; }
|
|
313
|
+
finally { listLoading.value = false; }
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function openCreate(): void { if (!canWrite.value || saving.value || open.value) return; editing.value = false; credFormTab.value = 'basic'; Object.assign(form, { ...blank }); onPlatform(); saveError.value = ''; formGuard.begin(); open.value = true; }
|
|
317
|
+
function openEdit(row: any): void { if (!canWrite.value || saving.value || open.value || listError.value) return;
|
|
293
318
|
editing.value = true;
|
|
294
319
|
credFormTab.value = 'basic';
|
|
295
320
|
Object.assign(form, {
|
|
@@ -297,13 +322,14 @@ function openEdit(row: any): void {
|
|
|
297
322
|
base_url: row.base_url, api_key: '', default_model: row.default_model || '', description: row.description || '',
|
|
298
323
|
});
|
|
299
324
|
credKind.value = row.kind === 'embedding' || (row.kind === 'both' && looksEmbeddingModel(row.default_model || '')) ? 'embedding' : 'chat';
|
|
300
|
-
open.value = true;
|
|
325
|
+
saveError.value = ''; formGuard.begin(); open.value = true;
|
|
301
326
|
}
|
|
302
327
|
function defaultVerifyModel(): string {
|
|
303
328
|
const firstGroup = verifyModelGroups.value[0];
|
|
304
329
|
return verifyForm.default_model || firstGroup?.models?.[0] || '';
|
|
305
330
|
}
|
|
306
331
|
function openVerify(row: any): void {
|
|
332
|
+
if (!canWrite.value || verifying.value) return;
|
|
307
333
|
Object.assign(verifyForm, {
|
|
308
334
|
name: row.name,
|
|
309
335
|
base_url: row.base_url || '',
|
|
@@ -322,6 +348,7 @@ function onVerifyCapabilityChange(): void {
|
|
|
322
348
|
verifyForm.model = defaultVerifyModel();
|
|
323
349
|
}
|
|
324
350
|
async function runVerify(): Promise<void> {
|
|
351
|
+
if (!canWrite.value || verifying.value) return;
|
|
325
352
|
if (!verifyForm.model.trim()) { ElMessage.error('请先填写要验证的模型名'); return; }
|
|
326
353
|
verifying.value = true;
|
|
327
354
|
verifyResult.value = null;
|
|
@@ -339,6 +366,8 @@ async function runVerify(): Promise<void> {
|
|
|
339
366
|
}
|
|
340
367
|
}
|
|
341
368
|
async function save(): Promise<void> {
|
|
369
|
+
if (!canWrite.value || saving.value) return;
|
|
370
|
+
saveError.value = '';
|
|
342
371
|
const kind = credKind.value;
|
|
343
372
|
if (modelIdHasWhitespace(form.default_model)) {
|
|
344
373
|
try {
|
|
@@ -351,16 +380,18 @@ async function save(): Promise<void> {
|
|
|
351
380
|
return;
|
|
352
381
|
}
|
|
353
382
|
}
|
|
383
|
+
if (!canWrite.value || saving.value || !open.value) return;
|
|
354
384
|
saving.value = true;
|
|
355
385
|
try {
|
|
356
386
|
// platform 仅 UI 辅助,不入库;存的还是 name/kind/base_url/api_key/default_model/description
|
|
357
387
|
const body = { name: form.name, kind, base_url: form.base_url, api_key: form.api_key, default_model: form.default_model, description: form.description };
|
|
358
388
|
await api('/admin/api/credentials', { method: 'POST', body: JSON.stringify(body) });
|
|
359
|
-
ElMessage.success('已保存(key 不再回显完整值)'); open.value = false; await load();
|
|
360
|
-
} catch (e) {
|
|
389
|
+
ElMessage.success('已保存(key 不再回显完整值)'); formGuard.markSaved(); open.value = false; await load();
|
|
390
|
+
} catch (e) { saveError.value = `未能确认保存成功:${(e as Error).message}。输入已保留,请核对后重试。`; }
|
|
361
391
|
finally { saving.value = false; }
|
|
362
392
|
}
|
|
363
393
|
async function del(name: string): Promise<void> {
|
|
394
|
+
if (!canWrite.value) return;
|
|
364
395
|
try { await api('/admin/api/credentials/' + encodeURIComponent(name), { method: 'DELETE' }); await load(); }
|
|
365
396
|
catch (e) { ElMessage.error((e as Error).message); }
|
|
366
397
|
}
|
|
@@ -13,13 +13,18 @@
|
|
|
13
13
|
</div>
|
|
14
14
|
</template>
|
|
15
15
|
|
|
16
|
+
<el-alert v-if="smokeError" type="error" :closable="false" show-icon title="Smoke 结果获取失败"
|
|
17
|
+
:description="smokeError" style="margin-bottom: 12px" />
|
|
16
18
|
<el-tabs v-model="tab">
|
|
17
19
|
<el-tab-pane label="配置体检" name="diagnostics">
|
|
20
|
+
<el-alert v-if="loadError" type="error" :closable="false" show-icon title="体检读取失败"
|
|
21
|
+
:description="loadError + (loadedAt ? `;以下为 ${fmtTime(loadedAt, true)} 的旧快照` : '')" style="margin-bottom: 12px" />
|
|
22
|
+
<div v-else-if="loadedAt" class="field-hint">最近检查:{{ fmtTime(loadedAt, true) }}</div>
|
|
18
23
|
<div class="summary">
|
|
19
|
-
<div><span class="muted">状态</span><b :class="{ bad: diag && !diag.ok }">{{ diag
|
|
20
|
-
<div><span class="muted">错误</span><b>{{ diag?.errors ??
|
|
21
|
-
<div><span class="muted">提醒</span><b>{{ diag?.warnings ??
|
|
22
|
-
<div><span class="muted">问题对象</span><b>{{ grouped.length }}</b></div>
|
|
24
|
+
<div><span class="muted">状态</span><b :class="{ bad: diag && !diag.ok }">{{ loadError ? (diag ? '旧快照' : '读取失败') : !diag ? '正在读取' : diag.ok ? '通过' : '存在问题' }}</b></div>
|
|
25
|
+
<div><span class="muted">错误</span><b>{{ diag?.errors ?? '—' }}</b></div>
|
|
26
|
+
<div><span class="muted">提醒</span><b>{{ diag?.warnings ?? '—' }}</b></div>
|
|
27
|
+
<div><span class="muted">问题对象</span><b>{{ diag ? grouped.length : '—' }}</b></div>
|
|
23
28
|
</div>
|
|
24
29
|
<div class="checkGrid">
|
|
25
30
|
<div v-for="c in checkCards" :key="c.key" class="checkCard" :class="c.status">
|
|
@@ -36,7 +41,7 @@
|
|
|
36
41
|
<b>Smoke 结果</b>
|
|
37
42
|
<span class="muted mono">{{ smoke.hub }}</span>
|
|
38
43
|
<el-tag size="small" effect="plain" :type="smoke.fail ? 'danger' : 'success'">通过 {{ smoke.pass }} / 跳过 {{ smoke.skip }} / 失败 {{ smoke.fail }}</el-tag>
|
|
39
|
-
<el-button v-if="smoke.run?.job_id" link type="primary" size="small" @click="router.push(
|
|
44
|
+
<el-button v-if="smoke.run?.job_id" link type="primary" size="small" @click="router.push(smokeDestination(smoke.run.job_id))">查看 smoke 任务</el-button>
|
|
40
45
|
</div>
|
|
41
46
|
<el-table :data="smoke.checks" size="small">
|
|
42
47
|
<el-table-column label="状态" width="80" align="center">
|
|
@@ -50,7 +55,7 @@
|
|
|
50
55
|
<el-segmented v-model="severity" :options="severityOptions" size="small" />
|
|
51
56
|
<el-input v-model="keyword" size="default" clearable placeholder="搜索对象 / 问题" class="search" />
|
|
52
57
|
</div>
|
|
53
|
-
<el-empty v-if="!loading && !filtered.length" description="
|
|
58
|
+
<el-empty v-if="!loading && !loadError && diag && !filtered.length" :description="diag.diagnostics.length ? '当前筛选下没有匹配的问题' : '体检完成,未发现问题'" />
|
|
54
59
|
<div v-else v-loading="loading" class="groups">
|
|
55
60
|
<section v-for="g in grouped" :key="g.area" class="group">
|
|
56
61
|
<div class="groupHead">
|
|
@@ -67,7 +72,7 @@
|
|
|
67
72
|
</el-table-column>
|
|
68
73
|
<el-table-column prop="message" label="问题" min-width="360" show-overflow-tooltip />
|
|
69
74
|
<el-table-column label="定位" width="90" align="right">
|
|
70
|
-
<template #default="{ row }"><el-button link type="primary" @click="goto(row)">打开</el-button></template>
|
|
75
|
+
<template #default="{ row }"><el-button v-if="destination(row)" link type="primary" @click="goto(row)">打开</el-button><span v-else class="muted">—</span></template>
|
|
71
76
|
</el-table-column>
|
|
72
77
|
</el-table>
|
|
73
78
|
</section>
|
|
@@ -75,12 +80,14 @@
|
|
|
75
80
|
</el-tab-pane>
|
|
76
81
|
|
|
77
82
|
<el-tab-pane label="route=auto 预演" name="auto">
|
|
83
|
+
<el-alert v-if="clientsError" type="error" :closable="false" show-icon title="接入方列表读取失败"
|
|
84
|
+
:description="clientsError + ';请刷新重试后再选择接入方预演'" style="margin-bottom: 12px" />
|
|
78
85
|
<div class="previewForm">
|
|
79
86
|
<el-form label-position="top" @submit.prevent>
|
|
80
87
|
<el-row :gutter="12">
|
|
81
88
|
<el-col :span="8">
|
|
82
89
|
<el-form-item label="接入方">
|
|
83
|
-
<el-select v-model="preview.client_app_id" clearable filterable size="default" placeholder="不选则按 admin 预演">
|
|
90
|
+
<el-select :disabled="!!clientsError" v-model="preview.client_app_id" clearable filterable size="default" placeholder="不选则按 admin 预演">
|
|
84
91
|
<el-option v-for="c in clients" :key="c.app_id" :label="`${c.name} (${c.app_id})`" :value="c.app_id" />
|
|
85
92
|
</el-select>
|
|
86
93
|
</el-form-item>
|
|
@@ -123,6 +130,8 @@
|
|
|
123
130
|
</el-form>
|
|
124
131
|
</div>
|
|
125
132
|
|
|
133
|
+
<el-alert v-if="previewError" type="error" :closable="false" show-icon title="预演未完成"
|
|
134
|
+
:description="previewError" style="margin-bottom: 12px" />
|
|
126
135
|
<div v-if="previewResult" class="previewResult">
|
|
127
136
|
<div class="resultHead">
|
|
128
137
|
<el-tag :type="previewResult.ok ? 'success' : 'warning'" effect="plain">{{ previewResult.ok ? '可命中' : '未选中' }}</el-tag>
|
|
@@ -159,16 +168,19 @@
|
|
|
159
168
|
</template>
|
|
160
169
|
|
|
161
170
|
<script setup lang="ts">
|
|
162
|
-
import { computed, onMounted, reactive, ref } from 'vue';
|
|
163
|
-
import { useRouter } from 'vue-router';
|
|
171
|
+
import { computed, onMounted, reactive, ref, watch } from 'vue';
|
|
172
|
+
import { useRoute, useRouter, type RouteLocationRaw } from 'vue-router';
|
|
164
173
|
import { ElMessage } from 'element-plus/es/components/message/index';
|
|
165
174
|
import { api } from '../request';
|
|
175
|
+
import { fmtTime } from '../util';
|
|
166
176
|
import HelpTip from '../components/HelpTip.vue';
|
|
177
|
+
import { diagnosticDestination } from '../console-location';
|
|
178
|
+
import { patchTaskQuery, queryText } from '../task-page-location';
|
|
167
179
|
|
|
168
180
|
interface ConfigDiagnostic { severity: 'error' | 'warning'; area: string; id: string; message: string }
|
|
169
181
|
interface ConfigDiagnosticsReport { ok: boolean; errors: number; warnings: number; diagnostics: ConfigDiagnostic[] }
|
|
170
182
|
interface ClientRow { app_id: string; name: string }
|
|
171
|
-
type CheckStatus = 'pass' | 'fail' | 'warn' | 'skip' | 'idle';
|
|
183
|
+
type CheckStatus = 'pass' | 'fail' | 'warn' | 'skip' | 'idle' | 'running' | 'error';
|
|
172
184
|
interface SmokeCheck { name: string; status: 'pass' | 'fail' | 'skip'; detail?: string }
|
|
173
185
|
interface SmokeReport {
|
|
174
186
|
hub: string;
|
|
@@ -180,14 +192,40 @@ interface SmokeReport {
|
|
|
180
192
|
}
|
|
181
193
|
|
|
182
194
|
const router = useRouter();
|
|
183
|
-
const
|
|
195
|
+
const route = useRoute();
|
|
196
|
+
function readTab(value: unknown): 'diagnostics' | 'auto' { return value === 'auto' ? 'auto' : 'diagnostics'; }
|
|
197
|
+
function readSeverity(value: unknown): 'all' | 'error' | 'warning' { return value === 'error' || value === 'warning' ? value : 'all'; }
|
|
198
|
+
const tab = ref(readTab(route.query.tab));
|
|
184
199
|
const loading = ref(false);
|
|
185
200
|
const diag = ref<ConfigDiagnosticsReport | null>(null);
|
|
201
|
+
const loadedAt = ref('');
|
|
202
|
+
const loadError = ref('');
|
|
203
|
+
const clientsError = ref('');
|
|
186
204
|
const clients = ref<ClientRow[]>([]);
|
|
187
205
|
const smoke = ref<SmokeReport | null>(null);
|
|
188
206
|
const smokeLoading = ref(false);
|
|
189
|
-
const
|
|
190
|
-
const
|
|
207
|
+
const smokeError = ref('');
|
|
208
|
+
const severity = ref(readSeverity(route.query.severity));
|
|
209
|
+
const keyword = ref(queryText(route.query.q));
|
|
210
|
+
let applyingLocation = false;
|
|
211
|
+
watch(() => route.query, (query) => {
|
|
212
|
+
if (route.path !== '/diagnostics') return;
|
|
213
|
+
applyingLocation = true;
|
|
214
|
+
tab.value = readTab(query.tab);
|
|
215
|
+
severity.value = readSeverity(query.severity);
|
|
216
|
+
keyword.value = queryText(query.q);
|
|
217
|
+
applyingLocation = false;
|
|
218
|
+
}, { flush: 'sync' });
|
|
219
|
+
watch([tab, severity, keyword], () => {
|
|
220
|
+
if (applyingLocation || route.path !== '/diagnostics') return;
|
|
221
|
+
const query = patchTaskQuery(route.query, {
|
|
222
|
+
tab: tab.value === 'diagnostics' ? undefined : tab.value,
|
|
223
|
+
severity: severity.value === 'all' ? undefined : severity.value,
|
|
224
|
+
q: keyword.value || undefined,
|
|
225
|
+
});
|
|
226
|
+
const location = { path: route.path, query, hash: route.hash };
|
|
227
|
+
if (router.resolve(location).fullPath !== route.fullPath) void router.replace(location);
|
|
228
|
+
}, { flush: 'sync', immediate: true });
|
|
191
229
|
const severityOptions = [
|
|
192
230
|
{ label: '全部', value: 'all' },
|
|
193
231
|
{ label: '错误', value: 'error' },
|
|
@@ -204,6 +242,7 @@ const preview = reactive({
|
|
|
204
242
|
});
|
|
205
243
|
const previewLoading = ref(false);
|
|
206
244
|
const previewResult = ref<any | null>(null);
|
|
245
|
+
const previewError = ref('');
|
|
207
246
|
|
|
208
247
|
const filtered = computed(() => {
|
|
209
248
|
const q = keyword.value.trim().toLowerCase();
|
|
@@ -226,7 +265,7 @@ const grouped = computed(() => {
|
|
|
226
265
|
const checkCards = computed(() => {
|
|
227
266
|
const diags = diag.value?.diagnostics ?? [];
|
|
228
267
|
const runtimeIssues = diags.filter((d) => d.area.startsWith('runtime_'));
|
|
229
|
-
const configErrors = diags.filter((d) => d.severity === 'error' && !d.area.startsWith('runtime_'))
|
|
268
|
+
const configErrors = diags.filter((d) => d.severity === 'error' && !d.area.startsWith('runtime_'));
|
|
230
269
|
const autoIssues = diags.filter((d) => d.area === 'route_auto');
|
|
231
270
|
const dlqIssues = diags.filter((d) => d.area === 'runtime_delivery');
|
|
232
271
|
const smokeRun = smoke.value?.checks.find((c) => c.name.includes('/run + trace') || c.name.includes('/run 建单'));
|
|
@@ -235,46 +274,46 @@ const checkCards = computed(() => {
|
|
|
235
274
|
{
|
|
236
275
|
key: 'config',
|
|
237
276
|
title: '配置结构',
|
|
238
|
-
status: !diag.value ? 'idle' : configErrors ? 'fail' : 'pass',
|
|
239
|
-
detail: !diag.value ? '等待体检数据' : configErrors ? `${configErrors} 个配置错误需要先修复` : '路由、目标、接入方、工具源等结构可用',
|
|
240
|
-
to: configErrors
|
|
277
|
+
status: !diag.value ? 'idle' : configErrors.length ? 'fail' : 'pass',
|
|
278
|
+
detail: !diag.value ? '等待体检数据' : configErrors.length ? `${configErrors.length} 个配置错误需要先修复` : '路由、目标、接入方、工具源等结构可用',
|
|
279
|
+
to: firstDestination(configErrors),
|
|
241
280
|
},
|
|
242
281
|
{
|
|
243
282
|
key: 'runtime',
|
|
244
283
|
title: '运行期调度',
|
|
245
284
|
status: runtimeIssues.some((d) => d.severity === 'error') ? 'fail' : runtimeIssues.length ? 'warn' : diag.value ? 'pass' : 'idle',
|
|
246
|
-
detail: runtimeIssues.length ? `${runtimeIssues.length} 个队列、执行器或送达运行期风险` : '队列、租约、执行器覆盖和送达队列未发现异常',
|
|
247
|
-
to: runtimeIssues
|
|
285
|
+
detail: !diag.value ? '等待体检数据' : runtimeIssues.length ? `${runtimeIssues.length} 个队列、执行器或送达运行期风险` : '队列、租约、执行器覆盖和送达队列未发现异常',
|
|
286
|
+
to: firstDestination(runtimeIssues),
|
|
248
287
|
},
|
|
249
288
|
{
|
|
250
289
|
key: 'auto',
|
|
251
290
|
title: 'route=auto',
|
|
252
291
|
status: autoIssues.some((d) => d.severity === 'error') ? 'fail' : autoIssues.length ? 'warn' : diag.value ? 'pass' : 'idle',
|
|
253
|
-
detail: autoIssues.length ? `${autoIssues.length} 个自动分诊规则需要确认` : '自动分诊规则未发现冲突或过宽风险',
|
|
254
|
-
to: autoIssues
|
|
292
|
+
detail: !diag.value ? '等待体检数据' : autoIssues.length ? `${autoIssues.length} 个自动分诊规则需要确认` : '自动分诊规则未发现冲突或过宽风险',
|
|
293
|
+
to: firstDestination(autoIssues),
|
|
255
294
|
},
|
|
256
295
|
{
|
|
257
296
|
key: 'delivery',
|
|
258
297
|
title: '送达死信',
|
|
259
298
|
status: dlqIssues.some((d) => d.severity === 'error') ? 'fail' : dlqIssues.length ? 'warn' : diag.value ? 'pass' : 'idle',
|
|
260
|
-
detail: dlqIssues.length ? '存在未处理送达死信或送达风险' : '未发现未处理送达死信',
|
|
261
|
-
to: dlqIssues
|
|
299
|
+
detail: !diag.value ? '等待体检数据' : dlqIssues.length ? '存在未处理送达死信或送达风险' : '未发现未处理送达死信',
|
|
300
|
+
to: firstDestination(dlqIssues),
|
|
262
301
|
},
|
|
263
302
|
{
|
|
264
303
|
key: 'smoke',
|
|
265
304
|
title: 'E2E Smoke',
|
|
266
|
-
status: !smoke.value ? 'idle' : smokeFailures ? 'fail' : 'pass',
|
|
267
|
-
detail: !smoke.value ? '点击运行 smoke,检查公网入口、后台 API、schema 和 demo 闭环' : `通过 ${smoke.value.pass},跳过 ${smoke.value.skip},失败 ${smoke.value.fail}`,
|
|
268
|
-
to: smoke.value?.run?.job_id ?
|
|
305
|
+
status: smokeLoading.value ? 'running' : smokeError.value ? 'error' : !smoke.value ? 'idle' : smokeFailures ? 'fail' : 'pass',
|
|
306
|
+
detail: smokeLoading.value ? '正在运行本次 smoke' : smokeError.value ? '未取得本次 Smoke 结果,请查看上方错误' : !smoke.value ? '点击运行 smoke,检查公网入口、后台 API、schema 和 demo 闭环' : `通过 ${smoke.value.pass},跳过 ${smoke.value.skip},失败 ${smoke.value.fail}`,
|
|
307
|
+
to: smoke.value?.run?.job_id ? smokeDestination(smoke.value.run.job_id) : undefined,
|
|
269
308
|
},
|
|
270
309
|
{
|
|
271
310
|
key: 'demo',
|
|
272
311
|
title: 'Demo 闭环',
|
|
273
|
-
status: !smoke.value || !smokeRun ? 'idle' : smokeRun.status === 'pass' ? 'pass' : smokeRun.status === 'skip' ? 'skip' : 'fail',
|
|
274
|
-
detail: !smoke.value ? '未运行 smoke' : smoke.value.run?.job_id ? `已创建任务 ${smoke.value.run.job_id}` : '当前环境未检测到 demo route 或 demo token',
|
|
275
|
-
to: smoke.value?.run?.job_id ?
|
|
312
|
+
status: smokeLoading.value ? 'running' : smokeError.value ? 'error' : !smoke.value || !smokeRun ? 'idle' : smokeRun.status === 'pass' ? 'pass' : smokeRun.status === 'skip' ? 'skip' : 'fail',
|
|
313
|
+
detail: smokeLoading.value ? '等待本次 Smoke 检查结果' : smokeError.value ? '未取得本次 Demo 闭环结果' : !smoke.value ? '未运行 smoke' : smoke.value.run?.job_id ? `已创建任务 ${smoke.value.run.job_id}` : '当前环境未检测到 demo route 或 demo token',
|
|
314
|
+
to: smoke.value?.run?.job_id ? smokeDestination(smoke.value.run.job_id) : undefined,
|
|
276
315
|
},
|
|
277
|
-
] as Array<{ key: string; title: string; status: CheckStatus; detail: string; to
|
|
316
|
+
] as Array<{ key: string; title: string; status: CheckStatus; detail: string; to?: RouteLocationRaw }>;
|
|
278
317
|
});
|
|
279
318
|
|
|
280
319
|
function areaLabel(area: string): string {
|
|
@@ -285,6 +324,7 @@ function areaLabel(area: string): string {
|
|
|
285
324
|
target: '调度目标',
|
|
286
325
|
project: '项目目录',
|
|
287
326
|
client: '接入方',
|
|
327
|
+
credential: '模型凭证',
|
|
288
328
|
channel: '入站渠道',
|
|
289
329
|
alert_rule: '告警规则',
|
|
290
330
|
tool_provider: '工具源',
|
|
@@ -300,23 +340,19 @@ function areaLabel(area: string): string {
|
|
|
300
340
|
};
|
|
301
341
|
return labels[area] ?? area;
|
|
302
342
|
}
|
|
303
|
-
function
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
if (area === 'project') return '/projects';
|
|
313
|
-
if (area === 'kb_base') return '/kb';
|
|
314
|
-
if (area === 'runtime_dispatch' || area === 'runtime_executor' || area === 'runtime_jobs') return '/executors';
|
|
315
|
-
if (area === 'runtime_delivery') return '/runs';
|
|
316
|
-
return '/system';
|
|
343
|
+
function destination(row: ConfigDiagnostic): RouteLocationRaw | undefined {
|
|
344
|
+
return diagnosticDestination(row, route.fullPath);
|
|
345
|
+
}
|
|
346
|
+
function firstDestination(rows: ConfigDiagnostic[]): RouteLocationRaw | undefined {
|
|
347
|
+
const first = rows.find((row) => row.severity === 'error') ?? rows[0];
|
|
348
|
+
return first ? destination(first) : undefined;
|
|
349
|
+
}
|
|
350
|
+
function smokeDestination(jobId: string): RouteLocationRaw {
|
|
351
|
+
return { path: '/runs', query: { tab: 'trace', job: jobId, return_to: route.fullPath } };
|
|
317
352
|
}
|
|
318
353
|
function goto(row: ConfigDiagnostic): void {
|
|
319
|
-
|
|
354
|
+
const to = destination(row);
|
|
355
|
+
if (to) void router.push(to);
|
|
320
356
|
}
|
|
321
357
|
function parseMetadata(): Record<string, unknown> {
|
|
322
358
|
const raw = preview.metadataText.trim();
|
|
@@ -326,7 +362,11 @@ function parseMetadata(): Record<string, unknown> {
|
|
|
326
362
|
return parsed as Record<string, unknown>;
|
|
327
363
|
}
|
|
328
364
|
async function runPreview(): Promise<void> {
|
|
329
|
-
if (
|
|
365
|
+
if (previewLoading.value) return;
|
|
366
|
+
previewResult.value = null;
|
|
367
|
+
previewError.value = '';
|
|
368
|
+
if (!preview.input.trim()) { previewError.value = '请输入触发文本'; return; }
|
|
369
|
+
if (clientsError.value && preview.client_app_id) { previewError.value = '请先刷新接入方列表后重试'; return; }
|
|
330
370
|
previewLoading.value = true;
|
|
331
371
|
try {
|
|
332
372
|
const metadata = parseMetadata();
|
|
@@ -347,33 +387,40 @@ async function runPreview(): Promise<void> {
|
|
|
347
387
|
}),
|
|
348
388
|
});
|
|
349
389
|
} catch (e) {
|
|
350
|
-
|
|
390
|
+
previewError.value = e instanceof Error ? e.message : '请求失败,请重试';
|
|
351
391
|
} finally { previewLoading.value = false; }
|
|
352
392
|
}
|
|
353
393
|
async function load(): Promise<void> {
|
|
394
|
+
if (loading.value) return;
|
|
354
395
|
loading.value = true;
|
|
355
396
|
try {
|
|
356
|
-
const [d, c] = await Promise.
|
|
397
|
+
const [d, c] = await Promise.allSettled([
|
|
357
398
|
api<ConfigDiagnosticsReport>('/admin/api/config-diagnostics'),
|
|
358
|
-
api<ClientRow[]>('/admin/api/clients')
|
|
399
|
+
api<ClientRow[]>('/admin/api/clients'),
|
|
359
400
|
]);
|
|
360
|
-
|
|
361
|
-
|
|
401
|
+
if (d.status === 'fulfilled') {
|
|
402
|
+
diag.value = d.value; loadedAt.value = new Date().toISOString(); loadError.value = '';
|
|
403
|
+
} else loadError.value = d.reason instanceof Error ? d.reason.message : '请求失败,请重试';
|
|
404
|
+
if (c.status === 'fulfilled') { clients.value = c.value; clientsError.value = ''; }
|
|
405
|
+
else clientsError.value = c.reason instanceof Error ? c.reason.message : '请求失败,请重试';
|
|
362
406
|
} finally { loading.value = false; }
|
|
363
407
|
}
|
|
364
408
|
async function runSmoke(): Promise<void> {
|
|
409
|
+
if (smokeLoading.value) return;
|
|
410
|
+
smoke.value = null;
|
|
411
|
+
smokeError.value = '';
|
|
365
412
|
smokeLoading.value = true;
|
|
366
413
|
try {
|
|
367
414
|
smoke.value = await api<SmokeReport>('/admin/api/smoke', { method: 'POST', body: '{}' });
|
|
368
415
|
if (smoke.value.fail) ElMessage.warning(`Smoke 完成:${smoke.value.fail} 项失败`);
|
|
369
416
|
else ElMessage.success('Smoke 通过');
|
|
370
417
|
} catch (e) {
|
|
371
|
-
|
|
418
|
+
smokeError.value = e instanceof Error ? e.message : '请求失败,请重试';
|
|
372
419
|
} finally { smokeLoading.value = false; }
|
|
373
420
|
}
|
|
374
421
|
function statusTag(s: CheckStatus): 'success' | 'danger' | 'info' | 'warning' {
|
|
375
422
|
if (s === 'pass') return 'success';
|
|
376
|
-
if (s === 'fail') return 'danger';
|
|
423
|
+
if (s === 'fail' || s === 'error') return 'danger';
|
|
377
424
|
if (s === 'warn') return 'warning';
|
|
378
425
|
return 'info';
|
|
379
426
|
}
|
|
@@ -382,6 +429,8 @@ function statusLabel(s: CheckStatus): string {
|
|
|
382
429
|
if (s === 'fail') return '失败';
|
|
383
430
|
if (s === 'warn') return '提醒';
|
|
384
431
|
if (s === 'skip') return '跳过';
|
|
432
|
+
if (s === 'running') return '检查中';
|
|
433
|
+
if (s === 'error') return '未取得结果';
|
|
385
434
|
return '未运行';
|
|
386
435
|
}
|
|
387
436
|
function smokeTag(s: SmokeCheck['status']): 'success' | 'danger' | 'info' {
|