bailinghub 0.10.0 → 0.11.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/CONTRIBUTING.md +20 -0
- package/README.en.md +6 -6
- package/README.md +6 -6
- package/SECURITY.md +20 -0
- package/THIRD_PARTY_NOTICES.md +2 -2
- package/docker-compose.images.yml +2 -2
- package/docs/AGENT_CONVERSATION_AUDIT.en.md +8 -2
- package/docs/AGENT_CONVERSATION_AUDIT.md +8 -1
- package/docs/CHANGELOG.en.md +29 -1
- package/docs/CHANGELOG.md +29 -1
- package/docs/IMPLEMENTATION_STATUS.en.md +12 -3
- package/docs/IMPLEMENTATION_STATUS.md +12 -3
- package/docs/INDEPENDENT_VALIDATION.en.md +4 -4
- package/docs/INDEPENDENT_VALIDATION.md +4 -4
- package/docs/MODEL_CONTINUATION.en.md +8 -0
- package/docs/MODEL_CONTINUATION.md +8 -0
- package/docs/MODEL_OUTPUT_BUDGET.en.md +1 -0
- package/docs/MODEL_OUTPUT_BUDGET.md +1 -0
- package/docs/README.en.md +6 -0
- package/docs/README.md +6 -0
- package/docs/RELEASE_NOTES_v0.10.1.en.md +41 -0
- package/docs/RELEASE_NOTES_v0.10.1.md +41 -0
- package/docs/RELEASE_NOTES_v0.11.0.en.md +19 -0
- package/docs/RELEASE_NOTES_v0.11.0.md +19 -0
- package/docs/RELEASE_NOTES_v0.11.1.en.md +25 -0
- package/docs/RELEASE_NOTES_v0.11.1.md +25 -0
- package/docs/UPGRADE_v0.10.1.en.md +66 -0
- package/docs/UPGRADE_v0.10.1.md +66 -0
- package/docs/UPGRADE_v0.11.0.en.md +24 -0
- package/docs/UPGRADE_v0.11.0.md +24 -0
- package/docs/UPGRADE_v0.11.1.en.md +28 -0
- package/docs/UPGRADE_v0.11.1.md +28 -0
- package/docs/security/GRC_EVIDENCE.md +54 -0
- package/docs/user-guide/console-map.md +2 -2
- package/package.json +5 -3
- 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/copy-acr-platform-image.sh +42 -0
- package/scripts/e2e-console-runtime-audit.mjs +7 -0
- package/scripts/e2e-console-troubleshooting-extra.mjs +4 -4
- package/scripts/e2e-console.mjs +90 -23
- package/scripts/install.sh +1 -1
- package/scripts/notification-console-test.mjs +2 -1
- package/scripts/publish-images.sh +1 -1
- package/scripts/release-audit.mjs +13 -1
- package/scripts/restore-ghcr-version.sh +48 -0
- package/scripts/sdk-declaration-contract-test.ts +34 -0
- package/scripts/sdk-p1-check.mjs +62 -26
- package/scripts/test-acr-platform-copy.sh +152 -0
- package/scripts/verify-github-repo.mjs +12 -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/core/config/console-task-location.test.ts +12 -24
- package/src/core/contracts/explicit-capability-values.test.ts +62 -0
- package/src/core/contracts/openapi-tools.ts +2 -2
- package/src/core/contracts/tool-annotations.ts +4 -4
- package/src/core/runtime/credential-resolver.ts +3 -3
- package/src/infrastructure/config/config-agent-conversation-audit-repository.test.ts +29 -0
- package/src/infrastructure/config/config-agent-conversation-audit-repository.ts +142 -9
- package/src/infrastructure/config/config-conversation-feed.integration.test.ts +134 -0
- package/src/infrastructure/config/config-conversation-ledger.test.ts +47 -1
- package/src/infrastructure/config/config-conversation-ledger.ts +24 -8
- package/src/infrastructure/config/config-observability-ledger.ts +32 -4
- package/src/infrastructure/config/config-recent-jobs.integration.test.ts +45 -0
- package/src/infrastructure/config/configstore.ts +4 -4
- package/src/infrastructure/config/conversation-delivery-message.ts +12 -0
- package/src/modules/usage/contracts.ts +1 -0
- package/src/modules/usage/model-context.test.ts +106 -0
- package/src/modules/usage/model-context.ts +54 -0
- package/src/modules/usage/model-continuation.test.ts +27 -0
- package/src/modules/usage/provider.test.ts +40 -0
- package/src/modules/usage/provider.ts +21 -3
- package/src/modules/usage/repository.ts +2 -1
- package/src/routes/admin-conversation-audit.ts +20 -3
- package/src/routes/admin-history-cursor.ts +12 -0
- package/src/routes/admin-runtime.test.ts +47 -0
- package/src/routes/admin-runtime.ts +32 -3
- package/src/routes/admin-usage.ts +12 -1
- package/src/routes/admin.ts +6 -1
- package/src/routes/agent-conversation-audit.test.ts +47 -3
- package/src/test-support/agent-conversation-audit-fixture.ts +9 -1
- package/web/connect/bailing-connect-php.tgz +0 -0
- package/web/connect/bailing-connect-php7.tgz +0 -0
- package/web/console/assets/{Accounts-Dhyw-7wF.js → Accounts-B1Ne8Xx2.js} +1 -1
- package/web/console/assets/AgentClients-CiGQ-n2i.js +1 -0
- package/web/console/assets/AgentClients-xEIfsj7w.css +1 -0
- package/web/console/assets/AgentTasks-CaCeYv60.css +1 -0
- package/web/console/assets/AgentTasks-CylHZHHq.js +2 -0
- package/web/console/assets/{Approvals-CQx1YWxW.js → Approvals-wD4Iv80G.js} +1 -1
- package/web/console/assets/{Audit--QcdVlMh.js → Audit-BStlxkPw.js} +1 -1
- package/web/console/assets/{BrandLockup-DQcaW4Nt.js → BrandLockup-BAhrPnhy.js} +1 -1
- package/web/console/assets/Channels-DAlIgNxo.js +105 -0
- package/web/console/assets/Channels-WwRHFKJn.css +1 -0
- package/web/console/assets/ChatEntries-CPx-E9aJ.js +7 -0
- package/web/console/assets/ChatEntries-DALYfRDP.css +1 -0
- package/web/console/assets/Clients-gqNFusNW.css +1 -0
- package/web/console/assets/Clients-w97QPpFD.js +3 -0
- package/web/console/assets/Cost-CNDZaif-.css +1 -0
- package/web/console/assets/Cost-CxtN0mca.js +1 -0
- package/web/console/assets/Credentials-6c6aktzZ.css +1 -0
- package/web/console/assets/Credentials-BhpoH-hR.js +1 -0
- package/web/console/assets/{Diagnostics-CyoM1XrZ.js → Diagnostics-DnC-ODuy.js} +1 -1
- package/web/console/assets/Executors-CCTYuZf4.js +1 -0
- package/web/console/assets/Executors-CQ8iw3kK.css +1 -0
- package/web/console/assets/{HelpTip-DLlhaGQp.js → HelpTip-piedkqU-.js} +1 -1
- package/web/console/assets/Kb-CFCa-7LY.css +1 -0
- package/web/console/assets/Kb-DKp3mwWB.js +2 -0
- package/web/console/assets/Login-g_aZWHQd.js +1 -0
- package/web/console/assets/Login-krXZsvoF.css +1 -0
- package/web/console/assets/Projects-BexeaCxT.css +1 -0
- package/web/console/assets/Projects-DurExYV9.js +1 -0
- package/web/console/assets/Routes-CKoIjkCM.css +1 -0
- package/web/console/assets/Routes-CX7Q7bkz.js +138 -0
- package/web/console/assets/Runs-C48kdEwk.css +1 -0
- package/web/console/assets/Runs-CQKEDsrH.js +3 -0
- package/web/console/assets/Setup-CtWCXXpj.css +1 -0
- package/web/console/assets/Setup-DzI8rEAc.js +1 -0
- package/web/console/assets/Shell-BQ-g_O7K.js +1 -0
- package/web/console/assets/Shell-Y2fZK5LV.css +1 -0
- package/web/console/assets/StorageBuckets-CWxzIh0x.css +1 -0
- package/web/console/assets/StorageBuckets-DoZIzA7B.js +1 -0
- package/web/console/assets/SystemSettings-C3pFFzAQ.js +1 -0
- package/web/console/assets/SystemSettings-C5nv0K2a.css +1 -0
- package/web/console/assets/SystemStatus-Bbxu2dp4.css +1 -0
- package/web/console/assets/SystemStatus-BgekIK52.js +1 -0
- package/web/console/assets/Targets-CbLq7rgm.css +1 -0
- package/web/console/assets/Targets-DH1ZcK0J.js +1 -0
- package/web/console/assets/Tools-CMS1wVOm.js +5 -0
- package/web/console/assets/Tools-Qk1c5Rp8.css +1 -0
- package/web/console/assets/Usage-C0OkK7Jg.js +1 -0
- package/web/console/assets/Usage-Cue7CYnT.css +1 -0
- package/web/console/assets/UsageAccess-CHdWXvE8.js +1 -0
- package/web/console/assets/UsageAccess-nOa03hGb.css +1 -0
- package/web/console/assets/{UsageHelp-BmuiE1Ew.js → UsageHelp-BkIsuFUj.js} +1 -1
- package/web/console/assets/{console-location-Csv-xsnl.js → console-location-C_az_xHo.js} +1 -1
- package/web/console/assets/index-CbI5fbiD.js +2 -0
- package/web/console/assets/{index-B_5UfiTw.js → index-DwlsLKwM.js} +1 -1
- package/web/console/assets/request-WgSVj8ie.js +1 -0
- package/web/console/assets/{schema-o3mK4mid.js → schema-rb4T_2cj.js} +1 -1
- package/web/console/assets/task-page-location-BGxGar7H.js +1 -0
- package/web/console/assets/{use-list-location-cIPy2cKM.js → use-list-location-DeVfTTII.js} +1 -1
- package/web/console/assets/{use-unsaved-form-DScKD0h9.js → use-unsaved-form-B10XHC-n.js} +1 -1
- package/web/console/assets/{util-B40VqOwl.js → util-C0YJ70YU.js} +1 -1
- package/web/console/assets/{vendor-element-BT8tHCFk.js → vendor-element-BCC2kYn_.js} +7 -7
- package/web/console/assets/{vendor-mammoth-CVIXVxTN.js → vendor-mammoth-C7l0Q30g.js} +1 -1
- package/web/console/index.html +2 -2
- package/web-admin/package-lock.json +4 -4
- package/web-admin/package.json +1 -1
- package/web-admin/scripts/agent-task-control-smoke.mjs +26 -3
- package/web-admin/src/components/AgentSetupPanel.vue +19 -15
- package/web-admin/src/components/ChannelThread.vue +441 -0
- package/web-admin/src/components/ClientConversations.vue +397 -134
- package/web-admin/src/components/ConversationSourceTag.vue +24 -0
- package/web-admin/src/components/JobStatusTag.vue +18 -0
- package/web-admin/src/components/NotificationOutboxPanel.vue +5 -2
- package/web-admin/src/components/UsageServiceReferences.vue +6 -24
- package/web-admin/src/components/conversation-audit.ts +67 -2
- package/web-admin/src/components/conversation-reading-position.ts +27 -0
- package/web-admin/src/layout/Shell.vue +15 -17
- package/web-admin/src/onboarding-state.ts +5 -5
- package/web-admin/src/pages/AgentClients.vue +33 -27
- package/web-admin/src/pages/AgentTasks.vue +88 -43
- package/web-admin/src/pages/Channels.vue +15 -41
- package/web-admin/src/pages/ChatEntries.vue +13 -51
- package/web-admin/src/pages/Clients.vue +2 -2
- package/web-admin/src/pages/Cost.vue +10 -51
- package/web-admin/src/pages/Credentials.vue +1 -1
- package/web-admin/src/pages/Executors.vue +4 -3
- package/web-admin/src/pages/Kb.vue +4 -4
- package/web-admin/src/pages/Login.vue +7 -8
- package/web-admin/src/pages/Projects.vue +1 -1
- package/web-admin/src/pages/Routes.vue +46 -83
- package/web-admin/src/pages/Runs.vue +239 -567
- package/web-admin/src/pages/Setup.vue +20 -20
- package/web-admin/src/pages/StorageBuckets.vue +1 -1
- package/web-admin/src/pages/SystemSettings.vue +1 -2
- package/web-admin/src/pages/SystemStatus.vue +4 -6
- package/web-admin/src/pages/Targets.vue +0 -2
- package/web-admin/src/pages/Tools.vue +31 -22
- package/web-admin/src/pages/Usage.vue +110 -60
- package/web-admin/src/pages/UsageAccess.vue +2 -5
- package/web-admin/src/request.ts +5 -1
- package/web-admin/src/task-page-location.ts +6 -12
- package/web-admin/src/task-trace-presentation.ts +143 -0
- package/web-admin/tests/conversation-audit.test.mjs +23 -1
- package/web-admin/tests/model-context.browser.mjs +238 -0
- package/web-admin/tests/model-output-budget.browser.mjs +1 -0
- package/web/console/assets/AgentClients-BA0M26-I.css +0 -1
- package/web/console/assets/AgentClients-DWxb8-ko.js +0 -1
- package/web/console/assets/AgentTasks-DOyxANnx.css +0 -1
- package/web/console/assets/AgentTasks-DUHD4dzr.js +0 -2
- package/web/console/assets/Channels-DJJU3ksE.css +0 -1
- package/web/console/assets/Channels-cGS5WfQ-.js +0 -105
- package/web/console/assets/ChatEntries-BYpji27B.css +0 -1
- package/web/console/assets/ChatEntries-nh23Iz5O.js +0 -7
- package/web/console/assets/Clients-CX5EeYio.js +0 -3
- package/web/console/assets/Clients-CbZAou8E.css +0 -1
- package/web/console/assets/Cost-C6oQvz9P.css +0 -1
- package/web/console/assets/Cost-DOZfdNS9.js +0 -1
- package/web/console/assets/Credentials--aHs57yV.css +0 -1
- package/web/console/assets/Credentials-sy6W9Sac.js +0 -1
- package/web/console/assets/Executors-2Upi6bOS.css +0 -1
- package/web/console/assets/Executors-BQqqiFwt.js +0 -1
- package/web/console/assets/Kb-5R3ce4UU.js +0 -5
- package/web/console/assets/Kb-BM_PYi11.css +0 -1
- package/web/console/assets/Login-YKeUwdgo.js +0 -1
- package/web/console/assets/Login-xtPwDB5_.css +0 -1
- package/web/console/assets/Projects-DHwHrPT9.css +0 -1
- package/web/console/assets/Projects-Grgb6fOv.js +0 -1
- package/web/console/assets/Routes-DR_Yf02e.css +0 -1
- package/web/console/assets/Routes-DYgrXlRJ.js +0 -138
- package/web/console/assets/Runs-CwTddJJj.js +0 -3
- package/web/console/assets/Runs-D4FOvNfu.css +0 -1
- package/web/console/assets/Setup-Ca0b1d1-.css +0 -1
- package/web/console/assets/Setup-D_xUPNDq.js +0 -1
- package/web/console/assets/Shell-BTg8Vw_L.css +0 -1
- package/web/console/assets/Shell-Dfam2Uoj.js +0 -1
- package/web/console/assets/StorageBuckets-7QLBpV4a.css +0 -1
- package/web/console/assets/StorageBuckets-CP6e50wI.js +0 -1
- package/web/console/assets/SystemSettings-BRYKyJNa.js +0 -1
- package/web/console/assets/SystemSettings-HsXGx0aH.css +0 -1
- package/web/console/assets/SystemStatus-B-VfRsQd.css +0 -1
- package/web/console/assets/SystemStatus-CbPsDsGt.js +0 -1
- package/web/console/assets/Targets-1j4-g6rC.css +0 -1
- package/web/console/assets/Targets-C2LkR2AF.js +0 -1
- package/web/console/assets/Tools-C9HPJqJb.css +0 -1
- package/web/console/assets/Tools-C9JNJUS0.js +0 -2
- package/web/console/assets/Usage-D1Mv6vGY.js +0 -1
- package/web/console/assets/Usage-DMOzUsqh.css +0 -1
- package/web/console/assets/UsageAccess-77LmGCm6.js +0 -1
- package/web/console/assets/UsageAccess-C6ZGxEgJ.css +0 -1
- package/web/console/assets/index-MjZJEFIN.js +0 -2
- package/web/console/assets/request-rqm6MT0s.js +0 -1
- package/web/console/assets/task-page-location-DWiGtAln.js +0 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<template #header>
|
|
4
4
|
<div style="display: flex; justify-content: space-between; align-items: center">
|
|
5
5
|
<span><b>任务</b> <HelpTip title="任务页是什么">
|
|
6
|
-
<p>「<b>会话</b
|
|
6
|
+
<p>「<b>会话</b>」按最近活动汇总客户端、网页助手和其他渠道已记录的对话。可从消息查看执行轨迹,也可单独查原授权记录。</p>
|
|
7
7
|
<p>「<b>调度流</b>」按时间倒序审计<b>每一次派发</b>,点行看任务全详情(输入 / 组装上下文 / 工具 / 回复)。</p>
|
|
8
8
|
<p>「<b>追溯</b>」按 job_id、request_id、client_id、thread_id 或 principal_id 查单次任务完整生命周期,用于接入排障和审批/送达/工具调用对账。</p>
|
|
9
9
|
</HelpTip></span>
|
|
@@ -15,194 +15,65 @@
|
|
|
15
15
|
<!-- ============ 会话视图:把平铺的 job 还原成「一个人一条对话」(收件箱式主从) ============ -->
|
|
16
16
|
<el-tab-pane name="threads">
|
|
17
17
|
<template #label><span><el-icon style="vertical-align:-2px"><ChatLineRound /></el-icon> 会话</span></template>
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<el-radio-button value="legacy">原授权记录</el-radio-button>
|
|
22
|
-
</el-radio-group>
|
|
23
|
-
<span class="muted">{{ conversationView === 'audit' ? '按客户端会话汇总正文;授权执行保持独立可追溯。' : '保留单授权、历史会话与业务接入记录;执行摘要不等于客户端完整答复。' }}</span>
|
|
24
|
-
</div>
|
|
25
|
-
<ClientConversations v-show="conversationView === 'audit'" :key="auditConversationId ? 'selected' : 'unselected'" ref="clientConversations" :selected-id="auditConversationId" :focus-turn="auditTurnId"
|
|
26
|
-
@select="selectAuditConversation" @open-thread="gotoThread" @open-job="openDetail({ job_id: $event })" />
|
|
27
|
-
<div v-show="conversationView === 'legacy'" class="convo">
|
|
28
|
-
<!-- 左:会话列表 -->
|
|
29
|
-
<div class="rail">
|
|
30
|
-
<el-alert v-if="threadsError" :title="threadsError" type="error" :closable="false" show-icon />
|
|
31
|
-
<el-input v-model="threadQ" size="default" placeholder="搜会话:身份 / 接入方 / 内容 / 路由" clearable class="railsearch" @input="persistThreadSearch">
|
|
32
|
-
<template #prefix><el-icon><Search /></el-icon></template>
|
|
33
|
-
</el-input>
|
|
34
|
-
<div v-loading="threadsLoading" class="raillist">
|
|
35
|
-
<el-empty v-if="!threadsLoading && !threadsError && !filteredThreads.length" :image-size="56"
|
|
36
|
-
:description="threadQ ? '没有匹配的会话' : '还没有会话:业务/聊天接入后这里会出现'" />
|
|
37
|
-
<div v-for="t in filteredThreads" :key="t.thread_id" class="threaditem"
|
|
38
|
-
:class="{ active: curThread === t.thread_id }" @click="openThread(t.thread_id)">
|
|
39
|
-
<div class="trow1">
|
|
40
|
-
<el-tag v-if="partyVisible(t)" size="small" effect="plain" :type="partyType(t)">{{ partyLabel(t) }}</el-tag>
|
|
41
|
-
<span class="who mono" :title="identityTitle(t)">{{ whoLabel(t) }}</span>
|
|
42
|
-
<span class="tcount muted">{{ t.message_count }} 条消息</span>
|
|
43
|
-
</div>
|
|
44
|
-
<div class="tprev muted">{{ t.last_preview || '(无内容)' }}</div>
|
|
45
|
-
<div class="tmeta muted"><span class="mono">{{ t.route_name }}</span> · {{ fmtTime(t.last_active_at, true) }}</div>
|
|
46
|
-
</div>
|
|
47
|
-
<div v-if="threadsMore" class="loadmore"><el-button link :loading="threadsMoreLoading" @click="loadMoreThreads">加载更多会话</el-button></div>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
<!-- 右:完整对话(聊天记录)+ 逐轮执行轨迹 -->
|
|
52
|
-
<div ref="paneRef" class="pane" v-loading="threadDataLoading">
|
|
53
|
-
<el-alert v-if="threadDataError" :title="threadDataError" type="error" :closable="false" show-icon />
|
|
54
|
-
<el-empty v-if="!threadData && !threadDataLoading && !threadDataError" :image-size="90" description="选择左侧记录,查看该授权或业务入口保存的消息与轨迹" />
|
|
55
|
-
<template v-if="threadData">
|
|
56
|
-
<div class="paneHead">
|
|
57
|
-
<div class="ph1">
|
|
58
|
-
<el-tag v-if="partyVisible(threadData.thread)" size="small" effect="plain" :type="partyType(threadData.thread)">{{ partyLabel(threadData.thread) }}</el-tag>
|
|
59
|
-
<b class="mono" :title="identityTitle(threadData.thread)">{{ whoLabel(threadData.thread) }}</b>
|
|
60
|
-
<el-tag size="small" effect="plain" type="info" class="mono">{{ threadData.thread.route_name }}</el-tag>
|
|
61
|
-
<span class="muted">{{ threadData.thread.message_count }} 条消息 · 最近 {{ fmtTime(threadData.thread.last_active_at, true) }}</span>
|
|
62
|
-
</div>
|
|
63
|
-
<div class="ph2 muted mono" :title="threadData.thread.scope_key">scope: {{ threadData.thread.scope_key }}</div>
|
|
64
|
-
</div>
|
|
65
|
-
<el-collapse v-if="threadData.thread.summary" class="coll summcoll">
|
|
66
|
-
<el-collapse-item title="记忆层滚动摘要(更早的对话已折叠进这里,装配上下文时注入)">
|
|
67
|
-
<pre class="block">{{ cap(threadData.thread.summary) }}</pre>
|
|
68
|
-
</el-collapse-item>
|
|
69
|
-
</el-collapse>
|
|
70
|
-
|
|
71
|
-
<div class="chat">
|
|
72
|
-
<div v-for="m in threadData.messages" :key="m.id" class="turn" :class="m.direction === 'in' ? 'fromUser' : 'fromHub'">
|
|
73
|
-
<div class="bubbleWrap">
|
|
74
|
-
<div class="bMeta muted">{{ messageActorLabel(m, threadData.thread) }} · {{ fmtTime(m.created_at, true) }}</div>
|
|
75
|
-
<div class="bubble"><RichText :text="m.content" /></div>
|
|
76
|
-
<!-- AI 轮次:旧链路按 job_id,新 Agent Client 链路按 agent_run_id 懒拉各自的安全轨迹。 -->
|
|
77
|
-
<div v-if="shouldShowMessageTrace(m)" class="traceLine">
|
|
78
|
-
<span class="tracetoggle" @click="toggleTrace(m)">
|
|
79
|
-
<svg class="traceCaret" :class="{ open: traces[traceKey(m)]?.open }" viewBox="0 0 1024 1024" aria-hidden="true">
|
|
80
|
-
<path d="M0.085333 239.36L512 784.64l511.914667-545.28z" fill="currentColor"></path>
|
|
81
|
-
</svg>
|
|
82
|
-
执行轨迹
|
|
83
|
-
<span v-if="traceBadge(traceKey(m))" class="muted">{{ traceBadge(traceKey(m)) }}</span>
|
|
84
|
-
</span>
|
|
85
|
-
<div v-if="traces[traceKey(m)]?.open" class="tracebox" v-loading="traces[traceKey(m)]?.loading">
|
|
86
|
-
<template v-if="traces[traceKey(m)]?.detail">
|
|
87
|
-
<div class="tmeta2">
|
|
88
|
-
<el-tag v-if="isAgentTrace(traceKey(m))" size="small" type="primary" effect="plain">本地智能体编排</el-tag>
|
|
89
|
-
<el-tag size="small" :type="statusType(traces[traceKey(m)].detail.status)" effect="plain">{{ traceStatusLabel(traces[traceKey(m)].detail.status) }}</el-tag>
|
|
90
|
-
<span v-if="traceModel(traceKey(m))" class="mono muted">{{ traceModel(traceKey(m)) }}</span>
|
|
91
|
-
<span v-if="traceDuration(traceKey(m))" class="muted">{{ (traceDuration(traceKey(m)) / 1000).toFixed(1) }}s</span>
|
|
92
|
-
<span v-if="traceTokenCount(traceKey(m))" class="muted">{{ traceTokenCount(traceKey(m)) }} tok</span>
|
|
93
|
-
</div>
|
|
94
|
-
<div v-if="isAgentTrace(traceKey(m))" class="agentTraceHint">
|
|
95
|
-
本地智能体负责理解、规划和工具选择;隐藏推理不会上传。以下只展示中枢可验证的运行边界、ACC 工具治理、审批与结果。
|
|
96
|
-
</div>
|
|
97
|
-
<el-button v-if="traces[traceKey(m)].detail.conversation_audit_id" size="small" plain type="primary" class="traceDetailBtn" @click="gotoAuditConversation(traces[traceKey(m)].detail.conversation_audit_id, traces[traceKey(m)].detail.client_turn_id)">查看客户端完整对话</el-button>
|
|
98
|
-
<div v-if="isAgentTrace(traceKey(m)) && traces[traceKey(m)].summary?.partial" class="agentTracePartial">
|
|
99
|
-
本轮工具记录超过单次展示上限,以下是已通过归属校验的部分轨迹,不代表全量。
|
|
100
|
-
</div>
|
|
101
|
-
<div v-if="!isAgentTrace(traceKey(m))" class="muted toolsum">{{ fmtTools(traces[traceKey(m)].detail?.dispatch?.tools) }}</div>
|
|
102
|
-
<div v-if="isAgentTrace(traceKey(m)) && traces[traceKey(m)].invocations.length" class="agentInvocations">
|
|
103
|
-
<div v-for="inv in traces[traceKey(m)].invocations" :key="inv.job_id" class="agentInvocation">
|
|
104
|
-
<el-tag size="small" effect="plain" type="primary" class="mono">{{ inv.tool }}</el-tag>
|
|
105
|
-
<span class="muted">{{ invocationStateLabel(inv) }}</span>
|
|
106
|
-
<span v-if="inv.duration_ms" class="muted">{{ (inv.duration_ms / 1000).toFixed(1) }}s</span>
|
|
107
|
-
<el-button link type="primary" size="small" @click.stop="openDetail({ job_id: inv.job_id })">工具详情</el-button>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
<el-timeline v-if="traces[traceKey(m)].events?.length" class="tline">
|
|
111
|
-
<el-timeline-item v-for="(a, i) in traces[traceKey(m)].events" :key="i" :timestamp="fmtTime(a.ts)" placement="top">
|
|
112
|
-
<b>{{ traceTitle(a) }}</b>
|
|
113
|
-
<el-tag v-if="a.source" size="small" effect="plain" :type="a.source === 'local_agent' ? 'primary' : 'info'" class="traceSource">{{ traceSourceLabel(a.source) }}</el-tag>
|
|
114
|
-
<el-tag size="small" effect="plain" :type="traceStageType(a.stage)" class="traceStage">{{ traceStageLabel(a.stage) }}</el-tag>
|
|
115
|
-
<el-tag v-if="a.severity && a.severity !== 'info'" size="small" effect="plain" :type="traceSeverityType(a.severity)" class="traceSeverity">{{ a.severity }}</el-tag>
|
|
116
|
-
<span v-if="traceSummaryText(a)" class="muted auditTag">{{ traceSummaryText(a) }}</span>
|
|
117
|
-
<template v-if="detailLen(a.detail)">
|
|
118
|
-
<el-collapse v-if="detailLen(a.detail) > 160" class="auditcoll">
|
|
119
|
-
<el-collapse-item :title="shortDetail(a.detail)"><pre class="block">{{ fullDetail(a.detail) }}</pre></el-collapse-item>
|
|
120
|
-
</el-collapse>
|
|
121
|
-
<div v-else class="muted detail-json">{{ shortDetail(a.detail) }}</div>
|
|
122
|
-
</template>
|
|
123
|
-
</el-timeline-item>
|
|
124
|
-
</el-timeline>
|
|
125
|
-
<div v-else class="muted notrace">这一轮没有可展示的执行事件</div>
|
|
126
|
-
<div v-if="isAgentTrace(traceKey(m)) && traces[traceKey(m)].summary?.tool_invocations === 0 && !traces[traceKey(m)].invocations.length" class="muted notrace">本轮未调用中枢治理工具。</div>
|
|
127
|
-
<el-button v-if="m.job_id" plain type="primary" size="small" class="traceDetailBtn" @click="openDetail({ job_id: m.job_id })">查看完整详情</el-button>
|
|
128
|
-
</template>
|
|
129
|
-
<div v-else-if="!traces[traceKey(m)]?.loading" class="muted">该轮详情已不可用(记录可能已清理)</div>
|
|
130
|
-
</div>
|
|
131
|
-
</div>
|
|
132
|
-
</div>
|
|
133
|
-
</div>
|
|
134
|
-
</div>
|
|
135
|
-
</template>
|
|
136
|
-
</div>
|
|
137
|
-
</div>
|
|
18
|
+
<ClientConversations ref="clientConversations" :selected-id="auditConversationId" :focus-turn="auditTurnId" :channel-thread="channelThreadId" :source="conversationSource"
|
|
19
|
+
@select-channel="selectChannelThread" @change-source="changeConversationSource" @open-audit="gotoAuditConversation"
|
|
20
|
+
@select="selectAuditConversation" @back-list="backToConversationList" @open-directory="openRecordDirectory" @open-thread="gotoThread" @open-job="openDetail({ job_id: $event })" />
|
|
138
21
|
</el-tab-pane>
|
|
139
|
-
|
|
140
22
|
<!-- ============ 调度流:原有平铺列表,按时间审计每一次派发 ============ -->
|
|
141
23
|
<el-tab-pane name="runs">
|
|
142
24
|
<template #label><span><el-icon style="vertical-align:-2px"><List /></el-icon> 调度流</span></template>
|
|
143
25
|
<div class="run-filters">
|
|
144
|
-
<el-select v-model="runFilters.status" aria-label="任务状态筛选" style="width:170px" @change="persistRunFilters"><el-option value="" label="全部状态" /><el-option v-for="status in RUN_FILTER_STATUSES" :key="status" :value="status" :label="`${
|
|
26
|
+
<el-select v-model="runFilters.status" aria-label="任务状态筛选" placeholder="全部状态" style="width:170px" @change="persistRunFilters"><el-option value="" label="全部状态" /><el-option v-for="status in RUN_FILTER_STATUSES" :key="status" :value="status" :label="`${jobStatusLabel(status)} · ${status}`" /></el-select>
|
|
145
27
|
<el-select v-model="runFilters.route" aria-label="任务路由筛选" style="width:240px" filterable allow-create clearable placeholder="全部路由(输入精确标识)" @change="persistRunFilters"><el-option v-for="key in runRouteOptions" :key="key" :value="key" :label="key" /></el-select>
|
|
146
28
|
<el-select v-model="runFilters.period" aria-label="任务时间筛选" style="width:150px" @change="persistRunFilters"><el-option value="all" label="全部时间" /><el-option value="24h" label="最近 24 小时" /><el-option value="7d" label="最近 7 天" /></el-select>
|
|
147
29
|
<el-button v-if="hasRunFilters" @click="clearRunFilters">清除筛选</el-button>
|
|
148
30
|
</div>
|
|
149
|
-
<el-alert
|
|
150
|
-
<
|
|
151
|
-
<el-
|
|
152
|
-
<el-
|
|
153
|
-
|
|
154
|
-
<el-table-column label="
|
|
155
|
-
<
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
</
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
<template #default="{ row }">
|
|
174
|
-
<div>{{ row.project || '-' }}</div>
|
|
175
|
-
<div class="muted ellipsis">{{ row.input_preview }}</div>
|
|
176
|
-
</template>
|
|
177
|
-
</el-table-column>
|
|
178
|
-
<el-table-column label="状态" width="100">
|
|
179
|
-
<template #default="{ row }">
|
|
180
|
-
<el-tag :type="statusType(row.status)" effect="plain">{{ row.status }}</el-tag>
|
|
181
|
-
</template>
|
|
182
|
-
</el-table-column>
|
|
183
|
-
<el-table-column prop="severity" label="级别" width="90" />
|
|
184
|
-
<el-table-column prop="summary" label="结果摘要" min-width="240" show-overflow-tooltip />
|
|
31
|
+
<el-alert v-if="runsError" :title="runsError" :description="list.length ? `保留上次读取的记录(${fmtTime(runsLoadedAt, true)})。` : '请重试读取当前条件下的任务。'" type="error" :closable="false" show-icon />
|
|
32
|
+
<div v-if="!loading && !runsError && list.length" class="runCount muted">{{ runsMore ? '已显示 ' + list.length + ' 条,可继续加载' : '共 ' + list.length + ' 条任务' }}</div>
|
|
33
|
+
<el-empty v-if="!list.length && !loading && !runsError" :description="hasRunFilters ? '没有符合当前条件的任务' : '尚无任务记录'"><el-button v-if="hasRunFilters" @click="clearRunFilters">清除筛选</el-button></el-empty>
|
|
34
|
+
<el-table v-else :data="list" v-loading="loading" @row-click="openDetail" row-key="job_id" class="runsTable">
|
|
35
|
+
<el-table-column label="时间" width="125"><template #default="{ row }"><time>{{ fmtTime(row.created_at, true) }}</time></template></el-table-column>
|
|
36
|
+
<el-table-column label="任务" min-width="215"><template #default="{ row }">
|
|
37
|
+
<button type="button" class="runSubject" :title="row.input_preview || row.project || row.request_id || row.job_id" @click.stop="openDetail(row)">{{ row.input_preview || row.project || row.request_id || row.job_id }}</button>
|
|
38
|
+
<div v-if="row.project && row.input_preview" class="muted runCellLine">{{ row.project }}</div>
|
|
39
|
+
</template></el-table-column>
|
|
40
|
+
<el-table-column label="来源" min-width="110"><template #default="{ row }">
|
|
41
|
+
<span class="runCellLine" :title="row.source || row.client_app_id">{{ runSourceLabel(row) }}</span>
|
|
42
|
+
<span v-if="row.visitor_uid || row.thread_id" class="muted runCellLine">{{ [row.visitor_uid, row.thread_id].filter(Boolean).join(' · ') }}</span>
|
|
43
|
+
</template></el-table-column>
|
|
44
|
+
<el-table-column label="路由 / 调度目标" min-width="135"><template #default="{ row }">
|
|
45
|
+
<span class="runCellLine" :title="runRouteKey(row)">{{ runRouteKey(row) || '未记录' }}</span>
|
|
46
|
+
<span v-if="row.target" class="muted runCellLine">{{ row.target }}</span>
|
|
47
|
+
</template></el-table-column>
|
|
48
|
+
<el-table-column label="状态" width="95"><template #default="{ row }">
|
|
49
|
+
<JobStatusTag :status="row.status" />
|
|
50
|
+
</template></el-table-column>
|
|
51
|
+
<el-table-column label="结果 / 异常摘要" min-width="180"><template #default="{ row }">
|
|
52
|
+
<div class="runCellLine" :class="{ errorText: row.error_preview }" :title="row.error_preview || row.summary">{{ row.error_preview || row.summary || '—' }}</div>
|
|
53
|
+
<span v-if="row.severity" class="muted runCellLine">级别 · {{ row.severity }}</span>
|
|
54
|
+
</template></el-table-column>
|
|
185
55
|
</el-table>
|
|
186
|
-
<div v-if="runsMore" class="loadmore"><el-button :loading="moreLoading" @click="loadMoreRuns">加载更多</el-button></div>
|
|
187
|
-
<div v-else-if="list.length" class="loadmore muted">— 已到底(共 {{ list.length }} 条)—</div>
|
|
56
|
+
<div v-if="runsMore" class="loadmore"><el-button :loading="moreLoading" :disabled="loading" @click="loadMoreRuns">加载更多</el-button></div>
|
|
188
57
|
</el-tab-pane>
|
|
189
58
|
|
|
190
59
|
<!-- ============ 单 Job 追溯:开发者排障入口,job_id → 生命周期全链 ============ -->
|
|
191
60
|
<el-tab-pane name="trace">
|
|
192
61
|
<template #label><span><el-icon style="vertical-align:-2px"><Search /></el-icon> 追溯</span></template>
|
|
193
62
|
<div class="traceLookup">
|
|
194
|
-
|
|
63
|
+
<el-input v-model="traceJobInput" size="default" class="mono" clearable aria-label="追溯标识" placeholder="任务、请求或关联对象标识" @keyup.enter="lookupJobTrace" @clear="clearTraceLookup">
|
|
195
64
|
<template #append><el-button :loading="traceLookupLoading" @click="lookupJobTrace">追溯</el-button></template>
|
|
196
65
|
</el-input>
|
|
66
|
+
<HelpTip title="追溯标识"><p>直接输入 job_id 或 request_id。按关联对象查询时,在标识前添加前缀,例如 <code>client:crm</code>、<code>thread:123</code> 或 <code>principal:u-1</code>。</p></HelpTip>
|
|
197
67
|
</div>
|
|
68
|
+
<el-button v-if="traceFrom" class="traceReturn" plain size="small" @click="returnToTraceMatches">返回匹配任务</el-button>
|
|
198
69
|
<el-alert v-if="traceLookupError" :title="traceLookupError" :description="traceLookupResult || traceLookupMatches.length ? `正在展示旧快照,上次成功读取:${fmtTime(traceLoadedAt, true)}。` : '此次未取得追溯结果,请刷新重试。'" type="error" :closable="false" show-icon />
|
|
199
|
-
<el-empty v-if="!traceLookupResult && !traceLookupLoading && !traceLookupMatches.length && !traceLookupError" description="
|
|
70
|
+
<el-empty v-if="!traceLookupResult && !traceLookupLoading && !traceLookupMatches.length && !traceLookupError" :description="traceEmptyFor ? `没有与「${traceEmptyFor}」匹配的任务` : '输入标识后查看匹配任务'" />
|
|
200
71
|
<el-table v-if="!traceLookupResult && traceLookupMatches.length" :data="traceLookupMatches" size="small" class="traceMatches" @row-click="openTraceMatch">
|
|
201
72
|
<el-table-column label="时间" width="130"><template #default="{ row }">{{ fmtTime(row.created_at, true) }}</template></el-table-column>
|
|
202
|
-
<el-table-column
|
|
73
|
+
<el-table-column label="请求编号" min-width="180" show-overflow-tooltip><template #default="{ row }"><el-button link type="primary" @click.stop="openTraceMatch(row)">{{ row.request_id || row.job_id }}</el-button></template></el-table-column>
|
|
203
74
|
<el-table-column prop="client_app_id" label="接入方" width="120" />
|
|
204
75
|
<el-table-column prop="route_key" label="路由" width="140" show-overflow-tooltip />
|
|
205
|
-
<el-table-column prop="status" label="状态" width="90"><template #default="{ row }"><
|
|
76
|
+
<el-table-column prop="status" label="状态" width="90"><template #default="{ row }"><JobStatusTag :status="row.status" /></template></el-table-column>
|
|
206
77
|
<el-table-column prop="input_preview" label="输入" min-width="220" show-overflow-tooltip />
|
|
207
78
|
</el-table>
|
|
208
79
|
<div v-if="traceLookupResult" v-loading="traceLookupLoading" class="tracePanel">
|
|
@@ -212,7 +83,7 @@
|
|
|
212
83
|
<div class="muted mono">request: {{ traceLookupJob.request_id || '—' }}</div>
|
|
213
84
|
</div>
|
|
214
85
|
<div class="traceHeadTags">
|
|
215
|
-
<
|
|
86
|
+
<JobStatusTag :status="traceLookupJob.status" />
|
|
216
87
|
<el-tag effect="plain" type="info">{{ traceLookupJob.target }}</el-tag>
|
|
217
88
|
<el-tag v-if="traceLookupJob.client_app_id" effect="plain" type="success">{{ traceLookupJob.client_app_id }}</el-tag>
|
|
218
89
|
<el-tag v-if="traceLookupSummary.error_count" effect="plain" type="danger">{{ traceLookupSummary.error_count }} 错误</el-tag>
|
|
@@ -283,7 +154,41 @@
|
|
|
283
154
|
</el-tabs>
|
|
284
155
|
</el-card>
|
|
285
156
|
|
|
286
|
-
<el-drawer :model-value="
|
|
157
|
+
<el-drawer :model-value="recordDrawerOpen" :title="curThread ? '原授权记录' : '授权与接入记录'"
|
|
158
|
+
size="min(660px, 100vw)" class="rawRecordDrawer" append-to-body :before-close="closeRecordDrawer">
|
|
159
|
+
<div ref="recordContents" class="recordContents">
|
|
160
|
+
<div class="recordTools">
|
|
161
|
+
<el-button v-if="curThread" size="small" data-record-list @click="backToRecordDirectory">返回记录列表</el-button>
|
|
162
|
+
<HelpTip v-else title="筛选授权与接入记录">记录按最近活动排序,搜索范围为当前已加载的记录。</HelpTip>
|
|
163
|
+
<el-button size="small" :loading="curThread ? rawTranscript?.loading : threadsLoading" @click="refreshRecords">刷新记录</el-button>
|
|
164
|
+
</div>
|
|
165
|
+
<div v-show="!curThread" class="rail" aria-label="原记录列表">
|
|
166
|
+
<el-alert v-if="threadsError" :title="threadsError" type="error" :closable="false" show-icon />
|
|
167
|
+
<el-input v-model="threadQ" size="default" aria-label="筛选已加载的授权与接入记录" placeholder="筛选身份、接入方、内容或路由" clearable class="railsearch" @input="persistThreadSearch">
|
|
168
|
+
<template #prefix><el-icon><Search /></el-icon></template>
|
|
169
|
+
</el-input>
|
|
170
|
+
<div v-loading="threadsLoading" class="raillist">
|
|
171
|
+
<el-empty v-if="!threadsLoading && !threadsError && !filteredThreads.length" :image-size="56"
|
|
172
|
+
:description="threadQ ? '已加载记录中没有匹配项' : '暂无授权或业务接入记录'" />
|
|
173
|
+
<button v-for="t in filteredThreads" :key="t.thread_id" type="button" class="threaditem"
|
|
174
|
+
:class="{ active: lastOpenedThread === t.thread_id }" :aria-current="lastOpenedThread === t.thread_id ? 'true' : undefined" :data-thread-id="t.thread_id" @click="gotoThread(t.thread_id)">
|
|
175
|
+
<div class="trow1">
|
|
176
|
+
<el-tag v-if="partyVisible(t)" size="small" effect="plain" :type="partyType(t)">{{ partyLabel(t) }}</el-tag>
|
|
177
|
+
<span class="who mono" :title="identityTitle(t)">{{ whoLabel(t) }}</span>
|
|
178
|
+
<span class="tcount muted">{{ t.message_count }} 条消息</span>
|
|
179
|
+
</div>
|
|
180
|
+
<div class="tprev muted">{{ t.last_preview || '(无内容)' }}</div>
|
|
181
|
+
<div class="tmeta muted"><span class="mono">{{ t.route_name }}</span> · {{ fmtTime(t.last_active_at, true) }}</div>
|
|
182
|
+
</button>
|
|
183
|
+
<div v-if="threadsMore" class="loadmore"><el-button link :loading="threadsMoreLoading" @click="loadMoreThreads">加载更多记录</el-button></div>
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
|
|
187
|
+
<ChannelThread v-if="curThread" ref="rawTranscript" :thread-id="curThread" @open-job="openDetail({ job_id: $event })" @open-audit="gotoAuditConversation" />
|
|
188
|
+
</div>
|
|
189
|
+
</el-drawer>
|
|
190
|
+
|
|
191
|
+
<el-drawer :model-value="detailOpen" size="min(920px, 92vw)" class="runDetailDrawer" append-to-body :title="'任务详情 · ' + (detail?.request_id || detail?.job_id || '')" :before-close="closeJobDetail">
|
|
287
192
|
<el-alert v-if="detailError" :title="detailError" :description="detail ? `当前保留旧快照(${fmtTime(detailLoadedAt, true)}),刷新成功前不能重新执行。` : '未取得任务详情,请重试。'" type="error" :closable="false" show-icon />
|
|
288
193
|
<div v-if="detailLoading" class="muted">正在读取任务详情…</div>
|
|
289
194
|
<el-button v-if="!detail && detailJobId && !detailLoading" @click="openDetail({ job_id: detailJobId })">重试读取任务</el-button>
|
|
@@ -291,7 +196,7 @@
|
|
|
291
196
|
<div class="detailHero">
|
|
292
197
|
<div class="detailHeroMain">
|
|
293
198
|
<div class="detailTags">
|
|
294
|
-
<
|
|
199
|
+
<JobStatusTag :status="detail.status" />
|
|
295
200
|
<el-tag effect="plain" type="info">{{ detail.target }}</el-tag>
|
|
296
201
|
<el-tag v-if="detail.client_app_id" effect="plain" type="success">{{ detail.client_app_id }}</el-tag>
|
|
297
202
|
<el-tag v-if="detail.attempts" effect="plain" type="warning">重试 {{ detail.attempts }}</el-tag>
|
|
@@ -339,7 +244,7 @@
|
|
|
339
244
|
<template #title>
|
|
340
245
|
<div class="detailSectionTitle">
|
|
341
246
|
<b>完整链路</b>
|
|
342
|
-
<span class="muted">{{ detailTraceCount }}
|
|
247
|
+
<span class="muted">{{ detailTraceCount }} 步</span>
|
|
343
248
|
</div>
|
|
344
249
|
</template>
|
|
345
250
|
<div class="chainGroups">
|
|
@@ -347,7 +252,7 @@
|
|
|
347
252
|
<div class="chainGroupHead">
|
|
348
253
|
<div>
|
|
349
254
|
<b>{{ g.label }}</b>
|
|
350
|
-
<
|
|
255
|
+
<HelpTip :title="g.label">{{ g.hint }}</HelpTip>
|
|
351
256
|
</div>
|
|
352
257
|
<div class="chainGroupTags">
|
|
353
258
|
<el-tag size="small" effect="plain" :type="detailGroupType(g)">{{ g.events.length }} 步</el-tag>
|
|
@@ -382,10 +287,9 @@
|
|
|
382
287
|
<template #title>
|
|
383
288
|
<div class="detailSectionTitle">
|
|
384
289
|
<b>输入与上下文</b>
|
|
385
|
-
<span class="muted">{{ inputParty.label }}、页面、知识、工具、模型请求</span>
|
|
386
290
|
</div>
|
|
387
291
|
</template>
|
|
388
|
-
<div class="detailSubhead">{{ inputParty.label }} <span class="muted">{{ inputParty.sub }}
|
|
292
|
+
<div class="detailSubhead">{{ inputParty.label }} <span class="muted">{{ inputParty.sub }}</span></div>
|
|
389
293
|
<div class="richbox compact"><RichText :text="rawInput" /></div>
|
|
390
294
|
<div v-if="pageCtx" class="pagectx">
|
|
391
295
|
<span class="muted">发起页面:</span>
|
|
@@ -408,7 +312,7 @@
|
|
|
408
312
|
<div v-else class="muted nokb">未注入知识</div>
|
|
409
313
|
</div>
|
|
410
314
|
<div>
|
|
411
|
-
<div class="detailSubhead">工具注入 <
|
|
315
|
+
<div class="detailSubhead">工具注入 <HelpTip title="工具注入">本次任务实际提供给模型的工具。渐进模式下,首轮提供目录,模型按需读取工具定义。</HelpTip></div>
|
|
412
316
|
<div class="muted toolsum">{{ toolsSummary }}</div>
|
|
413
317
|
<div v-if="llmReq" class="toolinject">
|
|
414
318
|
<el-tag size="small" :type="toolModeType" effect="plain">{{ toolModeLabel }}</el-tag>
|
|
@@ -417,7 +321,6 @@
|
|
|
417
321
|
<div v-if="injectedTools.length" class="injtags">
|
|
418
322
|
<el-tag v-for="n in injectedTools" :key="n" size="small" effect="plain" class="mono injtag">{{ n }}</el-tag>
|
|
419
323
|
</div>
|
|
420
|
-
<div v-else-if="llmReq.tool_mode === 'progressive'" class="muted" style="margin-top: 4px">首轮只给工具目录,模型经 find_tools 按需取定义</div>
|
|
421
324
|
<div v-else-if="llmReq.tool_mode === 'none'" class="muted" style="margin-top: 4px">本路由未挂工具源,纯对话生成</div>
|
|
422
325
|
</div>
|
|
423
326
|
<div v-else class="muted toolsum">该任务无运行期工具注入记录</div>
|
|
@@ -426,7 +329,7 @@
|
|
|
426
329
|
|
|
427
330
|
<el-collapse class="coll">
|
|
428
331
|
<el-collapse-item title="系统提示词">
|
|
429
|
-
<div class="muted sectionHint">{{ llmReq ? '
|
|
332
|
+
<div class="muted sectionHint">{{ llmReq ? '运行时实际提示词' : '配置原文(缺少运行时记录)' }}</div>
|
|
430
333
|
<pre class="block sm">{{ actualSystemPrompt || '(未配置)' }}</pre>
|
|
431
334
|
</el-collapse-item>
|
|
432
335
|
<el-collapse-item :title="'完整组装 prompt(' + assembledLen + ' 字符)'">
|
|
@@ -439,7 +342,6 @@
|
|
|
439
342
|
<template #title>
|
|
440
343
|
<div class="detailSectionTitle">
|
|
441
344
|
<b>AI 回复</b>
|
|
442
|
-
<span class="muted">最终返回给用户或业务侧的内容</span>
|
|
443
345
|
</div>
|
|
444
346
|
</template>
|
|
445
347
|
<div class="richbox"><RichText :text="resultText" /></div>
|
|
@@ -449,12 +351,11 @@
|
|
|
449
351
|
<template #title>
|
|
450
352
|
<div class="detailSectionTitle">
|
|
451
353
|
<b>原始快照</b>
|
|
452
|
-
<span class="muted">metadata / dispatch,深度排障时使用</span>
|
|
453
354
|
</div>
|
|
454
355
|
</template>
|
|
455
|
-
<div class="detailSubhead">metadata <
|
|
356
|
+
<div class="detailSubhead">metadata <HelpTip title="任务元数据">记录触发方、会话身份、线程和业务字段。</HelpTip></div>
|
|
456
357
|
<pre class="block">{{ cap(JSON.stringify(detail.metadata || {}, null, 2)) }}</pre>
|
|
457
|
-
<div class="detailSubhead">dispatch <
|
|
358
|
+
<div class="detailSubhead">dispatch <HelpTip title="派发快照">记录任务派发时使用的模型、工具和送达配置。</HelpTip></div>
|
|
458
359
|
<pre class="block">{{ cap(JSON.stringify(detail.dispatch || {}, null, 2)) }}</pre>
|
|
459
360
|
</el-collapse-item>
|
|
460
361
|
</el-collapse>
|
|
@@ -467,79 +368,25 @@ import { computed, nextTick, onMounted, reactive, ref, watch } from 'vue';
|
|
|
467
368
|
import { useRoute, useRouter } from 'vue-router';
|
|
468
369
|
import { ElMessage } from 'element-plus/es/components/message/index';
|
|
469
370
|
import { ChatLineRound, List, Search } from '@element-plus/icons-vue';
|
|
470
|
-
import { api } from '../request';
|
|
371
|
+
import { api, ApiError } from '../request';
|
|
471
372
|
import { fmtTime } from '../util';
|
|
472
373
|
import { useMe } from '../store';
|
|
473
374
|
import RichText from '../components/RichText.vue';
|
|
474
375
|
import HelpTip from '../components/HelpTip.vue';
|
|
376
|
+
import JobStatusTag from '../components/JobStatusTag.vue';
|
|
475
377
|
import ClientConversations from '../components/ClientConversations.vue';
|
|
378
|
+
import ChannelThread from '../components/ChannelThread.vue';
|
|
379
|
+
import { cap, detailLen, shortDetail, fullDetail, fmtTools, jobStatusLabel, traceTitle, traceSummaryText, traceStageLabel, traceStageType, traceSeverityType,
|
|
380
|
+
partyLabel, partyVisible, partyType, whoLabel, identityTitle, type TraceEvent, type TracePayload } from '../task-trace-presentation';
|
|
476
381
|
import NotificationOutboxPanel from '../components/NotificationOutboxPanel.vue';
|
|
477
382
|
import { canOfferRerun, rerunHint } from '../runtime-feedback';
|
|
478
|
-
import {
|
|
383
|
+
import { queryText, runFilterParams, patchTaskQuery, readRunFilters, readRunsLocation, RUN_FILTER_STATUSES, runRouteKey, runsTabQuery, safeTaskReturnPath, type RunsTab } from '../task-page-location';
|
|
479
384
|
|
|
480
385
|
const route = useRoute();
|
|
481
386
|
const router = useRouter();
|
|
482
387
|
const returnPath = computed(() => safeTaskReturnPath(route.query.return_to));
|
|
483
388
|
const initialLocation = readRunsLocation(route.query);
|
|
484
389
|
|
|
485
|
-
type TraceSeverity = 'info' | 'warning' | 'error';
|
|
486
|
-
type TraceStage = 'launch' | 'context' | 'execution' | 'tool' | 'approval' | 'delivery' | 'summary' | 'recovery' | 'channel' | 'config' | 'system' | string;
|
|
487
|
-
interface TraceEvent {
|
|
488
|
-
ts: string;
|
|
489
|
-
event: string;
|
|
490
|
-
stage?: TraceStage;
|
|
491
|
-
severity?: TraceSeverity;
|
|
492
|
-
title?: string;
|
|
493
|
-
summary?: string;
|
|
494
|
-
detail?: Record<string, unknown>;
|
|
495
|
-
source?: 'local_agent' | 'hub_governance';
|
|
496
|
-
tool_job_id?: string;
|
|
497
|
-
}
|
|
498
|
-
interface TracePayload {
|
|
499
|
-
job: any;
|
|
500
|
-
trace: { summary?: any; events: TraceEvent[] };
|
|
501
|
-
lookup?: any;
|
|
502
|
-
debug_bundle?: any;
|
|
503
|
-
debug_report?: string;
|
|
504
|
-
}
|
|
505
|
-
interface AgentRunInvocation {
|
|
506
|
-
job_id: string;
|
|
507
|
-
invocation_id: string;
|
|
508
|
-
tool: string;
|
|
509
|
-
status: string;
|
|
510
|
-
state: string | null;
|
|
511
|
-
ok: boolean | null;
|
|
512
|
-
business_status: string | number | null;
|
|
513
|
-
approval_status: string | null;
|
|
514
|
-
approval_id: number | null;
|
|
515
|
-
event_count: number;
|
|
516
|
-
duration_ms?: number;
|
|
517
|
-
created_at: string;
|
|
518
|
-
updated_at: string;
|
|
519
|
-
}
|
|
520
|
-
interface AgentRunTracePayload {
|
|
521
|
-
kind: 'agent_client_run';
|
|
522
|
-
run: any;
|
|
523
|
-
trace: { summary?: any; events: TraceEvent[] };
|
|
524
|
-
invocations: AgentRunInvocation[];
|
|
525
|
-
}
|
|
526
|
-
interface ThreadMessage {
|
|
527
|
-
id: number;
|
|
528
|
-
direction: 'in' | 'out';
|
|
529
|
-
content: string;
|
|
530
|
-
created_at: string;
|
|
531
|
-
job_id?: string | null;
|
|
532
|
-
agent_run_id?: string | null;
|
|
533
|
-
}
|
|
534
|
-
interface ConversationTraceState {
|
|
535
|
-
kind: 'job' | 'agent-run';
|
|
536
|
-
open: boolean;
|
|
537
|
-
loading: boolean;
|
|
538
|
-
detail: any;
|
|
539
|
-
events: TraceEvent[];
|
|
540
|
-
summary: any | null;
|
|
541
|
-
invocations: AgentRunInvocation[];
|
|
542
|
-
}
|
|
543
390
|
interface DetailTraceGroup {
|
|
544
391
|
key: string;
|
|
545
392
|
label: string;
|
|
@@ -553,20 +400,37 @@ interface DetailTraceGroup {
|
|
|
553
400
|
const s = useMe();
|
|
554
401
|
const activeTab = ref<RunsTab>(initialLocation.tab);
|
|
555
402
|
const notificationPanel = ref<InstanceType<typeof NotificationOutboxPanel> | null>(null);
|
|
556
|
-
const
|
|
403
|
+
const recordDrawerOpen = computed(() => {
|
|
404
|
+
const location = readRunsLocation(route.query);
|
|
405
|
+
return location.tab === 'threads' && location.view === 'legacy';
|
|
406
|
+
});
|
|
557
407
|
const auditConversationId = ref(initialLocation.conversation), auditTurnId = ref(initialLocation.turn);
|
|
408
|
+
const rawTranscript = ref<InstanceType<typeof ChannelThread> | null>(null);
|
|
409
|
+
const channelThreadId = computed(() => {
|
|
410
|
+
const value = route.query.channel_thread;
|
|
411
|
+
return typeof value === 'string' && /^[1-9]\d*$/.test(value) && Number.isSafeInteger(Number(value)) ? Number(value) : undefined;
|
|
412
|
+
});
|
|
413
|
+
const conversationSource = computed(() => typeof route.query.conversation_source === 'string' ? route.query.conversation_source : 'all');
|
|
558
414
|
const clientConversations = ref<InstanceType<typeof ClientConversations> | null>(null);
|
|
559
415
|
const list = ref<any[]>([]);
|
|
560
416
|
const runFilters = reactive(readRunFilters(route.query));
|
|
561
|
-
const runFilterTime = ref(Date.now());
|
|
562
|
-
const runStatusLabels: Record<string, string> = { queued: '等待执行', running: '执行中', dispatched: '已派发', done: '已完成', error: '执行错误', rejected: '已拒绝' };
|
|
563
417
|
const hasRunFilters = computed(() => Boolean(runFilters.status || runFilters.route || runFilters.period !== 'all'));
|
|
564
|
-
const
|
|
565
|
-
const runRouteOptions = computed(() => [...new Set([...
|
|
418
|
+
const knownRunRoutes = ref<string[]>([]);
|
|
419
|
+
const runRouteOptions = computed(() => [...new Set([...knownRunRoutes.value, ...(runFilters.route ? [runFilters.route] : [])])].sort());
|
|
420
|
+
let requestedRunsKey: string | undefined;
|
|
421
|
+
function runSourceLabel(row: { source?: string; client_app_id?: string }): string {
|
|
422
|
+
const src = row.source || '';
|
|
423
|
+
if (src.startsWith('chat:')) return '网页助手 · ' + src.slice(5);
|
|
424
|
+
if (src.startsWith('wecom:')) return '企微 · ' + src.slice(6);
|
|
425
|
+
if (src.startsWith('agent:') || src.startsWith('agent-tool:')) return '客户端 · ' + (row.client_app_id || src.slice(src.indexOf(':') + 1));
|
|
426
|
+
if (src === 'delivery') return '结果送达';
|
|
427
|
+
if (src === 'admin') return '控制台';
|
|
428
|
+
return row.client_app_id || src || '未记录';
|
|
429
|
+
}
|
|
566
430
|
const loading = ref(false);
|
|
567
431
|
const runsError = ref(''), runsLoadedAt = ref('');
|
|
568
432
|
let runsGeneration = 0;
|
|
569
|
-
//
|
|
433
|
+
// 多取一条判断是否还有下一页,同秒的记录以 Job ID 排序。
|
|
570
434
|
const RUNS_PAGE = 50;
|
|
571
435
|
const runsMore = ref(false);
|
|
572
436
|
const moreLoading = ref(false);
|
|
@@ -580,7 +444,8 @@ const traceJobInput = ref(initialLocation.traceQ);
|
|
|
580
444
|
const traceLookupLoading = ref(false);
|
|
581
445
|
const traceLookupResult = ref<TracePayload | null>(null);
|
|
582
446
|
const traceLookupMatches = ref<any[]>([]);
|
|
583
|
-
const traceLookupError = ref(''), traceLoadedAt = ref('');
|
|
447
|
+
const traceLookupError = ref(''), traceLoadedAt = ref(''), traceEmptyFor = ref('');
|
|
448
|
+
const traceFrom = computed(() => queryText(route.query.trace_from));
|
|
584
449
|
let traceGeneration = 0, traceLoadedQuery = '', traceRequestedRaw = '';
|
|
585
450
|
|
|
586
451
|
// ---- 会话视图状态 ----
|
|
@@ -594,13 +459,8 @@ const threadsMore = ref(false);
|
|
|
594
459
|
const threadsMoreLoading = ref(false);
|
|
595
460
|
const threadQ = ref(initialLocation.threadQ);
|
|
596
461
|
const curThread = ref<number | null>(null);
|
|
597
|
-
const
|
|
598
|
-
const
|
|
599
|
-
const threadDataError = ref('');
|
|
600
|
-
let threadLoadGeneration = 0;
|
|
601
|
-
const paneRef = ref<HTMLElement | null>(null);
|
|
602
|
-
// 逐轮执行轨迹缓存:job:<id> / agent-run:<id> 分开命名,避免两类 UUID 语义混淆。
|
|
603
|
-
const traces = reactive<Record<string, ConversationTraceState>>({});
|
|
462
|
+
const lastOpenedThread = ref<number | null>(null);
|
|
463
|
+
const recordContents = ref<HTMLElement | null>(null);
|
|
604
464
|
const traceLookupJob = computed(() => traceLookupResult.value?.job ?? {});
|
|
605
465
|
const traceLookupEvents = computed(() => traceLookupResult.value ? normalizeTraceEvents(traceLookupResult.value) : []);
|
|
606
466
|
const traceLookupSummary = computed(() => traceLookupResult.value?.trace.summary ?? {});
|
|
@@ -620,75 +480,10 @@ const DETAIL_TRACE_STAGE_TO_GROUP = DETAIL_TRACE_GROUP_DEFS.reduce<Record<string
|
|
|
620
480
|
return acc;
|
|
621
481
|
}, {});
|
|
622
482
|
|
|
623
|
-
function statusType(st: string): 'success' | 'danger' | 'info' | 'warning' {
|
|
624
|
-
if (st === 'done' || st === 'completed') return 'success';
|
|
625
|
-
if (st === 'error' || st === 'rejected' || st === 'failed') return 'danger';
|
|
626
|
-
if (st === 'running' || st === 'dispatched' || st === 'preparing' || st === 'context_ready') return 'warning';
|
|
627
|
-
return 'info';
|
|
628
|
-
}
|
|
629
|
-
function traceStatusLabel(st: string): string {
|
|
630
|
-
const labels: Record<string, string> = {
|
|
631
|
-
completed: '已完成', failed: '失败', cancelled: '已取消', preparing: '准备中', context_ready: '上下文已就绪',
|
|
632
|
-
};
|
|
633
|
-
return labels[st] || st;
|
|
634
|
-
}
|
|
635
|
-
// 显示安全上限:审计要全量可追溯,但极端大内容(如几 MB 响应)整段塞进 DOM 会卡;
|
|
636
|
-
// 200K 字符够覆盖正常审计内容,超出才尾部标注(真实留存在后端审计,这里只是展示护栏)。
|
|
637
|
-
const SAFE_MAX = 200000;
|
|
638
|
-
function cap(s: string): string {
|
|
639
|
-
return s.length > SAFE_MAX ? s.slice(0, SAFE_MAX) + `\n…[显示已达上限 ${SAFE_MAX} 字符,完整内容见后端审计 / 重跑导出]` : s;
|
|
640
|
-
}
|
|
641
|
-
function detailLen(d: unknown): number {
|
|
642
|
-
const t = JSON.stringify(d ?? {});
|
|
643
|
-
return t === '{}' ? 0 : t.length;
|
|
644
|
-
}
|
|
645
|
-
// 折叠态的预览(一行):内容多时点箭头看 fullDetail 全量
|
|
646
|
-
function shortDetail(d: unknown): string {
|
|
647
|
-
const t = JSON.stringify(d ?? {});
|
|
648
|
-
return t === '{}' ? '' : (t.length > 200 ? t.slice(0, 200) + ' …' : t);
|
|
649
|
-
}
|
|
650
|
-
// 展开态:全量、易读的 pretty JSON(不截断,仅受 SAFE_MAX 展示护栏)
|
|
651
|
-
function fullDetail(d: unknown): string {
|
|
652
|
-
return cap(JSON.stringify(d ?? {}, null, 2));
|
|
653
|
-
}
|
|
654
483
|
const TOOL_MODE_LABEL: Record<string, string> = { retrieval: '语义检索注入', progressive: '渐进披露(目录+find_tools)', inline: '全量内联', none: '未注入工具' };
|
|
655
484
|
function normalizeTraceEvents(t: TracePayload): TraceEvent[] {
|
|
656
485
|
return t.trace.events;
|
|
657
486
|
}
|
|
658
|
-
function traceTitle(a: TraceEvent): string {
|
|
659
|
-
return a.title || a.event;
|
|
660
|
-
}
|
|
661
|
-
function traceSummaryText(a: TraceEvent): string {
|
|
662
|
-
return a.summary || '';
|
|
663
|
-
}
|
|
664
|
-
const STAGE_LABEL: Record<string, string> = {
|
|
665
|
-
launch: '入口',
|
|
666
|
-
context: '上下文',
|
|
667
|
-
execution: '执行',
|
|
668
|
-
tool: '工具',
|
|
669
|
-
approval: '审批',
|
|
670
|
-
delivery: '送达',
|
|
671
|
-
summary: '摘要',
|
|
672
|
-
recovery: '恢复',
|
|
673
|
-
channel: '渠道',
|
|
674
|
-
config: '配置',
|
|
675
|
-
system: '系统',
|
|
676
|
-
};
|
|
677
|
-
function traceStageLabel(stage?: string): string {
|
|
678
|
-
return STAGE_LABEL[stage || ''] || stage || '系统';
|
|
679
|
-
}
|
|
680
|
-
function traceStageType(stage?: string): 'success' | 'danger' | 'info' | 'warning' | 'primary' {
|
|
681
|
-
if (stage === 'tool') return 'primary';
|
|
682
|
-
if (stage === 'approval' || stage === 'recovery') return 'warning';
|
|
683
|
-
if (stage === 'delivery' || stage === 'summary') return 'success';
|
|
684
|
-
if (stage === 'context' || stage === 'execution') return 'info';
|
|
685
|
-
return 'info';
|
|
686
|
-
}
|
|
687
|
-
function traceSeverityType(severity?: string): 'success' | 'danger' | 'info' | 'warning' {
|
|
688
|
-
if (severity === 'error') return 'danger';
|
|
689
|
-
if (severity === 'warning') return 'warning';
|
|
690
|
-
return 'info';
|
|
691
|
-
}
|
|
692
487
|
function diagnosisType(severity?: string): 'success' | 'danger' | 'info' | 'warning' {
|
|
693
488
|
if (severity === 'error') return 'danger';
|
|
694
489
|
if (severity === 'warning') return 'warning';
|
|
@@ -699,12 +494,6 @@ function diagnosisLabel(severity?: string): string {
|
|
|
699
494
|
if (severity === 'warning') return '提醒';
|
|
700
495
|
return '信息';
|
|
701
496
|
}
|
|
702
|
-
// 工具摘要:详情抽屉与会话轨迹共用
|
|
703
|
-
function fmtTools(t: any): string {
|
|
704
|
-
if (!t || !t.provider) return '未挂工具';
|
|
705
|
-
const allow = Array.isArray(t.allow) ? t.allow.join(' / ') : '';
|
|
706
|
-
return `工具源 ${t.provider}(放行 scope:${allow || '无'};单任务上限 ${t.max_calls ?? 5})`;
|
|
707
|
-
}
|
|
708
497
|
const resultText = computed(() => {
|
|
709
498
|
const r = detail.value?.result ?? {};
|
|
710
499
|
if (typeof r.text === 'string' && r.text) return cap(r.text);
|
|
@@ -800,55 +589,6 @@ function detailGroupType(g: DetailTraceGroup): 'success' | 'danger' | 'info' | '
|
|
|
800
589
|
return 'info';
|
|
801
590
|
}
|
|
802
591
|
|
|
803
|
-
// ---- 会话标签:把内部的 channel / principal_id / scope_key 翻成人可读的通用主体 ----
|
|
804
|
-
// 接入方:业务接入方名 > 网页入口名 > 渠道解析(企微/控制台)
|
|
805
|
-
function partyLabel(t: any): string {
|
|
806
|
-
const ch = String(t.channel || '');
|
|
807
|
-
if (ch.startsWith('agent:')) return `智能体客户端 · ${t.client_name || ch.slice(6) || '未知接入方'}`;
|
|
808
|
-
if (t.client_name) return t.client_name;
|
|
809
|
-
if (t.entry_name) return t.entry_name;
|
|
810
|
-
if (ch.startsWith('chat:')) return '网页聊天';
|
|
811
|
-
if (ch.startsWith('wecom:')) return '企微·' + ch.slice(6);
|
|
812
|
-
if (ch === 'admin') return '控制台/自测';
|
|
813
|
-
if (ch === 'hub') return '中枢';
|
|
814
|
-
return ch || '—';
|
|
815
|
-
}
|
|
816
|
-
function partyVisible(t: any): boolean {
|
|
817
|
-
return partyLabel(t) !== '—';
|
|
818
|
-
}
|
|
819
|
-
function partyType(t: any): 'success' | 'warning' | 'primary' | 'info' | 'danger' {
|
|
820
|
-
const ch = String(t.channel || '');
|
|
821
|
-
if (ch.startsWith('agent:')) return 'primary';
|
|
822
|
-
if (t.client_name) return 'success';
|
|
823
|
-
if (ch.startsWith('wecom:')) return 'primary';
|
|
824
|
-
if (ch.startsWith('chat:')) return 'warning';
|
|
825
|
-
return 'info';
|
|
826
|
-
}
|
|
827
|
-
// 身份:principal_id 是接入方传入的业务主体编码,中枢不推断它的业务含义。
|
|
828
|
-
// 例如 uid:t1:u1621 只说明它是一个稳定主体,不等价于中枢能判断出“租户/用户”。
|
|
829
|
-
function whoLabel(t: any): string {
|
|
830
|
-
const p = String(t.principal_id || '');
|
|
831
|
-
if (p.startsWith('uid:')) {
|
|
832
|
-
const body = p.slice(4);
|
|
833
|
-
return body ? `身份 ${body}` : '身份';
|
|
834
|
-
}
|
|
835
|
-
if (p.startsWith('visitor:')) return '访客 ' + p.slice(8, 16);
|
|
836
|
-
if (p.startsWith('wxuid:')) return '企微 ' + p.slice(6);
|
|
837
|
-
if (p) return p;
|
|
838
|
-
const sc = String(t.scope_key || '');
|
|
839
|
-
if (sc.startsWith('req:')) return '单次任务 ' + sc.slice(4, 16);
|
|
840
|
-
return sc ? sc.slice(-24) : '匿名';
|
|
841
|
-
}
|
|
842
|
-
function messageActorLabel(message: ThreadMessage, thread: any): string {
|
|
843
|
-
if (message.direction === 'in') return whoLabel(thread);
|
|
844
|
-
return message.agent_run_id ? '本地智能体' : '中枢';
|
|
845
|
-
}
|
|
846
|
-
function identityTitle(t: any): string {
|
|
847
|
-
const p = String(t.principal_id || '');
|
|
848
|
-
const sc = String(t.scope_key || '');
|
|
849
|
-
return [p ? `principal_id: ${p}` : '', sc ? `scope_key: ${sc}` : ''].filter(Boolean).join('\n');
|
|
850
|
-
}
|
|
851
|
-
|
|
852
592
|
const filteredThreads = computed(() => {
|
|
853
593
|
const q = threadQ.value.trim().toLowerCase();
|
|
854
594
|
if (!q) return threads.value;
|
|
@@ -858,84 +598,47 @@ const filteredThreads = computed(() => {
|
|
|
858
598
|
});
|
|
859
599
|
});
|
|
860
600
|
|
|
861
|
-
function
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
.filter((message) => message.direction === 'out' && !!message.agent_run_id)
|
|
867
|
-
.map((message) => message.agent_run_id as string),
|
|
868
|
-
));
|
|
869
|
-
function shouldShowMessageTrace(message: ThreadMessage): boolean {
|
|
870
|
-
if (message.direction === 'out') return !!(message.job_id || message.agent_run_id);
|
|
871
|
-
// 客户端在 complete 前崩溃或断网时只有入站消息;此时仍需从该轮入站气泡进入排障轨迹。
|
|
872
|
-
return !!message.agent_run_id && !agentRunIdsWithOutput.value.has(message.agent_run_id);
|
|
873
|
-
}
|
|
874
|
-
function isAgentTrace(key: string): boolean {
|
|
875
|
-
return traces[key]?.kind === 'agent-run';
|
|
876
|
-
}
|
|
877
|
-
function traceSourceLabel(source: TraceEvent['source']): string {
|
|
878
|
-
return source === 'local_agent' ? '本地编排' : '中枢治理';
|
|
879
|
-
}
|
|
880
|
-
function invocationStateLabel(invocation: AgentRunInvocation): string {
|
|
881
|
-
if (invocation.approval_status === 'denied') return '审批拒绝';
|
|
882
|
-
if (invocation.approval_status === 'pending') return '等待审批';
|
|
883
|
-
if (invocation.approval_status === 'approved' && invocation.state === 'awaiting_approval') return '已批准,等待本地智能体续执行';
|
|
884
|
-
const labels: Record<string, string> = {
|
|
885
|
-
executed: '执行成功', business_rejected: '业务拒绝', awaiting_approval: '等待审批', denied: '审批拒绝',
|
|
886
|
-
rejected_before_dispatch: '派发前拦截', reconciliation_required: '需要人工对账', in_progress: '执行中',
|
|
887
|
-
};
|
|
888
|
-
return labels[invocation.state || ''] || invocation.state || traceStatusLabel(invocation.status);
|
|
889
|
-
}
|
|
890
|
-
// 轨迹徽标(懒拉后才有):工具次数 / 识图次数 / 耗时
|
|
891
|
-
function traceBadge(key: string): string {
|
|
892
|
-
const tr = traces[key];
|
|
893
|
-
if (!tr || !tr.detail) return '';
|
|
894
|
-
const parts: string[] = [];
|
|
895
|
-
const tools = tr.summary?.tool_invocations ?? tr.summary?.tool_results ?? (tr.events || []).filter((a) => a.event === 'tool_result').length;
|
|
896
|
-
if (tools) parts.push(tools + ' 次工具');
|
|
897
|
-
const vc = tr.summary?.perceptions ?? (tr.events || []).filter((a) => a.event === 'perception').length;
|
|
898
|
-
if (vc) parts.push(vc + ' 次识图');
|
|
899
|
-
const warn = tr.summary?.warning_count ?? 0;
|
|
900
|
-
if (warn) parts.push(warn + ' 警告');
|
|
901
|
-
const err = tr.summary?.error_count ?? 0;
|
|
902
|
-
if (err) parts.push(err + ' 错误');
|
|
903
|
-
const dur = traceDuration(key);
|
|
904
|
-
if (dur) parts.push((dur / 1000).toFixed(1) + 's');
|
|
905
|
-
return parts.length ? '· ' + parts.join(' · ') : '';
|
|
906
|
-
}
|
|
907
|
-
function traceModel(key: string): string {
|
|
908
|
-
const d = traces[key]?.detail;
|
|
909
|
-
return String(d?.model || d?.runtime || d?.dispatch?.target_config?.model || d?.target || '');
|
|
910
|
-
}
|
|
911
|
-
function traceDuration(key: string): number {
|
|
912
|
-
const trace = traces[key];
|
|
913
|
-
return Number(trace?.summary?.duration_ms ?? trace?.detail?.usage?.duration_ms ?? 0) || 0;
|
|
914
|
-
}
|
|
915
|
-
function traceTokenCount(key: string): number {
|
|
916
|
-
const usage = traces[key]?.detail?.usage ?? {};
|
|
917
|
-
return Number(usage.total_tokens ?? usage.tokens ?? 0) || 0;
|
|
601
|
+
function applyRunPage(rows: any[], append: boolean): void {
|
|
602
|
+
const page = rows.slice(0, RUNS_PAGE);
|
|
603
|
+
list.value = append ? [...list.value, ...page] : page;
|
|
604
|
+
runsMore.value = rows.length > RUNS_PAGE;
|
|
605
|
+
knownRunRoutes.value = [...new Set([...knownRunRoutes.value, ...page.map(runRouteKey).filter(Boolean)])];
|
|
918
606
|
}
|
|
919
607
|
|
|
920
608
|
async function load(): Promise<void> {
|
|
921
609
|
const generation = ++runsGeneration;
|
|
922
|
-
|
|
610
|
+
const query = runFilterParams(runFilters);
|
|
611
|
+
const key = query.toString();
|
|
612
|
+
if (key !== requestedRunsKey) { list.value = []; runsMore.value = false; runsLoadedAt.value = ''; }
|
|
613
|
+
requestedRunsKey = key;
|
|
614
|
+
loading.value = true; moreLoading.value = false; runsError.value = '';
|
|
615
|
+
query.set('limit', String(RUNS_PAGE + 1)); query.set('offset', '0');
|
|
923
616
|
try {
|
|
924
|
-
const rows = await api<any[]>(
|
|
617
|
+
const rows = await api<any[]>('/admin/api/runs?' + query);
|
|
925
618
|
if (generation !== runsGeneration) return;
|
|
926
|
-
|
|
927
|
-
} catch
|
|
619
|
+
applyRunPage(rows, false); runsLoadedAt.value = new Date().toISOString();
|
|
620
|
+
} catch (error) {
|
|
621
|
+
if (generation === runsGeneration) runsError.value = (error as Error).message || '暂时无法读取任务列表,请刷新重试。';
|
|
622
|
+
}
|
|
928
623
|
finally { if (generation === runsGeneration) loading.value = false; }
|
|
929
624
|
}
|
|
930
625
|
async function loadMoreRuns(): Promise<void> {
|
|
931
|
-
if (loading.value || moreLoading.value) return;
|
|
626
|
+
if (loading.value || moreLoading.value || !runsMore.value) return;
|
|
932
627
|
const generation = runsGeneration;
|
|
628
|
+
const query = runFilterParams(runFilters);
|
|
629
|
+
if (query.toString() !== requestedRunsKey) return;
|
|
630
|
+
query.set('limit', String(RUNS_PAGE + 1)); query.set('offset', String(list.value.length));
|
|
631
|
+
const last = list.value.at(-1);
|
|
632
|
+
if (last?.created_at && last.job_id) {
|
|
633
|
+
query.set('before_created_at', last.created_at);
|
|
634
|
+
query.set('before_job_id', last.job_id);
|
|
635
|
+
}
|
|
933
636
|
moreLoading.value = true;
|
|
934
637
|
try {
|
|
935
|
-
const rows = await api<any[]>(
|
|
936
|
-
if (generation === runsGeneration)
|
|
937
|
-
} catch (e) { ElMessage.error((e as Error).message); }
|
|
938
|
-
finally { moreLoading.value = false; }
|
|
638
|
+
const rows = await api<any[]>('/admin/api/runs?' + query);
|
|
639
|
+
if (generation === runsGeneration) applyRunPage(rows, true);
|
|
640
|
+
} catch (e) { if (generation === runsGeneration) ElMessage.error((e as Error).message); }
|
|
641
|
+
finally { if (generation === runsGeneration) moreLoading.value = false; }
|
|
939
642
|
}
|
|
940
643
|
async function loadThreads(): Promise<void> {
|
|
941
644
|
const generation = ++threadsGeneration;
|
|
@@ -958,78 +661,37 @@ async function loadMoreThreads(): Promise<void> {
|
|
|
958
661
|
} catch (e) { ElMessage.error((e as Error).message); }
|
|
959
662
|
finally { threadsMoreLoading.value = false; }
|
|
960
663
|
}
|
|
961
|
-
// 聊天场景:进会话直接落在最新消息(最底部),看历史自己向上翻——而不是每次从顶部往下翻
|
|
962
|
-
function scrollPaneToBottom(): void {
|
|
963
|
-
const el = paneRef.value;
|
|
964
|
-
if (el) el.scrollTop = el.scrollHeight;
|
|
965
|
-
}
|
|
966
|
-
async function loadThread(id: number): Promise<void> {
|
|
967
|
-
const generation = ++threadLoadGeneration;
|
|
968
|
-
if (curThread.value !== id) threadData.value = null;
|
|
969
|
-
curThread.value = id;
|
|
970
|
-
threadDataLoading.value = true; threadDataError.value = '';
|
|
971
|
-
// 切会话清空轨迹缓存(避免不同会话的 job 串台占内存)
|
|
972
|
-
for (const k of Object.keys(traces)) delete traces[k];
|
|
973
|
-
try {
|
|
974
|
-
const data = await api<{ thread: any; messages: ThreadMessage[] }>('/admin/api/threads/' + id);
|
|
975
|
-
if (generation === threadLoadGeneration) threadData.value = data;
|
|
976
|
-
}
|
|
977
|
-
catch { if (generation === threadLoadGeneration) threadDataError.value = threadData.value ? '会话读取失败,当前展示旧快照,请刷新重试。' : '未能读取此会话,请刷新重试。'; }
|
|
978
|
-
finally { if (generation === threadLoadGeneration) threadDataLoading.value = false; }
|
|
979
|
-
if (generation === threadLoadGeneration && threadData.value) {
|
|
980
|
-
await nextTick();
|
|
981
|
-
scrollPaneToBottom();
|
|
982
|
-
setTimeout(() => { if (generation === threadLoadGeneration) scrollPaneToBottom(); }, 150); // 图片/异步内容撑高后再贴底
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
async function toggleTrace(message: ThreadMessage): Promise<void> {
|
|
986
|
-
const generation = threadLoadGeneration;
|
|
987
|
-
const key = traceKey(message);
|
|
988
|
-
const cur = traces[key];
|
|
989
|
-
if (cur?.open) { cur.open = false; return; }
|
|
990
|
-
if (cur?.detail) { cur.open = true; return; }
|
|
991
|
-
const kind: ConversationTraceState['kind'] = message.job_id ? 'job' : 'agent-run';
|
|
992
|
-
traces[key] = { kind, open: true, loading: true, detail: null, events: [], summary: null, invocations: [] };
|
|
993
|
-
try {
|
|
994
|
-
if (message.job_id) {
|
|
995
|
-
const t = await api<TracePayload>('/admin/api/runs/' + message.job_id + '/trace');
|
|
996
|
-
if (generation !== threadLoadGeneration) return;
|
|
997
|
-
traces[key] = { kind, open: true, loading: false, detail: t.job, events: normalizeTraceEvents(t), summary: t.trace.summary ?? null, invocations: [] };
|
|
998
|
-
} else if (message.agent_run_id && curThread.value) {
|
|
999
|
-
const t = await api<AgentRunTracePayload>(`/admin/api/threads/${curThread.value}/agent-runs/${message.agent_run_id}/trace`);
|
|
1000
|
-
if (generation !== threadLoadGeneration) return;
|
|
1001
|
-
traces[key] = { kind, open: true, loading: false, detail: t.run, events: t.trace.events, summary: t.trace.summary ?? null, invocations: t.invocations ?? [] };
|
|
1002
|
-
} else {
|
|
1003
|
-
throw new Error('该轮缺少可追溯标识');
|
|
1004
|
-
}
|
|
1005
|
-
} catch (e) {
|
|
1006
|
-
if (generation !== threadLoadGeneration) return;
|
|
1007
|
-
traces[key] = { kind, open: true, loading: false, detail: null, events: [], summary: null, invocations: [] };
|
|
1008
|
-
ElMessage.error((e as Error).message);
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
664
|
function onTab(name: string): void {
|
|
1012
665
|
if (name === readRunsLocation(route.query).tab) return;
|
|
1013
|
-
void router.push({ query: patchTaskQuery(route.query, { tab: runsTabQuery(name as RunsTab)
|
|
666
|
+
void router.push({ query: patchTaskQuery(route.query, { tab: runsTabQuery(name as RunsTab) }) });
|
|
667
|
+
}
|
|
668
|
+
function openRecordDirectory(): void { gotoThread(); }
|
|
669
|
+
function closeRecordDrawer(): void {
|
|
670
|
+
const { position, rawRecordsOrigin } = router.options.history.state;
|
|
671
|
+
if (typeof position === 'number' && typeof rawRecordsOrigin === 'number' && rawRecordsOrigin < position) {
|
|
672
|
+
router.go(rawRecordsOrigin - position);
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
// A bookmark has no in-app opener; keep its optional conversation, turn and return destination.
|
|
676
|
+
void router.replace({ query: patchTaskQuery(route.query, { tab: 'conversations', view: 'audit', thread: undefined }) });
|
|
677
|
+
}
|
|
678
|
+
function backToRecordDirectory(): void {
|
|
679
|
+
const query = patchTaskQuery(route.query, { tab: 'conversations', view: 'legacy', thread: undefined });
|
|
680
|
+
if (router.options.history.state.back === router.resolve({ query }).fullPath) router.back();
|
|
681
|
+
else void router.replace({ query });
|
|
1014
682
|
}
|
|
1015
|
-
function
|
|
1016
|
-
|
|
683
|
+
function refreshRecords(): void {
|
|
684
|
+
if (curThread.value) void rawTranscript.value?.refresh(); else void loadThreads();
|
|
1017
685
|
}
|
|
1018
686
|
function persistThreadSearch(): void { void router.replace({ query: patchTaskQuery(route.query, { thread_q: threadQ.value || undefined }) }); }
|
|
1019
687
|
function persistRunFilters(): void {
|
|
1020
|
-
runFilterTime.value = Date.now();
|
|
1021
688
|
void router.replace({ query: patchTaskQuery(route.query, { tab: 'jobs', run_status: runFilters.status || undefined,
|
|
1022
689
|
run_route: runFilters.route.trim() || undefined, run_period: runFilters.period === 'all' ? undefined : runFilters.period }) });
|
|
1023
690
|
}
|
|
1024
691
|
function clearRunFilters(): void { Object.assign(runFilters, { status: '', route: '', period: 'all' }); persistRunFilters(); }
|
|
1025
|
-
async function openThread(id: number): Promise<void> {
|
|
1026
|
-
if (curThread.value === id && conversationView.value === 'legacy') { await loadThread(id); return; }
|
|
1027
|
-
await router.push({ query: patchTaskQuery(route.query, { tab: 'conversations', view: 'legacy', thread: String(id), detail: undefined }) });
|
|
1028
|
-
}
|
|
1029
692
|
function refresh(): void {
|
|
1030
693
|
if (activeTab.value === 'notifications') void notificationPanel.value?.refresh();
|
|
1031
|
-
else if (activeTab.value === 'threads'
|
|
1032
|
-
else if (activeTab.value === 'threads') { void loadThreads(); if (curThread.value) void loadThread(curThread.value); }
|
|
694
|
+
else if (activeTab.value === 'threads') void clientConversations.value?.refresh();
|
|
1033
695
|
else if (activeTab.value === 'trace') { if (traceJobInput.value.trim()) void lookupJobTrace(); }
|
|
1034
696
|
else void load();
|
|
1035
697
|
}
|
|
@@ -1055,11 +717,12 @@ async function lookupJobTrace(persist = true): Promise<void> {
|
|
|
1055
717
|
const raw = traceJobInput.value.trim();
|
|
1056
718
|
if (!raw) { ElMessage.error('请输入要追溯的标识'); return; }
|
|
1057
719
|
traceRequestedRaw = raw;
|
|
1058
|
-
if (persist) void router.replace({ query: patchTaskQuery(route.query, { tab: 'trace', trace_q: raw, job: undefined
|
|
720
|
+
if (persist) void router.replace({ query: patchTaskQuery(route.query, { tab: 'trace', trace_q: raw, job: undefined,
|
|
721
|
+
trace_from: raw === queryText(route.query.trace_q) ? traceFrom.value : undefined }) });
|
|
1059
722
|
const q = traceLookupQuery(raw);
|
|
1060
723
|
const generation = ++traceGeneration;
|
|
1061
724
|
if (q !== traceLoadedQuery) { traceLookupResult.value = null; traceLookupMatches.value = []; }
|
|
1062
|
-
traceLookupLoading.value = true; traceLookupError.value = '';
|
|
725
|
+
traceLookupLoading.value = true; traceLookupError.value = ''; traceEmptyFor.value = '';
|
|
1063
726
|
try {
|
|
1064
727
|
const got = await api<TracePayload & { matches?: any[]; count?: number }>('/admin/api/runs/trace?' + q);
|
|
1065
728
|
if (generation !== traceGeneration) return;
|
|
@@ -1070,9 +733,14 @@ async function lookupJobTrace(persist = true): Promise<void> {
|
|
|
1070
733
|
} else {
|
|
1071
734
|
traceLookupResult.value = null;
|
|
1072
735
|
traceLookupMatches.value = got.matches ?? [];
|
|
1073
|
-
if (!traceLookupMatches.value.length)
|
|
736
|
+
if (!traceLookupMatches.value.length) traceEmptyFor.value = raw;
|
|
1074
737
|
}
|
|
1075
|
-
} catch
|
|
738
|
+
} catch (error) {
|
|
739
|
+
if (generation !== traceGeneration) return;
|
|
740
|
+
if (error instanceof ApiError && error.status === 404 && error.message === 'job 不存在') {
|
|
741
|
+
traceLookupResult.value = null; traceLookupMatches.value = []; traceEmptyFor.value = raw;
|
|
742
|
+
} else traceLookupError.value = '暂时无法读取追溯结果,请刷新重试。';
|
|
743
|
+
}
|
|
1076
744
|
finally { if (generation === traceGeneration) traceLookupLoading.value = false; }
|
|
1077
745
|
}
|
|
1078
746
|
function traceLookupQuery(raw: string): string {
|
|
@@ -1084,9 +752,16 @@ function traceLookupQuery(raw: string): string {
|
|
|
1084
752
|
else p.set('request_id', raw);
|
|
1085
753
|
return p.toString();
|
|
1086
754
|
}
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
755
|
+
function openTraceMatch(row: { job_id: string }): void {
|
|
756
|
+
void router.push({ query: patchTaskQuery(route.query, { tab: 'trace', job: undefined, trace_q: row.job_id, trace_from: traceRequestedRaw }) });
|
|
757
|
+
}
|
|
758
|
+
function returnToTraceMatches(): void {
|
|
759
|
+
const query = patchTaskQuery(route.query, { trace_q: traceFrom.value, trace_from: undefined });
|
|
760
|
+
if (router.options.history.state.back === router.resolve({ query }).fullPath) router.back();
|
|
761
|
+
else void router.replace({ query });
|
|
762
|
+
}
|
|
763
|
+
function clearTraceLookup(): void {
|
|
764
|
+
void router.replace({ query: patchTaskQuery(route.query, { trace_q: undefined, trace_from: undefined, job: undefined }) });
|
|
1090
765
|
}
|
|
1091
766
|
function openTraceLookupDetail(): void {
|
|
1092
767
|
if (!traceLookupResult.value) return;
|
|
@@ -1100,12 +775,10 @@ function openTraceLookupDetail(): void {
|
|
|
1100
775
|
detailOpen.value = true;
|
|
1101
776
|
void router.push({ query: patchTaskQuery(route.query, { tab: 'trace', detail: detailJobId.value }) });
|
|
1102
777
|
}
|
|
1103
|
-
function
|
|
1104
|
-
|
|
1105
|
-
if (
|
|
1106
|
-
|
|
1107
|
-
void router.replace({ query: patchTaskQuery(route.query, { tab: runsTabQuery(activeTab.value), detail: undefined }) });
|
|
1108
|
-
}
|
|
778
|
+
function closeJobDetail(): void {
|
|
779
|
+
const query = patchTaskQuery(route.query, { tab: runsTabQuery(activeTab.value), detail: undefined });
|
|
780
|
+
if (router.options.history.state.back === router.resolve({ query }).fullPath) router.back();
|
|
781
|
+
else void router.replace({ query });
|
|
1109
782
|
}
|
|
1110
783
|
async function copyJobId(jobId: string): Promise<void> {
|
|
1111
784
|
try { await navigator.clipboard.writeText(jobId); ElMessage.success('已复制原 Job ID,可用于核对原调用结果'); }
|
|
@@ -1162,15 +835,26 @@ async function copyTraceDebugReport(): Promise<void> {
|
|
|
1162
835
|
ElMessage.error('复制失败,请下载排障报告');
|
|
1163
836
|
}
|
|
1164
837
|
}
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
838
|
+
function gotoThread(threadId?: number): void {
|
|
839
|
+
const { position, rawRecordsOrigin } = router.options.history.state;
|
|
840
|
+
const origin = recordDrawerOpen.value ? rawRecordsOrigin : position;
|
|
841
|
+
void router.push({
|
|
842
|
+
query: patchTaskQuery(route.query, { tab: 'conversations', view: 'legacy', detail: undefined, job: undefined, thread: threadId ? String(threadId) : undefined }),
|
|
843
|
+
state: { rawRecordsOrigin: typeof origin === 'number' ? origin : null },
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
function selectAuditConversation(id: string): void { gotoAuditConversation(id); }
|
|
847
|
+
function selectChannelThread(id: number): void {
|
|
848
|
+
void router.push({ query: patchTaskQuery(route.query, { tab: 'conversations', view: 'audit', channel_thread: String(id), conversation: undefined, turn: undefined, thread: undefined, detail: undefined, job: undefined }) });
|
|
849
|
+
}
|
|
850
|
+
function changeConversationSource(source: string): void {
|
|
851
|
+
void router.push({ query: patchTaskQuery(route.query, { tab: 'conversations', view: 'audit', conversation_source: source === 'all' ? undefined : source, channel_thread: undefined, conversation: undefined, turn: undefined, thread: undefined, detail: undefined, job: undefined }) });
|
|
1168
852
|
}
|
|
1169
|
-
function
|
|
1170
|
-
|
|
853
|
+
function backToConversationList(): void {
|
|
854
|
+
void router.push({ query: patchTaskQuery(route.query, { tab: 'conversations', view: 'audit', thread: undefined, channel_thread: undefined, conversation: undefined, turn: undefined }) });
|
|
1171
855
|
}
|
|
1172
856
|
function gotoAuditConversation(id: string, turnId?: string): void {
|
|
1173
|
-
void router.push({ query: patchTaskQuery(route.query, { tab: 'conversations', view: 'audit', detail: undefined, job: undefined, conversation: id, turn: turnId || undefined }) });
|
|
857
|
+
void router.push({ query: patchTaskQuery(route.query, { tab: 'conversations', view: 'audit', detail: undefined, job: undefined, thread: undefined, channel_thread: undefined, conversation: id, turn: turnId || undefined }) });
|
|
1174
858
|
}
|
|
1175
859
|
async function rerun(): Promise<void> {
|
|
1176
860
|
if (!canRerun.value || detailLoading.value || detailError.value || rerunning.value) return;
|
|
@@ -1188,28 +872,41 @@ async function rerun(): Promise<void> {
|
|
|
1188
872
|
function applyLocation(): void {
|
|
1189
873
|
if (route.path !== '/runs') return;
|
|
1190
874
|
const location = readRunsLocation(route.query);
|
|
1191
|
-
Object.assign(runFilters, readRunFilters(route.query));
|
|
1192
|
-
|
|
875
|
+
Object.assign(runFilters, readRunFilters(route.query));
|
|
876
|
+
if (location.tab === 'runs' && runFilterParams(runFilters).toString() !== requestedRunsKey) void load();
|
|
877
|
+
activeTab.value = location.tab;
|
|
1193
878
|
auditConversationId.value = location.conversation; auditTurnId.value = location.turn;
|
|
1194
879
|
threadQ.value = location.threadQ; traceJobInput.value = location.traceQ;
|
|
1195
880
|
if (location.tab === 'threads' && location.view === 'legacy') {
|
|
1196
|
-
if (!threadsLoaded.value && !threadsLoading.value) void loadThreads();
|
|
1197
|
-
|
|
1198
|
-
|
|
881
|
+
if (!location.thread && !threadsLoaded.value && !threadsLoading.value) void loadThreads();
|
|
882
|
+
curThread.value = location.thread;
|
|
883
|
+
if (location.thread) lastOpenedThread.value = location.thread;
|
|
1199
884
|
}
|
|
1200
885
|
if (location.tab === 'trace' && location.traceQ && location.traceQ !== traceRequestedRaw) void lookupJobTrace(false);
|
|
1201
|
-
else if (!location.traceQ) { traceGeneration++; traceRequestedRaw = ''; traceLoadedQuery = ''; traceLookupResult.value = null; traceLookupMatches.value = []; traceLookupError.value = ''; traceLookupLoading.value = false; }
|
|
886
|
+
else if (!location.traceQ) { traceGeneration++; traceRequestedRaw = ''; traceLoadedQuery = ''; traceEmptyFor.value = ''; traceLookupResult.value = null; traceLookupMatches.value = []; traceLookupError.value = ''; traceLookupLoading.value = false; }
|
|
1202
887
|
if (location.detail && (!detailOpen.value || detailJobId.value !== location.detail)) void loadDetail(location.detail);
|
|
1203
888
|
else if (!location.detail && detailOpen.value) { detailGeneration++; detailOpen.value = false; detailLoading.value = false; detailJobId.value = ''; }
|
|
1204
889
|
}
|
|
1205
|
-
|
|
890
|
+
watch(curThread, async (id, previous) => {
|
|
891
|
+
if (!recordDrawerOpen.value || !recordContents.value) return;
|
|
892
|
+
await nextTick();
|
|
893
|
+
const selector = id ? '[data-record-list]' : `[data-thread-id="${previous}"]`;
|
|
894
|
+
const target = recordContents.value?.querySelector<HTMLElement>(selector) || recordContents.value?.querySelector('input');
|
|
895
|
+
target?.focus({ preventScroll: true });
|
|
896
|
+
});
|
|
897
|
+
onMounted(applyLocation);
|
|
1206
898
|
watch(() => route.query, applyLocation);
|
|
1207
899
|
</script>
|
|
1208
900
|
|
|
1209
901
|
<style scoped>
|
|
1210
902
|
.muted { color: var(--el-text-color-secondary); font-size: 12px; }
|
|
903
|
+
.runCount { margin: 6px 0; }
|
|
904
|
+
.runsTable { cursor: pointer; }
|
|
905
|
+
.runCellLine { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
906
|
+
.runSubject { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; max-width: 100%; overflow: hidden; white-space: normal; overflow-wrap: anywhere; line-height: 1.45; padding: 0; border: 0; background: transparent; cursor: pointer; font-family: inherit; font-size: inherit; font-weight: 600; text-align: left; color: var(--el-text-color-primary); }
|
|
907
|
+
.runSubject:hover, .runSubject:focus-visible { color: var(--el-color-primary); text-decoration: underline; }
|
|
908
|
+
.errorText { color: var(--el-color-danger); }
|
|
1211
909
|
.run-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 4px 0 14px; }
|
|
1212
|
-
.conversationViewSwitch { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
|
|
1213
910
|
.dangerText { color: var(--el-color-danger); }
|
|
1214
911
|
.warningText { color: var(--el-color-warning); }
|
|
1215
912
|
.loadmore { text-align: center; padding: 12px 0 4px; }
|
|
@@ -1242,8 +939,8 @@ watch(() => route.query, applyLocation);
|
|
|
1242
939
|
.auditcoll :deep(.el-collapse-item__content) { padding-bottom: 6px; }
|
|
1243
940
|
.auditcoll :deep(.el-collapse-item__wrap) { border-bottom: none; }
|
|
1244
941
|
|
|
1245
|
-
:
|
|
1246
|
-
:
|
|
942
|
+
:global(.runDetailDrawer .el-drawer__header) { margin-bottom: 0; padding: 18px 22px 12px; border-bottom: 1px solid var(--el-border-color-lighter); }
|
|
943
|
+
:global(.runDetailDrawer .el-drawer__body) { padding: 16px 22px 24px; }
|
|
1247
944
|
.detailHero { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--el-border-color-lighter); border-radius: 0; background: var(--el-fill-color-light); margin-bottom: 12px; }
|
|
1248
945
|
.detailHeroMain { min-width: 0; flex: 1; }
|
|
1249
946
|
.detailTags { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
|
|
@@ -1281,51 +978,26 @@ watch(() => route.query, applyLocation);
|
|
|
1281
978
|
.detailContextGrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 10px; }
|
|
1282
979
|
.sectionHint { margin-bottom: 6px; }
|
|
1283
980
|
|
|
1284
|
-
|
|
1285
|
-
.
|
|
1286
|
-
.
|
|
1287
|
-
.
|
|
981
|
+
/* 授权与业务接入记录侧栏 */
|
|
982
|
+
:global(.rawRecordDrawer .el-drawer__header) { margin-bottom: 0; padding: 16px 20px; border-bottom: 1px solid var(--el-border-color-lighter); }
|
|
983
|
+
:global(.rawRecordDrawer .el-drawer__body) { padding: 0; min-height: 0; }
|
|
984
|
+
.recordContents { display: flex; flex-direction: column; height: 100%; }
|
|
985
|
+
.recordTools { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--el-border-color-lighter); }
|
|
986
|
+
.rail { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--el-bg-color); }
|
|
987
|
+
.railsearch { padding: 10px 16px; }
|
|
1288
988
|
.raillist { flex: 1; overflow-y: auto; }
|
|
1289
|
-
.threaditem { padding:
|
|
989
|
+
.threaditem { display: block; width: 100%; text-align: left; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--el-border-color-lighter); background: transparent; color: inherit; font: inherit; cursor: pointer; }
|
|
1290
990
|
.threaditem:hover { background: var(--el-fill-color-light); }
|
|
1291
|
-
.threaditem.active { background: var(--el-color-primary-light-9);
|
|
991
|
+
.threaditem.active { background: var(--el-color-primary-light-9); }
|
|
992
|
+
.threaditem.active .who { color: var(--el-color-primary); }
|
|
993
|
+
.threaditem:focus-visible { outline: 2px solid var(--el-color-primary); outline-offset: -2px; }
|
|
1292
994
|
.trow1 { display: flex; align-items: center; gap: 6px; }
|
|
1293
995
|
.trow1 .who { font-weight: 600; color: var(--el-text-color-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1294
996
|
.trow1 .tcount { margin-left: auto; flex: none; }
|
|
1295
997
|
.tprev { margin: 3px 0 2px; font-size: 12px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
|
1296
998
|
.tmeta { font-size: 11px; }
|
|
1297
|
-
.
|
|
1298
|
-
.
|
|
1299
|
-
.ph1 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
|
|
1300
|
-
.ph2 { margin-top: 4px; word-break: break-all; }
|
|
1301
|
-
.summcoll { margin-bottom: 8px; }
|
|
1302
|
-
.chat { display: flex; flex-direction: column; gap: 14px; padding-top: 6px; }
|
|
1303
|
-
.turn { display: flex; }
|
|
1304
|
-
.turn.fromUser { justify-content: flex-end; }
|
|
1305
|
-
.turn.fromHub { justify-content: flex-start; }
|
|
1306
|
-
.bubbleWrap { max-width: 80%; min-width: 0; }
|
|
1307
|
-
.bMeta { font-size: 11px; margin-bottom: 3px; }
|
|
1308
|
-
.turn.fromUser .bMeta { text-align: right; }
|
|
1309
|
-
.bubble { border-radius: 0; padding: 8px 12px; word-break: break-word; }
|
|
1310
|
-
.turn.fromUser .bubble { background: var(--el-color-primary-light-9); border: 1px solid var(--el-color-primary-light-7); }
|
|
1311
|
-
.turn.fromHub .bubble { background: var(--el-fill-color-light); border: 1px solid var(--el-border-color-lighter); }
|
|
1312
|
-
.traceLine { margin-top: 4px; }
|
|
1313
|
-
.tracetoggle { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--el-text-color-secondary); cursor: pointer; user-select: none; }
|
|
1314
|
-
.tracetoggle:hover { color: var(--el-color-primary); }
|
|
1315
|
-
.traceCaret { width: 10px; height: 10px; color: currentColor; transform: rotate(-90deg); transition: transform .14s ease; flex: none; }
|
|
1316
|
-
.traceCaret.open { transform: rotate(0deg); }
|
|
1317
|
-
.tracebox { margin-top: 6px; padding: 10px 12px; border: 1px dashed var(--el-border-color); border-radius: 0; background: var(--el-fill-color-blank); }
|
|
1318
|
-
.traceDetailBtn { margin-top: 4px; height: 26px; padding: 0 10px; }
|
|
1319
|
-
.tmeta2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
|
|
1320
|
-
.agentTraceHint { margin: 6px 0 9px; padding: 7px 9px; border-left: 3px solid var(--el-color-primary-light-3); background: var(--el-color-primary-light-9); color: var(--el-text-color-regular); font-size: 12px; line-height: 1.55; }
|
|
1321
|
-
.agentTracePartial { margin: 6px 0 9px; padding: 7px 9px; border-left: 3px solid var(--el-color-warning); background: var(--el-color-warning-light-9); color: var(--el-text-color-regular); font-size: 12px; line-height: 1.55; }
|
|
1322
|
-
.agentInvocations { display: flex; flex-direction: column; gap: 5px; margin: 7px 0 10px; }
|
|
1323
|
-
.agentInvocation { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; min-height: 28px; padding: 4px 7px; border: 1px solid var(--el-border-color-lighter); background: var(--el-fill-color-light); }
|
|
1324
|
-
.agentInvocation :deep(.el-button) { margin-left: auto; }
|
|
1325
|
-
.traceSource { margin-left: 8px; vertical-align: 1px; }
|
|
1326
|
-
.tline { padding-left: 4px; margin-top: 4px; }
|
|
1327
|
-
.notrace { font-size: 12px; margin: 4px 0; }
|
|
1328
|
-
.traceLookup { max-width: 720px; margin-bottom: 14px; }
|
|
999
|
+
.traceLookup { display: flex; align-items: center; gap: 6px; max-width: 720px; margin-bottom: 14px; }
|
|
1000
|
+
.traceReturn { margin-bottom: 12px; }
|
|
1329
1001
|
.traceMatches { margin-bottom: 14px; cursor: pointer; }
|
|
1330
1002
|
.tracePanel { border: 1px solid var(--el-border-color-lighter); border-radius: 0; padding: 14px 16px; background: var(--el-bg-color); }
|
|
1331
1003
|
.traceHead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
|
|
@@ -1361,7 +1033,7 @@ watch(() => route.query, applyLocation);
|
|
|
1361
1033
|
.debugGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
1362
1034
|
}
|
|
1363
1035
|
@media (max-width: 560px) {
|
|
1364
|
-
:
|
|
1036
|
+
:global(.runDetailDrawer .el-drawer__body) { padding: 12px 14px 18px; }
|
|
1365
1037
|
.detailStats { grid-template-columns: minmax(0, 1fr); }
|
|
1366
1038
|
.detailActions { justify-content: flex-start; }
|
|
1367
1039
|
}
|