bailinghub 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.en.md +3 -1
  2. package/README.md +4 -0
  3. package/docker-compose.images.yml +2 -2
  4. package/docs/CHANGELOG.en.md +58 -1
  5. package/docs/CHANGELOG.md +26 -1
  6. package/docs/COMPATIBILITY.en.md +25 -0
  7. package/docs/CONTRACT.en.md +91 -8
  8. package/docs/CONTRACT.md +39 -7
  9. package/docs/DEMO.en.md +6 -0
  10. package/docs/DEMO.md +2 -0
  11. package/docs/INDEPENDENT_VALIDATION.en.md +9 -6
  12. package/docs/INDEPENDENT_VALIDATION.md +9 -6
  13. package/docs/QUICKSTART.en.md +20 -0
  14. package/docs/QUICKSTART.md +2 -2
  15. package/docs/README.en.md +4 -0
  16. package/docs/README.md +4 -0
  17. package/docs/RELEASE_NOTES_v0.3.4.en.md +38 -0
  18. package/docs/RELEASE_NOTES_v0.3.4.md +38 -0
  19. package/docs/RELEASE_NOTES_v0.4.0.en.md +39 -0
  20. package/docs/RELEASE_NOTES_v0.4.0.md +39 -0
  21. package/docs/STREAMING.en.md +32 -0
  22. package/docs/STREAMING.md +8 -2
  23. package/docs/WIDGET_RENDERERS.en.md +123 -6
  24. package/docs/WIDGET_RENDERERS.md +75 -6
  25. package/docs/user-guide/concepts.en.md +8 -1
  26. package/docs/user-guide/concepts.md +3 -1
  27. package/docs/user-guide/console-map.en.md +1 -2
  28. package/docs/user-guide/console-map.md +3 -3
  29. package/docs//345/205/274/345/256/271/346/200/247/344/270/216/345/215/207/347/272/247.md +9 -0
  30. package/package.json +1 -1
  31. package/schemas/config/chat-entry.schema.json +2 -1
  32. package/scripts/check-doc-links.mjs +2 -0
  33. package/scripts/check-image-tags.sh +1 -1
  34. package/scripts/check-release-consistency.test.mjs +5 -5
  35. package/scripts/e2e-console.mjs +38 -10
  36. package/scripts/install.sh +1 -1
  37. package/scripts/publish-images.sh +1 -1
  38. package/scripts/release-audit.mjs +2 -0
  39. package/scripts/verify-github-repo.mjs +2 -0
  40. package/scripts/widget-renderer-test.mjs +244 -16
  41. package/src/core/config/config-models.test.ts +18 -1
  42. package/src/core/config/config-models.ts +25 -3
  43. package/src/core/config/config-schema.test.ts +2 -0
  44. package/src/core/contracts/types.ts +2 -1
  45. package/src/core/platform/chat-form.test.ts +147 -0
  46. package/src/core/platform/chat-form.ts +402 -0
  47. package/src/core/platform/version.ts +1 -1
  48. package/src/core/runtime/execution-runtime.test.ts +73 -4
  49. package/src/core/runtime/execution-runtime.ts +18 -1
  50. package/src/routes/chat-mount.test.ts +9 -1
  51. package/src/routes/chat.test.ts +319 -7
  52. package/src/routes/chat.ts +179 -28
  53. package/web/console/assets/{Accounts-08VltF2i.js → Accounts-DuUY2UJU.js} +1 -1
  54. package/web/console/assets/{Approvals-CqgmsMau.js → Approvals-B11mo1dy.js} +1 -1
  55. package/web/console/assets/{Audit-bPlpSQt3.js → Audit-CQwJRIJT.js} +1 -1
  56. package/web/console/assets/{BrandLockup-DhX07g3G.js → BrandLockup-BIF-h1pi.js} +1 -1
  57. package/web/console/assets/{Channels-BZe0pLgx.js → Channels-BIploUT-.js} +1 -1
  58. package/web/console/assets/ChatEntries-Cpg_WV-o.js +7 -0
  59. package/web/console/assets/ChatEntries-DsYtcXN6.css +1 -0
  60. package/web/console/assets/Clients--D7NQJKk.css +1 -0
  61. package/web/console/assets/{Clients-BVVZfX3r.js → Clients-DS29eUi2.js} +2 -2
  62. package/web/console/assets/{Cost-DANcjr_p.js → Cost-BF52tfU2.js} +1 -1
  63. package/web/console/assets/{Credentials-D_8tP2Xa.js → Credentials-SwfmQAv6.js} +1 -1
  64. package/web/console/assets/{Diagnostics-Bw1WImFe.js → Diagnostics-CJfbI_8p.js} +1 -1
  65. package/web/console/assets/{Executors-fuieN2Sl.js → Executors-CzlZlznA.js} +1 -1
  66. package/web/console/assets/{Kb-BaMi_7xf.js → Kb-CVX22U4k.js} +1 -1
  67. package/web/console/assets/{Login-Cmz2ppY8.js → Login-PoUVsBI-.js} +1 -1
  68. package/web/console/assets/{Projects-D6xIgFB3.js → Projects-DYlbjLQy.js} +1 -1
  69. package/web/console/assets/{Routes-B90i3ZNa.js → Routes-DSEvGujN.js} +1 -1
  70. package/web/console/assets/{Runs-9qpwotOj.js → Runs-B-TsYZEt.js} +1 -1
  71. package/web/console/assets/Setup-D7nxgn-9.css +1 -0
  72. package/web/console/assets/Setup-xiPXit_b.js +1 -0
  73. package/web/console/assets/{Shell-Dm6eFcl1.js → Shell-DNiWZOYB.js} +1 -1
  74. package/web/console/assets/{StorageBuckets-DY8WuJlM.js → StorageBuckets-Bjsc3pLd.js} +1 -1
  75. package/web/console/assets/{SystemSettings-O_NMPzq_.js → SystemSettings-CcKF2lJ9.js} +1 -1
  76. package/web/console/assets/{SystemStatus-Cok3S7S3.js → SystemStatus-Oj1xjxJn.js} +1 -1
  77. package/web/console/assets/{Targets-YWBoxqvy.js → Targets-y1KllVXT.js} +1 -1
  78. package/web/console/assets/{Tools-BgXDw7Mg.js → Tools-DoEP_y9x.js} +1 -1
  79. package/web/console/assets/{index-S_J0I0Zh.js → index-CxPIS6G7.js} +2 -2
  80. package/web/console/assets/{request-FM608Kfz.js → request-CBLNpLth.js} +1 -1
  81. package/web/console/assets/{schema-DWnFqTkB.js → schema-DzwLpuOy.js} +1 -1
  82. package/web/console/index.html +1 -1
  83. package/web/widget/widget.js +493 -14
  84. package/web-admin/src/pages/ChatEntries.vue +46 -23
  85. package/web-admin/src/pages/Clients.vue +2 -2
  86. package/web-admin/src/pages/Setup.vue +12 -8
  87. package/web/console/assets/ChatEntries-BweMx_CU.css +0 -1
  88. package/web/console/assets/ChatEntries-Ca0lcGqn.js +0 -7
  89. package/web/console/assets/Clients-DcTYN-Js.css +0 -1
  90. package/web/console/assets/Setup-BIjCiA2i.js +0 -1
  91. package/web/console/assets/Setup-BuyKFofL.css +0 -1
@@ -1,7 +1,7 @@
1
1
  // 聊天入口(公开面):网页组件 → POST /chat/:entry → 同一条路由/总账/知识/工具链路。
2
2
  // entry_key 可公开;防滥用 = Origin 白名单 + 按 IP 限速 + 可停用。访客=匿名主体;签名访客票据(verifyVisitorTicket)验签后写 metadata.visitor_uid。
3
3
  import type { IncomingMessage, ServerResponse } from 'node:http';
4
- import { createHmac, randomUUID, timingSafeEqual } from 'node:crypto';
4
+ import { createHash, createHmac, randomUUID, timingSafeEqual } from 'node:crypto';
5
5
  import { ipOf, normalizeHttpMountPath, readBody, readBodyCapped, send } from '../app/http';
6
6
  import type { EngineRuntime } from '../app/engine';
7
7
  import { resolveTargetDef } from '../core/targets/resolve';
@@ -16,12 +16,22 @@ import type { RuntimeStateStore } from '../core/state/state-contracts';
16
16
  import type { ConfigStoreContract } from '../infrastructure/config/configstore';
17
17
  import { CHAT_STREAM_PROTOCOL, type JobStreamBroker } from '../core/runtime/job-stream';
18
18
  import type { TargetRegistry } from '../core/targets/registry';
19
+ import {
20
+ BailingFormValidationError,
21
+ bailingFormHistoryInteraction,
22
+ buildBailingFormCanonicalInput,
23
+ findBailingFormDefinition,
24
+ parseBailingFormInteraction,
25
+ validateBailingFormValues,
26
+ type BailingFormHistoryInteraction,
27
+ type BailingFormInteraction,
28
+ } from '../core/platform/chat-form';
19
29
 
20
30
  // ---- 聊天入口(公开面):网页组件 → POST /chat/:entry → 同一条路由/总账/知识/工具链路 ----
21
31
  // entry_key 设计为可公开(页面源码可见);防滥用 = Origin 白名单 + 按 IP 限速 + 可停用/删除。
22
32
  // 落点是「触发路由」:背后是 llm 还是执行器智能体,入口无感(用户铁律:聊天不绑死 LLM)。
23
- // 身份纪律(总纲):网页访客=匿名主体。metadata 由服务端构造,组件只能带 visitor_id(会话连续性用),
24
- // 业务操作主体(subject_field → on-behalf-of)永远为空——挂工具的路由读公开数据可用,写操作业务侧自然拒。
33
+ // 身份纪律(总纲):网页访客默认是匿名主体。metadata 由服务端构造,组件只能带 visitor_id(会话连续性用);
34
+ // 没有验签票据时业务操作主体为空,无需主体的公开工具仍可用,subject.required 工具在装配阶段不可见;业务系统继续做最终授权。
25
35
 
26
36
  export function chatCors(res: ServerResponse): void {
27
37
  // 公开面不用 Cookie,CORS 直接放开;"哪些站点能嵌"由服务端 Origin 白名单裁决(不匹配 403,浏览器 Origin 不可伪造)
@@ -74,11 +84,26 @@ interface RuntimeContextInput {
74
84
  actor?: RuntimeActor;
75
85
  }
76
86
 
87
+ function canonicalHttpOrigin(value: unknown): string | undefined {
88
+ const raw = String(value ?? '').trim();
89
+ if (!raw) return undefined;
90
+ try {
91
+ const url = new URL(raw);
92
+ if (raw.includes('?') || raw.includes('#')
93
+ || (url.protocol !== 'http:' && url.protocol !== 'https:')
94
+ || url.username || url.password || url.search || url.hash
95
+ || url.pathname !== '/' || url.origin === 'null') return undefined;
96
+ return url.origin;
97
+ } catch { return undefined; }
98
+ }
99
+
77
100
  function chatOriginAllowed(entry: ChatEntry, req: IncomingMessage): boolean {
78
101
  if (!entry.allowed_origins.length) return true; // 未配=不限,控制台建议上线前配白名单
79
- const o = (req.headers['origin'] ?? '').toString().replace(/\/+$/, '');
80
- if (!o) return true; // 无 Origin = 非浏览器调用(curl 等),白名单管不到也不必管——它防的是别家网页盗嵌
81
- return entry.allowed_origins.some((a) => a.replace(/\/+$/, '') === o);
102
+ const rawOrigin = (req.headers['origin'] ?? '').toString().trim();
103
+ if (!rawOrigin) return true; // 无 Origin = 非浏览器调用(curl 等),白名单管不到也不必管——它防的是别家网页盗嵌
104
+ const origin = canonicalHttpOrigin(rawOrigin);
105
+ if (!origin) return false;
106
+ return entry.allowed_origins.some((allowed) => canonicalHttpOrigin(allowed) === origin);
82
107
  }
83
108
 
84
109
  async function chatRateLimited(config: ConfigStoreContract | null, entry: ChatEntry, ip: string): Promise<boolean> {
@@ -109,6 +134,58 @@ export function normalizePresentationCapabilities(value: unknown): { renderers:
109
134
  return normalized.length ? { renderers: normalized } : undefined;
110
135
  }
111
136
 
137
+ function chatJobReply(job: Job): string {
138
+ const result = (job.result ?? {}) as Record<string, unknown>;
139
+ if (typeof result['text'] === 'string' && result['text']) return result['text'];
140
+ if (result['report']) return JSON.stringify(result['report']);
141
+ return job.raw_result ?? '';
142
+ }
143
+
144
+ function chatInteractionRequestId(
145
+ entryKey: string,
146
+ visitor: string,
147
+ visitorUid: string,
148
+ thread: string,
149
+ interaction: BailingFormInteraction,
150
+ ): string {
151
+ const identity = visitorUid ? 'uid:' + visitorUid : 'visitor:' + visitor;
152
+ const digest = createHash('sha256').update(JSON.stringify([
153
+ entryKey, identity, thread, interaction.source_job_id, interaction.form_id, interaction.submission_id,
154
+ ])).digest('hex');
155
+ return 'chat_form_' + digest.slice(0, 48);
156
+ }
157
+
158
+ function sourceJobBelongsToChat(
159
+ job: Job,
160
+ entryKey: string,
161
+ visitor: string,
162
+ visitorUid: string,
163
+ thread: string,
164
+ ): boolean {
165
+ const metadata = job.metadata ?? {};
166
+ if (job.source !== 'chat:' + entryKey || metadata['chat_entry'] !== entryKey) return false;
167
+ if (String(metadata['thread_id'] ?? '') !== thread) return false;
168
+ if (visitorUid) return metadata['visitor_uid'] === visitorUid;
169
+ return !metadata['visitor_uid'] && metadata['visitor_id'] === visitor;
170
+ }
171
+
172
+ function interactionMetadataMatches(
173
+ job: Job,
174
+ entryKey: string,
175
+ visitor: string,
176
+ visitorUid: string,
177
+ thread: string,
178
+ expected: BailingFormHistoryInteraction,
179
+ ): boolean {
180
+ if (!sourceJobBelongsToChat(job, entryKey, visitor, visitorUid, thread)) return false;
181
+ const actual = bailingFormHistoryInteraction((job.metadata ?? {})['interaction']);
182
+ return !!actual
183
+ && actual.source_job_id === expected.source_job_id
184
+ && actual.form_id === expected.form_id
185
+ && actual.submission_id === expected.submission_id
186
+ && actual.action === expected.action;
187
+ }
188
+
112
189
 
113
190
  /** job → 聊天响应形态。错误不暴露内部细节(公开面)。references=知识检索命中(doc_id 留在中枢侧,不外露)。 */
114
191
  function chatShape(job: Job, visitorId: string): Record<string, unknown> {
@@ -132,7 +209,7 @@ function chatShape(job: Job, visitorId: string): Record<string, unknown> {
132
209
 
133
210
 
134
211
  export async function handleChatFor(deps: ChatApiDeps, req: IncomingMessage, res: ServerResponse, entryKey: string): Promise<void> {
135
- const { ctx, config: cfgStore } = await chatRuntime(deps, `chat:${entryKey}`);
212
+ const { ctx, state: store, config: cfgStore } = await chatRuntime(deps, `chat:${entryKey}`);
136
213
  if (!cfgStore) { send(res, 400, { error: '聊天入口需要 mysql 后端' }); return; }
137
214
  const engine = deps.engineForContext(ctx);
138
215
  const entry = await cfgStore.chatEntries.get(entryKey);
@@ -142,8 +219,19 @@ export async function handleChatFor(deps: ChatApiDeps, req: IncomingMessage, res
142
219
  if (await chatRateLimited(cfgStore, entry, ipOf(req))) { send(res, 429, { done: true, error: true, reply: '提问太频繁了,请稍候片刻再试。' }); return; }
143
220
 
144
221
  const body = (await readBody(req).catch(() => ({} as Record<string, unknown>)));
145
- const message = String(body['message'] ?? '').trim().slice(0, 4000);
146
- if (!message) { send(res, 400, { error: 'message 必填' }); return; }
222
+ const rawMessage = String(body['message'] ?? '').trim();
223
+ const hasInteraction = Object.prototype.hasOwnProperty.call(body, 'interaction_response');
224
+ if (rawMessage && hasInteraction) { send(res, 400, { error: 'message 与 interaction_response 只能提交一个' }); return; }
225
+ let interaction: BailingFormInteraction | undefined;
226
+ if (hasInteraction) {
227
+ try { interaction = parseBailingFormInteraction(body['interaction_response']); }
228
+ catch (e) {
229
+ send(res, 400, { error: e instanceof BailingFormValidationError ? e.message : 'interaction_response 无效' });
230
+ return;
231
+ }
232
+ }
233
+ let message = rawMessage.slice(0, 4000);
234
+ if (!message && !interaction) { send(res, 400, { error: 'message 或 interaction_response 必填' }); return; }
147
235
  // visitor_id:组件生成存 localStorage,只用于会话连续性,不是身份凭证;不合规直接服务端换发
148
236
  let visitor = String(body['visitor_id'] ?? '').replace(/[^a-zA-Z0-9_-]/g, '').slice(0, 64);
149
237
  if (visitor.length < 8) visitor = randomUUID().replace(/-/g, '').slice(0, 16);
@@ -178,6 +266,43 @@ export async function handleChatFor(deps: ChatApiDeps, req: IncomingMessage, res
178
266
  // 可选 thread_id:同一身份下按它切分平行线程(业务多会话 UI 映射)——开新会话=换 thread_id,继续当前会话=复用。
179
267
  // 它只是已验身份内部的分区键,不跨权限边界;清洗限长防滥用。会话与对话总账同键切分,连续性一致。
180
268
  const thread = String(body['thread_id'] ?? '').replace(/[^a-zA-Z0-9_-]/g, '').slice(0, 32);
269
+ let interactionMeta: BailingFormHistoryInteraction | undefined;
270
+ let interactionRequestId = '';
271
+ if (interaction) {
272
+ const sourceJob = await store.getJob(interaction.source_job_id);
273
+ // 来源不存在/跨入口/跨身份/跨线程一律按 not found 收口,避免公开面成为任务探针。
274
+ if (!sourceJob || !sourceJobBelongsToChat(sourceJob, entry.entry_key, visitor, visitorUid, thread)) {
275
+ send(res, 404, { error: 'not found' }); return;
276
+ }
277
+ if (sourceJob.status !== 'done') { send(res, 409, { error: '来源回答尚未完成,暂不能提交表单' }); return; }
278
+ try {
279
+ const form = findBailingFormDefinition(chatJobReply(sourceJob), interaction.form_id);
280
+ if (!form) { send(res, 400, { error: '来源回答中没有可提交的对应表单' }); return; }
281
+ const values = interaction.action === 'submit' ? validateBailingFormValues(form, interaction.values) : {};
282
+ message = buildBailingFormCanonicalInput(form, interaction, values);
283
+ } catch (e) {
284
+ send(res, 400, { error: e instanceof BailingFormValidationError ? e.message : '表单提交无效' });
285
+ return;
286
+ }
287
+ if (message.length > 4000) { send(res, 400, { error: '表单提交生成的用户消息超过 4000 字上限,请缩短填写内容' }); return; }
288
+ interactionMeta = {
289
+ type: interaction.type,
290
+ version: interaction.version,
291
+ source_job_id: interaction.source_job_id,
292
+ form_id: interaction.form_id,
293
+ submission_id: interaction.submission_id,
294
+ action: interaction.action,
295
+ };
296
+ interactionRequestId = chatInteractionRequestId(entry.entry_key, visitor, visitorUid, thread, interaction);
297
+ const existing = await store.findByRequestId(interactionRequestId);
298
+ if (existing) {
299
+ if (!interactionMetadataMatches(existing, entry.entry_key, visitor, visitorUid, thread, interactionMeta)) {
300
+ send(res, 409, { error: 'submission_id 冲突,请重新提交' }); return;
301
+ }
302
+ send(res, 200, { ...chatShape(existing, visitor), deduped: true });
303
+ return;
304
+ }
305
+ }
181
306
  const scopeKey = chatScopeKey(entry.entry_key, visitor, visitorUid, thread);
182
307
  const sess = await cfgStore.conversations.sessionForScope(route.route_key, scopeKey);
183
308
  // 页面上下文(寻址):组件抓的 url/title(+可选 page_key) → 按本入口登记表模式匹配 → 解析出页面说明。
@@ -193,16 +318,29 @@ export async function handleChatFor(deps: ChatApiDeps, req: IncomingMessage, res
193
318
  }
194
319
  // 展示能力由客户端自报,只用于回答呈现提示,绝不能参与身份、权限、审批或工具放行。
195
320
  const presentationCapabilities = normalizePresentationCapabilities(body['client_capabilities']);
196
- const job = await engine.launchJob({
197
- requestId: `chat_${randomUUID()}`, fullInput: message,
198
- route, routeKey: route.route_key,
199
- target: route.target, project: route.project ?? null, projectPath,
200
- profileName: route.profile, permission: route.permission, source: `chat:${entry.entry_key}`,
201
- // 服务端构造:visitor_uid 只可能来自验签通过的票据,组件/访客无法伪造(鉴权总纲)
202
- metadata: { chat_entry: entry.entry_key, visitor_id: visitor, no_delivery: true, ...(visitorUid ? { visitor_uid: visitorUid } : {}), ...(thread ? { thread_id: thread } : {}), ...(pageContext ? { page_context: pageContext } : {}), ...(presentationCapabilities ? { presentation_capabilities: presentationCapabilities } : {}) },
203
- session: { sessionId: sess.sessionId, isContinue: sess.isContinue },
204
- threadScope: scopeKey, principalId: (visitorUid ? `uid:${visitorUid}` : `visitor:${visitor}`).slice(0, 64), channel: `chat:${entry.entry_key}`,
205
- });
321
+ let job: Job;
322
+ try {
323
+ job = await engine.launchJob({
324
+ requestId: interactionRequestId || `chat_${randomUUID()}`, fullInput: message,
325
+ route, routeKey: route.route_key,
326
+ target: route.target, project: route.project ?? null, projectPath,
327
+ profileName: route.profile, permission: route.permission, source: `chat:${entry.entry_key}`,
328
+ // 服务端构造:visitor_uid 只可能来自验签通过的票据,组件/访客无法伪造(鉴权总纲)
329
+ metadata: { chat_entry: entry.entry_key, visitor_id: visitor, no_delivery: true, ...(visitorUid ? { visitor_uid: visitorUid } : {}), ...(thread ? { thread_id: thread } : {}), ...(pageContext ? { page_context: pageContext } : {}), ...(presentationCapabilities ? { presentation_capabilities: presentationCapabilities } : {}), ...(interactionMeta ? { interaction: interactionMeta } : {}) },
330
+ session: { sessionId: sess.sessionId, isContinue: sess.isContinue },
331
+ threadScope: scopeKey, principalId: (visitorUid ? `uid:${visitorUid}` : `visitor:${visitor}`).slice(0, 64), channel: `chat:${entry.entry_key}`,
332
+ });
333
+ } catch (error) {
334
+ // 并发双击可能同时通过前置查询;唯一 request_id 由状态库裁决,失败方回查并复用赢家。
335
+ if (interactionRequestId && interactionMeta) {
336
+ const raced = await store.findByRequestId(interactionRequestId).catch(() => null);
337
+ if (raced && interactionMetadataMatches(raced, entry.entry_key, visitor, visitorUid, thread, interactionMeta)) {
338
+ send(res, 200, { ...chatShape(raced, visitor), deduped: true });
339
+ return;
340
+ }
341
+ }
342
+ throw error;
343
+ }
206
344
 
207
345
  // 聊天主链路:创建任务后立即返回 job_id,回答统一由 SSE 事件流输出。
208
346
  send(res, 200, chatShape(job, visitor));
@@ -303,7 +441,7 @@ function chatScopeKey(entryKey: string, visitor: string, visitorUid: string, thr
303
441
  * 身份纪律:带票按 uid 线索、无票按 visitor 线索;票坏=401(与 handleChat 同,组件可据此提示重登)。
304
442
  */
305
443
  export async function handleChatThreadFor(deps: ChatApiDeps, req: IncomingMessage, res: ServerResponse, entryKey: string, url: URL): Promise<void> {
306
- const { config: cfgStore } = await chatRuntime(deps, `chat_thread:${entryKey}`);
444
+ const { state: store, config: cfgStore } = await chatRuntime(deps, `chat_thread:${entryKey}`);
307
445
  if (!cfgStore) { send(res, 400, { error: '聊天入口需要 mysql 后端' }); return; }
308
446
  const entry = await cfgStore.chatEntries.get(entryKey);
309
447
  if (!entry || !entry.enabled) { send(res, 404, { error: '聊天入口不存在或已停用' }); return; }
@@ -328,11 +466,17 @@ export async function handleChatThreadFor(deps: ChatApiDeps, req: IncomingMessag
328
466
  if (!threadId) { send(res, 200, { visitor_id: visitor, messages: [] }); return; }
329
467
  const rows = await cfgStore.conversations.threadMessages(threadId, 50);
330
468
  // 出站消息现算富内容(图片/文件附件),与实时 chatShape 渲染口径一致;入站只回文本
331
- const messages = rows.map((m) => {
469
+ const messages = await Promise.all(rows.map(async (m) => {
332
470
  const atts = extractAttachments(m.content); // 入站也解析:用户上传的图片以 ![](url) 进消息,回灌后同样渲染成缩略图
333
- if (m.direction === 'in') return { r: 'u', t: m.content, j: m.job_id, ts: m.created_at, ...(atts.length ? { atts } : {}) };
471
+ if (m.direction === 'in') {
472
+ const job = m.job_id ? await store.getJob(m.job_id).catch(() => null) : null;
473
+ const interaction = job && job.thread_id === threadId && (job.metadata ?? {})['chat_entry'] === entryKey
474
+ ? bailingFormHistoryInteraction((job.metadata ?? {})['interaction'])
475
+ : undefined;
476
+ return { r: 'u', t: m.content, j: m.job_id, ts: m.created_at, ...(atts.length ? { atts } : {}), ...(interaction ? { interaction } : {}) };
477
+ }
334
478
  return { r: 'a', t: m.content, j: m.job_id, ts: m.created_at, ...(atts.length ? { atts } : {}) };
335
- });
479
+ }));
336
480
  send(res, 200, { visitor_id: visitor, messages });
337
481
  }
338
482
 
@@ -440,6 +584,7 @@ export async function handleChatConfigFor(deps: ChatApiDeps, req: IncomingMessag
440
584
  send(res, 200, {
441
585
  enabled: true,
442
586
  title: entry.title || entry.name, greeting: entry.greeting ?? '', color: entry.color || '#7a5b3a', brand: deps.cfg.brand.name, upload,
587
+ default_open: ap.default_open === true,
443
588
  width: ap.width ?? 400, height: ap.height ?? 600,
444
589
  title_align: ap.title_align === 'left' ? 'left' : 'center',
445
590
  position: ap.position === 'left' ? 'left' : 'right',
@@ -452,7 +597,7 @@ export async function handleChatConfigFor(deps: ChatApiDeps, req: IncomingMessag
452
597
  });
453
598
  }
454
599
 
455
- /** 演示页:贴一行 script 的效果,建好入口立即可看(也是给第三方的"先试再接"入口)。 */
600
+ /** 匿名预览页:只验证组件和公开能力;不继承中枢管理员登录态,也不伪造业务主体。 */
456
601
  export function serveChatDemoFor(
457
602
  deps: Pick<ChatApiDeps, 'cfg'>,
458
603
  res: ServerResponse,
@@ -461,12 +606,18 @@ export function serveChatDemoFor(
461
606
  ): void {
462
607
  const safeMountPath = normalizeHttpMountPath(mountPath);
463
608
  const html = [
464
- '<!doctype html><html lang="zh"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">',
465
- `<title>聊天入口演示 · ${deps.cfg.brand.name}</title></head>`,
609
+ '<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">',
610
+ `<title>聊天入口匿名预览 · ${deps.cfg.brand.name}</title></head>`,
466
611
  '<body style="margin:0;min-height:100vh;background:#faf9f7;font:15px/1.7 -apple-system,\'PingFang SC\',sans-serif;color:#3d372f">',
467
612
  '<div style="max-width:560px;margin:0 auto;padding:48px 24px">',
468
- '<h2 style="margin:0 0 8px">聊天入口演示页</h2>',
469
- '<p style="color:#8a8378">右下角的气泡就是嵌入效果。把下面这行代码贴进你网站任意页面的 &lt;/body&gt; 前即可:</p>',
613
+ '<h2 style="margin:0 0 8px">聊天入口匿名预览</h2>',
614
+ '<div style="margin:16px 0;padding:14px 16px;border:1px solid #ead9b8;border-radius:10px;background:#fff9ed">',
615
+ '<strong>当前页面不具有业务用户身份</strong>',
616
+ '<p style="margin:6px 0 0">它不会携带或继承中枢管理后台的登录状态,也没有独立的业务登录入口。请勿在对话中提供账号、Token 或用户 ID。</p>',
617
+ '</div>',
618
+ '<p>这里适合验证聊天组件、公开问答,以及不要求业务主体的工具。需要业务主体的查询或办理能力,应将助手嵌入已登录的业务系统页面,并由业务后端签发短期身份票据。</p>',
619
+ '<p>如果你是管理员,需要验证内置演示的完整链路,请在上手向导中运行 Smoke;Smoke 会使用受控的演示主体。</p>',
620
+ '<p style="color:#8a8378">右下角的气泡展示组件嵌入效果。把下面这行代码贴进你网站任意页面的 &lt;/body&gt; 前即可:</p>',
470
621
  `<pre style="background:#fff;border:1px solid #e8e4dd;border-radius:8px;padding:12px;overflow:auto;font-size:12px">&lt;script src="<span data-host></span>/widget.js" data-entry="${entryKey}" async&gt;&lt;/script&gt;</pre>`,
471
622
  '</div>',
472
623
  `<script>document.querySelector("[data-host]").textContent=location.origin+${JSON.stringify(safeMountPath)};</script>`,
@@ -1,3 +1,3 @@
1
- import{aj as K,E as V}from"./vendor-element-D7WRzHhy.js";import{a as C}from"./request-FM608Kfz.js";import{f as W,c as X}from"./util-SiQC2MJh.js";import{u as Y}from"./index-S_J0I0Zh.js";import{H as c}from"./HelpTip-CT07o3kB.js";import{d as Z,z as h,c as L,S as n,J as t,R as O,r as _,ai as i,o as b,e as o,Q as r,P as s,u as ee,I as E,O as $,a3 as le,q as te}from"./vendor-vue-B2uhHUfE.js";import{_ as ne}from"./_plugin-vue_export-helper-DlAUqK2U.js";const ae={class:"head"},oe={class:"account-main"},se={class:"account-stack"},de={class:"muted"},ie={class:"account-stack"},ue={class:"muted"},re=Z({__name:"Accounts",setup(me){const y={admin:"全能",kb_editor:"知识库维护",viewer:"只读任务"},N=Y(),x=_([]),T=_(["admin","kb_editor","viewer"]),u=_(!1),m=_(!1),w=_(!1),d=te({username:"",display_name:"",role:"kb_editor",password:"",enabled:!0});async function g(){var e;const a=await C("/admin/api/admins");x.value=a.list,(e=a.roles)!=null&&e.length&&(T.value=a.roles)}function S(a){return a==="admin"?"admin":a==="kb_editor"?"kb_editor":a==="viewer"?"viewer":a}function M(a){return a?`最近登录 ${W(a)}`:"从未登录"}function j(){m.value=!1,Object.assign(d,{username:"",display_name:"",role:"kb_editor",password:"",enabled:!0}),u.value=!0}function q(a){m.value=!0,Object.assign(d,{username:a.username,display_name:a.display_name||"",role:a.role,password:"",enabled:!!a.enabled}),u.value=!0}async function D(){w.value=!0;try{const a=await C("/admin/api/admins",{method:"POST",body:JSON.stringify(d)});u.value=!1,await g(),a.generated_password?(await K.alert(`账号 ${a.username} 的初始密码(只显示这一次,请立即发给使用人):
1
+ import{aj as K,E as V}from"./vendor-element-D7WRzHhy.js";import{a as C}from"./request-CBLNpLth.js";import{f as W,c as X}from"./util-SiQC2MJh.js";import{u as Y}from"./index-CxPIS6G7.js";import{H as c}from"./HelpTip-CT07o3kB.js";import{d as Z,z as h,c as L,S as n,J as t,R as O,r as _,ai as i,o as b,e as o,Q as r,P as s,u as ee,I as E,O as $,a3 as le,q as te}from"./vendor-vue-B2uhHUfE.js";import{_ as ne}from"./_plugin-vue_export-helper-DlAUqK2U.js";const ae={class:"head"},oe={class:"account-main"},se={class:"account-stack"},de={class:"muted"},ie={class:"account-stack"},ue={class:"muted"},re=Z({__name:"Accounts",setup(me){const y={admin:"全能",kb_editor:"知识库维护",viewer:"只读任务"},N=Y(),x=_([]),T=_(["admin","kb_editor","viewer"]),u=_(!1),m=_(!1),w=_(!1),d=te({username:"",display_name:"",role:"kb_editor",password:"",enabled:!0});async function g(){var e;const a=await C("/admin/api/admins");x.value=a.list,(e=a.roles)!=null&&e.length&&(T.value=a.roles)}function S(a){return a==="admin"?"admin":a==="kb_editor"?"kb_editor":a==="viewer"?"viewer":a}function M(a){return a?`最近登录 ${W(a)}`:"从未登录"}function j(){m.value=!1,Object.assign(d,{username:"",display_name:"",role:"kb_editor",password:"",enabled:!0}),u.value=!0}function q(a){m.value=!0,Object.assign(d,{username:a.username,display_name:a.display_name||"",role:a.role,password:"",enabled:!!a.enabled}),u.value=!0}async function D(){w.value=!0;try{const a=await C("/admin/api/admins",{method:"POST",body:JSON.stringify(d)});u.value=!1,await g(),a.generated_password?(await K.alert(`账号 ${a.username} 的初始密码(只显示这一次,请立即发给使用人):
2
2
 
3
3
  ${a.generated_password}`,"账号已创建",{confirmButtonText:"复制密码"}).catch(()=>{}),await X(a.generated_password,"密码已复制")):V.success("已保存")}catch(a){V.error(a.message)}finally{w.value=!1}}async function I(a){try{await C("/admin/api/admins/"+encodeURIComponent(a),{method:"DELETE"}),await g()}catch(e){V.error(e.message)}}return h(g),(a,e)=>{const p=i("el-button"),v=i("el-table-column"),U=i("el-tag"),R=i("el-popconfirm"),z=i("el-table"),A=i("el-card"),k=i("el-input"),f=i("el-form-item"),H=i("el-option"),J=i("el-select"),P=i("el-switch"),F=i("el-form"),Q=i("el-drawer");return b(),L(O,null,[n(A,{shadow:"never"},{header:t(()=>[o("div",ae,[e[9]||(e[9]=o("b",null,"后台账号",-1)),e[10]||(e[10]=s()),n(c,{title:"后台账号 / 角色"},{default:t(()=>[...e[7]||(e[7]=[o("p",null,"后台账号只用于维护中枢控制台,不等同于业务系统用户,也不参与聊天/工具调用的业务身份。",-1),o("p",null,[s("角色决定可见板块与管理权限:"),o("code",null,"admin"),s(" 管全局配置,"),o("code",null,"kb_editor"),s(" 维护知识库,"),o("code",null,"viewer"),s(" 查看运行记录。")],-1)])]),_:1}),n(p,{type:"primary",style:{"margin-left":"auto"},onClick:j},{default:t(()=>[...e[8]||(e[8]=[s("新建账号",-1)])]),_:1})])]),default:t(()=>[n(z,{data:x.value},{default:t(()=>[n(v,{label:"账号","min-width":"240","show-overflow-tooltip":""},{default:t(({row:l})=>[o("div",oe,[o("b",null,r(l.display_name||l.username),1),o("code",null,r(l.username),1)])]),_:1}),n(v,{label:"角色权限","min-width":"220"},{default:t(({row:l})=>[o("div",se,[n(U,{type:l.role==="admin"?"warning":"info",effect:"plain"},{default:t(()=>[s(r(S(l.role)),1)]),_:2},1032,["type"]),o("span",de,r(y[l.role]||"自定义角色"),1)])]),_:1}),n(v,{label:"登录状态","min-width":"190"},{default:t(({row:l})=>[o("div",ie,[n(U,{type:l.enabled?"success":"info",effect:"plain"},{default:t(()=>[s(r(l.enabled?"启用":"停用"),1)]),_:2},1032,["type"]),o("span",ue,r(M(l.last_login_at)),1)])]),_:1}),n(v,{"min-width":"80",align:"right"},{default:t(({row:l})=>{var B;return[n(p,{link:"",type:"primary",onClick:G=>q(l)},{default:t(()=>[...e[11]||(e[11]=[s("编辑",-1)])]),_:1},8,["onClick"]),l.username!==((B=ee(N).me)==null?void 0:B.username)?(b(),E(R,{key:0,title:"删除该账号?其登录会话立即失效。",width:"240",onConfirm:G=>I(l.username)},{reference:t(()=>[n(p,{link:"",type:"danger"},{default:t(()=>[...e[12]||(e[12]=[s("删",-1)])]),_:1})]),_:1},8,["onConfirm"])):$("",!0)]}),_:1})]),_:1},8,["data"])]),_:1}),n(Q,{modelValue:u.value,"onUpdate:modelValue":e[6]||(e[6]=l=>u.value=l),title:m.value?"编辑账号":"新建账号",size:"420px"},{footer:t(()=>[n(p,{onClick:e[5]||(e[5]=l=>u.value=!1)},{default:t(()=>[...e[22]||(e[22]=[s("取消",-1)])]),_:1}),n(p,{type:"primary",loading:w.value,onClick:D},{default:t(()=>[...e[23]||(e[23]=[s("保存",-1)])]),_:1},8,["loading"])]),default:t(()=>[n(F,{"label-position":"top"},{default:t(()=>[n(f,null,{label:t(()=>[...e[13]||(e[13]=[s("用户名 ",-1),o("span",{class:"field-required"},"必填",-1)])]),default:t(()=>[n(k,{modelValue:d.username,"onUpdate:modelValue":e[0]||(e[0]=l=>d.username=l),disabled:m.value,placeholder:"如 ops-admin",class:"mono"},null,8,["modelValue","disabled"])]),_:1}),n(f,{label:"显示名(可选)"},{default:t(()=>[n(k,{modelValue:d.display_name,"onUpdate:modelValue":e[1]||(e[1]=l=>d.display_name=l)},null,8,["modelValue"])]),_:1}),n(f,null,{label:t(()=>[e[15]||(e[15]=s("角色 ",-1)),e[16]||(e[16]=o("span",{class:"field-required"},"必填",-1)),e[17]||(e[17]=s()),n(c,{title:"角色"},{default:t(()=>[...e[14]||(e[14]=[o("p",null,[o("b",null,"admin"),s(":管理全局配置与账号;"),o("b",null,"kb_editor"),s(":维护知识库;"),o("b",null,"viewer"),s(":只读查看运行记录。")],-1)])]),_:1})]),default:t(()=>[n(J,{modelValue:d.role,"onUpdate:modelValue":e[2]||(e[2]=l=>d.role=l),style:{width:"100%"}},{default:t(()=>[(b(!0),L(O,null,le(T.value,l=>(b(),E(H,{key:l,value:l,label:l+(y[l]?"("+y[l]+")":"")},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1}),n(f,null,{label:t(()=>[e[19]||(e[19]=s("密码 ",-1)),n(c,{title:"密码"},{default:t(()=>[...e[18]||(e[18]=[o("p",null,"新建时留空会自动生成,并只显示一次。编辑时留空表示不修改;填写后该账号其他登录会话会立即下线。",-1)])]),_:1})]),default:t(()=>[n(k,{modelValue:d.password,"onUpdate:modelValue":e[3]||(e[3]=l=>d.password=l),type:"password","show-password":"",autocomplete:"new-password",placeholder:"至少 8 位"},null,8,["modelValue"])]),_:1}),m.value?(b(),E(f,{key:0},{label:t(()=>[e[21]||(e[21]=s("启用 ",-1)),n(c,{title:"启用状态"},{default:t(()=>[...e[20]||(e[20]=[o("p",null,"停用账号会立即使其登录会话失效。",-1)])]),_:1})]),default:t(()=>[n(P,{modelValue:d.enabled,"onUpdate:modelValue":e[4]||(e[4]=l=>d.enabled=l)},null,8,["modelValue"])]),_:1})):$("",!0)]),_:1})]),_:1},8,["modelValue","title"])],64)}}}),we=ne(re,[["__scopeId","data-v-f7ba53c9"]]);export{we as default};
@@ -1 +1 @@
1
- import{d as R,z as U,V as q,I as v,J as s,ai as i,r as N,o as u,S as a,e as o,Q as l,c as m,R as x,O as S,u as z,P as d,aC as F}from"./vendor-vue-B2uhHUfE.js";import{E as J}from"./vendor-element-D7WRzHhy.js";import{a as O}from"./request-FM608Kfz.js";import{o as Q}from"./docs-DPUOCa7R.js";import{f as T}from"./util-SiQC2MJh.js";import{H as G}from"./HelpTip-CT07o3kB.js";import{_ as K}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./index-S_J0I0Zh.js";const W={class:"head"},X={class:"intent"},Y={class:"block"},Z={class:"block"},w={class:"intent-main"},ee={class:"muted"},te={class:"muted ellipsis"},ne={class:"intent-stack"},se={class:"muted mono"},oe={class:"muted"},ae={class:"intent-stack"},le={class:"muted"},ie={class:"intent-stack"},de={key:0,class:"muted ellipsis"},re={key:1,class:"muted"},ue=R({__name:"Approvals",setup(pe){const $=F(),f=N([]),c=N("pending");let y=0;async function _(){f.value=await O("/admin/api/tool-approvals?status="+c.value)}async function g(n,t){try{const r=await O(`/admin/api/tool-approvals/${n}/${t}`,{method:"POST"});J.success(t==="approve"?r.rerun?"已批准,任务已自动重跑":"已批准(任务在途,运行中会执行该调用)":"已拒绝"),await _()}catch(r){J.error(r.message)}}function B(n){$.push("/runs?job="+n)}function I(){Q("/docs/approvals")}function b(n,t){return n==="risk_high"?"高风险":n==="confirm_required"?"强制确认":n==="confirm_when"?"条件确认":t==="high"?"高风险":"需确认"}function j(n){return n==="high"?"高风险":n==="medium"?"中风险":n||"需确认"}function D(n){return n.status==="pending"?"待决策":n.status==="approved"?n.used_at?"已批准 · 已执行":"已批准 · 待执行":"已拒绝"}function E(n){return n.status==="pending"?"warning":n.status==="approved"?"success":"info"}function L(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch{return n}}return U(()=>{_(),y=window.setInterval(()=>void _(),3e4)}),q(()=>window.clearInterval(y)),(n,t)=>{const r=i("el-button"),k=i("el-radio-button"),A=i("el-radio-group"),H=i("el-empty"),p=i("el-table-column"),h=i("el-tag"),C=i("el-popconfirm"),M=i("el-table"),P=i("el-card");return u(),v(P,{shadow:"never"},{header:s(()=>[o("div",W,[t[5]||(t[5]=o("b",null,"审批意图",-1)),t[6]||(t[6]=d()),a(G,{title:"审批意图是什么"},{default:s(()=>[...t[1]||(t[1]=[o("p",null,"高风险或命中参数级确认规则的工具调用会先冻结成审批意图。中枢锁定调用快照,批准后任务自动重跑并只执行被批准的那次调用。",-1),o("p",null,"如果路由配置了业务侧审批承接,这里仍可追溯中枢侧意图与最终决策;实际审批人和审批页面由业务系统决定。",-1)])]),_:1}),a(r,{style:{"margin-left":"auto"},onClick:I},{default:s(()=>[...t[2]||(t[2]=[d("开发文档",-1)])]),_:1}),a(A,{modelValue:c.value,"onUpdate:modelValue":t[0]||(t[0]=e=>c.value=e),size:"small",onChange:_},{default:s(()=>[a(k,{value:"pending"},{default:s(()=>[...t[3]||(t[3]=[d("待审批",-1)])]),_:1}),a(k,{value:"all"},{default:s(()=>[...t[4]||(t[4]=[d("全部",-1)])]),_:1})]),_:1},8,["modelValue"])])]),default:s(()=>[f.value.length?(u(),v(M,{key:1,data:f.value,"row-key":"id"},{default:s(()=>[a(p,{type:"expand"},{default:s(({row:e})=>[o("div",X,[t[8]||(t[8]=o("div",{class:"td-sec"},"参数快照",-1)),o("pre",Y,l(L(e.args_json||"{}")),1),e.intent?(u(),m(x,{key:0},[t[7]||(t[7]=o("div",{class:"td-sec"},"审批意图完整快照",-1)),o("pre",Z,l(JSON.stringify(e.intent,null,2)),1)],64)):S("",!0)])]),_:1}),a(p,{label:"审批意图","min-width":"320","show-overflow-tooltip":""},{default:s(({row:e})=>[o("div",w,[o("span",ee,"#"+l(e.id)+" · "+l(z(T)(e.created_at)),1),o("b",null,l(e.summary||e.reason||e.tool),1),o("span",te,l(e.reason||b(e.policy,e.risk)),1),o("code",null,l(e.provider)+" · "+l(e.tool),1)])]),_:1}),a(p,{label:"调用上下文","min-width":"260","show-overflow-tooltip":""},{default:s(({row:e})=>[o("div",ne,[o("code",null,l(e.method)+" "+l(e.path),1),o("span",se,l(e.scope),1),o("span",oe,"主体 "+l(e.on_behalf_of||"无主体"),1),a(r,{link:"",type:"primary",size:"small",onClick:V=>B(e.job_id)},{default:s(()=>[...t[9]||(t[9]=[d("看任务",-1)])]),_:1},8,["onClick"])])]),_:1}),a(p,{label:"治理规则",width:"150"},{default:s(({row:e})=>[o("div",ae,[a(h,{size:"small",effect:"plain",type:e.risk==="high"?"danger":"warning"},{default:s(()=>[d(l(j(e.risk)),1)]),_:2},1032,["type"]),o("span",le,l(b(e.policy,e.risk)),1)])]),_:1}),a(p,{label:"决策状态",width:"170"},{default:s(({row:e})=>[o("div",ie,[a(h,{size:"small",type:E(e),effect:"plain"},{default:s(()=>[d(l(D(e)),1)]),_:2},1032,["type"]),e.decided_by?(u(),m("span",de,l(e.decided_by)+" · "+l(z(T)(e.decided_at)),1)):(u(),m("span",re,"等待业务侧或控制台兜底决策"))])]),_:1}),a(p,{width:"178",align:"right"},{default:s(({row:e})=>[e.status==="pending"?(u(),m(x,{key:0},[a(C,{title:"批准该意图?任务将自动重跑并执行这次已冻结的调用快照。",width:"260",onConfirm:V=>g(e.id,"approve")},{reference:s(()=>[a(r,{link:"",type:"success"},{default:s(()=>[...t[10]||(t[10]=[d("兜底批准",-1)])]),_:1})]),_:1},8,["onConfirm"]),a(C,{title:"拒绝该意图?任务保持原结论,不会重跑。",width:"260",onConfirm:V=>g(e.id,"deny")},{reference:s(()=>[a(r,{link:"",type:"danger"},{default:s(()=>[...t[11]||(t[11]=[d("兜底拒绝",-1)])]),_:1})]),_:1},8,["onConfirm"])],64)):S("",!0)]),_:1})]),_:1},8,["data"])):(u(),v(H,{key:0,description:c.value==="pending"?"没有待审批的调用":"还没有审批记录"},null,8,["description"]))]),_:1})}}}),ke=K(ue,[["__scopeId","data-v-03845cb0"]]);export{ke as default};
1
+ import{d as R,z as U,V as q,I as v,J as s,ai as i,r as N,o as u,S as a,e as o,Q as l,c as m,R as x,O as S,u as z,P as d,aC as F}from"./vendor-vue-B2uhHUfE.js";import{E as J}from"./vendor-element-D7WRzHhy.js";import{a as O}from"./request-CBLNpLth.js";import{o as Q}from"./docs-DPUOCa7R.js";import{f as T}from"./util-SiQC2MJh.js";import{H as G}from"./HelpTip-CT07o3kB.js";import{_ as K}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./index-CxPIS6G7.js";const W={class:"head"},X={class:"intent"},Y={class:"block"},Z={class:"block"},w={class:"intent-main"},ee={class:"muted"},te={class:"muted ellipsis"},ne={class:"intent-stack"},se={class:"muted mono"},oe={class:"muted"},ae={class:"intent-stack"},le={class:"muted"},ie={class:"intent-stack"},de={key:0,class:"muted ellipsis"},re={key:1,class:"muted"},ue=R({__name:"Approvals",setup(pe){const $=F(),f=N([]),c=N("pending");let y=0;async function _(){f.value=await O("/admin/api/tool-approvals?status="+c.value)}async function g(n,t){try{const r=await O(`/admin/api/tool-approvals/${n}/${t}`,{method:"POST"});J.success(t==="approve"?r.rerun?"已批准,任务已自动重跑":"已批准(任务在途,运行中会执行该调用)":"已拒绝"),await _()}catch(r){J.error(r.message)}}function B(n){$.push("/runs?job="+n)}function I(){Q("/docs/approvals")}function b(n,t){return n==="risk_high"?"高风险":n==="confirm_required"?"强制确认":n==="confirm_when"?"条件确认":t==="high"?"高风险":"需确认"}function j(n){return n==="high"?"高风险":n==="medium"?"中风险":n||"需确认"}function D(n){return n.status==="pending"?"待决策":n.status==="approved"?n.used_at?"已批准 · 已执行":"已批准 · 待执行":"已拒绝"}function E(n){return n.status==="pending"?"warning":n.status==="approved"?"success":"info"}function L(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch{return n}}return U(()=>{_(),y=window.setInterval(()=>void _(),3e4)}),q(()=>window.clearInterval(y)),(n,t)=>{const r=i("el-button"),k=i("el-radio-button"),A=i("el-radio-group"),H=i("el-empty"),p=i("el-table-column"),h=i("el-tag"),C=i("el-popconfirm"),M=i("el-table"),P=i("el-card");return u(),v(P,{shadow:"never"},{header:s(()=>[o("div",W,[t[5]||(t[5]=o("b",null,"审批意图",-1)),t[6]||(t[6]=d()),a(G,{title:"审批意图是什么"},{default:s(()=>[...t[1]||(t[1]=[o("p",null,"高风险或命中参数级确认规则的工具调用会先冻结成审批意图。中枢锁定调用快照,批准后任务自动重跑并只执行被批准的那次调用。",-1),o("p",null,"如果路由配置了业务侧审批承接,这里仍可追溯中枢侧意图与最终决策;实际审批人和审批页面由业务系统决定。",-1)])]),_:1}),a(r,{style:{"margin-left":"auto"},onClick:I},{default:s(()=>[...t[2]||(t[2]=[d("开发文档",-1)])]),_:1}),a(A,{modelValue:c.value,"onUpdate:modelValue":t[0]||(t[0]=e=>c.value=e),size:"small",onChange:_},{default:s(()=>[a(k,{value:"pending"},{default:s(()=>[...t[3]||(t[3]=[d("待审批",-1)])]),_:1}),a(k,{value:"all"},{default:s(()=>[...t[4]||(t[4]=[d("全部",-1)])]),_:1})]),_:1},8,["modelValue"])])]),default:s(()=>[f.value.length?(u(),v(M,{key:1,data:f.value,"row-key":"id"},{default:s(()=>[a(p,{type:"expand"},{default:s(({row:e})=>[o("div",X,[t[8]||(t[8]=o("div",{class:"td-sec"},"参数快照",-1)),o("pre",Y,l(L(e.args_json||"{}")),1),e.intent?(u(),m(x,{key:0},[t[7]||(t[7]=o("div",{class:"td-sec"},"审批意图完整快照",-1)),o("pre",Z,l(JSON.stringify(e.intent,null,2)),1)],64)):S("",!0)])]),_:1}),a(p,{label:"审批意图","min-width":"320","show-overflow-tooltip":""},{default:s(({row:e})=>[o("div",w,[o("span",ee,"#"+l(e.id)+" · "+l(z(T)(e.created_at)),1),o("b",null,l(e.summary||e.reason||e.tool),1),o("span",te,l(e.reason||b(e.policy,e.risk)),1),o("code",null,l(e.provider)+" · "+l(e.tool),1)])]),_:1}),a(p,{label:"调用上下文","min-width":"260","show-overflow-tooltip":""},{default:s(({row:e})=>[o("div",ne,[o("code",null,l(e.method)+" "+l(e.path),1),o("span",se,l(e.scope),1),o("span",oe,"主体 "+l(e.on_behalf_of||"无主体"),1),a(r,{link:"",type:"primary",size:"small",onClick:V=>B(e.job_id)},{default:s(()=>[...t[9]||(t[9]=[d("看任务",-1)])]),_:1},8,["onClick"])])]),_:1}),a(p,{label:"治理规则",width:"150"},{default:s(({row:e})=>[o("div",ae,[a(h,{size:"small",effect:"plain",type:e.risk==="high"?"danger":"warning"},{default:s(()=>[d(l(j(e.risk)),1)]),_:2},1032,["type"]),o("span",le,l(b(e.policy,e.risk)),1)])]),_:1}),a(p,{label:"决策状态",width:"170"},{default:s(({row:e})=>[o("div",ie,[a(h,{size:"small",type:E(e),effect:"plain"},{default:s(()=>[d(l(D(e)),1)]),_:2},1032,["type"]),e.decided_by?(u(),m("span",de,l(e.decided_by)+" · "+l(z(T)(e.decided_at)),1)):(u(),m("span",re,"等待业务侧或控制台兜底决策"))])]),_:1}),a(p,{width:"178",align:"right"},{default:s(({row:e})=>[e.status==="pending"?(u(),m(x,{key:0},[a(C,{title:"批准该意图?任务将自动重跑并执行这次已冻结的调用快照。",width:"260",onConfirm:V=>g(e.id,"approve")},{reference:s(()=>[a(r,{link:"",type:"success"},{default:s(()=>[...t[10]||(t[10]=[d("兜底批准",-1)])]),_:1})]),_:1},8,["onConfirm"]),a(C,{title:"拒绝该意图?任务保持原结论,不会重跑。",width:"260",onConfirm:V=>g(e.id,"deny")},{reference:s(()=>[a(r,{link:"",type:"danger"},{default:s(()=>[...t[11]||(t[11]=[d("兜底拒绝",-1)])]),_:1})]),_:1},8,["onConfirm"])],64)):S("",!0)]),_:1})]),_:1},8,["data"])):(u(),v(H,{key:0,description:c.value==="pending"?"没有待审批的调用":"还没有审批记录"},null,8,["description"]))]),_:1})}}}),ke=K(ue,[["__scopeId","data-v-03845cb0"]]);export{ke as default};
@@ -1 +1 @@
1
- import{a as h}from"./request-FM608Kfz.js";import{f as B}from"./util-SiQC2MJh.js";import{H as N}from"./HelpTip-CT07o3kB.js";import{d as P,z as S,I as g,J as a,ai as i,r as d,o as u,K as V,S as n,e as o,Q as c,u as A,P as p,c as $,O as H,as as I}from"./vendor-vue-B2uhHUfE.js";import{_ as M}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./index-S_J0I0Zh.js";import"./vendor-element-D7WRzHhy.js";const O={class:"head"},j={class:"audit-main"},z={class:"muted"},G={class:"audit-stack"},J={class:"muted mono"},K={key:2,class:"loadmore"},f=100,Q=P({__name:"Audit",setup(U){const s=d([]),r=d(!1),m=d(!1),_=d(!1);function k(e){return String(e||"").replace(/^\/admin\/api\//,"").replace(/^routes/,"触发路由").replace(/^clients/,"接入方").replace(/^credentials/,"模型凭证").replace(/^tool-providers/,"工具源").replace(/^targets/,"调度目标").replace(/^executor-tokens/,"执行器令牌").replace(/^storage-buckets/,"对象存储").replace(/^admins/,"后台账号").replace(/^kb/,"知识库")}function w(e){return e==="DELETE"?"删除":e==="POST"?"保存":e==="PUT"?"更新":e||"变更"}async function b(){r.value=!0;try{const e=await h(`/admin/api/config-audit?limit=${f}&offset=0`);s.value=e,m.value=e.length===f}finally{r.value=!1}}async function E(){_.value=!0;try{const e=await h(`/admin/api/config-audit?limit=${f}&offset=${s.value.length}`);s.value=s.value.concat(e),m.value=e.length===f}finally{_.value=!1}}return S(b),(e,t)=>{const y=i("el-button"),T=i("el-empty"),v=i("el-table-column"),x=i("el-tag"),C=i("el-table"),D=i("el-card"),L=I("loading");return u(),g(D,{shadow:"never"},{header:a(()=>[o("div",O,[t[2]||(t[2]=o("b",null,"变更审计",-1)),t[3]||(t[3]=p()),n(N,{title:"变更审计是什么"},{default:a(()=>[...t[0]||(t[0]=[o("p",null,"记录控制台配置被谁修改、何时修改、作用到哪个配置对象。用于追溯路由、凭证、接入方、账号、知识库、目标等配置变更。",-1),o("p",null,"这是配置审计,不是任务执行 trace;任务执行过程请到「任务」查看。",-1)])]),_:1}),n(y,{style:{"margin-left":"auto"},loading:r.value,onClick:b},{default:a(()=>[...t[1]||(t[1]=[p("刷新",-1)])]),_:1},8,["loading"])])]),default:a(()=>[!s.value.length&&!r.value?(u(),g(T,{key:0,description:"暂无配置变更记录"})):V((u(),g(C,{key:1,data:s.value},{default:a(()=>[n(v,{label:"变更事件","min-width":"260","show-overflow-tooltip":""},{default:a(({row:l})=>[o("div",j,[o("b",null,c(l.by||"未知操作人"),1),o("span",z,c(A(B)(l.ts,!0)),1)])]),_:1}),n(v,{label:"配置对象","min-width":"360","show-overflow-tooltip":""},{default:a(({row:l})=>[o("div",G,[o("code",null,c(k(l.path)),1),o("span",J,c(l.path),1)])]),_:1}),n(v,{label:"动作",width:"110",align:"center"},{default:a(({row:l})=>[n(x,{type:l.method==="DELETE"?"danger":"success",effect:"plain"},{default:a(()=>[p(c(w(l.method)),1)]),_:2},1032,["type"])]),_:1})]),_:1},8,["data"])),[[L,r.value]]),m.value?(u(),$("div",K,[n(y,{loading:_.value,onClick:E},{default:a(()=>[...t[4]||(t[4]=[p("加载更多",-1)])]),_:1},8,["loading"])])):H("",!0)]),_:1})}}}),ee=M(Q,[["__scopeId","data-v-a240b46d"]]);export{ee as default};
1
+ import{a as h}from"./request-CBLNpLth.js";import{f as B}from"./util-SiQC2MJh.js";import{H as N}from"./HelpTip-CT07o3kB.js";import{d as P,z as S,I as g,J as a,ai as i,r as d,o as u,K as V,S as n,e as o,Q as c,u as A,P as p,c as $,O as H,as as I}from"./vendor-vue-B2uhHUfE.js";import{_ as M}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./index-CxPIS6G7.js";import"./vendor-element-D7WRzHhy.js";const O={class:"head"},j={class:"audit-main"},z={class:"muted"},G={class:"audit-stack"},J={class:"muted mono"},K={key:2,class:"loadmore"},f=100,Q=P({__name:"Audit",setup(U){const s=d([]),r=d(!1),m=d(!1),_=d(!1);function k(e){return String(e||"").replace(/^\/admin\/api\//,"").replace(/^routes/,"触发路由").replace(/^clients/,"接入方").replace(/^credentials/,"模型凭证").replace(/^tool-providers/,"工具源").replace(/^targets/,"调度目标").replace(/^executor-tokens/,"执行器令牌").replace(/^storage-buckets/,"对象存储").replace(/^admins/,"后台账号").replace(/^kb/,"知识库")}function w(e){return e==="DELETE"?"删除":e==="POST"?"保存":e==="PUT"?"更新":e||"变更"}async function b(){r.value=!0;try{const e=await h(`/admin/api/config-audit?limit=${f}&offset=0`);s.value=e,m.value=e.length===f}finally{r.value=!1}}async function E(){_.value=!0;try{const e=await h(`/admin/api/config-audit?limit=${f}&offset=${s.value.length}`);s.value=s.value.concat(e),m.value=e.length===f}finally{_.value=!1}}return S(b),(e,t)=>{const y=i("el-button"),T=i("el-empty"),v=i("el-table-column"),x=i("el-tag"),C=i("el-table"),D=i("el-card"),L=I("loading");return u(),g(D,{shadow:"never"},{header:a(()=>[o("div",O,[t[2]||(t[2]=o("b",null,"变更审计",-1)),t[3]||(t[3]=p()),n(N,{title:"变更审计是什么"},{default:a(()=>[...t[0]||(t[0]=[o("p",null,"记录控制台配置被谁修改、何时修改、作用到哪个配置对象。用于追溯路由、凭证、接入方、账号、知识库、目标等配置变更。",-1),o("p",null,"这是配置审计,不是任务执行 trace;任务执行过程请到「任务」查看。",-1)])]),_:1}),n(y,{style:{"margin-left":"auto"},loading:r.value,onClick:b},{default:a(()=>[...t[1]||(t[1]=[p("刷新",-1)])]),_:1},8,["loading"])])]),default:a(()=>[!s.value.length&&!r.value?(u(),g(T,{key:0,description:"暂无配置变更记录"})):V((u(),g(C,{key:1,data:s.value},{default:a(()=>[n(v,{label:"变更事件","min-width":"260","show-overflow-tooltip":""},{default:a(({row:l})=>[o("div",j,[o("b",null,c(l.by||"未知操作人"),1),o("span",z,c(A(B)(l.ts,!0)),1)])]),_:1}),n(v,{label:"配置对象","min-width":"360","show-overflow-tooltip":""},{default:a(({row:l})=>[o("div",G,[o("code",null,c(k(l.path)),1),o("span",J,c(l.path),1)])]),_:1}),n(v,{label:"动作",width:"110",align:"center"},{default:a(({row:l})=>[n(x,{type:l.method==="DELETE"?"danger":"success",effect:"plain"},{default:a(()=>[p(c(w(l.method)),1)]),_:2},1032,["type"])]),_:1})]),_:1},8,["data"])),[[L,r.value]]),m.value?(u(),$("div",K,[n(y,{loading:_.value,onClick:E},{default:a(()=>[...t[4]||(t[4]=[p("加载更多",-1)])]),_:1},8,["loading"])])):H("",!0)]),_:1})}}}),ee=M(Q,[["__scopeId","data-v-a240b46d"]]);export{ee as default};
@@ -1 +1 @@
1
- import{i as H,a as t}from"./index-S_J0I0Zh.js";import{d as e,u as Q,o as V,c as s,aD as r}from"./vendor-vue-B2uhHUfE.js";import{_ as M}from"./_plugin-vue_export-helper-DlAUqK2U.js";const o=["src","alt"],n={key:1,class:"brand-lockup-svg",viewBox:"0 0 144 58",role:"img","aria-label":"百灵中枢 BailingHub"},l=e({__name:"BrandLockup",setup(Z){return(c,a)=>Q(H).logo_url?(V(),s("img",{key:0,class:"brand-lockup-image",src:Q(t)(Q(H).logo_url),alt:Q(H).site_name},null,8,o)):(V(),s("svg",n,[...a[0]||(a[0]=[r('<g transform="translate(0 -3) scale(0.2416667)" data-v-efbff744><path class="brand-lockup-svg__mark-main" fill-rule="evenodd" d="M42 44h34v152H54l-12-12zM76 44h58v34H76zM76 103h22v34H76zM76 162h58v34H76zM150 44h22l12 12v8h-34zM150 86h34v110h-34z" data-v-efbff744></path><path class="brand-lockup-svg__mark-accent" fill-rule="evenodd" d="M116 103h68v34h-68zM76 162h58v34H76z" data-v-efbff744></path></g><path class="brand-lockup-svg__main" transform="translate(0 1)" d="M59.197 7.553H77.824V10.535H59.197ZM63.397 17.486H73.897V20.237H63.397ZM63.481 22.442H73.603V25.256H63.481ZM66.715 8.645 70.474 9.401Q70.222 10.304 69.96 11.186Q69.697 12.068 69.466 12.845Q69.235 13.622 69.004 14.231L66.085 13.496Q66.232 12.803 66.368 11.963Q66.505 11.123 66.6 10.262Q66.694 9.401 66.715 8.645ZM61.129 12.509H76.081V26.474H72.805V15.323H64.237V26.474H61.129Z M87.925 15.911H91.159Q91.012 17.507 90.739 18.893Q90.466 20.279 89.868 21.476Q89.269 22.673 88.177 23.649Q87.085 24.626 85.342 25.392Q83.599 26.159 80.995 26.684Q80.806 26.075 80.344 25.298Q79.882 24.521 79.42 24.038Q81.73 23.639 83.242 23.082Q84.754 22.526 85.647 21.791Q86.539 21.056 86.99 20.163Q87.442 19.271 87.631 18.21Q87.82 17.15 87.925 15.911ZM82.948 16.541 85.573 17.507Q85.195 18.746 84.618 19.985Q84.04 21.224 83.179 22.085L80.638 20.552Q81.436 19.817 82.024 18.746Q82.612 17.675 82.948 16.541ZM95.401 16.415 98.047 17.927Q97.396 18.998 96.714 20.069Q96.031 21.14 95.443 21.917L93.175 20.531Q93.553 20.006 93.963 19.303Q94.372 18.599 94.761 17.843Q95.149 17.087 95.401 16.415ZM90.781 17.192Q91.306 19.145 92.335 20.499Q93.364 21.854 95.118 22.62Q96.871 23.387 99.58 23.639Q99.286 23.954 98.95 24.447Q98.614 24.941 98.32 25.466Q98.026 25.991 97.837 26.432Q95.611 26.075 94.025 25.382Q92.44 24.689 91.358 23.597Q90.277 22.505 89.542 20.993Q88.807 19.481 88.282 17.486ZM82.108 10.304H96.115V12.362H82.108ZM81.184 7.07H97.354V15.533H81.184V12.845H94.435V9.758H81.184Z M101.743 10.136H119.341V21.056H116.128V13.139H104.809V21.161H101.743ZM103.318 17.066H117.892V20.069H103.318ZM108.841 6.545H112.075V26.495H108.841Z M121.714 10.388H129.001V13.202H121.714ZM124.276 6.545H127.027V26.495H124.276ZM124.255 12.551 125.83 13.202Q125.62 14.525 125.305 15.9Q124.99 17.276 124.591 18.588Q124.192 19.901 123.709 21.035Q123.226 22.169 122.68 22.988Q122.554 22.547 122.312 21.98Q122.071 21.413 121.798 20.846Q121.525 20.279 121.273 19.859Q121.777 19.229 122.239 18.358Q122.701 17.486 123.089 16.499Q123.478 15.512 123.772 14.493Q124.066 13.475 124.255 12.551ZM126.922 13.664Q127.111 13.874 127.468 14.409Q127.825 14.945 128.234 15.585Q128.644 16.226 128.99 16.772Q129.337 17.318 129.463 17.549L127.72 19.565Q127.552 19.061 127.29 18.41Q127.027 17.759 126.722 17.066Q126.418 16.373 126.124 15.764Q125.83 15.155 125.599 14.714ZM141.118 7.574V10.325H132.403V23.051H141.454V25.781H129.442V7.574ZM132.235 12.614 134.482 11.144Q135.343 12.236 136.277 13.496Q137.212 14.756 138.115 16.026Q139.018 17.297 139.753 18.494Q140.488 19.691 140.95 20.699L138.409 22.484Q138.01 21.497 137.317 20.268Q136.624 19.04 135.774 17.717Q134.923 16.394 134.01 15.081Q133.096 13.769 132.235 12.614ZM137.947 10.913 140.761 11.669Q140.026 13.769 139.018 15.817Q138.01 17.864 136.844 19.649Q135.679 21.434 134.44 22.757Q134.209 22.484 133.789 22.085Q133.369 21.686 132.939 21.308Q132.508 20.93 132.172 20.699Q133.39 19.565 134.471 18Q135.553 16.436 136.445 14.619Q137.338 12.803 137.947 10.913Z" data-v-efbff744></path><path class="brand-lockup-svg__sub" transform="translate(-1 0)" d="M60.891 43.8V35.77H63.3Q64.455 35.77 65.126 36.32Q65.797 36.87 65.797 37.838Q65.797 38.377 65.555 38.778Q65.313 39.18 64.895 39.4Q64.477 39.62 63.938 39.62V39.543Q64.532 39.532 64.988 39.763Q65.445 39.994 65.709 40.445Q65.973 40.896 65.973 41.523Q65.973 42.216 65.665 42.733Q65.357 43.25 64.791 43.525Q64.224 43.8 63.443 43.8ZM62.134 42.711H63.355Q63.971 42.711 64.334 42.381Q64.697 42.051 64.697 41.468Q64.697 40.874 64.334 40.516Q63.971 40.159 63.355 40.159H62.134ZM62.134 39.103H63.289Q63.861 39.103 64.186 38.8Q64.51 38.498 64.51 37.981Q64.51 37.453 64.186 37.156Q63.861 36.859 63.3 36.859H62.134Z M68.029 43.8 70.064 35.77H71.736L73.771 43.8H72.473L72 41.809H69.8L69.338 43.8ZM70.031 40.753H71.758L71.252 38.52Q71.12 37.948 71.026 37.497Q70.933 37.046 70.9 36.87Q70.867 37.046 70.779 37.492Q70.691 37.937 70.559 38.509Z M76.234 43.8V42.667H77.851V36.903H76.234V35.77H80.766V36.903H79.149V42.667H80.766V43.8Z M83.966 43.8V35.77H85.253V42.612H88.707V43.8Z M91.434 43.8V42.667H93.051V36.903H91.434V35.77H95.966V36.903H94.349V42.667H95.966V43.8Z M98.847 43.8V35.77H100.431L102.719 42.348Q102.697 42.018 102.658 41.561Q102.62 41.105 102.598 40.615Q102.576 40.126 102.576 39.741V35.77H103.753V43.8H102.169L99.892 37.222Q99.925 37.519 99.952 37.959Q99.98 38.399 100.002 38.867Q100.024 39.334 100.024 39.73V43.8Z M108.944 43.91Q108.185 43.91 107.618 43.624Q107.052 43.338 106.744 42.804Q106.436 42.271 106.436 41.556V38.014Q106.436 37.288 106.744 36.76Q107.052 36.232 107.618 35.946Q108.185 35.66 108.944 35.66Q109.714 35.66 110.269 35.951Q110.825 36.243 111.133 36.765Q111.441 37.288 111.441 38.014H110.165Q110.165 37.42 109.846 37.106Q109.527 36.793 108.944 36.793Q108.361 36.793 108.036 37.106Q107.712 37.42 107.712 38.014V41.556Q107.712 42.139 108.036 42.463Q108.361 42.788 108.944 42.788Q109.527 42.788 109.846 42.463Q110.165 42.139 110.165 41.545V40.698H108.724V39.576H111.441V41.556Q111.441 42.271 111.133 42.799Q110.825 43.327 110.269 43.618Q109.714 43.91 108.944 43.91Z M121.691 43.8V35.77H122.978V39.048H125.222V35.77H126.509V43.8H125.222V40.236H122.978V43.8Z M131.7 43.91Q130.534 43.91 129.89 43.272Q129.247 42.634 129.247 41.534V35.77H130.523V41.523Q130.523 42.117 130.82 42.453Q131.117 42.788 131.7 42.788Q132.272 42.788 132.574 42.453Q132.877 42.117 132.877 41.523V35.77H134.153V41.534Q134.153 42.634 133.515 43.272Q132.877 43.91 131.7 43.91Z M136.891 43.8V35.77H139.3Q140.455 35.77 141.126 36.32Q141.797 36.87 141.797 37.838Q141.797 38.377 141.555 38.778Q141.313 39.18 140.895 39.4Q140.477 39.62 139.938 39.62V39.543Q140.532 39.532 140.988 39.763Q141.445 39.994 141.709 40.445Q141.973 40.896 141.973 41.523Q141.973 42.216 141.665 42.733Q141.357 43.25 140.79 43.525Q140.224 43.8 139.443 43.8ZM138.134 42.711H139.355Q139.971 42.711 140.334 42.381Q140.697 42.051 140.697 41.468Q140.697 40.874 140.334 40.516Q139.971 40.159 139.355 40.159H138.134ZM138.134 39.103H139.289Q139.861 39.103 140.185 38.8Q140.51 38.498 140.51 37.981Q140.51 37.453 140.185 37.156Q139.861 36.859 139.3 36.859H138.134Z" data-v-efbff744></path>',3)])]))}}),_=M(l,[["__scopeId","data-v-efbff744"]]);export{_ as B};
1
+ import{i as H,a as t}from"./index-CxPIS6G7.js";import{d as e,u as Q,o as V,c as s,aD as r}from"./vendor-vue-B2uhHUfE.js";import{_ as M}from"./_plugin-vue_export-helper-DlAUqK2U.js";const o=["src","alt"],n={key:1,class:"brand-lockup-svg",viewBox:"0 0 144 58",role:"img","aria-label":"百灵中枢 BailingHub"},l=e({__name:"BrandLockup",setup(Z){return(c,a)=>Q(H).logo_url?(V(),s("img",{key:0,class:"brand-lockup-image",src:Q(t)(Q(H).logo_url),alt:Q(H).site_name},null,8,o)):(V(),s("svg",n,[...a[0]||(a[0]=[r('<g transform="translate(0 -3) scale(0.2416667)" data-v-efbff744><path class="brand-lockup-svg__mark-main" fill-rule="evenodd" d="M42 44h34v152H54l-12-12zM76 44h58v34H76zM76 103h22v34H76zM76 162h58v34H76zM150 44h22l12 12v8h-34zM150 86h34v110h-34z" data-v-efbff744></path><path class="brand-lockup-svg__mark-accent" fill-rule="evenodd" d="M116 103h68v34h-68zM76 162h58v34H76z" data-v-efbff744></path></g><path class="brand-lockup-svg__main" transform="translate(0 1)" d="M59.197 7.553H77.824V10.535H59.197ZM63.397 17.486H73.897V20.237H63.397ZM63.481 22.442H73.603V25.256H63.481ZM66.715 8.645 70.474 9.401Q70.222 10.304 69.96 11.186Q69.697 12.068 69.466 12.845Q69.235 13.622 69.004 14.231L66.085 13.496Q66.232 12.803 66.368 11.963Q66.505 11.123 66.6 10.262Q66.694 9.401 66.715 8.645ZM61.129 12.509H76.081V26.474H72.805V15.323H64.237V26.474H61.129Z M87.925 15.911H91.159Q91.012 17.507 90.739 18.893Q90.466 20.279 89.868 21.476Q89.269 22.673 88.177 23.649Q87.085 24.626 85.342 25.392Q83.599 26.159 80.995 26.684Q80.806 26.075 80.344 25.298Q79.882 24.521 79.42 24.038Q81.73 23.639 83.242 23.082Q84.754 22.526 85.647 21.791Q86.539 21.056 86.99 20.163Q87.442 19.271 87.631 18.21Q87.82 17.15 87.925 15.911ZM82.948 16.541 85.573 17.507Q85.195 18.746 84.618 19.985Q84.04 21.224 83.179 22.085L80.638 20.552Q81.436 19.817 82.024 18.746Q82.612 17.675 82.948 16.541ZM95.401 16.415 98.047 17.927Q97.396 18.998 96.714 20.069Q96.031 21.14 95.443 21.917L93.175 20.531Q93.553 20.006 93.963 19.303Q94.372 18.599 94.761 17.843Q95.149 17.087 95.401 16.415ZM90.781 17.192Q91.306 19.145 92.335 20.499Q93.364 21.854 95.118 22.62Q96.871 23.387 99.58 23.639Q99.286 23.954 98.95 24.447Q98.614 24.941 98.32 25.466Q98.026 25.991 97.837 26.432Q95.611 26.075 94.025 25.382Q92.44 24.689 91.358 23.597Q90.277 22.505 89.542 20.993Q88.807 19.481 88.282 17.486ZM82.108 10.304H96.115V12.362H82.108ZM81.184 7.07H97.354V15.533H81.184V12.845H94.435V9.758H81.184Z M101.743 10.136H119.341V21.056H116.128V13.139H104.809V21.161H101.743ZM103.318 17.066H117.892V20.069H103.318ZM108.841 6.545H112.075V26.495H108.841Z M121.714 10.388H129.001V13.202H121.714ZM124.276 6.545H127.027V26.495H124.276ZM124.255 12.551 125.83 13.202Q125.62 14.525 125.305 15.9Q124.99 17.276 124.591 18.588Q124.192 19.901 123.709 21.035Q123.226 22.169 122.68 22.988Q122.554 22.547 122.312 21.98Q122.071 21.413 121.798 20.846Q121.525 20.279 121.273 19.859Q121.777 19.229 122.239 18.358Q122.701 17.486 123.089 16.499Q123.478 15.512 123.772 14.493Q124.066 13.475 124.255 12.551ZM126.922 13.664Q127.111 13.874 127.468 14.409Q127.825 14.945 128.234 15.585Q128.644 16.226 128.99 16.772Q129.337 17.318 129.463 17.549L127.72 19.565Q127.552 19.061 127.29 18.41Q127.027 17.759 126.722 17.066Q126.418 16.373 126.124 15.764Q125.83 15.155 125.599 14.714ZM141.118 7.574V10.325H132.403V23.051H141.454V25.781H129.442V7.574ZM132.235 12.614 134.482 11.144Q135.343 12.236 136.277 13.496Q137.212 14.756 138.115 16.026Q139.018 17.297 139.753 18.494Q140.488 19.691 140.95 20.699L138.409 22.484Q138.01 21.497 137.317 20.268Q136.624 19.04 135.774 17.717Q134.923 16.394 134.01 15.081Q133.096 13.769 132.235 12.614ZM137.947 10.913 140.761 11.669Q140.026 13.769 139.018 15.817Q138.01 17.864 136.844 19.649Q135.679 21.434 134.44 22.757Q134.209 22.484 133.789 22.085Q133.369 21.686 132.939 21.308Q132.508 20.93 132.172 20.699Q133.39 19.565 134.471 18Q135.553 16.436 136.445 14.619Q137.338 12.803 137.947 10.913Z" data-v-efbff744></path><path class="brand-lockup-svg__sub" transform="translate(-1 0)" d="M60.891 43.8V35.77H63.3Q64.455 35.77 65.126 36.32Q65.797 36.87 65.797 37.838Q65.797 38.377 65.555 38.778Q65.313 39.18 64.895 39.4Q64.477 39.62 63.938 39.62V39.543Q64.532 39.532 64.988 39.763Q65.445 39.994 65.709 40.445Q65.973 40.896 65.973 41.523Q65.973 42.216 65.665 42.733Q65.357 43.25 64.791 43.525Q64.224 43.8 63.443 43.8ZM62.134 42.711H63.355Q63.971 42.711 64.334 42.381Q64.697 42.051 64.697 41.468Q64.697 40.874 64.334 40.516Q63.971 40.159 63.355 40.159H62.134ZM62.134 39.103H63.289Q63.861 39.103 64.186 38.8Q64.51 38.498 64.51 37.981Q64.51 37.453 64.186 37.156Q63.861 36.859 63.3 36.859H62.134Z M68.029 43.8 70.064 35.77H71.736L73.771 43.8H72.473L72 41.809H69.8L69.338 43.8ZM70.031 40.753H71.758L71.252 38.52Q71.12 37.948 71.026 37.497Q70.933 37.046 70.9 36.87Q70.867 37.046 70.779 37.492Q70.691 37.937 70.559 38.509Z M76.234 43.8V42.667H77.851V36.903H76.234V35.77H80.766V36.903H79.149V42.667H80.766V43.8Z M83.966 43.8V35.77H85.253V42.612H88.707V43.8Z M91.434 43.8V42.667H93.051V36.903H91.434V35.77H95.966V36.903H94.349V42.667H95.966V43.8Z M98.847 43.8V35.77H100.431L102.719 42.348Q102.697 42.018 102.658 41.561Q102.62 41.105 102.598 40.615Q102.576 40.126 102.576 39.741V35.77H103.753V43.8H102.169L99.892 37.222Q99.925 37.519 99.952 37.959Q99.98 38.399 100.002 38.867Q100.024 39.334 100.024 39.73V43.8Z M108.944 43.91Q108.185 43.91 107.618 43.624Q107.052 43.338 106.744 42.804Q106.436 42.271 106.436 41.556V38.014Q106.436 37.288 106.744 36.76Q107.052 36.232 107.618 35.946Q108.185 35.66 108.944 35.66Q109.714 35.66 110.269 35.951Q110.825 36.243 111.133 36.765Q111.441 37.288 111.441 38.014H110.165Q110.165 37.42 109.846 37.106Q109.527 36.793 108.944 36.793Q108.361 36.793 108.036 37.106Q107.712 37.42 107.712 38.014V41.556Q107.712 42.139 108.036 42.463Q108.361 42.788 108.944 42.788Q109.527 42.788 109.846 42.463Q110.165 42.139 110.165 41.545V40.698H108.724V39.576H111.441V41.556Q111.441 42.271 111.133 42.799Q110.825 43.327 110.269 43.618Q109.714 43.91 108.944 43.91Z M121.691 43.8V35.77H122.978V39.048H125.222V35.77H126.509V43.8H125.222V40.236H122.978V43.8Z M131.7 43.91Q130.534 43.91 129.89 43.272Q129.247 42.634 129.247 41.534V35.77H130.523V41.523Q130.523 42.117 130.82 42.453Q131.117 42.788 131.7 42.788Q132.272 42.788 132.574 42.453Q132.877 42.117 132.877 41.523V35.77H134.153V41.534Q134.153 42.634 133.515 43.272Q132.877 43.91 131.7 43.91Z M136.891 43.8V35.77H139.3Q140.455 35.77 141.126 36.32Q141.797 36.87 141.797 37.838Q141.797 38.377 141.555 38.778Q141.313 39.18 140.895 39.4Q140.477 39.62 139.938 39.62V39.543Q140.532 39.532 140.988 39.763Q141.445 39.994 141.709 40.445Q141.973 40.896 141.973 41.523Q141.973 42.216 141.665 42.733Q141.357 43.25 140.79 43.525Q140.224 43.8 139.443 43.8ZM138.134 42.711H139.355Q139.971 42.711 140.334 42.381Q140.697 42.051 140.697 41.468Q140.697 40.874 140.334 40.516Q139.971 40.159 139.355 40.159H138.134ZM138.134 39.103H139.289Q139.861 39.103 140.185 38.8Q140.51 38.498 140.51 37.981Q140.51 37.453 140.185 37.156Q139.861 36.859 139.3 36.859H138.134Z" data-v-efbff744></path>',3)])]))}}),_=M(l,[["__scopeId","data-v-efbff744"]]);export{_ as B};
@@ -1,4 +1,4 @@
1
- import{E as P}from"./vendor-element-D7WRzHhy.js";import{a as x}from"./request-FM608Kfz.js";import{o as ze}from"./docs-DPUOCa7R.js";import{c as z}from"./util-SiQC2MJh.js";import{u as Be,b as B}from"./index-S_J0I0Zh.js";import{H as y}from"./HelpTip-CT07o3kB.js";import{u as Le,s as Ke,a as Je,b as Me}from"./schema-DWnFqTkB.js";import{d as Fe,z as Xe,c as g,S as a,J as t,R as D,r as b,ai as f,o as r,I as $,P as o,e as l,Q as i,O as T,u as N,a3 as L,q as Ee,m as K}from"./vendor-vue-B2uhHUfE.js";import{_ as Ge}from"./_plugin-vue_export-helper-DlAUqK2U.js";const Qe={class:"head"},We={class:"channel-main"},Ye={class:"tagline"},Ze={key:0,class:"muted ellipsis"},el={class:"channel-stack"},ll={class:"tagline"},tl={class:"muted"},nl={class:"callback-line"},al={class:"mono muted"},ol={class:"channel-stack"},sl={class:"tagline"},il={key:0,class:"muted"},dl={class:"head"},ul={class:"channel-main"},rl={key:0,class:"muted ellipsis"},pl={class:"channel-stack"},ml={class:"tagline"},fl={class:"mono muted"},cl={class:"channel-stack"},vl={class:"muted"},yl={key:0,class:"field-required"},bl={key:0,class:"field-required"},_l={key:0,class:"field-required"},kl={class:"code-context"},gl={class:"code-context-main"},$l={key:1,class:"muted"},Vl={key:0,class:"channel-code-summary"},Cl={class:"mono"},Tl={class:"mono"},xl={class:"snippet-card"},wl={class:"snippet-head"},Ul={class:"snippet-code"},hl={class:"snippet-card"},Pl={class:"snippet-head"},Sl={class:"snippet-code"},El={class:"snippet-card"},Al={class:"snippet-head"},Ol={class:"snippet-code"},Il={class:"snippet-card"},jl={class:"snippet-head"},ql={class:"snippet-code"},Rl={class:"code-notices compact",style:{"margin-top":"12px"}},Dl={class:"code-notice info"},Nl=Fe({__name:"Channels",setup(Hl){const G={wecom:"企业微信",feishu:"飞书"},Q=Be(),J=Le("channel"),O=b([]),W=b([]),Y=b(!1),_=b(null),k=b(""),C=b("<接入方token>"),Z=b("curl"),ee=b([]),de=b([]),I=b(!1),j=b(!1),le=b(!1),M=b("basic"),ue={name:"",kind:"wecom",route_key:"",corpid:"",token:"",aes_key:"",agentid:"",secret:"",reply_wait_ms:4e3,bucket:"",description:"",enabled:!0},u=Ee({...ue});function m(s,e){return Ke(J.schema.value,s,e)}function V(s,e=""){return Je(J.schema.value,s,e)}function te(s){return Me(J.required.value,s)}function re(s,e="wecom"){const d=e==="wecom"?"wecom":e;return`${B()}/${d}/${s}`}function pe(s){return re(s.name,s.kind)}function me(s){const e=ee.value.find(d=>d.route_key===s);return(e==null?void 0:e.name)||s||"-"}function F(s){const e=s.config||{};return!!(e.corpid&&e.agentid&&(e.secret||e.secret_masked||e.has_secret))}function Ae(s){const e=Array.isArray(s)?s.map(d=>String(d)).filter(Boolean):[];return e.length?e.length<=3?e.join("、"):`${e.slice(0,3).join("、")} 等 ${e.length} 人`:"-"}async function ne(){O.value=await x("/admin/api/channels")}function fe(){j.value=!1,M.value="basic",Object.assign(u,ue),I.value=!0}function Oe(s){j.value=!0,M.value="basic";const e=s.config||{};Object.assign(u,{name:s.name,kind:s.kind,route_key:s.route_key,corpid:e.corpid||"",token:"",aes_key:"",agentid:e.agentid||"",secret:"",reply_wait_ms:Number(e.reply_wait_ms)||4e3,bucket:e.bucket||"",description:s.description||"",enabled:!!s.enabled}),I.value=!0}async function Ie(){le.value=!0;try{const s={name:u.name,kind:u.kind,route_key:u.route_key,description:u.description,enabled:u.enabled,config:{corpid:u.corpid,token:u.token,aes_key:u.aes_key,agentid:u.agentid,secret:u.secret,reply_wait_ms:u.reply_wait_ms,bucket:u.bucket}};await x("/admin/api/channels",{method:"POST",body:JSON.stringify(s)}),P.success("已保存(密钥不再回显完整值)"),I.value=!1,await ne()}catch(s){P.error(s.message)}finally{le.value=!1}}async function je(s){try{await x("/admin/api/channels/"+encodeURIComponent(s),{method:"DELETE"}),await ne()}catch(e){P.error(e.message)}}const ce={executor_offline:"执行器离线",queue_backlog:"任务积压",error_burst:"任务失败激增",spec_change:"工具源 spec 变更",spec_refresh_fail:"工具源 spec 刷新失败",authz_probe:"工具源鉴权探针告警"},ae=b([]),q=b(!1),X=b(!1),oe=b(!1),ve={id:0,event_prefix:"",channel:"",recipients:[],cooldown_min:60,description:"",enabled:!0},c=Ee({...ve});async function se(){try{ae.value=await x("/admin/api/alert-rules")}catch{}}function ye(){X.value=!1,Object.assign(c,ve,{recipients:[]}),q.value=!0}function qe(s){X.value=!0,Object.assign(c,{id:s.id,event_prefix:s.event_prefix||"",channel:s.channel,recipients:[...s.recipients||[]],cooldown_min:s.cooldown_min||60,description:s.description||"",enabled:!!s.enabled}),q.value=!0}async function Re(){if(!c.channel){P.error("请选择渠道");return}if(!c.recipients.length){P.error("至少填一个收件人");return}oe.value=!0;try{await x("/admin/api/alert-rules",{method:"POST",body:JSON.stringify({...c,id:c.id||void 0})}),P.success("已保存"),q.value=!1,await se()}catch(s){P.error(s.message)}finally{oe.value=!1}}async function De(s){try{await x("/admin/api/alert-rules/"+s,{method:"DELETE"}),await se()}catch(e){P.error(e.message)}}const H=K(()=>W.value.filter(s=>{var e;return(s.allowed_channels||[]).includes("*")||(s.allowed_channels||[]).includes((e=_.value)==null?void 0:e.name)}));async function Ne(s){var d;_.value=s,Z.value="curl",C.value="<接入方token>";const e=W.value.filter(S=>(S.allowed_channels||[]).includes("*")||(S.allowed_channels||[]).includes(s.name));k.value=((d=e[0])==null?void 0:d.app_id)||"",Y.value=!0,k.value&&await be()}async function be(){if(!k.value){C.value="<接入方token>";return}try{const s=await x("/admin/api/clients/"+encodeURIComponent(k.value)+"/token");C.value=s.token}catch{C.value="<接入方token>"}}const _e=K(()=>{const s=_.value;if(!s)return"";const e=B(),d="bailing_send_"+String(s.name).replace(/[^a-z0-9]+/gi,"_"),S=k.value?k.value+"_":"";return`/**
1
+ import{E as P}from"./vendor-element-D7WRzHhy.js";import{a as x}from"./request-CBLNpLth.js";import{o as ze}from"./docs-DPUOCa7R.js";import{c as z}from"./util-SiQC2MJh.js";import{u as Be,b as B}from"./index-CxPIS6G7.js";import{H as y}from"./HelpTip-CT07o3kB.js";import{u as Le,s as Ke,a as Je,b as Me}from"./schema-DzwLpuOy.js";import{d as Fe,z as Xe,c as g,S as a,J as t,R as D,r as b,ai as f,o as r,I as $,P as o,e as l,Q as i,O as T,u as N,a3 as L,q as Ee,m as K}from"./vendor-vue-B2uhHUfE.js";import{_ as Ge}from"./_plugin-vue_export-helper-DlAUqK2U.js";const Qe={class:"head"},We={class:"channel-main"},Ye={class:"tagline"},Ze={key:0,class:"muted ellipsis"},el={class:"channel-stack"},ll={class:"tagline"},tl={class:"muted"},nl={class:"callback-line"},al={class:"mono muted"},ol={class:"channel-stack"},sl={class:"tagline"},il={key:0,class:"muted"},dl={class:"head"},ul={class:"channel-main"},rl={key:0,class:"muted ellipsis"},pl={class:"channel-stack"},ml={class:"tagline"},fl={class:"mono muted"},cl={class:"channel-stack"},vl={class:"muted"},yl={key:0,class:"field-required"},bl={key:0,class:"field-required"},_l={key:0,class:"field-required"},kl={class:"code-context"},gl={class:"code-context-main"},$l={key:1,class:"muted"},Vl={key:0,class:"channel-code-summary"},Cl={class:"mono"},Tl={class:"mono"},xl={class:"snippet-card"},wl={class:"snippet-head"},Ul={class:"snippet-code"},hl={class:"snippet-card"},Pl={class:"snippet-head"},Sl={class:"snippet-code"},El={class:"snippet-card"},Al={class:"snippet-head"},Ol={class:"snippet-code"},Il={class:"snippet-card"},jl={class:"snippet-head"},ql={class:"snippet-code"},Rl={class:"code-notices compact",style:{"margin-top":"12px"}},Dl={class:"code-notice info"},Nl=Fe({__name:"Channels",setup(Hl){const G={wecom:"企业微信",feishu:"飞书"},Q=Be(),J=Le("channel"),O=b([]),W=b([]),Y=b(!1),_=b(null),k=b(""),C=b("<接入方token>"),Z=b("curl"),ee=b([]),de=b([]),I=b(!1),j=b(!1),le=b(!1),M=b("basic"),ue={name:"",kind:"wecom",route_key:"",corpid:"",token:"",aes_key:"",agentid:"",secret:"",reply_wait_ms:4e3,bucket:"",description:"",enabled:!0},u=Ee({...ue});function m(s,e){return Ke(J.schema.value,s,e)}function V(s,e=""){return Je(J.schema.value,s,e)}function te(s){return Me(J.required.value,s)}function re(s,e="wecom"){const d=e==="wecom"?"wecom":e;return`${B()}/${d}/${s}`}function pe(s){return re(s.name,s.kind)}function me(s){const e=ee.value.find(d=>d.route_key===s);return(e==null?void 0:e.name)||s||"-"}function F(s){const e=s.config||{};return!!(e.corpid&&e.agentid&&(e.secret||e.secret_masked||e.has_secret))}function Ae(s){const e=Array.isArray(s)?s.map(d=>String(d)).filter(Boolean):[];return e.length?e.length<=3?e.join("、"):`${e.slice(0,3).join("、")} 等 ${e.length} 人`:"-"}async function ne(){O.value=await x("/admin/api/channels")}function fe(){j.value=!1,M.value="basic",Object.assign(u,ue),I.value=!0}function Oe(s){j.value=!0,M.value="basic";const e=s.config||{};Object.assign(u,{name:s.name,kind:s.kind,route_key:s.route_key,corpid:e.corpid||"",token:"",aes_key:"",agentid:e.agentid||"",secret:"",reply_wait_ms:Number(e.reply_wait_ms)||4e3,bucket:e.bucket||"",description:s.description||"",enabled:!!s.enabled}),I.value=!0}async function Ie(){le.value=!0;try{const s={name:u.name,kind:u.kind,route_key:u.route_key,description:u.description,enabled:u.enabled,config:{corpid:u.corpid,token:u.token,aes_key:u.aes_key,agentid:u.agentid,secret:u.secret,reply_wait_ms:u.reply_wait_ms,bucket:u.bucket}};await x("/admin/api/channels",{method:"POST",body:JSON.stringify(s)}),P.success("已保存(密钥不再回显完整值)"),I.value=!1,await ne()}catch(s){P.error(s.message)}finally{le.value=!1}}async function je(s){try{await x("/admin/api/channels/"+encodeURIComponent(s),{method:"DELETE"}),await ne()}catch(e){P.error(e.message)}}const ce={executor_offline:"执行器离线",queue_backlog:"任务积压",error_burst:"任务失败激增",spec_change:"工具源 spec 变更",spec_refresh_fail:"工具源 spec 刷新失败",authz_probe:"工具源鉴权探针告警"},ae=b([]),q=b(!1),X=b(!1),oe=b(!1),ve={id:0,event_prefix:"",channel:"",recipients:[],cooldown_min:60,description:"",enabled:!0},c=Ee({...ve});async function se(){try{ae.value=await x("/admin/api/alert-rules")}catch{}}function ye(){X.value=!1,Object.assign(c,ve,{recipients:[]}),q.value=!0}function qe(s){X.value=!0,Object.assign(c,{id:s.id,event_prefix:s.event_prefix||"",channel:s.channel,recipients:[...s.recipients||[]],cooldown_min:s.cooldown_min||60,description:s.description||"",enabled:!!s.enabled}),q.value=!0}async function Re(){if(!c.channel){P.error("请选择渠道");return}if(!c.recipients.length){P.error("至少填一个收件人");return}oe.value=!0;try{await x("/admin/api/alert-rules",{method:"POST",body:JSON.stringify({...c,id:c.id||void 0})}),P.success("已保存"),q.value=!1,await se()}catch(s){P.error(s.message)}finally{oe.value=!1}}async function De(s){try{await x("/admin/api/alert-rules/"+s,{method:"DELETE"}),await se()}catch(e){P.error(e.message)}}const H=K(()=>W.value.filter(s=>{var e;return(s.allowed_channels||[]).includes("*")||(s.allowed_channels||[]).includes((e=_.value)==null?void 0:e.name)}));async function Ne(s){var d;_.value=s,Z.value="curl",C.value="<接入方token>";const e=W.value.filter(S=>(S.allowed_channels||[]).includes("*")||(S.allowed_channels||[]).includes(s.name));k.value=((d=e[0])==null?void 0:d.app_id)||"",Y.value=!0,k.value&&await be()}async function be(){if(!k.value){C.value="<接入方token>";return}try{const s=await x("/admin/api/clients/"+encodeURIComponent(k.value)+"/token");C.value=s.token}catch{C.value="<接入方token>"}}const _e=K(()=>{const s=_.value;if(!s)return"";const e=B(),d="bailing_send_"+String(s.name).replace(/[^a-z0-9]+/gi,"_"),S=k.value?k.value+"_":"";return`/**
2
2
  * 百灵中枢 · 经「${s.name}」渠道主动给某用户推一条消息(文字 / 图片 / 附件)
3
3
  * 会作为「回复方」记进该用户在本渠道的会话历史;用户随后追问,大脑接得上。
4
4
  * 用法:
@@ -0,0 +1,7 @@
1
+ import{E as w}from"./vendor-element-D7WRzHhy.js";import{a as x}from"./request-CBLNpLth.js";import{o as lt}from"./docs-DPUOCa7R.js";import{f as nt}from"./util-SiQC2MJh.js";import{b as ot}from"./index-CxPIS6G7.js";import{H as c}from"./HelpTip-CT07o3kB.js";import{d as at,z as it,c as C,S as n,J as o,R as S,r as b,ai as p,o as _,e as l,P as i,I as v,Q as s,O as P,a3 as K,u as Oe,q as je,m as I}from"./vendor-vue-B2uhHUfE.js";import{_ as dt}from"./_plugin-vue_export-helper-DlAUqK2U.js";const st={class:"head"},ut={class:"entry-main"},rt={key:0,class:"muted ellipsis"},pt={class:"entry-stack"},mt={class:"muted"},_t={class:"muted"},ft={class:"entry-stack"},yt={class:"tagline"},bt={class:"tagline"},gt={class:"protection-stack"},vt={class:"muted"},kt={class:"table-actions"},ct={class:"state-copy"},Vt={class:"row"},wt={class:"state-copy"},xt={class:"state-copy"},$t={class:"position-config"},Ut={class:"row"},Ct={class:"row offset-row"},Ot={class:"code-notices compact"},jt={key:0,class:"code-notice info"},It={key:0,class:"embed-entry-summary"},Tt={class:"mono"},Nt={class:"mono"},At={class:"snippet-card"},Et={class:"snippet-head"},Pt={class:"snippet-code compact"},Rt={class:"snippet-card"},Lt={class:"snippet-head"},St={class:"snippet-code compact"},zt={class:"snippet-card"},Bt={class:"snippet-head"},Dt={class:"snippet-code"},Ft={class:"snippet-card"},Ht={class:"snippet-head"},Jt={class:"snippet-code"},Kt={class:"snippet-notes"},qt={class:"muted"},Gt={class:"row2"},Mt={class:"row2"},Qt={class:"mono"},Xt={class:"muted mono"},Wt=at({__name:"ChatEntries",setup(Yt){const z=b([]),q=b([]),se=b([]),ue=b([]),T=b(!1),B=b(!1),G=b(!1),D=b("basic"),re={title_align:"center",width:400,height:600,position:"right",offset_x:24,offset_y:24,avatar:"",launcher_icon:"",default_open:!1,resizable:!1,ai_notice:!0,powered_by_visible:!0,powered_by_text:""},d=je({entry_key:"",name:"",route_key:"",origins_text:"",ticket_client:"",bucket:"",title:"",greeting:"",color:"#3fb950",...re,rate_limit_per_min:20,description:"",enabled:!0}),M=b("");function pe(a){return q.value.find(e=>e.route_key===a)}function me(a){const e=pe(a);return e?e.name||e.route_key:"未找到路由"}function Ie(a){const e=pe(a);return e!=null&&e.target?`→ ${e.target}`:""}function Te(a,e){const u=Array.isArray(a)?a.map(k=>String(k)).filter(Boolean):[];return u.length?u.includes("*")?[e]:u.length<=2?u:[...u.slice(0,2),`+${u.length-2}`]:[]}function Ne(a){const e=Array.isArray(a.allowed_origins)?a.allowed_origins.filter(Boolean):[];return e.length?e.length===1?e[0]:`${e.length} 个站点`:"不限 Origin"}const Q=b(!1),_e=b(null),X=b([]);function Ae(a){return a==="up"?"有用":a==="down"?"没用":"反馈"}function Ee(a){return a==="up"?"success":a==="down"?"danger":"info"}const W=b(!1),R=b(null),Y=b([]),Z=b(!1),f=je({id:0,url_pattern:"",page_key:"",page_name:"",description:"",priority:0,enabled:!0}),h=b(!1),m=b(null),ee=b("script"),L=b("node"),O=ot(),fe=I(()=>{var a;return`<script src="${O}/widget.js" data-entry="${(a=m.value)==null?void 0:a.entry_key}" async><\/script>`}),ye=I(()=>{var a;return`${O}/widget/demo/${(a=m.value)==null?void 0:a.entry_key}`}),be=I(()=>{var a;return[`curl -X POST '${O}/chat/${(a=m.value)==null?void 0:a.entry_key}' \\`," -H 'content-type: application/json' \\",` -d '{"message":"你好","visitor_id":"demo-visitor-01","wait_ms":8000,"ticket":"<可选:登录身份票据,签法见下方票据生成>"}'`,"# 带 ticket = 登录身份(验签失败回 401,不会静默降级为匿名);不带 = 匿名访客","# 可选 thread_id(字母数字_-,≤32 字符):同一身份下按它切分平行会话——开新会话=换新值,续旧会话=复用;不带=该身份单线程续聊","# 返回 {done,reply,job_id,visitor_id,references?,attachments?};done=false 时轮询 GET /chat/<入口>/result/<job_id>?wait=8000","# reply=markdown 回复;attachments=解析好的富内容数组(图片/文件),无 md 渲染器的端按 type 渲染(详见官网 /docs#routes)","# 注意:聊天任务归属本入口,不能用接入方 token 走 GET /jobs/<id> 查(那是 API 触发任务的取法),结果只走上面的 result 端点",'# 审批类操作(如删除):首跑回"已提交审批",业务侧或控制台兜底批准后任务重跑,最终结果经路由「送达 webhook」回调业务后端',"# 载荷、签名和重试规范见官网 /docs/api;同 job_id 的 result 端点也会更新,可作轮询兜底",'# 评价:POST /chat/<入口>/rate/<job_id> 体 {"rating":"up|down|note","visitor_id":"<同上>","comment":"可选;rating=note 时必填"}',"# 小程序/服务端调用不带浏览器 Origin 头:站点 Origin 白名单不拦(它只防别家网页盗嵌)"].join(`
2
+ `)}),Pe=I(()=>{var a,e;return[`// 用接入方「${(a=m.value)==null?void 0:a.ticket_client}」的 token 签发(1 小时有效,按需调整)`,'// uid 是中枢原样回传的「操作主体」串:多租户务必把租户编进去(如 "{$tenantId}:{$uid}"),别只签裸 uid——','// 否则接第二个租户时 uid 跨租户撞车,中枢无处补救(详见官网 /docs#security)。单租户也建议直接用 "1:1"。',"$subject = $tenantId . ':' . $当前登录用户ID; // 单租户可只写 (string)$当前登录用户ID","$payload = rtrim(strtr(base64_encode(json_encode(['uid' => $subject, 'exp' => time() + 3600])), '+/', '-_'), '=');","$ticket = 'v1.' . $payload . '.' . hash_hmac('sha256', $payload, $接入方token);","// 页面输出(登录用户才输出 data-ticket;游客不输出即匿名聊):",`<script src="${O}/widget.js" data-entry="${(e=m.value)==null?void 0:e.entry_key}" data-ticket="<?= $ticket ?>" async><\/script>`].join(`
3
+ `)}),Re=I(()=>{var a,e;return[`// 用接入方「${(a=m.value)==null?void 0:a.ticket_client}」的 token 签发(1 小时有效,按需调整)`,"// uid 是中枢原样回传的「操作主体」串:多租户务必把租户编进去,如 tenantId + ':' + userId。","import { createHmac } from 'node:crypto';","","const clientToken = process.env.BAILING_CLIENT_TOKEN || '<接入方token>';","const subject = tenantId + ':' + userId;","const body = JSON.stringify({ uid: subject, exp: Math.floor(Date.now() / 1000) + 3600 });","const payload = Buffer.from(body)"," .toString('base64')"," .replace(/\\+/g, '-')"," .replace(/\\//g, '_')"," .replace(/=+$/, '');","const signature = createHmac('sha256', clientToken).update(payload).digest('hex');","const ticket = 'v1.' + payload + '.' + signature;","","// 页面输出(登录用户才输出 data-ticket;游客不输出即匿名聊):",`<script src="${O}/widget.js" data-entry="${(e=m.value)==null?void 0:e.entry_key}" data-ticket="\${ticket}" async><\/script>`].join(`
4
+ `)}),Le=I(()=>{var a,e;return[`# 用接入方「${(a=m.value)==null?void 0:a.ticket_client}」的 token 签发(1 小时有效,按需调整)`,'# uid 是中枢原样回传的「操作主体」串:多租户务必把租户编进去,如 f"{tenant_id}:{user_id}"。',"import base64","import hashlib","import hmac","import json","import os","import time","",'client_token = os.getenv("BAILING_CLIENT_TOKEN", "<接入方token>")','subject = f"{tenant_id}:{user_id}"','body = json.dumps({"uid": subject, "exp": int(time.time()) + 3600}, ensure_ascii=False, separators=(",", ":")).encode("utf-8")','payload = base64.urlsafe_b64encode(body).decode("utf-8").rstrip("=")','signature = hmac.new(client_token.encode("utf-8"), payload.encode("utf-8"), hashlib.sha256).hexdigest()','ticket = f"v1.{payload}.{signature}"',"","# 页面输出(登录用户才输出 data-ticket;游客不输出即匿名聊):",`# <script src="${O}/widget.js" data-entry="${(e=m.value)==null?void 0:e.entry_key}" data-ticket="{ticket}" async><\\/script>`].join(`
5
+ `)}),ge=I(()=>L.value==="php"?Pe.value:L.value==="python"?Le.value:Re.value);async function te(){z.value=await x("/admin/api/chat-entries"),q.value=await x("/admin/api/routes"),se.value=await x("/admin/api/clients"),ue.value=await x("/admin/api/storage-buckets").catch(()=>[])}function ve(){B.value=!1,D.value="basic",Object.assign(d,{entry_key:"",name:"",route_key:"",origins_text:"",ticket_client:"",bucket:"",title:"",greeting:"",color:"#3fb950",...re,rate_limit_per_min:20,description:"",enabled:!0}),T.value=!0}function Se(a){B.value=!0,D.value="basic";const e=a.appearance||{};Object.assign(d,{entry_key:a.entry_key,name:a.name,route_key:a.route_key,origins_text:(a.allowed_origins||[]).join(`
6
+ `),ticket_client:a.ticket_client||"",bucket:a.bucket||"",title:a.title||"",greeting:a.greeting||"",color:a.color||"#3fb950",title_align:e.title_align==="left"?"left":"center",width:Number(e.width)||400,height:Number(e.height)||600,position:e.position==="left"?"left":"right",offset_x:Number.isFinite(Number(e.offset_x))?Number(e.offset_x):24,offset_y:Number.isFinite(Number(e.offset_y))?Number(e.offset_y):24,avatar:e.avatar||"",launcher_icon:e.launcher_icon||"",default_open:!!e.default_open,resizable:!!e.resizable,ai_notice:e.ai_notice!==!1,powered_by_visible:e.powered_by_visible!==!1,powered_by_text:e.powered_by_text||"",rate_limit_per_min:a.rate_limit_per_min,description:a.description||"",enabled:!!a.enabled}),T.value=!0}async function ze(a){_e.value=a,X.value=await x("/admin/api/chat-ratings?entry="+encodeURIComponent(a.entry_key)),Q.value=!0}function F(){Object.assign(f,{id:0,url_pattern:"",page_key:"",page_name:"",description:"",priority:0,enabled:!0})}async function le(){Y.value=await x("/admin/api/page-contexts?entry="+encodeURIComponent(R.value.entry_key))}async function Be(a){R.value=a,F(),await le(),W.value=!0}function De(a){Object.assign(f,{id:a.id,url_pattern:a.url_pattern,page_key:a.page_key||"",page_name:a.page_name||"",description:a.description||"",priority:a.priority||0,enabled:a.enabled!==!1})}async function Fe(){if(!f.url_pattern.trim()){w.error("URL 模式必填");return}Z.value=!0;try{await x("/admin/api/page-contexts",{method:"POST",body:JSON.stringify({...f,entry_key:R.value.entry_key,url_pattern:f.url_pattern.trim()})}),w.success("已保存"),F(),await le()}catch(a){w.error(a.message)}finally{Z.value=!1}}async function He(a){try{await x("/admin/api/page-contexts/"+a+"?entry="+encodeURIComponent(R.value.entry_key),{method:"DELETE"}),f.id===a&&F(),await le()}catch(e){w.error(e.message)}}async function Je(){G.value=!0;try{const a=d.origins_text.split(`
7
+ `).map(y=>y.trim()).filter(Boolean),e={entry_key:d.entry_key||void 0,name:d.name.trim(),route_key:d.route_key,allowed_origins:a,ticket_client:d.ticket_client||void 0,bucket:d.bucket||void 0,title:d.title.trim()||void 0,greeting:d.greeting.trim()||void 0,color:d.color||void 0,rate_limit_per_min:d.rate_limit_per_min,appearance:{title_align:d.title_align,width:d.width,height:d.height,position:d.position,offset_x:d.offset_x,offset_y:d.offset_y,...d.avatar.trim()?{avatar:d.avatar.trim()}:{},...d.launcher_icon.trim()?{launcher_icon:d.launcher_icon.trim()}:{},...d.default_open?{default_open:!0}:{},...d.resizable?{resizable:!0}:{},...d.ai_notice===!1?{ai_notice:!1}:{},...d.powered_by_visible===!1?{powered_by_visible:!1}:{},...d.powered_by_text.trim()?{powered_by_text:d.powered_by_text.trim()}:{}},description:d.description.trim()||void 0,enabled:d.enabled},u=await x("/admin/api/chat-entries",{method:"POST",body:JSON.stringify(e)});T.value=!1,await te();const k=z.value.find(y=>y.entry_key===u.entry_key),N=Array.isArray(k==null?void 0:k.allowed_origins)?k.allowed_origins.filter(Boolean).length:0;w.success(N?`已保存,Origin 白名单已限制 ${N} 个站点`:"已保存,当前未限制 Origin"),B.value||k&&ke(k)}catch(a){w.error(a.message)}finally{G.value=!1}}function ke(a){m.value=a,ee.value="script",L.value="node",h.value=!0}function Ke(a){window.open(`${O}/widget/demo/${a.entry_key}`,"_blank")}function qe(a,e){return{entry_key:a.entry_key,name:a.name,route_key:a.route_key,enabled:e,allowed_origins:Array.isArray(a.allowed_origins)?a.allowed_origins:[],rate_limit_per_min:a.rate_limit_per_min,ticket_client:a.ticket_client||void 0,bucket:a.bucket||void 0,title:a.title||void 0,greeting:a.greeting||void 0,color:a.color||void 0,appearance:a.appearance||void 0,description:a.description||void 0}}async function Ge(a,e){const u=!!a.enabled;a.enabled=e,M.value=a.entry_key;try{await x("/admin/api/chat-entries",{method:"POST",body:JSON.stringify(qe(a,e))}),w.success(e?"聊天组件已恢复展示":"聊天组件已暂停并隐藏")}catch(k){a.enabled=u,w.error(k.message)}finally{M.value=""}}async function Me(a,e){if(a==="page-context"){await Be(e);return}a==="ratings"&&await ze(e)}async function H(a){try{await navigator.clipboard.writeText(a),w.success("已复制")}catch{w.error("复制失败,请手动选择复制")}}async function Qe(a){try{await x("/admin/api/chat-entries/"+encodeURIComponent(a),{method:"DELETE"}),await te()}catch(e){w.error(e.message)}}return it(te),(a,e)=>{var $e,Ue,Ce;const u=p("el-button"),k=p("el-alert"),N=p("el-empty"),y=p("el-table-column"),A=p("el-tag"),j=p("el-switch"),Xe=p("el-tooltip"),ce=p("el-dropdown-item"),We=p("el-dropdown-menu"),Ye=p("el-dropdown"),Ve=p("el-popconfirm"),ne=p("el-table"),Ze=p("el-card"),r=p("el-form-item"),V=p("el-input"),oe=p("el-option"),ae=p("el-select"),E=p("el-input-number"),$=p("el-tab-pane"),he=p("el-color-picker"),J=p("el-radio-button"),we=p("el-radio-group"),ie=p("el-tabs"),xe=p("el-form"),de=p("el-drawer"),et=p("el-dialog"),tt=p("el-divider");return _(),C(S,null,[n(Ze,{shadow:"never"},{header:o(()=>[l("div",st,[e[45]||(e[45]=l("b",null,"聊天入口",-1)),e[46]||(e[46]=i()),n(c,{title:"聊天入口是什么"},{default:o(()=>[...e[43]||(e[43]=[l("p",null,[i("网页聊天组件的公开插座:建入口绑一条路由 → 拿一行 "),l("code",null,"script"),i(" 贴进任何网页;背后是 LLM 还是执行器智能体,入口无感。")],-1)])]),_:1}),n(u,{type:"primary",style:{"margin-left":"auto"},onClick:ve},{default:o(()=>[...e[44]||(e[44]=[i("新建入口",-1)])]),_:1})])]),default:o(()=>[n(k,{class:"preview-boundary",type:"info","show-icon":"",closable:!1},{title:o(()=>[...e[47]||(e[47]=[i("“匿名预览”不会继承中枢后台登录状态,也不会自动携带业务身份票据。",-1)])]),default:o(()=>[e[48]||(e[48]=l("p",null,"所有标记为“需主体(subject.required)”的工具,包括只读查询和写操作,都不会向 Agent 暴露。业务身份应由已登录的业务系统后端签发;内置演示链路请在“上手向导”手动运行 Smoke。",-1))]),_:1}),z.value.length?(_(),v(ne,{key:1,data:z.value},{default:o(()=>[n(y,{label:"入口","min-width":"230","show-overflow-tooltip":""},{default:o(({row:t})=>[l("div",ut,[l("b",null,s(t.name||t.entry_key),1),l("code",null,s(t.entry_key),1),t.description?(_(),C("span",rt,s(t.description),1)):P("",!0)])]),_:1}),n(y,{label:"绑定场景","min-width":"230"},{default:o(({row:t})=>[l("div",pt,[l("div",null,[n(A,{size:"small",effect:"plain",type:"info"},{default:o(()=>[i(s(t.route_key),1)]),_:2},1024),l("span",mt,s(Ie(t.route_key)),1)]),l("span",_t,s(me(t.route_key)),1)])]),_:1}),n(y,{label:"发布边界","min-width":"300"},{default:o(({row:t})=>{var g;return[l("div",ft,[l("div",yt,[e[51]||(e[51]=l("span",{class:"muted"},"站点",-1)),(g=t.allowed_origins)!=null&&g.length?(_(!0),C(S,{key:0},K(Te(t.allowed_origins,"全部站点"),U=>(_(),v(A,{key:U,size:"small",effect:"plain",type:"info"},{default:o(()=>[i(s(U),1)]),_:2},1024))),128)):(_(),v(A,{key:1,size:"small",type:"warning",effect:"plain"},{default:o(()=>[...e[50]||(e[50]=[i("不限 Origin",-1)])]),_:1}))]),l("div",bt,[n(A,{size:"small",effect:"plain",type:t.ticket_client?"success":"info"},{default:o(()=>[i(s(t.ticket_client?"支持业务身份票据:"+t.ticket_client:"仅匿名访问"),1)]),_:2},1032,["type"]),n(A,{size:"small",effect:"plain",type:"success"},{default:o(()=>[i("媒体上传:"+s(t.bucket||"本地"),1)]),_:2},1024)])])]}),_:1}),n(y,{label:"运行保护",width:"126"},{default:o(({row:t})=>[l("div",gt,[n(Xe,{content:t.enabled?"聊天组件展示中":"聊天组件已暂停",placement:"top"},{default:o(()=>[n(j,{"model-value":!!t.enabled,loading:M.value===t.entry_key,onChange:g=>Ge(t,!!g)},null,8,["model-value","loading","onChange"])]),_:2},1032,["content"]),l("span",vt,"限速 "+s(t.rate_limit_per_min)+"/分/IP",1)])]),_:1}),n(y,{width:"274",align:"right"},{default:o(({row:t})=>[l("div",kt,[n(u,{link:"",type:"primary",onClick:g=>ke(t)},{default:o(()=>[...e[52]||(e[52]=[i("嵌入代码",-1)])]),_:1},8,["onClick"]),n(u,{link:"",type:"primary",onClick:g=>Ke(t)},{default:o(()=>[...e[53]||(e[53]=[i("匿名预览",-1)])]),_:1},8,["onClick"]),n(u,{link:"",type:"primary",onClick:g=>Se(t)},{default:o(()=>[...e[54]||(e[54]=[i("编辑",-1)])]),_:1},8,["onClick"]),n(Ye,{trigger:"click",onCommand:g=>Me(String(g),t)},{dropdown:o(()=>[n(We,null,{default:o(()=>[n(ce,{command:"page-context"},{default:o(()=>[...e[56]||(e[56]=[i("页面登记",-1)])]),_:1}),n(ce,{command:"ratings"},{default:o(()=>[...e[57]||(e[57]=[i("评价记录",-1)])]),_:1})]),_:1})]),default:o(()=>[n(u,{link:"",type:"primary"},{default:o(()=>[...e[55]||(e[55]=[i("更多",-1)])]),_:1})]),_:1},8,["onCommand"]),n(Ve,{title:"删除该入口?已嵌入的页面组件会立即失效。",width:"260",onConfirm:g=>Qe(t.entry_key)},{reference:o(()=>[n(u,{link:"",type:"danger"},{default:o(()=>[...e[58]||(e[58]=[i("删",-1)])]),_:1})]),_:1},8,["onConfirm"])])]),_:1})]),_:1},8,["data"])):(_(),v(N,{key:0,description:"还没有聊天入口:绑一条触发路由即可生成可嵌入的网页聊天组件"},{default:o(()=>[n(u,{type:"primary",onClick:ve},{default:o(()=>[...e[49]||(e[49]=[i("新建第一个",-1)])]),_:1})]),_:1}))]),_:1}),n(de,{modelValue:T.value,"onUpdate:modelValue":e[26]||(e[26]=t=>T.value=t),title:B.value?"编辑聊天入口":"新建聊天入口",size:"520px"},{footer:o(()=>[n(u,{onClick:e[25]||(e[25]=t=>T.value=!1)},{default:o(()=>[...e[93]||(e[93]=[i("取消",-1)])]),_:1}),n(u,{type:"primary",loading:G.value,onClick:Je},{default:o(()=>[...e[94]||(e[94]=[i("保存",-1)])]),_:1},8,["loading"])]),default:o(()=>[n(xe,{"label-position":"top"},{default:o(()=>[n(ie,{modelValue:D.value,"onUpdate:modelValue":e[24]||(e[24]=t=>D.value=t),class:"console-tabs"},{default:o(()=>[n($,{label:"基础接入",name:"basic"},{default:o(()=>[n(r,null,{label:o(()=>[e[60]||(e[60]=i("聊天组件 ",-1)),n(c,{title:"聊天组件启停"},{default:o(()=>[...e[59]||(e[59]=[l("p",null,"关闭后,已经嵌入业务页面的脚本仍可保留,但悬浮按钮和聊天窗口都不会展示,新消息、历史、上传和评价接口也会停止服务。",-1),l("p",null,"重新开启后,业务页面无需改代码,访客下次加载页面即可恢复。",-1)])]),_:1})]),default:o(()=>[n(j,{modelValue:d.enabled,"onUpdate:modelValue":e[0]||(e[0]=t=>d.enabled=t)},null,8,["modelValue"]),l("span",ct,s(d.enabled?"展示并接收新会话":"暂停展示与新会话"),1)]),_:1}),n(r,{label:"名称"},{default:o(()=>[n(V,{modelValue:d.name,"onUpdate:modelValue":e[1]||(e[1]=t=>d.name=t),placeholder:"如 在线助手"},null,8,["modelValue"])]),_:1}),n(r,null,{label:o(()=>[e[62]||(e[62]=i("绑定路由 ",-1)),e[63]||(e[63]=l("span",{class:"field-required"},"必填",-1)),e[64]||(e[64]=i()),n(c,{title:"绑定路由"},{default:o(()=>[...e[61]||(e[61]=[l("p",null,"入口的所有提问交给这条路由处理——它决定大脑(target / 模型 / 提示词)、知识库、可用工具。",-1),l("p",null,[i("聊天按访客自动续会话(带票按 uid、匿名按 visitor_id),"),l("b",null,"路由的会话策略对入口不生效"),i(";业务多会话 UI 用聊天 body 的 "),l("code",null,"thread_id"),i(" 切分。")],-1)])]),_:1})]),default:o(()=>[n(ae,{modelValue:d.route_key,"onUpdate:modelValue":e[2]||(e[2]=t=>d.route_key=t),filterable:"",style:{width:"100%"}},{default:o(()=>[(_(!0),C(S,null,K(q.value,t=>(_(),v(oe,{key:t.route_key,label:`${t.name}(${t.route_key} → ${t.target})`,value:t.route_key},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),n(r,null,{label:o(()=>[e[66]||(e[66]=i("站点 Origin ",-1)),n(c,{title:"Origin 白名单"},{default:o(()=>[...e[65]||(e[65]=[l("p",null,[i("一行一个,如 "),l("code",null,"https://www.example.com"),i("。留空 = 不限(试用模式),"),l("b",null,"正式上线建议配置"),i("。")],-1),l("p",null,[i("只填 "),l("code",null,"scheme://host[:port]"),i(",不要带业务路径、查询参数或 "),l("code",null,"#"),i(" 片段;保存时会规范化并去重。")],-1),l("p",null,[i('它只防"别家网页盗嵌"——'),l("b",null,"小程序 / 服务端调用不带浏览器 Origin 头,不会被白名单拦截"),i(",可放心配。")],-1)])]),_:1})]),default:o(()=>[n(V,{modelValue:d.origins_text,"onUpdate:modelValue":e[3]||(e[3]=t=>d.origins_text=t),type:"textarea",rows:3,class:"mono",placeholder:"https://www.example.com"},null,8,["modelValue"])]),_:1}),n(r,null,{label:o(()=>[e[68]||(e[68]=i("业务身份票据签发方 ",-1)),n(c,{title:"支持业务身份票据"},{default:o(()=>[...e[67]||(e[67]=[l("p",null,[i("这里只是声明该入口"),l("b",null,"支持"),i("哪个接入方签发的业务身份票据,不会把中枢后台管理员当成业务用户,也不会给“匿名预览”自动补身份。")],-1),l("p",null,[i("业务后端用该接入方的 token 给"),l("b",null,"已登录业务用户"),i("签短票(HMAC 算法或任意语言 SDK,默认 2 小时),组件带 "),l("code",null,"data-ticket"),i(" 即获可信身份——uid 进 "),l("code",null,"metadata.visitor_uid"),i(",使标「需主体」的工具进入候选清单,并原样透传到业务侧 On-Behalf-Of;最终是否允许执行仍由业务系统按自身权限裁决。")],-1),l("p",null,[i("同一把 token 也用于「送达 webhook」回调验签(一钥贯通)。留空 = 仅支持匿名访问;"),l("b",null,"token 永不进前端"),i(",进前端的只有签好的短票。")],-1)])]),_:1})]),default:o(()=>[n(ae,{modelValue:d.ticket_client,"onUpdate:modelValue":e[4]||(e[4]=t=>d.ticket_client=t),clearable:"",filterable:"",style:{width:"100%"},placeholder:"不支持业务身份票据(仅匿名访问)"},{default:o(()=>[(_(!0),C(S,null,K(se.value,t=>(_(),v(oe,{key:t.app_id,label:`${t.name}(${t.app_id})`,value:t.app_id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),n(r,null,{label:o(()=>[e[70]||(e[70]=i("媒体存储 ",-1)),n(c,{title:"媒体存储"},{default:o(()=>[...e[69]||(e[69]=[l("p",null,"图片和语音都会先变成永久 URL,再进入会话、视觉/语音模型和业务工具参数。",-1),l("p",null,[i("留空 = 使用服务器本地 "),l("code",null,"data/uploads"),i(",开箱可用;选择外部对象存储 = 使用业务 CDN、生命周期管理和多副本共享,适合生产。")],-1)])]),_:1})]),default:o(()=>[n(ae,{modelValue:d.bucket,"onUpdate:modelValue":e[5]||(e[5]=t=>d.bucket=t),clearable:"",filterable:"",style:{width:"100%"},placeholder:"使用服务器本地存储(默认)"},{default:o(()=>[(_(!0),C(S,null,K(ue.value,t=>(_(),v(oe,{key:t.name,label:`${t.name}(${t.kind==="local"?"本地":t.bucket})`,value:t.name,disabled:!t.enabled},null,8,["label","value","disabled"]))),128))]),_:1},8,["modelValue"])]),_:1}),n(r,{label:"按 IP 限速"},{default:o(()=>[n(E,{modelValue:d.rate_limit_per_min,"onUpdate:modelValue":e[6]||(e[6]=t=>d.rate_limit_per_min=t),min:1,max:600},null,8,["modelValue"]),e[71]||(e[71]=l("span",{class:"muted",style:{"margin-left":"8px"}},"次/分钟",-1))]),_:1})]),_:1}),n($,{label:"外观",name:"appearance"},{default:o(()=>[n(r,{label:"组件标题"},{default:o(()=>[n(V,{modelValue:d.title,"onUpdate:modelValue":e[7]||(e[7]=t=>d.title=t),placeholder:"留空用名称"},null,8,["modelValue"])]),_:1}),n(r,{label:"开场白(组件首条气泡)"},{default:o(()=>[n(V,{modelValue:d.greeting,"onUpdate:modelValue":e[8]||(e[8]=t=>d.greeting=t),placeholder:"你好,有什么可以帮你?"},null,8,["modelValue"])]),_:1}),n(r,{label:"主色"},{default:o(()=>[n(he,{modelValue:d.color,"onUpdate:modelValue":e[9]||(e[9]=t=>d.color=t),predefine:["#3fb950","#3a6ea5","#3a7a55","#8a4f7d"]},null,8,["modelValue"])]),_:1}),n(r,{label:"标题对齐"},{default:o(()=>[n(we,{modelValue:d.title_align,"onUpdate:modelValue":e[10]||(e[10]=t=>d.title_align=t)},{default:o(()=>[n(J,{value:"center"},{default:o(()=>[...e[72]||(e[72]=[i("居中",-1)])]),_:1}),n(J,{value:"left"},{default:o(()=>[...e[73]||(e[73]=[i("居左",-1)])]),_:1})]),_:1},8,["modelValue"])]),_:1}),n(r,{label:"展开窗口尺寸(px)"},{default:o(()=>[l("div",Vt,[e[74]||(e[74]=l("span",{class:"muted"},"宽",-1)),n(E,{modelValue:d.width,"onUpdate:modelValue":e[11]||(e[11]=t=>d.width=t),min:280,max:720,step:10,"controls-position":"right",style:{width:"128px"}},null,8,["modelValue"]),e[75]||(e[75]=l("span",{class:"muted"},"高",-1)),n(E,{modelValue:d.height,"onUpdate:modelValue":e[12]||(e[12]=t=>d.height=t),min:360,max:900,step:10,"controls-position":"right",style:{width:"128px"}},null,8,["modelValue"]),e[76]||(e[76]=l("span",{class:"muted"},"手机端自动接近全屏,不受此值限制",-1))])]),_:1}),n(r,null,{label:o(()=>[e[78]||(e[78]=i("允许访客拖动改尺寸 ",-1)),n(c,{title:"访客可调整窗口大小"},{default:o(()=>[...e[77]||(e[77]=[l("p",null,[i("开启后,访客可把鼠标放在展开面板的"),l("b",null,"上边框"),i("拖动改高、"),l("b",null,"靠内一侧的边框"),i("(贴右下角时为左边、贴左下角时为右边)拖动改宽,夹在上面的宽高上下限内,按访客本地记住。")],-1),l("p",{class:"muted"},"适合当工作台用、要读长回答/表格的场景;轻量问答可保持关闭。手机端面板本就接近全屏,此开关自动不生效。",-1)])]),_:1})]),default:o(()=>[n(j,{modelValue:d.resizable,"onUpdate:modelValue":e[13]||(e[13]=t=>d.resizable=t)},null,8,["modelValue"])]),_:1}),n(r,null,{label:o(()=>[e[80]||(e[80]=i("默认展开 ",-1)),n(c,{title:"嵌入后默认展开"},{default:o(()=>[...e[79]||(e[79]=[l("p",null,"开启后,业务页面加载嵌入脚本时会直接展开聊天窗口,访客仍可手动最小化。",-1),l("p",{class:"muted"},[i("关闭时默认只显示气泡按钮;已显式使用 "),l("code",null,'data-open="1"'),i(" 的嵌入代码仍会展开。")],-1)])]),_:1})]),default:o(()=>[n(j,{modelValue:d.default_open,"onUpdate:modelValue":e[14]||(e[14]=t=>d.default_open=t)},null,8,["modelValue"]),l("span",wt,s(d.default_open?"加载即展开":"默认显示气泡"),1)]),_:1}),n(r,null,{label:o(()=>[e[82]||(e[82]=i("AI 内容提示 ",-1)),n(c,{title:"AI 内容提示"},{default:o(()=>[...e[81]||(e[81]=[l("p",null,"开启后,每条 AI 回复下方显示「由 AI 生成,请结合实际业务结果核验」,复制回复时也会附带该提示。",-1),l("p",null,"如果业务侧已经在自己的页面统一声明 AI 生成内容,可以关闭这里的组件内提示。",-1)])]),_:1})]),default:o(()=>[n(j,{modelValue:d.ai_notice,"onUpdate:modelValue":e[15]||(e[15]=t=>d.ai_notice=t)},null,8,["modelValue"])]),_:1}),n(r,null,{label:o(()=>[e[84]||(e[84]=i("品牌标识 ",-1)),n(c,{title:"组件底部品牌标识"},{default:o(()=>[...e[83]||(e[83]=[l("p",null,"控制聊天窗口底部是否展示品牌文案。关闭后整行收起,不会留下空白区域。",-1),l("p",null,"开源版允许部署方使用自己的品牌;留空文案时使用当前中枢的默认品牌名称。",-1)])]),_:1})]),default:o(()=>[n(j,{modelValue:d.powered_by_visible,"onUpdate:modelValue":e[16]||(e[16]=t=>d.powered_by_visible=t)},null,8,["modelValue"]),l("span",xt,s(d.powered_by_visible?"显示":"隐藏"),1)]),_:1}),d.powered_by_visible?(_(),v(r,{key:0,label:"品牌文案"},{default:o(()=>[n(V,{modelValue:d.powered_by_text,"onUpdate:modelValue":e[17]||(e[17]=t=>d.powered_by_text=t),maxlength:"80","show-word-limit":"",placeholder:"留空使用当前中枢的默认品牌文案"},null,8,["modelValue"])]),_:1})):P("",!0),n(r,{label:"气泡位置"},{default:o(()=>[l("div",$t,[l("div",Ut,[n(we,{modelValue:d.position,"onUpdate:modelValue":e[18]||(e[18]=t=>d.position=t)},{default:o(()=>[n(J,{value:"right"},{default:o(()=>[...e[85]||(e[85]=[i("右下角",-1)])]),_:1}),n(J,{value:"left"},{default:o(()=>[...e[86]||(e[86]=[i("左下角",-1)])]),_:1})]),_:1},8,["modelValue"])]),l("div",Ct,[e[87]||(e[87]=l("span",{class:"muted"},"距侧边",-1)),n(E,{modelValue:d.offset_x,"onUpdate:modelValue":e[19]||(e[19]=t=>d.offset_x=t),min:0,max:400,step:4,"controls-position":"right",style:{width:"116px"}},null,8,["modelValue"]),e[88]||(e[88]=l("span",{class:"muted"},"距底部",-1)),n(E,{modelValue:d.offset_y,"onUpdate:modelValue":e[20]||(e[20]=t=>d.offset_y=t),min:0,max:400,step:4,"controls-position":"right",style:{width:"116px"}},null,8,["modelValue"])])])]),_:1}),n(r,null,{label:o(()=>[e[90]||(e[90]=i("头部 Logo / 头像 ",-1)),n(c,{title:"头部头像"},{default:o(()=>[...e[89]||(e[89]=[l("p",null,"标题旁的小圆头像,填图片 URL(http/https)。留空 = 不显示。",-1)])]),_:1})]),default:o(()=>[n(V,{modelValue:d.avatar,"onUpdate:modelValue":e[21]||(e[21]=t=>d.avatar=t),placeholder:"https://…/logo.png(留空不显示)",class:"mono"},null,8,["modelValue"])]),_:1}),n(r,null,{label:o(()=>[e[92]||(e[92]=i("自定义气泡图标 ",-1)),n(c,{title:"气泡图标"},{default:o(()=>[...e[91]||(e[91]=[l("p",null,"右下角悬浮气泡里的图标,填图片 URL(http/https)。留空 = 用内置对话气泡图标。",-1)])]),_:1})]),default:o(()=>[n(V,{modelValue:d.launcher_icon,"onUpdate:modelValue":e[22]||(e[22]=t=>d.launcher_icon=t),placeholder:"https://…/icon.png(留空用默认气泡)",class:"mono"},null,8,["modelValue"])]),_:1})]),_:1}),n($,{label:"发布",name:"publish"},{default:o(()=>[n(r,{label:"说明(可选)"},{default:o(()=>[n(V,{modelValue:d.description,"onUpdate:modelValue":e[23]||(e[23]=t=>d.description=t)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["modelValue","title"]),n(et,{modelValue:h.value,"onUpdate:modelValue":e[34]||(e[34]=t=>h.value=t),title:"嵌入代码 · "+(($e=m.value)==null?void 0:$e.name),width:"820px",class:"code-dialog"},{default:o(()=>{var t;return[l("div",Ot,[e[96]||(e[96]=l("div",{class:"code-notice info"},[l("b",null,"entry_key 可公开"),l("span",null,"页面源码可见是预期行为;防滥用依靠 Origin 白名单、按 IP 限速和入口停用。")],-1)),e[97]||(e[97]=l("div",{class:"code-notice warning"},[l("b",null,"匿名访问边界"),l("span",null,[i("不带 "),l("code",null,"data-ticket"),i(" 时(包括控制台“匿名预览”),不会继承中枢后台登录状态。所有需主体工具,包括只读查询和写操作,都不会向 Agent 暴露。")])],-1)),(t=m.value)!=null&&t.ticket_client?(_(),C("div",jt,[...e[95]||(e[95]=[l("b",null,"支持业务身份票据",-1),l("span",null,[i("仅当已登录业务系统的后端签发短票,并在业务页面输出 "),l("code",null,"data-ticket"),i(" 时,组件才携带可信业务身份。")],-1)])])):P("",!0)]),m.value?(_(),C("div",It,[l("div",null,[e[98]||(e[98]=l("span",null,"入口",-1)),l("b",Tt,s(m.value.entry_key),1),l("em",null,s(m.value.name),1)]),l("div",null,[e[99]||(e[99]=l("span",null,"绑定路由",-1)),l("b",Nt,s(m.value.route_key),1),l("em",null,s(me(m.value.route_key)),1)]),l("div",null,[e[100]||(e[100]=l("span",null,"站点边界",-1)),l("b",null,s(Ne(m.value)),1),l("em",null,s(m.value.rate_limit_per_min)+"/分/IP",1)]),l("div",null,[e[101]||(e[101]=l("span",null,"访客身份",-1)),l("b",null,s(m.value.ticket_client?"支持业务身份票据":"仅匿名访问"),1),l("em",null,s(m.value.ticket_client||"未配置业务身份票据签发方"),1)])])):P("",!0),n(ie,{modelValue:ee.value,"onUpdate:modelValue":e[33]||(e[33]=g=>ee.value=g),class:"code-tabs"},{default:o(()=>{var g;return[n($,{label:"网页嵌入",name:"script"},{default:o(()=>[l("section",At,[l("div",Et,[e[103]||(e[103]=l("div",null,[l("b",null,"页面组件代码"),l("p",null,[i("贴到任意页面的 "),l("code",null,"</body>"),i(" 前,页面右下角会出现聊天气泡。")])],-1)),n(u,{type:"primary",onClick:e[27]||(e[27]=U=>H(fe.value))},{default:o(()=>[...e[102]||(e[102]=[i("复制代码",-1)])]),_:1})]),l("pre",Pt,s(fe.value),1)])]),_:1}),n($,{label:"匿名预览链接",name:"demo"},{default:o(()=>[l("section",Rt,[l("div",Lt,[e[105]||(e[105]=l("div",null,[l("b",null,"在线匿名预览页"),l("p",null,"无需嵌入页面,仅验证聊天组件、公开问答和无需主体的工具;该页不携带业务身份。")],-1)),n(u,{type:"primary",onClick:e[28]||(e[28]=U=>H(ye.value))},{default:o(()=>[...e[104]||(e[104]=[i("复制链接",-1)])]),_:1})]),l("pre",St,s(ye.value),1)])]),_:1}),n($,{label:"接口直调",name:"api"},{default:o(()=>[l("section",zt,[l("div",Bt,[e[107]||(e[107]=l("div",null,[l("b",null,"聊天接口示例"),l("p",null,"不用网页组件、自己做 UI 时按这个接口收发消息。")],-1)),n(u,{type:"primary",onClick:e[29]||(e[29]=U=>H(be.value))},{default:o(()=>[...e[106]||(e[106]=[i("复制代码",-1)])]),_:1})]),l("pre",Dt,s(be.value),1),e[108]||(e[108]=l("div",{class:"snippet-notes"},[l("span",null,[i("聊天任务结果只能走 "),l("code",null,"/chat/<入口>/result/<job_id>"),i(",不能用接入方 token 调 "),l("code",null,"/jobs/<id>"),i("。")])],-1))])]),_:1}),(g=m.value)!=null&&g.ticket_client?(_(),v($,{key:0,label:"业务身份票据",name:"ticket"},{default:o(()=>[l("section",Ft,[l("div",Ht,[e[110]||(e[110]=l("div",null,[l("b",null,"业务身份票据生成"),l("p",null,"业务后端在自己的用户登录态里执行,接入方 token 永不进入前端;任选一种语言实现同一签名算法。")],-1)),n(u,{type:"primary",onClick:e[30]||(e[30]=U=>H(ge.value))},{default:o(()=>[...e[109]||(e[109]=[i("复制代码",-1)])]),_:1})]),n(ie,{modelValue:L.value,"onUpdate:modelValue":e[31]||(e[31]=U=>L.value=U),class:"code-subtabs"},{default:o(()=>[n($,{label:"Node.js",name:"node"}),n($,{label:"Python",name:"python"}),n($,{label:"PHP",name:"php"})]),_:1},8,["modelValue"]),l("pre",Jt,s(ge.value),1),l("div",Kt,[e[112]||(e[112]=l("span",null,[i("带票据的访客会成为可信身份,uid 会进入 "),l("code",null,"metadata.visitor_uid"),i(" 并透传给业务工具。")],-1)),e[113]||(e[113]=l("span",null,"Java、Go、.NET 也提供同等票据签发 helper,完整用法见官网 SDK 文档。",-1)),n(u,{link:"",type:"primary",onClick:e[32]||(e[32]=U=>Oe(lt)("/docs/sdk"))},{default:o(()=>[...e[111]||(e[111]=[i("打开 SDK 文档",-1)])]),_:1})])])]),_:1})):P("",!0)]}),_:1},8,["modelValue"])]}),_:1},8,["modelValue","title"]),n(de,{modelValue:Q.value,"onUpdate:modelValue":e[35]||(e[35]=t=>Q.value=t),title:"评价记录 · "+((Ue=_e.value)==null?void 0:Ue.name),size:"920px"},{default:o(()=>[X.value.length?(_(),v(ne,{key:1,data:X.value,size:"small"},{default:o(()=>[n(y,{label:"评价",width:"70"},{default:o(({row:t})=>[n(A,{size:"small",type:Ee(t.rating),effect:"plain"},{default:o(()=>[i(s(Ae(t.rating)),1)]),_:2},1032,["type"])]),_:1}),n(y,{label:"问题","min-width":"160","show-overflow-tooltip":""},{default:o(({row:t})=>[i(s(t.question||"(任务已清理)"),1)]),_:1}),n(y,{label:"回答","min-width":"200","show-overflow-tooltip":""},{default:o(({row:t})=>[i(s(t.reply||"-"),1)]),_:1}),n(y,{label:"文字反馈","min-width":"180","show-overflow-tooltip":""},{default:o(({row:t})=>[i(s(t.comment||"-"),1)]),_:1}),n(y,{label:"时间",width:"150"},{default:o(({row:t})=>[l("span",qt,s(Oe(nt)(t.updated_at)),1)]),_:1}),n(y,{width:"80",align:"right"},{default:o(({row:t})=>[n(u,{link:"",type:"primary",onClick:g=>a.$router.push("/runs?job="+t.job_id)},{default:o(()=>[...e[114]||(e[114]=[i("看任务",-1)])]),_:1},8,["onClick"])]),_:1})]),_:1},8,["data"])):(_(),v(N,{key:0,description:"还没有评价:访客在组件里点「有用 / 没用 / 反馈」后在这里汇总"}))]),_:1},8,["modelValue","title"]),n(de,{modelValue:W.value,"onUpdate:modelValue":e[42]||(e[42]=t=>W.value=t),title:"页面登记 · "+((Ce=R.value)==null?void 0:Ce.name),size:"640px"},{default:o(()=>[n(k,{type:"info",closable:!1,style:{"margin-bottom":"14px"},title:"组件每条消息自动上报当前页 URL(path+hash,去 query)。这里声明「URL 模式 → 页面说明」,中枢匹配后把页面背景注入 AI、并落到任务详情,便于精准定位用户从哪个页面发起。只需声明你在意的页面,未命中的自动按原始路径兜底;几百上千路由也无需逐个写代码。"}),n(xe,{"label-position":"top"},{default:o(()=>[n(r,null,{label:o(()=>[e[116]||(e[116]=i("URL 模式 ",-1)),n(c,{title:"URL 模式"},{default:o(()=>[...e[115]||(e[115]=[l("p",null,[l("code",null,"*"),i(" 为通配,匹配组件抓到的 "),l("code",null,"path+hash"),i("(子串命中即可)。如 "),l("code",null,"*/users/list*"),i("、"),l("code",null,"/admin/settings"),i("、"),l("code",null,"#/records/*/detail"),i("。")],-1),l("p",null,"多条命中时取优先级高者;同级取模式更长(更具体)者。",-1)])]),_:1})]),default:o(()=>[n(V,{modelValue:f.url_pattern,"onUpdate:modelValue":e[36]||(e[36]=t=>f.url_pattern=t),placeholder:"如 */users/list*",class:"mono"},null,8,["modelValue"])]),_:1}),l("div",Gt,[n(r,{label:"页面标识 page_key(可选)",style:{flex:"1"}},{default:o(()=>[n(V,{modelValue:f.page_key,"onUpdate:modelValue":e[37]||(e[37]=t=>f.page_key=t),placeholder:"如 users.list",class:"mono"},null,8,["modelValue"])]),_:1}),n(r,{label:"页面名(可选)",style:{flex:"1"}},{default:o(()=>[n(V,{modelValue:f.page_name,"onUpdate:modelValue":e[38]||(e[38]=t=>f.page_name=t),placeholder:"如 用户列表"},null,8,["modelValue"])]),_:1})]),n(r,{label:"页面说明(注入给 AI:这页承载什么功能)"},{default:o(()=>[n(V,{modelValue:f.description,"onUpdate:modelValue":e[39]||(e[39]=t=>f.description=t),type:"textarea",rows:3,placeholder:"如:承载用户检索、标记、导出;权限配置在「设置」页维护"},null,8,["modelValue"])]),_:1}),l("div",Mt,[n(r,{label:"优先级(高者先匹配)"},{default:o(()=>[n(E,{modelValue:f.priority,"onUpdate:modelValue":e[40]||(e[40]=t=>f.priority=t),min:0,max:100},null,8,["modelValue"])]),_:1}),n(r,{label:"启用"},{default:o(()=>[n(j,{modelValue:f.enabled,"onUpdate:modelValue":e[41]||(e[41]=t=>f.enabled=t)},null,8,["modelValue"])]),_:1})]),n(u,{type:"primary",loading:Z.value,onClick:Fe},{default:o(()=>[i(s(f.id?"更新规则":"新增规则"),1)]),_:1},8,["loading"]),f.id?(_(),v(u,{key:0,onClick:F},{default:o(()=>[...e[117]||(e[117]=[i("取消编辑",-1)])]),_:1})):P("",!0)]),_:1}),n(tt),Y.value.length?(_(),v(ne,{key:1,data:Y.value,size:"small"},{default:o(()=>[n(y,{label:"URL 模式","min-width":"150"},{default:o(({row:t})=>[l("code",Qt,s(t.url_pattern),1)]),_:1}),n(y,{label:"页面","min-width":"120"},{default:o(({row:t})=>[l("b",null,s(t.page_name||"-"),1),l("div",Xt,s(t.page_key),1)]),_:1}),n(y,{label:"优先级",width:"70",align:"center"},{default:o(({row:t})=>[i(s(t.priority),1)]),_:1}),n(y,{label:"启用",width:"56",align:"center"},{default:o(({row:t})=>[i(s(t.enabled?"✓":"停"),1)]),_:1}),n(y,{width:"100",align:"right"},{default:o(({row:t})=>[n(u,{link:"",type:"primary",onClick:g=>De(t)},{default:o(()=>[...e[118]||(e[118]=[i("编辑",-1)])]),_:1},8,["onClick"]),n(Ve,{title:"删除该规则?",width:"200",onConfirm:g=>He(t.id)},{reference:o(()=>[n(u,{link:"",type:"danger"},{default:o(()=>[...e[119]||(e[119]=[i("删",-1)])]),_:1})]),_:1},8,["onConfirm"])]),_:1})]),_:1},8,["data"])):(_(),v(N,{key:0,description:"还没有页面登记:上面加一条 URL 模式 → 页面说明"}))]),_:1},8,["modelValue","title"])],64)}}}),il=dt(Wt,[["__scopeId","data-v-9000496e"]]);export{il as default};
@@ -0,0 +1 @@
1
+ .head[data-v-9000496e]{display:flex;align-items:center;gap:10px}.preview-boundary[data-v-9000496e]{margin-bottom:14px}.preview-boundary p[data-v-9000496e]{margin:6px 0 0;line-height:1.65}.row[data-v-9000496e]{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.row2[data-v-9000496e]{display:flex;gap:12px}.position-config[data-v-9000496e]{display:grid;gap:10px}.offset-row[data-v-9000496e]{padding-top:2px}.state-copy[data-v-9000496e]{display:inline-flex;align-items:center;gap:7px;color:var(--el-text-color-secondary);font-size:12px;white-space:nowrap}.muted[data-v-9000496e]{color:var(--el-text-color-secondary);font-size:12px}.mono[data-v-9000496e]{font-family:var(--bz-mono);font-size:12px}.ellipsis[data-v-9000496e]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.entry-main[data-v-9000496e],.entry-stack[data-v-9000496e],.protection-stack[data-v-9000496e]{display:grid;gap:4px;min-width:0}.protection-stack[data-v-9000496e]{min-width:86px}.entry-main b[data-v-9000496e]{min-width:0;overflow:hidden;color:var(--el-text-color-primary);font-size:13px;font-weight:650;text-overflow:ellipsis;white-space:nowrap}.entry-main code[data-v-9000496e]{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.entry-stack>div[data-v-9000496e],.tagline[data-v-9000496e]{display:flex;align-items:center;flex-wrap:wrap;gap:5px;min-width:0}.embed-entry-summary[data-v-9000496e]{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));margin-bottom:12px;border:1px solid var(--el-border-color-lighter)}.embed-entry-summary>div[data-v-9000496e]{min-width:0;padding:10px 12px;border-right:1px solid var(--el-border-color-lighter);background:var(--el-fill-color-lighter)}.embed-entry-summary>div[data-v-9000496e]:last-child{border-right:0}.embed-entry-summary span[data-v-9000496e],.embed-entry-summary em[data-v-9000496e]{display:block;color:var(--el-text-color-secondary);font-size:12px;font-style:normal}.embed-entry-summary b[data-v-9000496e]{display:block;margin:4px 0 2px;overflow:hidden;color:var(--el-text-color-primary);font-size:13px;text-overflow:ellipsis;white-space:nowrap}.table-actions[data-v-9000496e]{display:inline-flex;align-items:center;justify-content:flex-end;gap:14px;width:100%;line-height:1;white-space:nowrap}.table-actions[data-v-9000496e] .el-button{margin:0;padding:0;height:22px;line-height:22px}.table-actions[data-v-9000496e] .el-dropdown{display:inline-flex;align-items:center;height:22px;line-height:22px;vertical-align:top}@media(max-width:900px){.embed-entry-summary[data-v-9000496e]{grid-template-columns:repeat(2,minmax(0,1fr))}.embed-entry-summary>div[data-v-9000496e]:nth-child(2){border-right:0}.embed-entry-summary>div[data-v-9000496e]:nth-child(-n+2){border-bottom:1px solid var(--el-border-color-lighter)}}