@kingsoftcloud/ksadk-web 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -1
- package/dist-ksadk/assets/{ArtifactsPanel-Cjnqt-8W.js → ArtifactsPanel-CakCqxEN.js} +1 -1
- package/dist-ksadk/assets/{CodeBlock-BqyqZfuB.js → CodeBlock-CynLknyO.js} +1 -1
- package/dist-ksadk/assets/{MathMessageMarkdown-BpH7jiFM.js → MathMessageMarkdown-3sQdOysS.js} +1 -1
- package/dist-ksadk/assets/{MermaidBlock-DWuxETaJ.js → MermaidBlock-NERD_ef7.js} +6 -6
- package/dist-ksadk/assets/NativeTerminalPanel-CiHWf82q.js +1 -0
- package/dist-ksadk/assets/{arc-CFKwSk_B.js → arc-DrgjcKhl.js} +1 -1
- package/dist-ksadk/assets/architecture-7EHR7CIX-CpZLRCcY.js +1 -0
- package/dist-ksadk/assets/{architectureDiagram-3BPJPVTR-Dej8jX8c.js → architectureDiagram-3BPJPVTR-BXoVRbQ6.js} +1 -1
- package/dist-ksadk/assets/{blockDiagram-GPEHLZMM-1F64jqvy.js → blockDiagram-GPEHLZMM-BnaB3Ywv.js} +1 -1
- package/dist-ksadk/assets/{c4Diagram-AAUBKEIU-9q7AUAKb.js → c4Diagram-AAUBKEIU-Dw4weZcp.js} +1 -1
- package/dist-ksadk/assets/channel-Dt3rQTFI.js +1 -0
- package/dist-ksadk/assets/{chunk-2J33WTMH-6qgwJm7Q.js → chunk-2J33WTMH-ChjpLK7j.js} +1 -1
- package/dist-ksadk/assets/{chunk-4BX2VUAB-CsWIQRhc.js → chunk-4BX2VUAB-B9drTgOW.js} +1 -1
- package/dist-ksadk/assets/{chunk-55IACEB6-BK8paA20.js → chunk-55IACEB6-CK4ROATy.js} +1 -1
- package/dist-ksadk/assets/{chunk-727SXJPM-B-JEhy7h.js → chunk-727SXJPM-B9KtTTgw.js} +1 -1
- package/dist-ksadk/assets/{chunk-AQP2D5EJ-DYBvMHAa.js → chunk-AQP2D5EJ-1O1mki3m.js} +1 -1
- package/dist-ksadk/assets/{chunk-FMBD7UC4-BGhvzDYt.js → chunk-FMBD7UC4-B_fH2YuH.js} +1 -1
- package/dist-ksadk/assets/{chunk-ND2GUHAM-D98vPd-E.js → chunk-ND2GUHAM-D6rFLaVV.js} +1 -1
- package/dist-ksadk/assets/chunk-QZHKN3VN-iXEZtKQc.js +1 -0
- package/dist-ksadk/assets/classDiagram-4FO5ZUOK-DIveV17Q.js +1 -0
- package/dist-ksadk/assets/classDiagram-v2-Q7XG4LA2-DIveV17Q.js +1 -0
- package/dist-ksadk/assets/{cose-bilkent-S5V4N54A-CX3yotHq.js → cose-bilkent-S5V4N54A-ChNs_Mdk.js} +1 -1
- package/dist-ksadk/assets/{dagre-BM42HDAG-C7TguAWo.js → dagre-BM42HDAG-D0QXg_MQ.js} +1 -1
- package/dist-ksadk/assets/{diagram-2AECGRRQ-Dd17_kws.js → diagram-2AECGRRQ-DBDDKwBQ.js} +1 -1
- package/dist-ksadk/assets/{diagram-5GNKFQAL-DVIClIil.js → diagram-5GNKFQAL-BkwDOxmO.js} +1 -1
- package/dist-ksadk/assets/{diagram-KO2AKTUF-Df_3gYQa.js → diagram-KO2AKTUF-Bv8waYvY.js} +1 -1
- package/dist-ksadk/assets/{diagram-LMA3HP47-BhLk6ZtA.js → diagram-LMA3HP47-e1VECDdu.js} +1 -1
- package/dist-ksadk/assets/{diagram-OG6HWLK6-D4GNGvuu.js → diagram-OG6HWLK6-Ds9adfRl.js} +1 -1
- package/dist-ksadk/assets/{dist-DlzCRy0S.js → dist-4N2NMVYg.js} +1 -1
- package/dist-ksadk/assets/{dist-CGcp2ex8.js → dist-B-jNR6Vn.js} +1 -1
- package/dist-ksadk/assets/{dist-DyvYLMW9.js → dist-B5J2uhNk.js} +1 -1
- package/dist-ksadk/assets/{dist-DqNnNFrw.js → dist-B5oS1zcj.js} +1 -1
- package/dist-ksadk/assets/{dist-BibcG1V9.js → dist-BB3-OwTQ.js} +1 -1
- package/dist-ksadk/assets/{dist-Cwt7koer.js → dist-BIlKoW0k.js} +1 -1
- package/dist-ksadk/assets/{dist-C2xjE7cO.js → dist-BjOdlDjj.js} +1 -1
- package/dist-ksadk/assets/{dist-DHn6nBzr.js → dist-C1sz5Eo3.js} +1 -1
- package/dist-ksadk/assets/{dist-BZ9n9AjO.js → dist-CWV4lDr1.js} +1 -1
- package/dist-ksadk/assets/{dist-C99THtIA.js → dist-CmZHzlwZ.js} +1 -1
- package/dist-ksadk/assets/{dist-ivOya1LD.js → dist-D6MpCZtz.js} +1 -1
- package/dist-ksadk/assets/{dist-CVQRZjPu.js → dist-DJN_6Y39.js} +1 -1
- package/dist-ksadk/assets/{dist-6CVKuTAe.js → dist-DQU9EWw-.js} +1 -1
- package/dist-ksadk/assets/{dist-Djgl2wVZ.js → dist-DWKByxWV.js} +1 -1
- package/dist-ksadk/assets/{dist-D82mtD2s.js → dist-Dli7qW-B.js} +1 -1
- package/dist-ksadk/assets/{dist-CgF3fj15.js → dist-DsHPdk3W.js} +1 -1
- package/dist-ksadk/assets/{dist-C7-3jInC.js → dist-X4TnqwOK.js} +1 -1
- package/dist-ksadk/assets/{dist-BUHRxvDG.js → dist-_pHPTyZ-.js} +1 -1
- package/dist-ksadk/assets/{dist-eoW6tZXA.js → dist-fhOuWds5.js} +1 -1
- package/dist-ksadk/assets/{dist-DF06ORQo.js → dist-gLnrGsoU.js} +1 -1
- package/dist-ksadk/assets/{dist-Cf23NY4L.js → dist-j6Dxmf_j.js} +1 -1
- package/dist-ksadk/assets/{dist-Bs-jQcRX.js → dist-o2OVmKvt.js} +1 -1
- package/dist-ksadk/assets/{erDiagram-TEJ5UH35-CnfRcY2M.js → erDiagram-TEJ5UH35-BPItFKH6.js} +1 -1
- package/dist-ksadk/assets/eventmodeling-FCH6USID-DYFSxbqr.js +1 -0
- package/dist-ksadk/assets/{flowDiagram-I6XJVG4X-DGaJjGNJ.js → flowDiagram-I6XJVG4X-BbYB9w5Y.js} +1 -1
- package/dist-ksadk/assets/{ganttDiagram-6RSMTGT7-DpCoB2g9.js → ganttDiagram-6RSMTGT7-TQXa0KXv.js} +1 -1
- package/dist-ksadk/assets/gitGraph-WXDBUCRP-DyNYp6BN.js +1 -0
- package/dist-ksadk/assets/{gitGraphDiagram-PVQCEYII-9IKVFBVT.js → gitGraphDiagram-PVQCEYII-bKblCnpa.js} +1 -1
- package/dist-ksadk/assets/index-R52pJJvg.js +177 -0
- package/dist-ksadk/assets/index-jJr3_955.css +2 -0
- package/dist-ksadk/assets/info-J43DQDTF-WUx7qTde.js +1 -0
- package/dist-ksadk/assets/{infoDiagram-5YYISTIA-CYIIsb8y.js → infoDiagram-5YYISTIA-BGVT7J_i.js} +1 -1
- package/dist-ksadk/assets/{ishikawaDiagram-YF4QCWOH-DLOHGvWw.js → ishikawaDiagram-YF4QCWOH-K0OOfVna.js} +1 -1
- package/dist-ksadk/assets/{journeyDiagram-JHISSGLW-BIzKeejT.js → journeyDiagram-JHISSGLW-8LeOJaZp.js} +1 -1
- package/dist-ksadk/assets/{kanban-definition-UN3LZRKU-BWHoFSw2.js → kanban-definition-UN3LZRKU-C6uCgZrW.js} +1 -1
- package/dist-ksadk/assets/{katex-DATssjp1.js → katex-CYWseY5E.js} +1 -1
- package/dist-ksadk/assets/{linear-CvMBw9cA.js → linear-hdBcYzM8.js} +1 -1
- package/dist-ksadk/assets/{mermaid-parser.core-mGAcEwcq.js → mermaid-parser.core-BWrDjSZM.js} +2 -2
- package/dist-ksadk/assets/{mindmap-definition-RKZ34NQL-CSAQxEAe.js → mindmap-definition-RKZ34NQL-Bjy_2v4_.js} +1 -1
- package/dist-ksadk/assets/packet-YPE3B663-BN13y_xl.js +1 -0
- package/dist-ksadk/assets/pie-LRSECV5Y-ftSLXhhc.js +1 -0
- package/dist-ksadk/assets/{pieDiagram-4H26LBE5-By-ra07M.js → pieDiagram-4H26LBE5-GmmqNiVH.js} +1 -1
- package/dist-ksadk/assets/{quadrantDiagram-W4KKPZXB-CxIR4JXI.js → quadrantDiagram-W4KKPZXB-BmkRbwCg.js} +1 -1
- package/dist-ksadk/assets/radar-GUYGQ44K-jaICkIeO.js +1 -0
- package/dist-ksadk/assets/{requirementDiagram-4Y6WPE33-DpW90iu3.js → requirementDiagram-4Y6WPE33-DSWFqL7c.js} +1 -1
- package/dist-ksadk/assets/{sankeyDiagram-5OEKKPKP-DpGa6EAV.js → sankeyDiagram-5OEKKPKP-l6iXmU65.js} +1 -1
- package/dist-ksadk/assets/{sequenceDiagram-3UESZ5HK-NTKNGGe5.js → sequenceDiagram-3UESZ5HK-Cq6UBeQB.js} +1 -1
- package/dist-ksadk/assets/{stateDiagram-AJRCARHV-DGpd9yFG.js → stateDiagram-AJRCARHV-qzTQpg3Y.js} +1 -1
- package/dist-ksadk/assets/stateDiagram-v2-BHNVJYJU-BYCoYGAN.js +1 -0
- package/dist-ksadk/assets/{timeline-definition-PNZ67QCA-jqoYs3jQ.js → timeline-definition-PNZ67QCA-DEz24vV0.js} +1 -1
- package/dist-ksadk/assets/treeView-BLDUP644-Cpib_vlz.js +1 -0
- package/dist-ksadk/assets/treemap-LRROVOQU-DQxfmVHK.js +1 -0
- package/dist-ksadk/assets/{vennDiagram-CIIHVFJN-l3Z7-wbP.js → vennDiagram-CIIHVFJN-CMCixki2.js} +1 -1
- package/dist-ksadk/assets/wardley-L42UT6IY-BQYHnnkU.js +1 -0
- package/dist-ksadk/assets/{wardleyDiagram-YWT4CUSO-BR54GPmr.js → wardleyDiagram-YWT4CUSO-CVzB8F9K.js} +1 -1
- package/dist-ksadk/assets/{xychartDiagram-2RQKCTM6-SkiH8GsK.js → xychartDiagram-2RQKCTM6-BFBqBLc1.js} +1 -1
- package/dist-ksadk/index.html +2 -2
- package/dist-lib/{ArtifactsPanel-BAfHt4bC.js → ArtifactsPanel-DjKIRTwo.js} +1 -1
- package/dist-lib/{CodeBlock-Cbl6cxYC.js → CodeBlock-C1D0R8wN.js} +1 -1
- package/dist-lib/{MathMessageMarkdown-DbMSeHQa.js → MathMessageMarkdown-D6LuI2LH.js} +2 -2
- package/dist-lib/{NativeTerminalPanel-BTPHqbvY.js → NativeTerminalPanel-BLhX4eDs.js} +14 -6
- package/dist-lib/{WorkspacePanelContainer-Iy0LhhgG.js → WorkspacePanelContainer-B7YlLAUJ.js} +962 -790
- package/dist-lib/components/chat/types.d.ts +8 -0
- package/dist-lib/components/chat/types.d.ts.map +1 -1
- package/dist-lib/components/native/NativeTerminalPanel.d.ts.map +1 -1
- package/dist-lib/components.js +4 -4
- package/dist-lib/core/stream/index.d.ts +2 -0
- package/dist-lib/core/stream/index.d.ts.map +1 -1
- package/dist-lib/core/stream/responses-protocol.d.ts +7 -0
- package/dist-lib/core/stream/responses-protocol.d.ts.map +1 -1
- package/dist-lib/core/stream/runtime-items.d.ts +174 -0
- package/dist-lib/core/stream/runtime-items.d.ts.map +1 -0
- package/dist-lib/runtime.js +655 -652
- package/dist-lib/stores/streaming.d.ts +8 -0
- package/dist-lib/stores/streaming.d.ts.map +1 -1
- package/dist-lib/styles.css +1 -1
- package/dist-lib/utils/feedback.d.ts +0 -1
- package/dist-lib/utils/feedback.d.ts.map +1 -1
- package/dist-lib/utils/responses-stream.d.ts +1 -0
- package/dist-lib/utils/responses-stream.d.ts.map +1 -1
- package/dist-lib/utils/session-events.d.ts +8 -0
- package/dist-lib/utils/session-events.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist-ksadk/assets/NativeTerminalPanel-MDTopWMO.js +0 -1
- package/dist-ksadk/assets/architecture-7EHR7CIX-CynqOWjZ.js +0 -1
- package/dist-ksadk/assets/channel-iUGv2N24.js +0 -1
- package/dist-ksadk/assets/chunk-QZHKN3VN-YQIEXeF6.js +0 -1
- package/dist-ksadk/assets/classDiagram-4FO5ZUOK-CDAUuoXK.js +0 -1
- package/dist-ksadk/assets/classDiagram-v2-Q7XG4LA2-CDAUuoXK.js +0 -1
- package/dist-ksadk/assets/eventmodeling-FCH6USID-ChYO-ijM.js +0 -1
- package/dist-ksadk/assets/gitGraph-WXDBUCRP-BN_0Fk-j.js +0 -1
- package/dist-ksadk/assets/index-QSwCHuB8.js +0 -177
- package/dist-ksadk/assets/index-jOPmTOZH.css +0 -2
- package/dist-ksadk/assets/info-J43DQDTF-Cp6o3vId.js +0 -1
- package/dist-ksadk/assets/packet-YPE3B663-wQzct3cT.js +0 -1
- package/dist-ksadk/assets/pie-LRSECV5Y-BgTQiv-9.js +0 -1
- package/dist-ksadk/assets/radar-GUYGQ44K-BIq5fXsn.js +0 -1
- package/dist-ksadk/assets/stateDiagram-v2-BHNVJYJU-B3o579IQ.js +0 -1
- package/dist-ksadk/assets/treeView-BLDUP644-Dqi-E0EM.js +0 -1
- package/dist-ksadk/assets/treemap-LRROVOQU-ClQP9CJ9.js +0 -1
- package/dist-ksadk/assets/wardley-L42UT6IY-8XLvnNIs.js +0 -1
package/dist-lib/{WorkspacePanelContainer-Iy0LhhgG.js → WorkspacePanelContainer-B7YlLAUJ.js}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ArrowDown as e, ArrowUp as t, Bot as n, Check as r, ChevronDown as i, Code as a, Copy as o, Download as s, ExternalLink as c, Eye as l, FileCode2 as u, FileDiff as d, FileText as f, FolderOpen as p, Globe2 as m, Hand as h, Image as g, Loader2 as _, LoaderCircle as v, Maximize2 as y, MessageSquarePlus as b, MessageSquareText as x, Minimize2 as S, MoreHorizontal as C, Package as w, PanelLeft as ee, PanelLeftClose as T, Paperclip as E, Pin as D, PinOff as te, RefreshCcw as O, RefreshCw as ne, Save as re, Search as ie, ShieldAlert as ae, ShieldCheck as k, Sparkles as A, Square as oe, StopCircle as j, TerminalSquare as M, ThumbsDown as N, ThumbsUp as P, Trash2 as se, Upload as ce, WifiOff as le, Wrench as ue, X as de, XCircle as F, ZapOff as fe } from "lucide-react";
|
|
2
2
|
import { clsx as pe } from "clsx";
|
|
3
|
-
import { twMerge as
|
|
4
|
-
import { create as
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import * as
|
|
7
|
-
import
|
|
3
|
+
import { twMerge as me } from "tailwind-merge";
|
|
4
|
+
import { create as I } from "zustand";
|
|
5
|
+
import { Fragment as L, jsx as R, jsxs as z } from "react/jsx-runtime";
|
|
6
|
+
import * as B from "react";
|
|
7
|
+
import V, { Suspense as H, lazy as he, useCallback as U, useEffect as W, useId as ge, useLayoutEffect as G, useMemo as _e, useRef as K, useState as q } from "react";
|
|
8
8
|
import * as J from "@radix-ui/react-dialog";
|
|
9
9
|
import { cva as ve } from "class-variance-authority";
|
|
10
10
|
import ye from "react-markdown";
|
|
@@ -21,7 +21,7 @@ import { autocompletion as $e, closeBrackets as et, closeBracketsKeymap as tt, c
|
|
|
21
21
|
import { languages as rt } from "@codemirror/language-data";
|
|
22
22
|
//#region src/lib/utils.ts
|
|
23
23
|
function Y(...e) {
|
|
24
|
-
return
|
|
24
|
+
return me(pe(e));
|
|
25
25
|
}
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/stores/model.ts
|
|
@@ -34,7 +34,7 @@ function it(e, t) {
|
|
|
34
34
|
});
|
|
35
35
|
return Array.from(n.values()).sort((e, t) => e.id.localeCompare(t.id));
|
|
36
36
|
}
|
|
37
|
-
var at =
|
|
37
|
+
var at = I()((e) => ({
|
|
38
38
|
availableModels: [],
|
|
39
39
|
selectedModel: "",
|
|
40
40
|
modelSource: "",
|
|
@@ -63,28 +63,28 @@ function ct(e) {
|
|
|
63
63
|
//#region src/components/chat/ContextUsageIndicator.tsx
|
|
64
64
|
function lt({ indicator: e }) {
|
|
65
65
|
let t = Math.max(0, Math.min(100, e.percent ?? 0));
|
|
66
|
-
return /* @__PURE__ */
|
|
66
|
+
return /* @__PURE__ */ z("div", {
|
|
67
67
|
className: "group relative flex h-8 w-8 items-center justify-center",
|
|
68
|
-
children: [/* @__PURE__ */
|
|
68
|
+
children: [/* @__PURE__ */ R("div", {
|
|
69
69
|
className: Y("flex h-4 w-4 items-center justify-center rounded-full", e.phase === "warning" || e.phase === "compressing" || t >= 85 ? "text-red-500" : "text-[#a5abb2]"),
|
|
70
70
|
title: e.label,
|
|
71
|
-
children: /* @__PURE__ */
|
|
71
|
+
children: /* @__PURE__ */ R("div", {
|
|
72
72
|
className: "flex h-3 w-3 items-center justify-center rounded-full",
|
|
73
73
|
style: { background: `conic-gradient(currentColor ${t * 3.6}deg, #edf0f2 0deg)` },
|
|
74
|
-
children: /* @__PURE__ */
|
|
74
|
+
children: /* @__PURE__ */ R("span", { className: "h-2 w-2 rounded-full bg-background" })
|
|
75
75
|
})
|
|
76
|
-
}), /* @__PURE__ */
|
|
76
|
+
}), /* @__PURE__ */ z("div", {
|
|
77
77
|
className: "pointer-events-auto absolute bottom-[calc(100%+0.75rem)] left-1/2 z-30 hidden w-max -translate-x-1/2 rounded-2xl border border-border/70 bg-background px-4 py-3 text-center text-sm leading-5 text-foreground shadow-[0_14px_42px_rgba(15,23,42,0.16)] group-hover:block dark:shadow-[0_14px_42px_rgba(0,0,0,0.4)]",
|
|
78
78
|
children: [
|
|
79
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ R("div", {
|
|
80
80
|
className: "mb-1 whitespace-nowrap font-light text-text-secondary",
|
|
81
81
|
children: "估算上下文"
|
|
82
82
|
}),
|
|
83
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ z("div", {
|
|
84
84
|
className: "whitespace-nowrap font-light",
|
|
85
85
|
children: [t, "% 已使用"]
|
|
86
86
|
}),
|
|
87
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ R("div", {
|
|
88
88
|
className: "whitespace-nowrap font-light text-text-muted",
|
|
89
89
|
children: e.usedTokens && e.contextWindowTokens ? `${ut(e.usedTokens)} / ${ut(e.contextWindowTokens)}` : e.label
|
|
90
90
|
})
|
|
@@ -105,27 +105,27 @@ function dt({ label: e, options: t, value: n, onChange: r, title: a }) {
|
|
|
105
105
|
c.current && !c.current.contains(e.target) && s(!1);
|
|
106
106
|
};
|
|
107
107
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
108
|
-
}, [o]), /* @__PURE__ */
|
|
108
|
+
}, [o]), /* @__PURE__ */ z("div", {
|
|
109
109
|
ref: c,
|
|
110
110
|
className: "relative",
|
|
111
|
-
children: [/* @__PURE__ */
|
|
111
|
+
children: [/* @__PURE__ */ z("button", {
|
|
112
112
|
type: "button",
|
|
113
113
|
onClick: () => s((e) => !e),
|
|
114
114
|
title: a,
|
|
115
115
|
className: "flex h-8 max-w-[12rem] items-center gap-1 overflow-hidden rounded-full px-2 text-sm font-normal leading-[18px] text-text-primary hover:bg-muted",
|
|
116
|
-
children: [/* @__PURE__ */
|
|
116
|
+
children: [/* @__PURE__ */ R("span", {
|
|
117
117
|
className: "min-w-0 flex-1 truncate text-center",
|
|
118
118
|
children: e
|
|
119
|
-
}), /* @__PURE__ */
|
|
120
|
-
}), o ? /* @__PURE__ */
|
|
119
|
+
}), /* @__PURE__ */ R(i, { className: Y("h-4 w-4 shrink-0 text-text-secondary transition-transform", o && "rotate-180") })]
|
|
120
|
+
}), o ? /* @__PURE__ */ R("div", {
|
|
121
121
|
className: "absolute bottom-[calc(100%+0.5rem)] left-0 z-30 max-h-[min(50vh,20rem)] min-w-[10rem] max-w-[16rem] overflow-y-auto rounded-xl border border-border bg-popover p-1.5 text-sm shadow-[0_10px_28px_rgba(0,0,0,0.18)]",
|
|
122
|
-
children: t.map((e) => /* @__PURE__ */
|
|
122
|
+
children: t.map((e) => /* @__PURE__ */ R("button", {
|
|
123
123
|
type: "button",
|
|
124
124
|
onClick: () => {
|
|
125
125
|
r(e.value), s(!1);
|
|
126
126
|
},
|
|
127
127
|
className: Y("flex w-full items-center rounded-lg px-2.5 py-1.5 text-left leading-5 transition-colors", e.value === n ? "bg-muted text-text-primary" : "text-text-secondary hover:bg-muted hover:text-text-primary"),
|
|
128
|
-
children: /* @__PURE__ */
|
|
128
|
+
children: /* @__PURE__ */ R("span", {
|
|
129
129
|
className: "min-w-0 flex-1 truncate",
|
|
130
130
|
children: e.label
|
|
131
131
|
})
|
|
@@ -149,7 +149,7 @@ function mt(e) {
|
|
|
149
149
|
globalThis.localStorage?.setItem(ft, e);
|
|
150
150
|
} catch {}
|
|
151
151
|
}
|
|
152
|
-
var ht =
|
|
152
|
+
var ht = I()((e) => ({
|
|
153
153
|
permissionMode: pt(),
|
|
154
154
|
setPermissionMode: (t) => {
|
|
155
155
|
mt(t), e({ permissionMode: t });
|
|
@@ -197,10 +197,10 @@ function vt({ approvalPolicy: e }) {
|
|
|
197
197
|
return document.addEventListener("mousedown", e), document.addEventListener("keydown", r), () => {
|
|
198
198
|
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", r);
|
|
199
199
|
};
|
|
200
|
-
}, [t]), /* @__PURE__ */
|
|
200
|
+
}, [t]), /* @__PURE__ */ z("div", {
|
|
201
201
|
ref: a,
|
|
202
202
|
className: "relative",
|
|
203
|
-
children: [/* @__PURE__ */
|
|
203
|
+
children: [/* @__PURE__ */ z("button", {
|
|
204
204
|
type: "button",
|
|
205
205
|
onClick: () => n((e) => !e),
|
|
206
206
|
className: "flex h-8 items-center gap-1 rounded-full px-2 text-[13px] text-text-secondary transition hover:bg-muted hover:text-text-primary",
|
|
@@ -208,20 +208,20 @@ function vt({ approvalPolicy: e }) {
|
|
|
208
208
|
"aria-haspopup": "menu",
|
|
209
209
|
title: "设置本次会话的工具审批规则",
|
|
210
210
|
children: [
|
|
211
|
-
/* @__PURE__ */
|
|
212
|
-
/* @__PURE__ */
|
|
213
|
-
/* @__PURE__ */
|
|
211
|
+
/* @__PURE__ */ R(k, { className: "h-3.5 w-3.5" }),
|
|
212
|
+
/* @__PURE__ */ R("span", { children: _t[o] }),
|
|
213
|
+
/* @__PURE__ */ R(i, { className: Y("h-3.5 w-3.5 transition-transform", t && "rotate-180") })
|
|
214
214
|
]
|
|
215
|
-
}), t ? /* @__PURE__ */
|
|
215
|
+
}), t ? /* @__PURE__ */ z("div", {
|
|
216
216
|
role: "menu",
|
|
217
217
|
"aria-label": "工具权限",
|
|
218
218
|
className: "absolute bottom-[calc(100%+0.6rem)] left-0 z-30 w-[19rem] rounded-2xl border border-border/80 bg-popover p-1.5 shadow-[0_12px_30px_rgba(15,23,42,0.14)]",
|
|
219
|
-
children: [/* @__PURE__ */
|
|
219
|
+
children: [/* @__PURE__ */ R("div", {
|
|
220
220
|
className: "px-2.5 pb-1.5 pt-1 text-[11px] text-text-muted",
|
|
221
221
|
children: "本次会话的默认审批规则"
|
|
222
222
|
}), c.map((e) => {
|
|
223
223
|
let t = e.icon, i = e.value === o;
|
|
224
|
-
return /* @__PURE__ */
|
|
224
|
+
return /* @__PURE__ */ z("button", {
|
|
225
225
|
type: "button",
|
|
226
226
|
role: "menuitemradio",
|
|
227
227
|
"aria-checked": i,
|
|
@@ -230,18 +230,18 @@ function vt({ approvalPolicy: e }) {
|
|
|
230
230
|
},
|
|
231
231
|
className: Y("flex w-full items-center gap-2.5 rounded-xl px-2.5 py-2 text-left transition-colors", i ? "bg-primary/[0.08]" : "hover:bg-muted/75"),
|
|
232
232
|
children: [
|
|
233
|
-
/* @__PURE__ */
|
|
234
|
-
/* @__PURE__ */
|
|
233
|
+
/* @__PURE__ */ R(t, { className: Y("h-[17px] w-[17px] shrink-0", i ? "text-primary" : "text-text-muted") }),
|
|
234
|
+
/* @__PURE__ */ z("span", {
|
|
235
235
|
className: "min-w-0 flex-1",
|
|
236
|
-
children: [/* @__PURE__ */
|
|
236
|
+
children: [/* @__PURE__ */ R("span", {
|
|
237
237
|
className: Y("block text-[13px] font-medium leading-5", i ? "text-text-primary" : "text-text-secondary"),
|
|
238
238
|
children: e.label
|
|
239
|
-
}), /* @__PURE__ */
|
|
239
|
+
}), /* @__PURE__ */ R("span", {
|
|
240
240
|
className: "block text-[11px] leading-4 text-text-muted",
|
|
241
241
|
children: e.description
|
|
242
242
|
})]
|
|
243
243
|
}),
|
|
244
|
-
i ? /* @__PURE__ */
|
|
244
|
+
i ? /* @__PURE__ */ R(r, {
|
|
245
245
|
className: "h-4 w-4 shrink-0 text-primary",
|
|
246
246
|
"aria-hidden": "true"
|
|
247
247
|
}) : null
|
|
@@ -255,43 +255,43 @@ function vt({ approvalPolicy: e }) {
|
|
|
255
255
|
//#region src/components/chat/ChatComposer.tsx
|
|
256
256
|
function yt({ attachments: e, composerContextIndicator: n, composerMaxHeight: r, fileInputRef: i, input: a, isMobile: o, isStreaming: s, approvalEnabled: c = !1, approvalPolicy: l, queuedDrafts: u, onAppendAttachments: d, onInputChange: f, onPaste: p, onRemoveAttachment: m, onStopGeneration: h, onCancelRemote: g, onSubmit: _, textareaRef: v }) {
|
|
257
257
|
let y = o ? "发送消息..." : "发送消息…", b = g ? "保留恢复点并结束本次执行" : "停止生成", x = at((e) => e.availableModels), S = at((e) => e.selectedModel), C = at((e) => e.thinkingMode), w = at((e) => e.setSelectedModel), ee = at((e) => e.setThinkingMode), T = x.find((e) => e.id === S)?.display_name || S || "", D = (e) => e === "enabled" ? "开启思考" : e === "disabled" ? "关闭思考" : "思考自动", te = (e) => e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
|
|
258
|
-
return /* @__PURE__ */
|
|
258
|
+
return /* @__PURE__ */ R("div", {
|
|
259
259
|
className: "relative z-10 flex-shrink-0 bg-background/95 px-3 py-3 backdrop-blur sm:px-4 sm:py-3",
|
|
260
|
-
children: /* @__PURE__ */
|
|
260
|
+
children: /* @__PURE__ */ z("div", {
|
|
261
261
|
className: "mx-auto w-full max-w-[64rem]",
|
|
262
|
-
children: [u.length > 0 ? /* @__PURE__ */
|
|
262
|
+
children: [u.length > 0 ? /* @__PURE__ */ z("div", {
|
|
263
263
|
className: "mb-2 rounded-2xl border border-amber-200/80 bg-amber-50/80 px-3 py-2 text-xs text-amber-900 shadow-sm dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-100",
|
|
264
|
-
children: [/* @__PURE__ */
|
|
264
|
+
children: [/* @__PURE__ */ z("div", {
|
|
265
265
|
className: "mb-1.5 flex items-center justify-between gap-2",
|
|
266
|
-
children: [/* @__PURE__ */
|
|
266
|
+
children: [/* @__PURE__ */ z("span", {
|
|
267
267
|
className: "font-semibold",
|
|
268
268
|
children: ["发送队列 · ", u.length]
|
|
269
|
-
}), /* @__PURE__ */
|
|
269
|
+
}), /* @__PURE__ */ R("span", {
|
|
270
270
|
className: "text-amber-700/75 dark:text-amber-200/75",
|
|
271
271
|
children: "当前回复完成后依次发送"
|
|
272
272
|
})]
|
|
273
|
-
}), /* @__PURE__ */
|
|
273
|
+
}), /* @__PURE__ */ z("div", {
|
|
274
274
|
className: "flex flex-col gap-1",
|
|
275
275
|
children: [u.slice(0, 3).map((e, t) => {
|
|
276
276
|
let n = e.text.trim() || (e.attachments.length > 0 ? "仅附件消息" : "空消息");
|
|
277
|
-
return /* @__PURE__ */
|
|
277
|
+
return /* @__PURE__ */ z("div", {
|
|
278
278
|
className: "flex items-center gap-2 rounded-xl bg-background/70 px-2 py-1.5",
|
|
279
279
|
children: [
|
|
280
|
-
/* @__PURE__ */
|
|
280
|
+
/* @__PURE__ */ R("span", {
|
|
281
281
|
className: "flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full bg-amber-100 font-mono text-[10px] text-amber-700 dark:bg-amber-900/50 dark:text-amber-100",
|
|
282
282
|
children: t + 1
|
|
283
283
|
}),
|
|
284
|
-
/* @__PURE__ */
|
|
284
|
+
/* @__PURE__ */ R("span", {
|
|
285
285
|
className: "min-w-0 flex-1 truncate text-text-secondary",
|
|
286
286
|
children: n
|
|
287
287
|
}),
|
|
288
|
-
e.attachments.length > 0 ? /* @__PURE__ */
|
|
288
|
+
e.attachments.length > 0 ? /* @__PURE__ */ z("span", {
|
|
289
289
|
className: "flex-shrink-0 rounded-full bg-amber-100 px-2 py-0.5 text-[10px] text-amber-700 dark:bg-amber-900/50 dark:text-amber-100",
|
|
290
290
|
children: [e.attachments.length, " 附件"]
|
|
291
291
|
}) : null
|
|
292
292
|
]
|
|
293
293
|
}, `${t}-${n}-${e.attachments.length}`);
|
|
294
|
-
}), u.length > 3 ? /* @__PURE__ */
|
|
294
|
+
}), u.length > 3 ? /* @__PURE__ */ z("div", {
|
|
295
295
|
className: "px-2 pt-0.5 text-[11px] text-amber-700/80 dark:text-amber-200/80",
|
|
296
296
|
children: [
|
|
297
297
|
"还有 ",
|
|
@@ -300,11 +300,11 @@ function yt({ attachments: e, composerContextIndicator: n, composerMaxHeight: r,
|
|
|
300
300
|
]
|
|
301
301
|
}) : null]
|
|
302
302
|
})]
|
|
303
|
-
}) : null, /* @__PURE__ */
|
|
303
|
+
}) : null, /* @__PURE__ */ R("div", {
|
|
304
304
|
className: "relative rounded-[26px] bg-surface shadow-[0_0_0_0.5px_rgba(15,23,42,0.08),0_3px_7.5px_rgba(0,0,0,0.04),0_0_20px_rgba(0,0,0,0.05)] dark:shadow-[0_0_0_0.5px_rgba(255,255,255,0.06),0_3px_7.5px_rgba(0,0,0,0.2)]",
|
|
305
|
-
children: /* @__PURE__ */
|
|
305
|
+
children: /* @__PURE__ */ R("div", {
|
|
306
306
|
className: "flex items-center gap-3",
|
|
307
|
-
children: /* @__PURE__ */
|
|
307
|
+
children: /* @__PURE__ */ z("form", {
|
|
308
308
|
onSubmit: (t) => {
|
|
309
309
|
if (t.preventDefault(), s) {
|
|
310
310
|
g ? g() : h();
|
|
@@ -321,31 +321,31 @@ function yt({ attachments: e, composerContextIndicator: n, composerMaxHeight: r,
|
|
|
321
321
|
},
|
|
322
322
|
className: "relative flex min-h-[76px] min-w-0 flex-1 flex-col rounded-[26px] border border-border/45 bg-background px-4 pb-1.5 pt-2 transition-all focus-within:border-primary/40 focus-within:ring-2 focus-within:ring-primary/15",
|
|
323
323
|
children: [
|
|
324
|
-
e.length > 0 ? /* @__PURE__ */
|
|
324
|
+
e.length > 0 ? /* @__PURE__ */ R("div", {
|
|
325
325
|
className: "mb-1.5 flex flex-wrap gap-2",
|
|
326
|
-
children: e.map((e, t) => /* @__PURE__ */
|
|
326
|
+
children: e.map((e, t) => /* @__PURE__ */ z("div", {
|
|
327
327
|
className: Y("group relative flex items-center gap-2 rounded-xl border border-border bg-background px-3 py-2 text-xs", o ? "max-w-full" : "max-w-[14rem]"),
|
|
328
328
|
children: [
|
|
329
|
-
/* @__PURE__ */
|
|
329
|
+
/* @__PURE__ */ R("span", {
|
|
330
330
|
className: "flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-lg bg-muted text-text-muted",
|
|
331
|
-
children: /* @__PURE__ */
|
|
331
|
+
children: /* @__PURE__ */ R(E, { className: "h-3.5 w-3.5" })
|
|
332
332
|
}),
|
|
333
|
-
/* @__PURE__ */
|
|
333
|
+
/* @__PURE__ */ z("span", {
|
|
334
334
|
className: "min-w-0 flex-1",
|
|
335
|
-
children: [/* @__PURE__ */
|
|
335
|
+
children: [/* @__PURE__ */ R("span", {
|
|
336
336
|
className: "block truncate font-medium text-text-primary",
|
|
337
337
|
children: e.name
|
|
338
|
-
}), /* @__PURE__ */
|
|
338
|
+
}), /* @__PURE__ */ R("span", {
|
|
339
339
|
className: "block text-[10px] text-text-muted",
|
|
340
340
|
children: te(e.size)
|
|
341
341
|
})]
|
|
342
342
|
}),
|
|
343
|
-
/* @__PURE__ */
|
|
343
|
+
/* @__PURE__ */ R("button", {
|
|
344
344
|
type: "button",
|
|
345
345
|
onClick: () => m(t),
|
|
346
346
|
className: "absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full border border-border bg-background text-text-muted shadow-sm transition hover:text-rose-500",
|
|
347
347
|
"aria-label": `移除附件 ${e.name}`,
|
|
348
|
-
children: /* @__PURE__ */
|
|
348
|
+
children: /* @__PURE__ */ R("span", {
|
|
349
349
|
className: "text-[11px] leading-none",
|
|
350
350
|
children: "×"
|
|
351
351
|
})
|
|
@@ -353,7 +353,7 @@ function yt({ attachments: e, composerContextIndicator: n, composerMaxHeight: r,
|
|
|
353
353
|
]
|
|
354
354
|
}, `${e.name}-${e.size}-${t}`))
|
|
355
355
|
}) : null,
|
|
356
|
-
/* @__PURE__ */
|
|
356
|
+
/* @__PURE__ */ R("textarea", {
|
|
357
357
|
ref: v,
|
|
358
358
|
rows: 1,
|
|
359
359
|
value: a,
|
|
@@ -369,15 +369,15 @@ function yt({ attachments: e, composerContextIndicator: n, composerMaxHeight: r,
|
|
|
369
369
|
overflowY: "auto"
|
|
370
370
|
}
|
|
371
371
|
}),
|
|
372
|
-
/* @__PURE__ */
|
|
372
|
+
/* @__PURE__ */ z("div", {
|
|
373
373
|
className: "mt-auto flex min-h-8 items-center justify-between gap-2 pt-1",
|
|
374
|
-
children: [/* @__PURE__ */
|
|
374
|
+
children: [/* @__PURE__ */ z("div", {
|
|
375
375
|
className: "flex items-center gap-2",
|
|
376
376
|
children: [
|
|
377
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ z("label", {
|
|
378
378
|
className: "flex h-8 w-8 items-center justify-center rounded-full text-text-muted transition hover:bg-muted hover:text-text-secondary",
|
|
379
379
|
title: "上传附件",
|
|
380
|
-
children: [/* @__PURE__ */
|
|
380
|
+
children: [/* @__PURE__ */ R("input", {
|
|
381
381
|
ref: i,
|
|
382
382
|
type: "file",
|
|
383
383
|
multiple: !0,
|
|
@@ -385,10 +385,10 @@ function yt({ attachments: e, composerContextIndicator: n, composerMaxHeight: r,
|
|
|
385
385
|
onChange: (e) => {
|
|
386
386
|
e.target.files && e.target.files.length > 0 && (d(Array.from(e.target.files)), e.target.value = "");
|
|
387
387
|
}
|
|
388
|
-
}), /* @__PURE__ */
|
|
388
|
+
}), /* @__PURE__ */ R(E, { className: "h-[18px] w-[18px]" })]
|
|
389
389
|
}),
|
|
390
|
-
c ? /* @__PURE__ */
|
|
391
|
-
x.length > 0 ? /* @__PURE__ */
|
|
390
|
+
c ? /* @__PURE__ */ R(vt, { approvalPolicy: l }) : null,
|
|
391
|
+
x.length > 0 ? /* @__PURE__ */ R(dt, {
|
|
392
392
|
label: T || S,
|
|
393
393
|
title: T || S,
|
|
394
394
|
value: S,
|
|
@@ -398,7 +398,7 @@ function yt({ attachments: e, composerContextIndicator: n, composerMaxHeight: r,
|
|
|
398
398
|
label: e.display_name || e.id
|
|
399
399
|
}))
|
|
400
400
|
}) : null,
|
|
401
|
-
/* @__PURE__ */
|
|
401
|
+
/* @__PURE__ */ R(dt, {
|
|
402
402
|
label: D(C),
|
|
403
403
|
title: "控制模型 thinking/reasoning 参数",
|
|
404
404
|
value: C,
|
|
@@ -419,14 +419,14 @@ function yt({ attachments: e, composerContextIndicator: n, composerMaxHeight: r,
|
|
|
419
419
|
]
|
|
420
420
|
})
|
|
421
421
|
]
|
|
422
|
-
}), /* @__PURE__ */
|
|
422
|
+
}), /* @__PURE__ */ z("div", {
|
|
423
423
|
className: "flex items-center gap-1.5",
|
|
424
|
-
children: [n ? /* @__PURE__ */
|
|
424
|
+
children: [n ? /* @__PURE__ */ R(lt, { indicator: n }) : null, /* @__PURE__ */ R("button", {
|
|
425
425
|
type: "submit",
|
|
426
426
|
disabled: !s && !a.trim() && e.length === 0,
|
|
427
427
|
className: Y("flex h-8 w-8 items-center justify-center rounded-full transition-all", s || a.trim() || e.length > 0 ? "bg-[#1f1f1f] text-white hover:opacity-80" : "bg-muted text-text-muted/45"),
|
|
428
428
|
title: s ? b : "发送消息",
|
|
429
|
-
children: s ? /* @__PURE__ */
|
|
429
|
+
children: s ? /* @__PURE__ */ R(oe, { className: "h-3.5 w-3.5 fill-current" }) : /* @__PURE__ */ R(t, { className: "h-[18px] w-[18px]" })
|
|
430
430
|
})]
|
|
431
431
|
})]
|
|
432
432
|
})
|
|
@@ -439,7 +439,7 @@ function yt({ attachments: e, composerContextIndicator: n, composerMaxHeight: r,
|
|
|
439
439
|
}
|
|
440
440
|
//#endregion
|
|
441
441
|
//#region src/components/ui/sheet.tsx
|
|
442
|
-
var bt = J.Root, xt = J.Portal, St =
|
|
442
|
+
var bt = J.Root, xt = J.Portal, St = B.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ R(J.Overlay, {
|
|
443
443
|
className: Y("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", e),
|
|
444
444
|
...t,
|
|
445
445
|
ref: n
|
|
@@ -453,36 +453,36 @@ var Ct = ve("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out
|
|
|
453
453
|
right: "inset-y-0 right-0 h-full border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right"
|
|
454
454
|
} },
|
|
455
455
|
defaultVariants: { side: "right" }
|
|
456
|
-
}), wt =
|
|
456
|
+
}), wt = B.forwardRef(({ side: e = "right", className: t, children: n, showOverlay: r = !0, showCloseButton: i = !0, ...a }, o) => /* @__PURE__ */ z(xt, { children: [r ? /* @__PURE__ */ R(St, {}) : null, /* @__PURE__ */ z(J.Content, {
|
|
457
457
|
ref: o,
|
|
458
458
|
className: Y(Ct({ side: e }), t),
|
|
459
459
|
...a,
|
|
460
|
-
children: [n, i ? /* @__PURE__ */
|
|
460
|
+
children: [n, i ? /* @__PURE__ */ z(J.Close, {
|
|
461
461
|
className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",
|
|
462
|
-
children: [/* @__PURE__ */
|
|
462
|
+
children: [/* @__PURE__ */ R(de, { className: "h-4 w-4" }), /* @__PURE__ */ R("span", {
|
|
463
463
|
className: "sr-only",
|
|
464
464
|
children: "Close"
|
|
465
465
|
})]
|
|
466
466
|
}) : null]
|
|
467
467
|
})] }));
|
|
468
468
|
wt.displayName = J.Content.displayName;
|
|
469
|
-
var Tt = ({ className: e, ...t }) => /* @__PURE__ */
|
|
469
|
+
var Tt = ({ className: e, ...t }) => /* @__PURE__ */ R("div", {
|
|
470
470
|
className: Y("flex flex-col space-y-2 text-center sm:text-left", e),
|
|
471
471
|
...t
|
|
472
472
|
});
|
|
473
473
|
Tt.displayName = "SheetHeader";
|
|
474
|
-
var Et = ({ className: e, ...t }) => /* @__PURE__ */
|
|
474
|
+
var Et = ({ className: e, ...t }) => /* @__PURE__ */ R("div", {
|
|
475
475
|
className: Y("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e),
|
|
476
476
|
...t
|
|
477
477
|
});
|
|
478
478
|
Et.displayName = "SheetFooter";
|
|
479
|
-
var Dt =
|
|
479
|
+
var Dt = B.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ R(J.Title, {
|
|
480
480
|
ref: n,
|
|
481
481
|
className: Y("text-lg font-semibold text-foreground", e),
|
|
482
482
|
...t
|
|
483
483
|
}));
|
|
484
484
|
Dt.displayName = J.Title.displayName;
|
|
485
|
-
var Ot =
|
|
485
|
+
var Ot = B.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ R(J.Description, {
|
|
486
486
|
ref: n,
|
|
487
487
|
className: Y("text-sm text-muted-foreground", e),
|
|
488
488
|
...t
|
|
@@ -490,104 +490,104 @@ var Ot = V.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ z(J.Descrip
|
|
|
490
490
|
Ot.displayName = J.Description.displayName;
|
|
491
491
|
//#endregion
|
|
492
492
|
//#region src/components/chat/ChatHeader.tsx
|
|
493
|
-
var kt = he(() => import("./NativeTerminalPanel-
|
|
493
|
+
var kt = he(() => import("./NativeTerminalPanel-BLhX4eDs.js").then((e) => e.n).then((e) => ({ default: e.NativeTerminalPanel })));
|
|
494
494
|
function At({ availableModels: e, selectedModel: t, onSelectModel: n, selectedModelLabel: r, modelCatalogLoaded: i, modelSource: a, thinkingEnabled: o, thinkingMode: s, onSelectThinkingMode: c, compact: l = !1 }) {
|
|
495
|
-
let u = Y("rounded-full border border-slate-200 bg-white px-3 py-2 text-sm text-slate-700 outline-none transition-colors focus:ring-1 focus:ring-blue-500 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300", l ? "w-full" : "max-w-[13rem]"), d = e.length > 1 ? /* @__PURE__ */
|
|
495
|
+
let u = Y("rounded-full border border-slate-200 bg-white px-3 py-2 text-sm text-slate-700 outline-none transition-colors focus:ring-1 focus:ring-blue-500 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300", l ? "w-full" : "max-w-[13rem]"), d = e.length > 1 ? /* @__PURE__ */ R("select", {
|
|
496
496
|
value: t,
|
|
497
497
|
onChange: (e) => n(e.target.value),
|
|
498
498
|
className: u,
|
|
499
|
-
children: e.map((e) => /* @__PURE__ */
|
|
499
|
+
children: e.map((e) => /* @__PURE__ */ R("option", {
|
|
500
500
|
value: e.id,
|
|
501
501
|
children: e.display_name || e.id
|
|
502
502
|
}, e.id))
|
|
503
|
-
}) : r ? /* @__PURE__ */
|
|
503
|
+
}) : r ? /* @__PURE__ */ R("span", {
|
|
504
504
|
className: Y(u, "inline-flex max-w-full items-center", l ? "justify-start" : ""),
|
|
505
505
|
title: a || r,
|
|
506
|
-
children: /* @__PURE__ */
|
|
506
|
+
children: /* @__PURE__ */ R("span", {
|
|
507
507
|
className: "truncate",
|
|
508
508
|
children: r
|
|
509
509
|
})
|
|
510
|
-
}) : /* @__PURE__ */
|
|
510
|
+
}) : /* @__PURE__ */ R("span", {
|
|
511
511
|
className: "text-sm text-slate-400",
|
|
512
512
|
children: i ? "未配置模型" : "Loading models..."
|
|
513
|
-
}), f = o ? /* @__PURE__ */
|
|
513
|
+
}), f = o ? /* @__PURE__ */ z("select", {
|
|
514
514
|
value: s,
|
|
515
515
|
onChange: (e) => c(e.target.value),
|
|
516
516
|
className: Y(u, l ? "" : "max-w-[9rem]"),
|
|
517
517
|
title: "控制模型 thinking/reasoning 参数",
|
|
518
518
|
children: [
|
|
519
|
-
/* @__PURE__ */
|
|
519
|
+
/* @__PURE__ */ R("option", {
|
|
520
520
|
value: "auto",
|
|
521
521
|
children: "思考自动"
|
|
522
522
|
}),
|
|
523
|
-
/* @__PURE__ */
|
|
523
|
+
/* @__PURE__ */ R("option", {
|
|
524
524
|
value: "enabled",
|
|
525
525
|
children: "开启思考"
|
|
526
526
|
}),
|
|
527
|
-
/* @__PURE__ */
|
|
527
|
+
/* @__PURE__ */ R("option", {
|
|
528
528
|
value: "disabled",
|
|
529
529
|
children: "关闭思考"
|
|
530
530
|
})
|
|
531
531
|
]
|
|
532
532
|
}) : null;
|
|
533
|
-
return /* @__PURE__ */
|
|
533
|
+
return /* @__PURE__ */ z("div", {
|
|
534
534
|
className: Y("flex min-w-0 gap-2", l ? "w-full flex-col" : "items-center"),
|
|
535
535
|
children: [d, f]
|
|
536
536
|
});
|
|
537
537
|
}
|
|
538
538
|
function jt({ agentName: e, currentSessionId: t, isMobile: n, sidebarOpen: r, mobileSidebarOpen: i, onToggleSidebar: a, availableModels: o, selectedModel: s, onSelectModel: l, selectedModelLabel: u, modelCatalogLoaded: d, modelSource: f, thinkingEnabled: m, thinkingMode: h, onSelectThinkingMode: g, mobileActionsOpen: _, onMobileActionsOpenChange: v, workspaceEnabled: y, onOpenWorkspace: b, nativeManagementLink: x, nativeTerminal: S, nativeLauncherMode: w = !1 }) {
|
|
539
|
-
let [E, D] = q(!1), te = !!S?.Enabled, O =
|
|
540
|
-
return /* @__PURE__ */
|
|
541
|
-
/* @__PURE__ */
|
|
539
|
+
let [E, D] = q(!1), te = !!S?.Enabled, O = R(n ? i ? T : ee : r ? T : ee, { className: "h-5 w-5" });
|
|
540
|
+
return /* @__PURE__ */ z(L, { children: [
|
|
541
|
+
/* @__PURE__ */ z("header", {
|
|
542
542
|
className: Y("flex flex-shrink-0 items-center justify-between border-b border-black/[0.06] bg-background/95 px-3 py-2 backdrop-blur dark:border-white/[0.08] dark:bg-background/95 sm:px-4", n ? "pt-[calc(var(--safe-area-top)+0.5rem)]" : "h-12"),
|
|
543
|
-
children: [/* @__PURE__ */
|
|
543
|
+
children: [/* @__PURE__ */ z("div", {
|
|
544
544
|
className: "flex min-w-0 items-center gap-2",
|
|
545
|
-
children: [w ? null : /* @__PURE__ */
|
|
545
|
+
children: [w ? null : /* @__PURE__ */ R("button", {
|
|
546
546
|
type: "button",
|
|
547
547
|
onClick: a,
|
|
548
548
|
className: "rounded-lg p-2 text-slate-500 transition-colors hover:bg-slate-100 dark:hover:bg-slate-800",
|
|
549
549
|
"aria-label": n ? "打开历史记录" : "切换侧边栏",
|
|
550
550
|
children: O
|
|
551
|
-
}), /* @__PURE__ */
|
|
551
|
+
}), /* @__PURE__ */ z("div", {
|
|
552
552
|
className: "min-w-0",
|
|
553
|
-
children: [/* @__PURE__ */
|
|
553
|
+
children: [/* @__PURE__ */ R("div", {
|
|
554
554
|
className: "truncate text-sm font-semibold text-slate-900 dark:text-slate-100 sm:text-base",
|
|
555
555
|
children: e
|
|
556
|
-
}), /* @__PURE__ */
|
|
556
|
+
}), /* @__PURE__ */ R("div", {
|
|
557
557
|
className: "text-[11px] text-slate-400 dark:text-slate-500",
|
|
558
558
|
children: w ? "原生运行时入口" : "智能体"
|
|
559
559
|
})]
|
|
560
560
|
})]
|
|
561
|
-
}), n ? /* @__PURE__ */
|
|
561
|
+
}), n ? /* @__PURE__ */ R("button", {
|
|
562
562
|
type: "button",
|
|
563
563
|
onClick: () => v(!0),
|
|
564
564
|
className: "rounded-lg p-2 text-slate-500 transition-colors hover:bg-slate-100 dark:hover:bg-slate-800",
|
|
565
565
|
"aria-label": "打开会话操作",
|
|
566
|
-
children: /* @__PURE__ */
|
|
567
|
-
}) : /* @__PURE__ */
|
|
566
|
+
children: /* @__PURE__ */ R(C, { className: "h-5 w-5" })
|
|
567
|
+
}) : /* @__PURE__ */ z("div", {
|
|
568
568
|
className: "flex min-w-0 items-center gap-2",
|
|
569
569
|
children: [
|
|
570
|
-
x ? /* @__PURE__ */
|
|
570
|
+
x ? /* @__PURE__ */ z("a", {
|
|
571
571
|
href: x.href,
|
|
572
572
|
target: "_blank",
|
|
573
573
|
rel: "noreferrer",
|
|
574
574
|
title: x.title,
|
|
575
575
|
className: "inline-flex flex-shrink-0 items-center gap-1.5 whitespace-nowrap rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm font-medium leading-none text-slate-700 transition hover:bg-slate-100 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-300 dark:hover:bg-slate-700",
|
|
576
|
-
children: [/* @__PURE__ */
|
|
576
|
+
children: [/* @__PURE__ */ R(c, { className: "h-4 w-4" }), /* @__PURE__ */ R("span", { children: x.label })]
|
|
577
577
|
}) : null,
|
|
578
|
-
y ? /* @__PURE__ */
|
|
578
|
+
y ? /* @__PURE__ */ z("button", {
|
|
579
579
|
type: "button",
|
|
580
580
|
onClick: b,
|
|
581
581
|
className: "inline-flex flex-shrink-0 items-center gap-1.5 whitespace-nowrap rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm font-medium leading-none text-slate-700 transition hover:bg-slate-100 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-300 dark:hover:bg-slate-700",
|
|
582
|
-
children: [/* @__PURE__ */
|
|
582
|
+
children: [/* @__PURE__ */ R(p, { className: "h-4 w-4" }), /* @__PURE__ */ R("span", { children: "Workspace" })]
|
|
583
583
|
}) : null,
|
|
584
|
-
te ? /* @__PURE__ */
|
|
584
|
+
te ? /* @__PURE__ */ z("button", {
|
|
585
585
|
type: "button",
|
|
586
586
|
onClick: () => D(!0),
|
|
587
587
|
className: "inline-flex flex-shrink-0 items-center gap-1.5 whitespace-nowrap rounded-xl border border-emerald-200 bg-emerald-50 px-3 py-2 text-sm font-medium leading-none text-emerald-800 transition hover:bg-emerald-100 dark:border-emerald-900/70 dark:bg-emerald-950/40 dark:text-emerald-200",
|
|
588
|
-
children: [/* @__PURE__ */
|
|
588
|
+
children: [/* @__PURE__ */ R(M, { className: "h-4 w-4" }), /* @__PURE__ */ R("span", { children: "TUI" })]
|
|
589
589
|
}) : null,
|
|
590
|
-
!w && n ? /* @__PURE__ */
|
|
590
|
+
!w && n ? /* @__PURE__ */ R(At, {
|
|
591
591
|
availableModels: o,
|
|
592
592
|
selectedModel: s,
|
|
593
593
|
onSelectModel: l,
|
|
@@ -599,62 +599,62 @@ function jt({ agentName: e, currentSessionId: t, isMobile: n, sidebarOpen: r, mo
|
|
|
599
599
|
onSelectThinkingMode: g,
|
|
600
600
|
compact: !0
|
|
601
601
|
}) : null,
|
|
602
|
-
!w && t ? /* @__PURE__ */
|
|
602
|
+
!w && t ? /* @__PURE__ */ z("span", {
|
|
603
603
|
className: "rounded bg-slate-50 px-2 py-1 text-xs font-mono text-slate-400 dark:bg-slate-800",
|
|
604
604
|
children: ["ID: ", t.slice(0, 8)]
|
|
605
605
|
}) : null
|
|
606
606
|
]
|
|
607
607
|
})]
|
|
608
608
|
}),
|
|
609
|
-
n ? /* @__PURE__ */
|
|
609
|
+
n ? /* @__PURE__ */ R(bt, {
|
|
610
610
|
open: _,
|
|
611
611
|
onOpenChange: v,
|
|
612
|
-
children: /* @__PURE__ */
|
|
612
|
+
children: /* @__PURE__ */ z(wt, {
|
|
613
613
|
side: "bottom",
|
|
614
614
|
className: "rounded-t-[1.75rem] border-slate-200 bg-white px-4 pb-[calc(var(--safe-area-bottom)+1rem)] pt-6 dark:border-slate-800 dark:bg-slate-900",
|
|
615
|
-
children: [/* @__PURE__ */
|
|
615
|
+
children: [/* @__PURE__ */ z(Tt, {
|
|
616
616
|
className: "text-left",
|
|
617
|
-
children: [/* @__PURE__ */
|
|
617
|
+
children: [/* @__PURE__ */ R(Dt, { children: "会话设置" }), /* @__PURE__ */ R(Ot, {
|
|
618
618
|
className: "sr-only",
|
|
619
619
|
children: "调整当前会话的模型和 Workspace 操作。"
|
|
620
620
|
})]
|
|
621
|
-
}), /* @__PURE__ */
|
|
621
|
+
}), /* @__PURE__ */ z("div", {
|
|
622
622
|
className: "mt-6 flex flex-col gap-4",
|
|
623
623
|
children: [
|
|
624
|
-
y ? /* @__PURE__ */
|
|
624
|
+
y ? /* @__PURE__ */ z("button", {
|
|
625
625
|
type: "button",
|
|
626
626
|
onClick: () => {
|
|
627
627
|
v(!1), b();
|
|
628
628
|
},
|
|
629
629
|
className: "inline-flex items-center gap-2 rounded-xl border border-slate-200 bg-slate-50 px-3 py-3 text-sm font-medium text-slate-700 transition hover:bg-slate-100 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-300 dark:hover:bg-slate-700",
|
|
630
|
-
children: [/* @__PURE__ */
|
|
630
|
+
children: [/* @__PURE__ */ R(p, { className: "h-4 w-4" }), "工作区文件"]
|
|
631
631
|
}) : null,
|
|
632
|
-
te ? /* @__PURE__ */
|
|
632
|
+
te ? /* @__PURE__ */ z("button", {
|
|
633
633
|
type: "button",
|
|
634
634
|
onClick: () => {
|
|
635
635
|
v(!1), D(!0);
|
|
636
636
|
},
|
|
637
637
|
className: "inline-flex items-center gap-2 rounded-xl border border-emerald-200 bg-emerald-50 px-3 py-3 text-sm font-medium text-emerald-800 transition hover:bg-emerald-100 dark:border-emerald-900/70 dark:bg-emerald-950/40 dark:text-emerald-200",
|
|
638
|
-
children: [/* @__PURE__ */
|
|
638
|
+
children: [/* @__PURE__ */ R(M, { className: "h-4 w-4" }), "原生 TUI"]
|
|
639
639
|
}) : null,
|
|
640
|
-
x ? /* @__PURE__ */
|
|
640
|
+
x ? /* @__PURE__ */ z("a", {
|
|
641
641
|
href: x.href,
|
|
642
642
|
target: "_blank",
|
|
643
643
|
rel: "noreferrer",
|
|
644
644
|
title: x.title,
|
|
645
645
|
onClick: () => v(!1),
|
|
646
646
|
className: "inline-flex items-center gap-2 rounded-xl border border-slate-200 bg-slate-50 px-3 py-3 text-sm font-medium text-slate-700 transition hover:bg-slate-100 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-300 dark:hover:bg-slate-700",
|
|
647
|
-
children: [/* @__PURE__ */
|
|
647
|
+
children: [/* @__PURE__ */ R(c, { className: "h-4 w-4" }), x.label]
|
|
648
648
|
}) : null,
|
|
649
|
-
w ? /* @__PURE__ */
|
|
649
|
+
w ? /* @__PURE__ */ R("div", {
|
|
650
650
|
className: "rounded-2xl border border-slate-200 bg-slate-50 px-3 py-3 text-sm leading-6 text-slate-600 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-300",
|
|
651
651
|
children: "当前运行时对话在原生管理台中进行;这里保留管理入口和 Workspace 文件操作。"
|
|
652
|
-
}) : /* @__PURE__ */
|
|
652
|
+
}) : /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ z("div", {
|
|
653
653
|
className: "space-y-2",
|
|
654
|
-
children: [/* @__PURE__ */
|
|
654
|
+
children: [/* @__PURE__ */ R("div", {
|
|
655
655
|
className: "text-xs font-medium uppercase tracking-[0.12em] text-slate-400 dark:text-slate-500",
|
|
656
656
|
children: "模型"
|
|
657
|
-
}), /* @__PURE__ */
|
|
657
|
+
}), /* @__PURE__ */ R(At, {
|
|
658
658
|
availableModels: o,
|
|
659
659
|
selectedModel: s,
|
|
660
660
|
onSelectModel: l,
|
|
@@ -666,14 +666,14 @@ function jt({ agentName: e, currentSessionId: t, isMobile: n, sidebarOpen: r, mo
|
|
|
666
666
|
onSelectThinkingMode: g,
|
|
667
667
|
compact: !0
|
|
668
668
|
})]
|
|
669
|
-
}), /* @__PURE__ */
|
|
669
|
+
}), /* @__PURE__ */ z("div", {
|
|
670
670
|
className: "space-y-2",
|
|
671
|
-
children: [/* @__PURE__ */
|
|
671
|
+
children: [/* @__PURE__ */ R("div", {
|
|
672
672
|
className: "text-xs font-medium uppercase tracking-[0.12em] text-slate-400 dark:text-slate-500",
|
|
673
673
|
children: "当前会话"
|
|
674
|
-
}), /* @__PURE__ */
|
|
674
|
+
}), /* @__PURE__ */ R("div", {
|
|
675
675
|
className: "rounded-2xl border border-slate-200 bg-slate-50 px-3 py-3 text-sm text-slate-600 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-300",
|
|
676
|
-
children: t ? /* @__PURE__ */
|
|
676
|
+
children: t ? /* @__PURE__ */ R("span", {
|
|
677
677
|
className: "break-all font-mono",
|
|
678
678
|
children: t
|
|
679
679
|
}) : "新对话尚未创建会话 ID"
|
|
@@ -683,9 +683,9 @@ function jt({ agentName: e, currentSessionId: t, isMobile: n, sidebarOpen: r, mo
|
|
|
683
683
|
})]
|
|
684
684
|
})
|
|
685
685
|
}) : null,
|
|
686
|
-
S && E ? /* @__PURE__ */
|
|
686
|
+
S && E ? /* @__PURE__ */ R(H, {
|
|
687
687
|
fallback: null,
|
|
688
|
-
children: /* @__PURE__ */
|
|
688
|
+
children: /* @__PURE__ */ R(kt, {
|
|
689
689
|
capability: S,
|
|
690
690
|
open: E,
|
|
691
691
|
sessionId: t,
|
|
@@ -814,91 +814,91 @@ function Kt(e) {
|
|
|
814
814
|
}
|
|
815
815
|
//#endregion
|
|
816
816
|
//#region src/components/MessageMarkdown.tsx
|
|
817
|
-
var qt =
|
|
817
|
+
var qt = V.lazy(() => import("./CodeBlock-C1D0R8wN.js").then((e) => ({ default: e.CodeBlock }))), Jt = V.lazy(() => import("./MermaidBlock-BFNE1NN8.js").then((e) => ({ default: e.MermaidBlock }))), Yt = V.lazy(() => import("./MathMessageMarkdown-D6LuI2LH.js").then((e) => ({ default: e.MathMessageMarkdown })));
|
|
818
818
|
function Xt(e) {
|
|
819
819
|
return /\$[^$]+\$|\$\$[^$]+\$\$/.test(e);
|
|
820
820
|
}
|
|
821
821
|
var Zt = {
|
|
822
822
|
h1({ children: e }) {
|
|
823
|
-
return /* @__PURE__ */
|
|
823
|
+
return /* @__PURE__ */ R("h1", {
|
|
824
824
|
className: "mb-3.5 mt-5 text-[17px] font-semibold text-foreground",
|
|
825
825
|
children: e
|
|
826
826
|
});
|
|
827
827
|
},
|
|
828
828
|
h2({ children: e }) {
|
|
829
|
-
return /* @__PURE__ */
|
|
829
|
+
return /* @__PURE__ */ R("h2", {
|
|
830
830
|
className: "mb-2.5 mt-4.5 text-[15px] font-semibold text-foreground",
|
|
831
831
|
children: e
|
|
832
832
|
});
|
|
833
833
|
},
|
|
834
834
|
h3({ children: e }) {
|
|
835
|
-
return /* @__PURE__ */
|
|
835
|
+
return /* @__PURE__ */ R("h3", {
|
|
836
836
|
className: "mb-2 mt-3.5 text-[14px] font-semibold text-foreground",
|
|
837
837
|
children: e
|
|
838
838
|
});
|
|
839
839
|
},
|
|
840
840
|
p({ children: e }) {
|
|
841
|
-
return /* @__PURE__ */
|
|
841
|
+
return /* @__PURE__ */ R("p", {
|
|
842
842
|
className: "mb-2.5 min-w-0 break-words leading-[1.65] text-foreground",
|
|
843
843
|
children: e
|
|
844
844
|
});
|
|
845
845
|
},
|
|
846
846
|
ul({ children: e }) {
|
|
847
|
-
return /* @__PURE__ */
|
|
847
|
+
return /* @__PURE__ */ R("ul", {
|
|
848
848
|
className: "mb-3 list-disc space-y-1.5 pl-5 text-foreground",
|
|
849
849
|
children: e
|
|
850
850
|
});
|
|
851
851
|
},
|
|
852
852
|
ol({ children: e }) {
|
|
853
|
-
return /* @__PURE__ */
|
|
853
|
+
return /* @__PURE__ */ R("ol", {
|
|
854
854
|
className: "mb-3 list-decimal space-y-1.5 pl-8 text-foreground",
|
|
855
855
|
children: e
|
|
856
856
|
});
|
|
857
857
|
},
|
|
858
858
|
li({ children: e }) {
|
|
859
|
-
return /* @__PURE__ */
|
|
859
|
+
return /* @__PURE__ */ R("li", {
|
|
860
860
|
className: "min-w-0 break-words pl-1 leading-6 text-foreground",
|
|
861
861
|
children: e
|
|
862
862
|
});
|
|
863
863
|
},
|
|
864
864
|
strong({ children: e }) {
|
|
865
|
-
return /* @__PURE__ */
|
|
865
|
+
return /* @__PURE__ */ R("strong", {
|
|
866
866
|
className: "font-semibold text-foreground",
|
|
867
867
|
children: e
|
|
868
868
|
});
|
|
869
869
|
},
|
|
870
870
|
blockquote({ children: e }) {
|
|
871
|
-
return /* @__PURE__ */
|
|
871
|
+
return /* @__PURE__ */ R("blockquote", {
|
|
872
872
|
className: "mb-3 border-l-2 border-border pl-4 text-text-secondary",
|
|
873
873
|
children: e
|
|
874
874
|
});
|
|
875
875
|
},
|
|
876
876
|
code({ className: e, children: t, ...n }) {
|
|
877
877
|
let r = /language-(\w+)/.exec(e || ""), i = String(t ?? "");
|
|
878
|
-
if (!r && !i.includes("\n")) return /* @__PURE__ */
|
|
878
|
+
if (!r && !i.includes("\n")) return /* @__PURE__ */ R("code", {
|
|
879
879
|
className: "rounded-md border border-border bg-muted px-1.5 py-0.5 font-mono text-[13.5px] text-text-primary before:content-none after:content-none",
|
|
880
880
|
...n,
|
|
881
881
|
children: t
|
|
882
882
|
});
|
|
883
883
|
let a = r ? r[1] : "";
|
|
884
|
-
return a === "mermaid" ? /* @__PURE__ */
|
|
885
|
-
fallback: /* @__PURE__ */
|
|
886
|
-
children: /* @__PURE__ */
|
|
887
|
-
}) : /* @__PURE__ */
|
|
888
|
-
fallback: /* @__PURE__ */
|
|
884
|
+
return a === "mermaid" ? /* @__PURE__ */ R(H, {
|
|
885
|
+
fallback: /* @__PURE__ */ R("div", { className: "h-32 animate-pulse rounded bg-muted" }),
|
|
886
|
+
children: /* @__PURE__ */ R(Jt, { chart: i })
|
|
887
|
+
}) : /* @__PURE__ */ R(H, {
|
|
888
|
+
fallback: /* @__PURE__ */ R("pre", {
|
|
889
889
|
className: "p-4 text-sm",
|
|
890
890
|
children: i
|
|
891
891
|
}),
|
|
892
|
-
children: /* @__PURE__ */
|
|
892
|
+
children: /* @__PURE__ */ R(qt, {
|
|
893
893
|
language: a,
|
|
894
894
|
value: i
|
|
895
895
|
})
|
|
896
896
|
});
|
|
897
897
|
},
|
|
898
898
|
table({ children: e, ...t }) {
|
|
899
|
-
return /* @__PURE__ */
|
|
899
|
+
return /* @__PURE__ */ R("div", {
|
|
900
900
|
className: "mb-3 max-w-full overflow-x-auto",
|
|
901
|
-
children: /* @__PURE__ */
|
|
901
|
+
children: /* @__PURE__ */ R("table", {
|
|
902
902
|
className: "w-full min-w-max border-collapse text-sm text-foreground",
|
|
903
903
|
...t,
|
|
904
904
|
children: e
|
|
@@ -906,21 +906,21 @@ var Zt = {
|
|
|
906
906
|
});
|
|
907
907
|
},
|
|
908
908
|
th({ children: e, ...t }) {
|
|
909
|
-
return /* @__PURE__ */
|
|
909
|
+
return /* @__PURE__ */ R("th", {
|
|
910
910
|
className: "border-b border-border px-3 py-2 text-left font-semibold text-foreground",
|
|
911
911
|
...t,
|
|
912
912
|
children: e
|
|
913
913
|
});
|
|
914
914
|
},
|
|
915
915
|
td({ children: e, ...t }) {
|
|
916
|
-
return /* @__PURE__ */
|
|
916
|
+
return /* @__PURE__ */ R("td", {
|
|
917
917
|
className: "border-b border-border px-3 py-2 text-text-secondary",
|
|
918
918
|
...t,
|
|
919
919
|
children: e
|
|
920
920
|
});
|
|
921
921
|
},
|
|
922
922
|
a({ children: e, href: t, ...n }) {
|
|
923
|
-
return /* @__PURE__ */
|
|
923
|
+
return /* @__PURE__ */ R("a", {
|
|
924
924
|
href: t,
|
|
925
925
|
className: "text-primary hover:underline",
|
|
926
926
|
target: "_blank",
|
|
@@ -929,20 +929,20 @@ var Zt = {
|
|
|
929
929
|
children: e
|
|
930
930
|
});
|
|
931
931
|
}
|
|
932
|
-
}, Qt =
|
|
932
|
+
}, Qt = V.memo(({ content: e }) => {
|
|
933
933
|
let t = Kt(e);
|
|
934
|
-
return /* @__PURE__ */
|
|
934
|
+
return /* @__PURE__ */ R("div", {
|
|
935
935
|
className: "max-w-none break-words text-[14px] leading-[1.65] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
|
|
936
|
-
children: /* @__PURE__ */
|
|
936
|
+
children: /* @__PURE__ */ R(ye, {
|
|
937
937
|
remarkPlugins: [be, xe],
|
|
938
938
|
components: Zt,
|
|
939
939
|
children: t
|
|
940
940
|
})
|
|
941
941
|
});
|
|
942
|
-
}), Z =
|
|
943
|
-
fallback: /* @__PURE__ */
|
|
944
|
-
children: /* @__PURE__ */
|
|
945
|
-
}) : /* @__PURE__ */
|
|
942
|
+
}), Z = V.memo(({ content: e }) => Xt(e) ? /* @__PURE__ */ R(H, {
|
|
943
|
+
fallback: /* @__PURE__ */ R(Qt, { content: e }),
|
|
944
|
+
children: /* @__PURE__ */ R(Yt, { content: e })
|
|
945
|
+
}) : /* @__PURE__ */ R(Qt, { content: e })), $t = /^diff --git "?a\/(.+?)"? "?b\/(.+?)"?$/;
|
|
946
946
|
function en(e) {
|
|
947
947
|
let t = [], n = /* @__PURE__ */ new Map(), r = null;
|
|
948
948
|
for (let i of e.split("\n")) {
|
|
@@ -979,17 +979,17 @@ function nn(e) {
|
|
|
979
979
|
//#region src/components/chat/ProcessingBlocksView.tsx
|
|
980
980
|
function rn({ summary: e, children: t, defaultOpen: n = !1, streaming: r = !1 }) {
|
|
981
981
|
let [a, o] = q(n);
|
|
982
|
-
return /* @__PURE__ */
|
|
982
|
+
return /* @__PURE__ */ z("div", {
|
|
983
983
|
className: "mb-1.5",
|
|
984
|
-
children: [/* @__PURE__ */
|
|
984
|
+
children: [/* @__PURE__ */ z("button", {
|
|
985
985
|
type: "button",
|
|
986
986
|
onClick: () => o((e) => !e),
|
|
987
987
|
className: "flex w-full items-center gap-1.5 rounded px-1 py-1 text-left text-[13px] text-slate-500 transition-colors hover:bg-slate-100/70 dark:text-slate-400 dark:hover:bg-slate-800/40",
|
|
988
|
-
children: [r ? /* @__PURE__ */
|
|
988
|
+
children: [r ? /* @__PURE__ */ R(v, { className: "h-3.5 w-3.5 animate-spin text-slate-400" }) : /* @__PURE__ */ R(i, { className: Y("h-3.5 w-3.5 text-slate-400 transition-transform", a && "rotate-90") }), /* @__PURE__ */ R("span", {
|
|
989
989
|
className: "min-w-0 flex-1 truncate",
|
|
990
990
|
children: e
|
|
991
991
|
})]
|
|
992
|
-
}), a && /* @__PURE__ */
|
|
992
|
+
}), a && /* @__PURE__ */ R("div", {
|
|
993
993
|
className: "mt-1.5 border-l border-slate-200 pl-3.5 dark:border-slate-700/60",
|
|
994
994
|
children: t
|
|
995
995
|
})]
|
|
@@ -997,83 +997,83 @@ function rn({ summary: e, children: t, defaultOpen: n = !1, streaming: r = !1 })
|
|
|
997
997
|
}
|
|
998
998
|
function an({ block: e }) {
|
|
999
999
|
let [t, n] = q(!1), r = e.status === "streaming", a = e.content.length, o = `${e.id}-thinking-detail`;
|
|
1000
|
-
return /* @__PURE__ */
|
|
1000
|
+
return /* @__PURE__ */ z("div", {
|
|
1001
1001
|
className: "mb-1.5 min-w-0",
|
|
1002
|
-
children: [/* @__PURE__ */
|
|
1002
|
+
children: [/* @__PURE__ */ z("button", {
|
|
1003
1003
|
type: "button",
|
|
1004
1004
|
"aria-expanded": t,
|
|
1005
1005
|
"aria-controls": o,
|
|
1006
1006
|
onClick: () => n((e) => !e),
|
|
1007
1007
|
className: "flex w-full items-center gap-1.5 rounded px-1 py-1 text-left text-[13px] leading-5 text-slate-400 transition-colors hover:bg-slate-100/70 hover:text-slate-500 dark:text-slate-500 dark:hover:bg-slate-800/40 dark:hover:text-slate-400",
|
|
1008
1008
|
children: [
|
|
1009
|
-
/* @__PURE__ */
|
|
1010
|
-
/* @__PURE__ */
|
|
1009
|
+
/* @__PURE__ */ R(A, { className: Y("h-3.5 w-3.5 shrink-0", r && "animate-pulse motion-reduce:animate-none") }),
|
|
1010
|
+
/* @__PURE__ */ R("span", {
|
|
1011
1011
|
className: "min-w-0 truncate",
|
|
1012
1012
|
children: r ? "思考中" : "已思考"
|
|
1013
1013
|
}),
|
|
1014
|
-
!r && /* @__PURE__ */
|
|
1014
|
+
!r && /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("span", {
|
|
1015
1015
|
className: "text-slate-300 dark:text-slate-600",
|
|
1016
1016
|
children: "·"
|
|
1017
|
-
}), /* @__PURE__ */
|
|
1017
|
+
}), /* @__PURE__ */ z("span", {
|
|
1018
1018
|
className: "font-mono text-xs text-slate-400 dark:text-slate-500",
|
|
1019
1019
|
children: [a, " 字"]
|
|
1020
1020
|
})] }),
|
|
1021
|
-
/* @__PURE__ */
|
|
1021
|
+
/* @__PURE__ */ R(i, { className: Y("h-3.5 w-3.5 shrink-0 transition-transform", t && "rotate-180") })
|
|
1022
1022
|
]
|
|
1023
|
-
}), t && e.content && /* @__PURE__ */
|
|
1023
|
+
}), t && e.content && /* @__PURE__ */ R("div", {
|
|
1024
1024
|
id: o,
|
|
1025
1025
|
className: "custom-scrollbar mt-1.5 max-h-[min(46vh,28rem)] overflow-y-auto border-l border-slate-200/80 pl-3.5 text-[12px] leading-5 text-slate-500 dark:border-slate-700/60 dark:text-slate-400 [&_h1]:!mb-2 [&_h1]:!mt-3 [&_h1]:!text-[13px] [&_h2]:!mb-1.5 [&_h2]:!mt-3 [&_h2]:!text-[12px] [&_h3]:!mb-1 [&_h3]:!mt-2.5 [&_h3]:!text-[12px] [&_li]:!text-[12px] [&_li]:!leading-5 [&_p]:!my-1.5 [&_p]:!text-[12px] [&_p]:!leading-5 [&_p]:!text-slate-500 dark:[&_p]:!text-slate-400 [&_pre]:!my-1.5",
|
|
1026
|
-
children: /* @__PURE__ */
|
|
1026
|
+
children: /* @__PURE__ */ R(Z, { content: e.content })
|
|
1027
1027
|
})]
|
|
1028
1028
|
});
|
|
1029
1029
|
}
|
|
1030
1030
|
function on({ block: e, tool: t, isStreaming: n, onRespondToApproval: r, onRespondToAguiApproval: i }) {
|
|
1031
1031
|
let a = t?.status ?? e.status, o = t?.args ?? e.args, s = t?.output ?? e.output, c = e.extra || {}, l = c.approvalStatus || t?.approvalStatus, u = c.approvalRequestId || t?.approvalRequestId, d = c.approvalMessage || t?.approvalMessage, f = c.approvalProtocol || t?.approvalProtocol, p = c.previousResponseId || t?.previousResponseId, m = a === "running", h = a === "error", g = a === "paused", _ = h ? "执行失败" : l === "pending" ? "等待确认" : l === "rejected" ? "已拒绝" : m ? l === "approved" ? "已授权 · 执行中" : "正在运行" : l === "approved" ? "已授权" : g ? "已暂停" : "已完成", v = h ? "text-rose-500 dark:text-rose-400" : g ? "text-amber-500 dark:text-amber-400" : m ? "text-slate-500 dark:text-slate-400" : "text-slate-400 dark:text-slate-500";
|
|
1032
|
-
return /* @__PURE__ */
|
|
1032
|
+
return /* @__PURE__ */ R(rn, {
|
|
1033
1033
|
streaming: m && !o,
|
|
1034
1034
|
defaultOpen: l === "pending" || g,
|
|
1035
|
-
summary: /* @__PURE__ */
|
|
1035
|
+
summary: /* @__PURE__ */ z("span", {
|
|
1036
1036
|
className: "flex items-center gap-1.5",
|
|
1037
1037
|
children: [
|
|
1038
|
-
/* @__PURE__ */
|
|
1039
|
-
/* @__PURE__ */
|
|
1038
|
+
/* @__PURE__ */ R(ue, { className: Y("h-3.5 w-3.5 shrink-0", v) }),
|
|
1039
|
+
/* @__PURE__ */ R("span", {
|
|
1040
1040
|
className: v,
|
|
1041
1041
|
children: _
|
|
1042
1042
|
}),
|
|
1043
|
-
/* @__PURE__ */
|
|
1043
|
+
/* @__PURE__ */ R("span", {
|
|
1044
1044
|
className: "truncate font-medium text-slate-600 dark:text-slate-300",
|
|
1045
1045
|
children: e.toolName
|
|
1046
1046
|
}),
|
|
1047
|
-
m && o && /* @__PURE__ */
|
|
1047
|
+
m && o && /* @__PURE__ */ R("span", {
|
|
1048
1048
|
className: "ml-0.5 animate-pulse text-slate-400",
|
|
1049
1049
|
children: "…"
|
|
1050
1050
|
})
|
|
1051
1051
|
]
|
|
1052
1052
|
}),
|
|
1053
|
-
children: /* @__PURE__ */
|
|
1053
|
+
children: /* @__PURE__ */ z("div", {
|
|
1054
1054
|
className: "flex flex-col gap-2.5 py-1 text-[13px]",
|
|
1055
1055
|
children: [
|
|
1056
|
-
u && l === "pending" && /* @__PURE__ */
|
|
1056
|
+
u && l === "pending" && /* @__PURE__ */ z("section", {
|
|
1057
1057
|
className: "flex flex-wrap items-center gap-x-3 gap-y-2 rounded-lg border border-slate-200/90 bg-white/70 px-2.5 py-2 font-sans text-[12px] text-slate-600 shadow-[0_1px_2px_rgba(15,23,42,0.03)] dark:border-slate-700/80 dark:bg-slate-900/30 dark:text-slate-300",
|
|
1058
|
-
children: [/* @__PURE__ */
|
|
1058
|
+
children: [/* @__PURE__ */ z("div", {
|
|
1059
1059
|
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
1060
1060
|
children: [
|
|
1061
|
-
/* @__PURE__ */
|
|
1061
|
+
/* @__PURE__ */ R("span", {
|
|
1062
1062
|
className: "h-1.5 w-1.5 shrink-0 rounded-full bg-amber-400",
|
|
1063
1063
|
"aria-hidden": "true"
|
|
1064
1064
|
}),
|
|
1065
|
-
/* @__PURE__ */
|
|
1065
|
+
/* @__PURE__ */ R("span", {
|
|
1066
1066
|
className: "shrink-0 font-medium text-slate-700 dark:text-slate-200",
|
|
1067
1067
|
children: "需要确认"
|
|
1068
1068
|
}),
|
|
1069
|
-
/* @__PURE__ */
|
|
1069
|
+
/* @__PURE__ */ R("span", {
|
|
1070
1070
|
className: "min-w-0 truncate text-slate-500 dark:text-slate-400",
|
|
1071
1071
|
children: d || "允许后将执行此工具调用。"
|
|
1072
1072
|
})
|
|
1073
1073
|
]
|
|
1074
|
-
}), /* @__PURE__ */
|
|
1074
|
+
}), /* @__PURE__ */ z("div", {
|
|
1075
1075
|
className: "flex shrink-0 items-center gap-1.5",
|
|
1076
|
-
children: [/* @__PURE__ */
|
|
1076
|
+
children: [/* @__PURE__ */ R("button", {
|
|
1077
1077
|
type: "button",
|
|
1078
1078
|
disabled: n,
|
|
1079
1079
|
onClick: () => f === "ag-ui" ? i?.({
|
|
@@ -1086,7 +1086,7 @@ function on({ block: e, tool: t, isStreaming: n, onRespondToApproval: r, onRespo
|
|
|
1086
1086
|
}),
|
|
1087
1087
|
className: "inline-flex h-7 items-center rounded-md bg-primary px-2.5 text-[12px] font-medium text-primary-foreground transition hover:bg-primary/90 disabled:opacity-55",
|
|
1088
1088
|
children: "允许执行"
|
|
1089
|
-
}), /* @__PURE__ */
|
|
1089
|
+
}), /* @__PURE__ */ R("button", {
|
|
1090
1090
|
type: "button",
|
|
1091
1091
|
disabled: n,
|
|
1092
1092
|
onClick: () => f === "ag-ui" ? i?.({
|
|
@@ -1102,15 +1102,15 @@ function on({ block: e, tool: t, isStreaming: n, onRespondToApproval: r, onRespo
|
|
|
1102
1102
|
})]
|
|
1103
1103
|
})]
|
|
1104
1104
|
}),
|
|
1105
|
-
u && l && l !== "pending" && /* @__PURE__ */
|
|
1105
|
+
u && l && l !== "pending" && /* @__PURE__ */ z("div", {
|
|
1106
1106
|
className: "flex items-center gap-1.5 font-sans text-xs text-slate-500 dark:text-slate-400",
|
|
1107
1107
|
children: [
|
|
1108
|
-
/* @__PURE__ */
|
|
1109
|
-
l === "approved" && m ? /* @__PURE__ */
|
|
1110
|
-
l === "approved" && h ? /* @__PURE__ */
|
|
1108
|
+
/* @__PURE__ */ R("span", { children: l === "approved" ? "已授权" : "已拒绝" }),
|
|
1109
|
+
l === "approved" && m ? /* @__PURE__ */ R("span", { children: "· 工具执行中" }) : null,
|
|
1110
|
+
l === "approved" && h ? /* @__PURE__ */ R("span", { children: "· 工具执行失败" }) : null
|
|
1111
1111
|
]
|
|
1112
1112
|
}),
|
|
1113
|
-
o ? /* @__PURE__ */
|
|
1113
|
+
o ? /* @__PURE__ */ R(dn, {
|
|
1114
1114
|
label: "入参",
|
|
1115
1115
|
value: o,
|
|
1116
1116
|
tone: "input"
|
|
@@ -1121,13 +1121,13 @@ function on({ block: e, tool: t, isStreaming: n, onRespondToApproval: r, onRespo
|
|
|
1121
1121
|
});
|
|
1122
1122
|
}
|
|
1123
1123
|
function sn(e, t, n) {
|
|
1124
|
-
if (nn(t)) return /* @__PURE__ */
|
|
1124
|
+
if (nn(t)) return /* @__PURE__ */ R(cn, { output: t });
|
|
1125
1125
|
let r = e.toLowerCase();
|
|
1126
1126
|
if (r.includes("web_search") || r.includes("search")) {
|
|
1127
1127
|
let e = ln(t);
|
|
1128
|
-
if (e.length > 0) return /* @__PURE__ */
|
|
1128
|
+
if (e.length > 0) return /* @__PURE__ */ R(un, { sources: e });
|
|
1129
1129
|
}
|
|
1130
|
-
return /* @__PURE__ */
|
|
1130
|
+
return /* @__PURE__ */ R(dn, {
|
|
1131
1131
|
label: "输出",
|
|
1132
1132
|
value: t,
|
|
1133
1133
|
tone: n ? "error" : "output"
|
|
@@ -1135,35 +1135,35 @@ function sn(e, t, n) {
|
|
|
1135
1135
|
}
|
|
1136
1136
|
function cn({ output: e }) {
|
|
1137
1137
|
let t = en(e), [n, r] = q(!1), i = n ? t : t.slice(0, 3);
|
|
1138
|
-
return /* @__PURE__ */
|
|
1138
|
+
return /* @__PURE__ */ z("div", {
|
|
1139
1139
|
className: "my-2 overflow-hidden rounded-xl border border-border bg-background",
|
|
1140
1140
|
children: [
|
|
1141
|
-
/* @__PURE__ */
|
|
1141
|
+
/* @__PURE__ */ z("div", {
|
|
1142
1142
|
className: "flex items-center gap-1.5 border-b border-border px-3 py-2 text-xs font-medium text-text-secondary",
|
|
1143
|
-
children: [/* @__PURE__ */
|
|
1143
|
+
children: [/* @__PURE__ */ R(d, { className: "h-3.5 w-3.5 text-primary" }), /* @__PURE__ */ z("span", { children: [
|
|
1144
1144
|
"改动 ",
|
|
1145
1145
|
t.length,
|
|
1146
1146
|
" 个文件"
|
|
1147
1147
|
] })]
|
|
1148
1148
|
}),
|
|
1149
|
-
/* @__PURE__ */
|
|
1149
|
+
/* @__PURE__ */ R("div", {
|
|
1150
1150
|
className: "flex flex-col",
|
|
1151
1151
|
children: i.map((e) => {
|
|
1152
1152
|
let { added: t, removed: n } = tn(e);
|
|
1153
|
-
return /* @__PURE__ */
|
|
1153
|
+
return /* @__PURE__ */ z("div", {
|
|
1154
1154
|
className: "group/file-change-row flex min-w-0 items-center gap-2 px-3 py-2 text-sm transition-colors hover:bg-muted",
|
|
1155
|
-
children: [/* @__PURE__ */
|
|
1155
|
+
children: [/* @__PURE__ */ R("span", {
|
|
1156
1156
|
className: "min-w-0 flex-1 truncate font-mono text-[13px] text-text-primary",
|
|
1157
1157
|
children: e.path
|
|
1158
|
-
}), /* @__PURE__ */
|
|
1158
|
+
}), /* @__PURE__ */ z("span", {
|
|
1159
1159
|
className: "flex-shrink-0 text-[11px] font-mono",
|
|
1160
1160
|
children: [
|
|
1161
|
-
/* @__PURE__ */
|
|
1161
|
+
/* @__PURE__ */ z("span", {
|
|
1162
1162
|
className: "text-emerald-600",
|
|
1163
1163
|
children: ["+", t]
|
|
1164
1164
|
}),
|
|
1165
1165
|
" ",
|
|
1166
|
-
/* @__PURE__ */
|
|
1166
|
+
/* @__PURE__ */ z("span", {
|
|
1167
1167
|
className: "text-rose-500",
|
|
1168
1168
|
children: ["−", n]
|
|
1169
1169
|
})
|
|
@@ -1172,7 +1172,7 @@ function cn({ output: e }) {
|
|
|
1172
1172
|
}, e.path);
|
|
1173
1173
|
})
|
|
1174
1174
|
}),
|
|
1175
|
-
t.length > 3 ? /* @__PURE__ */
|
|
1175
|
+
t.length > 3 ? /* @__PURE__ */ R("button", {
|
|
1176
1176
|
type: "button",
|
|
1177
1177
|
onClick: () => r((e) => !e),
|
|
1178
1178
|
className: "flex w-full items-center justify-center gap-1 border-t border-border py-1.5 text-xs text-text-muted transition hover:bg-muted hover:text-text-primary",
|
|
@@ -1196,32 +1196,32 @@ function ln(e) {
|
|
|
1196
1196
|
}
|
|
1197
1197
|
}
|
|
1198
1198
|
function un({ sources: e }) {
|
|
1199
|
-
return /* @__PURE__ */
|
|
1199
|
+
return /* @__PURE__ */ R("div", {
|
|
1200
1200
|
className: "mt-2 flex min-w-0",
|
|
1201
|
-
children: /* @__PURE__ */
|
|
1201
|
+
children: /* @__PURE__ */ z("span", {
|
|
1202
1202
|
className: "group/web-search-sources relative inline-flex min-w-0",
|
|
1203
|
-
children: [/* @__PURE__ */
|
|
1203
|
+
children: [/* @__PURE__ */ z("button", {
|
|
1204
1204
|
type: "button",
|
|
1205
1205
|
className: "inline-flex h-7 min-w-0 items-center gap-1.5 rounded-md border border-border bg-surface px-2 text-xs text-text-secondary transition-colors hover:bg-muted hover:text-text-primary",
|
|
1206
|
-
children: [/* @__PURE__ */
|
|
1206
|
+
children: [/* @__PURE__ */ R(m, {
|
|
1207
1207
|
className: "h-3.5 w-3.5 shrink-0",
|
|
1208
1208
|
strokeWidth: 1.7
|
|
1209
|
-
}), /* @__PURE__ */
|
|
1210
|
-
}), /* @__PURE__ */
|
|
1209
|
+
}), /* @__PURE__ */ z("span", { children: ["来源 · ", e.length] })]
|
|
1210
|
+
}), /* @__PURE__ */ R("span", {
|
|
1211
1211
|
className: "absolute bottom-full left-0 z-30 hidden max-w-[calc(100vw-3rem)] pb-1 group-hover/web-search-sources:block",
|
|
1212
|
-
children: /* @__PURE__ */
|
|
1212
|
+
children: /* @__PURE__ */ R("span", {
|
|
1213
1213
|
className: "block w-[min(26rem,calc(100vw-3rem))] rounded-xl border border-border bg-popover p-2 text-left text-text-primary shadow-2xl",
|
|
1214
|
-
children: /* @__PURE__ */
|
|
1214
|
+
children: /* @__PURE__ */ R("span", {
|
|
1215
1215
|
className: "flex min-w-0 flex-col gap-1",
|
|
1216
|
-
children: e.map((e, t) => /* @__PURE__ */
|
|
1216
|
+
children: e.map((e, t) => /* @__PURE__ */ z("a", {
|
|
1217
1217
|
href: e.url,
|
|
1218
1218
|
target: "_blank",
|
|
1219
1219
|
rel: "noopener noreferrer",
|
|
1220
1220
|
className: "flex min-w-0 items-center gap-2 rounded-lg px-2 py-1.5 text-sm leading-5 text-text-secondary transition-colors hover:bg-muted hover:text-text-primary",
|
|
1221
|
-
children: [/* @__PURE__ */
|
|
1221
|
+
children: [/* @__PURE__ */ R(m, {
|
|
1222
1222
|
className: "h-3.5 w-3.5 shrink-0",
|
|
1223
1223
|
strokeWidth: 1.7
|
|
1224
|
-
}), /* @__PURE__ */
|
|
1224
|
+
}), /* @__PURE__ */ R("span", {
|
|
1225
1225
|
className: "min-w-0 flex-1 truncate",
|
|
1226
1226
|
children: e.title
|
|
1227
1227
|
})]
|
|
@@ -1233,38 +1233,206 @@ function un({ sources: e }) {
|
|
|
1233
1233
|
});
|
|
1234
1234
|
}
|
|
1235
1235
|
function dn({ label: e, tone: t, value: n }) {
|
|
1236
|
-
return /* @__PURE__ */
|
|
1236
|
+
return /* @__PURE__ */ z("div", { children: [/* @__PURE__ */ R("div", {
|
|
1237
1237
|
className: "mb-1 text-[11px] font-semibold uppercase tracking-wide text-slate-400",
|
|
1238
1238
|
children: e
|
|
1239
|
-
}), /* @__PURE__ */
|
|
1239
|
+
}), /* @__PURE__ */ R("pre", {
|
|
1240
1240
|
className: Y("custom-scrollbar max-h-60 overflow-auto rounded-lg px-3 py-2 text-[12.5px] leading-relaxed whitespace-pre-wrap break-all", t === "error" ? "bg-rose-50/60 text-rose-700 dark:bg-rose-950/20 dark:text-rose-200" : t === "output" ? "bg-emerald-50/40 text-emerald-800 dark:bg-emerald-950/20 dark:text-emerald-200" : "bg-slate-50 text-slate-700 dark:bg-slate-900/40 dark:text-slate-200"),
|
|
1241
1241
|
children: n
|
|
1242
1242
|
})] });
|
|
1243
1243
|
}
|
|
1244
1244
|
function fn({ block: e }) {
|
|
1245
|
-
return e.content ? /* @__PURE__ */
|
|
1245
|
+
return e.content ? /* @__PURE__ */ R("div", {
|
|
1246
1246
|
className: "w-full break-words py-0.5 text-[14px] leading-[1.65]",
|
|
1247
|
-
children: /* @__PURE__ */
|
|
1247
|
+
children: /* @__PURE__ */ R(Z, { content: e.content })
|
|
1248
1248
|
}) : null;
|
|
1249
1249
|
}
|
|
1250
1250
|
function pn({ message: e, isStreaming: t, onRespondToApproval: n, onRespondToAguiApproval: r }) {
|
|
1251
|
-
return /* @__PURE__ */
|
|
1251
|
+
return /* @__PURE__ */ R("div", {
|
|
1252
1252
|
className: "mb-3 min-w-0",
|
|
1253
|
-
children: (e.blocks ?? []).map((i) => i.type === "thinking" ? /* @__PURE__ */
|
|
1253
|
+
children: (e.blocks ?? []).map((i) => i.type === "thinking" ? /* @__PURE__ */ R(an, { block: i }, i.id) : i.type === "tool" ? /* @__PURE__ */ R(on, {
|
|
1254
1254
|
block: i,
|
|
1255
1255
|
tool: e.tools?.[i.toolName],
|
|
1256
1256
|
isStreaming: t,
|
|
1257
1257
|
onRespondToApproval: n,
|
|
1258
1258
|
onRespondToAguiApproval: r
|
|
1259
|
-
}, i.id) : /* @__PURE__ */
|
|
1259
|
+
}, i.id) : /* @__PURE__ */ R(fn, { block: i }, i.id))
|
|
1260
1260
|
});
|
|
1261
1261
|
}
|
|
1262
1262
|
//#endregion
|
|
1263
|
+
//#region src/core/stream/runtime-items.ts
|
|
1264
|
+
function mn(e, t) {
|
|
1265
|
+
return `${e}${t}`;
|
|
1266
|
+
}
|
|
1267
|
+
function hn(e) {
|
|
1268
|
+
return { ...e };
|
|
1269
|
+
}
|
|
1270
|
+
var gn = class {
|
|
1271
|
+
runId = null;
|
|
1272
|
+
status = null;
|
|
1273
|
+
items = /* @__PURE__ */ new Map();
|
|
1274
|
+
seenEventIds = /* @__PURE__ */ new Set();
|
|
1275
|
+
apply(e) {
|
|
1276
|
+
if (e.eventId) {
|
|
1277
|
+
if (this.seenEventIds.has(e.eventId)) return;
|
|
1278
|
+
this.seenEventIds.add(e.eventId);
|
|
1279
|
+
}
|
|
1280
|
+
switch (e.type) {
|
|
1281
|
+
case "run_started":
|
|
1282
|
+
this.runId = e.runId, this.status = "running";
|
|
1283
|
+
return;
|
|
1284
|
+
case "run_interrupted":
|
|
1285
|
+
this.status = "interrupted";
|
|
1286
|
+
return;
|
|
1287
|
+
case "run_completed":
|
|
1288
|
+
this.status = "completed";
|
|
1289
|
+
return;
|
|
1290
|
+
case "run_failed":
|
|
1291
|
+
this.status = "failed";
|
|
1292
|
+
return;
|
|
1293
|
+
case "run_canceled":
|
|
1294
|
+
this.status = "canceled";
|
|
1295
|
+
return;
|
|
1296
|
+
case "item_started":
|
|
1297
|
+
this.startItem(e);
|
|
1298
|
+
return;
|
|
1299
|
+
case "item_updated":
|
|
1300
|
+
this.updateItem(e);
|
|
1301
|
+
return;
|
|
1302
|
+
case "item_snapshot_replaced":
|
|
1303
|
+
this.replaceSnapshot(e);
|
|
1304
|
+
return;
|
|
1305
|
+
case "item_completed":
|
|
1306
|
+
case "item_failed":
|
|
1307
|
+
this.closeItem(e);
|
|
1308
|
+
return;
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
applyAll(e) {
|
|
1312
|
+
for (let t of e) this.apply(t);
|
|
1313
|
+
}
|
|
1314
|
+
snapshot() {
|
|
1315
|
+
return {
|
|
1316
|
+
runId: this.runId,
|
|
1317
|
+
status: this.status,
|
|
1318
|
+
items: Array.from(this.items.values()).map((e) => ({
|
|
1319
|
+
...e,
|
|
1320
|
+
parts: e.parts.map(hn)
|
|
1321
|
+
}))
|
|
1322
|
+
};
|
|
1323
|
+
}
|
|
1324
|
+
ensureItem(e) {
|
|
1325
|
+
this.runId === null && (this.runId = e.runId);
|
|
1326
|
+
let t = mn(e.scopeId, e.itemId), n = this.items.get(t);
|
|
1327
|
+
return n || (n = {
|
|
1328
|
+
runId: e.runId,
|
|
1329
|
+
scopeId: e.scopeId,
|
|
1330
|
+
itemId: e.itemId,
|
|
1331
|
+
itemKind: e.itemKind || "message",
|
|
1332
|
+
status: "open",
|
|
1333
|
+
parts: []
|
|
1334
|
+
}, this.items.set(t, n)), n;
|
|
1335
|
+
}
|
|
1336
|
+
startItem(e) {
|
|
1337
|
+
let t = mn(e.scopeId, e.itemId), n = this.items.get(t);
|
|
1338
|
+
if (n) {
|
|
1339
|
+
e.phase !== void 0 && (n.phase = e.phase);
|
|
1340
|
+
return;
|
|
1341
|
+
}
|
|
1342
|
+
let r = this.ensureItem(e);
|
|
1343
|
+
r.phase = e.phase, e.initialParts && (r.parts = e.initialParts.map(hn));
|
|
1344
|
+
}
|
|
1345
|
+
updateItem(e) {
|
|
1346
|
+
let t = this.ensureItem(e), n = t.parts.findIndex((t) => t.partId === e.partId);
|
|
1347
|
+
if (n < 0) {
|
|
1348
|
+
t.parts.push(hn(e.part));
|
|
1349
|
+
return;
|
|
1350
|
+
}
|
|
1351
|
+
let r = t.parts[n];
|
|
1352
|
+
if (e.op === "replace") {
|
|
1353
|
+
t.parts[n] = hn(e.part);
|
|
1354
|
+
return;
|
|
1355
|
+
}
|
|
1356
|
+
t.parts[n] = {
|
|
1357
|
+
...r,
|
|
1358
|
+
text: `${r.text || ""}${e.part.text || ""}`
|
|
1359
|
+
};
|
|
1360
|
+
}
|
|
1361
|
+
replaceSnapshot(e) {
|
|
1362
|
+
let t = this.ensureItem(e);
|
|
1363
|
+
t.parts = e.parts.map(hn);
|
|
1364
|
+
}
|
|
1365
|
+
closeItem(e) {
|
|
1366
|
+
let t = this.ensureItem(e);
|
|
1367
|
+
e.parts && (t.parts = e.parts.map(hn)), t.status = e.type === "item_completed" ? "completed" : "failed";
|
|
1368
|
+
}
|
|
1369
|
+
};
|
|
1370
|
+
function _n(e, t) {
|
|
1371
|
+
return {
|
|
1372
|
+
partId: e,
|
|
1373
|
+
contentType: "text",
|
|
1374
|
+
text: t
|
|
1375
|
+
};
|
|
1376
|
+
}
|
|
1377
|
+
var vn = "text-0";
|
|
1378
|
+
function yn(e, t) {
|
|
1379
|
+
return String(e?.id || e?.item_id || t?.item_id || t?.output_index || "");
|
|
1380
|
+
}
|
|
1381
|
+
function bn(e) {
|
|
1382
|
+
let t = e?.content;
|
|
1383
|
+
return Array.isArray(t) ? t.map((e) => typeof e == "string" ? e : String(e?.text || "")).join("") : String(e?.output_text || e?.text || "");
|
|
1384
|
+
}
|
|
1385
|
+
function xn(e, t, n, r) {
|
|
1386
|
+
let i = String(t?.type || e || "").trim(), a = t?.id ? String(t.id) : void 0, o = t?.item || t?.output_item || {}, s = yn(o, t), c = String(o?.type || ""), l = c.includes("reasoning") ? "reasoning" : "message";
|
|
1387
|
+
if (i === "response.output_item.added") return !s || c !== "message" && !c.includes("reasoning") ? [] : [{
|
|
1388
|
+
type: "item_started",
|
|
1389
|
+
runId: n,
|
|
1390
|
+
scopeId: r,
|
|
1391
|
+
itemId: s,
|
|
1392
|
+
itemKind: l,
|
|
1393
|
+
phase: "final_answer",
|
|
1394
|
+
eventId: a
|
|
1395
|
+
}];
|
|
1396
|
+
if (i === "response.output_text.delta" || i === "response.content_part.delta") {
|
|
1397
|
+
if (!s) return [];
|
|
1398
|
+
let e = String(t?.delta || t?.text || "");
|
|
1399
|
+
return e ? [{
|
|
1400
|
+
type: "item_updated",
|
|
1401
|
+
runId: n,
|
|
1402
|
+
scopeId: r,
|
|
1403
|
+
itemId: s,
|
|
1404
|
+
itemKind: l,
|
|
1405
|
+
partId: vn,
|
|
1406
|
+
op: "append",
|
|
1407
|
+
part: _n(vn, e),
|
|
1408
|
+
eventId: a
|
|
1409
|
+
}] : [];
|
|
1410
|
+
}
|
|
1411
|
+
return i === "response.output_item.done" || i === "response.output_text.done" ? s ? [{
|
|
1412
|
+
type: "item_completed",
|
|
1413
|
+
runId: n,
|
|
1414
|
+
scopeId: r,
|
|
1415
|
+
itemId: s,
|
|
1416
|
+
itemKind: l,
|
|
1417
|
+
parts: [_n(vn, bn(o) || String(t?.text || ""))],
|
|
1418
|
+
eventId: a
|
|
1419
|
+
}] : [] : i === "response.completed" ? [{
|
|
1420
|
+
type: "run_completed",
|
|
1421
|
+
runId: n,
|
|
1422
|
+
scopeId: r,
|
|
1423
|
+
eventId: a
|
|
1424
|
+
}] : [];
|
|
1425
|
+
}
|
|
1426
|
+
//#endregion
|
|
1263
1427
|
//#region src/stores/streaming.ts
|
|
1264
|
-
var
|
|
1428
|
+
var Sn = (e) => Object.keys(e).length > 0, Cn = {
|
|
1429
|
+
runId: null,
|
|
1430
|
+
status: null,
|
|
1431
|
+
items: []
|
|
1432
|
+
}, wn = new gn(), Tn = (e, t) => {
|
|
1265
1433
|
let n = { ...e };
|
|
1266
1434
|
return delete n[t], n;
|
|
1267
|
-
},
|
|
1435
|
+
}, En = I()((e, t) => ({
|
|
1268
1436
|
isStreaming: !1,
|
|
1269
1437
|
currentRunId: "",
|
|
1270
1438
|
stopRequested: !1,
|
|
@@ -1274,6 +1442,7 @@ var mn = (e) => Object.keys(e).length > 0, hn = (e, t) => {
|
|
|
1274
1442
|
banner: null,
|
|
1275
1443
|
lastSeqId: 0,
|
|
1276
1444
|
activeInvocationId: "",
|
|
1445
|
+
runtimeItems: Cn,
|
|
1277
1446
|
setStreaming: (t) => e({ isStreaming: t }),
|
|
1278
1447
|
setBanner: (t) => e({ banner: t ? {
|
|
1279
1448
|
...t,
|
|
@@ -1284,13 +1453,13 @@ var mn = (e) => Object.keys(e).length > 0, hn = (e, t) => {
|
|
|
1284
1453
|
setSessionStreaming: (t, n) => e((e) => {
|
|
1285
1454
|
let r = String(t || "");
|
|
1286
1455
|
if (!r) return { isStreaming: n };
|
|
1287
|
-
let i =
|
|
1456
|
+
let i = Tn(e.sessionStreaming, r), a = n ? {
|
|
1288
1457
|
...i,
|
|
1289
1458
|
[r]: !0
|
|
1290
1459
|
} : i;
|
|
1291
1460
|
return {
|
|
1292
1461
|
sessionStreaming: a,
|
|
1293
|
-
isStreaming:
|
|
1462
|
+
isStreaming: Sn(a)
|
|
1294
1463
|
};
|
|
1295
1464
|
}),
|
|
1296
1465
|
isSessionStreaming: (e) => {
|
|
@@ -1335,7 +1504,7 @@ var mn = (e) => Object.keys(e).length > 0, hn = (e, t) => {
|
|
|
1335
1504
|
eventCount: t.countEvent === !1 ? 0 : 1
|
|
1336
1505
|
};
|
|
1337
1506
|
return n ? {
|
|
1338
|
-
isStreaming:
|
|
1507
|
+
isStreaming: Sn(e.sessionStreaming),
|
|
1339
1508
|
sessionActivities: {
|
|
1340
1509
|
...e.sessionActivities,
|
|
1341
1510
|
[n]: i
|
|
@@ -1368,9 +1537,9 @@ var mn = (e) => Object.keys(e).length > 0, hn = (e, t) => {
|
|
|
1368
1537
|
}, o = {
|
|
1369
1538
|
...e.sessionActivities,
|
|
1370
1539
|
[r]: a
|
|
1371
|
-
}, s =
|
|
1540
|
+
}, s = Tn(e.sessionStreaming, r);
|
|
1372
1541
|
return {
|
|
1373
|
-
isStreaming:
|
|
1542
|
+
isStreaming: Sn(s),
|
|
1374
1543
|
activity: a,
|
|
1375
1544
|
sessionActivities: o,
|
|
1376
1545
|
sessionStreaming: s
|
|
@@ -1380,72 +1549,78 @@ var mn = (e) => Object.keys(e).length > 0, hn = (e, t) => {
|
|
|
1380
1549
|
clearSessionActivity: (t) => e((e) => {
|
|
1381
1550
|
let n = String(t || "");
|
|
1382
1551
|
if (!n) return {};
|
|
1383
|
-
let { [n]: r, ...i } = e.sessionActivities, a =
|
|
1552
|
+
let { [n]: r, ...i } = e.sessionActivities, a = Tn(e.sessionStreaming, n);
|
|
1384
1553
|
return {
|
|
1385
1554
|
sessionActivities: i,
|
|
1386
1555
|
sessionStreaming: a,
|
|
1387
|
-
isStreaming:
|
|
1556
|
+
isStreaming: Sn(a),
|
|
1388
1557
|
activity: e.activity === r ? null : e.activity
|
|
1389
1558
|
};
|
|
1390
1559
|
}),
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1560
|
+
applyRuntimeItemOperations: (t) => {
|
|
1561
|
+
wn.applyAll(t), e({ runtimeItems: wn.snapshot() });
|
|
1562
|
+
},
|
|
1563
|
+
resetRun: () => {
|
|
1564
|
+
wn = new gn(), e({
|
|
1565
|
+
isStreaming: !1,
|
|
1566
|
+
currentRunId: "",
|
|
1567
|
+
stopRequested: !1,
|
|
1568
|
+
activity: null,
|
|
1569
|
+
sessionActivities: {},
|
|
1570
|
+
sessionStreaming: {},
|
|
1571
|
+
lastSeqId: 0,
|
|
1572
|
+
activeInvocationId: "",
|
|
1573
|
+
runtimeItems: Cn
|
|
1574
|
+
});
|
|
1575
|
+
}
|
|
1401
1576
|
}));
|
|
1402
1577
|
//#endregion
|
|
1403
1578
|
//#region src/components/chat/StatusBanner.tsx
|
|
1404
|
-
function
|
|
1405
|
-
let t =
|
|
1579
|
+
function Dn({ onRetry: e }) {
|
|
1580
|
+
let t = En((e) => e.banner);
|
|
1406
1581
|
if (!t) return null;
|
|
1407
|
-
let n = t.kind === "rate_limited" ? /* @__PURE__ */
|
|
1582
|
+
let n = t.kind === "rate_limited" ? /* @__PURE__ */ R(On, {
|
|
1408
1583
|
message: t.message,
|
|
1409
1584
|
retryAfterSec: t.retryAfterSec
|
|
1410
1585
|
}, t.createdAt || `${t.sessionId || ""}:${t.retryAfterSec || 0}`) : null, r = {
|
|
1411
1586
|
rate_limited: {
|
|
1412
|
-
icon: /* @__PURE__ */
|
|
1587
|
+
icon: /* @__PURE__ */ R(fe, { className: "h-4 w-4 text-amber-500" }),
|
|
1413
1588
|
bg: "border-amber-200/70 bg-amber-50/70 dark:border-amber-900/40 dark:bg-amber-950/20",
|
|
1414
1589
|
text: "text-amber-700 dark:text-amber-200",
|
|
1415
1590
|
label: n
|
|
1416
1591
|
},
|
|
1417
1592
|
network: {
|
|
1418
|
-
icon: /* @__PURE__ */
|
|
1593
|
+
icon: /* @__PURE__ */ R(v, { className: "h-4 w-4 animate-spin text-text-secondary" }),
|
|
1419
1594
|
bg: "border-border/70 bg-muted/60",
|
|
1420
1595
|
text: "text-text-secondary",
|
|
1421
1596
|
label: t.message || "网络异常,正在重连…"
|
|
1422
1597
|
},
|
|
1423
1598
|
error: {
|
|
1424
|
-
icon: /* @__PURE__ */
|
|
1599
|
+
icon: /* @__PURE__ */ R(le, { className: "h-4 w-4 text-rose-500" }),
|
|
1425
1600
|
bg: "border-rose-200/70 bg-rose-50/70 dark:border-rose-900/40 dark:bg-rose-950/20",
|
|
1426
1601
|
text: "text-rose-600 dark:text-rose-300",
|
|
1427
1602
|
label: t.message || "运行失败,请重试"
|
|
1428
1603
|
}
|
|
1429
1604
|
}[t.kind];
|
|
1430
|
-
return /* @__PURE__ */
|
|
1605
|
+
return /* @__PURE__ */ z("div", {
|
|
1431
1606
|
className: Y("mx-auto mb-3 flex w-full max-w-3xl items-center gap-2.5 rounded-xl border px-3.5 py-2.5 text-sm shadow-sm", r.bg, r.text),
|
|
1432
1607
|
role: "status",
|
|
1433
1608
|
children: [
|
|
1434
1609
|
r.icon,
|
|
1435
|
-
/* @__PURE__ */
|
|
1610
|
+
/* @__PURE__ */ R("span", {
|
|
1436
1611
|
className: "min-w-0 flex-1 truncate",
|
|
1437
1612
|
children: r.label
|
|
1438
1613
|
}),
|
|
1439
|
-
t.kind === "error" && e ? /* @__PURE__ */
|
|
1614
|
+
t.kind === "error" && e ? /* @__PURE__ */ z("button", {
|
|
1440
1615
|
type: "button",
|
|
1441
1616
|
onClick: e,
|
|
1442
1617
|
className: "flex items-center gap-1 rounded-full px-2.5 py-1 text-xs font-medium text-rose-600 transition hover:bg-rose-100 dark:text-rose-300 dark:hover:bg-rose-950/40",
|
|
1443
|
-
children: [/* @__PURE__ */
|
|
1618
|
+
children: [/* @__PURE__ */ R(ne, { className: "h-3 w-3" }), "重试"]
|
|
1444
1619
|
}) : null
|
|
1445
1620
|
]
|
|
1446
1621
|
});
|
|
1447
1622
|
}
|
|
1448
|
-
function
|
|
1623
|
+
function On({ message: e, retryAfterSec: t }) {
|
|
1449
1624
|
let [n, r] = q(t || 0);
|
|
1450
1625
|
return W(() => {
|
|
1451
1626
|
if (!t) return;
|
|
@@ -1460,13 +1635,13 @@ function vn({ message: e, retryAfterSec: t }) {
|
|
|
1460
1635
|
function Q(e) {
|
|
1461
1636
|
return String(e || "").trim();
|
|
1462
1637
|
}
|
|
1463
|
-
function
|
|
1638
|
+
function kn(e) {
|
|
1464
1639
|
let t = Q(e).toLowerCase();
|
|
1465
1640
|
return t === "up" || t === "down" ? t : "";
|
|
1466
1641
|
}
|
|
1467
|
-
function
|
|
1642
|
+
function An(e) {
|
|
1468
1643
|
if (!e || typeof e != "object") return null;
|
|
1469
|
-
let t =
|
|
1644
|
+
let t = kn(e.Rating || e.rating);
|
|
1470
1645
|
return t ? {
|
|
1471
1646
|
agentId: Q(e.AgentId || e.agentId),
|
|
1472
1647
|
sessionId: Q(e.SessionId || e.sessionId),
|
|
@@ -1479,10 +1654,10 @@ function bn(e) {
|
|
|
1479
1654
|
updatedAt: Q(e.UpdatedAt || e.updatedAt)
|
|
1480
1655
|
} : null;
|
|
1481
1656
|
}
|
|
1482
|
-
function
|
|
1483
|
-
return !!(e?.role === "model" && Q(e.responseId) &&
|
|
1657
|
+
function jn(e, t, n) {
|
|
1658
|
+
return !!(e?.role === "model" && Q(e.responseId) && !(t && n));
|
|
1484
1659
|
}
|
|
1485
|
-
function
|
|
1660
|
+
function Mn({ agentId: e, sessionId: t, message: n }) {
|
|
1486
1661
|
let r = Q(n?.responseId);
|
|
1487
1662
|
if (!r) throw Error("Message missing response id");
|
|
1488
1663
|
return {
|
|
@@ -1491,26 +1666,23 @@ function Sn({ agentId: e, sessionId: t, message: n }) {
|
|
|
1491
1666
|
ResponseId: r
|
|
1492
1667
|
};
|
|
1493
1668
|
}
|
|
1494
|
-
function
|
|
1495
|
-
let a =
|
|
1669
|
+
function Nn({ agentId: e, sessionId: t, message: n, rating: r, comment: i = "" }) {
|
|
1670
|
+
let a = kn(r);
|
|
1496
1671
|
if (!a) throw Error("Feedback rating must be up or down");
|
|
1497
|
-
|
|
1498
|
-
...
|
|
1672
|
+
return {
|
|
1673
|
+
...Mn({
|
|
1499
1674
|
agentId: e,
|
|
1500
1675
|
sessionId: t,
|
|
1501
1676
|
message: n
|
|
1502
1677
|
}),
|
|
1503
|
-
EventId: Q(n?.eventId),
|
|
1504
1678
|
Rating: a,
|
|
1505
1679
|
Comment: String(i || ""),
|
|
1506
1680
|
TraceId: Q(n?.traceId),
|
|
1507
1681
|
RootSpanId: Q(n?.rootSpanId)
|
|
1508
1682
|
};
|
|
1509
|
-
if (!o.EventId) throw Error("Message missing event id");
|
|
1510
|
-
return o;
|
|
1511
1683
|
}
|
|
1512
|
-
function
|
|
1513
|
-
let i = e.find((e) => e.id === t), a = i?.feedback ? { ...i.feedback } : null, o =
|
|
1684
|
+
function Pn(e, { messageId: t, rating: n, comment: r = "" }) {
|
|
1685
|
+
let i = e.find((e) => e.id === t), a = i?.feedback ? { ...i.feedback } : null, o = kn(n);
|
|
1514
1686
|
return {
|
|
1515
1687
|
nextMessages: e.map((e) => e.id === t ? {
|
|
1516
1688
|
...e,
|
|
@@ -1527,8 +1699,8 @@ function wn(e, { messageId: t, rating: n, comment: r = "" }) {
|
|
|
1527
1699
|
previousFeedback: a
|
|
1528
1700
|
};
|
|
1529
1701
|
}
|
|
1530
|
-
function
|
|
1531
|
-
let r =
|
|
1702
|
+
function Fn(e, { messageId: t, feedback: n }) {
|
|
1703
|
+
let r = An(n) || n;
|
|
1532
1704
|
return e.map((e) => e.id === t ? {
|
|
1533
1705
|
...e,
|
|
1534
1706
|
feedback: r ? {
|
|
@@ -1538,7 +1710,7 @@ function Tn(e, { messageId: t, feedback: n }) {
|
|
|
1538
1710
|
} : void 0
|
|
1539
1711
|
} : e);
|
|
1540
1712
|
}
|
|
1541
|
-
function
|
|
1713
|
+
function In(e, { messageId: t, previousFeedback: n }) {
|
|
1542
1714
|
return e.map((e) => {
|
|
1543
1715
|
if (e.id !== t) return e;
|
|
1544
1716
|
if (!n) {
|
|
@@ -1551,7 +1723,7 @@ function En(e, { messageId: t, previousFeedback: n }) {
|
|
|
1551
1723
|
};
|
|
1552
1724
|
});
|
|
1553
1725
|
}
|
|
1554
|
-
function
|
|
1726
|
+
function Ln(e, { messageId: t }) {
|
|
1555
1727
|
return e.map((e) => {
|
|
1556
1728
|
if (e.id !== t) return e;
|
|
1557
1729
|
let { feedback: n, ...r } = e;
|
|
@@ -1560,10 +1732,10 @@ function Dn(e, { messageId: t }) {
|
|
|
1560
1732
|
}
|
|
1561
1733
|
//#endregion
|
|
1562
1734
|
//#region src/utils/tool-display.js
|
|
1563
|
-
function
|
|
1735
|
+
function Rn(e) {
|
|
1564
1736
|
return String(e || "").replace(/\\u([0-9a-fA-F]{4})/g, (e, t) => String.fromCharCode(Number.parseInt(t, 16)));
|
|
1565
1737
|
}
|
|
1566
|
-
function
|
|
1738
|
+
function zn(e) {
|
|
1567
1739
|
let t = String(e || "").trim();
|
|
1568
1740
|
for (let e = 0; e < 3; e += 1) {
|
|
1569
1741
|
if (!t) return t;
|
|
@@ -1571,59 +1743,59 @@ function kn(e) {
|
|
|
1571
1743
|
if (!(e === "{" && n === "}" || e === "[" && n === "]" || e === "\"" && n === "\"")) return t.replace(/\\n/g, "\n").replace(/\\"/g, "\"");
|
|
1572
1744
|
try {
|
|
1573
1745
|
let e = JSON.parse(t);
|
|
1574
|
-
if (typeof e != "string") return
|
|
1746
|
+
if (typeof e != "string") return Bn(e);
|
|
1575
1747
|
t = e.trim();
|
|
1576
1748
|
} catch {
|
|
1577
|
-
return
|
|
1749
|
+
return Rn(t).replace(/\\n/g, "\n").replace(/\\"/g, "\"");
|
|
1578
1750
|
}
|
|
1579
1751
|
}
|
|
1580
1752
|
return t;
|
|
1581
1753
|
}
|
|
1582
|
-
function
|
|
1583
|
-
return typeof e == "string" ?
|
|
1754
|
+
function Bn(e) {
|
|
1755
|
+
return typeof e == "string" ? zn(e) : Array.isArray(e) ? e.map((e) => Bn(e)) : !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, Bn(t)]));
|
|
1584
1756
|
}
|
|
1585
|
-
function
|
|
1586
|
-
return typeof e == "string" ?
|
|
1757
|
+
function Vn(e) {
|
|
1758
|
+
return typeof e == "string" ? zn(e) : Bn(e);
|
|
1587
1759
|
}
|
|
1588
|
-
function
|
|
1760
|
+
function Hn(e) {
|
|
1589
1761
|
return e === !1 ? !0 : typeof e == "string" ? e.trim().toLowerCase() === "false" : !1;
|
|
1590
1762
|
}
|
|
1591
|
-
function
|
|
1763
|
+
function Un(e) {
|
|
1592
1764
|
return e === !0 ? !0 : typeof e == "string" ? e.trim().toLowerCase() === "true" : !1;
|
|
1593
1765
|
}
|
|
1594
|
-
function
|
|
1766
|
+
function Wn(e) {
|
|
1595
1767
|
return e == null || e === !1 ? !1 : typeof e == "string" ? e.trim().length > 0 : typeof e == "object" ? Object.keys(e).length > 0 : !0;
|
|
1596
1768
|
}
|
|
1597
|
-
function
|
|
1769
|
+
function Gn(e) {
|
|
1598
1770
|
return String(e?.status || "").trim().toLowerCase() === "accepted_not_extracted";
|
|
1599
1771
|
}
|
|
1600
|
-
function
|
|
1772
|
+
function Kn(e, t = 0) {
|
|
1601
1773
|
if (!e || t > 4) return !1;
|
|
1602
1774
|
if (typeof e == "string") {
|
|
1603
|
-
let n =
|
|
1604
|
-
return n !== e &&
|
|
1775
|
+
let n = zn(e);
|
|
1776
|
+
return n !== e && Kn(n, t + 1);
|
|
1605
1777
|
}
|
|
1606
|
-
if (Array.isArray(e)) return e.some((e) =>
|
|
1607
|
-
if (typeof e != "object" ||
|
|
1608
|
-
if (
|
|
1609
|
-
let n =
|
|
1778
|
+
if (Array.isArray(e)) return e.some((e) => Kn(e, t + 1));
|
|
1779
|
+
if (typeof e != "object" || Gn(e)) return !1;
|
|
1780
|
+
if (Hn(e.ok) || Hn(e.success)) return !0;
|
|
1781
|
+
let n = Un(e.ok) || Un(e.success), r = String(e.status || "").trim().toLowerCase();
|
|
1610
1782
|
return !n && [
|
|
1611
1783
|
"error",
|
|
1612
1784
|
"failed",
|
|
1613
1785
|
"failure"
|
|
1614
|
-
].includes(r) || !n && (
|
|
1786
|
+
].includes(r) || !n && (Wn(e.error_type) || Wn(e.error_message) || Wn(e.error)) ? !0 : Object.values(e).some((e) => Kn(e, t + 1));
|
|
1615
1787
|
}
|
|
1616
|
-
function
|
|
1617
|
-
return e == null || e === "" ? !1 :
|
|
1788
|
+
function qn(e) {
|
|
1789
|
+
return e == null || e === "" ? !1 : Kn(Vn(e));
|
|
1618
1790
|
}
|
|
1619
|
-
function
|
|
1791
|
+
function Jn(e) {
|
|
1620
1792
|
if (e == null || e === "") return "";
|
|
1621
|
-
let t =
|
|
1793
|
+
let t = Vn(e);
|
|
1622
1794
|
return typeof t == "string" ? t : JSON.stringify(t, null, 2);
|
|
1623
1795
|
}
|
|
1624
1796
|
//#endregion
|
|
1625
1797
|
//#region src/utils/clipboard.js
|
|
1626
|
-
async function
|
|
1798
|
+
async function Yn(e, t = globalThis) {
|
|
1627
1799
|
let n = String(e ?? ""), r = t?.navigator;
|
|
1628
1800
|
if (r?.clipboard?.writeText) try {
|
|
1629
1801
|
return await r.clipboard.writeText(n), !0;
|
|
@@ -1642,15 +1814,15 @@ async function zn(e, t = globalThis) {
|
|
|
1642
1814
|
}
|
|
1643
1815
|
//#endregion
|
|
1644
1816
|
//#region src/utils/session-helpers.ts
|
|
1645
|
-
function
|
|
1817
|
+
function Xn(e) {
|
|
1646
1818
|
return String(e.Title || "").trim() || String(e.FirstPrompt || "").trim() || String(e.LastPrompt || "").trim() || String(e.Summary || "").trim() || "新对话";
|
|
1647
1819
|
}
|
|
1648
1820
|
//#endregion
|
|
1649
1821
|
//#region src/utils/message-virtualization.js
|
|
1650
|
-
function
|
|
1822
|
+
function Zn(e, t, n) {
|
|
1651
1823
|
return Math.max(t, Math.min(n, e));
|
|
1652
1824
|
}
|
|
1653
|
-
function
|
|
1825
|
+
function Qn({ items: e = [], scrollTop: t = 0, viewportHeight: n = 0, overscan: r = 4, defaultItemHeight: i = 120, measuredHeights: a = /* @__PURE__ */ new Map(), getItemKey: o = (e, t) => e?.id || String(t) } = {}) {
|
|
1654
1826
|
let s = Math.max(0, Number(n) || 0), c = Math.max(0, Number(t) || 0), l = Math.max(0, Number(r) || 0), u = Math.max(1, Number(i) || 120);
|
|
1655
1827
|
if (!e.length) return {
|
|
1656
1828
|
startIndex: 0,
|
|
@@ -1668,7 +1840,7 @@ function Hn({ items: e = [], scrollTop: t = 0, viewportHeight: n = 0, overscan:
|
|
|
1668
1840
|
for (; g < e.length && f[g] + d[g] <= c;) g += 1;
|
|
1669
1841
|
let _ = g;
|
|
1670
1842
|
for (; _ < e.length && f[_] < h;) _ += 1;
|
|
1671
|
-
return g =
|
|
1843
|
+
return g = Zn(g - l, 0, e.length), _ = Zn(Math.max(g + 1, _ + l), 0, e.length), {
|
|
1672
1844
|
startIndex: g,
|
|
1673
1845
|
endIndex: _,
|
|
1674
1846
|
offsetTop: f[g] || 0,
|
|
@@ -1686,11 +1858,11 @@ function Hn({ items: e = [], scrollTop: t = 0, viewportHeight: n = 0, overscan:
|
|
|
1686
1858
|
}
|
|
1687
1859
|
//#endregion
|
|
1688
1860
|
//#region src/core/run/a2ui.ts
|
|
1689
|
-
var
|
|
1861
|
+
var $n = Te, er = {
|
|
1690
1862
|
description: we,
|
|
1691
|
-
value: Ee(
|
|
1863
|
+
value: Ee($n)
|
|
1692
1864
|
};
|
|
1693
|
-
function
|
|
1865
|
+
function tr(e) {
|
|
1694
1866
|
return e.map((e) => {
|
|
1695
1867
|
let t = e.updateComponents;
|
|
1696
1868
|
if (!t || typeof t != "object" || Array.isArray(t)) return e;
|
|
@@ -1715,30 +1887,30 @@ function Gn(e) {
|
|
|
1715
1887
|
}
|
|
1716
1888
|
//#endregion
|
|
1717
1889
|
//#region src/components/chat/A2UIActivityMessage.tsx
|
|
1718
|
-
function
|
|
1890
|
+
function nr({ surfaceId: e, messages: t }) {
|
|
1719
1891
|
let { processMessages: n } = De();
|
|
1720
1892
|
return W(() => {
|
|
1721
1893
|
n(t);
|
|
1722
|
-
}, [t, n]), /* @__PURE__ */
|
|
1894
|
+
}, [t, n]), /* @__PURE__ */ R(Ce, {
|
|
1723
1895
|
surfaceId: e,
|
|
1724
1896
|
className: "w-full",
|
|
1725
|
-
fallback: /* @__PURE__ */
|
|
1897
|
+
fallback: /* @__PURE__ */ R("div", {
|
|
1726
1898
|
className: "text-sm text-slate-500 dark:text-slate-400",
|
|
1727
1899
|
children: "界面内容暂不可用"
|
|
1728
1900
|
}),
|
|
1729
|
-
loadingFallback: /* @__PURE__ */
|
|
1901
|
+
loadingFallback: /* @__PURE__ */ R("div", {
|
|
1730
1902
|
className: "text-sm text-slate-500 dark:text-slate-400",
|
|
1731
1903
|
children: "正在加载界面"
|
|
1732
1904
|
})
|
|
1733
1905
|
});
|
|
1734
1906
|
}
|
|
1735
|
-
function
|
|
1736
|
-
return /* @__PURE__ */
|
|
1907
|
+
function rr({ surfaceId: e, messages: t, onAction: n }) {
|
|
1908
|
+
return /* @__PURE__ */ R("div", {
|
|
1737
1909
|
className: "mb-3 w-full overflow-hidden rounded-lg border border-slate-200 bg-white p-3 shadow-sm dark:border-slate-700 dark:bg-slate-900",
|
|
1738
|
-
children: /* @__PURE__ */
|
|
1739
|
-
catalog:
|
|
1910
|
+
children: /* @__PURE__ */ R(Se, {
|
|
1911
|
+
catalog: $n,
|
|
1740
1912
|
onAction: n,
|
|
1741
|
-
children: /* @__PURE__ */
|
|
1913
|
+
children: /* @__PURE__ */ R(nr, {
|
|
1742
1914
|
surfaceId: e,
|
|
1743
1915
|
messages: t
|
|
1744
1916
|
})
|
|
@@ -1747,15 +1919,15 @@ function qn({ surfaceId: e, messages: t, onAction: n }) {
|
|
|
1747
1919
|
}
|
|
1748
1920
|
//#endregion
|
|
1749
1921
|
//#region src/components/chat/ChatMessageList.tsx
|
|
1750
|
-
var
|
|
1751
|
-
function
|
|
1922
|
+
var ir = 140, ar = 4;
|
|
1923
|
+
function or(e) {
|
|
1752
1924
|
let t = String(e || "").trim().toLowerCase();
|
|
1753
1925
|
return t === "elevated" ? "高风险" : t === "always" ? "始终确认" : t === "confirm" ? "需确认" : e || "";
|
|
1754
1926
|
}
|
|
1755
|
-
function
|
|
1927
|
+
function sr(e) {
|
|
1756
1928
|
return String(e || "").trim().toLowerCase() === "elevated" ? "border-rose-200 bg-rose-50 text-rose-700 dark:border-rose-900/70 dark:bg-rose-950/30 dark:text-rose-200" : "border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/70 dark:bg-amber-950/30 dark:text-amber-200";
|
|
1757
1929
|
}
|
|
1758
|
-
function
|
|
1930
|
+
function cr({ messageId: e, top: t, onMeasure: n, children: r }) {
|
|
1759
1931
|
let i = K(null);
|
|
1760
1932
|
return G(() => {
|
|
1761
1933
|
let r = i.current;
|
|
@@ -1768,7 +1940,7 @@ function Qn({ messageId: e, top: t, onMeasure: n, children: r }) {
|
|
|
1768
1940
|
e,
|
|
1769
1941
|
n,
|
|
1770
1942
|
t
|
|
1771
|
-
]), /* @__PURE__ */
|
|
1943
|
+
]), /* @__PURE__ */ R("div", {
|
|
1772
1944
|
ref: i,
|
|
1773
1945
|
style: {
|
|
1774
1946
|
position: "absolute",
|
|
@@ -1779,92 +1951,92 @@ function Qn({ messageId: e, top: t, onMeasure: n, children: r }) {
|
|
|
1779
1951
|
children: r
|
|
1780
1952
|
});
|
|
1781
1953
|
}
|
|
1782
|
-
function
|
|
1954
|
+
function lr(e) {
|
|
1783
1955
|
let t = Math.max(0, Math.floor(e / 1e3)), n = Math.floor(t / 60), r = t % 60;
|
|
1784
1956
|
return n <= 0 ? `${r}s` : `${n}m ${String(r).padStart(2, "0")}s`;
|
|
1785
1957
|
}
|
|
1786
|
-
function
|
|
1958
|
+
function ur(e) {
|
|
1787
1959
|
return e < 1e3 ? "刚刚" : e < 6e4 ? `${Math.floor(e / 1e3)} 秒前` : `${Math.floor(e / 6e4)} 分钟前`;
|
|
1788
1960
|
}
|
|
1789
|
-
function
|
|
1961
|
+
function dr(e) {
|
|
1790
1962
|
return !Number.isFinite(e) || !e || e <= 0 ? "" : e >= 1e6 ? `${(e / 1e6).toFixed(e >= 1e7 ? 0 : 1)}M` : e >= 1e3 ? `${(e / 1e3).toFixed(e >= 1e5 ? 0 : 1)}K` : String(Math.round(e));
|
|
1791
1963
|
}
|
|
1792
|
-
function
|
|
1793
|
-
let t = e?.usedTokens, n = e?.contextWindowTokens, r =
|
|
1964
|
+
function fr({ contextIndicator: e }) {
|
|
1965
|
+
let t = e?.usedTokens, n = e?.contextWindowTokens, r = dr(t), i = dr(n);
|
|
1794
1966
|
if (!r) return null;
|
|
1795
1967
|
let a = [r, i].filter(Boolean).join("/");
|
|
1796
|
-
return /* @__PURE__ */
|
|
1968
|
+
return /* @__PURE__ */ z("span", {
|
|
1797
1969
|
className: "token-count-pulse hidden text-slate-400 dark:text-slate-500 sm:inline",
|
|
1798
1970
|
title: e?.label || `估算 token ${a}`,
|
|
1799
1971
|
children: ["估算 token ", a]
|
|
1800
1972
|
}, r);
|
|
1801
1973
|
}
|
|
1802
|
-
function
|
|
1974
|
+
function pr({ activity: e, contextIndicator: t, onStopGeneration: n, onCancelRemote: i }) {
|
|
1803
1975
|
let [a, o] = q(() => Date.now());
|
|
1804
1976
|
W(() => {
|
|
1805
1977
|
let e = window.setInterval(() => o(Date.now()), 1e3);
|
|
1806
1978
|
return () => window.clearInterval(e);
|
|
1807
1979
|
}, []);
|
|
1808
1980
|
let s = e.status === "connecting" || e.status === "running" || e.status === "waiting", c = a - e.lastEventAt < 2e4;
|
|
1809
|
-
return /* @__PURE__ */
|
|
1981
|
+
return /* @__PURE__ */ z("div", {
|
|
1810
1982
|
className: "inline-flex max-w-full items-center gap-2 rounded-full border border-slate-200/70 bg-white/90 px-2.5 py-1 text-[11px] leading-4 text-slate-500 shadow-sm shadow-slate-900/5 backdrop-blur dark:border-slate-700/60 dark:bg-slate-900/90 dark:text-slate-400",
|
|
1811
1983
|
children: [
|
|
1812
|
-
e.status === "failed" ? /* @__PURE__ */
|
|
1813
|
-
/* @__PURE__ */
|
|
1984
|
+
e.status === "failed" ? /* @__PURE__ */ R(j, { className: "h-3 w-3 text-rose-500" }) : e.status === "completed" ? /* @__PURE__ */ R(r, { className: "h-3 w-3 text-emerald-500" }) : e.status === "stopped" ? /* @__PURE__ */ R(k, { className: "h-3 w-3 text-amber-500" }) : /* @__PURE__ */ R(O, { className: "h-3 w-3 animate-spin text-slate-400" }),
|
|
1985
|
+
/* @__PURE__ */ R("span", {
|
|
1814
1986
|
className: "max-w-[16rem] truncate text-slate-600 dark:text-slate-300",
|
|
1815
1987
|
title: e.detail || e.phase,
|
|
1816
1988
|
children: e.phase
|
|
1817
1989
|
}),
|
|
1818
|
-
/* @__PURE__ */
|
|
1990
|
+
/* @__PURE__ */ z("span", { children: [
|
|
1819
1991
|
e.source === "restore" ? "恢复" : "运行",
|
|
1820
1992
|
" ",
|
|
1821
|
-
|
|
1993
|
+
lr(a - e.startedAt)
|
|
1822
1994
|
] }),
|
|
1823
|
-
s ? /* @__PURE__ */
|
|
1995
|
+
s ? /* @__PURE__ */ R("span", {
|
|
1824
1996
|
className: Y("inline-block h-1.5 w-1.5 flex-shrink-0 rounded-full", c ? "bg-emerald-400" : "bg-slate-300 dark:bg-slate-600"),
|
|
1825
1997
|
title: c ? "连接存活" : "连接超时"
|
|
1826
1998
|
}) : null,
|
|
1827
|
-
/* @__PURE__ */
|
|
1999
|
+
/* @__PURE__ */ z("span", {
|
|
1828
2000
|
className: "text-slate-400 dark:text-slate-500",
|
|
1829
2001
|
children: [e.eventCount, " ev"]
|
|
1830
2002
|
}),
|
|
1831
|
-
/* @__PURE__ */
|
|
2003
|
+
/* @__PURE__ */ R("span", {
|
|
1832
2004
|
className: "hidden text-slate-400 dark:text-slate-500 sm:inline",
|
|
1833
|
-
children:
|
|
2005
|
+
children: ur(a - e.lastEventAt)
|
|
1834
2006
|
}),
|
|
1835
|
-
/* @__PURE__ */
|
|
1836
|
-
s && (n || i) ? /* @__PURE__ */
|
|
2007
|
+
/* @__PURE__ */ R(fr, { contextIndicator: t }),
|
|
2008
|
+
s && (n || i) ? /* @__PURE__ */ z("div", {
|
|
1837
2009
|
className: "flex flex-shrink-0 gap-1",
|
|
1838
|
-
children: [n ? /* @__PURE__ */
|
|
2010
|
+
children: [n ? /* @__PURE__ */ z("button", {
|
|
1839
2011
|
type: "button",
|
|
1840
2012
|
onClick: n,
|
|
1841
2013
|
className: "flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[11px] text-slate-400 transition hover:bg-slate-100 hover:text-slate-700 dark:text-slate-500 dark:hover:bg-slate-800 dark:hover:text-slate-200",
|
|
1842
|
-
children: [/* @__PURE__ */
|
|
1843
|
-
}) : null, i ? /* @__PURE__ */
|
|
2014
|
+
children: [/* @__PURE__ */ R(j, { className: "h-3 w-3" }), "停止"]
|
|
2015
|
+
}) : null, i ? /* @__PURE__ */ z("button", {
|
|
1844
2016
|
type: "button",
|
|
1845
2017
|
"aria-label": "取消运行并保留恢复点",
|
|
1846
2018
|
title: "取消运行并保留最近 checkpoint",
|
|
1847
2019
|
onClick: i,
|
|
1848
2020
|
className: "flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[11px] text-slate-400 transition hover:bg-rose-50 hover:text-rose-600 dark:text-slate-500 dark:hover:bg-rose-950/30 dark:hover:text-rose-300",
|
|
1849
|
-
children: [/* @__PURE__ */
|
|
2021
|
+
children: [/* @__PURE__ */ R(F, { className: "h-3 w-3" }), "取消"]
|
|
1850
2022
|
}) : null]
|
|
1851
2023
|
}) : null
|
|
1852
2024
|
]
|
|
1853
2025
|
});
|
|
1854
2026
|
}
|
|
1855
|
-
function
|
|
1856
|
-
return /* @__PURE__ */
|
|
2027
|
+
function mr({ agentName: e }) {
|
|
2028
|
+
return /* @__PURE__ */ z("div", {
|
|
1857
2029
|
className: "flex flex-col items-center justify-center min-h-[50vh] px-4",
|
|
1858
2030
|
children: [
|
|
1859
|
-
/* @__PURE__ */
|
|
2031
|
+
/* @__PURE__ */ R("div", {
|
|
1860
2032
|
className: "mb-6 h-16 w-16 rounded-2xl bg-gradient-to-br from-blue-500 to-indigo-600\n flex items-center justify-center shadow-lg shadow-blue-500/20",
|
|
1861
|
-
children: /* @__PURE__ */
|
|
2033
|
+
children: /* @__PURE__ */ R(n, { className: "h-8 w-8 text-white" })
|
|
1862
2034
|
}),
|
|
1863
|
-
/* @__PURE__ */
|
|
2035
|
+
/* @__PURE__ */ R("h2", {
|
|
1864
2036
|
className: "text-xl font-semibold text-slate-900 dark:text-slate-50",
|
|
1865
2037
|
children: "有什么我可以帮您的吗?"
|
|
1866
2038
|
}),
|
|
1867
|
-
/* @__PURE__ */
|
|
2039
|
+
/* @__PURE__ */ z("p", {
|
|
1868
2040
|
className: "mt-2 text-sm text-slate-500",
|
|
1869
2041
|
children: [
|
|
1870
2042
|
"我是 ",
|
|
@@ -1875,43 +2047,43 @@ function ir({ agentName: e }) {
|
|
|
1875
2047
|
]
|
|
1876
2048
|
});
|
|
1877
2049
|
}
|
|
1878
|
-
function
|
|
1879
|
-
return /* @__PURE__ */
|
|
2050
|
+
function hr() {
|
|
2051
|
+
return /* @__PURE__ */ z("div", {
|
|
1880
2052
|
className: "mx-auto flex w-full max-w-[44rem] flex-col gap-5 px-2 py-8",
|
|
1881
2053
|
"aria-label": "正在加载会话历史",
|
|
1882
2054
|
children: [
|
|
1883
|
-
/* @__PURE__ */
|
|
1884
|
-
/* @__PURE__ */
|
|
1885
|
-
/* @__PURE__ */
|
|
1886
|
-
/* @__PURE__ */
|
|
2055
|
+
/* @__PURE__ */ R("div", { className: "h-4 w-28 animate-pulse rounded bg-slate-200/80 dark:bg-slate-800" }),
|
|
2056
|
+
/* @__PURE__ */ R("div", { className: "h-20 w-4/5 animate-pulse rounded-lg bg-slate-100 dark:bg-slate-900" }),
|
|
2057
|
+
/* @__PURE__ */ R("div", { className: "ml-auto h-12 w-3/5 animate-pulse rounded-lg bg-slate-100 dark:bg-slate-900" }),
|
|
2058
|
+
/* @__PURE__ */ R("div", { className: "h-16 w-11/12 animate-pulse rounded-lg bg-slate-100 dark:bg-slate-900" })
|
|
1887
2059
|
]
|
|
1888
2060
|
});
|
|
1889
2061
|
}
|
|
1890
|
-
function
|
|
1891
|
-
return /* @__PURE__ */
|
|
2062
|
+
function gr({ attachments: e, isMobile: t, onOpenAttachmentPreview: n }) {
|
|
2063
|
+
return /* @__PURE__ */ R("div", {
|
|
1892
2064
|
className: "mb-3 flex flex-wrap gap-3",
|
|
1893
|
-
children: e.map((e, r) => e.type.startsWith("image/") ? e.url ? /* @__PURE__ */
|
|
2065
|
+
children: e.map((e, r) => e.type.startsWith("image/") ? e.url ? /* @__PURE__ */ R("button", {
|
|
1894
2066
|
type: "button",
|
|
1895
2067
|
onClick: () => n(e),
|
|
1896
2068
|
className: Y("group relative overflow-hidden rounded-xl border border-slate-200 shadow-sm dark:border-slate-700", t ? "w-full max-w-full" : "max-w-[200px]"),
|
|
1897
|
-
children: /* @__PURE__ */
|
|
2069
|
+
children: /* @__PURE__ */ R("img", {
|
|
1898
2070
|
src: e.url,
|
|
1899
2071
|
alt: e.name,
|
|
1900
2072
|
className: Y("object-cover transition group-hover:scale-[1.02]", t ? "max-h-[16rem] w-full max-w-full" : "max-h-[200px] max-w-[200px]")
|
|
1901
2073
|
})
|
|
1902
|
-
}, `${e.name}-${r}`) : /* @__PURE__ */
|
|
2074
|
+
}, `${e.name}-${r}`) : /* @__PURE__ */ R("div", {
|
|
1903
2075
|
className: Y("flex items-center justify-center rounded-xl border border-dashed border-slate-300 bg-slate-50 px-4 text-sm text-slate-500 dark:border-slate-700 dark:bg-slate-900/40 dark:text-slate-400", t ? "h-28 w-full" : "h-[120px] w-[200px]"),
|
|
1904
2076
|
children: e.name
|
|
1905
|
-
}, `${e.name}-${r}`) : /* @__PURE__ */
|
|
2077
|
+
}, `${e.name}-${r}`) : /* @__PURE__ */ z("div", {
|
|
1906
2078
|
className: Y("flex items-center gap-2 rounded-xl border border-slate-200 bg-slate-100 px-3 py-2 shadow-sm dark:border-slate-700 dark:bg-slate-800", t ? "w-full max-w-full" : "w-max max-w-full"),
|
|
1907
|
-
children: [/* @__PURE__ */
|
|
2079
|
+
children: [/* @__PURE__ */ R(E, { className: "h-4 w-4 flex-shrink-0 text-blue-500" }), e.url ? /* @__PURE__ */ R("a", {
|
|
1908
2080
|
href: e.url,
|
|
1909
2081
|
target: "_blank",
|
|
1910
2082
|
rel: "noreferrer",
|
|
1911
2083
|
className: "truncate text-sm text-slate-700 hover:underline dark:text-slate-300",
|
|
1912
2084
|
title: e.name,
|
|
1913
2085
|
children: e.name
|
|
1914
|
-
}) : /* @__PURE__ */
|
|
2086
|
+
}) : /* @__PURE__ */ R("span", {
|
|
1915
2087
|
className: "truncate text-sm text-slate-700 dark:text-slate-300",
|
|
1916
2088
|
title: e.name,
|
|
1917
2089
|
children: e.name
|
|
@@ -1919,91 +2091,91 @@ function or({ attachments: e, isMobile: t, onOpenAttachmentPreview: n }) {
|
|
|
1919
2091
|
}, `${e.name}-${r}`))
|
|
1920
2092
|
});
|
|
1921
2093
|
}
|
|
1922
|
-
function
|
|
1923
|
-
return /* @__PURE__ */
|
|
2094
|
+
function _r({ message: e }) {
|
|
2095
|
+
return /* @__PURE__ */ R("div", {
|
|
1924
2096
|
className: "w-full px-0 py-2 sm:px-4",
|
|
1925
|
-
children: /* @__PURE__ */
|
|
2097
|
+
children: /* @__PURE__ */ z("div", {
|
|
1926
2098
|
className: "mx-auto max-w-3xl rounded-2xl border border-amber-200/80 bg-amber-50/80 px-4 py-3 text-sm text-amber-900 shadow-sm dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-100",
|
|
1927
2099
|
children: [
|
|
1928
|
-
/* @__PURE__ */
|
|
2100
|
+
/* @__PURE__ */ z("div", {
|
|
1929
2101
|
className: "flex items-center gap-2 font-medium",
|
|
1930
|
-
children: [e.status === "running" ? /* @__PURE__ */
|
|
2102
|
+
children: [e.status === "running" ? /* @__PURE__ */ R(O, { className: "h-4 w-4 animate-spin text-amber-600 dark:text-amber-300" }) : e.status === "failed" ? /* @__PURE__ */ R(j, { className: "h-4 w-4 text-rose-600 dark:text-rose-400" }) : /* @__PURE__ */ R(r, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" }), /* @__PURE__ */ R("span", { children: e.content })]
|
|
1931
2103
|
}),
|
|
1932
|
-
e.compactedUntilSeqId ? /* @__PURE__ */
|
|
2104
|
+
e.compactedUntilSeqId ? /* @__PURE__ */ z("div", {
|
|
1933
2105
|
className: "mt-1 text-xs text-amber-700/80 dark:text-amber-200/80",
|
|
1934
2106
|
children: ["已折叠到会话事件 #", e.compactedUntilSeqId]
|
|
1935
2107
|
}) : null,
|
|
1936
|
-
e.summary ? /* @__PURE__ */
|
|
2108
|
+
e.summary ? /* @__PURE__ */ z("details", {
|
|
1937
2109
|
className: "mt-3 rounded-xl border border-amber-200/80 bg-white/70 px-3 py-2 dark:border-amber-900/60 dark:bg-slate-950/40",
|
|
1938
|
-
children: [/* @__PURE__ */
|
|
2110
|
+
children: [/* @__PURE__ */ R("summary", {
|
|
1939
2111
|
className: "cursor-pointer select-none text-xs font-medium text-amber-800 dark:text-amber-200",
|
|
1940
2112
|
children: "查看压缩摘要"
|
|
1941
|
-
}), /* @__PURE__ */
|
|
2113
|
+
}), /* @__PURE__ */ R("div", {
|
|
1942
2114
|
className: "mt-2 text-[13px] leading-relaxed text-slate-700 dark:text-slate-200",
|
|
1943
|
-
children: /* @__PURE__ */
|
|
2115
|
+
children: /* @__PURE__ */ R(Z, { content: e.summary })
|
|
1944
2116
|
})]
|
|
1945
2117
|
}) : null
|
|
1946
2118
|
]
|
|
1947
2119
|
})
|
|
1948
2120
|
});
|
|
1949
2121
|
}
|
|
1950
|
-
function
|
|
1951
|
-
let [i, a] = q("idle"), s =
|
|
2122
|
+
function vr({ label: e, tone: t, value: n }) {
|
|
2123
|
+
let [i, a] = q("idle"), s = Jn(n);
|
|
1952
2124
|
W(() => {
|
|
1953
2125
|
if (i === "idle") return;
|
|
1954
2126
|
let e = window.setTimeout(() => a("idle"), 1600);
|
|
1955
2127
|
return () => window.clearTimeout(e);
|
|
1956
2128
|
}, [i]);
|
|
1957
2129
|
let c = async () => {
|
|
1958
|
-
a(await
|
|
2130
|
+
a(await Yn(s) ? "copied" : "failed");
|
|
1959
2131
|
};
|
|
1960
|
-
return /* @__PURE__ */
|
|
2132
|
+
return /* @__PURE__ */ z("div", { children: [/* @__PURE__ */ z("div", {
|
|
1961
2133
|
className: "mb-1 flex items-center justify-between gap-2",
|
|
1962
|
-
children: [/* @__PURE__ */
|
|
2134
|
+
children: [/* @__PURE__ */ R("div", {
|
|
1963
2135
|
className: Y("text-xs font-semibold uppercase", t === "input" ? "text-blue-500" : t === "error" ? "text-rose-500" : "text-emerald-500"),
|
|
1964
2136
|
children: e
|
|
1965
|
-
}), /* @__PURE__ */
|
|
2137
|
+
}), /* @__PURE__ */ z("button", {
|
|
1966
2138
|
type: "button",
|
|
1967
2139
|
onClick: () => {
|
|
1968
2140
|
c();
|
|
1969
2141
|
},
|
|
1970
2142
|
className: "inline-flex items-center gap-1 rounded-lg px-2 py-1 text-[11px] font-medium text-slate-500 transition hover:bg-white hover:text-slate-900 dark:text-slate-400 dark:hover:bg-slate-900 dark:hover:text-slate-100",
|
|
1971
|
-
children: [i === "copied" ? /* @__PURE__ */
|
|
2143
|
+
children: [i === "copied" ? /* @__PURE__ */ R(r, { className: "h-3.5 w-3.5 text-emerald-500" }) : /* @__PURE__ */ R(o, { className: "h-3.5 w-3.5" }), i === "copied" ? "已复制" : i === "failed" ? "复制失败" : "复制"]
|
|
1972
2144
|
})]
|
|
1973
|
-
}), /* @__PURE__ */
|
|
2145
|
+
}), /* @__PURE__ */ R("div", {
|
|
1974
2146
|
className: "custom-scrollbar max-h-[220px] overflow-y-auto whitespace-pre-wrap break-words rounded-xl border border-slate-200/30 bg-white/70 p-3 text-slate-600 shadow-sm dark:border-slate-800 dark:bg-slate-950/40 dark:text-slate-300 sm:max-h-[300px]",
|
|
1975
2147
|
children: s
|
|
1976
2148
|
})] });
|
|
1977
2149
|
}
|
|
1978
|
-
function
|
|
1979
|
-
let [a, s] = q(!1), [c, l] = q(n.feedback?.comment || ""), u =
|
|
2150
|
+
function yr({ isLastMessage: e, isStreaming: t, message: n, onDeleteFeedback: r, onSubmitFeedback: i }) {
|
|
2151
|
+
let [a, s] = q(!1), [c, l] = q(n.feedback?.comment || ""), u = jn(n, t, e), d = !!n.feedback?.pending, f = n.feedback?.rating, p = async () => {
|
|
1980
2152
|
let e = n.content || "";
|
|
1981
|
-
e &&
|
|
2153
|
+
e && Yn(e);
|
|
1982
2154
|
};
|
|
1983
|
-
return u ? /* @__PURE__ */
|
|
2155
|
+
return u ? /* @__PURE__ */ z("div", {
|
|
1984
2156
|
className: "mt-2 flex flex-col gap-2 opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-within:opacity-100",
|
|
1985
2157
|
children: [
|
|
1986
|
-
/* @__PURE__ */
|
|
2158
|
+
/* @__PURE__ */ z("div", {
|
|
1987
2159
|
className: "flex flex-wrap items-center gap-1.5 text-xs text-text-muted",
|
|
1988
2160
|
children: [
|
|
1989
|
-
/* @__PURE__ */
|
|
2161
|
+
/* @__PURE__ */ R("button", {
|
|
1990
2162
|
type: "button",
|
|
1991
2163
|
onClick: () => {
|
|
1992
2164
|
p();
|
|
1993
2165
|
},
|
|
1994
2166
|
className: "inline-flex items-center gap-1 rounded-full px-2 py-1 font-medium text-text-secondary transition hover:bg-muted hover:text-text-primary",
|
|
1995
2167
|
title: "复制",
|
|
1996
|
-
children: /* @__PURE__ */
|
|
2168
|
+
children: /* @__PURE__ */ R(o, { className: "h-3.5 w-3.5" })
|
|
1997
2169
|
}),
|
|
1998
|
-
/* @__PURE__ */
|
|
2170
|
+
/* @__PURE__ */ R("span", {
|
|
1999
2171
|
className: "text-text-muted/60",
|
|
2000
2172
|
children: "·"
|
|
2001
2173
|
}),
|
|
2002
|
-
/* @__PURE__ */
|
|
2174
|
+
/* @__PURE__ */ R("span", {
|
|
2003
2175
|
className: "font-medium",
|
|
2004
2176
|
children: "本次回复有帮助吗?"
|
|
2005
2177
|
}),
|
|
2006
|
-
/* @__PURE__ */
|
|
2178
|
+
/* @__PURE__ */ z("button", {
|
|
2007
2179
|
type: "button",
|
|
2008
2180
|
disabled: d,
|
|
2009
2181
|
onClick: () => i({
|
|
@@ -2012,45 +2184,45 @@ function lr({ isLastMessage: e, isStreaming: t, message: n, onDeleteFeedback: r,
|
|
|
2012
2184
|
comment: ""
|
|
2013
2185
|
}),
|
|
2014
2186
|
className: Y("inline-flex items-center gap-1 rounded-full border px-2.5 py-1 font-medium transition disabled:cursor-not-allowed disabled:opacity-60", f === "up" ? "border-primary/30 bg-primary/10 text-primary" : "border-border bg-background text-text-secondary hover:border-primary/30 hover:text-primary"),
|
|
2015
|
-
children: [/* @__PURE__ */
|
|
2187
|
+
children: [/* @__PURE__ */ R(P, { className: "h-3.5 w-3.5" }), "有帮助"]
|
|
2016
2188
|
}),
|
|
2017
|
-
/* @__PURE__ */
|
|
2189
|
+
/* @__PURE__ */ z("button", {
|
|
2018
2190
|
type: "button",
|
|
2019
2191
|
disabled: d,
|
|
2020
2192
|
onClick: () => {
|
|
2021
2193
|
l(n.feedback?.comment || ""), s((e) => !e);
|
|
2022
2194
|
},
|
|
2023
2195
|
className: Y("inline-flex items-center gap-1 rounded-full border px-2.5 py-1 font-medium transition disabled:cursor-not-allowed disabled:opacity-60", f === "down" ? "border-rose-300 bg-rose-50 text-rose-600 dark:border-rose-900/70 dark:bg-rose-950/30 dark:text-rose-300" : "border-border bg-background text-text-secondary hover:border-rose-300 hover:text-rose-600"),
|
|
2024
|
-
children: [/* @__PURE__ */
|
|
2196
|
+
children: [/* @__PURE__ */ R(N, { className: "h-3.5 w-3.5" }), "需改进"]
|
|
2025
2197
|
}),
|
|
2026
|
-
n.feedback ? /* @__PURE__ */
|
|
2198
|
+
n.feedback ? /* @__PURE__ */ z("button", {
|
|
2027
2199
|
type: "button",
|
|
2028
2200
|
disabled: d,
|
|
2029
2201
|
onClick: () => r(n),
|
|
2030
2202
|
className: "inline-flex items-center gap-1 rounded-full border border-transparent px-2 py-1 font-medium text-slate-400 transition hover:border-slate-200 hover:text-slate-700 disabled:cursor-not-allowed disabled:opacity-60 dark:hover:border-slate-800 dark:hover:text-slate-200",
|
|
2031
|
-
children: [/* @__PURE__ */
|
|
2203
|
+
children: [/* @__PURE__ */ R(se, { className: "h-3.5 w-3.5" }), "删除反馈"]
|
|
2032
2204
|
}) : null,
|
|
2033
|
-
d ? /* @__PURE__ */
|
|
2205
|
+
d ? /* @__PURE__ */ R("span", {
|
|
2034
2206
|
className: "text-slate-400",
|
|
2035
2207
|
children: "提交中…"
|
|
2036
2208
|
}) : null
|
|
2037
2209
|
]
|
|
2038
2210
|
}),
|
|
2039
|
-
a ? /* @__PURE__ */
|
|
2211
|
+
a ? /* @__PURE__ */ z("div", {
|
|
2040
2212
|
className: "max-w-xl rounded-2xl border border-rose-100 bg-rose-50/60 p-3 shadow-sm dark:border-rose-900/60 dark:bg-rose-950/20",
|
|
2041
|
-
children: [/* @__PURE__ */
|
|
2213
|
+
children: [/* @__PURE__ */ R("textarea", {
|
|
2042
2214
|
value: c,
|
|
2043
2215
|
onChange: (e) => l(e.target.value),
|
|
2044
2216
|
placeholder: "可以补充哪里不准确、缺失或不符合预期。",
|
|
2045
2217
|
className: "min-h-[84px] w-full resize-y rounded-xl border border-rose-100 bg-white px-3 py-2 text-sm text-slate-700 outline-none transition placeholder:text-slate-400 focus:border-rose-300 focus:ring-2 focus:ring-rose-100 dark:border-rose-900/70 dark:bg-slate-950 dark:text-slate-100 dark:focus:border-rose-700 dark:focus:ring-rose-950"
|
|
2046
|
-
}), /* @__PURE__ */
|
|
2218
|
+
}), /* @__PURE__ */ z("div", {
|
|
2047
2219
|
className: "mt-2 flex flex-wrap justify-end gap-2",
|
|
2048
|
-
children: [/* @__PURE__ */
|
|
2220
|
+
children: [/* @__PURE__ */ R("button", {
|
|
2049
2221
|
type: "button",
|
|
2050
2222
|
onClick: () => s(!1),
|
|
2051
2223
|
className: "rounded-xl px-3 py-1.5 text-xs font-semibold text-slate-500 transition hover:bg-white hover:text-slate-800 dark:text-slate-400 dark:hover:bg-slate-950 dark:hover:text-slate-100",
|
|
2052
2224
|
children: "取消"
|
|
2053
|
-
}), /* @__PURE__ */
|
|
2225
|
+
}), /* @__PURE__ */ R("button", {
|
|
2054
2226
|
type: "button",
|
|
2055
2227
|
disabled: d,
|
|
2056
2228
|
onClick: () => {
|
|
@@ -2064,106 +2236,106 @@ function lr({ isLastMessage: e, isStreaming: t, message: n, onDeleteFeedback: r,
|
|
|
2064
2236
|
children: "提交点踩"
|
|
2065
2237
|
})]
|
|
2066
2238
|
})]
|
|
2067
|
-
}) : f === "down" && n.feedback?.comment ? /* @__PURE__ */
|
|
2239
|
+
}) : f === "down" && n.feedback?.comment ? /* @__PURE__ */ z("div", {
|
|
2068
2240
|
className: "max-w-xl rounded-xl border border-rose-100 bg-rose-50/50 px-3 py-2 text-xs text-rose-700 dark:border-rose-900/60 dark:bg-rose-950/20 dark:text-rose-200",
|
|
2069
2241
|
children: ["反馈:", n.feedback.comment]
|
|
2070
2242
|
}) : null,
|
|
2071
|
-
n.feedback?.error ? /* @__PURE__ */
|
|
2243
|
+
n.feedback?.error ? /* @__PURE__ */ R("div", {
|
|
2072
2244
|
className: "text-xs text-rose-600 dark:text-rose-300",
|
|
2073
2245
|
children: n.feedback.error
|
|
2074
2246
|
}) : null
|
|
2075
2247
|
]
|
|
2076
2248
|
}) : null;
|
|
2077
2249
|
}
|
|
2078
|
-
function
|
|
2079
|
-
return s.role === "user" ? /* @__PURE__ */
|
|
2250
|
+
function br({ agentName: e, isMobile: t, isStreaming: a, isLastMessage: o, message: s, onDeleteFeedback: c, onOpenAttachmentPreview: l, onRespondToApproval: u, onRespondToAguiApproval: d, onSubmitFeedback: f, onSubmitAguiAction: p }) {
|
|
2251
|
+
return s.role === "user" ? /* @__PURE__ */ R("div", {
|
|
2080
2252
|
className: "mb-3 flex justify-end",
|
|
2081
|
-
children: /* @__PURE__ */
|
|
2253
|
+
children: /* @__PURE__ */ z("div", {
|
|
2082
2254
|
className: "max-w-[80%] rounded-2xl bg-muted px-3 py-2 text-[14px] leading-relaxed text-foreground",
|
|
2083
|
-
children: [s.attachments?.length ? /* @__PURE__ */
|
|
2255
|
+
children: [s.attachments?.length ? /* @__PURE__ */ R(gr, {
|
|
2084
2256
|
attachments: s.attachments,
|
|
2085
2257
|
isMobile: t,
|
|
2086
2258
|
onOpenAttachmentPreview: l
|
|
2087
2259
|
}) : null, s.content]
|
|
2088
2260
|
})
|
|
2089
|
-
}) : s.role === "a2ui" && s.aguiActivity ? /* @__PURE__ */
|
|
2261
|
+
}) : s.role === "a2ui" && s.aguiActivity ? /* @__PURE__ */ R(rr, {
|
|
2090
2262
|
surfaceId: s.aguiActivity.surfaceId,
|
|
2091
2263
|
messages: s.aguiActivity.messages,
|
|
2092
2264
|
onAction: p
|
|
2093
|
-
}) : /* @__PURE__ */
|
|
2265
|
+
}) : /* @__PURE__ */ z("div", {
|
|
2094
2266
|
className: "group mx-auto mb-3 w-full max-w-3xl px-6",
|
|
2095
2267
|
children: [
|
|
2096
|
-
/* @__PURE__ */
|
|
2268
|
+
/* @__PURE__ */ z("div", {
|
|
2097
2269
|
className: "mb-1.5 flex items-center gap-2 text-xs text-text-muted",
|
|
2098
|
-
children: [/* @__PURE__ */
|
|
2270
|
+
children: [/* @__PURE__ */ R(n, { className: "w-3.5 h-3.5" }), /* @__PURE__ */ R("span", { children: e })]
|
|
2099
2271
|
}),
|
|
2100
|
-
s.attachments?.length ? /* @__PURE__ */
|
|
2272
|
+
s.attachments?.length ? /* @__PURE__ */ R(gr, {
|
|
2101
2273
|
attachments: s.attachments,
|
|
2102
2274
|
isMobile: t,
|
|
2103
2275
|
onOpenAttachmentPreview: l
|
|
2104
2276
|
}) : null,
|
|
2105
|
-
s.blocks?.length ? /* @__PURE__ */
|
|
2277
|
+
s.blocks?.length ? /* @__PURE__ */ R(pn, {
|
|
2106
2278
|
message: s,
|
|
2107
2279
|
isStreaming: a,
|
|
2108
2280
|
onRespondToApproval: u,
|
|
2109
2281
|
onRespondToAguiApproval: d
|
|
2110
|
-
}) : /* @__PURE__ */
|
|
2111
|
-
s.reasoning ? /* @__PURE__ */
|
|
2282
|
+
}) : /* @__PURE__ */ z(L, { children: [
|
|
2283
|
+
s.reasoning ? /* @__PURE__ */ z("details", {
|
|
2112
2284
|
className: "group/details mb-3 overflow-hidden rounded-md border border-slate-200/80 bg-slate-50/60 text-sm text-slate-600 transition-colors open:bg-white dark:border-slate-700/80 dark:bg-slate-900/40 dark:text-slate-300 dark:open:bg-slate-950/30",
|
|
2113
|
-
children: [/* @__PURE__ */
|
|
2285
|
+
children: [/* @__PURE__ */ z("summary", {
|
|
2114
2286
|
className: "flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2 font-medium outline-none marker:hidden",
|
|
2115
|
-
children: [/* @__PURE__ */
|
|
2287
|
+
children: [/* @__PURE__ */ z("div", {
|
|
2116
2288
|
className: "flex min-w-0 items-center gap-2",
|
|
2117
2289
|
children: [
|
|
2118
|
-
a && o && !s.content ? /* @__PURE__ */
|
|
2119
|
-
/* @__PURE__ */
|
|
2290
|
+
a && o && !s.content ? /* @__PURE__ */ R(O, { className: "h-4 w-4 animate-spin text-slate-500" }) : /* @__PURE__ */ R(r, { className: "h-4 w-4 text-slate-400" }),
|
|
2291
|
+
/* @__PURE__ */ R("span", {
|
|
2120
2292
|
className: "truncate",
|
|
2121
2293
|
children: "思考过程"
|
|
2122
2294
|
}),
|
|
2123
|
-
/* @__PURE__ */
|
|
2295
|
+
/* @__PURE__ */ R("span", {
|
|
2124
2296
|
className: "rounded-full bg-slate-200/70 px-2 py-0.5 text-[11px] font-medium text-slate-600 dark:bg-slate-800 dark:text-slate-300",
|
|
2125
2297
|
children: a && o && !s.content ? "生成中" : "已完成"
|
|
2126
2298
|
})
|
|
2127
2299
|
]
|
|
2128
|
-
}), /* @__PURE__ */
|
|
2129
|
-
}), /* @__PURE__ */
|
|
2300
|
+
}), /* @__PURE__ */ R(i, { className: "h-4 w-4 flex-shrink-0 text-slate-400 transition-transform group-open/details:rotate-180" })]
|
|
2301
|
+
}), /* @__PURE__ */ R("div", {
|
|
2130
2302
|
className: "border-t border-slate-200/70 bg-white/70 dark:border-slate-800 dark:bg-slate-950/20",
|
|
2131
|
-
children: /* @__PURE__ */
|
|
2303
|
+
children: /* @__PURE__ */ R("div", {
|
|
2132
2304
|
className: "custom-scrollbar max-h-[min(46vh,28rem)] overflow-y-auto px-4 py-3 text-[14px] leading-7 text-slate-600 dark:text-slate-300 [&_p]:my-2 [&_pre]:my-2",
|
|
2133
|
-
children: /* @__PURE__ */
|
|
2305
|
+
children: /* @__PURE__ */ R(Z, { content: s.reasoning })
|
|
2134
2306
|
})
|
|
2135
2307
|
})]
|
|
2136
2308
|
}) : null,
|
|
2137
|
-
s.tools ? Object.values(s.tools).map((e, t) => /* @__PURE__ */
|
|
2309
|
+
s.tools ? Object.values(s.tools).map((e, t) => /* @__PURE__ */ z("details", {
|
|
2138
2310
|
open: e.approvalStatus === "pending" || e.status === "paused" ? !0 : void 0,
|
|
2139
2311
|
className: Y("group/details mb-2 overflow-hidden rounded-md border text-sm transition-colors", e.status === "paused" ? "border-amber-200/80 bg-amber-50/25 text-slate-700 dark:border-amber-900/60 dark:bg-amber-950/10 dark:text-slate-200" : e.status === "error" ? "border-rose-200/80 bg-rose-50/25 text-rose-700 dark:border-rose-900/60 dark:bg-rose-950/10 dark:text-rose-200" : "border-slate-200/80 bg-slate-50/40 text-slate-600 dark:border-slate-700/80 dark:bg-slate-900/30 dark:text-slate-300"),
|
|
2140
|
-
children: [/* @__PURE__ */
|
|
2312
|
+
children: [/* @__PURE__ */ R("summary", {
|
|
2141
2313
|
className: "flex cursor-pointer list-none items-center justify-between gap-2 px-3 py-2 font-medium",
|
|
2142
|
-
children: /* @__PURE__ */
|
|
2314
|
+
children: /* @__PURE__ */ z("div", {
|
|
2143
2315
|
className: "flex items-center gap-2",
|
|
2144
|
-
children: [e.status === "running" ? /* @__PURE__ */
|
|
2316
|
+
children: [e.status === "running" ? /* @__PURE__ */ R(O, { className: "h-4 w-4 animate-spin text-slate-500" }) : e.status === "paused" ? /* @__PURE__ */ R(k, { className: "h-4 w-4 text-amber-500" }) : e.status === "error" ? /* @__PURE__ */ R(F, { className: "h-4 w-4 text-rose-500" }) : /* @__PURE__ */ R(r, { className: "h-4 w-4 text-slate-400" }), /* @__PURE__ */ z("span", { children: [e.approvalStatus === "pending" ? "等待审批:" : e.approvalStatus === "approved" ? "已批准:" : e.approvalStatus === "rejected" ? "已拒绝:" : e.status === "error" ? "工具调用失败:" : "工具调用:", e.name] })]
|
|
2145
2317
|
})
|
|
2146
|
-
}), /* @__PURE__ */
|
|
2318
|
+
}), /* @__PURE__ */ z("div", {
|
|
2147
2319
|
className: Y("flex flex-col gap-3 border-t px-3 py-3 font-mono text-[13px] leading-relaxed", e.status === "paused" ? "border-amber-200/70 dark:border-amber-900/60" : e.status === "error" ? "border-rose-200/70 dark:border-rose-900/60" : "border-slate-200/70 dark:border-slate-800"),
|
|
2148
2320
|
children: [
|
|
2149
|
-
e.approvalRequestId ? /* @__PURE__ */
|
|
2321
|
+
e.approvalRequestId ? /* @__PURE__ */ z("div", {
|
|
2150
2322
|
className: "font-sans text-sm text-slate-700 dark:text-slate-200",
|
|
2151
2323
|
children: [
|
|
2152
|
-
/* @__PURE__ */
|
|
2324
|
+
/* @__PURE__ */ R("div", {
|
|
2153
2325
|
className: "font-medium",
|
|
2154
2326
|
children: e.approvalStatus === "approved" ? "已批准该工具调用。" : e.approvalStatus === "rejected" ? "已拒绝该工具调用。" : e.approvalMessage || "该工具调用需要人工确认后继续。"
|
|
2155
2327
|
}),
|
|
2156
|
-
e.approvalLevel ? /* @__PURE__ */
|
|
2157
|
-
className: Y("mt-2 inline-flex items-center rounded border px-1.5 py-0.5 text-xs font-medium",
|
|
2158
|
-
children: ["审批级别:",
|
|
2328
|
+
e.approvalLevel ? /* @__PURE__ */ z("div", {
|
|
2329
|
+
className: Y("mt-2 inline-flex items-center rounded border px-1.5 py-0.5 text-xs font-medium", sr(e.approvalLevel)),
|
|
2330
|
+
children: ["审批级别:", or(e.approvalLevel)]
|
|
2159
2331
|
}) : null,
|
|
2160
|
-
e.serverLabel ? /* @__PURE__ */
|
|
2332
|
+
e.serverLabel ? /* @__PURE__ */ z("div", {
|
|
2161
2333
|
className: "mt-1 text-xs text-amber-700/80 dark:text-amber-200/80",
|
|
2162
2334
|
children: ["MCP Server: ", e.serverLabel]
|
|
2163
2335
|
}) : null,
|
|
2164
|
-
e.approvalStatus === "pending" ? /* @__PURE__ */
|
|
2336
|
+
e.approvalStatus === "pending" ? /* @__PURE__ */ z("div", {
|
|
2165
2337
|
className: "mt-3 flex flex-wrap gap-2",
|
|
2166
|
-
children: [/* @__PURE__ */
|
|
2338
|
+
children: [/* @__PURE__ */ z("button", {
|
|
2167
2339
|
type: "button",
|
|
2168
2340
|
disabled: a || e.approvalStatus !== "pending",
|
|
2169
2341
|
onClick: () => e.approvalProtocol === "ag-ui" ? d?.({
|
|
@@ -2175,8 +2347,8 @@ function ur({ agentName: e, isMobile: t, isStreaming: a, isLastMessage: o, messa
|
|
|
2175
2347
|
previousResponseId: e.previousResponseId
|
|
2176
2348
|
}),
|
|
2177
2349
|
className: "inline-flex min-h-8 items-center gap-1.5 rounded-md bg-emerald-600 px-3 py-1.5 text-xs font-semibold text-white shadow-sm transition hover:bg-emerald-500 disabled:cursor-not-allowed disabled:opacity-55",
|
|
2178
|
-
children: [/* @__PURE__ */
|
|
2179
|
-
}), /* @__PURE__ */
|
|
2350
|
+
children: [/* @__PURE__ */ R(r, { className: "h-3.5 w-3.5" }), "批准并继续"]
|
|
2351
|
+
}), /* @__PURE__ */ z("button", {
|
|
2180
2352
|
type: "button",
|
|
2181
2353
|
disabled: a || e.approvalStatus !== "pending",
|
|
2182
2354
|
onClick: () => e.approvalProtocol === "ag-ui" ? d?.({
|
|
@@ -2188,20 +2360,20 @@ function ur({ agentName: e, isMobile: t, isStreaming: a, isLastMessage: o, messa
|
|
|
2188
2360
|
previousResponseId: e.previousResponseId
|
|
2189
2361
|
}),
|
|
2190
2362
|
className: "inline-flex min-h-8 items-center gap-1.5 rounded-md border border-slate-300 bg-white px-3 py-1.5 text-xs font-semibold text-slate-600 transition hover:border-rose-300 hover:bg-rose-50 hover:text-rose-600 disabled:cursor-not-allowed disabled:opacity-55 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-300 dark:hover:border-rose-800 dark:hover:bg-rose-950/30 dark:hover:text-rose-300",
|
|
2191
|
-
children: [/* @__PURE__ */
|
|
2363
|
+
children: [/* @__PURE__ */ R(F, { className: "h-3.5 w-3.5" }), "拒绝"]
|
|
2192
2364
|
})]
|
|
2193
|
-
}) : /* @__PURE__ */
|
|
2365
|
+
}) : /* @__PURE__ */ z("div", {
|
|
2194
2366
|
className: "mt-2 inline-flex items-center gap-1.5 text-xs font-medium text-slate-500 dark:text-slate-400",
|
|
2195
|
-
children: [e.approvalStatus === "approved" ? /* @__PURE__ */
|
|
2367
|
+
children: [e.approvalStatus === "approved" ? /* @__PURE__ */ R(r, { className: "h-3.5 w-3.5 text-emerald-500" }) : /* @__PURE__ */ R(F, { className: "h-3.5 w-3.5 text-rose-500" }), e.approvalStatus === "approved" ? "已批准" : "已拒绝"]
|
|
2196
2368
|
})
|
|
2197
2369
|
]
|
|
2198
2370
|
}) : null,
|
|
2199
|
-
e.args ? /* @__PURE__ */
|
|
2371
|
+
e.args ? /* @__PURE__ */ R(vr, {
|
|
2200
2372
|
label: "入参 (Args)",
|
|
2201
2373
|
tone: "input",
|
|
2202
2374
|
value: e.args
|
|
2203
2375
|
}) : null,
|
|
2204
|
-
e.output ? /* @__PURE__ */
|
|
2376
|
+
e.output ? /* @__PURE__ */ R(vr, {
|
|
2205
2377
|
label: "输出 (Output)",
|
|
2206
2378
|
tone: e.status === "error" ? "error" : "output",
|
|
2207
2379
|
value: e.output
|
|
@@ -2209,17 +2381,17 @@ function ur({ agentName: e, isMobile: t, isStreaming: a, isLastMessage: o, messa
|
|
|
2209
2381
|
]
|
|
2210
2382
|
})]
|
|
2211
2383
|
}, `${e.name}-${t}`)) : null,
|
|
2212
|
-
/* @__PURE__ */
|
|
2384
|
+
/* @__PURE__ */ R("div", {
|
|
2213
2385
|
className: "w-full break-words",
|
|
2214
|
-
children: s.content ? /* @__PURE__ */
|
|
2386
|
+
children: s.content ? /* @__PURE__ */ R(Z, { content: s.content }) : a && o && !s.reasoning && !s.tools ? /* @__PURE__ */ R("span", { className: "ml-1 mt-2 inline-block h-4 w-2 animate-pulse rounded-sm bg-emerald-500 align-middle opacity-80 shadow-sm" }) : null
|
|
2215
2387
|
})
|
|
2216
2388
|
] }),
|
|
2217
|
-
s.aguiActivities?.map((e) => /* @__PURE__ */
|
|
2389
|
+
s.aguiActivities?.map((e) => /* @__PURE__ */ R(rr, {
|
|
2218
2390
|
surfaceId: e.surfaceId,
|
|
2219
2391
|
messages: e.messages,
|
|
2220
2392
|
onAction: p
|
|
2221
2393
|
}, e.surfaceId)),
|
|
2222
|
-
/* @__PURE__ */
|
|
2394
|
+
/* @__PURE__ */ R(yr, {
|
|
2223
2395
|
isLastMessage: o,
|
|
2224
2396
|
isStreaming: a,
|
|
2225
2397
|
message: s,
|
|
@@ -2229,7 +2401,7 @@ function ur({ agentName: e, isMobile: t, isStreaming: a, isLastMessage: o, messa
|
|
|
2229
2401
|
]
|
|
2230
2402
|
});
|
|
2231
2403
|
}
|
|
2232
|
-
function
|
|
2404
|
+
function xr({ agentName: t, isMobile: n, isStreaming: r, activity: i, contextIndicator: a, messages: o, isLoadingInitialHistory: s = !1, onDeleteFeedback: c, onOpenAttachmentPreview: l, onRespondToApproval: u, onRespondToAguiApproval: d, onSubmitFeedback: f, onSubmitAguiAction: p, onStopGeneration: m, onCancelRemote: h, checkpoints: g = [], onResumeCheckpoint: _, scrollRef: v }) {
|
|
2233
2405
|
let [y, b] = q(0), [x, S] = q(0), [C, w] = q(/* @__PURE__ */ new Map()), ee = K(C);
|
|
2234
2406
|
G(() => {
|
|
2235
2407
|
let e = v.current;
|
|
@@ -2241,12 +2413,12 @@ function dr({ agentName: t, isMobile: n, isStreaming: r, activity: i, contextInd
|
|
|
2241
2413
|
let n = new ResizeObserver(() => t());
|
|
2242
2414
|
return n.observe(e), () => n.disconnect();
|
|
2243
2415
|
}, [v]);
|
|
2244
|
-
let T = _e(() =>
|
|
2416
|
+
let T = _e(() => Qn({
|
|
2245
2417
|
items: o,
|
|
2246
2418
|
scrollTop: y,
|
|
2247
2419
|
viewportHeight: x,
|
|
2248
|
-
overscan:
|
|
2249
|
-
defaultItemHeight:
|
|
2420
|
+
overscan: ar,
|
|
2421
|
+
defaultItemHeight: ir,
|
|
2250
2422
|
measuredHeights: C,
|
|
2251
2423
|
getItemKey: (e, t) => e?.id || String(t)
|
|
2252
2424
|
}), [
|
|
@@ -2256,28 +2428,28 @@ function dr({ agentName: t, isMobile: n, isStreaming: r, activity: i, contextInd
|
|
|
2256
2428
|
x
|
|
2257
2429
|
]), E = T.visibleItems, D = U((e, t, n) => {
|
|
2258
2430
|
if (!e || !Number.isFinite(t) || t <= 0) return;
|
|
2259
|
-
let r = ee.current, i = r.get(e) ??
|
|
2431
|
+
let r = ee.current, i = r.get(e) ?? ir;
|
|
2260
2432
|
if (i === t) return;
|
|
2261
2433
|
let a = new Map(r);
|
|
2262
2434
|
a.set(e, t), ee.current = a, w(a);
|
|
2263
2435
|
let o = v.current;
|
|
2264
2436
|
o && n < o.scrollTop && (o.scrollTop += t - i, b(o.scrollTop));
|
|
2265
2437
|
}, [v]);
|
|
2266
|
-
return /* @__PURE__ */
|
|
2438
|
+
return /* @__PURE__ */ z("div", {
|
|
2267
2439
|
ref: v,
|
|
2268
2440
|
onScroll: (e) => b(e.currentTarget.scrollTop),
|
|
2269
2441
|
className: Y("custom-scrollbar relative min-h-0 flex-1 overflow-y-auto scroll-smooth", n ? "px-3 py-3" : "px-4 py-5"),
|
|
2270
2442
|
children: [
|
|
2271
|
-
/* @__PURE__ */
|
|
2443
|
+
/* @__PURE__ */ R("div", {
|
|
2272
2444
|
className: Y("mx-auto flex w-full max-w-[64rem] flex-col", i ? "pb-10 sm:pb-10" : "pb-6 sm:pb-8"),
|
|
2273
|
-
children: o.length === 0 && s ? /* @__PURE__ */
|
|
2445
|
+
children: o.length === 0 && s ? /* @__PURE__ */ R(hr, {}) : o.length === 0 ? /* @__PURE__ */ R(mr, { agentName: t }) : /* @__PURE__ */ R("div", {
|
|
2274
2446
|
style: { height: T.totalHeight },
|
|
2275
2447
|
className: "relative",
|
|
2276
|
-
children: E.map((e) => /* @__PURE__ */
|
|
2448
|
+
children: E.map((e) => /* @__PURE__ */ R(cr, {
|
|
2277
2449
|
messageId: e.item.id || String(e.index),
|
|
2278
2450
|
top: e.top,
|
|
2279
2451
|
onMeasure: D,
|
|
2280
|
-
children: e.item.role === "system" ? /* @__PURE__ */
|
|
2452
|
+
children: e.item.role === "system" ? /* @__PURE__ */ R(_r, { message: e.item }) : /* @__PURE__ */ R(br, {
|
|
2281
2453
|
agentName: t,
|
|
2282
2454
|
isMobile: n,
|
|
2283
2455
|
isStreaming: r,
|
|
@@ -2293,8 +2465,8 @@ function dr({ agentName: t, isMobile: n, isStreaming: r, activity: i, contextInd
|
|
|
2293
2465
|
}, e.item.id || e.index))
|
|
2294
2466
|
})
|
|
2295
2467
|
}),
|
|
2296
|
-
/* @__PURE__ */
|
|
2297
|
-
y > 320 ? /* @__PURE__ */
|
|
2468
|
+
/* @__PURE__ */ R(Dn, {}),
|
|
2469
|
+
y > 320 ? /* @__PURE__ */ R("button", {
|
|
2298
2470
|
type: "button",
|
|
2299
2471
|
onClick: () => {
|
|
2300
2472
|
let e = v.current;
|
|
@@ -2305,11 +2477,11 @@ function dr({ agentName: t, isMobile: n, isStreaming: r, activity: i, contextInd
|
|
|
2305
2477
|
},
|
|
2306
2478
|
className: "sticky bottom-4 left-1/2 z-20 mx-auto flex h-9 w-9 -translate-x-1/2 items-center justify-center rounded-full border border-border bg-surface text-text-secondary shadow-[0_8px_24px_rgba(15,23,42,0.12)] transition hover:text-text-primary",
|
|
2307
2479
|
title: "回到底部",
|
|
2308
|
-
children: /* @__PURE__ */
|
|
2480
|
+
children: /* @__PURE__ */ R(e, { className: "h-4 w-4" })
|
|
2309
2481
|
}) : null,
|
|
2310
|
-
i ? /* @__PURE__ */
|
|
2482
|
+
i ? /* @__PURE__ */ R("div", {
|
|
2311
2483
|
className: "sticky bottom-1 z-20 mx-auto flex w-full max-w-[64rem] justify-end",
|
|
2312
|
-
children: /* @__PURE__ */
|
|
2484
|
+
children: /* @__PURE__ */ R(pr, {
|
|
2313
2485
|
activity: i,
|
|
2314
2486
|
contextIndicator: a,
|
|
2315
2487
|
onStopGeneration: m,
|
|
@@ -2321,13 +2493,13 @@ function dr({ agentName: t, isMobile: n, isStreaming: r, activity: i, contextInd
|
|
|
2321
2493
|
}
|
|
2322
2494
|
//#endregion
|
|
2323
2495
|
//#region src/utils/session-list.js
|
|
2324
|
-
var
|
|
2496
|
+
var Sr = new Set([
|
|
2325
2497
|
"in_progress",
|
|
2326
2498
|
"running",
|
|
2327
2499
|
"queued",
|
|
2328
2500
|
"pending"
|
|
2329
|
-
]),
|
|
2330
|
-
function
|
|
2501
|
+
]), Cr = 300 * 1e3;
|
|
2502
|
+
function wr(e) {
|
|
2331
2503
|
let t = e?.UpdatedAt ?? e?.updated_at;
|
|
2332
2504
|
if (typeof t == "string") {
|
|
2333
2505
|
let e = Date.parse(t);
|
|
@@ -2335,10 +2507,10 @@ function mr(e) {
|
|
|
2335
2507
|
}
|
|
2336
2508
|
return typeof t == "number" && Number.isFinite(t) ? t > 1e11 ? t : t * 1e3 : 0;
|
|
2337
2509
|
}
|
|
2338
|
-
function
|
|
2510
|
+
function Tr(e) {
|
|
2339
2511
|
return String(e || "").trim().toLowerCase();
|
|
2340
2512
|
}
|
|
2341
|
-
function
|
|
2513
|
+
function Er(e) {
|
|
2342
2514
|
if (!e) return "";
|
|
2343
2515
|
let t = typeof e == "number" ? new Date(e > 1e11 ? e : e * 1e3) : new Date(e);
|
|
2344
2516
|
return Number.isNaN(t.getTime()) ? "" : t.toLocaleString("zh-CN", {
|
|
@@ -2350,7 +2522,7 @@ function gr(e) {
|
|
|
2350
2522
|
hour12: !1
|
|
2351
2523
|
});
|
|
2352
2524
|
}
|
|
2353
|
-
function
|
|
2525
|
+
function Dr(e) {
|
|
2354
2526
|
return [
|
|
2355
2527
|
e?.Title,
|
|
2356
2528
|
e?.Summary,
|
|
@@ -2359,58 +2531,58 @@ function _r(e) {
|
|
|
2359
2531
|
e?.SessionId,
|
|
2360
2532
|
e?.Model?.display_name,
|
|
2361
2533
|
e?.Model?.id
|
|
2362
|
-
].map(
|
|
2534
|
+
].map(Tr).join(" ");
|
|
2363
2535
|
}
|
|
2364
|
-
function
|
|
2365
|
-
if (!
|
|
2366
|
-
let n =
|
|
2536
|
+
function Or(e, t = {}) {
|
|
2537
|
+
if (!Sr.has(Tr(e?.ActiveRunStatus))) return !1;
|
|
2538
|
+
let n = wr(e);
|
|
2367
2539
|
if (!n) return !0;
|
|
2368
|
-
let r = Number.isFinite(Number(t.now)) ? Number(t.now) : Date.now(), i = Number.isFinite(Number(t.activeStaleAfterMs)) ? Number(t.activeStaleAfterMs) :
|
|
2540
|
+
let r = Number.isFinite(Number(t.now)) ? Number(t.now) : Date.now(), i = Number.isFinite(Number(t.activeStaleAfterMs)) ? Number(t.activeStaleAfterMs) : Cr;
|
|
2369
2541
|
return r - n <= i;
|
|
2370
2542
|
}
|
|
2371
|
-
function
|
|
2372
|
-
let r =
|
|
2373
|
-
return (Array.isArray(e) ? e : []).filter((e) => e?.SessionId).filter((e) => !r ||
|
|
2543
|
+
function kr(e = [], t = "", n = {}) {
|
|
2544
|
+
let r = Tr(t), i = new Set(Array.isArray(n.pinnedSessionIds) ? n.pinnedSessionIds : []);
|
|
2545
|
+
return (Array.isArray(e) ? e : []).filter((e) => e?.SessionId).filter((e) => !r || Dr(e).includes(r)).slice().sort((e, t) => {
|
|
2374
2546
|
let r = +!!i.has(e.SessionId), a = +!!i.has(t.SessionId);
|
|
2375
2547
|
if (r !== a) return a - r;
|
|
2376
|
-
let o = +!!
|
|
2377
|
-
return o === s ?
|
|
2548
|
+
let o = +!!Or(e, n), s = +!!Or(t, n);
|
|
2549
|
+
return o === s ? wr(t) - wr(e) : s - o;
|
|
2378
2550
|
});
|
|
2379
2551
|
}
|
|
2380
|
-
function
|
|
2381
|
-
let n =
|
|
2552
|
+
function Ar(e, t = {}) {
|
|
2553
|
+
let n = Or(e, t);
|
|
2382
2554
|
return {
|
|
2383
2555
|
running: n,
|
|
2384
|
-
label: n ? "" :
|
|
2556
|
+
label: n ? "" : Er(e?.UpdatedAt ?? e?.updated_at)
|
|
2385
2557
|
};
|
|
2386
2558
|
}
|
|
2387
2559
|
//#endregion
|
|
2388
2560
|
//#region src/components/chat/ChatSidebar.tsx
|
|
2389
|
-
function
|
|
2390
|
-
let [f, p] = q(""), m = _e(() =>
|
|
2561
|
+
function jr({ sessions: e, currentSessionId: t, onCreateNewSession: n, onSelectSession: r, onDeleteSession: i, onTogglePinSession: a, onLoadMoreSessions: o, sessionTitle: s, pinnedSessionIds: c = [], hasMoreSessions: l = !1, isLoadingSessions: u = !1, className: d }) {
|
|
2562
|
+
let [f, p] = q(""), m = _e(() => kr(e, f, { pinnedSessionIds: c }), [
|
|
2391
2563
|
e,
|
|
2392
2564
|
c,
|
|
2393
2565
|
f
|
|
2394
2566
|
]), h = _e(() => new Set(c), [c]);
|
|
2395
|
-
return /* @__PURE__ */
|
|
2567
|
+
return /* @__PURE__ */ z("div", {
|
|
2396
2568
|
className: Y("flex h-full min-h-0 flex-col bg-sidebar", d),
|
|
2397
2569
|
children: [
|
|
2398
|
-
/* @__PURE__ */
|
|
2570
|
+
/* @__PURE__ */ z("div", {
|
|
2399
2571
|
className: "flex flex-shrink-0 flex-col gap-2 border-b border-black/[0.06] px-3 py-3 dark:border-white/[0.08]",
|
|
2400
|
-
children: [/* @__PURE__ */
|
|
2572
|
+
children: [/* @__PURE__ */ z("button", {
|
|
2401
2573
|
type: "button",
|
|
2402
2574
|
onClick: n,
|
|
2403
2575
|
className: "flex h-[34px] w-full items-center justify-between rounded-[10px] px-2.5 text-sm font-medium text-sidebar-text-secondary transition-colors hover:bg-sidebar-hover hover:text-sidebar-text",
|
|
2404
|
-
children: [/* @__PURE__ */
|
|
2576
|
+
children: [/* @__PURE__ */ z("span", {
|
|
2405
2577
|
className: "flex items-center gap-1.5",
|
|
2406
|
-
children: [/* @__PURE__ */
|
|
2407
|
-
}), /* @__PURE__ */
|
|
2578
|
+
children: [/* @__PURE__ */ R(b, { className: "h-4 w-4" }), /* @__PURE__ */ R("span", { children: "新对话" })]
|
|
2579
|
+
}), /* @__PURE__ */ R("span", {
|
|
2408
2580
|
className: "rounded border border-black/[0.08] px-1.5 py-0.5 text-[11px] text-sidebar-text-muted dark:border-white/[0.1]",
|
|
2409
2581
|
children: "⌘ N"
|
|
2410
2582
|
})]
|
|
2411
|
-
}), /* @__PURE__ */
|
|
2583
|
+
}), /* @__PURE__ */ z("label", {
|
|
2412
2584
|
className: "flex h-9 items-center gap-2 rounded-[10px] border border-black/[0.06] bg-background px-2.5 text-xs text-sidebar-text-muted focus-within:border-primary/40 dark:border-white/[0.08]",
|
|
2413
|
-
children: [/* @__PURE__ */
|
|
2585
|
+
children: [/* @__PURE__ */ R(ie, { className: "h-3.5 w-3.5 flex-shrink-0" }), /* @__PURE__ */ R("input", {
|
|
2414
2586
|
value: f,
|
|
2415
2587
|
onChange: (e) => p(e.target.value),
|
|
2416
2588
|
className: "min-w-0 flex-1 bg-transparent text-sm text-sidebar-text outline-none placeholder:text-sidebar-text-muted",
|
|
@@ -2418,21 +2590,21 @@ function xr({ sessions: e, currentSessionId: t, onCreateNewSession: n, onSelectS
|
|
|
2418
2590
|
})]
|
|
2419
2591
|
})]
|
|
2420
2592
|
}),
|
|
2421
|
-
/* @__PURE__ */
|
|
2593
|
+
/* @__PURE__ */ z("div", {
|
|
2422
2594
|
className: "min-h-0 flex-1 overflow-y-auto px-2 pb-4 pt-2 custom-scrollbar",
|
|
2423
2595
|
onScroll: (e) => {
|
|
2424
2596
|
if (!o || u || !l || f.trim()) return;
|
|
2425
2597
|
let t = e.currentTarget;
|
|
2426
2598
|
t.scrollHeight - t.scrollTop - t.clientHeight < 200 && o();
|
|
2427
2599
|
},
|
|
2428
|
-
children: [/* @__PURE__ */
|
|
2600
|
+
children: [/* @__PURE__ */ z("div", {
|
|
2429
2601
|
className: "px-2.5 py-2 text-xs font-medium text-sidebar-text-muted opacity-75",
|
|
2430
2602
|
children: ["历史记录", f.trim() ? ` · ${m.length}` : ""]
|
|
2431
|
-
}), /* @__PURE__ */
|
|
2603
|
+
}), /* @__PURE__ */ z("div", {
|
|
2432
2604
|
className: "flex flex-col gap-0.5",
|
|
2433
2605
|
children: [m.length > 0 ? m.map((e) => {
|
|
2434
|
-
let n =
|
|
2435
|
-
return /* @__PURE__ */
|
|
2606
|
+
let n = Ar(e), o = h.has(e.SessionId), c = t === e.SessionId;
|
|
2607
|
+
return /* @__PURE__ */ z("div", {
|
|
2436
2608
|
role: "button",
|
|
2437
2609
|
tabIndex: 0,
|
|
2438
2610
|
"aria-current": c ? "page" : void 0,
|
|
@@ -2442,58 +2614,58 @@ function xr({ sessions: e, currentSessionId: t, onCreateNewSession: n, onSelectS
|
|
|
2442
2614
|
},
|
|
2443
2615
|
className: Y("group relative flex h-[30px] items-center gap-1 rounded-[10px] border-l-2 border-transparent px-2 text-sm leading-5 transition-colors", c ? "border-l-2 border-primary bg-primary/10 font-medium text-sidebar-text" : n.running ? "cursor-pointer bg-primary/8 text-sidebar-text" : "cursor-pointer text-sidebar-text-secondary hover:bg-sidebar-hover hover:text-sidebar-text"),
|
|
2444
2616
|
children: [
|
|
2445
|
-
n.running ? /* @__PURE__ */
|
|
2617
|
+
n.running ? /* @__PURE__ */ R("span", {
|
|
2446
2618
|
className: "absolute left-0 top-1/2 h-3.5 w-0.5 -translate-y-1/2 rounded-full bg-primary",
|
|
2447
2619
|
"aria-hidden": "true"
|
|
2448
2620
|
}) : null,
|
|
2449
|
-
/* @__PURE__ */
|
|
2621
|
+
/* @__PURE__ */ R("div", {
|
|
2450
2622
|
className: "min-w-0 flex-1 truncate text-[13px]",
|
|
2451
2623
|
children: s(e)
|
|
2452
2624
|
}),
|
|
2453
|
-
n.running ? /* @__PURE__ */
|
|
2625
|
+
n.running ? /* @__PURE__ */ R(v, { className: "h-3.5 w-3.5 flex-shrink-0 animate-spin text-primary" }) : n.label ? /* @__PURE__ */ R("span", {
|
|
2454
2626
|
className: "flex-shrink-0 text-[11px] leading-none text-sidebar-text-muted group-hover:hidden",
|
|
2455
2627
|
children: n.label
|
|
2456
2628
|
}) : null,
|
|
2457
|
-
/* @__PURE__ */
|
|
2629
|
+
/* @__PURE__ */ z("div", {
|
|
2458
2630
|
className: "pointer-events-none absolute right-1 top-1/2 flex -translate-y-1/2 items-center justify-end gap-0.5 opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100",
|
|
2459
|
-
children: [/* @__PURE__ */
|
|
2631
|
+
children: [/* @__PURE__ */ R("button", {
|
|
2460
2632
|
type: "button",
|
|
2461
2633
|
onClick: (t) => a(e.SessionId, t),
|
|
2462
2634
|
className: Y("flex h-6 w-6 items-center justify-center rounded-md text-sidebar-text-muted hover:bg-sidebar-active hover:text-sidebar-text", o && "text-primary opacity-100"),
|
|
2463
2635
|
title: o ? "取消置顶" : "置顶会话",
|
|
2464
2636
|
"aria-label": o ? "取消置顶会话" : "置顶会话",
|
|
2465
|
-
children:
|
|
2466
|
-
}), /* @__PURE__ */
|
|
2637
|
+
children: R(o ? te : D, { className: "h-3.5 w-3.5" })
|
|
2638
|
+
}), /* @__PURE__ */ R("button", {
|
|
2467
2639
|
type: "button",
|
|
2468
2640
|
onClick: (t) => i(e.SessionId, t),
|
|
2469
2641
|
className: "flex h-6 w-6 items-center justify-center rounded-md text-sidebar-text-muted hover:bg-sidebar-active hover:text-rose-500",
|
|
2470
2642
|
title: "删除会话",
|
|
2471
|
-
children: /* @__PURE__ */
|
|
2643
|
+
children: /* @__PURE__ */ R(se, { className: "h-3.5 w-3.5" })
|
|
2472
2644
|
})]
|
|
2473
2645
|
})
|
|
2474
2646
|
]
|
|
2475
2647
|
}, e.SessionId);
|
|
2476
|
-
}) : /* @__PURE__ */
|
|
2648
|
+
}) : /* @__PURE__ */ R("div", {
|
|
2477
2649
|
className: "rounded-xl border border-dashed border-black/[0.08] px-3 py-8 text-center text-xs text-sidebar-text-muted dark:border-white/[0.1]",
|
|
2478
2650
|
children: "没有匹配的会话"
|
|
2479
|
-
}), u ? /* @__PURE__ */
|
|
2651
|
+
}), u ? /* @__PURE__ */ z("div", {
|
|
2480
2652
|
className: "flex items-center justify-center gap-2 px-3 py-3 text-xs text-sidebar-text-muted",
|
|
2481
|
-
children: [/* @__PURE__ */
|
|
2653
|
+
children: [/* @__PURE__ */ R(v, { className: "h-3.5 w-3.5 animate-spin" }), /* @__PURE__ */ R("span", { children: "加载中" })]
|
|
2482
2654
|
}) : null]
|
|
2483
2655
|
})]
|
|
2484
2656
|
}),
|
|
2485
|
-
/* @__PURE__ */
|
|
2657
|
+
/* @__PURE__ */ z("div", {
|
|
2486
2658
|
className: "border-t border-black/[0.06] px-4 py-3 text-center dark:border-white/[0.08]",
|
|
2487
2659
|
children: [
|
|
2488
|
-
/* @__PURE__ */
|
|
2660
|
+
/* @__PURE__ */ R("div", {
|
|
2489
2661
|
className: "text-[10px] font-medium tracking-[0.14em] text-sidebar-text-muted",
|
|
2490
2662
|
children: "POWERED BY"
|
|
2491
2663
|
}),
|
|
2492
|
-
/* @__PURE__ */
|
|
2664
|
+
/* @__PURE__ */ R("div", {
|
|
2493
2665
|
className: "mt-1 bg-gradient-to-r from-blue-600 to-indigo-500 bg-clip-text text-xs font-bold text-transparent dark:from-blue-400 dark:to-indigo-300",
|
|
2494
2666
|
children: "Ksyun AgentEngine"
|
|
2495
2667
|
}),
|
|
2496
|
-
/* @__PURE__ */
|
|
2668
|
+
/* @__PURE__ */ R("div", {
|
|
2497
2669
|
className: "mx-auto mt-2 max-w-[13rem] text-[10px] leading-4 text-sidebar-text-muted",
|
|
2498
2670
|
children: "Agent 可能产生不准确的信息,请独立验证。"
|
|
2499
2671
|
})
|
|
@@ -2504,117 +2676,117 @@ function xr({ sessions: e, currentSessionId: t, onCreateNewSession: n, onSelectS
|
|
|
2504
2676
|
}
|
|
2505
2677
|
//#endregion
|
|
2506
2678
|
//#region src/components/native/NativeRuntimeLauncher.tsx
|
|
2507
|
-
var
|
|
2508
|
-
function
|
|
2679
|
+
var Mr = he(() => import("./NativeTerminalPanel-BLhX4eDs.js").then((e) => e.n).then((e) => ({ default: e.NativeTerminalPanel })));
|
|
2680
|
+
function Nr({ productLabel: e = "原生运行时", nativeManagementLink: t, nativeTerminal: n, workspaceEnabled: r, onOpenWorkspace: i }) {
|
|
2509
2681
|
let a = !!n?.Enabled, [o, s] = q(!1);
|
|
2510
|
-
return /* @__PURE__ */
|
|
2682
|
+
return /* @__PURE__ */ z("section", {
|
|
2511
2683
|
className: "flex min-h-0 flex-1 overflow-y-auto bg-[radial-gradient(circle_at_top_left,rgba(14,165,233,0.12),transparent_34%),linear-gradient(135deg,#f8fafc_0%,#ffffff_48%,#f1f5f9_100%)] px-4 py-8 dark:bg-[radial-gradient(circle_at_top_left,rgba(14,165,233,0.16),transparent_34%),linear-gradient(135deg,#020617_0%,#0f172a_52%,#111827_100%)] sm:px-8",
|
|
2512
|
-
children: [/* @__PURE__ */
|
|
2684
|
+
children: [/* @__PURE__ */ R("div", {
|
|
2513
2685
|
className: "mx-auto flex w-full max-w-5xl flex-col justify-center",
|
|
2514
|
-
children: /* @__PURE__ */
|
|
2686
|
+
children: /* @__PURE__ */ z("div", {
|
|
2515
2687
|
className: "overflow-hidden rounded-[2rem] border border-slate-200/80 bg-white/90 shadow-xl shadow-slate-200/60 backdrop-blur dark:border-slate-800 dark:bg-slate-900/85 dark:shadow-black/30",
|
|
2516
|
-
children: [/* @__PURE__ */
|
|
2688
|
+
children: [/* @__PURE__ */ z("div", {
|
|
2517
2689
|
className: "border-b border-slate-200/80 bg-slate-50/80 px-6 py-5 dark:border-slate-800 dark:bg-slate-950/40 sm:px-8",
|
|
2518
2690
|
children: [
|
|
2519
|
-
/* @__PURE__ */
|
|
2691
|
+
/* @__PURE__ */ z("div", {
|
|
2520
2692
|
className: "inline-flex items-center gap-2 rounded-full border border-sky-200 bg-sky-50 px-3 py-1 text-xs font-medium text-sky-700 dark:border-sky-900/60 dark:bg-sky-950/50 dark:text-sky-300",
|
|
2521
2693
|
children: [
|
|
2522
|
-
/* @__PURE__ */
|
|
2694
|
+
/* @__PURE__ */ R(k, { className: "h-3.5 w-3.5" }),
|
|
2523
2695
|
e,
|
|
2524
2696
|
" native runtime"
|
|
2525
2697
|
]
|
|
2526
2698
|
}),
|
|
2527
|
-
/* @__PURE__ */
|
|
2699
|
+
/* @__PURE__ */ R("h1", {
|
|
2528
2700
|
className: "mt-5 text-2xl font-semibold tracking-tight text-slate-950 dark:text-slate-50 sm:text-3xl",
|
|
2529
2701
|
children: "对话请使用原生管理台"
|
|
2530
2702
|
}),
|
|
2531
|
-
/* @__PURE__ */
|
|
2703
|
+
/* @__PURE__ */ R("p", {
|
|
2532
2704
|
className: "mt-3 max-w-2xl text-sm leading-6 text-slate-600 dark:text-slate-300 sm:text-base",
|
|
2533
2705
|
children: "当前运行时的对话状态由原生管理台承载。AgentEngine Hosted UI 在这里保留统一入口和 Workspace 文件管理,不重复实现运行时内部已有的复杂对话状态机。"
|
|
2534
2706
|
})
|
|
2535
2707
|
]
|
|
2536
|
-
}), /* @__PURE__ */
|
|
2708
|
+
}), /* @__PURE__ */ z("div", {
|
|
2537
2709
|
className: "grid gap-4 p-6 md:grid-cols-3 sm:p-8",
|
|
2538
2710
|
children: [
|
|
2539
|
-
/* @__PURE__ */
|
|
2711
|
+
/* @__PURE__ */ z("div", {
|
|
2540
2712
|
className: "rounded-3xl border border-slate-200 bg-white p-5 dark:border-slate-800 dark:bg-slate-900",
|
|
2541
2713
|
children: [
|
|
2542
|
-
/* @__PURE__ */
|
|
2714
|
+
/* @__PURE__ */ R("div", {
|
|
2543
2715
|
className: "flex h-11 w-11 items-center justify-center rounded-2xl bg-slate-950 text-white dark:bg-slate-100 dark:text-slate-950",
|
|
2544
|
-
children: /* @__PURE__ */
|
|
2716
|
+
children: /* @__PURE__ */ R(x, { className: "h-5 w-5" })
|
|
2545
2717
|
}),
|
|
2546
|
-
/* @__PURE__ */
|
|
2718
|
+
/* @__PURE__ */ R("h2", {
|
|
2547
2719
|
className: "mt-4 text-base font-semibold text-slate-950 dark:text-slate-50",
|
|
2548
2720
|
children: "原生管理台"
|
|
2549
2721
|
}),
|
|
2550
|
-
/* @__PURE__ */
|
|
2722
|
+
/* @__PURE__ */ R("p", {
|
|
2551
2723
|
className: "mt-2 text-sm leading-6 text-slate-600 dark:text-slate-300",
|
|
2552
2724
|
children: "使用原生管理台处理对话、工具卡片、思考流、审批、中断和运行时历史,避免跨状态机不一致。"
|
|
2553
2725
|
}),
|
|
2554
|
-
t ? /* @__PURE__ */
|
|
2726
|
+
t ? /* @__PURE__ */ z("a", {
|
|
2555
2727
|
href: t.href,
|
|
2556
2728
|
target: "_blank",
|
|
2557
2729
|
rel: "noreferrer",
|
|
2558
2730
|
title: t.title,
|
|
2559
2731
|
className: "mt-5 inline-flex items-center gap-2 rounded-2xl bg-slate-950 px-4 py-2.5 text-sm font-medium text-white transition hover:bg-slate-800 dark:bg-slate-100 dark:text-slate-950 dark:hover:bg-white",
|
|
2560
2732
|
children: [
|
|
2561
|
-
/* @__PURE__ */
|
|
2733
|
+
/* @__PURE__ */ R(c, { className: "h-4 w-4" }),
|
|
2562
2734
|
"打开",
|
|
2563
2735
|
t.label
|
|
2564
2736
|
]
|
|
2565
|
-
}) : /* @__PURE__ */
|
|
2737
|
+
}) : /* @__PURE__ */ R("div", {
|
|
2566
2738
|
className: "mt-5 rounded-2xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm leading-6 text-amber-800 dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-200",
|
|
2567
2739
|
children: "当前访问模式不开放原生管理入口。需要完整对话体验时,请使用 owner/private 链接或 CLI。"
|
|
2568
2740
|
})
|
|
2569
2741
|
]
|
|
2570
2742
|
}),
|
|
2571
|
-
/* @__PURE__ */
|
|
2743
|
+
/* @__PURE__ */ z("div", {
|
|
2572
2744
|
className: "rounded-3xl border border-slate-200 bg-white p-5 dark:border-slate-800 dark:bg-slate-900",
|
|
2573
2745
|
children: [
|
|
2574
|
-
/* @__PURE__ */
|
|
2746
|
+
/* @__PURE__ */ R("div", {
|
|
2575
2747
|
className: "flex h-11 w-11 items-center justify-center rounded-2xl bg-sky-100 text-sky-700 dark:bg-sky-950 dark:text-sky-300",
|
|
2576
|
-
children: /* @__PURE__ */
|
|
2748
|
+
children: /* @__PURE__ */ R(p, { className: "h-5 w-5" })
|
|
2577
2749
|
}),
|
|
2578
|
-
/* @__PURE__ */
|
|
2750
|
+
/* @__PURE__ */ R("h2", {
|
|
2579
2751
|
className: "mt-4 text-base font-semibold text-slate-950 dark:text-slate-50",
|
|
2580
2752
|
children: "Workspace 文件管理"
|
|
2581
2753
|
}),
|
|
2582
|
-
/* @__PURE__ */
|
|
2754
|
+
/* @__PURE__ */ R("p", {
|
|
2583
2755
|
className: "mt-2 text-sm leading-6 text-slate-600 dark:text-slate-300",
|
|
2584
2756
|
children: "文件浏览、上传、预览仍由 Hosted UI 提供,和原生管理台组合使用覆盖对话与工作区。"
|
|
2585
2757
|
}),
|
|
2586
|
-
r ? /* @__PURE__ */
|
|
2758
|
+
r ? /* @__PURE__ */ z("button", {
|
|
2587
2759
|
type: "button",
|
|
2588
2760
|
onClick: i,
|
|
2589
2761
|
className: "mt-5 inline-flex items-center gap-2 rounded-2xl border border-slate-200 bg-slate-50 px-4 py-2.5 text-sm font-medium text-slate-800 transition hover:bg-slate-100 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100 dark:hover:bg-slate-700",
|
|
2590
|
-
children: [/* @__PURE__ */
|
|
2591
|
-
}) : /* @__PURE__ */
|
|
2762
|
+
children: [/* @__PURE__ */ R(p, { className: "h-4 w-4" }), "打开 Workspace"]
|
|
2763
|
+
}) : /* @__PURE__ */ R("div", {
|
|
2592
2764
|
className: "mt-5 rounded-2xl border border-slate-200 bg-slate-50 px-4 py-3 text-sm leading-6 text-slate-500 dark:border-slate-800 dark:bg-slate-950/40 dark:text-slate-400",
|
|
2593
2765
|
children: "当前链接未开放 Workspace 文件管理。Owner 或 private 链接可使用该能力。"
|
|
2594
2766
|
})
|
|
2595
2767
|
]
|
|
2596
2768
|
}),
|
|
2597
|
-
/* @__PURE__ */
|
|
2769
|
+
/* @__PURE__ */ z("div", {
|
|
2598
2770
|
className: "rounded-3xl border border-slate-200 bg-white p-5 dark:border-slate-800 dark:bg-slate-900",
|
|
2599
2771
|
children: [
|
|
2600
|
-
/* @__PURE__ */
|
|
2772
|
+
/* @__PURE__ */ R("div", {
|
|
2601
2773
|
className: "flex h-11 w-11 items-center justify-center rounded-2xl bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300",
|
|
2602
|
-
children: /* @__PURE__ */
|
|
2774
|
+
children: /* @__PURE__ */ R(M, { className: "h-5 w-5" })
|
|
2603
2775
|
}),
|
|
2604
|
-
/* @__PURE__ */
|
|
2776
|
+
/* @__PURE__ */ R("h2", {
|
|
2605
2777
|
className: "mt-4 text-base font-semibold text-slate-950 dark:text-slate-50",
|
|
2606
2778
|
children: "原生 TUI"
|
|
2607
2779
|
}),
|
|
2608
|
-
/* @__PURE__ */
|
|
2780
|
+
/* @__PURE__ */ R("p", {
|
|
2609
2781
|
className: "mt-2 text-sm leading-6 text-slate-600 dark:text-slate-300",
|
|
2610
2782
|
children: "如果运行时暴露安全的 ks-terminal.v1 通道,可以在这里进入原生终端 UI;share 链接不会开放该入口。"
|
|
2611
2783
|
}),
|
|
2612
|
-
a ? /* @__PURE__ */
|
|
2784
|
+
a ? /* @__PURE__ */ z("button", {
|
|
2613
2785
|
type: "button",
|
|
2614
2786
|
onClick: () => s(!0),
|
|
2615
2787
|
className: "mt-5 inline-flex items-center gap-2 rounded-2xl border border-emerald-200 bg-emerald-50 px-4 py-2.5 text-sm font-medium text-emerald-800 transition hover:bg-emerald-100 dark:border-emerald-900/70 dark:bg-emerald-950/40 dark:text-emerald-200",
|
|
2616
|
-
children: [/* @__PURE__ */
|
|
2617
|
-
}) : /* @__PURE__ */
|
|
2788
|
+
children: [/* @__PURE__ */ R(M, { className: "h-4 w-4" }), "打开 TUI"]
|
|
2789
|
+
}) : /* @__PURE__ */ R("div", {
|
|
2618
2790
|
className: "mt-5 rounded-2xl border border-slate-200 bg-slate-50 px-4 py-3 text-sm leading-6 text-slate-500 dark:border-slate-800 dark:bg-slate-950/40 dark:text-slate-400",
|
|
2619
2791
|
children: "当前运行时未声明可用的浏览器 TUI 能力。"
|
|
2620
2792
|
})
|
|
@@ -2623,9 +2795,9 @@ function Cr({ productLabel: e = "原生运行时", nativeManagementLink: t, nati
|
|
|
2623
2795
|
]
|
|
2624
2796
|
})]
|
|
2625
2797
|
})
|
|
2626
|
-
}), n && o ? /* @__PURE__ */
|
|
2798
|
+
}), n && o ? /* @__PURE__ */ R(H, {
|
|
2627
2799
|
fallback: null,
|
|
2628
|
-
children: /* @__PURE__ */
|
|
2800
|
+
children: /* @__PURE__ */ R(Mr, {
|
|
2629
2801
|
capability: n,
|
|
2630
2802
|
open: o,
|
|
2631
2803
|
onClose: () => s(!1)
|
|
@@ -2635,10 +2807,10 @@ function Cr({ productLabel: e = "原生运行时", nativeManagementLink: t, nati
|
|
|
2635
2807
|
}
|
|
2636
2808
|
//#endregion
|
|
2637
2809
|
//#region src/stores/ui.ts
|
|
2638
|
-
function
|
|
2810
|
+
function Pr(e, t) {
|
|
2639
2811
|
return typeof t == "function" ? t(e) : t;
|
|
2640
2812
|
}
|
|
2641
|
-
var
|
|
2813
|
+
var Fr = I()((e) => ({
|
|
2642
2814
|
sidebarOpen: !0,
|
|
2643
2815
|
mobileSidebarOpen: !1,
|
|
2644
2816
|
mobileActionsOpen: !1,
|
|
@@ -2661,10 +2833,10 @@ var Tr = L()((e) => ({
|
|
|
2661
2833
|
setWorkspacePanelWidth: (t) => e({ workspacePanelWidth: t }),
|
|
2662
2834
|
setWorkspacePanelFullscreen: (t) => e({ workspacePanelFullscreen: t }),
|
|
2663
2835
|
setInput: (t) => e({ input: t }),
|
|
2664
|
-
setAttachments: (t) => e((e) => ({ attachments:
|
|
2836
|
+
setAttachments: (t) => e((e) => ({ attachments: Pr(e.attachments, t) })),
|
|
2665
2837
|
setPreviewAttachment: (t) => e({ previewAttachment: t }),
|
|
2666
2838
|
setPreviewImageSize: (t) => e({ previewImageSize: t }),
|
|
2667
|
-
setQueuedDrafts: (t) => e((e) => ({ queuedDrafts:
|
|
2839
|
+
setQueuedDrafts: (t) => e((e) => ({ queuedDrafts: Pr(e.queuedDrafts, t) })),
|
|
2668
2840
|
pushToast: (t, n = "info") => e((e) => ({ toasts: [...e.toasts, {
|
|
2669
2841
|
id: String(Date.now() + Math.random()),
|
|
2670
2842
|
message: t,
|
|
@@ -2675,14 +2847,14 @@ var Tr = L()((e) => ({
|
|
|
2675
2847
|
}));
|
|
2676
2848
|
//#endregion
|
|
2677
2849
|
//#region src/components/workspace/FileEditor.tsx
|
|
2678
|
-
function
|
|
2850
|
+
function Ir(e) {
|
|
2679
2851
|
let t = String(e || "").split("/").pop() || "", n = t.lastIndexOf(".");
|
|
2680
2852
|
return n >= 0 ? t.slice(n) : "";
|
|
2681
2853
|
}
|
|
2682
|
-
function
|
|
2854
|
+
function Lr(e) {
|
|
2683
2855
|
return Ue.matchFilename(rt, `file${e}`);
|
|
2684
2856
|
}
|
|
2685
|
-
function
|
|
2857
|
+
function Rr({ content: e, path: t, readOnly: n = !1, onSave: r, onDirtyChange: i, onContentChange: a, getContentRef: o }) {
|
|
2686
2858
|
let s = K(null), c = K(null), l = K(new Le()), u = K(new Le()), d = K(new Le()), f = K(!1), p = K(r), m = K(i), h = K(a);
|
|
2687
2859
|
W(() => {
|
|
2688
2860
|
p.current = r, m.current = i, h.current = a;
|
|
@@ -2748,7 +2920,7 @@ function Or({ content: e, path: t, readOnly: n = !1, onSave: r, onDirtyChange: i
|
|
|
2748
2920
|
parent: s.current
|
|
2749
2921
|
});
|
|
2750
2922
|
c.current = a, o && (o.current = () => a.state.doc.toString());
|
|
2751
|
-
let f =
|
|
2923
|
+
let f = Lr(Ir(t));
|
|
2752
2924
|
return f && f.load().then((e) => {
|
|
2753
2925
|
c.current && c.current.dispatch({ effects: l.current.reconfigure(e) });
|
|
2754
2926
|
}).catch(() => {}), () => {
|
|
@@ -2766,7 +2938,7 @@ function Or({ content: e, path: t, readOnly: n = !1, onSave: r, onDirtyChange: i
|
|
|
2766
2938
|
}, [e, g]), W(() => {
|
|
2767
2939
|
let e = c.current;
|
|
2768
2940
|
if (!e) return;
|
|
2769
|
-
let n =
|
|
2941
|
+
let n = Lr(Ir(t));
|
|
2770
2942
|
n ? n.load().then((e) => {
|
|
2771
2943
|
c.current && c.current.dispatch({ effects: l.current.reconfigure(e) });
|
|
2772
2944
|
}).catch(() => {}) : e.dispatch({ effects: l.current.reconfigure([]) });
|
|
@@ -2784,35 +2956,35 @@ function Or({ content: e, path: t, readOnly: n = !1, onSave: r, onDirtyChange: i
|
|
|
2784
2956
|
attributes: !0,
|
|
2785
2957
|
attributeFilter: ["class"]
|
|
2786
2958
|
}), () => e.disconnect();
|
|
2787
|
-
}, []), /* @__PURE__ */
|
|
2959
|
+
}, []), /* @__PURE__ */ R("div", {
|
|
2788
2960
|
ref: s,
|
|
2789
2961
|
className: "h-full w-full overflow-hidden [&_.cm-editor]:h-full [&_.cm-scroller]:auto"
|
|
2790
2962
|
});
|
|
2791
2963
|
}
|
|
2792
2964
|
//#endregion
|
|
2793
2965
|
//#region src/components/workspace/FilePreview.tsx
|
|
2794
|
-
function
|
|
2795
|
-
return n === "markdown" ? /* @__PURE__ */
|
|
2966
|
+
function zr({ content: e, objectUrl: t, kind: n, filename: r, path: i }) {
|
|
2967
|
+
return n === "markdown" ? /* @__PURE__ */ R(Z, { content: e || "" }) : n === "image" && t ? /* @__PURE__ */ R("div", {
|
|
2796
2968
|
className: "flex items-center justify-center p-4",
|
|
2797
|
-
children: /* @__PURE__ */
|
|
2969
|
+
children: /* @__PURE__ */ R("img", {
|
|
2798
2970
|
src: t,
|
|
2799
2971
|
alt: r,
|
|
2800
2972
|
className: "max-h-[70vh] max-w-full rounded object-contain"
|
|
2801
2973
|
})
|
|
2802
|
-
}) : n === "pdf" && t ? /* @__PURE__ */
|
|
2974
|
+
}) : n === "pdf" && t ? /* @__PURE__ */ R("iframe", {
|
|
2803
2975
|
src: t,
|
|
2804
2976
|
title: r,
|
|
2805
2977
|
className: "h-full w-full border-0"
|
|
2806
|
-
}) : (n === "text" || n === "code") && e !== null ? /* @__PURE__ */
|
|
2978
|
+
}) : (n === "text" || n === "code") && e !== null ? /* @__PURE__ */ R(Rr, {
|
|
2807
2979
|
content: e,
|
|
2808
2980
|
path: i || r,
|
|
2809
2981
|
readOnly: !0,
|
|
2810
2982
|
onSave: () => {},
|
|
2811
2983
|
onDirtyChange: () => {},
|
|
2812
2984
|
getContentRef: { current: () => e || "" }
|
|
2813
|
-
}) : /* @__PURE__ */
|
|
2985
|
+
}) : /* @__PURE__ */ R("div", {
|
|
2814
2986
|
className: "flex h-full items-center justify-center px-6 text-center",
|
|
2815
|
-
children: /* @__PURE__ */
|
|
2987
|
+
children: /* @__PURE__ */ R("div", {
|
|
2816
2988
|
className: "w-full max-w-md rounded-2xl border border-dashed border-slate-300 bg-slate-50 px-5 py-5 text-slate-500 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-400",
|
|
2817
2989
|
children: "该文件类型暂不支持在线预览,请直接下载查看。"
|
|
2818
2990
|
})
|
|
@@ -2820,10 +2992,10 @@ function kr({ content: e, objectUrl: t, kind: n, filename: r, path: i }) {
|
|
|
2820
2992
|
}
|
|
2821
2993
|
//#endregion
|
|
2822
2994
|
//#region src/utils/sandbox.ts
|
|
2823
|
-
function
|
|
2995
|
+
function Br(e) {
|
|
2824
2996
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
2825
2997
|
}
|
|
2826
|
-
function
|
|
2998
|
+
function Vr(e) {
|
|
2827
2999
|
let t = e.endsWith("/") ? e : `${e}/`;
|
|
2828
3000
|
if (typeof window > "u") return "'self'";
|
|
2829
3001
|
try {
|
|
@@ -2832,11 +3004,11 @@ function jr(e) {
|
|
|
2832
3004
|
return "'self'";
|
|
2833
3005
|
}
|
|
2834
3006
|
}
|
|
2835
|
-
function
|
|
3007
|
+
function Hr(...e) {
|
|
2836
3008
|
return Array.from(new Set(e.filter((e) => !!e))).join(" ");
|
|
2837
3009
|
}
|
|
2838
|
-
function
|
|
2839
|
-
let t = e ?
|
|
3010
|
+
function Ur(e) {
|
|
3011
|
+
let t = e ? Vr(e) : void 0, n = Hr("'unsafe-inline'", "'unsafe-eval'", "'self'", "https:", t), r = Hr("'self'", "https:", t);
|
|
2840
3012
|
return [
|
|
2841
3013
|
"default-src 'none'",
|
|
2842
3014
|
`script-src ${n}`,
|
|
@@ -2850,7 +3022,7 @@ function Nr(e) {
|
|
|
2850
3022
|
"base-uri 'self'"
|
|
2851
3023
|
].join("; ");
|
|
2852
3024
|
}
|
|
2853
|
-
function
|
|
3025
|
+
function Wr(e) {
|
|
2854
3026
|
try {
|
|
2855
3027
|
let t = new URL(e, window.location.href);
|
|
2856
3028
|
return [
|
|
@@ -2862,8 +3034,8 @@ function Pr(e) {
|
|
|
2862
3034
|
return !1;
|
|
2863
3035
|
}
|
|
2864
3036
|
}
|
|
2865
|
-
function
|
|
2866
|
-
let { channelId: n, basePath: r } = typeof t == "string" ? { channelId: t } : t, i =
|
|
3037
|
+
function Gr(e, t = {}) {
|
|
3038
|
+
let { channelId: n, basePath: r } = typeof t == "string" ? { channelId: t } : t, i = Ur(r), a = `<script>
|
|
2867
3039
|
function ksadkScrollToHash(rawHref) {
|
|
2868
3040
|
if (!rawHref || rawHref === '#') return;
|
|
2869
3041
|
var rawId = rawHref.slice(1);
|
|
@@ -2895,24 +3067,24 @@ document.addEventListener('click', function(event) {
|
|
|
2895
3067
|
}, '*');
|
|
2896
3068
|
}
|
|
2897
3069
|
}, true);
|
|
2898
|
-
<\/script>`, o = `${`<meta http-equiv="Content-Security-Policy" content="${
|
|
3070
|
+
<\/script>`, o = `${`<meta http-equiv="Content-Security-Policy" content="${Br(i)}">`}${r ? `<base href="${Br(r)}">` : ""}${a}`;
|
|
2899
3071
|
return /<head[^>]*>/i.test(e) ? e.replace(/<head[^>]*>/i, `$&${o}`) : `${o}${e}`;
|
|
2900
3072
|
}
|
|
2901
|
-
function
|
|
3073
|
+
function Kr(e, t) {
|
|
2902
3074
|
let n = K(null);
|
|
2903
3075
|
W(() => (n.current = (n) => {
|
|
2904
3076
|
if (n.source !== e.current?.contentWindow || n.data?.type !== "ksadk:linkClick" || t && n.data?.channelId !== t) return;
|
|
2905
3077
|
let r = n.data?.href;
|
|
2906
|
-
typeof r == "string" && r &&
|
|
3078
|
+
typeof r == "string" && r && Wr(r) && window.open(r, "_blank", "noopener,noreferrer");
|
|
2907
3079
|
}, window.addEventListener("message", n.current), () => {
|
|
2908
3080
|
n.current && window.removeEventListener("message", n.current);
|
|
2909
3081
|
}), [e, t]);
|
|
2910
3082
|
}
|
|
2911
|
-
var
|
|
3083
|
+
var qr = "/_ksadk/workspace/v1/files", Jr = new Set([
|
|
2912
3084
|
".md",
|
|
2913
3085
|
".markdown",
|
|
2914
3086
|
".mdx"
|
|
2915
|
-
]),
|
|
3087
|
+
]), Yr = new Set([".pdf"]), Xr = new Set([
|
|
2916
3088
|
".png",
|
|
2917
3089
|
".jpg",
|
|
2918
3090
|
".jpeg",
|
|
@@ -2921,7 +3093,7 @@ var Lr = "/_ksadk/workspace/v1/files", Rr = new Set([
|
|
|
2921
3093
|
".svg",
|
|
2922
3094
|
".bmp",
|
|
2923
3095
|
".ico"
|
|
2924
|
-
]),
|
|
3096
|
+
]), Zr = new Set(/* @__PURE__ */ ".txt,.log,.json,.yaml,.yml,.xml,.html,.css,.js,.jsx,.ts,.tsx,.py,.sh,.sql,.csv,.tsv,.toml,.ini,.env,.lock,.conf,.c,.cc,.cpp,.go,.java,.rs".split(",")), Qr = new Set([
|
|
2925
3097
|
"application/json",
|
|
2926
3098
|
"application/ld+json",
|
|
2927
3099
|
"application/xml",
|
|
@@ -2950,40 +3122,40 @@ function $(e) {
|
|
|
2950
3122
|
}
|
|
2951
3123
|
return n.length > 0 ? n.join("/") : ".";
|
|
2952
3124
|
}
|
|
2953
|
-
function
|
|
3125
|
+
function $r(e) {
|
|
2954
3126
|
let t = $(e);
|
|
2955
3127
|
return t === "." ? "" : t.split("/").filter(Boolean).map((e) => encodeURIComponent(e)).join("/");
|
|
2956
3128
|
}
|
|
2957
|
-
function
|
|
2958
|
-
let t =
|
|
2959
|
-
return t ? `${
|
|
3129
|
+
function ei(e) {
|
|
3130
|
+
let t = $r(e);
|
|
3131
|
+
return t ? `${qr}/${t}` : qr;
|
|
2960
3132
|
}
|
|
2961
|
-
function
|
|
3133
|
+
function ti(e) {
|
|
2962
3134
|
let t = $(e);
|
|
2963
|
-
if (t === "." || !t.includes("/")) return `${
|
|
2964
|
-
let n =
|
|
2965
|
-
return n ? `${
|
|
3135
|
+
if (t === "." || !t.includes("/")) return `${qr}/`;
|
|
3136
|
+
let n = $r(t.substring(0, t.lastIndexOf("/")));
|
|
3137
|
+
return n ? `${qr}/${n}/` : `${qr}/`;
|
|
2966
3138
|
}
|
|
2967
|
-
function
|
|
3139
|
+
function ni(e) {
|
|
2968
3140
|
return $(e) === ".";
|
|
2969
3141
|
}
|
|
2970
|
-
function
|
|
3142
|
+
function ri(e) {
|
|
2971
3143
|
let t = $(e);
|
|
2972
3144
|
return t === "." ? "/" : `/${t}`;
|
|
2973
3145
|
}
|
|
2974
|
-
function
|
|
3146
|
+
function ii(e) {
|
|
2975
3147
|
let t = String(e || "").split("/").pop() || "", n = t.lastIndexOf(".");
|
|
2976
3148
|
return n >= 0 ? t.slice(n).toLowerCase() : "";
|
|
2977
3149
|
}
|
|
2978
|
-
function
|
|
3150
|
+
function ai(e) {
|
|
2979
3151
|
return String(e || "").split(";")[0].trim().toLowerCase();
|
|
2980
3152
|
}
|
|
2981
|
-
var
|
|
2982
|
-
function
|
|
2983
|
-
let n =
|
|
2984
|
-
return r === "text/html" ||
|
|
3153
|
+
var oi = new Set([".html", ".htm"]);
|
|
3154
|
+
function si({ path: e, mimeType: t }) {
|
|
3155
|
+
let n = ii(e), r = ai(t);
|
|
3156
|
+
return r === "text/html" || oi.has(n) ? "html" : r === "text/markdown" || Jr.has(n) ? "markdown" : r === "application/pdf" || Yr.has(n) ? "pdf" : r.startsWith("image/") || Xr.has(n) ? "image" : r.startsWith("text/") || Qr.has(r) || Zr.has(n) ? "text" : "unsupported";
|
|
2985
3157
|
}
|
|
2986
|
-
var
|
|
3158
|
+
var ci = new Set([
|
|
2987
3159
|
".txt",
|
|
2988
3160
|
".log",
|
|
2989
3161
|
".csv",
|
|
@@ -2993,11 +3165,11 @@ var Qr = new Set([
|
|
|
2993
3165
|
".conf",
|
|
2994
3166
|
".lock"
|
|
2995
3167
|
]);
|
|
2996
|
-
function
|
|
2997
|
-
let n =
|
|
2998
|
-
return
|
|
3168
|
+
function li({ path: e, mimeType: t }) {
|
|
3169
|
+
let n = ii(e), r = ai(t);
|
|
3170
|
+
return oi.has(n) || r === "text/html" ? "html" : r === "text/markdown" || Jr.has(n) ? "markdown" : r === "application/pdf" || Yr.has(n) || r.startsWith("image/") || Xr.has(n) ? null : ci.has(n) || r === "text/plain" ? "text" : r.startsWith("text/") || Qr.has(r) || Zr.has(n) ? "code" : null;
|
|
2999
3171
|
}
|
|
3000
|
-
function
|
|
3172
|
+
function ui({ isMobile: e }) {
|
|
3001
3173
|
return e ? {
|
|
3002
3174
|
renderMode: "sheet",
|
|
3003
3175
|
modal: !0,
|
|
@@ -3012,7 +3184,7 @@ function ei({ isMobile: e }) {
|
|
|
3012
3184
|
side: "right"
|
|
3013
3185
|
};
|
|
3014
3186
|
}
|
|
3015
|
-
function
|
|
3187
|
+
function di() {
|
|
3016
3188
|
let e = 0;
|
|
3017
3189
|
return {
|
|
3018
3190
|
next(t) {
|
|
@@ -3029,15 +3201,15 @@ function ti() {
|
|
|
3029
3201
|
}
|
|
3030
3202
|
};
|
|
3031
3203
|
}
|
|
3032
|
-
function
|
|
3204
|
+
function fi({ workspaceFiles: e, accessMode: t }) {
|
|
3033
3205
|
if (!e?.Enabled) return !1;
|
|
3034
3206
|
let n = String(t || "").trim().toLowerCase();
|
|
3035
3207
|
return n === "owner" || n === "private";
|
|
3036
3208
|
}
|
|
3037
3209
|
//#endregion
|
|
3038
3210
|
//#region src/components/workspace/HtmlPreview.tsx
|
|
3039
|
-
function
|
|
3040
|
-
let s = K(null), u = ge(), [d, f] = q("preview"), p =
|
|
3211
|
+
function pi({ content: e, path: t, onSave: n, onDirtyChange: r, getContentRef: i, isMobile: o }) {
|
|
3212
|
+
let s = K(null), u = ge(), [d, f] = q("preview"), p = ti(t), m = ei(t), h = U(() => Gr(e, {
|
|
3041
3213
|
basePath: p,
|
|
3042
3214
|
channelId: u
|
|
3043
3215
|
}), [
|
|
@@ -3050,147 +3222,147 @@ function ri({ content: e, path: t, onSave: n, onDirtyChange: r, getContentRef: i
|
|
|
3050
3222
|
_(h());
|
|
3051
3223
|
}, 300);
|
|
3052
3224
|
return () => clearTimeout(e);
|
|
3053
|
-
}, [h]),
|
|
3225
|
+
}, [h]), Kr(s, u);
|
|
3054
3226
|
let v = U(() => {
|
|
3055
3227
|
let e = new Blob([g], { type: "text/html;charset=utf-8" }), t = URL.createObjectURL(e), n = window.open(t, "_blank", "noopener,noreferrer");
|
|
3056
3228
|
window.setTimeout(() => URL.revokeObjectURL(t), 3e4), n || window.open(m, "_blank", "noopener,noreferrer");
|
|
3057
3229
|
}, [m, g]);
|
|
3058
|
-
return o ? /* @__PURE__ */
|
|
3230
|
+
return o ? /* @__PURE__ */ z("div", {
|
|
3059
3231
|
className: "flex h-full flex-col",
|
|
3060
|
-
children: [/* @__PURE__ */
|
|
3232
|
+
children: [/* @__PURE__ */ z("div", {
|
|
3061
3233
|
className: "flex items-center gap-1 border-b border-slate-200 px-2 py-1.5 dark:border-slate-700",
|
|
3062
|
-
children: [/* @__PURE__ */
|
|
3234
|
+
children: [/* @__PURE__ */ z("button", {
|
|
3063
3235
|
onClick: () => f("editor"),
|
|
3064
3236
|
className: Y("flex items-center gap-1.5 rounded-md px-3 py-1 text-xs font-medium transition-colors", d === "editor" ? "bg-slate-100 text-slate-900 dark:bg-slate-700 dark:text-slate-100" : "text-slate-500 hover:bg-slate-50 dark:text-slate-400 dark:hover:bg-slate-800"),
|
|
3065
|
-
children: [/* @__PURE__ */
|
|
3066
|
-
}), /* @__PURE__ */
|
|
3237
|
+
children: [/* @__PURE__ */ R(a, { className: "h-3.5 w-3.5" }), "编辑"]
|
|
3238
|
+
}), /* @__PURE__ */ z("button", {
|
|
3067
3239
|
onClick: () => f("preview"),
|
|
3068
3240
|
className: Y("flex items-center gap-1.5 rounded-md px-3 py-1 text-xs font-medium transition-colors", d === "preview" ? "bg-slate-100 text-slate-900 dark:bg-slate-700 dark:text-slate-100" : "text-slate-500 hover:bg-slate-50 dark:text-slate-400 dark:hover:bg-slate-800"),
|
|
3069
|
-
children: [/* @__PURE__ */
|
|
3241
|
+
children: [/* @__PURE__ */ R(l, { className: "h-3.5 w-3.5" }), "预览"]
|
|
3070
3242
|
})]
|
|
3071
|
-
}), d === "editor" ? /* @__PURE__ */
|
|
3243
|
+
}), d === "editor" ? /* @__PURE__ */ R(Rr, {
|
|
3072
3244
|
content: e,
|
|
3073
3245
|
path: t,
|
|
3074
3246
|
onSave: n,
|
|
3075
3247
|
onDirtyChange: r,
|
|
3076
3248
|
getContentRef: i
|
|
3077
|
-
}) : /* @__PURE__ */
|
|
3249
|
+
}) : /* @__PURE__ */ R("iframe", {
|
|
3078
3250
|
ref: s,
|
|
3079
3251
|
srcDoc: g,
|
|
3080
3252
|
sandbox: "allow-scripts allow-downloads allow-same-origin",
|
|
3081
3253
|
title: "HTML 预览",
|
|
3082
3254
|
className: "h-full w-full border-0 bg-white"
|
|
3083
3255
|
})]
|
|
3084
|
-
}) : d === "editor" ? /* @__PURE__ */
|
|
3256
|
+
}) : d === "editor" ? /* @__PURE__ */ z("div", {
|
|
3085
3257
|
className: "relative flex h-full flex-col",
|
|
3086
|
-
children: [/* @__PURE__ */
|
|
3258
|
+
children: [/* @__PURE__ */ R(Rr, {
|
|
3087
3259
|
content: e,
|
|
3088
3260
|
path: t,
|
|
3089
3261
|
onSave: n,
|
|
3090
3262
|
onDirtyChange: r,
|
|
3091
3263
|
getContentRef: i
|
|
3092
|
-
}), /* @__PURE__ */
|
|
3264
|
+
}), /* @__PURE__ */ z("button", {
|
|
3093
3265
|
onClick: () => f("preview"),
|
|
3094
3266
|
className: "absolute right-3 top-3 z-10 inline-flex items-center gap-1.5 rounded-lg border border-slate-200 bg-white/90 px-2.5 py-1.5 text-xs font-medium text-slate-600 shadow-sm backdrop-blur-sm transition hover:bg-slate-50 dark:border-slate-700 dark:bg-slate-800/90 dark:text-slate-300 dark:hover:bg-slate-700",
|
|
3095
|
-
children: [/* @__PURE__ */
|
|
3267
|
+
children: [/* @__PURE__ */ R(l, { className: "h-3.5 w-3.5" }), "预览"]
|
|
3096
3268
|
})]
|
|
3097
|
-
}) : /* @__PURE__ */
|
|
3269
|
+
}) : /* @__PURE__ */ z("div", {
|
|
3098
3270
|
className: "relative flex h-full flex-col",
|
|
3099
|
-
children: [/* @__PURE__ */
|
|
3271
|
+
children: [/* @__PURE__ */ R("iframe", {
|
|
3100
3272
|
ref: s,
|
|
3101
3273
|
srcDoc: g,
|
|
3102
3274
|
sandbox: "allow-scripts allow-downloads allow-same-origin",
|
|
3103
3275
|
title: "HTML 预览",
|
|
3104
3276
|
className: "h-full w-full border-0 bg-white"
|
|
3105
|
-
}), /* @__PURE__ */
|
|
3277
|
+
}), /* @__PURE__ */ z("div", {
|
|
3106
3278
|
className: "absolute right-3 top-3 z-10 flex gap-1.5",
|
|
3107
|
-
children: [/* @__PURE__ */
|
|
3279
|
+
children: [/* @__PURE__ */ z("button", {
|
|
3108
3280
|
onClick: v,
|
|
3109
3281
|
className: "inline-flex items-center gap-1.5 rounded-lg border border-slate-200 bg-white/90 px-2.5 py-1.5 text-xs font-medium text-slate-600 shadow-sm backdrop-blur-sm transition hover:bg-slate-50 dark:border-slate-700 dark:bg-slate-800/90 dark:text-slate-300 dark:hover:bg-slate-700",
|
|
3110
3282
|
title: "在新窗口中打开当前预览",
|
|
3111
|
-
children: [/* @__PURE__ */
|
|
3112
|
-
}), /* @__PURE__ */
|
|
3283
|
+
children: [/* @__PURE__ */ R(c, { className: "h-3.5 w-3.5" }), "新窗口"]
|
|
3284
|
+
}), /* @__PURE__ */ z("button", {
|
|
3113
3285
|
onClick: () => f("editor"),
|
|
3114
3286
|
className: "inline-flex items-center gap-1.5 rounded-lg border border-slate-200 bg-white/90 px-2.5 py-1.5 text-xs font-medium text-slate-600 shadow-sm backdrop-blur-sm transition hover:bg-slate-50 dark:border-slate-700 dark:bg-slate-800/90 dark:text-slate-300 dark:hover:bg-slate-700",
|
|
3115
|
-
children: [/* @__PURE__ */
|
|
3287
|
+
children: [/* @__PURE__ */ R(a, { className: "h-3.5 w-3.5" }), "编辑"]
|
|
3116
3288
|
})]
|
|
3117
3289
|
})]
|
|
3118
3290
|
});
|
|
3119
3291
|
}
|
|
3120
3292
|
//#endregion
|
|
3121
3293
|
//#region src/components/workspace/MarkdownPreview.tsx
|
|
3122
|
-
function
|
|
3294
|
+
function mi(e) {
|
|
3123
3295
|
e.current && clearTimeout(e.current);
|
|
3124
3296
|
}
|
|
3125
|
-
function
|
|
3297
|
+
function hi({ content: e, path: t, onSave: n, onDirtyChange: r, getContentRef: i, isMobile: o }) {
|
|
3126
3298
|
let [s, c] = q("editor"), [u, d] = q(e), f = K(null);
|
|
3127
|
-
return W(() => (
|
|
3299
|
+
return W(() => (mi(f), f.current = setTimeout(() => d(e), 300), () => mi(f)), [e]), o ? /* @__PURE__ */ z("div", {
|
|
3128
3300
|
className: "flex h-full flex-col",
|
|
3129
|
-
children: [/* @__PURE__ */
|
|
3301
|
+
children: [/* @__PURE__ */ z("div", {
|
|
3130
3302
|
className: "flex items-center gap-1 border-b border-slate-200/30 px-2 py-1.5 dark:border-slate-700/30",
|
|
3131
|
-
children: [/* @__PURE__ */
|
|
3303
|
+
children: [/* @__PURE__ */ z("button", {
|
|
3132
3304
|
onClick: () => c("editor"),
|
|
3133
3305
|
className: Y("flex items-center gap-1.5 rounded-md px-3 py-1 text-xs font-medium transition-colors", s === "editor" ? "bg-slate-100 text-slate-900 dark:bg-slate-700 dark:text-slate-100" : "text-slate-500 hover:bg-slate-50 dark:text-slate-400 dark:hover:bg-slate-800"),
|
|
3134
|
-
children: [/* @__PURE__ */
|
|
3135
|
-
}), /* @__PURE__ */
|
|
3306
|
+
children: [/* @__PURE__ */ R(a, { className: "h-3.5 w-3.5" }), "编辑"]
|
|
3307
|
+
}), /* @__PURE__ */ z("button", {
|
|
3136
3308
|
onClick: () => c("preview"),
|
|
3137
3309
|
className: Y("flex items-center gap-1.5 rounded-md px-3 py-1 text-xs font-medium transition-colors", s === "preview" ? "bg-slate-100 text-slate-900 dark:bg-slate-700 dark:text-slate-100" : "text-slate-500 hover:bg-slate-50 dark:text-slate-400 dark:hover:bg-slate-800"),
|
|
3138
|
-
children: [/* @__PURE__ */
|
|
3310
|
+
children: [/* @__PURE__ */ R(l, { className: "h-3.5 w-3.5" }), "预览"]
|
|
3139
3311
|
})]
|
|
3140
|
-
}), s === "editor" ? /* @__PURE__ */
|
|
3312
|
+
}), s === "editor" ? /* @__PURE__ */ R(Rr, {
|
|
3141
3313
|
content: e,
|
|
3142
3314
|
path: t,
|
|
3143
3315
|
onSave: n,
|
|
3144
3316
|
onDirtyChange: r,
|
|
3145
3317
|
getContentRef: i
|
|
3146
|
-
}) : /* @__PURE__ */
|
|
3318
|
+
}) : /* @__PURE__ */ R("div", {
|
|
3147
3319
|
className: "flex-1 overflow-auto p-4",
|
|
3148
|
-
children: /* @__PURE__ */
|
|
3320
|
+
children: /* @__PURE__ */ R(Z, { content: u })
|
|
3149
3321
|
})]
|
|
3150
|
-
}) : s === "editor" ? /* @__PURE__ */
|
|
3322
|
+
}) : s === "editor" ? /* @__PURE__ */ z("div", {
|
|
3151
3323
|
className: "relative flex h-full flex-col",
|
|
3152
|
-
children: [/* @__PURE__ */
|
|
3324
|
+
children: [/* @__PURE__ */ R(Rr, {
|
|
3153
3325
|
content: e,
|
|
3154
3326
|
path: t,
|
|
3155
3327
|
onSave: n,
|
|
3156
3328
|
onDirtyChange: r,
|
|
3157
3329
|
getContentRef: i
|
|
3158
|
-
}), /* @__PURE__ */
|
|
3330
|
+
}), /* @__PURE__ */ z("button", {
|
|
3159
3331
|
onClick: () => c("preview"),
|
|
3160
3332
|
className: "absolute right-3 top-3 z-10 inline-flex items-center gap-1.5 rounded-lg border border-slate-200/30 bg-white/90 px-2.5 py-1.5 text-xs font-medium text-slate-600 shadow-sm backdrop-blur-sm transition hover:bg-slate-50 dark:border-slate-700 dark:bg-slate-800/90 dark:text-slate-300 dark:hover:bg-slate-700",
|
|
3161
|
-
children: [/* @__PURE__ */
|
|
3333
|
+
children: [/* @__PURE__ */ R(l, { className: "h-3.5 w-3.5" }), "预览"]
|
|
3162
3334
|
})]
|
|
3163
|
-
}) : /* @__PURE__ */
|
|
3335
|
+
}) : /* @__PURE__ */ z("div", {
|
|
3164
3336
|
className: "relative flex h-full flex-col",
|
|
3165
|
-
children: [/* @__PURE__ */
|
|
3337
|
+
children: [/* @__PURE__ */ R("div", {
|
|
3166
3338
|
className: "flex-1 overflow-auto p-4",
|
|
3167
|
-
children: /* @__PURE__ */
|
|
3168
|
-
}), /* @__PURE__ */
|
|
3339
|
+
children: /* @__PURE__ */ R(Z, { content: u })
|
|
3340
|
+
}), /* @__PURE__ */ z("button", {
|
|
3169
3341
|
onClick: () => c("editor"),
|
|
3170
3342
|
className: "absolute right-3 top-3 z-10 inline-flex items-center gap-1.5 rounded-lg border border-slate-200/30 bg-white/90 px-2.5 py-1.5 text-xs font-medium text-slate-600 shadow-sm backdrop-blur-sm transition hover:bg-slate-50 dark:border-slate-700 dark:bg-slate-800/90 dark:text-slate-300 dark:hover:bg-slate-700",
|
|
3171
|
-
children: [/* @__PURE__ */
|
|
3343
|
+
children: [/* @__PURE__ */ R(a, { className: "h-3.5 w-3.5" }), "编辑"]
|
|
3172
3344
|
})]
|
|
3173
3345
|
});
|
|
3174
3346
|
}
|
|
3175
3347
|
//#endregion
|
|
3176
3348
|
//#region src/components/workspace/WorkspacePanel.tsx
|
|
3177
|
-
var
|
|
3178
|
-
function
|
|
3349
|
+
var gi = "/agentengine/api/v1/GetWorkspaceFileContent", _i = 4e3;
|
|
3350
|
+
function vi(e) {
|
|
3179
3351
|
let t = $(e);
|
|
3180
3352
|
if (!t || t === ".") return ".";
|
|
3181
3353
|
let n = t.split("/").filter(Boolean);
|
|
3182
3354
|
return n.length <= 1 ? "." : n.slice(0, -1).join("/");
|
|
3183
3355
|
}
|
|
3184
|
-
function
|
|
3356
|
+
function yi(e) {
|
|
3185
3357
|
if (!e) return "";
|
|
3186
3358
|
let t = Date.parse(e);
|
|
3187
3359
|
return Number.isNaN(t) ? e : new Date(t).toLocaleString();
|
|
3188
3360
|
}
|
|
3189
|
-
function
|
|
3361
|
+
function bi(e) {
|
|
3190
3362
|
let t = Number(e);
|
|
3191
3363
|
return !Number.isFinite(t) || t <= 0 ? "0 B" : t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(1)} KB` : t < 1024 * 1024 * 1024 ? `${(t / (1024 * 1024)).toFixed(1)} MB` : `${(t / (1024 * 1024 * 1024)).toFixed(1)} GB`;
|
|
3192
3364
|
}
|
|
3193
|
-
var
|
|
3365
|
+
var xi = [
|
|
3194
3366
|
{
|
|
3195
3367
|
label: "Markdown",
|
|
3196
3368
|
detail: ".md .markdown .mdx"
|
|
@@ -3212,35 +3384,35 @@ var di = [
|
|
|
3212
3384
|
detail: "CSV TSV"
|
|
3213
3385
|
}
|
|
3214
3386
|
];
|
|
3215
|
-
function
|
|
3216
|
-
return
|
|
3387
|
+
function Si(e) {
|
|
3388
|
+
return ei(e);
|
|
3217
3389
|
}
|
|
3218
|
-
function
|
|
3219
|
-
return /* @__PURE__ */
|
|
3390
|
+
function Ci({ label: e, showSupportedTypes: t = !1 }) {
|
|
3391
|
+
return /* @__PURE__ */ R("div", {
|
|
3220
3392
|
className: "flex h-full min-h-[16rem] flex-col items-center justify-center px-6 text-center",
|
|
3221
|
-
children: /* @__PURE__ */
|
|
3393
|
+
children: /* @__PURE__ */ z("div", {
|
|
3222
3394
|
className: "w-full max-w-md rounded-2xl border border-dashed border-slate-300 bg-slate-50 px-5 py-5 text-slate-500 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-400",
|
|
3223
|
-
children: [/* @__PURE__ */
|
|
3395
|
+
children: [/* @__PURE__ */ R("div", { children: e }), t ? /* @__PURE__ */ z("div", {
|
|
3224
3396
|
className: "mt-4 text-left",
|
|
3225
3397
|
children: [
|
|
3226
|
-
/* @__PURE__ */
|
|
3398
|
+
/* @__PURE__ */ R("div", {
|
|
3227
3399
|
className: "text-xs font-semibold uppercase tracking-[0.12em] text-slate-400",
|
|
3228
3400
|
children: "支持在线预览"
|
|
3229
3401
|
}),
|
|
3230
|
-
/* @__PURE__ */
|
|
3402
|
+
/* @__PURE__ */ R("div", {
|
|
3231
3403
|
className: "mt-2 grid gap-2",
|
|
3232
|
-
children:
|
|
3404
|
+
children: xi.map((e) => /* @__PURE__ */ z("div", {
|
|
3233
3405
|
className: "rounded-xl border border-slate-200 bg-white px-3 py-2 dark:border-slate-800 dark:bg-slate-950",
|
|
3234
|
-
children: [/* @__PURE__ */
|
|
3406
|
+
children: [/* @__PURE__ */ R("div", {
|
|
3235
3407
|
className: "text-sm font-medium text-slate-700 dark:text-slate-200",
|
|
3236
3408
|
children: e.label
|
|
3237
|
-
}), /* @__PURE__ */
|
|
3409
|
+
}), /* @__PURE__ */ R("div", {
|
|
3238
3410
|
className: "mt-0.5 font-mono text-[11px] text-slate-400",
|
|
3239
3411
|
children: e.detail
|
|
3240
3412
|
})]
|
|
3241
3413
|
}, e.label))
|
|
3242
3414
|
}),
|
|
3243
|
-
/* @__PURE__ */
|
|
3415
|
+
/* @__PURE__ */ R("div", {
|
|
3244
3416
|
className: "mt-3 text-xs leading-5 text-slate-400",
|
|
3245
3417
|
children: "Word、Excel、PPT 当前不支持在线预览,可下载后查看。"
|
|
3246
3418
|
})
|
|
@@ -3249,11 +3421,11 @@ function pi({ label: e, showSupportedTypes: t = !1 }) {
|
|
|
3249
3421
|
})
|
|
3250
3422
|
});
|
|
3251
3423
|
}
|
|
3252
|
-
function
|
|
3253
|
-
let d = K(null), m = K(null), [h, v] = q(!1), [b, x] = q("."), [C, ee] = q([]), [T, E] = q(!1), [D, te] = q(!1), [O, ie] = q(!1), [ae, k] = q(""), [A, oe] = q(null), [j, M] = q(null), [N, P] = q(!1), [le, ue] = q(!1), F = K(null), fe = K(null), pe = K("selection"),
|
|
3254
|
-
path:
|
|
3255
|
-
mimeType:
|
|
3256
|
-
}) : null, [
|
|
3424
|
+
function wi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a = !1, onToggleFullscreen: o, isMobile: c = !1, api: l }) {
|
|
3425
|
+
let d = K(null), m = K(null), [h, v] = q(!1), [b, x] = q("."), [C, ee] = q([]), [T, E] = q(!1), [D, te] = q(!1), [O, ie] = q(!1), [ae, k] = q(""), [A, oe] = q(null), [j, M] = q(null), [N, P] = q(!1), [le, ue] = q(!1), F = K(null), fe = K(null), pe = K("selection"), me = K(di()), I = _e(() => C.find((e) => e.Path === A) ?? null, [C, A]), L = _e(() => I ? li({
|
|
3426
|
+
path: I.Path,
|
|
3427
|
+
mimeType: I.MimeType
|
|
3428
|
+
}) : null, [I]), B = U(() => N ? window.confirm("当前文件有未保存的更改,确定要离开吗?") : !0, [N]), V = n.ContentPath || gi, H = n.RootLabel || "Workspace", he = H ? `${H.charAt(0).toUpperCase()}${H.slice(1)}` : "Workspace", ge = ri(b), G = U(() => {
|
|
3257
3429
|
m.current &&= (URL.revokeObjectURL(m.current), null);
|
|
3258
3430
|
}, []);
|
|
3259
3431
|
W(() => () => G(), [G]);
|
|
@@ -3285,7 +3457,7 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3285
3457
|
if (!r || N || !h) return;
|
|
3286
3458
|
let e = window.setInterval(() => {
|
|
3287
3459
|
J(b, { background: !0 });
|
|
3288
|
-
},
|
|
3460
|
+
}, _i);
|
|
3289
3461
|
return () => window.clearInterval(e);
|
|
3290
3462
|
}, [
|
|
3291
3463
|
b,
|
|
@@ -3295,7 +3467,7 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3295
3467
|
r
|
|
3296
3468
|
]);
|
|
3297
3469
|
let ve = U(async (t) => {
|
|
3298
|
-
let n =
|
|
3470
|
+
let n = me.current.next(t.Path), r = si({
|
|
3299
3471
|
path: t.Path,
|
|
3300
3472
|
mimeType: t.MimeType
|
|
3301
3473
|
});
|
|
@@ -3316,9 +3488,9 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3316
3488
|
});
|
|
3317
3489
|
try {
|
|
3318
3490
|
let r = await l.getWorkspaceFileContent(e, t.Path, { asText: !1 });
|
|
3319
|
-
if (!
|
|
3491
|
+
if (!me.current.isCurrent(n)) return;
|
|
3320
3492
|
if (r instanceof Blob) {
|
|
3321
|
-
let e = t.MimeType || "", i =
|
|
3493
|
+
let e = t.MimeType || "", i = si({
|
|
3322
3494
|
path: t.Path,
|
|
3323
3495
|
mimeType: e
|
|
3324
3496
|
});
|
|
@@ -3334,8 +3506,8 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3334
3506
|
return;
|
|
3335
3507
|
}
|
|
3336
3508
|
let a = await r.text();
|
|
3337
|
-
if (!
|
|
3338
|
-
let o =
|
|
3509
|
+
if (!me.current.isCurrent(n)) return;
|
|
3510
|
+
let o = si({
|
|
3339
3511
|
path: t.Path,
|
|
3340
3512
|
mimeType: e
|
|
3341
3513
|
});
|
|
@@ -3347,7 +3519,7 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3347
3519
|
content: a
|
|
3348
3520
|
});
|
|
3349
3521
|
} else {
|
|
3350
|
-
let e = t.MimeType || "", n =
|
|
3522
|
+
let e = t.MimeType || "", n = si({
|
|
3351
3523
|
path: t.Path,
|
|
3352
3524
|
mimeType: e
|
|
3353
3525
|
});
|
|
@@ -3360,7 +3532,7 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3360
3532
|
});
|
|
3361
3533
|
}
|
|
3362
3534
|
} catch (e) {
|
|
3363
|
-
if (!
|
|
3535
|
+
if (!me.current.isCurrent(n)) return;
|
|
3364
3536
|
console.error("Failed to preview workspace file:", e), M({
|
|
3365
3537
|
path: t.Path,
|
|
3366
3538
|
kind: r,
|
|
@@ -3375,19 +3547,19 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3375
3547
|
G
|
|
3376
3548
|
]);
|
|
3377
3549
|
W(() => {
|
|
3378
|
-
if (!
|
|
3550
|
+
if (!I || I.Type !== "file") {
|
|
3379
3551
|
G(), M(null), P(!1), fe.current = null;
|
|
3380
3552
|
return;
|
|
3381
3553
|
}
|
|
3382
|
-
if (pe.current === "background-refresh" && fe.current ===
|
|
3554
|
+
if (pe.current === "background-refresh" && fe.current === I.Path) {
|
|
3383
3555
|
pe.current = "selection";
|
|
3384
3556
|
return;
|
|
3385
3557
|
}
|
|
3386
|
-
pe.current = "selection", ve(
|
|
3558
|
+
pe.current = "selection", ve(I);
|
|
3387
3559
|
}, [
|
|
3388
3560
|
G,
|
|
3389
3561
|
ve,
|
|
3390
|
-
|
|
3562
|
+
I
|
|
3391
3563
|
]);
|
|
3392
3564
|
let ye = async (t) => {
|
|
3393
3565
|
if (!(!t || t.length === 0)) {
|
|
@@ -3395,7 +3567,7 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3395
3567
|
try {
|
|
3396
3568
|
for (let r of Array.from(t)) {
|
|
3397
3569
|
if (r.size > n.MaxUploadBytes) throw Error(`文件 ${r.name} 超过上传上限`);
|
|
3398
|
-
let t =
|
|
3570
|
+
let t = ni(b) ? r.name : `${b}/${r.name}`, i = new FormData();
|
|
3399
3571
|
i.append("file", r), i.append("AgentId", e), i.append("Path", t), await l.addWorkspaceFile(i);
|
|
3400
3572
|
}
|
|
3401
3573
|
await J(b);
|
|
@@ -3411,122 +3583,122 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3411
3583
|
if (window.confirm(`删除 ${r} ?`)) {
|
|
3412
3584
|
k("");
|
|
3413
3585
|
try {
|
|
3414
|
-
await l.deleteWorkspaceFile(e, r), A && $(A) === r && (oe(null), P(!1)), await J(t.Type === "directory" && ($(b) === r || $(b).startsWith(`${r}/`)) ?
|
|
3586
|
+
await l.deleteWorkspaceFile(e, r), A && $(A) === r && (oe(null), P(!1)), await J(t.Type === "directory" && ($(b) === r || $(b).startsWith(`${r}/`)) ? vi(r) : b);
|
|
3415
3587
|
} catch (e) {
|
|
3416
3588
|
console.error("Failed to delete workspace file:", e), k(e instanceof Error ? e.message : String(e));
|
|
3417
3589
|
}
|
|
3418
3590
|
}
|
|
3419
|
-
}, xe = () => !
|
|
3591
|
+
}, xe = () => !I || I.Type !== "file" ? /* @__PURE__ */ R(Ci, {
|
|
3420
3592
|
label: "从左侧选择文件后在这里查看内容预览。",
|
|
3421
3593
|
showSupportedTypes: !0
|
|
3422
|
-
}) : !j || j.path !==
|
|
3594
|
+
}) : !j || j.path !== I.Path || j.status === "loading" ? /* @__PURE__ */ R("div", {
|
|
3423
3595
|
className: "flex h-full min-h-[16rem] items-center justify-center",
|
|
3424
|
-
children: /* @__PURE__ */
|
|
3596
|
+
children: /* @__PURE__ */ z("div", {
|
|
3425
3597
|
className: "inline-flex items-center gap-2 rounded-full border border-slate-200 bg-white px-4 py-2 text-sm text-slate-500 shadow-sm dark:border-slate-800 dark:bg-slate-900 dark:text-slate-400",
|
|
3426
|
-
children: [/* @__PURE__ */
|
|
3598
|
+
children: [/* @__PURE__ */ R(_, { className: "h-4 w-4 animate-spin" }), "正在加载预览..."]
|
|
3427
3599
|
})
|
|
3428
|
-
}) : j.status === "error" ? /* @__PURE__ */
|
|
3600
|
+
}) : j.status === "error" ? /* @__PURE__ */ R(Ci, { label: j.error || "文件预览加载失败。" }) : j.kind === "markdown" ? /* @__PURE__ */ R(hi, {
|
|
3429
3601
|
content: j.content || "",
|
|
3430
|
-
path:
|
|
3602
|
+
path: I.Path,
|
|
3431
3603
|
onSave: Se,
|
|
3432
3604
|
onDirtyChange: P,
|
|
3433
3605
|
getContentRef: F,
|
|
3434
3606
|
isMobile: c
|
|
3435
|
-
}) : j.kind === "image" && j.objectUrl ? /* @__PURE__ */
|
|
3607
|
+
}) : j.kind === "image" && j.objectUrl ? /* @__PURE__ */ R(zr, {
|
|
3436
3608
|
content: null,
|
|
3437
3609
|
objectUrl: j.objectUrl,
|
|
3438
3610
|
kind: "image",
|
|
3439
|
-
filename:
|
|
3611
|
+
filename: I.Name,
|
|
3440
3612
|
mimeType: j.mimeType || ""
|
|
3441
|
-
}) : j.kind === "pdf" && j.objectUrl ? /* @__PURE__ */
|
|
3613
|
+
}) : j.kind === "pdf" && j.objectUrl ? /* @__PURE__ */ R(zr, {
|
|
3442
3614
|
content: null,
|
|
3443
3615
|
objectUrl: j.objectUrl,
|
|
3444
3616
|
kind: "pdf",
|
|
3445
|
-
filename:
|
|
3617
|
+
filename: I.Name,
|
|
3446
3618
|
mimeType: j.mimeType || ""
|
|
3447
|
-
}) : j.kind === "html" ? /* @__PURE__ */
|
|
3619
|
+
}) : j.kind === "html" ? /* @__PURE__ */ R(pi, {
|
|
3448
3620
|
content: j.content || "",
|
|
3449
|
-
path:
|
|
3621
|
+
path: I.Path,
|
|
3450
3622
|
onSave: Se,
|
|
3451
3623
|
onDirtyChange: P,
|
|
3452
3624
|
getContentRef: F,
|
|
3453
3625
|
isMobile: c,
|
|
3454
3626
|
agentId: e,
|
|
3455
|
-
contentPath:
|
|
3456
|
-
}) : j.kind === "text" || j.kind === "code" ? /* @__PURE__ */
|
|
3627
|
+
contentPath: V
|
|
3628
|
+
}) : j.kind === "text" || j.kind === "code" ? /* @__PURE__ */ R(Rr, {
|
|
3457
3629
|
content: j.content || "",
|
|
3458
|
-
path:
|
|
3630
|
+
path: I.Path,
|
|
3459
3631
|
onSave: Se,
|
|
3460
3632
|
onDirtyChange: P,
|
|
3461
3633
|
getContentRef: F
|
|
3462
|
-
}) : /* @__PURE__ */
|
|
3634
|
+
}) : /* @__PURE__ */ R(zr, {
|
|
3463
3635
|
content: null,
|
|
3464
3636
|
kind: "unsupported",
|
|
3465
|
-
filename:
|
|
3637
|
+
filename: I.Name,
|
|
3466
3638
|
mimeType: j.mimeType || ""
|
|
3467
3639
|
}), Se = async (t) => {
|
|
3468
|
-
if (
|
|
3640
|
+
if (I) {
|
|
3469
3641
|
ue(!0), k("");
|
|
3470
3642
|
try {
|
|
3471
|
-
let n = new Blob([t], { type:
|
|
3472
|
-
r.append("file", n,
|
|
3643
|
+
let n = new Blob([t], { type: I.MimeType || "text/plain" }), r = new FormData();
|
|
3644
|
+
r.append("file", n, I.Name), r.append("AgentId", e), r.append("Path", I.Path), await l.addWorkspaceFile(r), me.current.invalidate(), P(!1), M((e) => e && e.path === I.Path ? {
|
|
3473
3645
|
...e,
|
|
3474
3646
|
content: t
|
|
3475
|
-
} : e), fe.current =
|
|
3647
|
+
} : e), fe.current = I.Path, await J(b, { background: !0 });
|
|
3476
3648
|
} catch (e) {
|
|
3477
3649
|
console.error("Failed to save workspace file:", e), k(e instanceof Error ? e.message : String(e));
|
|
3478
3650
|
} finally {
|
|
3479
3651
|
ue(!1);
|
|
3480
3652
|
}
|
|
3481
3653
|
}
|
|
3482
|
-
}, Ce =
|
|
3483
|
-
return /* @__PURE__ */
|
|
3654
|
+
}, Ce = I?.Type === "file" && j?.path === I.Path && j.status === "ready" && (j.kind === "text" || j.kind === "code" || j.kind === "html" || j.kind === "markdown"), we = I?.Type === "file" && j?.path === I.Path && j.status === "ready" && j.kind === "pdf";
|
|
3655
|
+
return /* @__PURE__ */ z("div", {
|
|
3484
3656
|
className: "flex h-full min-h-[22rem] w-full min-w-0 flex-col bg-white text-slate-800 dark:bg-slate-950 dark:text-slate-200",
|
|
3485
|
-
children: [/* @__PURE__ */
|
|
3657
|
+
children: [/* @__PURE__ */ z("div", {
|
|
3486
3658
|
className: "flex h-14 flex-shrink-0 items-center gap-3 border-b border-slate-200/30 px-4 dark:border-slate-800/40",
|
|
3487
|
-
children: [/* @__PURE__ */
|
|
3659
|
+
children: [/* @__PURE__ */ z("div", {
|
|
3488
3660
|
className: "flex min-w-0 flex-1 items-center gap-3",
|
|
3489
3661
|
children: [
|
|
3490
|
-
/* @__PURE__ */
|
|
3662
|
+
/* @__PURE__ */ R("div", {
|
|
3491
3663
|
className: "truncate text-sm font-semibold text-slate-900 dark:text-slate-100",
|
|
3492
3664
|
children: he
|
|
3493
3665
|
}),
|
|
3494
|
-
/* @__PURE__ */
|
|
3495
|
-
/* @__PURE__ */
|
|
3666
|
+
/* @__PURE__ */ R("div", { className: "hidden h-4 w-px bg-slate-200/70 dark:bg-slate-800 sm:block" }),
|
|
3667
|
+
/* @__PURE__ */ z("div", {
|
|
3496
3668
|
className: "flex min-w-0 items-center gap-2",
|
|
3497
|
-
children: [/* @__PURE__ */
|
|
3669
|
+
children: [/* @__PURE__ */ R("span", {
|
|
3498
3670
|
className: "flex-shrink-0 text-xs text-slate-400",
|
|
3499
3671
|
children: "当前目录"
|
|
3500
|
-
}), /* @__PURE__ */
|
|
3672
|
+
}), /* @__PURE__ */ R("div", {
|
|
3501
3673
|
className: "custom-scrollbar max-w-[min(42vw,34rem)] overflow-x-auto whitespace-nowrap rounded-md bg-slate-50 px-2 py-1 font-mono text-[11px] text-slate-600 dark:bg-slate-900 dark:text-slate-300",
|
|
3502
3674
|
title: `${ge},来自 ListWorkspaceFiles 返回的 Data.Path 字段`,
|
|
3503
3675
|
children: ge
|
|
3504
3676
|
})]
|
|
3505
3677
|
}),
|
|
3506
|
-
/* @__PURE__ */
|
|
3678
|
+
/* @__PURE__ */ R("div", {
|
|
3507
3679
|
className: "hidden truncate text-[11px] text-slate-400 xl:block",
|
|
3508
3680
|
children: "工作区内相对路径,不是宿主机绝对路径。"
|
|
3509
3681
|
})
|
|
3510
3682
|
]
|
|
3511
|
-
}), /* @__PURE__ */
|
|
3683
|
+
}), /* @__PURE__ */ z("div", {
|
|
3512
3684
|
className: "flex flex-shrink-0 items-center gap-1.5",
|
|
3513
3685
|
children: [
|
|
3514
|
-
/* @__PURE__ */
|
|
3686
|
+
/* @__PURE__ */ R("input", {
|
|
3515
3687
|
ref: d,
|
|
3516
3688
|
type: "file",
|
|
3517
3689
|
multiple: !0,
|
|
3518
3690
|
className: "hidden",
|
|
3519
3691
|
onChange: (e) => void ye(e.target.files)
|
|
3520
3692
|
}),
|
|
3521
|
-
/* @__PURE__ */
|
|
3693
|
+
/* @__PURE__ */ z("button", {
|
|
3522
3694
|
type: "button",
|
|
3523
3695
|
onClick: () => d.current?.click(),
|
|
3524
3696
|
disabled: O,
|
|
3525
3697
|
className: "inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium text-slate-600 transition hover:bg-slate-100 disabled:cursor-not-allowed disabled:opacity-50 dark:text-slate-300 dark:hover:bg-slate-900",
|
|
3526
3698
|
title: `上传文件,上限 ${Math.floor(n.MaxUploadBytes / (1024 * 1024))}MB`,
|
|
3527
|
-
children: [/* @__PURE__ */
|
|
3699
|
+
children: [/* @__PURE__ */ R(ce, { className: "h-3.5 w-3.5" }), O ? "上传中" : "上传"]
|
|
3528
3700
|
}),
|
|
3529
|
-
/* @__PURE__ */
|
|
3701
|
+
/* @__PURE__ */ z("button", {
|
|
3530
3702
|
type: "button",
|
|
3531
3703
|
onClick: () => {
|
|
3532
3704
|
let e = new URLSearchParams({ Path: b }).toString();
|
|
@@ -3534,165 +3706,165 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3534
3706
|
},
|
|
3535
3707
|
className: "inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium text-slate-600 transition hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-900",
|
|
3536
3708
|
title: "导出当前目录为 ZIP",
|
|
3537
|
-
children: [/* @__PURE__ */
|
|
3709
|
+
children: [/* @__PURE__ */ R(w, { className: "h-3.5 w-3.5" }), "导出"]
|
|
3538
3710
|
}),
|
|
3539
|
-
o ? /* @__PURE__ */
|
|
3711
|
+
o ? /* @__PURE__ */ R("button", {
|
|
3540
3712
|
type: "button",
|
|
3541
3713
|
onClick: o,
|
|
3542
3714
|
className: "rounded-lg p-1.5 text-slate-500 transition hover:bg-slate-100 hover:text-slate-900 dark:text-slate-400 dark:hover:bg-slate-900 dark:hover:text-slate-100",
|
|
3543
3715
|
"aria-label": a ? "退出全屏" : "全屏查看 Workspace",
|
|
3544
3716
|
title: a ? "退出全屏" : "全屏查看",
|
|
3545
|
-
children:
|
|
3717
|
+
children: R(a ? S : y, { className: "h-4 w-4" })
|
|
3546
3718
|
}) : null,
|
|
3547
|
-
i ? /* @__PURE__ */
|
|
3719
|
+
i ? /* @__PURE__ */ R("button", {
|
|
3548
3720
|
type: "button",
|
|
3549
3721
|
onClick: () => {
|
|
3550
|
-
|
|
3722
|
+
B() && i?.();
|
|
3551
3723
|
},
|
|
3552
3724
|
className: "rounded-lg p-1.5 text-slate-500 transition hover:bg-slate-100 hover:text-slate-900 dark:text-slate-400 dark:hover:bg-slate-900 dark:hover:text-slate-100",
|
|
3553
3725
|
"aria-label": "关闭 Workspace",
|
|
3554
3726
|
title: "关闭",
|
|
3555
|
-
children: /* @__PURE__ */
|
|
3727
|
+
children: /* @__PURE__ */ R(de, { className: "h-4 w-4" })
|
|
3556
3728
|
}) : null
|
|
3557
3729
|
]
|
|
3558
3730
|
})]
|
|
3559
|
-
}), /* @__PURE__ */
|
|
3731
|
+
}), /* @__PURE__ */ z("div", {
|
|
3560
3732
|
className: "flex min-h-0 flex-1 flex-col md:flex-row",
|
|
3561
|
-
children: [/* @__PURE__ */
|
|
3733
|
+
children: [/* @__PURE__ */ z("div", {
|
|
3562
3734
|
className: "flex w-full flex-col border-b border-slate-200/30 dark:border-slate-800/40 md:w-[13.5rem] md:border-b-0 md:border-r",
|
|
3563
|
-
children: [/* @__PURE__ */
|
|
3735
|
+
children: [/* @__PURE__ */ z("div", {
|
|
3564
3736
|
className: "flex h-14 flex-shrink-0 items-center border-b border-slate-200/30 px-3 dark:border-slate-800/40",
|
|
3565
|
-
children: [/* @__PURE__ */
|
|
3737
|
+
children: [/* @__PURE__ */ z("div", {
|
|
3566
3738
|
className: "flex items-center justify-between gap-2",
|
|
3567
|
-
children: [/* @__PURE__ */
|
|
3739
|
+
children: [/* @__PURE__ */ z("div", {
|
|
3568
3740
|
className: "min-w-0",
|
|
3569
|
-
children: [/* @__PURE__ */
|
|
3741
|
+
children: [/* @__PURE__ */ R("div", {
|
|
3570
3742
|
className: "text-xs font-medium text-slate-900 dark:text-slate-100",
|
|
3571
3743
|
children: "文件"
|
|
3572
|
-
}), /* @__PURE__ */
|
|
3744
|
+
}), /* @__PURE__ */ z("div", {
|
|
3573
3745
|
className: "flex items-center gap-1 text-[11px] text-slate-400",
|
|
3574
|
-
children: [/* @__PURE__ */
|
|
3746
|
+
children: [/* @__PURE__ */ z("span", { children: [C.length, " 项"] }), D ? /* @__PURE__ */ R(ne, {
|
|
3575
3747
|
className: "h-3 w-3 animate-spin",
|
|
3576
3748
|
"aria-label": "正在同步 Workspace 目录"
|
|
3577
3749
|
}) : null]
|
|
3578
3750
|
})]
|
|
3579
|
-
}), /* @__PURE__ */
|
|
3751
|
+
}), /* @__PURE__ */ z("div", {
|
|
3580
3752
|
className: "flex items-center gap-1",
|
|
3581
|
-
children: [/* @__PURE__ */
|
|
3753
|
+
children: [/* @__PURE__ */ R("button", {
|
|
3582
3754
|
type: "button",
|
|
3583
3755
|
onClick: () => {
|
|
3584
|
-
|
|
3756
|
+
B() && J(vi(b));
|
|
3585
3757
|
},
|
|
3586
|
-
disabled: T ||
|
|
3758
|
+
disabled: T || ni(b),
|
|
3587
3759
|
className: "rounded-md p-1.5 text-slate-500 transition hover:bg-slate-100 disabled:cursor-not-allowed disabled:opacity-40 dark:text-slate-400 dark:hover:bg-slate-900",
|
|
3588
3760
|
title: "返回上级目录",
|
|
3589
|
-
children: /* @__PURE__ */
|
|
3590
|
-
}), /* @__PURE__ */
|
|
3761
|
+
children: /* @__PURE__ */ R(t, { className: "h-4 w-4" })
|
|
3762
|
+
}), /* @__PURE__ */ R("button", {
|
|
3591
3763
|
type: "button",
|
|
3592
3764
|
onClick: () => {
|
|
3593
|
-
|
|
3765
|
+
B() && J(b);
|
|
3594
3766
|
},
|
|
3595
3767
|
disabled: T,
|
|
3596
3768
|
className: "rounded-md p-1.5 text-slate-500 transition hover:bg-slate-100 disabled:cursor-not-allowed disabled:opacity-40 dark:text-slate-400 dark:hover:bg-slate-900",
|
|
3597
3769
|
title: "刷新目录",
|
|
3598
|
-
children: /* @__PURE__ */
|
|
3770
|
+
children: /* @__PURE__ */ R(ne, { className: `h-4 w-4 ${T ? "animate-spin" : ""}` })
|
|
3599
3771
|
})]
|
|
3600
3772
|
})]
|
|
3601
|
-
}), ae ? /* @__PURE__ */
|
|
3773
|
+
}), ae ? /* @__PURE__ */ R("div", {
|
|
3602
3774
|
className: "mt-3 rounded-xl border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-600 dark:border-red-900/60 dark:bg-red-950/40 dark:text-red-300",
|
|
3603
3775
|
children: ae
|
|
3604
3776
|
}) : null]
|
|
3605
|
-
}), /* @__PURE__ */
|
|
3777
|
+
}), /* @__PURE__ */ R("div", {
|
|
3606
3778
|
className: "custom-scrollbar min-h-0 flex-1 overflow-y-auto px-2 py-2",
|
|
3607
|
-
children: !h && !r ? /* @__PURE__ */
|
|
3779
|
+
children: !h && !r ? /* @__PURE__ */ R("div", {
|
|
3608
3780
|
className: "px-3 py-4 text-sm text-slate-400",
|
|
3609
3781
|
children: "打开面板后加载 workspace 文件。"
|
|
3610
|
-
}) : T ? /* @__PURE__ */
|
|
3782
|
+
}) : T ? /* @__PURE__ */ R("div", {
|
|
3611
3783
|
className: "px-3 py-4 text-sm text-slate-400",
|
|
3612
3784
|
children: "正在加载目录..."
|
|
3613
|
-
}) : C.length === 0 ? /* @__PURE__ */
|
|
3785
|
+
}) : C.length === 0 ? /* @__PURE__ */ R("div", {
|
|
3614
3786
|
className: "px-3 py-4 text-sm text-slate-400",
|
|
3615
3787
|
children: "当前目录为空。"
|
|
3616
|
-
}) : /* @__PURE__ */
|
|
3788
|
+
}) : /* @__PURE__ */ R("div", {
|
|
3617
3789
|
className: "space-y-0.5",
|
|
3618
3790
|
children: C.map((e) => {
|
|
3619
|
-
let t =
|
|
3791
|
+
let t = si({
|
|
3620
3792
|
path: e.Path,
|
|
3621
3793
|
mimeType: e.MimeType
|
|
3622
|
-
}), r = A === e.Path, i = e.Type === "file" ?
|
|
3623
|
-
return /* @__PURE__ */
|
|
3794
|
+
}), r = A === e.Path, i = e.Type === "file" ? Si(e.Path) : "";
|
|
3795
|
+
return /* @__PURE__ */ z("div", {
|
|
3624
3796
|
title: e.Path,
|
|
3625
3797
|
className: Y("group flex items-center gap-1 rounded-lg px-1.5 py-1 transition", r ? "bg-slate-100 text-slate-950 dark:bg-slate-800 dark:text-slate-50" : "text-slate-700 hover:bg-slate-50 dark:text-slate-300 dark:hover:bg-slate-900"),
|
|
3626
|
-
children: [/* @__PURE__ */
|
|
3798
|
+
children: [/* @__PURE__ */ z("button", {
|
|
3627
3799
|
type: "button",
|
|
3628
3800
|
onClick: () => {
|
|
3629
3801
|
if (e.Type === "directory") {
|
|
3630
3802
|
J(e.Path);
|
|
3631
3803
|
return;
|
|
3632
3804
|
}
|
|
3633
|
-
A !== e.Path && !
|
|
3805
|
+
A !== e.Path && !B() || oe(e.Path);
|
|
3634
3806
|
},
|
|
3635
3807
|
className: "flex min-w-0 flex-1 items-center gap-2 text-left",
|
|
3636
|
-
children: [/* @__PURE__ */
|
|
3808
|
+
children: [/* @__PURE__ */ R("div", {
|
|
3637
3809
|
className: Y("flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-md", r ? "text-slate-900 dark:text-slate-50" : "text-slate-400 dark:text-slate-500"),
|
|
3638
|
-
children: e.Type === "directory" ? /* @__PURE__ */
|
|
3639
|
-
}), /* @__PURE__ */
|
|
3810
|
+
children: e.Type === "directory" ? /* @__PURE__ */ R(p, { className: "h-3.5 w-3.5" }) : R(t === "image" ? g : t === "markdown" || t === "text" || t === "html" ? u : f, { className: "h-3.5 w-3.5" })
|
|
3811
|
+
}), /* @__PURE__ */ z("div", {
|
|
3640
3812
|
className: "min-w-0 flex-1",
|
|
3641
|
-
children: [/* @__PURE__ */
|
|
3813
|
+
children: [/* @__PURE__ */ R("div", {
|
|
3642
3814
|
className: "truncate text-[13px] leading-5",
|
|
3643
3815
|
children: e.Name
|
|
3644
|
-
}), /* @__PURE__ */
|
|
3816
|
+
}), /* @__PURE__ */ R("div", {
|
|
3645
3817
|
className: Y("truncate text-[11px] leading-4", r ? "text-slate-500 dark:text-slate-400" : "text-slate-400"),
|
|
3646
|
-
children: e.Type === "directory" ? "目录" :
|
|
3818
|
+
children: e.Type === "directory" ? "目录" : bi(e.SizeBytes)
|
|
3647
3819
|
})]
|
|
3648
3820
|
})]
|
|
3649
|
-
}), /* @__PURE__ */
|
|
3821
|
+
}), /* @__PURE__ */ z("div", {
|
|
3650
3822
|
className: "flex flex-shrink-0 items-center gap-0.5 opacity-0 transition group-hover:opacity-100",
|
|
3651
|
-
children: [e.Type === "file" ? /* @__PURE__ */
|
|
3823
|
+
children: [e.Type === "file" ? /* @__PURE__ */ R("a", {
|
|
3652
3824
|
href: i,
|
|
3653
3825
|
download: e.Name,
|
|
3654
3826
|
className: Y("rounded-md p-1.5 transition", r ? "hover:bg-white dark:hover:bg-slate-700" : "hover:bg-slate-100 dark:hover:bg-slate-800"),
|
|
3655
3827
|
title: "下载",
|
|
3656
|
-
children: /* @__PURE__ */
|
|
3657
|
-
}) : null, n.SupportsDelete ? /* @__PURE__ */
|
|
3828
|
+
children: /* @__PURE__ */ R(s, { className: "h-3.5 w-3.5" })
|
|
3829
|
+
}) : null, n.SupportsDelete ? /* @__PURE__ */ R("button", {
|
|
3658
3830
|
type: "button",
|
|
3659
3831
|
onClick: () => void be(e),
|
|
3660
3832
|
className: Y("rounded-md p-1.5 transition", r ? "hover:bg-white dark:hover:bg-slate-700" : "hover:bg-slate-100 dark:hover:bg-slate-800"),
|
|
3661
3833
|
title: "删除",
|
|
3662
|
-
children: /* @__PURE__ */
|
|
3834
|
+
children: /* @__PURE__ */ R(se, { className: "h-3.5 w-3.5" })
|
|
3663
3835
|
}) : null]
|
|
3664
3836
|
})]
|
|
3665
3837
|
}, e.Path);
|
|
3666
3838
|
})
|
|
3667
3839
|
})
|
|
3668
3840
|
})]
|
|
3669
|
-
}), /* @__PURE__ */
|
|
3841
|
+
}), /* @__PURE__ */ z("div", {
|
|
3670
3842
|
className: "flex min-h-0 min-w-0 flex-1 flex-col",
|
|
3671
|
-
children: [/* @__PURE__ */
|
|
3843
|
+
children: [/* @__PURE__ */ R("div", {
|
|
3672
3844
|
className: "flex h-14 flex-shrink-0 items-center border-b border-slate-200/30 px-4 dark:border-slate-800/40",
|
|
3673
|
-
children:
|
|
3845
|
+
children: I ? /* @__PURE__ */ z("div", {
|
|
3674
3846
|
className: "flex w-full items-start justify-between gap-3",
|
|
3675
|
-
children: [/* @__PURE__ */
|
|
3847
|
+
children: [/* @__PURE__ */ z("div", {
|
|
3676
3848
|
className: "min-w-0",
|
|
3677
3849
|
children: [
|
|
3678
|
-
/* @__PURE__ */
|
|
3850
|
+
/* @__PURE__ */ R("div", {
|
|
3679
3851
|
className: "truncate text-sm font-semibold text-slate-900 dark:text-slate-100",
|
|
3680
|
-
children:
|
|
3852
|
+
children: I.Name
|
|
3681
3853
|
}),
|
|
3682
|
-
/* @__PURE__ */
|
|
3854
|
+
/* @__PURE__ */ R("div", {
|
|
3683
3855
|
className: "mt-0.5 break-all font-mono text-[11px] text-slate-400",
|
|
3684
|
-
children:
|
|
3856
|
+
children: I.Path
|
|
3685
3857
|
}),
|
|
3686
|
-
/* @__PURE__ */
|
|
3858
|
+
/* @__PURE__ */ z("div", {
|
|
3687
3859
|
className: "mt-1 text-[11px] text-slate-400",
|
|
3688
3860
|
children: [
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3861
|
+
bi(I.SizeBytes),
|
|
3862
|
+
I.MimeType ? ` · ${I.MimeType}` : "",
|
|
3863
|
+
I.ModifiedAt ? ` · ${yi(I.ModifiedAt)}` : ""
|
|
3692
3864
|
]
|
|
3693
3865
|
})
|
|
3694
3866
|
]
|
|
3695
|
-
}),
|
|
3867
|
+
}), L === "text" || L === "code" || L === "html" || L === "markdown" ? /* @__PURE__ */ z("button", {
|
|
3696
3868
|
type: "button",
|
|
3697
3869
|
onClick: () => {
|
|
3698
3870
|
let e = F.current;
|
|
@@ -3700,19 +3872,19 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3700
3872
|
},
|
|
3701
3873
|
disabled: !N || le,
|
|
3702
3874
|
className: Y("inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition", N && !le ? "bg-blue-600 text-white hover:bg-blue-700" : "text-slate-400 dark:text-slate-500 cursor-not-allowed"),
|
|
3703
|
-
children: [/* @__PURE__ */
|
|
3875
|
+
children: [/* @__PURE__ */ R(re, { className: "h-3.5 w-3.5" }), le ? "保存中" : N ? "保存" : "已保存"]
|
|
3704
3876
|
}) : null]
|
|
3705
|
-
}) : /* @__PURE__ */
|
|
3877
|
+
}) : /* @__PURE__ */ z("div", {
|
|
3706
3878
|
className: "w-full",
|
|
3707
|
-
children: [/* @__PURE__ */
|
|
3879
|
+
children: [/* @__PURE__ */ R("div", {
|
|
3708
3880
|
className: "text-sm font-semibold text-slate-900 dark:text-slate-100",
|
|
3709
3881
|
children: "文件预览"
|
|
3710
|
-
}), /* @__PURE__ */
|
|
3882
|
+
}), /* @__PURE__ */ R("div", {
|
|
3711
3883
|
className: "mt-0.5 text-xs text-slate-500 dark:text-slate-400",
|
|
3712
3884
|
children: "选择左侧文件后可在此查看内容。"
|
|
3713
3885
|
})]
|
|
3714
3886
|
})
|
|
3715
|
-
}), /* @__PURE__ */
|
|
3887
|
+
}), /* @__PURE__ */ R("div", {
|
|
3716
3888
|
className: Y("custom-scrollbar min-h-0 flex-1", we || Ce ? "overflow-hidden p-0" : "overflow-y-auto px-4 py-4"),
|
|
3717
3889
|
children: xe()
|
|
3718
3890
|
})]
|
|
@@ -3722,34 +3894,34 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3722
3894
|
}
|
|
3723
3895
|
//#endregion
|
|
3724
3896
|
//#region src/components/workspace/WorkspacePanelContainer.tsx
|
|
3725
|
-
function
|
|
3897
|
+
function Ti({ agentId: e, capability: t, workspacePanelOpen: n, workspacePanelWidth: r, workspacePanelFullscreen: i, isMobile: a, workspaceEnabled: o, workspaceFiles: s, workspacePanelPresentation: c, closeWorkspacePanel: l, handleWorkspacePanelResizeStart: u, api: d }) {
|
|
3726
3898
|
let f = c.renderMode === "inline", p = c.renderMode === "sheet";
|
|
3727
|
-
return !o || !s ? null : /* @__PURE__ */
|
|
3899
|
+
return !o || !s ? null : /* @__PURE__ */ z(L, { children: [f ? /* @__PURE__ */ z(L, { children: [n && !i ? /* @__PURE__ */ R("div", {
|
|
3728
3900
|
role: "separator",
|
|
3729
3901
|
"aria-label": "调整 Workspace 宽度",
|
|
3730
3902
|
"aria-orientation": "vertical",
|
|
3731
3903
|
onPointerDown: u,
|
|
3732
3904
|
className: "hidden h-full w-1 cursor-col-resize bg-transparent transition-colors hover:bg-blue-200/60 dark:hover:bg-blue-900/50 md:block"
|
|
3733
|
-
}) : null, /* @__PURE__ */
|
|
3905
|
+
}) : null, /* @__PURE__ */ R("aside", {
|
|
3734
3906
|
style: n && !i ? { width: `${r}px` } : void 0,
|
|
3735
3907
|
className: Y(i ? "fixed inset-0 z-40 flex h-[var(--app-height)] w-screen overflow-hidden bg-white dark:bg-slate-950" : "hidden h-full flex-shrink-0 overflow-hidden bg-white transition-[width] duration-200 ease-out dark:bg-slate-950 md:flex", n ? "border-l border-slate-200/30 dark:border-slate-800/40" : "w-0 border-l border-transparent"),
|
|
3736
|
-
children: n ? /* @__PURE__ */
|
|
3908
|
+
children: n ? /* @__PURE__ */ R(wi, {
|
|
3737
3909
|
agentId: e,
|
|
3738
3910
|
capability: t,
|
|
3739
3911
|
open: n,
|
|
3740
3912
|
onClose: l,
|
|
3741
3913
|
isFullscreen: i,
|
|
3742
|
-
onToggleFullscreen: () =>
|
|
3914
|
+
onToggleFullscreen: () => Fr.getState().setWorkspacePanelFullscreen(!i),
|
|
3743
3915
|
isMobile: a,
|
|
3744
3916
|
api: d
|
|
3745
3917
|
}) : null
|
|
3746
|
-
})] }) : null, p ? /* @__PURE__ */
|
|
3918
|
+
})] }) : null, p ? /* @__PURE__ */ R(bt, {
|
|
3747
3919
|
open: n,
|
|
3748
3920
|
onOpenChange: (e) => {
|
|
3749
|
-
e ||
|
|
3921
|
+
e || Fr.getState().setWorkspacePanelFullscreen(!1), Fr.getState().setWorkspacePanelOpen(e);
|
|
3750
3922
|
},
|
|
3751
3923
|
modal: c.modal,
|
|
3752
|
-
children: /* @__PURE__ */
|
|
3924
|
+
children: /* @__PURE__ */ z(wt, {
|
|
3753
3925
|
side: c.side,
|
|
3754
3926
|
showOverlay: c.showOverlay,
|
|
3755
3927
|
onInteractOutside: (e) => {
|
|
@@ -3758,15 +3930,15 @@ function hi({ agentId: e, capability: t, workspacePanelOpen: n, workspacePanelWi
|
|
|
3758
3930
|
showCloseButton: !1,
|
|
3759
3931
|
className: Y("border-slate-200 bg-white p-0 dark:border-slate-800 dark:bg-slate-950", a ? "h-[70vh] rounded-t-[1.75rem]" : "h-[calc(100vh-1.5rem)] w-[min(72rem,calc(100vw-1.5rem))] max-w-[calc(100vw-1.5rem)] rounded-l-[1.5rem] border-l shadow-2xl"),
|
|
3760
3932
|
children: [
|
|
3761
|
-
/* @__PURE__ */
|
|
3933
|
+
/* @__PURE__ */ R(Dt, {
|
|
3762
3934
|
className: "sr-only",
|
|
3763
3935
|
children: "Workspace 文件"
|
|
3764
3936
|
}),
|
|
3765
|
-
/* @__PURE__ */
|
|
3937
|
+
/* @__PURE__ */ R(Ot, {
|
|
3766
3938
|
className: "sr-only",
|
|
3767
3939
|
children: "浏览、上传和预览 Workspace 文件。"
|
|
3768
3940
|
}),
|
|
3769
|
-
/* @__PURE__ */
|
|
3941
|
+
/* @__PURE__ */ R(wi, {
|
|
3770
3942
|
agentId: e,
|
|
3771
3943
|
capability: t,
|
|
3772
3944
|
open: n,
|
|
@@ -3779,4 +3951,4 @@ function hi({ agentId: e, capability: t, workspacePanelOpen: n, workspacePanelWi
|
|
|
3779
3951
|
}) : null] });
|
|
3780
3952
|
}
|
|
3781
3953
|
//#endregion
|
|
3782
|
-
export {
|
|
3954
|
+
export { Ot as A, En as C, jt as D, Kt as E, st as F, at as I, Y as L, yt as M, ht as N, bt as O, ct as P, jn as S, Z as T, Nn as _, Kr as a, An as b, jr as c, tr as d, Xn as f, Mn as g, Pn as h, Gr as i, Dt as j, wt as k, xr as l, qn as m, fi as n, Fr as o, Yn as p, ui as r, Nr as s, Ti as t, er as u, Ln as v, xn as w, In as x, Fn as y };
|