@kingsoftcloud/ksadk-web 0.2.9 → 0.2.10
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 +16 -0
- package/dist-ksadk/assets/{ArtifactsPanel-SSyx1aCo.js → ArtifactsPanel-DWKSsYb9.js} +1 -1
- package/dist-ksadk/assets/{CodeBlock-YQ5vXzYH.js → CodeBlock-CTxzE2VS.js} +1 -1
- package/dist-ksadk/assets/{MathMessageMarkdown-CflwKEe7.js → MathMessageMarkdown-BQEjyzo5.js} +1 -1
- package/dist-ksadk/assets/{MermaidBlock-nbjqLbuu.js → MermaidBlock-CDmk7TDv.js} +6 -6
- package/dist-ksadk/assets/NativeTerminalPanel-DEfOlZBW.js +1 -0
- package/dist-ksadk/assets/{arc-QSfvB8Et.js → arc-DsDFn-pM.js} +1 -1
- package/dist-ksadk/assets/architecture-7EHR7CIX-DXMaR0JR.js +1 -0
- package/dist-ksadk/assets/{architectureDiagram-3BPJPVTR-CILqFpDC.js → architectureDiagram-3BPJPVTR-CXQLDPo9.js} +1 -1
- package/dist-ksadk/assets/{blockDiagram-GPEHLZMM-DD53Zgkb.js → blockDiagram-GPEHLZMM-ByJsJcrt.js} +1 -1
- package/dist-ksadk/assets/{c4Diagram-AAUBKEIU-DjS3CJER.js → c4Diagram-AAUBKEIU-D5eKWwvF.js} +1 -1
- package/dist-ksadk/assets/channel-Be4GcfhN.js +1 -0
- package/dist-ksadk/assets/{chunk-2J33WTMH-CBEtb1wr.js → chunk-2J33WTMH-CmLQ3DD9.js} +1 -1
- package/dist-ksadk/assets/{chunk-4BX2VUAB-CqF_-u4a.js → chunk-4BX2VUAB-BhRYlJwh.js} +1 -1
- package/dist-ksadk/assets/{chunk-55IACEB6-lR2vu_yR.js → chunk-55IACEB6-B60wcTiu.js} +1 -1
- package/dist-ksadk/assets/{chunk-727SXJPM-DvjC_wor.js → chunk-727SXJPM-BGlb7ll1.js} +1 -1
- package/dist-ksadk/assets/{chunk-AQP2D5EJ-BVUaV9p1.js → chunk-AQP2D5EJ-C5QUv7XG.js} +1 -1
- package/dist-ksadk/assets/{chunk-FMBD7UC4-Cc8_1XC_.js → chunk-FMBD7UC4-Du4tdup0.js} +1 -1
- package/dist-ksadk/assets/{chunk-ND2GUHAM-CAHh5eAF.js → chunk-ND2GUHAM-BsLG8760.js} +1 -1
- package/dist-ksadk/assets/chunk-QZHKN3VN-D07X2ALj.js +1 -0
- package/dist-ksadk/assets/classDiagram-4FO5ZUOK-CcD88kyq.js +1 -0
- package/dist-ksadk/assets/classDiagram-v2-Q7XG4LA2-CcD88kyq.js +1 -0
- package/dist-ksadk/assets/{cose-bilkent-S5V4N54A-CW6wiY80.js → cose-bilkent-S5V4N54A-JMKU0kQi.js} +1 -1
- package/dist-ksadk/assets/{dagre-BM42HDAG-BH_tWldy.js → dagre-BM42HDAG-P3phXbyY.js} +1 -1
- package/dist-ksadk/assets/{diagram-2AECGRRQ-ljY0ga-3.js → diagram-2AECGRRQ-C6ifXc81.js} +1 -1
- package/dist-ksadk/assets/{diagram-5GNKFQAL-BjZ8yg4e.js → diagram-5GNKFQAL-BLkF21oh.js} +1 -1
- package/dist-ksadk/assets/{diagram-KO2AKTUF-D5-e50p6.js → diagram-KO2AKTUF-A9gkeGco.js} +1 -1
- package/dist-ksadk/assets/{diagram-LMA3HP47-CIMbgA2R.js → diagram-LMA3HP47-Bqa8UV5s.js} +1 -1
- package/dist-ksadk/assets/{diagram-OG6HWLK6-CHAv8n8N.js → diagram-OG6HWLK6-GRe4pokR.js} +1 -1
- package/dist-ksadk/assets/{dist-B-8AvGwU.js → dist-4wlqrTld.js} +1 -1
- package/dist-ksadk/assets/{dist-C-TuGFEP.js → dist-BVtcRB6j.js} +1 -1
- package/dist-ksadk/assets/{dist-CwcMj9TX.js → dist-Bb2GBx-1.js} +1 -1
- package/dist-ksadk/assets/{dist-DplOU2XC.js → dist-Bg1jewnS.js} +1 -1
- package/dist-ksadk/assets/{dist-DxbIq1y9.js → dist-BicfrzOs.js} +1 -1
- package/dist-ksadk/assets/{dist-miJcQ_QT.js → dist-CIwg1HaJ.js} +1 -1
- package/dist-ksadk/assets/{dist-8fhwk8tR.js → dist-CJmGJ-_Y.js} +1 -1
- package/dist-ksadk/assets/{dist-CjTwd1ba.js → dist-CNP2pf7G.js} +1 -1
- package/dist-ksadk/assets/{dist-DHqMtxSi.js → dist-CQy3m9R-.js} +1 -1
- package/dist-ksadk/assets/{dist-CH8X1hMv.js → dist-CTVErq35.js} +1 -1
- package/dist-ksadk/assets/{dist-DkE5j5qa.js → dist-CejVKm1n.js} +1 -1
- package/dist-ksadk/assets/{dist-CSdL9G4U.js → dist-Cy6uew5t.js} +1 -1
- package/dist-ksadk/assets/{dist-BFWeVh8Y.js → dist-Cybdu3nb.js} +1 -1
- package/dist-ksadk/assets/{dist-Bh8Jo1Hy.js → dist-D2JPG7pC.js} +1 -1
- package/dist-ksadk/assets/{dist-CA7FMnEq.js → dist-DBDWFC2P.js} +1 -1
- package/dist-ksadk/assets/{dist-k2YXzXki.js → dist-DELPkMrm.js} +1 -1
- package/dist-ksadk/assets/{dist-CPGAEeVO.js → dist-DIe_LuNr.js} +1 -1
- package/dist-ksadk/assets/{dist-BQFXkYCL.js → dist-DjQKJaGi.js} +1 -1
- package/dist-ksadk/assets/{dist-lBacVcOX.js → dist-DpijsPsZ.js} +1 -1
- package/dist-ksadk/assets/{dist-Gtm38p17.js → dist-DqTi4q3N.js} +1 -1
- package/dist-ksadk/assets/{dist-CefsMd33.js → dist-Q6a4_tgv.js} +1 -1
- package/dist-ksadk/assets/{dist-YCkBmRQg.js → dist-f5z7EOt1.js} +1 -1
- package/dist-ksadk/assets/{erDiagram-TEJ5UH35-Buxp9SL_.js → erDiagram-TEJ5UH35-B8oH_MaS.js} +1 -1
- package/dist-ksadk/assets/eventmodeling-FCH6USID-Dl1-sbst.js +1 -0
- package/dist-ksadk/assets/{flowDiagram-I6XJVG4X-CNQ7RUqk.js → flowDiagram-I6XJVG4X-BhXAWO91.js} +1 -1
- package/dist-ksadk/assets/{ganttDiagram-6RSMTGT7-BR4K2g25.js → ganttDiagram-6RSMTGT7-BHNcInuv.js} +1 -1
- package/dist-ksadk/assets/gitGraph-WXDBUCRP-BH52bHVm.js +1 -0
- package/dist-ksadk/assets/{gitGraphDiagram-PVQCEYII-D5xJeGM-.js → gitGraphDiagram-PVQCEYII-B82aMrtH.js} +1 -1
- package/dist-ksadk/assets/{index-CAl5bzeo.css → index-DAURbCsP.css} +1 -1
- package/dist-ksadk/assets/index-DZFhFnmx.js +165 -0
- package/dist-ksadk/assets/info-J43DQDTF-DpbRzclW.js +1 -0
- package/dist-ksadk/assets/{infoDiagram-5YYISTIA-Dx3WJJ7c.js → infoDiagram-5YYISTIA-b_Hi36OA.js} +1 -1
- package/dist-ksadk/assets/{ishikawaDiagram-YF4QCWOH-CinAgPok.js → ishikawaDiagram-YF4QCWOH-CpiHSyNA.js} +1 -1
- package/dist-ksadk/assets/{journeyDiagram-JHISSGLW-CvHK1ISY.js → journeyDiagram-JHISSGLW-BHxHdRl7.js} +1 -1
- package/dist-ksadk/assets/{kanban-definition-UN3LZRKU-CdVmYG0i.js → kanban-definition-UN3LZRKU-kTk8cylz.js} +1 -1
- package/dist-ksadk/assets/{katex-j3gWbtq2.js → katex-D_Tkj1sg.js} +1 -1
- package/dist-ksadk/assets/{linear-CSzugA0M.js → linear-Dc1T6HuL.js} +1 -1
- package/dist-ksadk/assets/{mermaid-parser.core-x5RuQqLN.js → mermaid-parser.core-Cfv6TRDT.js} +2 -2
- package/dist-ksadk/assets/{mindmap-definition-RKZ34NQL-DHeHLEl4.js → mindmap-definition-RKZ34NQL-BsWFIVwR.js} +1 -1
- package/dist-ksadk/assets/packet-YPE3B663-DCpFrt65.js +1 -0
- package/dist-ksadk/assets/pie-LRSECV5Y-BcSHuNj-.js +1 -0
- package/dist-ksadk/assets/{pieDiagram-4H26LBE5-Bn-CBt6T.js → pieDiagram-4H26LBE5-CAMt3yXs.js} +1 -1
- package/dist-ksadk/assets/{quadrantDiagram-W4KKPZXB-DvSMM3_k.js → quadrantDiagram-W4KKPZXB-D-fXOUis.js} +1 -1
- package/dist-ksadk/assets/radar-GUYGQ44K-DR1bSSMx.js +1 -0
- package/dist-ksadk/assets/{requirementDiagram-4Y6WPE33-Bs1Umaod.js → requirementDiagram-4Y6WPE33-on5TsZ__.js} +1 -1
- package/dist-ksadk/assets/{sankeyDiagram-5OEKKPKP-uM4nwFIR.js → sankeyDiagram-5OEKKPKP-DJVzeVPc.js} +1 -1
- package/dist-ksadk/assets/{sequenceDiagram-3UESZ5HK-CUM1cPop.js → sequenceDiagram-3UESZ5HK-DHLjjUuy.js} +1 -1
- package/dist-ksadk/assets/{stateDiagram-AJRCARHV-BMhsQxg0.js → stateDiagram-AJRCARHV-CS1svOV-.js} +1 -1
- package/dist-ksadk/assets/stateDiagram-v2-BHNVJYJU-BXQTiPGY.js +1 -0
- package/dist-ksadk/assets/{timeline-definition-PNZ67QCA-DqOyQzFY.js → timeline-definition-PNZ67QCA-CzEM0jEl.js} +1 -1
- package/dist-ksadk/assets/treeView-BLDUP644-94CTmjJu.js +1 -0
- package/dist-ksadk/assets/treemap-LRROVOQU-Cjv6ruUS.js +1 -0
- package/dist-ksadk/assets/{vennDiagram-CIIHVFJN-CL6ie2Ap.js → vennDiagram-CIIHVFJN-CX4PRvMt.js} +1 -1
- package/dist-ksadk/assets/wardley-L42UT6IY-B-RIUQEs.js +1 -0
- package/dist-ksadk/assets/{wardleyDiagram-YWT4CUSO-CoLkaHQx.js → wardleyDiagram-YWT4CUSO-C_uFCiox.js} +1 -1
- package/dist-ksadk/assets/{xychartDiagram-2RQKCTM6-D3W-LOH6.js → xychartDiagram-2RQKCTM6-C0jIrQJj.js} +1 -1
- package/dist-ksadk/index.html +2 -2
- package/dist-lib/App.d.ts +3 -1
- package/dist-lib/App.d.ts.map +1 -1
- package/dist-lib/{ArtifactsPanel--CQyb4ZY.js → ArtifactsPanel-Bwj57S63.js} +4 -4
- package/dist-lib/{CodeBlock-Bwiebu9v.js → CodeBlock-CqZR-NBE.js} +1 -1
- package/dist-lib/{MathMessageMarkdown-BYzR9y8h.js → MathMessageMarkdown-D-CXaxIx.js} +2 -2
- package/dist-lib/{NativeTerminalPanel-BctkNn1k.js → NativeTerminalPanel-DASBHcE0.js} +77 -68
- package/dist-lib/{WorkspacePanelContainer-CtS_M-Qt.js → WorkspacePanelContainer-DLWLtZRG.js} +925 -833
- package/dist-lib/api/events.d.ts +12 -1
- package/dist-lib/api/events.d.ts.map +1 -1
- package/dist-lib/api/session.d.ts +11 -2
- package/dist-lib/api/session.d.ts.map +1 -1
- package/dist-lib/components/chat/ChatMessageList.d.ts.map +1 -1
- package/dist-lib/components/chat/ChatSidebar.d.ts +6 -1
- package/dist-lib/components/chat/ChatSidebar.d.ts.map +1 -1
- package/dist-lib/components/chat/ConnectedMessageList.d.ts +2 -1
- package/dist-lib/components/chat/ConnectedMessageList.d.ts.map +1 -1
- package/dist-lib/components/chat/ConnectedSidebar.d.ts +2 -1
- package/dist-lib/components/chat/ConnectedSidebar.d.ts.map +1 -1
- package/dist-lib/components/native/NativeTerminalPanel.d.ts +2 -1
- package/dist-lib/components/native/NativeTerminalPanel.d.ts.map +1 -1
- package/dist-lib/components.js +3 -3
- package/dist-lib/core/api/facade.d.ts +13 -4
- package/dist-lib/core/api/facade.d.ts.map +1 -1
- package/dist-lib/core/api/types.d.ts +13 -1
- package/dist-lib/core/api/types.d.ts.map +1 -1
- package/dist-lib/hooks/useSessionLifecycle.d.ts +2 -0
- package/dist-lib/hooks/useSessionLifecycle.d.ts.map +1 -1
- package/dist-lib/runtime.js +1107 -817
- package/dist-lib/stores/checkpoint.d.ts.map +1 -1
- package/dist-lib/stores/session.d.ts +35 -1
- package/dist-lib/stores/session.d.ts.map +1 -1
- package/dist-lib/styles.css +1 -1
- package/dist-lib/utils/message-virtualization.d.ts +21 -0
- package/dist-lib/utils/message-virtualization.d.ts.map +1 -0
- package/dist-lib/utils/session-list.d.ts.map +1 -1
- package/dist-lib/utils/session-pagination.d.ts +20 -0
- package/dist-lib/utils/session-pagination.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist-ksadk/assets/NativeTerminalPanel-DxAh9H8z.js +0 -1
- package/dist-ksadk/assets/architecture-7EHR7CIX-C19PcYz-.js +0 -1
- package/dist-ksadk/assets/channel-eJj5zetk.js +0 -1
- package/dist-ksadk/assets/chunk-QZHKN3VN-D4mip6Il.js +0 -1
- package/dist-ksadk/assets/classDiagram-4FO5ZUOK-33PbfFSW.js +0 -1
- package/dist-ksadk/assets/classDiagram-v2-Q7XG4LA2-33PbfFSW.js +0 -1
- package/dist-ksadk/assets/eventmodeling-FCH6USID-DmbjPnMI.js +0 -1
- package/dist-ksadk/assets/gitGraph-WXDBUCRP-Bc_9dlTu.js +0 -1
- package/dist-ksadk/assets/index-B6Jvzl61.js +0 -165
- package/dist-ksadk/assets/info-J43DQDTF-B8Y6xmyb.js +0 -1
- package/dist-ksadk/assets/packet-YPE3B663-BrYG7omE.js +0 -1
- package/dist-ksadk/assets/pie-LRSECV5Y-_wNpvHX3.js +0 -1
- package/dist-ksadk/assets/radar-GUYGQ44K-BaVGJTci.js +0 -1
- package/dist-ksadk/assets/stateDiagram-v2-BHNVJYJU-B1hvuTKv.js +0 -1
- package/dist-ksadk/assets/treeView-BLDUP644-SGPboZ5y.js +0 -1
- package/dist-ksadk/assets/treemap-LRROVOQU-DuxD3lqD.js +0 -1
- package/dist-ksadk/assets/wardley-L42UT6IY-D9w6kgpb.js +0 -1
package/dist-lib/{WorkspacePanelContainer-CtS_M-Qt.js → WorkspacePanelContainer-DLWLtZRG.js}
RENAMED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
import { ArrowUp as e, Bot as t, Check as n, ChevronDown as r, Code as i, Copy as a, Download as o, ExternalLink as s, Eye as c, FileCode2 as l, FileText as u, FolderOpen as d, Image as f, Loader2 as p, LoaderCircle as m, Maximize2 as h, MessageSquareText as g, Minimize2 as
|
|
2
|
-
import { clsx as
|
|
3
|
-
import { twMerge as
|
|
4
|
-
import { Fragment as
|
|
5
|
-
import * as
|
|
6
|
-
import
|
|
7
|
-
import * as
|
|
8
|
-
import { cva as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { create as
|
|
12
|
-
import { EditorView as
|
|
13
|
-
import { Compartment as
|
|
14
|
-
import { defaultKeymap as
|
|
15
|
-
import { LanguageDescription as
|
|
16
|
-
import { oneDark as
|
|
17
|
-
import { highlightSelectionMatches as
|
|
18
|
-
import { autocompletion as
|
|
19
|
-
import { languages as
|
|
1
|
+
import { ArrowUp as e, Bot as t, Check as n, ChevronDown as r, Code as i, Copy as a, Download as o, ExternalLink as s, Eye as c, FileCode2 as l, FileText as u, FolderOpen as d, Image as f, Loader2 as p, LoaderCircle as m, Maximize2 as h, MessageSquareText as g, Minimize2 as _, MoreHorizontal as v, Package as y, PanelLeft as b, PanelLeftClose as ee, Paperclip as x, Pin as te, PinOff as S, Plus as ne, RefreshCcw as C, RefreshCw as re, Save as ie, Search as w, Send as ae, ShieldCheck as T, StopCircle as E, TerminalSquare as D, ThumbsDown as oe, ThumbsUp as O, Trash2 as se, Upload as ce, X as le, XCircle as k } from "lucide-react";
|
|
2
|
+
import { clsx as ue } from "clsx";
|
|
3
|
+
import { twMerge as A } from "tailwind-merge";
|
|
4
|
+
import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
|
|
5
|
+
import * as P from "react";
|
|
6
|
+
import F, { Suspense as I, lazy as de, useCallback as L, useEffect as R, useId as z, useLayoutEffect as fe, useMemo as pe, useRef as B, useState as V } from "react";
|
|
7
|
+
import * as H from "@radix-ui/react-dialog";
|
|
8
|
+
import { cva as U } from "class-variance-authority";
|
|
9
|
+
import W from "react-markdown";
|
|
10
|
+
import me from "remark-gfm";
|
|
11
|
+
import { create as he } from "zustand";
|
|
12
|
+
import { EditorView as ge, crosshairCursor as _e, drawSelection as ve, dropCursor as ye, highlightActiveLine as G, highlightActiveLineGutter as K, keymap as be, lineNumbers as xe, rectangularSelection as Se } from "@codemirror/view";
|
|
13
|
+
import { Compartment as Ce, EditorState as q } from "@codemirror/state";
|
|
14
|
+
import { defaultKeymap as we, history as Te, historyKeymap as Ee, indentWithTab as De } from "@codemirror/commands";
|
|
15
|
+
import { LanguageDescription as Oe, bracketMatching as ke, defaultHighlightStyle as Ae, foldGutter as je, foldKeymap as Me, indentOnInput as Ne, syntaxHighlighting as Pe } from "@codemirror/language";
|
|
16
|
+
import { oneDark as Fe } from "@codemirror/theme-one-dark";
|
|
17
|
+
import { highlightSelectionMatches as Ie, searchKeymap as Le } from "@codemirror/search";
|
|
18
|
+
import { autocompletion as Re, closeBrackets as ze, closeBracketsKeymap as Be, completionKeymap as Ve } from "@codemirror/autocomplete";
|
|
19
|
+
import { languages as He } from "@codemirror/language-data";
|
|
20
20
|
//#region src/lib/utils.ts
|
|
21
21
|
function J(...e) {
|
|
22
|
-
return
|
|
22
|
+
return A(ue(e));
|
|
23
23
|
}
|
|
24
24
|
//#endregion
|
|
25
25
|
//#region src/components/chat/ChatComposer.tsx
|
|
26
|
-
function
|
|
27
|
-
let g = a ? "发送消息..." : "发送消息... (Shift + Enter 换行)",
|
|
28
|
-
return /* @__PURE__ */
|
|
26
|
+
function Ue({ attachments: e, composerContextIndicator: t, composerMaxHeight: n, fileInputRef: r, input: i, isMobile: a, isStreaming: o, queuedDrafts: s, onAppendAttachments: c, onInputChange: l, onPaste: u, onRemoveAttachment: d, onStopGeneration: f, onCancelRemote: p, onSubmit: m, textareaRef: h }) {
|
|
27
|
+
let g = a ? "发送消息..." : "发送消息... (Shift + Enter 换行)", _ = p ? "保留恢复点并结束本次执行" : "停止生成";
|
|
28
|
+
return /* @__PURE__ */ M("div", {
|
|
29
29
|
className: "relative z-10 flex-shrink-0 bg-white/95 px-3 py-3 backdrop-blur dark:bg-slate-900/95 sm:px-4 sm:py-3",
|
|
30
|
-
children: /* @__PURE__ */
|
|
30
|
+
children: /* @__PURE__ */ N("div", {
|
|
31
31
|
className: "mx-auto w-full max-w-[64rem]",
|
|
32
|
-
children: [s.length > 0 ? /* @__PURE__ */
|
|
32
|
+
children: [s.length > 0 ? /* @__PURE__ */ N("div", {
|
|
33
33
|
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",
|
|
34
|
-
children: [/* @__PURE__ */
|
|
34
|
+
children: [/* @__PURE__ */ N("div", {
|
|
35
35
|
className: "mb-1.5 flex items-center justify-between gap-2",
|
|
36
|
-
children: [/* @__PURE__ */
|
|
36
|
+
children: [/* @__PURE__ */ N("span", {
|
|
37
37
|
className: "font-semibold",
|
|
38
38
|
children: ["发送队列 · ", s.length]
|
|
39
|
-
}), /* @__PURE__ */
|
|
39
|
+
}), /* @__PURE__ */ M("span", {
|
|
40
40
|
className: "text-amber-700/75 dark:text-amber-200/75",
|
|
41
41
|
children: "当前回复完成后依次发送"
|
|
42
42
|
})]
|
|
43
|
-
}), /* @__PURE__ */
|
|
43
|
+
}), /* @__PURE__ */ N("div", {
|
|
44
44
|
className: "flex flex-col gap-1",
|
|
45
45
|
children: [s.slice(0, 3).map((e, t) => {
|
|
46
46
|
let n = e.text.trim() || (e.attachments.length > 0 ? "仅附件消息" : "空消息");
|
|
47
|
-
return /* @__PURE__ */
|
|
47
|
+
return /* @__PURE__ */ N("div", {
|
|
48
48
|
className: "flex items-center gap-2 rounded-xl bg-white/70 px-2 py-1.5 dark:bg-slate-950/35",
|
|
49
49
|
children: [
|
|
50
|
-
/* @__PURE__ */
|
|
50
|
+
/* @__PURE__ */ M("span", {
|
|
51
51
|
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",
|
|
52
52
|
children: t + 1
|
|
53
53
|
}),
|
|
54
|
-
/* @__PURE__ */
|
|
54
|
+
/* @__PURE__ */ M("span", {
|
|
55
55
|
className: "min-w-0 flex-1 truncate text-slate-700 dark:text-slate-200",
|
|
56
56
|
children: n
|
|
57
57
|
}),
|
|
58
|
-
e.attachments.length > 0 ? /* @__PURE__ */
|
|
58
|
+
e.attachments.length > 0 ? /* @__PURE__ */ N("span", {
|
|
59
59
|
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",
|
|
60
60
|
children: [e.attachments.length, " 附件"]
|
|
61
61
|
}) : null
|
|
62
62
|
]
|
|
63
63
|
}, `${t}-${n}-${e.attachments.length}`);
|
|
64
|
-
}), s.length > 3 ? /* @__PURE__ */
|
|
64
|
+
}), s.length > 3 ? /* @__PURE__ */ N("div", {
|
|
65
65
|
className: "px-2 pt-0.5 text-[11px] text-amber-700/80 dark:text-amber-200/80",
|
|
66
66
|
children: [
|
|
67
67
|
"还有 ",
|
|
@@ -70,9 +70,9 @@ function Be({ attachments: e, composerContextIndicator: t, composerMaxHeight: n,
|
|
|
70
70
|
]
|
|
71
71
|
}) : null]
|
|
72
72
|
})]
|
|
73
|
-
}) : null, /* @__PURE__ */
|
|
73
|
+
}) : null, /* @__PURE__ */ N("div", {
|
|
74
74
|
className: "flex items-center gap-3",
|
|
75
|
-
children: [/* @__PURE__ */
|
|
75
|
+
children: [/* @__PURE__ */ N("form", {
|
|
76
76
|
onSubmit: (t) => {
|
|
77
77
|
if (t.preventDefault(), o) {
|
|
78
78
|
p ? p() : f();
|
|
@@ -88,14 +88,14 @@ function Be({ attachments: e, composerContextIndicator: t, composerMaxHeight: n,
|
|
|
88
88
|
e.preventDefault(), e.stopPropagation(), e.dataTransfer.files && e.dataTransfer.files.length > 0 && c(Array.from(e.dataTransfer.files));
|
|
89
89
|
},
|
|
90
90
|
className: "relative flex min-w-0 flex-1 flex-col rounded-[1.25rem] border border-slate-200 bg-white p-1.5 shadow-[0_8px_22px_rgba(15,23,42,0.07)] transition-all focus-within:border-slate-300 focus-within:ring-1 focus-within:ring-slate-300 dark:border-slate-700 dark:bg-slate-900 dark:focus-within:border-slate-600 dark:focus-within:ring-slate-600",
|
|
91
|
-
children: [e.length > 0 ? /* @__PURE__ */
|
|
91
|
+
children: [e.length > 0 ? /* @__PURE__ */ M("div", {
|
|
92
92
|
className: "mb-1.5 flex flex-wrap gap-2 px-1.5 pt-1.5",
|
|
93
|
-
children: e.map((e, t) => /* @__PURE__ */
|
|
93
|
+
children: e.map((e, t) => /* @__PURE__ */ N("div", {
|
|
94
94
|
className: J("flex items-center gap-2 rounded-xl border border-slate-200 bg-slate-100 px-3 py-1.5 text-xs text-slate-600 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-300", a ? "max-w-full" : ""),
|
|
95
|
-
children: [/* @__PURE__ */
|
|
95
|
+
children: [/* @__PURE__ */ M("span", {
|
|
96
96
|
className: "max-w-[10rem] truncate font-medium sm:max-w-[12rem]",
|
|
97
97
|
children: e.name
|
|
98
|
-
}), /* @__PURE__ */
|
|
98
|
+
}), /* @__PURE__ */ M("button", {
|
|
99
99
|
type: "button",
|
|
100
100
|
onClick: () => d(t),
|
|
101
101
|
className: "text-slate-400 transition hover:text-red-500",
|
|
@@ -103,13 +103,13 @@ function Be({ attachments: e, composerContextIndicator: t, composerMaxHeight: n,
|
|
|
103
103
|
children: "×"
|
|
104
104
|
})]
|
|
105
105
|
}, `${e.name}-${e.size}-${t}`))
|
|
106
|
-
}) : null, /* @__PURE__ */
|
|
106
|
+
}) : null, /* @__PURE__ */ N("div", {
|
|
107
107
|
className: "flex w-full items-end gap-2",
|
|
108
108
|
children: [
|
|
109
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ N("label", {
|
|
110
110
|
className: "relative flex h-9 w-9 flex-shrink-0 items-center justify-center overflow-hidden rounded-xl text-slate-400 transition hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-slate-800 dark:hover:text-slate-200",
|
|
111
111
|
title: "上传附件",
|
|
112
|
-
children: [/* @__PURE__ */
|
|
112
|
+
children: [/* @__PURE__ */ M("input", {
|
|
113
113
|
ref: r,
|
|
114
114
|
type: "file",
|
|
115
115
|
multiple: !0,
|
|
@@ -117,9 +117,9 @@ function Be({ attachments: e, composerContextIndicator: t, composerMaxHeight: n,
|
|
|
117
117
|
onChange: (e) => {
|
|
118
118
|
e.target.files && e.target.files.length > 0 && (c(Array.from(e.target.files)), e.target.value = "");
|
|
119
119
|
}
|
|
120
|
-
}), /* @__PURE__ */
|
|
120
|
+
}), /* @__PURE__ */ M(x, { className: "h-5 w-5" })]
|
|
121
121
|
}),
|
|
122
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ M("textarea", {
|
|
123
123
|
ref: h,
|
|
124
124
|
rows: 1,
|
|
125
125
|
value: i,
|
|
@@ -135,18 +135,18 @@ function Be({ attachments: e, composerContextIndicator: t, composerMaxHeight: n,
|
|
|
135
135
|
overflowY: "auto"
|
|
136
136
|
}
|
|
137
137
|
}),
|
|
138
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ M("button", {
|
|
139
139
|
type: "submit",
|
|
140
140
|
disabled: !o && !i.trim() && e.length === 0,
|
|
141
141
|
className: J("flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-xl transition-all", o || i.trim() || e.length > 0 ? "bg-slate-900 text-white hover:bg-slate-800 dark:bg-slate-100 dark:text-slate-900 dark:hover:bg-white" : "bg-slate-100 text-slate-400 dark:bg-slate-800 dark:text-slate-600"),
|
|
142
|
-
title: o ?
|
|
143
|
-
children: o ? /* @__PURE__ */
|
|
142
|
+
title: o ? _ : "发送消息",
|
|
143
|
+
children: o ? /* @__PURE__ */ M(E, { className: "h-4 w-4" }) : /* @__PURE__ */ M(ae, { className: "ml-0.5 h-4 w-4" })
|
|
144
144
|
})
|
|
145
145
|
]
|
|
146
146
|
})]
|
|
147
|
-
}), t ? /* @__PURE__ */
|
|
147
|
+
}), t ? /* @__PURE__ */ N("div", {
|
|
148
148
|
className: J("hidden flex-shrink-0 items-center gap-1.5 rounded-full px-2.5 py-1 text-right text-[11px] leading-5 transition-colors sm:inline-flex", t.phase === "compressing" ? "bg-amber-50 text-amber-600 dark:bg-amber-950/30 dark:text-amber-300" : t.phase === "warning" ? "bg-rose-50 text-rose-600 dark:bg-rose-950/30 dark:text-rose-300" : "bg-slate-50 text-slate-400 dark:bg-slate-800/50 dark:text-slate-500"),
|
|
149
|
-
children: [/* @__PURE__ */
|
|
149
|
+
children: [/* @__PURE__ */ M(T, { className: "h-3 w-3" }), t.label]
|
|
150
150
|
}) : null]
|
|
151
151
|
})]
|
|
152
152
|
})
|
|
@@ -154,13 +154,13 @@ function Be({ attachments: e, composerContextIndicator: t, composerMaxHeight: n,
|
|
|
154
154
|
}
|
|
155
155
|
//#endregion
|
|
156
156
|
//#region src/components/ui/sheet.tsx
|
|
157
|
-
var
|
|
157
|
+
var We = H.Root, Ge = H.Portal, Ke = P.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ M(H.Overlay, {
|
|
158
158
|
className: J("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),
|
|
159
159
|
...t,
|
|
160
160
|
ref: n
|
|
161
161
|
}));
|
|
162
|
-
|
|
163
|
-
var
|
|
162
|
+
Ke.displayName = H.Overlay.displayName;
|
|
163
|
+
var qe = U("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500", {
|
|
164
164
|
variants: { side: {
|
|
165
165
|
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
166
166
|
bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
@@ -168,141 +168,141 @@ var We = pe("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out
|
|
|
168
168
|
right: "inset-y-0 right-0 h-full border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right"
|
|
169
169
|
} },
|
|
170
170
|
defaultVariants: { side: "right" }
|
|
171
|
-
}),
|
|
171
|
+
}), Je = P.forwardRef(({ side: e = "right", className: t, children: n, showOverlay: r = !0, showCloseButton: i = !0, ...a }, o) => /* @__PURE__ */ N(Ge, { children: [r ? /* @__PURE__ */ M(Ke, {}) : null, /* @__PURE__ */ N(H.Content, {
|
|
172
172
|
ref: o,
|
|
173
|
-
className: J(
|
|
173
|
+
className: J(qe({ side: e }), t),
|
|
174
174
|
...a,
|
|
175
|
-
children: [n, i ? /* @__PURE__ */
|
|
175
|
+
children: [n, i ? /* @__PURE__ */ N(H.Close, {
|
|
176
176
|
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",
|
|
177
|
-
children: [/* @__PURE__ */
|
|
177
|
+
children: [/* @__PURE__ */ M(le, { className: "h-4 w-4" }), /* @__PURE__ */ M("span", {
|
|
178
178
|
className: "sr-only",
|
|
179
179
|
children: "Close"
|
|
180
180
|
})]
|
|
181
181
|
}) : null]
|
|
182
182
|
})] }));
|
|
183
|
-
|
|
184
|
-
var
|
|
183
|
+
Je.displayName = H.Content.displayName;
|
|
184
|
+
var Ye = ({ className: e, ...t }) => /* @__PURE__ */ M("div", {
|
|
185
185
|
className: J("flex flex-col space-y-2 text-center sm:text-left", e),
|
|
186
186
|
...t
|
|
187
187
|
});
|
|
188
|
-
|
|
189
|
-
var
|
|
188
|
+
Ye.displayName = "SheetHeader";
|
|
189
|
+
var Xe = ({ className: e, ...t }) => /* @__PURE__ */ M("div", {
|
|
190
190
|
className: J("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e),
|
|
191
191
|
...t
|
|
192
192
|
});
|
|
193
|
-
|
|
194
|
-
var
|
|
193
|
+
Xe.displayName = "SheetFooter";
|
|
194
|
+
var Ze = P.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ M(H.Title, {
|
|
195
195
|
ref: n,
|
|
196
196
|
className: J("text-lg font-semibold text-foreground", e),
|
|
197
197
|
...t
|
|
198
198
|
}));
|
|
199
|
-
|
|
200
|
-
var
|
|
199
|
+
Ze.displayName = H.Title.displayName;
|
|
200
|
+
var Qe = P.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ M(H.Description, {
|
|
201
201
|
ref: n,
|
|
202
202
|
className: J("text-sm text-muted-foreground", e),
|
|
203
203
|
...t
|
|
204
204
|
}));
|
|
205
|
-
|
|
205
|
+
Qe.displayName = H.Description.displayName;
|
|
206
206
|
//#endregion
|
|
207
207
|
//#region src/components/chat/ChatHeader.tsx
|
|
208
|
-
var
|
|
209
|
-
function
|
|
210
|
-
let u = J("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__ */
|
|
208
|
+
var $e = de(() => import("./NativeTerminalPanel-DASBHcE0.js").then((e) => e.n).then((e) => ({ default: e.NativeTerminalPanel })));
|
|
209
|
+
function et({ availableModels: e, selectedModel: t, onSelectModel: n, selectedModelLabel: r, modelCatalogLoaded: i, modelSource: a, thinkingEnabled: o, thinkingMode: s, onSelectThinkingMode: c, compact: l = !1 }) {
|
|
210
|
+
let u = J("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__ */ M("select", {
|
|
211
211
|
value: t,
|
|
212
212
|
onChange: (e) => n(e.target.value),
|
|
213
213
|
className: u,
|
|
214
|
-
children: e.map((e) => /* @__PURE__ */
|
|
214
|
+
children: e.map((e) => /* @__PURE__ */ M("option", {
|
|
215
215
|
value: e.id,
|
|
216
216
|
children: e.display_name || e.id
|
|
217
217
|
}, e.id))
|
|
218
|
-
}) : r ? /* @__PURE__ */
|
|
218
|
+
}) : r ? /* @__PURE__ */ M("span", {
|
|
219
219
|
className: J(u, "inline-flex max-w-full items-center", l ? "justify-start" : ""),
|
|
220
220
|
title: a || r,
|
|
221
|
-
children: /* @__PURE__ */
|
|
221
|
+
children: /* @__PURE__ */ M("span", {
|
|
222
222
|
className: "truncate",
|
|
223
223
|
children: r
|
|
224
224
|
})
|
|
225
|
-
}) : /* @__PURE__ */
|
|
225
|
+
}) : /* @__PURE__ */ M("span", {
|
|
226
226
|
className: "text-sm text-slate-400",
|
|
227
227
|
children: i ? "未配置模型" : "Loading models..."
|
|
228
|
-
}), f = o ? /* @__PURE__ */
|
|
228
|
+
}), f = o ? /* @__PURE__ */ N("select", {
|
|
229
229
|
value: s,
|
|
230
230
|
onChange: (e) => c(e.target.value),
|
|
231
231
|
className: J(u, l ? "" : "max-w-[9rem]"),
|
|
232
232
|
title: "控制模型 thinking/reasoning 参数",
|
|
233
233
|
children: [
|
|
234
|
-
/* @__PURE__ */
|
|
234
|
+
/* @__PURE__ */ M("option", {
|
|
235
235
|
value: "auto",
|
|
236
236
|
children: "思考自动"
|
|
237
237
|
}),
|
|
238
|
-
/* @__PURE__ */
|
|
238
|
+
/* @__PURE__ */ M("option", {
|
|
239
239
|
value: "enabled",
|
|
240
240
|
children: "开启思考"
|
|
241
241
|
}),
|
|
242
|
-
/* @__PURE__ */
|
|
242
|
+
/* @__PURE__ */ M("option", {
|
|
243
243
|
value: "disabled",
|
|
244
244
|
children: "关闭思考"
|
|
245
245
|
})
|
|
246
246
|
]
|
|
247
247
|
}) : null;
|
|
248
|
-
return /* @__PURE__ */
|
|
248
|
+
return /* @__PURE__ */ N("div", {
|
|
249
249
|
className: J("flex min-w-0 gap-2", l ? "w-full flex-col" : "items-center"),
|
|
250
250
|
children: [d, f]
|
|
251
251
|
});
|
|
252
252
|
}
|
|
253
|
-
function
|
|
254
|
-
let [
|
|
255
|
-
return /* @__PURE__ */ j
|
|
256
|
-
/* @__PURE__ */
|
|
253
|
+
function tt({ agentName: e, currentSessionId: t, isMobile: n, sidebarOpen: r, mobileSidebarOpen: i, onToggleSidebar: a, availableModels: o, selectedModel: c, onSelectModel: l, selectedModelLabel: u, modelCatalogLoaded: f, modelSource: p, thinkingEnabled: m, thinkingMode: h, onSelectThinkingMode: g, mobileActionsOpen: _, onMobileActionsOpenChange: y, workspaceEnabled: x, onOpenWorkspace: te, nativeManagementLink: S, nativeTerminal: ne, nativeLauncherMode: C = !1 }) {
|
|
254
|
+
let [re, ie] = V(!1), w = !!ne?.Enabled, ae = M(n ? i ? ee : b : r ? ee : b, { className: "h-5 w-5" });
|
|
255
|
+
return /* @__PURE__ */ N(j, { children: [
|
|
256
|
+
/* @__PURE__ */ N("header", {
|
|
257
257
|
className: J("flex flex-shrink-0 items-center justify-between border-b border-slate-200/30 bg-white/95 px-3 py-2 backdrop-blur dark:border-slate-800 dark:bg-slate-900/95 sm:px-4", n ? "pt-[calc(var(--safe-area-top)+0.5rem)]" : "h-14"),
|
|
258
|
-
children: [/* @__PURE__ */
|
|
258
|
+
children: [/* @__PURE__ */ N("div", {
|
|
259
259
|
className: "flex min-w-0 items-center gap-2",
|
|
260
|
-
children: [
|
|
260
|
+
children: [C ? null : /* @__PURE__ */ M("button", {
|
|
261
261
|
type: "button",
|
|
262
262
|
onClick: a,
|
|
263
263
|
className: "rounded-lg p-2 text-slate-500 transition-colors hover:bg-slate-100 dark:hover:bg-slate-800",
|
|
264
264
|
"aria-label": n ? "打开历史记录" : "切换侧边栏",
|
|
265
|
-
children:
|
|
266
|
-
}), /* @__PURE__ */
|
|
265
|
+
children: ae
|
|
266
|
+
}), /* @__PURE__ */ N("div", {
|
|
267
267
|
className: "min-w-0",
|
|
268
|
-
children: [/* @__PURE__ */
|
|
268
|
+
children: [/* @__PURE__ */ M("div", {
|
|
269
269
|
className: "truncate text-sm font-semibold text-slate-900 dark:text-slate-100 sm:text-base",
|
|
270
270
|
children: e
|
|
271
|
-
}), /* @__PURE__ */
|
|
271
|
+
}), /* @__PURE__ */ M("div", {
|
|
272
272
|
className: "text-[11px] text-slate-400 dark:text-slate-500",
|
|
273
|
-
children:
|
|
273
|
+
children: C ? "原生运行时入口" : "智能体"
|
|
274
274
|
})]
|
|
275
275
|
})]
|
|
276
|
-
}), n ? /* @__PURE__ */
|
|
276
|
+
}), n ? /* @__PURE__ */ M("button", {
|
|
277
277
|
type: "button",
|
|
278
|
-
onClick: () =>
|
|
278
|
+
onClick: () => y(!0),
|
|
279
279
|
className: "rounded-lg p-2 text-slate-500 transition-colors hover:bg-slate-100 dark:hover:bg-slate-800",
|
|
280
280
|
"aria-label": "打开会话操作",
|
|
281
|
-
children: /* @__PURE__ */
|
|
282
|
-
}) : /* @__PURE__ */
|
|
281
|
+
children: /* @__PURE__ */ M(v, { className: "h-5 w-5" })
|
|
282
|
+
}) : /* @__PURE__ */ N("div", {
|
|
283
283
|
className: "flex min-w-0 items-center gap-2",
|
|
284
284
|
children: [
|
|
285
|
-
|
|
286
|
-
href:
|
|
285
|
+
S ? /* @__PURE__ */ N("a", {
|
|
286
|
+
href: S.href,
|
|
287
287
|
target: "_blank",
|
|
288
288
|
rel: "noreferrer",
|
|
289
|
-
title:
|
|
289
|
+
title: S.title,
|
|
290
290
|
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",
|
|
291
|
-
children: [/* @__PURE__ */
|
|
291
|
+
children: [/* @__PURE__ */ M(s, { className: "h-4 w-4" }), /* @__PURE__ */ M("span", { children: S.label })]
|
|
292
292
|
}) : null,
|
|
293
|
-
|
|
293
|
+
x ? /* @__PURE__ */ N("button", {
|
|
294
294
|
type: "button",
|
|
295
|
-
onClick:
|
|
295
|
+
onClick: te,
|
|
296
296
|
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",
|
|
297
|
-
children: [/* @__PURE__ */
|
|
297
|
+
children: [/* @__PURE__ */ M(d, { className: "h-4 w-4" }), /* @__PURE__ */ M("span", { children: "Workspace" })]
|
|
298
298
|
}) : null,
|
|
299
|
-
w ? /* @__PURE__ */
|
|
299
|
+
w ? /* @__PURE__ */ N("button", {
|
|
300
300
|
type: "button",
|
|
301
|
-
onClick: () =>
|
|
301
|
+
onClick: () => ie(!0),
|
|
302
302
|
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",
|
|
303
|
-
children: [/* @__PURE__ */
|
|
303
|
+
children: [/* @__PURE__ */ M(D, { className: "h-4 w-4" }), /* @__PURE__ */ M("span", { children: "TUI" })]
|
|
304
304
|
}) : null,
|
|
305
|
-
|
|
305
|
+
C ? null : /* @__PURE__ */ M(et, {
|
|
306
306
|
availableModels: o,
|
|
307
307
|
selectedModel: c,
|
|
308
308
|
onSelectModel: l,
|
|
@@ -313,62 +313,62 @@ function Qe({ agentName: e, currentSessionId: t, isMobile: n, sidebarOpen: r, mo
|
|
|
313
313
|
thinkingMode: h,
|
|
314
314
|
onSelectThinkingMode: g
|
|
315
315
|
}),
|
|
316
|
-
!
|
|
316
|
+
!C && t ? /* @__PURE__ */ N("span", {
|
|
317
317
|
className: "rounded bg-slate-50 px-2 py-1 text-xs font-mono text-slate-400 dark:bg-slate-800",
|
|
318
318
|
children: ["ID: ", t.slice(0, 8)]
|
|
319
319
|
}) : null
|
|
320
320
|
]
|
|
321
321
|
})]
|
|
322
322
|
}),
|
|
323
|
-
n ? /* @__PURE__ */
|
|
324
|
-
open:
|
|
325
|
-
onOpenChange:
|
|
326
|
-
children: /* @__PURE__ */
|
|
323
|
+
n ? /* @__PURE__ */ M(We, {
|
|
324
|
+
open: _,
|
|
325
|
+
onOpenChange: y,
|
|
326
|
+
children: /* @__PURE__ */ N(Je, {
|
|
327
327
|
side: "bottom",
|
|
328
328
|
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",
|
|
329
|
-
children: [/* @__PURE__ */
|
|
329
|
+
children: [/* @__PURE__ */ N(Ye, {
|
|
330
330
|
className: "text-left",
|
|
331
|
-
children: [/* @__PURE__ */
|
|
331
|
+
children: [/* @__PURE__ */ M(Ze, { children: "会话设置" }), /* @__PURE__ */ M(Qe, {
|
|
332
332
|
className: "sr-only",
|
|
333
333
|
children: "调整当前会话的模型和 Workspace 操作。"
|
|
334
334
|
})]
|
|
335
|
-
}), /* @__PURE__ */
|
|
335
|
+
}), /* @__PURE__ */ N("div", {
|
|
336
336
|
className: "mt-6 flex flex-col gap-4",
|
|
337
337
|
children: [
|
|
338
|
-
|
|
338
|
+
x ? /* @__PURE__ */ N("button", {
|
|
339
339
|
type: "button",
|
|
340
340
|
onClick: () => {
|
|
341
|
-
|
|
341
|
+
y(!1), te();
|
|
342
342
|
},
|
|
343
343
|
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",
|
|
344
|
-
children: [/* @__PURE__ */
|
|
344
|
+
children: [/* @__PURE__ */ M(d, { className: "h-4 w-4" }), "工作区文件"]
|
|
345
345
|
}) : null,
|
|
346
|
-
w ? /* @__PURE__ */
|
|
346
|
+
w ? /* @__PURE__ */ N("button", {
|
|
347
347
|
type: "button",
|
|
348
348
|
onClick: () => {
|
|
349
|
-
|
|
349
|
+
y(!1), ie(!0);
|
|
350
350
|
},
|
|
351
351
|
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",
|
|
352
|
-
children: [/* @__PURE__ */
|
|
352
|
+
children: [/* @__PURE__ */ M(D, { className: "h-4 w-4" }), "原生 TUI"]
|
|
353
353
|
}) : null,
|
|
354
|
-
|
|
355
|
-
href:
|
|
354
|
+
S ? /* @__PURE__ */ N("a", {
|
|
355
|
+
href: S.href,
|
|
356
356
|
target: "_blank",
|
|
357
357
|
rel: "noreferrer",
|
|
358
|
-
title:
|
|
359
|
-
onClick: () =>
|
|
358
|
+
title: S.title,
|
|
359
|
+
onClick: () => y(!1),
|
|
360
360
|
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",
|
|
361
|
-
children: [/* @__PURE__ */
|
|
361
|
+
children: [/* @__PURE__ */ M(s, { className: "h-4 w-4" }), S.label]
|
|
362
362
|
}) : null,
|
|
363
|
-
|
|
363
|
+
C ? /* @__PURE__ */ M("div", {
|
|
364
364
|
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",
|
|
365
365
|
children: "当前运行时对话在原生管理台中进行;这里保留管理入口和 Workspace 文件操作。"
|
|
366
|
-
}) : /* @__PURE__ */ j
|
|
366
|
+
}) : /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ N("div", {
|
|
367
367
|
className: "space-y-2",
|
|
368
|
-
children: [/* @__PURE__ */
|
|
368
|
+
children: [/* @__PURE__ */ M("div", {
|
|
369
369
|
className: "text-xs font-medium uppercase tracking-[0.12em] text-slate-400 dark:text-slate-500",
|
|
370
370
|
children: "模型"
|
|
371
|
-
}), /* @__PURE__ */
|
|
371
|
+
}), /* @__PURE__ */ M(et, {
|
|
372
372
|
availableModels: o,
|
|
373
373
|
selectedModel: c,
|
|
374
374
|
onSelectModel: l,
|
|
@@ -380,14 +380,14 @@ function Qe({ agentName: e, currentSessionId: t, isMobile: n, sidebarOpen: r, mo
|
|
|
380
380
|
onSelectThinkingMode: g,
|
|
381
381
|
compact: !0
|
|
382
382
|
})]
|
|
383
|
-
}), /* @__PURE__ */
|
|
383
|
+
}), /* @__PURE__ */ N("div", {
|
|
384
384
|
className: "space-y-2",
|
|
385
|
-
children: [/* @__PURE__ */
|
|
385
|
+
children: [/* @__PURE__ */ M("div", {
|
|
386
386
|
className: "text-xs font-medium uppercase tracking-[0.12em] text-slate-400 dark:text-slate-500",
|
|
387
387
|
children: "当前会话"
|
|
388
|
-
}), /* @__PURE__ */
|
|
388
|
+
}), /* @__PURE__ */ M("div", {
|
|
389
389
|
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",
|
|
390
|
-
children: t ? /* @__PURE__ */
|
|
390
|
+
children: t ? /* @__PURE__ */ M("span", {
|
|
391
391
|
className: "break-all font-mono",
|
|
392
392
|
children: t
|
|
393
393
|
}) : "新对话尚未创建会话 ID"
|
|
@@ -397,46 +397,46 @@ function Qe({ agentName: e, currentSessionId: t, isMobile: n, sidebarOpen: r, mo
|
|
|
397
397
|
})]
|
|
398
398
|
})
|
|
399
399
|
}) : null,
|
|
400
|
-
|
|
400
|
+
ne && re ? /* @__PURE__ */ M(I, {
|
|
401
401
|
fallback: null,
|
|
402
|
-
children: /* @__PURE__ */
|
|
403
|
-
capability:
|
|
404
|
-
open:
|
|
405
|
-
onClose: () =>
|
|
402
|
+
children: /* @__PURE__ */ M($e, {
|
|
403
|
+
capability: ne,
|
|
404
|
+
open: re,
|
|
405
|
+
onClose: () => ie(!1)
|
|
406
406
|
})
|
|
407
407
|
}) : null
|
|
408
408
|
] });
|
|
409
409
|
}
|
|
410
410
|
//#endregion
|
|
411
411
|
//#region src/utils/markdown.js
|
|
412
|
-
function
|
|
412
|
+
function nt(e) {
|
|
413
413
|
return e.replace(/<think>([\s\S]*?)(?:<\/think>|$)/gi, (e, t) => `\n> 💭 **思考过程**\n>\n${String(t || "").trim().split("\n").filter(Boolean).map((e) => `> ${e}`).join("\n")}\n\n`);
|
|
414
414
|
}
|
|
415
|
-
function
|
|
415
|
+
function rt(e) {
|
|
416
416
|
return /^\s*\|(?:\s*[:\-]+\s*\|){2,}\s*$/.test(e);
|
|
417
417
|
}
|
|
418
418
|
function Y(e) {
|
|
419
419
|
let t = e.trim();
|
|
420
420
|
return t.startsWith("|") ? t.split("|").length >= 4 : !1;
|
|
421
421
|
}
|
|
422
|
-
function
|
|
423
|
-
return
|
|
422
|
+
function it(e) {
|
|
423
|
+
return rt(e) || /\|\|/.test(e) || /\|(?:\s*[:\-]+\s*\|){2,}/.test(e) && /\|(?:[^|\n]*\|){2,}/.test(e);
|
|
424
424
|
}
|
|
425
|
-
function
|
|
426
|
-
return
|
|
425
|
+
function at(e) {
|
|
426
|
+
return it(e) ? e.replace(/\|\s*\|/g, "|\n|").split("\n").map((e) => e.trimEnd()).filter((e) => e.trim().length > 0) : [e];
|
|
427
427
|
}
|
|
428
|
-
function
|
|
428
|
+
function ot(e) {
|
|
429
429
|
return Y(e) ? e.replace(/\|\s*(?:\*{1,2}|_{1,2})\s*$/u, "|") : e;
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function st(e) {
|
|
432
432
|
let t = e.trim();
|
|
433
433
|
return Y(t) ? t.split("|").slice(1, -1).length : 0;
|
|
434
434
|
}
|
|
435
|
-
function
|
|
436
|
-
let t = e.match(/^(\s*)/)?.[1] || "", n =
|
|
435
|
+
function ct(e) {
|
|
436
|
+
let t = e.match(/^(\s*)/)?.[1] || "", n = st(e);
|
|
437
437
|
return n < 2 ? "" : `${t}| ${Array.from({ length: n }, () => "---").join(" | ")} |`;
|
|
438
438
|
}
|
|
439
|
-
function
|
|
439
|
+
function lt(e) {
|
|
440
440
|
let t = [];
|
|
441
441
|
for (let n of e.split("\n")) {
|
|
442
442
|
if (/^\s*\|\s*$/.test(n)) continue;
|
|
@@ -445,15 +445,15 @@ function ot(e) {
|
|
|
445
445
|
t.push(`${e[1]}${e[2].trim()}`);
|
|
446
446
|
continue;
|
|
447
447
|
}
|
|
448
|
-
t.push(...
|
|
448
|
+
t.push(...at(n).map(ot));
|
|
449
449
|
}
|
|
450
450
|
let n = [];
|
|
451
451
|
for (let e = 0; e < t.length; e += 1) {
|
|
452
452
|
let r = t[e], i = t[e + 1] || "";
|
|
453
|
-
if (n.push(r), Y(r) && Y(i) && !
|
|
453
|
+
if (n.push(r), Y(r) && Y(i) && !rt(i) && st(r) === st(i)) {
|
|
454
454
|
let i = Y(t[e - 1] || ""), a = r.match(/^(\s*)/)?.[1] || "";
|
|
455
455
|
if (!i && a.length === 0) {
|
|
456
|
-
let e =
|
|
456
|
+
let e = ct(r);
|
|
457
457
|
e && n.push(e);
|
|
458
458
|
}
|
|
459
459
|
}
|
|
@@ -465,61 +465,61 @@ function ot(e) {
|
|
|
465
465
|
}
|
|
466
466
|
return r.join("\n");
|
|
467
467
|
}
|
|
468
|
-
function
|
|
468
|
+
function ut(e) {
|
|
469
469
|
let t = e.replace(/^[\u200B-\u200D\uFEFF]+/u, ""), n = t.match(/^([ \t\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)([##]{1,6})([ \t\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)(\S.*)?$/u);
|
|
470
470
|
if (!n) return t;
|
|
471
471
|
let [, r, i, , a = ""] = n, o = r.replace(/[^\t ]/gu, " "), s = i.replace(/#/gu, "#");
|
|
472
472
|
return a ? `${o}${s} ${a}` : `${o}${s}`;
|
|
473
473
|
}
|
|
474
|
-
function
|
|
474
|
+
function dt(e) {
|
|
475
475
|
let t = e;
|
|
476
|
-
return t = t.split("\n").map((e) =>
|
|
476
|
+
return t = t.split("\n").map((e) => ut(e)).join("\n"), t = t.replace(/^[ \t]+(#{1,6}\s*)/gm, "$1"), t = t.replace(/([^\n#])\s*(#{1,6}\s*\S)/g, "$1\n\n$2"), t = t.replace(/^(#{1,6}\s*[^\n]+)\n(?!\n)/gm, "$1\n\n"), t = t.replace(/^(#{1,6}[^\n|]+?)\s*(\|)/gm, "$1\n$2"), t = t.replace(/([。;;::])\s*(\d+\.\s*)/g, "$1\n$2"), t = t.replace(/([^\n\s])(\d+\.\s+)/g, "$1\n$2"), t = t.replace(/([。;;::\.])\s*-(?!-)\s*/g, "$1\n- "), t = t.replace(/([^\n\s-])-\s+/g, "$1\n- "), t = t.replace(/^-(?!-)(\S)/gm, "- $1"), t = lt(t), t = t.replace(/\n{3,}/g, "\n\n"), t.trim();
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function ft(e) {
|
|
479
479
|
return e.map((t, n) => {
|
|
480
480
|
if (n % 2 == 1) return t;
|
|
481
|
-
let r =
|
|
481
|
+
let r = dt(t), i = n > 0, a = n < e.length - 1;
|
|
482
482
|
return r ? (i && !r.startsWith("\n") && (r = `\n${r}`), a && !r.endsWith("\n") && (r = `${r}\n`), r) : i && a ? "\n\n" : i || a ? "\n" : r;
|
|
483
483
|
});
|
|
484
484
|
}
|
|
485
|
-
function
|
|
485
|
+
function pt(e) {
|
|
486
486
|
if (!e) return e;
|
|
487
487
|
let t = String(e).replace(/\r\n/g, "\n").replace(/\r/g, "\n").trim();
|
|
488
|
-
return t =
|
|
488
|
+
return t = nt(t), (t.match(/```/g) || []).length % 2 == 1 && (t = `${t}\n\`\`\``), ft(t.split("```")).join("```").trim();
|
|
489
489
|
}
|
|
490
490
|
//#endregion
|
|
491
491
|
//#region src/components/MessageMarkdown.tsx
|
|
492
|
-
var
|
|
493
|
-
function
|
|
492
|
+
var mt = F.lazy(() => import("./CodeBlock-CqZR-NBE.js").then((e) => ({ default: e.CodeBlock }))), ht = F.lazy(() => import("./MermaidBlock-BFNE1NN8.js").then((e) => ({ default: e.MermaidBlock }))), gt = F.lazy(() => import("./MathMessageMarkdown-D-CXaxIx.js").then((e) => ({ default: e.MathMessageMarkdown })));
|
|
493
|
+
function _t(e) {
|
|
494
494
|
return /\$[^$]+\$|\$\$[^$]+\$\$/.test(e);
|
|
495
495
|
}
|
|
496
|
-
var
|
|
496
|
+
var vt = {
|
|
497
497
|
code({ className: e, children: t, ...n }) {
|
|
498
498
|
let r = /language-(\w+)/.exec(e || ""), i = String(t ?? "");
|
|
499
|
-
if (!r && !i.includes("\n")) return /* @__PURE__ */
|
|
499
|
+
if (!r && !i.includes("\n")) return /* @__PURE__ */ M("code", {
|
|
500
500
|
className: "bg-slate-100 dark:bg-slate-800 px-1.5 py-0.5 rounded-md text-[13.5px] font-mono text-slate-800 dark:text-slate-200 before:content-none after:content-none border border-slate-200 dark:border-slate-700",
|
|
501
501
|
...n,
|
|
502
502
|
children: t
|
|
503
503
|
});
|
|
504
504
|
let a = r ? r[1] : "";
|
|
505
|
-
return a === "mermaid" ? /* @__PURE__ */
|
|
506
|
-
fallback: /* @__PURE__ */
|
|
507
|
-
children: /* @__PURE__ */
|
|
508
|
-
}) : /* @__PURE__ */
|
|
509
|
-
fallback: /* @__PURE__ */
|
|
505
|
+
return a === "mermaid" ? /* @__PURE__ */ M(I, {
|
|
506
|
+
fallback: /* @__PURE__ */ M("div", { className: "h-32 animate-pulse bg-slate-100 dark:bg-slate-800 rounded" }),
|
|
507
|
+
children: /* @__PURE__ */ M(ht, { chart: i })
|
|
508
|
+
}) : /* @__PURE__ */ M(I, {
|
|
509
|
+
fallback: /* @__PURE__ */ M("pre", {
|
|
510
510
|
className: "p-4 text-sm",
|
|
511
511
|
children: i
|
|
512
512
|
}),
|
|
513
|
-
children: /* @__PURE__ */
|
|
513
|
+
children: /* @__PURE__ */ M(mt, {
|
|
514
514
|
language: a,
|
|
515
515
|
value: i
|
|
516
516
|
})
|
|
517
517
|
});
|
|
518
518
|
},
|
|
519
519
|
table({ children: e, ...t }) {
|
|
520
|
-
return /* @__PURE__ */
|
|
520
|
+
return /* @__PURE__ */ M("div", {
|
|
521
521
|
className: "overflow-x-auto my-4 border border-slate-200 dark:border-slate-700 rounded-lg",
|
|
522
|
-
children: /* @__PURE__ */
|
|
522
|
+
children: /* @__PURE__ */ M("table", {
|
|
523
523
|
className: "w-full text-sm text-left my-0",
|
|
524
524
|
...t,
|
|
525
525
|
children: e
|
|
@@ -527,21 +527,21 @@ var ht = {
|
|
|
527
527
|
});
|
|
528
528
|
},
|
|
529
529
|
th({ children: e, ...t }) {
|
|
530
|
-
return /* @__PURE__ */
|
|
530
|
+
return /* @__PURE__ */ M("th", {
|
|
531
531
|
className: "bg-slate-50 dark:bg-slate-800/50 px-4 py-2 font-semibold border-b border-slate-200 dark:border-slate-700",
|
|
532
532
|
...t,
|
|
533
533
|
children: e
|
|
534
534
|
});
|
|
535
535
|
},
|
|
536
536
|
td({ children: e, ...t }) {
|
|
537
|
-
return /* @__PURE__ */
|
|
537
|
+
return /* @__PURE__ */ M("td", {
|
|
538
538
|
className: "px-4 py-2 border-b border-slate-100 dark:border-slate-800 last:border-0",
|
|
539
539
|
...t,
|
|
540
540
|
children: e
|
|
541
541
|
});
|
|
542
542
|
},
|
|
543
543
|
a({ children: e, href: t, ...n }) {
|
|
544
|
-
return /* @__PURE__ */
|
|
544
|
+
return /* @__PURE__ */ M("a", {
|
|
545
545
|
href: t,
|
|
546
546
|
className: "text-blue-600 dark:text-blue-400 hover:underline",
|
|
547
547
|
target: "_blank",
|
|
@@ -550,32 +550,32 @@ var ht = {
|
|
|
550
550
|
children: e
|
|
551
551
|
});
|
|
552
552
|
}
|
|
553
|
-
},
|
|
554
|
-
let t =
|
|
555
|
-
return /* @__PURE__ */
|
|
553
|
+
}, yt = F.memo(({ content: e }) => {
|
|
554
|
+
let t = pt(e);
|
|
555
|
+
return /* @__PURE__ */ M("div", {
|
|
556
556
|
className: "prose prose-slate dark:prose-invert max-w-none break-words text-[15px] leading-7 prose-headings:mb-3 prose-headings:mt-6 prose-headings:font-semibold prose-headings:text-slate-900 dark:prose-headings:text-slate-50 prose-h1:text-[1.95rem] prose-h1:leading-tight prose-h1:tracking-[-0.02em] prose-h2:text-[1.55rem] prose-h2:leading-tight prose-h2:tracking-[-0.015em] prose-h3:text-[1.2rem] prose-h3:leading-snug prose-p:my-3 prose-p:leading-7 prose-strong:text-slate-900 dark:prose-strong:text-slate-100 prose-ol:my-3 prose-ul:my-3 prose-li:my-1.5 prose-li:leading-7 prose-hr:my-5 prose-hr:border-slate-200 dark:prose-hr:border-slate-700 prose-pre:m-0 prose-pre:bg-transparent prose-pre:p-0 [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
|
|
557
|
-
children: /* @__PURE__ */
|
|
558
|
-
remarkPlugins: [
|
|
559
|
-
components:
|
|
557
|
+
children: /* @__PURE__ */ M(W, {
|
|
558
|
+
remarkPlugins: [me],
|
|
559
|
+
components: vt,
|
|
560
560
|
children: t
|
|
561
561
|
})
|
|
562
562
|
});
|
|
563
|
-
}), X =
|
|
564
|
-
fallback: /* @__PURE__ */
|
|
565
|
-
children: /* @__PURE__ */
|
|
566
|
-
}) : /* @__PURE__ */
|
|
563
|
+
}), X = F.memo(({ content: e }) => _t(e) ? /* @__PURE__ */ M(I, {
|
|
564
|
+
fallback: /* @__PURE__ */ M(yt, { content: e }),
|
|
565
|
+
children: /* @__PURE__ */ M(gt, { content: e })
|
|
566
|
+
}) : /* @__PURE__ */ M(yt, { content: e }));
|
|
567
567
|
//#endregion
|
|
568
568
|
//#region src/utils/feedback.js
|
|
569
569
|
function Z(e) {
|
|
570
570
|
return String(e || "").trim();
|
|
571
571
|
}
|
|
572
|
-
function
|
|
572
|
+
function bt(e) {
|
|
573
573
|
let t = Z(e).toLowerCase();
|
|
574
574
|
return t === "up" || t === "down" ? t : "";
|
|
575
575
|
}
|
|
576
|
-
function
|
|
576
|
+
function xt(e) {
|
|
577
577
|
if (!e || typeof e != "object") return null;
|
|
578
|
-
let t =
|
|
578
|
+
let t = bt(e.Rating || e.rating);
|
|
579
579
|
return t ? {
|
|
580
580
|
agentId: Z(e.AgentId || e.agentId),
|
|
581
581
|
sessionId: Z(e.SessionId || e.sessionId),
|
|
@@ -588,10 +588,10 @@ function vt(e) {
|
|
|
588
588
|
updatedAt: Z(e.UpdatedAt || e.updatedAt)
|
|
589
589
|
} : null;
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function St(e, t, n) {
|
|
592
592
|
return !!(e?.role === "model" && Z(e.responseId) && Z(e.eventId) && !(t && n));
|
|
593
593
|
}
|
|
594
|
-
function
|
|
594
|
+
function Ct({ agentId: e, sessionId: t, message: n }) {
|
|
595
595
|
let r = Z(n?.responseId);
|
|
596
596
|
if (!r) throw Error("Message missing response id");
|
|
597
597
|
return {
|
|
@@ -600,11 +600,11 @@ function bt({ agentId: e, sessionId: t, message: n }) {
|
|
|
600
600
|
ResponseId: r
|
|
601
601
|
};
|
|
602
602
|
}
|
|
603
|
-
function
|
|
604
|
-
let a =
|
|
603
|
+
function wt({ agentId: e, sessionId: t, message: n, rating: r, comment: i = "" }) {
|
|
604
|
+
let a = bt(r);
|
|
605
605
|
if (!a) throw Error("Feedback rating must be up or down");
|
|
606
606
|
let o = {
|
|
607
|
-
...
|
|
607
|
+
...Ct({
|
|
608
608
|
agentId: e,
|
|
609
609
|
sessionId: t,
|
|
610
610
|
message: n
|
|
@@ -618,8 +618,8 @@ function xt({ agentId: e, sessionId: t, message: n, rating: r, comment: i = "" }
|
|
|
618
618
|
if (!o.EventId) throw Error("Message missing event id");
|
|
619
619
|
return o;
|
|
620
620
|
}
|
|
621
|
-
function
|
|
622
|
-
let i = e.find((e) => e.id === t), a = i?.feedback ? { ...i.feedback } : null, o =
|
|
621
|
+
function Tt(e, { messageId: t, rating: n, comment: r = "" }) {
|
|
622
|
+
let i = e.find((e) => e.id === t), a = i?.feedback ? { ...i.feedback } : null, o = bt(n);
|
|
623
623
|
return {
|
|
624
624
|
nextMessages: e.map((e) => e.id === t ? {
|
|
625
625
|
...e,
|
|
@@ -636,8 +636,8 @@ function St(e, { messageId: t, rating: n, comment: r = "" }) {
|
|
|
636
636
|
previousFeedback: a
|
|
637
637
|
};
|
|
638
638
|
}
|
|
639
|
-
function
|
|
640
|
-
let r =
|
|
639
|
+
function Et(e, { messageId: t, feedback: n }) {
|
|
640
|
+
let r = xt(n) || n;
|
|
641
641
|
return e.map((e) => e.id === t ? {
|
|
642
642
|
...e,
|
|
643
643
|
feedback: r ? {
|
|
@@ -647,7 +647,7 @@ function Ct(e, { messageId: t, feedback: n }) {
|
|
|
647
647
|
} : void 0
|
|
648
648
|
} : e);
|
|
649
649
|
}
|
|
650
|
-
function
|
|
650
|
+
function Dt(e, { messageId: t, previousFeedback: n }) {
|
|
651
651
|
return e.map((e) => {
|
|
652
652
|
if (e.id !== t) return e;
|
|
653
653
|
if (!n) {
|
|
@@ -660,7 +660,7 @@ function wt(e, { messageId: t, previousFeedback: n }) {
|
|
|
660
660
|
};
|
|
661
661
|
});
|
|
662
662
|
}
|
|
663
|
-
function
|
|
663
|
+
function Ot(e, { messageId: t }) {
|
|
664
664
|
return e.map((e) => {
|
|
665
665
|
if (e.id !== t) return e;
|
|
666
666
|
let { feedback: n, ...r } = e;
|
|
@@ -669,10 +669,10 @@ function Tt(e, { messageId: t }) {
|
|
|
669
669
|
}
|
|
670
670
|
//#endregion
|
|
671
671
|
//#region src/utils/tool-display.js
|
|
672
|
-
function
|
|
672
|
+
function kt(e) {
|
|
673
673
|
return String(e || "").replace(/\\u([0-9a-fA-F]{4})/g, (e, t) => String.fromCharCode(Number.parseInt(t, 16)));
|
|
674
674
|
}
|
|
675
|
-
function
|
|
675
|
+
function At(e) {
|
|
676
676
|
let t = String(e || "").trim();
|
|
677
677
|
for (let e = 0; e < 3; e += 1) {
|
|
678
678
|
if (!t) return t;
|
|
@@ -680,59 +680,59 @@ function Dt(e) {
|
|
|
680
680
|
if (!(e === "{" && n === "}" || e === "[" && n === "]" || e === "\"" && n === "\"")) return t.replace(/\\n/g, "\n").replace(/\\"/g, "\"");
|
|
681
681
|
try {
|
|
682
682
|
let e = JSON.parse(t);
|
|
683
|
-
if (typeof e != "string") return
|
|
683
|
+
if (typeof e != "string") return jt(e);
|
|
684
684
|
t = e.trim();
|
|
685
685
|
} catch {
|
|
686
|
-
return
|
|
686
|
+
return kt(t).replace(/\\n/g, "\n").replace(/\\"/g, "\"");
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
689
|
return t;
|
|
690
690
|
}
|
|
691
|
-
function
|
|
692
|
-
return typeof e == "string" ?
|
|
691
|
+
function jt(e) {
|
|
692
|
+
return typeof e == "string" ? At(e) : Array.isArray(e) ? e.map((e) => jt(e)) : !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, jt(t)]));
|
|
693
693
|
}
|
|
694
|
-
function
|
|
695
|
-
return typeof e == "string" ?
|
|
694
|
+
function Mt(e) {
|
|
695
|
+
return typeof e == "string" ? At(e) : jt(e);
|
|
696
696
|
}
|
|
697
|
-
function
|
|
697
|
+
function Nt(e) {
|
|
698
698
|
return e === !1 ? !0 : typeof e == "string" ? e.trim().toLowerCase() === "false" : !1;
|
|
699
699
|
}
|
|
700
|
-
function
|
|
700
|
+
function Pt(e) {
|
|
701
701
|
return e === !0 ? !0 : typeof e == "string" ? e.trim().toLowerCase() === "true" : !1;
|
|
702
702
|
}
|
|
703
|
-
function
|
|
703
|
+
function Ft(e) {
|
|
704
704
|
return e == null || e === !1 ? !1 : typeof e == "string" ? e.trim().length > 0 : typeof e == "object" ? Object.keys(e).length > 0 : !0;
|
|
705
705
|
}
|
|
706
|
-
function
|
|
706
|
+
function It(e) {
|
|
707
707
|
return String(e?.status || "").trim().toLowerCase() === "accepted_not_extracted";
|
|
708
708
|
}
|
|
709
|
-
function
|
|
709
|
+
function Lt(e, t = 0) {
|
|
710
710
|
if (!e || t > 4) return !1;
|
|
711
711
|
if (typeof e == "string") {
|
|
712
|
-
let n =
|
|
713
|
-
return n !== e &&
|
|
712
|
+
let n = At(e);
|
|
713
|
+
return n !== e && Lt(n, t + 1);
|
|
714
714
|
}
|
|
715
|
-
if (Array.isArray(e)) return e.some((e) =>
|
|
716
|
-
if (typeof e != "object" ||
|
|
717
|
-
if (
|
|
718
|
-
let n =
|
|
715
|
+
if (Array.isArray(e)) return e.some((e) => Lt(e, t + 1));
|
|
716
|
+
if (typeof e != "object" || It(e)) return !1;
|
|
717
|
+
if (Nt(e.ok) || Nt(e.success)) return !0;
|
|
718
|
+
let n = Pt(e.ok) || Pt(e.success), r = String(e.status || "").trim().toLowerCase();
|
|
719
719
|
return !n && [
|
|
720
720
|
"error",
|
|
721
721
|
"failed",
|
|
722
722
|
"failure"
|
|
723
|
-
].includes(r) || !n && (
|
|
723
|
+
].includes(r) || !n && (Ft(e.error_type) || Ft(e.error_message) || Ft(e.error)) ? !0 : Object.values(e).some((e) => Lt(e, t + 1));
|
|
724
724
|
}
|
|
725
|
-
function
|
|
726
|
-
return e == null || e === "" ? !1 :
|
|
725
|
+
function Rt(e) {
|
|
726
|
+
return e == null || e === "" ? !1 : Lt(Mt(e));
|
|
727
727
|
}
|
|
728
|
-
function
|
|
728
|
+
function zt(e) {
|
|
729
729
|
if (e == null || e === "") return "";
|
|
730
|
-
let t =
|
|
730
|
+
let t = Mt(e);
|
|
731
731
|
return typeof t == "string" ? t : JSON.stringify(t, null, 2);
|
|
732
732
|
}
|
|
733
733
|
//#endregion
|
|
734
734
|
//#region src/utils/clipboard.js
|
|
735
|
-
async function
|
|
735
|
+
async function Bt(e, t = globalThis) {
|
|
736
736
|
let n = String(e ?? ""), r = t?.navigator;
|
|
737
737
|
if (r?.clipboard?.writeText) try {
|
|
738
738
|
return await r.clipboard.writeText(n), !0;
|
|
@@ -751,27 +751,10 @@ async function Lt(e, t = globalThis) {
|
|
|
751
751
|
}
|
|
752
752
|
//#endregion
|
|
753
753
|
//#region src/utils/session-helpers.ts
|
|
754
|
-
function
|
|
755
|
-
let t = e.UpdatedAt;
|
|
756
|
-
if (typeof t == "string") {
|
|
757
|
-
let e = Date.parse(t);
|
|
758
|
-
return Number.isNaN(e) ? 0 : e;
|
|
759
|
-
}
|
|
760
|
-
return typeof t == "number" ? t : 0;
|
|
761
|
-
}
|
|
762
|
-
function zt(e, t) {
|
|
763
|
-
let n = /* @__PURE__ */ new Map();
|
|
764
|
-
for (let t of e) t?.SessionId && n.set(t.SessionId, t);
|
|
765
|
-
for (let e of t) e?.SessionId && n.set(e.SessionId, {
|
|
766
|
-
...n.get(e.SessionId) || {},
|
|
767
|
-
...e
|
|
768
|
-
});
|
|
769
|
-
return Array.from(n.values()).sort((e, t) => Rt(t) - Rt(e));
|
|
770
|
-
}
|
|
771
|
-
function Bt(e) {
|
|
754
|
+
function Vt(e) {
|
|
772
755
|
return String(e.Title || "").trim() || String(e.FirstPrompt || "").trim() || "新对话";
|
|
773
756
|
}
|
|
774
|
-
function
|
|
757
|
+
function Ht(e) {
|
|
775
758
|
if (!e) return "";
|
|
776
759
|
if (typeof e == "string") {
|
|
777
760
|
let t = Date.parse(e);
|
|
@@ -790,97 +773,137 @@ function Vt(e) {
|
|
|
790
773
|
});
|
|
791
774
|
}
|
|
792
775
|
//#endregion
|
|
776
|
+
//#region src/utils/message-virtualization.js
|
|
777
|
+
function Ut(e, t, n) {
|
|
778
|
+
return Math.max(t, Math.min(n, e));
|
|
779
|
+
}
|
|
780
|
+
function Wt({ 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) } = {}) {
|
|
781
|
+
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);
|
|
782
|
+
if (!e.length) return {
|
|
783
|
+
startIndex: 0,
|
|
784
|
+
endIndex: 0,
|
|
785
|
+
offsetTop: 0,
|
|
786
|
+
totalHeight: 0,
|
|
787
|
+
visibleItems: []
|
|
788
|
+
};
|
|
789
|
+
let d = e.map((e, t) => {
|
|
790
|
+
let n = o(e, t), r = Number(a.get(n));
|
|
791
|
+
return Number.isFinite(r) && r > 0 ? r : u;
|
|
792
|
+
}), f = Array(e.length), p = 0;
|
|
793
|
+
for (let t = 0; t < e.length; t += 1) f[t] = p, p += d[t];
|
|
794
|
+
let m = p, h = c + s, g = 0;
|
|
795
|
+
for (; g < e.length && f[g] + d[g] <= c;) g += 1;
|
|
796
|
+
let _ = g;
|
|
797
|
+
for (; _ < e.length && f[_] < h;) _ += 1;
|
|
798
|
+
return g = Ut(g - l, 0, e.length), _ = Ut(Math.max(g + 1, _ + l), 0, e.length), {
|
|
799
|
+
startIndex: g,
|
|
800
|
+
endIndex: _,
|
|
801
|
+
offsetTop: f[g] || 0,
|
|
802
|
+
totalHeight: m,
|
|
803
|
+
visibleItems: e.slice(g, _).map((e, t) => {
|
|
804
|
+
let n = g + t;
|
|
805
|
+
return {
|
|
806
|
+
index: n,
|
|
807
|
+
item: e,
|
|
808
|
+
top: f[n] || 0,
|
|
809
|
+
height: d[n] || u
|
|
810
|
+
};
|
|
811
|
+
})
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
//#endregion
|
|
793
815
|
//#region src/components/chat/ChatMessageList.tsx
|
|
794
|
-
|
|
816
|
+
var Gt = 140, Kt = 4;
|
|
817
|
+
function qt(e) {
|
|
795
818
|
let t = Math.max(0, Math.floor(e / 1e3)), n = Math.floor(t / 60), r = t % 60;
|
|
796
819
|
return n <= 0 ? `${r}s` : `${n}m ${String(r).padStart(2, "0")}s`;
|
|
797
820
|
}
|
|
798
|
-
function
|
|
821
|
+
function Jt(e) {
|
|
799
822
|
return e < 1e3 ? "刚刚" : e < 6e4 ? `${Math.floor(e / 1e3)} 秒前` : `${Math.floor(e / 6e4)} 分钟前`;
|
|
800
823
|
}
|
|
801
|
-
function
|
|
824
|
+
function Yt(e) {
|
|
802
825
|
let t = Number(e);
|
|
803
826
|
return !Number.isFinite(t) || t <= 0 ? "0" : t < 1e3 ? String(Math.round(t)) : t < 1e6 ? `${Math.round(t / 100) / 10}k` : `${Math.round(t / 1e5) / 10}m`;
|
|
804
827
|
}
|
|
805
|
-
function
|
|
828
|
+
function Xt({ contextIndicator: e }) {
|
|
806
829
|
let t = e?.usedTokens, n = e?.contextWindowTokens;
|
|
807
|
-
return !t || !n ? null : /* @__PURE__ */
|
|
830
|
+
return !t || !n ? null : /* @__PURE__ */ N("span", {
|
|
808
831
|
className: "token-count-pulse hidden font-mono text-slate-400 dark:text-slate-500 sm:inline",
|
|
809
832
|
title: `估算 token:${Math.round(t)} / ${Math.round(n)}`,
|
|
810
833
|
children: [
|
|
811
834
|
"估算 token ",
|
|
812
|
-
|
|
835
|
+
Yt(t),
|
|
813
836
|
" / ",
|
|
814
|
-
|
|
837
|
+
Yt(n)
|
|
815
838
|
]
|
|
816
839
|
}, Math.round(t));
|
|
817
840
|
}
|
|
818
|
-
function
|
|
819
|
-
let [a, o] =
|
|
820
|
-
|
|
841
|
+
function Zt({ activity: e, contextIndicator: t, onStopGeneration: r, onCancelRemote: i }) {
|
|
842
|
+
let [a, o] = V(() => Date.now());
|
|
843
|
+
R(() => {
|
|
821
844
|
let e = window.setInterval(() => o(Date.now()), 1e3);
|
|
822
845
|
return () => window.clearInterval(e);
|
|
823
846
|
}, []);
|
|
824
847
|
let s = e.status === "connecting" || e.status === "running" || e.status === "waiting", c = a - e.lastEventAt < 2e4;
|
|
825
|
-
return /* @__PURE__ */
|
|
848
|
+
return /* @__PURE__ */ N("div", {
|
|
826
849
|
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",
|
|
827
850
|
children: [
|
|
828
|
-
e.status === "failed" ? /* @__PURE__ */
|
|
829
|
-
/* @__PURE__ */
|
|
851
|
+
e.status === "failed" ? /* @__PURE__ */ M(E, { className: "h-3 w-3 text-rose-500" }) : e.status === "completed" ? /* @__PURE__ */ M(n, { className: "h-3 w-3 text-emerald-500" }) : e.status === "stopped" ? /* @__PURE__ */ M(T, { className: "h-3 w-3 text-amber-500" }) : /* @__PURE__ */ M(C, { className: "h-3 w-3 animate-spin text-slate-400" }),
|
|
852
|
+
/* @__PURE__ */ M("span", {
|
|
830
853
|
className: "max-w-[16rem] truncate text-slate-600 dark:text-slate-300",
|
|
831
854
|
title: e.detail || e.phase,
|
|
832
855
|
children: e.phase
|
|
833
856
|
}),
|
|
834
|
-
/* @__PURE__ */
|
|
857
|
+
/* @__PURE__ */ N("span", { children: [
|
|
835
858
|
e.source === "restore" ? "恢复" : "运行",
|
|
836
859
|
" ",
|
|
837
|
-
|
|
860
|
+
qt(a - e.startedAt)
|
|
838
861
|
] }),
|
|
839
|
-
s ? /* @__PURE__ */
|
|
862
|
+
s ? /* @__PURE__ */ M("span", {
|
|
840
863
|
className: J("inline-block h-1.5 w-1.5 flex-shrink-0 rounded-full", c ? "bg-emerald-400" : "bg-slate-300 dark:bg-slate-600"),
|
|
841
864
|
title: c ? "连接存活" : "连接超时"
|
|
842
865
|
}) : null,
|
|
843
|
-
/* @__PURE__ */
|
|
866
|
+
/* @__PURE__ */ N("span", {
|
|
844
867
|
className: "text-slate-400 dark:text-slate-500",
|
|
845
868
|
children: [e.eventCount, " ev"]
|
|
846
869
|
}),
|
|
847
|
-
/* @__PURE__ */
|
|
848
|
-
/* @__PURE__ */
|
|
870
|
+
/* @__PURE__ */ M(Xt, { contextIndicator: t }),
|
|
871
|
+
/* @__PURE__ */ M("span", {
|
|
849
872
|
className: "hidden text-slate-400 dark:text-slate-500 sm:inline",
|
|
850
|
-
children:
|
|
873
|
+
children: Jt(a - e.lastEventAt)
|
|
851
874
|
}),
|
|
852
|
-
s && (r || i) ? /* @__PURE__ */
|
|
875
|
+
s && (r || i) ? /* @__PURE__ */ N("div", {
|
|
853
876
|
className: "flex flex-shrink-0 gap-1",
|
|
854
|
-
children: [r ? /* @__PURE__ */
|
|
877
|
+
children: [r ? /* @__PURE__ */ N("button", {
|
|
855
878
|
type: "button",
|
|
856
879
|
onClick: r,
|
|
857
880
|
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",
|
|
858
|
-
children: [/* @__PURE__ */
|
|
859
|
-
}) : null, i ? /* @__PURE__ */
|
|
881
|
+
children: [/* @__PURE__ */ M(E, { className: "h-3 w-3" }), "停止"]
|
|
882
|
+
}) : null, i ? /* @__PURE__ */ N("button", {
|
|
860
883
|
type: "button",
|
|
861
884
|
"aria-label": "取消运行并保留恢复点",
|
|
862
885
|
title: "取消运行并保留最近 checkpoint",
|
|
863
886
|
onClick: i,
|
|
864
887
|
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",
|
|
865
|
-
children: [/* @__PURE__ */
|
|
888
|
+
children: [/* @__PURE__ */ M(k, { className: "h-3 w-3" }), "取消"]
|
|
866
889
|
}) : null]
|
|
867
890
|
}) : null
|
|
868
891
|
]
|
|
869
892
|
});
|
|
870
893
|
}
|
|
871
|
-
function
|
|
872
|
-
return /* @__PURE__ */
|
|
894
|
+
function Qt({ agentName: e }) {
|
|
895
|
+
return /* @__PURE__ */ N("div", {
|
|
873
896
|
className: "flex flex-col items-center justify-center min-h-[50vh] px-4",
|
|
874
897
|
children: [
|
|
875
|
-
/* @__PURE__ */
|
|
898
|
+
/* @__PURE__ */ M("div", {
|
|
876
899
|
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",
|
|
877
|
-
children: /* @__PURE__ */
|
|
900
|
+
children: /* @__PURE__ */ M(t, { className: "h-8 w-8 text-white" })
|
|
878
901
|
}),
|
|
879
|
-
/* @__PURE__ */
|
|
902
|
+
/* @__PURE__ */ M("h2", {
|
|
880
903
|
className: "text-xl font-semibold text-slate-900 dark:text-slate-50",
|
|
881
904
|
children: "有什么我可以帮您的吗?"
|
|
882
905
|
}),
|
|
883
|
-
/* @__PURE__ */
|
|
906
|
+
/* @__PURE__ */ N("p", {
|
|
884
907
|
className: "mt-2 text-sm text-slate-500",
|
|
885
908
|
children: [
|
|
886
909
|
"我是 ",
|
|
@@ -891,7 +914,7 @@ function qt({ agentName: e }) {
|
|
|
891
914
|
]
|
|
892
915
|
});
|
|
893
916
|
}
|
|
894
|
-
function
|
|
917
|
+
function $t(e) {
|
|
895
918
|
let t = String(e || "").trim();
|
|
896
919
|
return t ? {
|
|
897
920
|
stream: "流式执行中",
|
|
@@ -903,7 +926,7 @@ function Jt(e) {
|
|
|
903
926
|
after_tool: "工具执行后"
|
|
904
927
|
}[t] || t : "保存运行状态";
|
|
905
928
|
}
|
|
906
|
-
function
|
|
929
|
+
function en(e) {
|
|
907
930
|
return {
|
|
908
931
|
completed: "已完成",
|
|
909
932
|
checkpointed: "已保存",
|
|
@@ -915,7 +938,7 @@ function Yt(e) {
|
|
|
915
938
|
pending: "等待中"
|
|
916
939
|
}[String(e || "").trim().toLowerCase()] || "";
|
|
917
940
|
}
|
|
918
|
-
function
|
|
941
|
+
function tn(e, t) {
|
|
919
942
|
return t.stage ? t.stage : t.phase && ![
|
|
920
943
|
"stream",
|
|
921
944
|
"running",
|
|
@@ -926,42 +949,42 @@ function Xt(e, t) {
|
|
|
926
949
|
"after_tool"
|
|
927
950
|
].includes(t.phase) ? t.phase : e === 0 ? "最新状态快照" : `状态快照 #${e + 1}`;
|
|
928
951
|
}
|
|
929
|
-
function
|
|
952
|
+
function nn(e, t) {
|
|
930
953
|
return `第 ${Math.max(1, t - e)}/${Math.max(1, t)} 阶段`;
|
|
931
954
|
}
|
|
932
|
-
function
|
|
955
|
+
function rn(e, t = 8, n = 4) {
|
|
933
956
|
let r = String(e || "").trim();
|
|
934
957
|
return r ? r.length <= t + n + 1 ? r : `${r.slice(0, t)}...${r.slice(-n)}` : "";
|
|
935
958
|
}
|
|
936
|
-
function
|
|
959
|
+
function an({ checkpoints: e, isStreaming: t, onResumeCheckpoint: r }) {
|
|
937
960
|
if (!e.length || !r) return null;
|
|
938
961
|
let i = e.filter((e) => {
|
|
939
962
|
let t = String(e.status || "").trim().toLowerCase();
|
|
940
963
|
return t === "completed" || t === "checkpointed" || t === "ready_to_resume";
|
|
941
964
|
}).length;
|
|
942
|
-
return /* @__PURE__ */
|
|
965
|
+
return /* @__PURE__ */ N("div", {
|
|
943
966
|
className: "mb-4 rounded-lg border border-slate-200 bg-white px-3 py-3 text-xs text-slate-600 shadow-sm shadow-slate-900/[0.04] dark:border-slate-700 dark:bg-slate-900/70 dark:text-slate-300",
|
|
944
|
-
children: [/* @__PURE__ */
|
|
967
|
+
children: [/* @__PURE__ */ N("div", {
|
|
945
968
|
className: "mb-2 flex flex-wrap items-center justify-between gap-2",
|
|
946
|
-
children: [/* @__PURE__ */
|
|
969
|
+
children: [/* @__PURE__ */ N("div", {
|
|
947
970
|
className: "min-w-0",
|
|
948
|
-
children: [/* @__PURE__ */
|
|
971
|
+
children: [/* @__PURE__ */ M("div", {
|
|
949
972
|
className: "font-medium text-slate-800 dark:text-slate-100",
|
|
950
973
|
children: "会话恢复区"
|
|
951
|
-
}), /* @__PURE__ */
|
|
974
|
+
}), /* @__PURE__ */ M("div", {
|
|
952
975
|
className: "mt-0.5 text-[11px] text-slate-400",
|
|
953
976
|
children: "选择 LangGraph 状态快照,从对应图状态继续"
|
|
954
977
|
})]
|
|
955
|
-
}), /* @__PURE__ */
|
|
978
|
+
}), /* @__PURE__ */ N("div", {
|
|
956
979
|
className: "flex flex-shrink-0 items-center gap-1.5",
|
|
957
|
-
children: [i > 0 ? /* @__PURE__ */
|
|
980
|
+
children: [i > 0 ? /* @__PURE__ */ N("span", {
|
|
958
981
|
className: "rounded-full bg-emerald-50 px-2 py-1 text-[11px] font-medium text-emerald-700 ring-1 ring-emerald-100 dark:bg-emerald-950/25 dark:text-emerald-300 dark:ring-emerald-900/50",
|
|
959
982
|
children: [
|
|
960
983
|
"已捕获 ",
|
|
961
984
|
i,
|
|
962
985
|
" 个快照"
|
|
963
986
|
]
|
|
964
|
-
}) : null, /* @__PURE__ */
|
|
987
|
+
}) : null, /* @__PURE__ */ N("span", {
|
|
965
988
|
className: "rounded-full bg-white px-2 py-1 text-[11px] font-medium text-slate-500 ring-1 ring-slate-200 dark:bg-slate-950/40 dark:text-slate-300 dark:ring-slate-700",
|
|
966
989
|
children: [
|
|
967
990
|
"共 ",
|
|
@@ -970,69 +993,69 @@ function $t({ checkpoints: e, isStreaming: t, onResumeCheckpoint: r }) {
|
|
|
970
993
|
]
|
|
971
994
|
})]
|
|
972
995
|
})]
|
|
973
|
-
}), /* @__PURE__ */
|
|
996
|
+
}), /* @__PURE__ */ M("div", {
|
|
974
997
|
className: "custom-scrollbar flex max-h-[24rem] flex-col gap-1.5 overflow-y-auto pr-1",
|
|
975
998
|
children: e.map((i, a) => {
|
|
976
|
-
let o = t || !i.sessionId, s =
|
|
977
|
-
return /* @__PURE__ */
|
|
999
|
+
let o = t || !i.sessionId, s = nn(a, e.length), c = tn(a, i), l = $t(i.phase), u = en(i.status) || (a === 0 ? "推荐" : ""), d = rn(i.checkpointId), f = rn(i.runId, 10, 4);
|
|
1000
|
+
return /* @__PURE__ */ N("div", {
|
|
978
1001
|
className: "grid min-h-[4.35rem] grid-cols-[1.75rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md border border-slate-200/70 bg-slate-50/70 px-2.5 py-2 transition hover:border-blue-200 hover:bg-blue-50/40 dark:border-slate-700/70 dark:bg-slate-950/30 dark:hover:border-blue-800 dark:hover:bg-blue-950/20",
|
|
979
1002
|
title: [
|
|
980
|
-
i.timestamp ? `时间:${
|
|
1003
|
+
i.timestamp ? `时间:${Ht(i.timestamp)}` : "",
|
|
981
1004
|
d ? `checkpoint:${i.checkpointId}` : "",
|
|
982
1005
|
f ? `run:${i.runId}` : ""
|
|
983
1006
|
].filter(Boolean).join("\n") || void 0,
|
|
984
1007
|
children: [
|
|
985
|
-
/* @__PURE__ */
|
|
1008
|
+
/* @__PURE__ */ M("div", {
|
|
986
1009
|
className: "flex h-7 w-7 items-center justify-center rounded-full bg-white text-emerald-600 ring-1 ring-slate-200 dark:bg-slate-900 dark:text-emerald-300 dark:ring-slate-700",
|
|
987
|
-
children: /* @__PURE__ */
|
|
1010
|
+
children: /* @__PURE__ */ M(n, { className: "h-3.5 w-3.5" })
|
|
988
1011
|
}),
|
|
989
|
-
/* @__PURE__ */
|
|
1012
|
+
/* @__PURE__ */ N("div", {
|
|
990
1013
|
className: "min-w-0",
|
|
991
1014
|
children: [
|
|
992
|
-
/* @__PURE__ */
|
|
1015
|
+
/* @__PURE__ */ N("div", {
|
|
993
1016
|
className: "flex min-w-0 items-center gap-2",
|
|
994
1017
|
children: [
|
|
995
|
-
/* @__PURE__ */
|
|
1018
|
+
/* @__PURE__ */ M("span", {
|
|
996
1019
|
className: "flex-shrink-0 rounded-full bg-blue-50 px-2 py-0.5 text-[11px] font-medium text-blue-600 dark:bg-blue-950/40 dark:text-blue-300",
|
|
997
1020
|
children: s
|
|
998
1021
|
}),
|
|
999
|
-
a === 0 ? /* @__PURE__ */
|
|
1022
|
+
a === 0 ? /* @__PURE__ */ M("span", {
|
|
1000
1023
|
className: "flex-shrink-0 rounded-full bg-white px-2 py-0.5 text-[11px] font-medium text-blue-600 ring-1 ring-blue-100 dark:bg-slate-950/40 dark:text-blue-300 dark:ring-blue-900/50",
|
|
1001
1024
|
children: "最新"
|
|
1002
1025
|
}) : null,
|
|
1003
|
-
u ? /* @__PURE__ */
|
|
1026
|
+
u ? /* @__PURE__ */ M("span", {
|
|
1004
1027
|
className: "flex-shrink-0 rounded-full bg-emerald-50 px-2 py-0.5 text-[11px] font-medium text-emerald-600 dark:bg-emerald-950/30 dark:text-emerald-300",
|
|
1005
1028
|
children: u
|
|
1006
1029
|
}) : null,
|
|
1007
|
-
/* @__PURE__ */
|
|
1030
|
+
/* @__PURE__ */ M("span", {
|
|
1008
1031
|
className: "truncate font-medium text-slate-800 dark:text-slate-100",
|
|
1009
1032
|
children: c
|
|
1010
1033
|
})
|
|
1011
1034
|
]
|
|
1012
1035
|
}),
|
|
1013
|
-
i.summary ? /* @__PURE__ */
|
|
1036
|
+
i.summary ? /* @__PURE__ */ M("div", {
|
|
1014
1037
|
className: "mt-1 truncate text-[12px] leading-5 text-slate-600 dark:text-slate-300",
|
|
1015
1038
|
children: i.summary
|
|
1016
|
-
}) : /* @__PURE__ */
|
|
1039
|
+
}) : /* @__PURE__ */ M("div", {
|
|
1017
1040
|
className: "mt-1 text-[12px] leading-5 text-slate-500 dark:text-slate-400",
|
|
1018
1041
|
children: l
|
|
1019
1042
|
}),
|
|
1020
|
-
/* @__PURE__ */
|
|
1043
|
+
/* @__PURE__ */ N("div", {
|
|
1021
1044
|
className: "mt-1 flex min-w-0 items-center gap-1.5 text-[11px] leading-4 text-slate-400",
|
|
1022
|
-
children: [i.nextAction ? /* @__PURE__ */
|
|
1045
|
+
children: [i.nextAction ? /* @__PURE__ */ N("span", {
|
|
1023
1046
|
className: "truncate text-blue-600 dark:text-blue-300",
|
|
1024
1047
|
children: ["恢复后阶段:", i.nextAction]
|
|
1025
|
-
}) : /* @__PURE__ */
|
|
1048
|
+
}) : /* @__PURE__ */ M("span", {
|
|
1026
1049
|
className: "truncate",
|
|
1027
1050
|
children: l
|
|
1028
|
-
}), i.timestamp ? /* @__PURE__ */
|
|
1051
|
+
}), i.timestamp ? /* @__PURE__ */ M("span", {
|
|
1029
1052
|
className: "hidden flex-shrink-0 sm:inline",
|
|
1030
|
-
children:
|
|
1053
|
+
children: Ht(i.timestamp)
|
|
1031
1054
|
}) : null]
|
|
1032
1055
|
})
|
|
1033
1056
|
]
|
|
1034
1057
|
}),
|
|
1035
|
-
/* @__PURE__ */
|
|
1058
|
+
/* @__PURE__ */ N("button", {
|
|
1036
1059
|
type: "button",
|
|
1037
1060
|
"aria-label": `恢复到${s}`,
|
|
1038
1061
|
disabled: o,
|
|
@@ -1045,7 +1068,7 @@ function $t({ checkpoints: e, isStreaming: t, onResumeCheckpoint: r }) {
|
|
|
1045
1068
|
});
|
|
1046
1069
|
},
|
|
1047
1070
|
className: "inline-flex h-8 flex-shrink-0 items-center gap-1 rounded-md border border-slate-200 bg-white px-2.5 text-[11px] font-medium text-slate-600 transition hover:border-blue-300 hover:text-blue-600 disabled:cursor-not-allowed disabled:opacity-50 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300 dark:hover:border-blue-500 dark:hover:text-blue-300",
|
|
1048
|
-
children: [/* @__PURE__ */
|
|
1071
|
+
children: [/* @__PURE__ */ M(C, { className: "h-3 w-3" }), "恢复"]
|
|
1049
1072
|
})
|
|
1050
1073
|
]
|
|
1051
1074
|
}, i.checkpointId);
|
|
@@ -1053,31 +1076,31 @@ function $t({ checkpoints: e, isStreaming: t, onResumeCheckpoint: r }) {
|
|
|
1053
1076
|
})]
|
|
1054
1077
|
});
|
|
1055
1078
|
}
|
|
1056
|
-
function
|
|
1057
|
-
return /* @__PURE__ */
|
|
1079
|
+
function on({ attachments: e, isMobile: t, onOpenAttachmentPreview: n }) {
|
|
1080
|
+
return /* @__PURE__ */ M("div", {
|
|
1058
1081
|
className: "mb-3 flex flex-wrap gap-3",
|
|
1059
|
-
children: e.map((e, r) => e.type.startsWith("image/") ? e.url ? /* @__PURE__ */
|
|
1082
|
+
children: e.map((e, r) => e.type.startsWith("image/") ? e.url ? /* @__PURE__ */ M("button", {
|
|
1060
1083
|
type: "button",
|
|
1061
1084
|
onClick: () => n(e),
|
|
1062
1085
|
className: J("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]"),
|
|
1063
|
-
children: /* @__PURE__ */
|
|
1086
|
+
children: /* @__PURE__ */ M("img", {
|
|
1064
1087
|
src: e.url,
|
|
1065
1088
|
alt: e.name,
|
|
1066
1089
|
className: J("object-cover transition group-hover:scale-[1.02]", t ? "max-h-[16rem] w-full max-w-full" : "max-h-[200px] max-w-[200px]")
|
|
1067
1090
|
})
|
|
1068
|
-
}, `${e.name}-${r}`) : /* @__PURE__ */
|
|
1091
|
+
}, `${e.name}-${r}`) : /* @__PURE__ */ M("div", {
|
|
1069
1092
|
className: J("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]"),
|
|
1070
1093
|
children: e.name
|
|
1071
|
-
}, `${e.name}-${r}`) : /* @__PURE__ */
|
|
1094
|
+
}, `${e.name}-${r}`) : /* @__PURE__ */ N("div", {
|
|
1072
1095
|
className: J("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"),
|
|
1073
|
-
children: [/* @__PURE__ */
|
|
1096
|
+
children: [/* @__PURE__ */ M(x, { className: "h-4 w-4 flex-shrink-0 text-blue-500" }), e.url ? /* @__PURE__ */ M("a", {
|
|
1074
1097
|
href: e.url,
|
|
1075
1098
|
target: "_blank",
|
|
1076
1099
|
rel: "noreferrer",
|
|
1077
1100
|
className: "truncate text-sm text-slate-700 hover:underline dark:text-slate-300",
|
|
1078
1101
|
title: e.name,
|
|
1079
1102
|
children: e.name
|
|
1080
|
-
}) : /* @__PURE__ */
|
|
1103
|
+
}) : /* @__PURE__ */ M("span", {
|
|
1081
1104
|
className: "truncate text-sm text-slate-700 dark:text-slate-300",
|
|
1082
1105
|
title: e.name,
|
|
1083
1106
|
children: e.name
|
|
@@ -1085,75 +1108,75 @@ function en({ attachments: e, isMobile: t, onOpenAttachmentPreview: n }) {
|
|
|
1085
1108
|
}, `${e.name}-${r}`))
|
|
1086
1109
|
});
|
|
1087
1110
|
}
|
|
1088
|
-
function
|
|
1089
|
-
return /* @__PURE__ */
|
|
1111
|
+
function sn({ message: e }) {
|
|
1112
|
+
return /* @__PURE__ */ M("div", {
|
|
1090
1113
|
className: "w-full px-0 py-2 sm:px-4",
|
|
1091
|
-
children: /* @__PURE__ */
|
|
1114
|
+
children: /* @__PURE__ */ N("div", {
|
|
1092
1115
|
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",
|
|
1093
1116
|
children: [
|
|
1094
|
-
/* @__PURE__ */
|
|
1117
|
+
/* @__PURE__ */ N("div", {
|
|
1095
1118
|
className: "flex items-center gap-2 font-medium",
|
|
1096
|
-
children: [e.status === "running" ? /* @__PURE__ */
|
|
1119
|
+
children: [e.status === "running" ? /* @__PURE__ */ M(C, { className: "h-4 w-4 animate-spin text-amber-600 dark:text-amber-300" }) : e.status === "failed" ? /* @__PURE__ */ M(E, { className: "h-4 w-4 text-rose-600 dark:text-rose-400" }) : /* @__PURE__ */ M(n, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" }), /* @__PURE__ */ M("span", { children: e.content })]
|
|
1097
1120
|
}),
|
|
1098
|
-
e.compactedUntilSeqId ? /* @__PURE__ */
|
|
1121
|
+
e.compactedUntilSeqId ? /* @__PURE__ */ N("div", {
|
|
1099
1122
|
className: "mt-1 text-xs text-amber-700/80 dark:text-amber-200/80",
|
|
1100
1123
|
children: ["已折叠到会话事件 #", e.compactedUntilSeqId]
|
|
1101
1124
|
}) : null,
|
|
1102
|
-
e.summary ? /* @__PURE__ */
|
|
1125
|
+
e.summary ? /* @__PURE__ */ N("details", {
|
|
1103
1126
|
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",
|
|
1104
|
-
children: [/* @__PURE__ */
|
|
1127
|
+
children: [/* @__PURE__ */ M("summary", {
|
|
1105
1128
|
className: "cursor-pointer select-none text-xs font-medium text-amber-800 dark:text-amber-200",
|
|
1106
1129
|
children: "查看压缩摘要"
|
|
1107
|
-
}), /* @__PURE__ */
|
|
1130
|
+
}), /* @__PURE__ */ M("div", {
|
|
1108
1131
|
className: "mt-2 text-[13px] leading-relaxed text-slate-700 dark:text-slate-200",
|
|
1109
|
-
children: /* @__PURE__ */
|
|
1132
|
+
children: /* @__PURE__ */ M(X, { content: e.summary })
|
|
1110
1133
|
})]
|
|
1111
1134
|
}) : null
|
|
1112
1135
|
]
|
|
1113
1136
|
})
|
|
1114
1137
|
});
|
|
1115
1138
|
}
|
|
1116
|
-
function
|
|
1117
|
-
let [i, o] =
|
|
1118
|
-
|
|
1139
|
+
function cn({ label: e, tone: t, value: r }) {
|
|
1140
|
+
let [i, o] = V("idle"), s = zt(r);
|
|
1141
|
+
R(() => {
|
|
1119
1142
|
if (i === "idle") return;
|
|
1120
1143
|
let e = window.setTimeout(() => o("idle"), 1600);
|
|
1121
1144
|
return () => window.clearTimeout(e);
|
|
1122
1145
|
}, [i]);
|
|
1123
1146
|
let c = async () => {
|
|
1124
|
-
o(await
|
|
1147
|
+
o(await Bt(s) ? "copied" : "failed");
|
|
1125
1148
|
};
|
|
1126
|
-
return /* @__PURE__ */
|
|
1149
|
+
return /* @__PURE__ */ N("div", { children: [/* @__PURE__ */ N("div", {
|
|
1127
1150
|
className: "mb-1 flex items-center justify-between gap-2",
|
|
1128
|
-
children: [/* @__PURE__ */
|
|
1151
|
+
children: [/* @__PURE__ */ M("div", {
|
|
1129
1152
|
className: J("text-xs font-semibold uppercase", t === "input" ? "text-blue-500" : t === "error" ? "text-rose-500" : "text-emerald-500"),
|
|
1130
1153
|
children: e
|
|
1131
|
-
}), /* @__PURE__ */
|
|
1154
|
+
}), /* @__PURE__ */ N("button", {
|
|
1132
1155
|
type: "button",
|
|
1133
1156
|
onClick: () => {
|
|
1134
1157
|
c();
|
|
1135
1158
|
},
|
|
1136
1159
|
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",
|
|
1137
|
-
children: [i === "copied" ? /* @__PURE__ */
|
|
1160
|
+
children: [i === "copied" ? /* @__PURE__ */ M(n, { className: "h-3.5 w-3.5 text-emerald-500" }) : /* @__PURE__ */ M(a, { className: "h-3.5 w-3.5" }), i === "copied" ? "已复制" : i === "failed" ? "复制失败" : "复制"]
|
|
1138
1161
|
})]
|
|
1139
|
-
}), /* @__PURE__ */
|
|
1162
|
+
}), /* @__PURE__ */ M("div", {
|
|
1140
1163
|
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]",
|
|
1141
1164
|
children: s
|
|
1142
1165
|
})] });
|
|
1143
1166
|
}
|
|
1144
|
-
function
|
|
1145
|
-
let [a, o] =
|
|
1146
|
-
return l ? /* @__PURE__ */
|
|
1167
|
+
function ln({ isLastMessage: e, isStreaming: t, message: n, onDeleteFeedback: r, onSubmitFeedback: i }) {
|
|
1168
|
+
let [a, o] = V(!1), [s, c] = V(n.feedback?.comment || ""), l = St(n, t, e), u = !!n.feedback?.pending, d = n.feedback?.rating;
|
|
1169
|
+
return l ? /* @__PURE__ */ N("div", {
|
|
1147
1170
|
className: "mt-3 flex flex-col gap-2",
|
|
1148
1171
|
children: [
|
|
1149
|
-
/* @__PURE__ */
|
|
1172
|
+
/* @__PURE__ */ N("div", {
|
|
1150
1173
|
className: "flex flex-wrap items-center gap-2 text-xs text-slate-500 dark:text-slate-400",
|
|
1151
1174
|
children: [
|
|
1152
|
-
/* @__PURE__ */
|
|
1175
|
+
/* @__PURE__ */ M("span", {
|
|
1153
1176
|
className: "font-medium",
|
|
1154
1177
|
children: "本次回复有帮助吗?"
|
|
1155
1178
|
}),
|
|
1156
|
-
/* @__PURE__ */
|
|
1179
|
+
/* @__PURE__ */ N("button", {
|
|
1157
1180
|
type: "button",
|
|
1158
1181
|
disabled: u,
|
|
1159
1182
|
onClick: () => i({
|
|
@@ -1162,45 +1185,45 @@ function rn({ isLastMessage: e, isStreaming: t, message: n, onDeleteFeedback: r,
|
|
|
1162
1185
|
comment: ""
|
|
1163
1186
|
}),
|
|
1164
1187
|
className: J("inline-flex items-center gap-1 rounded-full border px-2.5 py-1 font-medium transition disabled:cursor-not-allowed disabled:opacity-60", d === "up" ? "border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-900/70 dark:bg-emerald-950/30 dark:text-emerald-200" : "border-slate-200 bg-white text-slate-600 hover:border-emerald-200 hover:text-emerald-700 dark:border-slate-800 dark:bg-slate-950/40 dark:text-slate-300 dark:hover:border-emerald-900/70 dark:hover:text-emerald-200"),
|
|
1165
|
-
children: [/* @__PURE__ */
|
|
1188
|
+
children: [/* @__PURE__ */ M(O, { className: "h-3.5 w-3.5" }), "有帮助"]
|
|
1166
1189
|
}),
|
|
1167
|
-
/* @__PURE__ */
|
|
1190
|
+
/* @__PURE__ */ N("button", {
|
|
1168
1191
|
type: "button",
|
|
1169
1192
|
disabled: u,
|
|
1170
1193
|
onClick: () => {
|
|
1171
1194
|
c(n.feedback?.comment || ""), o((e) => !e);
|
|
1172
1195
|
},
|
|
1173
1196
|
className: J("inline-flex items-center gap-1 rounded-full border px-2.5 py-1 font-medium transition disabled:cursor-not-allowed disabled:opacity-60", d === "down" ? "border-rose-200 bg-rose-50 text-rose-700 dark:border-rose-900/70 dark:bg-rose-950/30 dark:text-rose-200" : "border-slate-200 bg-white text-slate-600 hover:border-rose-200 hover:text-rose-700 dark:border-slate-800 dark:bg-slate-950/40 dark:text-slate-300 dark:hover:border-rose-900/70 dark:hover:text-rose-200"),
|
|
1174
|
-
children: [/* @__PURE__ */
|
|
1197
|
+
children: [/* @__PURE__ */ M(oe, { className: "h-3.5 w-3.5" }), "需改进"]
|
|
1175
1198
|
}),
|
|
1176
|
-
n.feedback ? /* @__PURE__ */
|
|
1199
|
+
n.feedback ? /* @__PURE__ */ N("button", {
|
|
1177
1200
|
type: "button",
|
|
1178
1201
|
disabled: u,
|
|
1179
1202
|
onClick: () => r(n),
|
|
1180
1203
|
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",
|
|
1181
|
-
children: [/* @__PURE__ */
|
|
1204
|
+
children: [/* @__PURE__ */ M(se, { className: "h-3.5 w-3.5" }), "删除反馈"]
|
|
1182
1205
|
}) : null,
|
|
1183
|
-
u ? /* @__PURE__ */
|
|
1206
|
+
u ? /* @__PURE__ */ M("span", {
|
|
1184
1207
|
className: "text-slate-400",
|
|
1185
1208
|
children: "提交中…"
|
|
1186
1209
|
}) : null
|
|
1187
1210
|
]
|
|
1188
1211
|
}),
|
|
1189
|
-
a ? /* @__PURE__ */
|
|
1212
|
+
a ? /* @__PURE__ */ N("div", {
|
|
1190
1213
|
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",
|
|
1191
|
-
children: [/* @__PURE__ */
|
|
1214
|
+
children: [/* @__PURE__ */ M("textarea", {
|
|
1192
1215
|
value: s,
|
|
1193
1216
|
onChange: (e) => c(e.target.value),
|
|
1194
1217
|
placeholder: "可以补充哪里不准确、缺失或不符合预期。",
|
|
1195
1218
|
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"
|
|
1196
|
-
}), /* @__PURE__ */
|
|
1219
|
+
}), /* @__PURE__ */ N("div", {
|
|
1197
1220
|
className: "mt-2 flex flex-wrap justify-end gap-2",
|
|
1198
|
-
children: [/* @__PURE__ */
|
|
1221
|
+
children: [/* @__PURE__ */ M("button", {
|
|
1199
1222
|
type: "button",
|
|
1200
1223
|
onClick: () => o(!1),
|
|
1201
1224
|
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",
|
|
1202
1225
|
children: "取消"
|
|
1203
|
-
}), /* @__PURE__ */
|
|
1226
|
+
}), /* @__PURE__ */ M("button", {
|
|
1204
1227
|
type: "button",
|
|
1205
1228
|
disabled: u,
|
|
1206
1229
|
onClick: () => {
|
|
@@ -1214,92 +1237,92 @@ function rn({ isLastMessage: e, isStreaming: t, message: n, onDeleteFeedback: r,
|
|
|
1214
1237
|
children: "提交点踩"
|
|
1215
1238
|
})]
|
|
1216
1239
|
})]
|
|
1217
|
-
}) : d === "down" && n.feedback?.comment ? /* @__PURE__ */
|
|
1240
|
+
}) : d === "down" && n.feedback?.comment ? /* @__PURE__ */ N("div", {
|
|
1218
1241
|
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",
|
|
1219
1242
|
children: ["反馈:", n.feedback.comment]
|
|
1220
1243
|
}) : null,
|
|
1221
|
-
n.feedback?.error ? /* @__PURE__ */
|
|
1244
|
+
n.feedback?.error ? /* @__PURE__ */ M("div", {
|
|
1222
1245
|
className: "text-xs text-rose-600 dark:text-rose-300",
|
|
1223
1246
|
children: n.feedback.error
|
|
1224
1247
|
}) : null
|
|
1225
1248
|
]
|
|
1226
1249
|
}) : null;
|
|
1227
1250
|
}
|
|
1228
|
-
function
|
|
1229
|
-
return s.role === "user" ? /* @__PURE__ */
|
|
1251
|
+
function un({ agentName: e, isMobile: i, isStreaming: a, isLastMessage: o, message: s, onDeleteFeedback: c, onOpenAttachmentPreview: l, onRespondToApproval: u, onSubmitFeedback: d }) {
|
|
1252
|
+
return s.role === "user" ? /* @__PURE__ */ M("div", {
|
|
1230
1253
|
className: "mb-3 flex justify-end",
|
|
1231
|
-
children: /* @__PURE__ */
|
|
1254
|
+
children: /* @__PURE__ */ N("div", {
|
|
1232
1255
|
className: "max-w-[80%] rounded-2xl rounded-br-sm bg-blue-600 px-3.5 py-2.5 text-[14px] leading-relaxed text-white dark:bg-blue-500",
|
|
1233
|
-
children: [s.attachments?.length ? /* @__PURE__ */
|
|
1256
|
+
children: [s.attachments?.length ? /* @__PURE__ */ M(on, {
|
|
1234
1257
|
attachments: s.attachments,
|
|
1235
1258
|
isMobile: i,
|
|
1236
1259
|
onOpenAttachmentPreview: l
|
|
1237
1260
|
}) : null, s.content]
|
|
1238
1261
|
})
|
|
1239
|
-
}) : /* @__PURE__ */
|
|
1262
|
+
}) : /* @__PURE__ */ N("div", {
|
|
1240
1263
|
className: "mb-3 max-w-none",
|
|
1241
1264
|
children: [
|
|
1242
|
-
/* @__PURE__ */
|
|
1265
|
+
/* @__PURE__ */ N("div", {
|
|
1243
1266
|
className: "mb-1.5 flex items-center gap-2 text-xs text-slate-400",
|
|
1244
|
-
children: [/* @__PURE__ */
|
|
1267
|
+
children: [/* @__PURE__ */ M(t, { className: "w-3.5 h-3.5" }), /* @__PURE__ */ M("span", { children: e })]
|
|
1245
1268
|
}),
|
|
1246
|
-
s.attachments?.length ? /* @__PURE__ */
|
|
1269
|
+
s.attachments?.length ? /* @__PURE__ */ M(on, {
|
|
1247
1270
|
attachments: s.attachments,
|
|
1248
1271
|
isMobile: i,
|
|
1249
1272
|
onOpenAttachmentPreview: l
|
|
1250
1273
|
}) : null,
|
|
1251
|
-
s.reasoning ? /* @__PURE__ */
|
|
1274
|
+
s.reasoning ? /* @__PURE__ */ N("details", {
|
|
1252
1275
|
className: "group/details mb-3 overflow-hidden rounded-lg border border-emerald-200/70 bg-emerald-50/40 text-sm text-slate-600 transition-colors open:bg-white dark:border-emerald-900/50 dark:bg-emerald-950/10 dark:text-slate-300 dark:open:bg-slate-950/30",
|
|
1253
|
-
children: [/* @__PURE__ */
|
|
1276
|
+
children: [/* @__PURE__ */ N("summary", {
|
|
1254
1277
|
className: "flex cursor-pointer list-none items-center justify-between gap-3 border-l-2 border-emerald-400 px-3 py-2 font-medium outline-none marker:hidden dark:border-emerald-500",
|
|
1255
|
-
children: [/* @__PURE__ */
|
|
1278
|
+
children: [/* @__PURE__ */ N("div", {
|
|
1256
1279
|
className: "flex min-w-0 items-center gap-2",
|
|
1257
1280
|
children: [
|
|
1258
|
-
a && o && !s.content ? /* @__PURE__ */
|
|
1259
|
-
/* @__PURE__ */
|
|
1281
|
+
a && o && !s.content ? /* @__PURE__ */ M(C, { className: "h-4 w-4 animate-spin text-emerald-500" }) : /* @__PURE__ */ M(n, { className: "h-4 w-4 text-emerald-500" }),
|
|
1282
|
+
/* @__PURE__ */ M("span", {
|
|
1260
1283
|
className: "truncate",
|
|
1261
1284
|
children: "思考过程"
|
|
1262
1285
|
}),
|
|
1263
|
-
/* @__PURE__ */
|
|
1286
|
+
/* @__PURE__ */ M("span", {
|
|
1264
1287
|
className: "rounded-full bg-emerald-100 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300",
|
|
1265
1288
|
children: a && o && !s.content ? "生成中" : "已完成"
|
|
1266
1289
|
})
|
|
1267
1290
|
]
|
|
1268
|
-
}), /* @__PURE__ */
|
|
1269
|
-
}), /* @__PURE__ */
|
|
1291
|
+
}), /* @__PURE__ */ M(r, { className: "h-4 w-4 flex-shrink-0 text-slate-400 transition-transform group-open/details:rotate-180" })]
|
|
1292
|
+
}), /* @__PURE__ */ M("div", {
|
|
1270
1293
|
className: "border-t border-emerald-100/80 bg-white/70 dark:border-emerald-950 dark:bg-slate-950/20",
|
|
1271
|
-
children: /* @__PURE__ */
|
|
1294
|
+
children: /* @__PURE__ */ M("div", {
|
|
1272
1295
|
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",
|
|
1273
|
-
children: /* @__PURE__ */
|
|
1296
|
+
children: /* @__PURE__ */ M(X, { content: s.reasoning })
|
|
1274
1297
|
})
|
|
1275
1298
|
})]
|
|
1276
1299
|
}) : null,
|
|
1277
|
-
s.tools ? Object.values(s.tools).map((e, t) => /* @__PURE__ */
|
|
1300
|
+
s.tools ? Object.values(s.tools).map((e, t) => /* @__PURE__ */ N("details", {
|
|
1278
1301
|
open: e.status === "paused" ? !0 : void 0,
|
|
1279
1302
|
className: J("group/details mb-3 rounded-xl border px-3 py-2.5 text-sm transition-all", e.status === "paused" ? "border-amber-200 bg-amber-50/50 text-amber-800 dark:border-amber-900/60 dark:bg-amber-950/20 dark:text-amber-200" : e.status === "error" ? "border-rose-200 bg-rose-50/40 text-rose-700 dark:border-rose-900/60 dark:bg-rose-950/20 dark:text-rose-200" : "border-blue-200 bg-blue-50/30 text-blue-600 dark:border-blue-900/50 dark:bg-blue-950/20 dark:text-blue-400"),
|
|
1280
|
-
children: [/* @__PURE__ */
|
|
1303
|
+
children: [/* @__PURE__ */ M("summary", {
|
|
1281
1304
|
className: "flex cursor-pointer list-none items-center justify-between gap-2 font-medium",
|
|
1282
|
-
children: /* @__PURE__ */
|
|
1305
|
+
children: /* @__PURE__ */ N("div", {
|
|
1283
1306
|
className: "flex items-center gap-2",
|
|
1284
|
-
children: [e.status === "running" ? /* @__PURE__ */
|
|
1307
|
+
children: [e.status === "running" ? /* @__PURE__ */ M(C, { className: "h-4 w-4 animate-spin text-blue-500" }) : e.status === "paused" ? /* @__PURE__ */ M(T, { className: "h-4 w-4 text-amber-500" }) : e.status === "error" ? /* @__PURE__ */ M(k, { className: "h-4 w-4 text-rose-500" }) : /* @__PURE__ */ M(n, { className: "h-4 w-4 text-emerald-500" }), /* @__PURE__ */ N("span", { children: [e.status === "paused" ? "等待审批:" : e.status === "error" ? "工具调用失败:" : "工具调用:", e.name] })]
|
|
1285
1308
|
})
|
|
1286
|
-
}), /* @__PURE__ */
|
|
1309
|
+
}), /* @__PURE__ */ N("div", {
|
|
1287
1310
|
className: J("mx-1 mt-3 flex flex-col gap-3 border-l-2 py-1 pl-4 font-mono text-[13px] leading-relaxed opacity-90", e.status === "paused" ? "border-amber-200 dark:border-amber-800" : e.status === "error" ? "border-rose-200 dark:border-rose-800" : "border-blue-200 dark:border-blue-800"),
|
|
1288
1311
|
children: [
|
|
1289
|
-
e.status === "paused" && e.approvalRequestId ? /* @__PURE__ */
|
|
1312
|
+
e.status === "paused" && e.approvalRequestId ? /* @__PURE__ */ N("div", {
|
|
1290
1313
|
className: "rounded-2xl border border-amber-200 bg-white/75 p-3 font-sans text-sm text-amber-900 shadow-sm dark:border-amber-900/70 dark:bg-slate-950/40 dark:text-amber-100",
|
|
1291
1314
|
children: [
|
|
1292
|
-
/* @__PURE__ */
|
|
1315
|
+
/* @__PURE__ */ M("div", {
|
|
1293
1316
|
className: "font-medium",
|
|
1294
1317
|
children: "该工具调用需要人工确认后继续。"
|
|
1295
1318
|
}),
|
|
1296
|
-
e.serverLabel ? /* @__PURE__ */
|
|
1319
|
+
e.serverLabel ? /* @__PURE__ */ N("div", {
|
|
1297
1320
|
className: "mt-1 text-xs text-amber-700/80 dark:text-amber-200/80",
|
|
1298
1321
|
children: ["MCP Server: ", e.serverLabel]
|
|
1299
1322
|
}) : null,
|
|
1300
|
-
/* @__PURE__ */
|
|
1323
|
+
/* @__PURE__ */ N("div", {
|
|
1301
1324
|
className: "mt-3 flex flex-wrap gap-2",
|
|
1302
|
-
children: [/* @__PURE__ */
|
|
1325
|
+
children: [/* @__PURE__ */ N("button", {
|
|
1303
1326
|
type: "button",
|
|
1304
1327
|
disabled: e.approvalStatus === "approved" || e.approvalStatus === "rejected",
|
|
1305
1328
|
onClick: () => u({
|
|
@@ -1308,8 +1331,8 @@ function an({ agentName: e, isMobile: i, isStreaming: a, isLastMessage: o, messa
|
|
|
1308
1331
|
previousResponseId: e.previousResponseId
|
|
1309
1332
|
}),
|
|
1310
1333
|
className: "inline-flex items-center gap-1.5 rounded-xl 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",
|
|
1311
|
-
children: [/* @__PURE__ */
|
|
1312
|
-
}), /* @__PURE__ */
|
|
1334
|
+
children: [/* @__PURE__ */ M(n, { className: "h-3.5 w-3.5" }), "批准并继续"]
|
|
1335
|
+
}), /* @__PURE__ */ N("button", {
|
|
1313
1336
|
type: "button",
|
|
1314
1337
|
disabled: e.approvalStatus === "approved" || e.approvalStatus === "rejected",
|
|
1315
1338
|
onClick: () => u({
|
|
@@ -1318,17 +1341,17 @@ function an({ agentName: e, isMobile: i, isStreaming: a, isLastMessage: o, messa
|
|
|
1318
1341
|
previousResponseId: e.previousResponseId
|
|
1319
1342
|
}),
|
|
1320
1343
|
className: "inline-flex items-center gap-1.5 rounded-xl border border-rose-200 bg-white px-3 py-1.5 text-xs font-semibold text-rose-600 shadow-sm transition hover:bg-rose-50 disabled:cursor-not-allowed disabled:opacity-55 dark:border-rose-900/70 dark:bg-slate-950 dark:text-rose-300 dark:hover:bg-rose-950/30",
|
|
1321
|
-
children: [/* @__PURE__ */
|
|
1344
|
+
children: [/* @__PURE__ */ M(k, { className: "h-3.5 w-3.5" }), "拒绝"]
|
|
1322
1345
|
})]
|
|
1323
1346
|
})
|
|
1324
1347
|
]
|
|
1325
1348
|
}) : null,
|
|
1326
|
-
e.args ? /* @__PURE__ */
|
|
1349
|
+
e.args ? /* @__PURE__ */ M(cn, {
|
|
1327
1350
|
label: "入参 (Args)",
|
|
1328
1351
|
tone: "input",
|
|
1329
1352
|
value: e.args
|
|
1330
1353
|
}) : null,
|
|
1331
|
-
e.output ? /* @__PURE__ */
|
|
1354
|
+
e.output ? /* @__PURE__ */ M(cn, {
|
|
1332
1355
|
label: "输出 (Output)",
|
|
1333
1356
|
tone: e.status === "error" ? "error" : "output",
|
|
1334
1357
|
value: e.output
|
|
@@ -1336,11 +1359,11 @@ function an({ agentName: e, isMobile: i, isStreaming: a, isLastMessage: o, messa
|
|
|
1336
1359
|
]
|
|
1337
1360
|
})]
|
|
1338
1361
|
}, `${e.name}-${t}`)) : null,
|
|
1339
|
-
/* @__PURE__ */
|
|
1362
|
+
/* @__PURE__ */ M("div", {
|
|
1340
1363
|
className: "w-full break-words",
|
|
1341
|
-
children: s.content ? /* @__PURE__ */
|
|
1364
|
+
children: s.content ? /* @__PURE__ */ M(X, { content: s.content }) : a && o && !s.reasoning && !s.tools ? /* @__PURE__ */ M("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
|
|
1342
1365
|
}),
|
|
1343
|
-
/* @__PURE__ */
|
|
1366
|
+
/* @__PURE__ */ M(ln, {
|
|
1344
1367
|
isLastMessage: o,
|
|
1345
1368
|
isStreaming: a,
|
|
1346
1369
|
message: s,
|
|
@@ -1350,30 +1373,77 @@ function an({ agentName: e, isMobile: i, isStreaming: a, isLastMessage: o, messa
|
|
|
1350
1373
|
]
|
|
1351
1374
|
});
|
|
1352
1375
|
}
|
|
1353
|
-
function
|
|
1354
|
-
|
|
1376
|
+
function dn({ agentName: e, isMobile: t, isStreaming: n, activity: r, contextIndicator: i, messages: a, onDeleteFeedback: o, onOpenAttachmentPreview: s, onRespondToApproval: c, onSubmitFeedback: l, onStopGeneration: u, onCancelRemote: d, checkpoints: f = [], onResumeCheckpoint: p, scrollRef: m }) {
|
|
1377
|
+
let [h, g] = V(0), [_, v] = V(0), [y, b] = V(/* @__PURE__ */ new Map());
|
|
1378
|
+
fe(() => {
|
|
1379
|
+
let e = m.current;
|
|
1380
|
+
if (!e) return;
|
|
1381
|
+
let t = () => {
|
|
1382
|
+
g(e.scrollTop), v(e.clientHeight);
|
|
1383
|
+
};
|
|
1384
|
+
if (t(), typeof ResizeObserver > "u") return;
|
|
1385
|
+
let n = new ResizeObserver(() => t());
|
|
1386
|
+
return n.observe(e), () => n.disconnect();
|
|
1387
|
+
}, [m]);
|
|
1388
|
+
let ee = pe(() => Wt({
|
|
1389
|
+
items: a,
|
|
1390
|
+
scrollTop: h,
|
|
1391
|
+
viewportHeight: _,
|
|
1392
|
+
overscan: Kt,
|
|
1393
|
+
defaultItemHeight: Gt,
|
|
1394
|
+
measuredHeights: y,
|
|
1395
|
+
getItemKey: (e, t) => e?.id || String(t)
|
|
1396
|
+
}), [
|
|
1397
|
+
y,
|
|
1398
|
+
a,
|
|
1399
|
+
h,
|
|
1400
|
+
_
|
|
1401
|
+
]), x = ee.visibleItems, te = (e, t) => {
|
|
1402
|
+
!e || !Number.isFinite(t) || t <= 0 || b((n) => {
|
|
1403
|
+
if (n.get(e) === t) return n;
|
|
1404
|
+
let r = new Map(n);
|
|
1405
|
+
return r.set(e, t), r;
|
|
1406
|
+
});
|
|
1407
|
+
};
|
|
1408
|
+
return /* @__PURE__ */ N("div", {
|
|
1355
1409
|
ref: m,
|
|
1410
|
+
onScroll: (e) => g(e.currentTarget.scrollTop),
|
|
1356
1411
|
className: J("custom-scrollbar relative min-h-0 flex-1 overflow-y-auto scroll-smooth", t ? "px-3 py-3" : "px-4 py-5"),
|
|
1357
|
-
children: [/* @__PURE__ */
|
|
1412
|
+
children: [/* @__PURE__ */ N("div", {
|
|
1358
1413
|
className: J("mx-auto flex w-full max-w-[64rem] flex-col", r ? "pb-10 sm:pb-10" : "pb-6 sm:pb-8"),
|
|
1359
|
-
children: [/* @__PURE__ */
|
|
1414
|
+
children: [/* @__PURE__ */ M(an, {
|
|
1360
1415
|
checkpoints: f,
|
|
1361
1416
|
isStreaming: n,
|
|
1362
1417
|
onResumeCheckpoint: p
|
|
1363
|
-
}), a.length === 0 ? /* @__PURE__ */
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1418
|
+
}), a.length === 0 ? /* @__PURE__ */ M(Qt, { agentName: e }) : /* @__PURE__ */ M("div", {
|
|
1419
|
+
style: { height: ee.totalHeight },
|
|
1420
|
+
className: "relative",
|
|
1421
|
+
children: x.map((r) => /* @__PURE__ */ M("div", {
|
|
1422
|
+
ref: (e) => {
|
|
1423
|
+
e && te(r.item.id || String(r.index), e.offsetHeight);
|
|
1424
|
+
},
|
|
1425
|
+
style: {
|
|
1426
|
+
position: "absolute",
|
|
1427
|
+
top: r.top,
|
|
1428
|
+
left: 0,
|
|
1429
|
+
right: 0
|
|
1430
|
+
},
|
|
1431
|
+
children: r.item.role === "system" ? /* @__PURE__ */ M(sn, { message: r.item }) : /* @__PURE__ */ M(un, {
|
|
1432
|
+
agentName: e,
|
|
1433
|
+
isMobile: t,
|
|
1434
|
+
isStreaming: n,
|
|
1435
|
+
isLastMessage: r.index === a.length - 1,
|
|
1436
|
+
message: r.item,
|
|
1437
|
+
onDeleteFeedback: o,
|
|
1438
|
+
onOpenAttachmentPreview: s,
|
|
1439
|
+
onRespondToApproval: c,
|
|
1440
|
+
onSubmitFeedback: l
|
|
1441
|
+
})
|
|
1442
|
+
}, r.item.id || r.index))
|
|
1443
|
+
})]
|
|
1444
|
+
}), r ? /* @__PURE__ */ M("div", {
|
|
1375
1445
|
className: "sticky bottom-1 z-20 mx-auto flex w-full max-w-[64rem] justify-end",
|
|
1376
|
-
children: /* @__PURE__ */
|
|
1446
|
+
children: /* @__PURE__ */ M(Zt, {
|
|
1377
1447
|
activity: r,
|
|
1378
1448
|
contextIndicator: i,
|
|
1379
1449
|
onStopGeneration: u,
|
|
@@ -1384,13 +1454,13 @@ function on({ agentName: e, isMobile: t, isStreaming: n, activity: r, contextInd
|
|
|
1384
1454
|
}
|
|
1385
1455
|
//#endregion
|
|
1386
1456
|
//#region src/utils/session-list.js
|
|
1387
|
-
var
|
|
1457
|
+
var fn = new Set([
|
|
1388
1458
|
"in_progress",
|
|
1389
1459
|
"running",
|
|
1390
1460
|
"queued",
|
|
1391
1461
|
"pending"
|
|
1392
|
-
]),
|
|
1393
|
-
function
|
|
1462
|
+
]), pn = 300 * 1e3;
|
|
1463
|
+
function mn(e) {
|
|
1394
1464
|
let t = e?.UpdatedAt ?? e?.updated_at;
|
|
1395
1465
|
if (typeof t == "string") {
|
|
1396
1466
|
let e = Date.parse(t);
|
|
@@ -1398,10 +1468,10 @@ function ln(e) {
|
|
|
1398
1468
|
}
|
|
1399
1469
|
return typeof t == "number" && Number.isFinite(t) ? t : 0;
|
|
1400
1470
|
}
|
|
1401
|
-
function
|
|
1471
|
+
function hn(e) {
|
|
1402
1472
|
return String(e || "").trim().toLowerCase();
|
|
1403
1473
|
}
|
|
1404
|
-
function
|
|
1474
|
+
function gn(e) {
|
|
1405
1475
|
if (!e) return "";
|
|
1406
1476
|
let t = typeof e == "number" ? new Date(e > 1e11 ? e : e * 1e3) : new Date(e);
|
|
1407
1477
|
return Number.isNaN(t.getTime()) ? "" : t.toLocaleString("zh-CN", {
|
|
@@ -1413,7 +1483,7 @@ function dn(e) {
|
|
|
1413
1483
|
hour12: !1
|
|
1414
1484
|
});
|
|
1415
1485
|
}
|
|
1416
|
-
function
|
|
1486
|
+
function _n(e) {
|
|
1417
1487
|
return [
|
|
1418
1488
|
e?.Title,
|
|
1419
1489
|
e?.Summary,
|
|
@@ -1422,69 +1492,80 @@ function fn(e) {
|
|
|
1422
1492
|
e?.SessionId,
|
|
1423
1493
|
e?.Model?.display_name,
|
|
1424
1494
|
e?.Model?.id
|
|
1425
|
-
].map(
|
|
1495
|
+
].map(hn).join(" ");
|
|
1426
1496
|
}
|
|
1427
|
-
function
|
|
1428
|
-
if (!
|
|
1429
|
-
let n =
|
|
1497
|
+
function vn(e, t = {}) {
|
|
1498
|
+
if (!fn.has(hn(e?.ActiveRunStatus))) return !1;
|
|
1499
|
+
let n = mn(e);
|
|
1430
1500
|
if (!n) return !0;
|
|
1431
|
-
let r = Number.isFinite(Number(t.now)) ? Number(t.now) : Date.now(), i = Number.isFinite(Number(t.activeStaleAfterMs)) ? Number(t.activeStaleAfterMs) :
|
|
1501
|
+
let r = Number.isFinite(Number(t.now)) ? Number(t.now) : Date.now(), i = Number.isFinite(Number(t.activeStaleAfterMs)) ? Number(t.activeStaleAfterMs) : pn;
|
|
1432
1502
|
return r - n <= i;
|
|
1433
1503
|
}
|
|
1434
|
-
function
|
|
1435
|
-
let r =
|
|
1436
|
-
return (Array.isArray(e) ? e : []).filter((e) => e?.SessionId).filter((e) => !r ||
|
|
1437
|
-
let r = +!!
|
|
1438
|
-
|
|
1504
|
+
function yn(e = [], t = "", n = {}) {
|
|
1505
|
+
let r = hn(t), i = new Set(Array.isArray(n.pinnedSessionIds) ? n.pinnedSessionIds : []);
|
|
1506
|
+
return (Array.isArray(e) ? e : []).filter((e) => e?.SessionId).filter((e) => !r || _n(e).includes(r)).slice().sort((e, t) => {
|
|
1507
|
+
let r = +!!i.has(e.SessionId), a = +!!i.has(t.SessionId);
|
|
1508
|
+
if (r !== a) return a - r;
|
|
1509
|
+
let o = +!!vn(e, n), s = +!!vn(t, n);
|
|
1510
|
+
return o === s ? mn(t) - mn(e) : s - o;
|
|
1439
1511
|
});
|
|
1440
1512
|
}
|
|
1441
|
-
function
|
|
1442
|
-
let n =
|
|
1513
|
+
function bn(e, t = {}) {
|
|
1514
|
+
let n = vn(e, t);
|
|
1443
1515
|
return {
|
|
1444
1516
|
running: n,
|
|
1445
|
-
label: n ? "" :
|
|
1517
|
+
label: n ? "" : gn(e?.UpdatedAt ?? e?.updated_at)
|
|
1446
1518
|
};
|
|
1447
1519
|
}
|
|
1448
1520
|
//#endregion
|
|
1449
1521
|
//#region src/components/chat/ChatSidebar.tsx
|
|
1450
|
-
function
|
|
1451
|
-
let [
|
|
1452
|
-
|
|
1453
|
-
|
|
1522
|
+
function xn({ 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 }) {
|
|
1523
|
+
let [f, p] = V(""), h = pe(() => yn(e, f, { pinnedSessionIds: c }), [
|
|
1524
|
+
e,
|
|
1525
|
+
c,
|
|
1526
|
+
f
|
|
1527
|
+
]), g = pe(() => new Set(c), [c]);
|
|
1528
|
+
return /* @__PURE__ */ N("div", {
|
|
1529
|
+
className: J("flex h-full min-h-0 flex-col bg-slate-50 dark:bg-slate-950/80", d),
|
|
1454
1530
|
children: [
|
|
1455
|
-
/* @__PURE__ */
|
|
1531
|
+
/* @__PURE__ */ N("div", {
|
|
1456
1532
|
className: "flex flex-shrink-0 flex-col gap-2 border-b border-slate-200/30 px-3 py-3 dark:border-slate-800",
|
|
1457
|
-
children: [/* @__PURE__ */
|
|
1533
|
+
children: [/* @__PURE__ */ N("button", {
|
|
1458
1534
|
type: "button",
|
|
1459
1535
|
onClick: n,
|
|
1460
1536
|
className: "flex w-full items-center justify-between rounded-2xl px-3 py-2 text-sm font-medium transition-colors hover:bg-slate-200/60 dark:hover:bg-slate-800",
|
|
1461
|
-
children: [/* @__PURE__ */
|
|
1537
|
+
children: [/* @__PURE__ */ N("span", {
|
|
1462
1538
|
className: "flex items-center gap-2",
|
|
1463
|
-
children: [/* @__PURE__ */
|
|
1464
|
-
}), /* @__PURE__ */
|
|
1539
|
+
children: [/* @__PURE__ */ M(ne, { className: "h-4 w-4" }), /* @__PURE__ */ M("span", { children: "新对话" })]
|
|
1540
|
+
}), /* @__PURE__ */ M("span", {
|
|
1465
1541
|
className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[11px] text-slate-500 shadow-sm dark:border-slate-700 dark:bg-slate-900",
|
|
1466
1542
|
children: "⌘ N"
|
|
1467
1543
|
})]
|
|
1468
|
-
}), /* @__PURE__ */
|
|
1544
|
+
}), /* @__PURE__ */ N("label", {
|
|
1469
1545
|
className: "flex items-center gap-2 rounded-2xl border border-slate-200 bg-white px-3 py-2 text-xs text-slate-500 shadow-sm focus-within:border-blue-300 focus-within:ring-2 focus-within:ring-blue-100 dark:border-slate-800 dark:bg-slate-900 dark:text-slate-400 dark:focus-within:border-blue-800 dark:focus-within:ring-blue-950/60",
|
|
1470
|
-
children: [/* @__PURE__ */
|
|
1471
|
-
value:
|
|
1472
|
-
onChange: (e) =>
|
|
1546
|
+
children: [/* @__PURE__ */ M(w, { className: "h-3.5 w-3.5 flex-shrink-0" }), /* @__PURE__ */ M("input", {
|
|
1547
|
+
value: f,
|
|
1548
|
+
onChange: (e) => p(e.target.value),
|
|
1473
1549
|
className: "min-w-0 flex-1 bg-transparent text-sm text-slate-700 outline-none placeholder:text-slate-400 dark:text-slate-200",
|
|
1474
1550
|
placeholder: "搜索会话、模型或摘要"
|
|
1475
1551
|
})]
|
|
1476
1552
|
})]
|
|
1477
1553
|
}),
|
|
1478
|
-
/* @__PURE__ */
|
|
1554
|
+
/* @__PURE__ */ N("div", {
|
|
1479
1555
|
className: "min-h-0 flex-1 overflow-y-auto px-2 pb-4 pt-2 custom-scrollbar",
|
|
1480
|
-
|
|
1556
|
+
onScroll: (e) => {
|
|
1557
|
+
if (!o || u || !l || f.trim()) return;
|
|
1558
|
+
let t = e.currentTarget;
|
|
1559
|
+
t.scrollHeight - t.scrollTop - t.clientHeight < 200 && o();
|
|
1560
|
+
},
|
|
1561
|
+
children: [/* @__PURE__ */ N("div", {
|
|
1481
1562
|
className: "px-2 py-2 text-xs font-semibold text-slate-400 dark:text-slate-500",
|
|
1482
|
-
children: ["历史记录",
|
|
1483
|
-
}), /* @__PURE__ */
|
|
1563
|
+
children: ["历史记录", f.trim() ? ` · ${h.length}` : ""]
|
|
1564
|
+
}), /* @__PURE__ */ N("div", {
|
|
1484
1565
|
className: "flex flex-col gap-1.5",
|
|
1485
|
-
children:
|
|
1486
|
-
let n =
|
|
1487
|
-
return /* @__PURE__ */
|
|
1566
|
+
children: [h.length > 0 ? h.map((e) => {
|
|
1567
|
+
let n = bn(e), o = g.has(e.SessionId);
|
|
1568
|
+
return /* @__PURE__ */ N("div", {
|
|
1488
1569
|
role: "button",
|
|
1489
1570
|
tabIndex: 0,
|
|
1490
1571
|
onClick: () => r(e.SessionId),
|
|
@@ -1493,41 +1574,52 @@ function gn({ sessions: e, currentSessionId: t, onCreateNewSession: n, onSelectS
|
|
|
1493
1574
|
},
|
|
1494
1575
|
className: J("group flex items-center justify-between gap-3 rounded-2xl px-3 py-3 text-sm transition-colors", t === e.SessionId ? "bg-slate-200/90 font-medium text-slate-950 dark:bg-slate-800 dark:text-slate-50" : "cursor-pointer text-slate-700 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800/60"),
|
|
1495
1576
|
children: [
|
|
1496
|
-
/* @__PURE__ */
|
|
1577
|
+
/* @__PURE__ */ M("div", {
|
|
1497
1578
|
className: "min-w-0 flex-1 truncate text-[15px] leading-6",
|
|
1498
|
-
children:
|
|
1579
|
+
children: s(e)
|
|
1499
1580
|
}),
|
|
1500
|
-
n.running ? /* @__PURE__ */
|
|
1581
|
+
n.running ? /* @__PURE__ */ M(m, { className: "h-4 w-4 flex-shrink-0 animate-spin text-slate-400 dark:text-slate-500" }) : n.label ? /* @__PURE__ */ M("span", {
|
|
1501
1582
|
className: "flex-shrink-0 text-[11px] leading-none text-slate-400 dark:text-slate-500",
|
|
1502
1583
|
children: n.label
|
|
1503
1584
|
}) : null,
|
|
1504
|
-
/* @__PURE__ */
|
|
1585
|
+
/* @__PURE__ */ M("button", {
|
|
1586
|
+
type: "button",
|
|
1587
|
+
onClick: (t) => a(e.SessionId, t),
|
|
1588
|
+
className: J("rounded-lg p-1.5 transition hover:bg-white md:opacity-0 md:group-hover:opacity-100 dark:hover:bg-slate-900", o ? "text-blue-500 opacity-100" : "text-slate-400"),
|
|
1589
|
+
title: o ? "取消置顶" : "置顶会话",
|
|
1590
|
+
"aria-label": o ? "取消置顶会话" : "置顶会话",
|
|
1591
|
+
children: M(o ? S : te, { className: "h-3.5 w-3.5" })
|
|
1592
|
+
}),
|
|
1593
|
+
/* @__PURE__ */ M("button", {
|
|
1505
1594
|
type: "button",
|
|
1506
1595
|
onClick: (t) => i(e.SessionId, t),
|
|
1507
1596
|
className: "hidden rounded-lg p-1.5 text-slate-400 transition hover:bg-white hover:text-rose-500 md:group-hover:block dark:hover:bg-slate-900",
|
|
1508
1597
|
title: "Delete chat",
|
|
1509
|
-
children: /* @__PURE__ */
|
|
1598
|
+
children: /* @__PURE__ */ M(se, { className: "h-3.5 w-3.5" })
|
|
1510
1599
|
})
|
|
1511
1600
|
]
|
|
1512
1601
|
}, e.SessionId);
|
|
1513
|
-
}) : /* @__PURE__ */
|
|
1602
|
+
}) : /* @__PURE__ */ M("div", {
|
|
1514
1603
|
className: "rounded-xl border border-dashed border-slate-200 px-3 py-8 text-center text-xs text-slate-400 dark:border-slate-800 dark:text-slate-500",
|
|
1515
1604
|
children: "没有匹配的会话"
|
|
1516
|
-
})
|
|
1605
|
+
}), u ? /* @__PURE__ */ N("div", {
|
|
1606
|
+
className: "flex items-center justify-center gap-2 px-3 py-3 text-xs text-slate-400",
|
|
1607
|
+
children: [/* @__PURE__ */ M(m, { className: "h-3.5 w-3.5 animate-spin" }), /* @__PURE__ */ M("span", { children: "加载中" })]
|
|
1608
|
+
}) : null]
|
|
1517
1609
|
})]
|
|
1518
1610
|
}),
|
|
1519
|
-
/* @__PURE__ */
|
|
1611
|
+
/* @__PURE__ */ N("div", {
|
|
1520
1612
|
className: "border-t border-slate-200/30 px-4 py-3 text-center dark:border-slate-800",
|
|
1521
1613
|
children: [
|
|
1522
|
-
/* @__PURE__ */
|
|
1614
|
+
/* @__PURE__ */ M("div", {
|
|
1523
1615
|
className: "text-[10px] font-medium tracking-[0.14em] text-slate-400 dark:text-slate-500",
|
|
1524
1616
|
children: "POWERED BY"
|
|
1525
1617
|
}),
|
|
1526
|
-
/* @__PURE__ */
|
|
1618
|
+
/* @__PURE__ */ M("div", {
|
|
1527
1619
|
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",
|
|
1528
1620
|
children: "Ksyun AgentEngine"
|
|
1529
1621
|
}),
|
|
1530
|
-
/* @__PURE__ */
|
|
1622
|
+
/* @__PURE__ */ M("div", {
|
|
1531
1623
|
className: "mx-auto mt-2 max-w-[13rem] text-[10px] leading-4 text-slate-400 dark:text-slate-500",
|
|
1532
1624
|
children: "Agent 可能产生不准确的信息,请独立验证。"
|
|
1533
1625
|
})
|
|
@@ -1538,117 +1630,117 @@ function gn({ sessions: e, currentSessionId: t, onCreateNewSession: n, onSelectS
|
|
|
1538
1630
|
}
|
|
1539
1631
|
//#endregion
|
|
1540
1632
|
//#region src/components/native/NativeRuntimeLauncher.tsx
|
|
1541
|
-
var
|
|
1542
|
-
function
|
|
1543
|
-
let a = !!n?.Enabled, [o, c] =
|
|
1544
|
-
return /* @__PURE__ */
|
|
1633
|
+
var Sn = de(() => import("./NativeTerminalPanel-DASBHcE0.js").then((e) => e.n).then((e) => ({ default: e.NativeTerminalPanel })));
|
|
1634
|
+
function Cn({ productLabel: e = "原生运行时", nativeManagementLink: t, nativeTerminal: n, workspaceEnabled: r, onOpenWorkspace: i }) {
|
|
1635
|
+
let a = !!n?.Enabled, [o, c] = V(!1);
|
|
1636
|
+
return /* @__PURE__ */ N("section", {
|
|
1545
1637
|
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",
|
|
1546
|
-
children: [/* @__PURE__ */
|
|
1638
|
+
children: [/* @__PURE__ */ M("div", {
|
|
1547
1639
|
className: "mx-auto flex w-full max-w-5xl flex-col justify-center",
|
|
1548
|
-
children: /* @__PURE__ */
|
|
1640
|
+
children: /* @__PURE__ */ N("div", {
|
|
1549
1641
|
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",
|
|
1550
|
-
children: [/* @__PURE__ */
|
|
1642
|
+
children: [/* @__PURE__ */ N("div", {
|
|
1551
1643
|
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",
|
|
1552
1644
|
children: [
|
|
1553
|
-
/* @__PURE__ */
|
|
1645
|
+
/* @__PURE__ */ N("div", {
|
|
1554
1646
|
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",
|
|
1555
1647
|
children: [
|
|
1556
|
-
/* @__PURE__ */
|
|
1648
|
+
/* @__PURE__ */ M(T, { className: "h-3.5 w-3.5" }),
|
|
1557
1649
|
e,
|
|
1558
1650
|
" native runtime"
|
|
1559
1651
|
]
|
|
1560
1652
|
}),
|
|
1561
|
-
/* @__PURE__ */
|
|
1653
|
+
/* @__PURE__ */ M("h1", {
|
|
1562
1654
|
className: "mt-5 text-2xl font-semibold tracking-tight text-slate-950 dark:text-slate-50 sm:text-3xl",
|
|
1563
1655
|
children: "对话请使用原生管理台"
|
|
1564
1656
|
}),
|
|
1565
|
-
/* @__PURE__ */
|
|
1657
|
+
/* @__PURE__ */ M("p", {
|
|
1566
1658
|
className: "mt-3 max-w-2xl text-sm leading-6 text-slate-600 dark:text-slate-300 sm:text-base",
|
|
1567
1659
|
children: "当前运行时的对话状态由原生管理台承载。AgentEngine Hosted UI 在这里保留统一入口和 Workspace 文件管理,不重复实现运行时内部已有的复杂对话状态机。"
|
|
1568
1660
|
})
|
|
1569
1661
|
]
|
|
1570
|
-
}), /* @__PURE__ */
|
|
1662
|
+
}), /* @__PURE__ */ N("div", {
|
|
1571
1663
|
className: "grid gap-4 p-6 md:grid-cols-3 sm:p-8",
|
|
1572
1664
|
children: [
|
|
1573
|
-
/* @__PURE__ */
|
|
1665
|
+
/* @__PURE__ */ N("div", {
|
|
1574
1666
|
className: "rounded-3xl border border-slate-200 bg-white p-5 dark:border-slate-800 dark:bg-slate-900",
|
|
1575
1667
|
children: [
|
|
1576
|
-
/* @__PURE__ */
|
|
1668
|
+
/* @__PURE__ */ M("div", {
|
|
1577
1669
|
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",
|
|
1578
|
-
children: /* @__PURE__ */
|
|
1670
|
+
children: /* @__PURE__ */ M(g, { className: "h-5 w-5" })
|
|
1579
1671
|
}),
|
|
1580
|
-
/* @__PURE__ */
|
|
1672
|
+
/* @__PURE__ */ M("h2", {
|
|
1581
1673
|
className: "mt-4 text-base font-semibold text-slate-950 dark:text-slate-50",
|
|
1582
1674
|
children: "原生管理台"
|
|
1583
1675
|
}),
|
|
1584
|
-
/* @__PURE__ */
|
|
1676
|
+
/* @__PURE__ */ M("p", {
|
|
1585
1677
|
className: "mt-2 text-sm leading-6 text-slate-600 dark:text-slate-300",
|
|
1586
1678
|
children: "使用原生管理台处理对话、工具卡片、思考流、审批、中断和运行时历史,避免跨状态机不一致。"
|
|
1587
1679
|
}),
|
|
1588
|
-
t ? /* @__PURE__ */
|
|
1680
|
+
t ? /* @__PURE__ */ N("a", {
|
|
1589
1681
|
href: t.href,
|
|
1590
1682
|
target: "_blank",
|
|
1591
1683
|
rel: "noreferrer",
|
|
1592
1684
|
title: t.title,
|
|
1593
1685
|
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",
|
|
1594
1686
|
children: [
|
|
1595
|
-
/* @__PURE__ */
|
|
1687
|
+
/* @__PURE__ */ M(s, { className: "h-4 w-4" }),
|
|
1596
1688
|
"打开",
|
|
1597
1689
|
t.label
|
|
1598
1690
|
]
|
|
1599
|
-
}) : /* @__PURE__ */
|
|
1691
|
+
}) : /* @__PURE__ */ M("div", {
|
|
1600
1692
|
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",
|
|
1601
1693
|
children: "当前访问模式不开放原生管理入口。需要完整对话体验时,请使用 owner/private 链接或 CLI。"
|
|
1602
1694
|
})
|
|
1603
1695
|
]
|
|
1604
1696
|
}),
|
|
1605
|
-
/* @__PURE__ */
|
|
1697
|
+
/* @__PURE__ */ N("div", {
|
|
1606
1698
|
className: "rounded-3xl border border-slate-200 bg-white p-5 dark:border-slate-800 dark:bg-slate-900",
|
|
1607
1699
|
children: [
|
|
1608
|
-
/* @__PURE__ */
|
|
1700
|
+
/* @__PURE__ */ M("div", {
|
|
1609
1701
|
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",
|
|
1610
|
-
children: /* @__PURE__ */
|
|
1702
|
+
children: /* @__PURE__ */ M(d, { className: "h-5 w-5" })
|
|
1611
1703
|
}),
|
|
1612
|
-
/* @__PURE__ */
|
|
1704
|
+
/* @__PURE__ */ M("h2", {
|
|
1613
1705
|
className: "mt-4 text-base font-semibold text-slate-950 dark:text-slate-50",
|
|
1614
1706
|
children: "Workspace 文件管理"
|
|
1615
1707
|
}),
|
|
1616
|
-
/* @__PURE__ */
|
|
1708
|
+
/* @__PURE__ */ M("p", {
|
|
1617
1709
|
className: "mt-2 text-sm leading-6 text-slate-600 dark:text-slate-300",
|
|
1618
1710
|
children: "文件浏览、上传、预览仍由 Hosted UI 提供,和原生管理台组合使用覆盖对话与工作区。"
|
|
1619
1711
|
}),
|
|
1620
|
-
r ? /* @__PURE__ */
|
|
1712
|
+
r ? /* @__PURE__ */ N("button", {
|
|
1621
1713
|
type: "button",
|
|
1622
1714
|
onClick: i,
|
|
1623
1715
|
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",
|
|
1624
|
-
children: [/* @__PURE__ */
|
|
1625
|
-
}) : /* @__PURE__ */
|
|
1716
|
+
children: [/* @__PURE__ */ M(d, { className: "h-4 w-4" }), "打开 Workspace"]
|
|
1717
|
+
}) : /* @__PURE__ */ M("div", {
|
|
1626
1718
|
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",
|
|
1627
1719
|
children: "当前链接未开放 Workspace 文件管理。Owner 或 private 链接可使用该能力。"
|
|
1628
1720
|
})
|
|
1629
1721
|
]
|
|
1630
1722
|
}),
|
|
1631
|
-
/* @__PURE__ */
|
|
1723
|
+
/* @__PURE__ */ N("div", {
|
|
1632
1724
|
className: "rounded-3xl border border-slate-200 bg-white p-5 dark:border-slate-800 dark:bg-slate-900",
|
|
1633
1725
|
children: [
|
|
1634
|
-
/* @__PURE__ */
|
|
1726
|
+
/* @__PURE__ */ M("div", {
|
|
1635
1727
|
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",
|
|
1636
|
-
children: /* @__PURE__ */
|
|
1728
|
+
children: /* @__PURE__ */ M(D, { className: "h-5 w-5" })
|
|
1637
1729
|
}),
|
|
1638
|
-
/* @__PURE__ */
|
|
1730
|
+
/* @__PURE__ */ M("h2", {
|
|
1639
1731
|
className: "mt-4 text-base font-semibold text-slate-950 dark:text-slate-50",
|
|
1640
1732
|
children: "原生 TUI"
|
|
1641
1733
|
}),
|
|
1642
|
-
/* @__PURE__ */
|
|
1734
|
+
/* @__PURE__ */ M("p", {
|
|
1643
1735
|
className: "mt-2 text-sm leading-6 text-slate-600 dark:text-slate-300",
|
|
1644
1736
|
children: "如果运行时暴露安全的 ks-terminal.v1 通道,可以在这里进入原生终端 UI;share 链接不会开放该入口。"
|
|
1645
1737
|
}),
|
|
1646
|
-
a ? /* @__PURE__ */
|
|
1738
|
+
a ? /* @__PURE__ */ N("button", {
|
|
1647
1739
|
type: "button",
|
|
1648
1740
|
onClick: () => c(!0),
|
|
1649
1741
|
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",
|
|
1650
|
-
children: [/* @__PURE__ */
|
|
1651
|
-
}) : /* @__PURE__ */
|
|
1742
|
+
children: [/* @__PURE__ */ M(D, { className: "h-4 w-4" }), "打开 TUI"]
|
|
1743
|
+
}) : /* @__PURE__ */ M("div", {
|
|
1652
1744
|
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",
|
|
1653
1745
|
children: "当前运行时未声明可用的浏览器 TUI 能力。"
|
|
1654
1746
|
})
|
|
@@ -1657,9 +1749,9 @@ function vn({ productLabel: e = "原生运行时", nativeManagementLink: t, nati
|
|
|
1657
1749
|
]
|
|
1658
1750
|
})]
|
|
1659
1751
|
})
|
|
1660
|
-
}), n && o ? /* @__PURE__ */
|
|
1752
|
+
}), n && o ? /* @__PURE__ */ M(I, {
|
|
1661
1753
|
fallback: null,
|
|
1662
|
-
children: /* @__PURE__ */
|
|
1754
|
+
children: /* @__PURE__ */ M(Sn, {
|
|
1663
1755
|
capability: n,
|
|
1664
1756
|
open: o,
|
|
1665
1757
|
onClose: () => c(!1)
|
|
@@ -1669,10 +1761,10 @@ function vn({ productLabel: e = "原生运行时", nativeManagementLink: t, nati
|
|
|
1669
1761
|
}
|
|
1670
1762
|
//#endregion
|
|
1671
1763
|
//#region src/stores/ui.ts
|
|
1672
|
-
function
|
|
1764
|
+
function wn(e, t) {
|
|
1673
1765
|
return typeof t == "function" ? t(e) : t;
|
|
1674
1766
|
}
|
|
1675
|
-
var
|
|
1767
|
+
var Tn = he()((e) => ({
|
|
1676
1768
|
sidebarOpen: !0,
|
|
1677
1769
|
mobileSidebarOpen: !1,
|
|
1678
1770
|
mobileActionsOpen: !1,
|
|
@@ -1695,10 +1787,10 @@ var bn = U()((e) => ({
|
|
|
1695
1787
|
setWorkspacePanelWidth: (t) => e({ workspacePanelWidth: t }),
|
|
1696
1788
|
setWorkspacePanelFullscreen: (t) => e({ workspacePanelFullscreen: t }),
|
|
1697
1789
|
setInput: (t) => e({ input: t }),
|
|
1698
|
-
setAttachments: (t) => e((e) => ({ attachments:
|
|
1790
|
+
setAttachments: (t) => e((e) => ({ attachments: wn(e.attachments, t) })),
|
|
1699
1791
|
setPreviewAttachment: (t) => e({ previewAttachment: t }),
|
|
1700
1792
|
setPreviewImageSize: (t) => e({ previewImageSize: t }),
|
|
1701
|
-
setQueuedDrafts: (t) => e((e) => ({ queuedDrafts:
|
|
1793
|
+
setQueuedDrafts: (t) => e((e) => ({ queuedDrafts: wn(e.queuedDrafts, t) })),
|
|
1702
1794
|
pushToast: (t, n = "info") => e((e) => ({ toasts: [...e.toasts, {
|
|
1703
1795
|
id: String(Date.now() + Math.random()),
|
|
1704
1796
|
message: t,
|
|
@@ -1709,71 +1801,71 @@ var bn = U()((e) => ({
|
|
|
1709
1801
|
}));
|
|
1710
1802
|
//#endregion
|
|
1711
1803
|
//#region src/components/workspace/FileEditor.tsx
|
|
1712
|
-
function
|
|
1804
|
+
function En(e) {
|
|
1713
1805
|
let t = String(e || "").split("/").pop() || "", n = t.lastIndexOf(".");
|
|
1714
1806
|
return n >= 0 ? t.slice(n) : "";
|
|
1715
1807
|
}
|
|
1716
|
-
function
|
|
1717
|
-
return
|
|
1808
|
+
function Dn(e) {
|
|
1809
|
+
return Oe.matchFilename(He, `file${e}`);
|
|
1718
1810
|
}
|
|
1719
1811
|
function Q({ content: e, path: t, readOnly: n = !1, onSave: r, onDirtyChange: i, onContentChange: a, getContentRef: o }) {
|
|
1720
|
-
let s =
|
|
1721
|
-
|
|
1812
|
+
let s = B(null), c = B(null), l = B(new Ce()), u = B(new Ce()), d = B(new Ce()), f = B(!1), p = B(r), m = B(i), h = B(a);
|
|
1813
|
+
R(() => {
|
|
1722
1814
|
p.current = r, m.current = i, h.current = a;
|
|
1723
1815
|
}, [
|
|
1724
1816
|
r,
|
|
1725
1817
|
i,
|
|
1726
1818
|
a
|
|
1727
1819
|
]);
|
|
1728
|
-
let g =
|
|
1820
|
+
let g = L((e) => {
|
|
1729
1821
|
f.current !== e && (f.current = e, m.current?.(e));
|
|
1730
1822
|
}, []);
|
|
1731
|
-
return
|
|
1823
|
+
return R(() => {
|
|
1732
1824
|
if (!s.current) return;
|
|
1733
|
-
let r = document.documentElement.classList.contains("dark"), i =
|
|
1825
|
+
let r = document.documentElement.classList.contains("dark"), i = be.of([{
|
|
1734
1826
|
key: "Mod-s",
|
|
1735
1827
|
run: (e) => {
|
|
1736
1828
|
let t = e.state.doc.toString();
|
|
1737
1829
|
return p.current?.(t), g(!1), !0;
|
|
1738
1830
|
},
|
|
1739
1831
|
preventDefault: !0
|
|
1740
|
-
}]), a = new
|
|
1741
|
-
state:
|
|
1832
|
+
}]), a = new ge({
|
|
1833
|
+
state: q.create({
|
|
1742
1834
|
doc: e,
|
|
1743
1835
|
extensions: [
|
|
1836
|
+
xe(),
|
|
1744
1837
|
K(),
|
|
1745
|
-
|
|
1838
|
+
Te(),
|
|
1839
|
+
je(),
|
|
1840
|
+
ve(),
|
|
1841
|
+
ye(),
|
|
1842
|
+
q.allowMultipleSelections.of(!0),
|
|
1843
|
+
Ne(),
|
|
1844
|
+
Pe(Ae, { fallback: !0 }),
|
|
1845
|
+
ke(),
|
|
1846
|
+
ze(),
|
|
1847
|
+
Re(),
|
|
1746
1848
|
Se(),
|
|
1747
|
-
|
|
1748
|
-
me(),
|
|
1749
|
-
he(),
|
|
1750
|
-
be.allowMultipleSelections.of(!0),
|
|
1751
|
-
Ae(),
|
|
1752
|
-
je(De, { fallback: !0 }),
|
|
1753
|
-
Ee(),
|
|
1754
|
-
Ie(),
|
|
1755
|
-
Fe(),
|
|
1756
|
-
q(),
|
|
1849
|
+
_e(),
|
|
1757
1850
|
G(),
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1851
|
+
Ie(),
|
|
1852
|
+
be.of([
|
|
1853
|
+
...Be,
|
|
1854
|
+
...we,
|
|
1761
1855
|
...Le,
|
|
1762
|
-
...
|
|
1763
|
-
...
|
|
1764
|
-
...
|
|
1765
|
-
|
|
1766
|
-
...Re,
|
|
1767
|
-
we
|
|
1856
|
+
...Ee,
|
|
1857
|
+
...Me,
|
|
1858
|
+
...Ve,
|
|
1859
|
+
De
|
|
1768
1860
|
]),
|
|
1769
1861
|
i,
|
|
1770
|
-
|
|
1862
|
+
ge.updateListener.of((e) => {
|
|
1771
1863
|
e.docChanged && (g(!0), h.current?.(e.state.doc.toString()));
|
|
1772
1864
|
}),
|
|
1773
|
-
d.current.of(
|
|
1865
|
+
d.current.of(q.readOnly.of(n)),
|
|
1774
1866
|
l.current.of([]),
|
|
1775
|
-
u.current.of(r ?
|
|
1776
|
-
|
|
1867
|
+
u.current.of(r ? Fe : []),
|
|
1868
|
+
ge.theme({
|
|
1777
1869
|
"&": { height: "100%" },
|
|
1778
1870
|
".cm-scroller": { overflow: "auto" }
|
|
1779
1871
|
})
|
|
@@ -1782,13 +1874,13 @@ function Q({ content: e, path: t, readOnly: n = !1, onSave: r, onDirtyChange: i,
|
|
|
1782
1874
|
parent: s.current
|
|
1783
1875
|
});
|
|
1784
1876
|
c.current = a, o && (o.current = () => a.state.doc.toString());
|
|
1785
|
-
let f =
|
|
1877
|
+
let f = Dn(En(t));
|
|
1786
1878
|
return f && f.load().then((e) => {
|
|
1787
1879
|
c.current && c.current.dispatch({ effects: l.current.reconfigure(e) });
|
|
1788
1880
|
}).catch(() => {}), () => {
|
|
1789
1881
|
a.destroy(), c.current = null, o && (o.current = null);
|
|
1790
1882
|
};
|
|
1791
|
-
}, []),
|
|
1883
|
+
}, []), R(() => {
|
|
1792
1884
|
let t = c.current;
|
|
1793
1885
|
if (!t) return;
|
|
1794
1886
|
let n = t.state.doc.toString();
|
|
@@ -1797,56 +1889,56 @@ function Q({ content: e, path: t, readOnly: n = !1, onSave: r, onDirtyChange: i,
|
|
|
1797
1889
|
to: n.length,
|
|
1798
1890
|
insert: e
|
|
1799
1891
|
} }), g(!1));
|
|
1800
|
-
}, [e, g]),
|
|
1892
|
+
}, [e, g]), R(() => {
|
|
1801
1893
|
let e = c.current;
|
|
1802
1894
|
if (!e) return;
|
|
1803
|
-
let n =
|
|
1895
|
+
let n = Dn(En(t));
|
|
1804
1896
|
n ? n.load().then((e) => {
|
|
1805
1897
|
c.current && c.current.dispatch({ effects: l.current.reconfigure(e) });
|
|
1806
1898
|
}).catch(() => {}) : e.dispatch({ effects: l.current.reconfigure([]) });
|
|
1807
|
-
}, [t]),
|
|
1899
|
+
}, [t]), R(() => {
|
|
1808
1900
|
let e = c.current;
|
|
1809
|
-
e && e.dispatch({ effects: d.current.reconfigure(
|
|
1810
|
-
}, [n]),
|
|
1901
|
+
e && e.dispatch({ effects: d.current.reconfigure(q.readOnly.of(n)) });
|
|
1902
|
+
}, [n]), R(() => {
|
|
1811
1903
|
let e = new MutationObserver(() => {
|
|
1812
1904
|
let e = c.current;
|
|
1813
1905
|
if (!e) return;
|
|
1814
1906
|
let t = document.documentElement.classList.contains("dark");
|
|
1815
|
-
e.dispatch({ effects: u.current.reconfigure(t ?
|
|
1907
|
+
e.dispatch({ effects: u.current.reconfigure(t ? Fe : []) });
|
|
1816
1908
|
});
|
|
1817
1909
|
return e.observe(document.documentElement, {
|
|
1818
1910
|
attributes: !0,
|
|
1819
1911
|
attributeFilter: ["class"]
|
|
1820
1912
|
}), () => e.disconnect();
|
|
1821
|
-
}, []), /* @__PURE__ */
|
|
1913
|
+
}, []), /* @__PURE__ */ M("div", {
|
|
1822
1914
|
ref: s,
|
|
1823
1915
|
className: "h-full w-full overflow-hidden [&_.cm-editor]:h-full [&_.cm-scroller]:auto"
|
|
1824
1916
|
});
|
|
1825
1917
|
}
|
|
1826
1918
|
//#endregion
|
|
1827
1919
|
//#region src/components/workspace/FilePreview.tsx
|
|
1828
|
-
function
|
|
1829
|
-
return n === "markdown" ? /* @__PURE__ */
|
|
1920
|
+
function On({ content: e, objectUrl: t, kind: n, filename: r, path: i }) {
|
|
1921
|
+
return n === "markdown" ? /* @__PURE__ */ M(X, { content: e || "" }) : n === "image" && t ? /* @__PURE__ */ M("div", {
|
|
1830
1922
|
className: "flex items-center justify-center p-4",
|
|
1831
|
-
children: /* @__PURE__ */
|
|
1923
|
+
children: /* @__PURE__ */ M("img", {
|
|
1832
1924
|
src: t,
|
|
1833
1925
|
alt: r,
|
|
1834
1926
|
className: "max-h-[70vh] max-w-full rounded object-contain"
|
|
1835
1927
|
})
|
|
1836
|
-
}) : n === "pdf" && t ? /* @__PURE__ */
|
|
1928
|
+
}) : n === "pdf" && t ? /* @__PURE__ */ M("iframe", {
|
|
1837
1929
|
src: t,
|
|
1838
1930
|
title: r,
|
|
1839
1931
|
className: "h-full w-full border-0"
|
|
1840
|
-
}) : (n === "text" || n === "code") && e !== null ? /* @__PURE__ */
|
|
1932
|
+
}) : (n === "text" || n === "code") && e !== null ? /* @__PURE__ */ M(Q, {
|
|
1841
1933
|
content: e,
|
|
1842
1934
|
path: i || r,
|
|
1843
1935
|
readOnly: !0,
|
|
1844
1936
|
onSave: () => {},
|
|
1845
1937
|
onDirtyChange: () => {},
|
|
1846
1938
|
getContentRef: { current: () => e || "" }
|
|
1847
|
-
}) : /* @__PURE__ */
|
|
1939
|
+
}) : /* @__PURE__ */ M("div", {
|
|
1848
1940
|
className: "flex h-full items-center justify-center px-6 text-center",
|
|
1849
|
-
children: /* @__PURE__ */
|
|
1941
|
+
children: /* @__PURE__ */ M("div", {
|
|
1850
1942
|
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",
|
|
1851
1943
|
children: "该文件类型暂不支持在线预览,请直接下载查看。"
|
|
1852
1944
|
})
|
|
@@ -1854,10 +1946,10 @@ function Cn({ content: e, objectUrl: t, kind: n, filename: r, path: i }) {
|
|
|
1854
1946
|
}
|
|
1855
1947
|
//#endregion
|
|
1856
1948
|
//#region src/utils/sandbox.ts
|
|
1857
|
-
function
|
|
1949
|
+
function kn(e) {
|
|
1858
1950
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
1859
1951
|
}
|
|
1860
|
-
function
|
|
1952
|
+
function An(e) {
|
|
1861
1953
|
let t = e.endsWith("/") ? e : `${e}/`;
|
|
1862
1954
|
if (typeof window > "u") return "'self'";
|
|
1863
1955
|
try {
|
|
@@ -1866,11 +1958,11 @@ function Tn(e) {
|
|
|
1866
1958
|
return "'self'";
|
|
1867
1959
|
}
|
|
1868
1960
|
}
|
|
1869
|
-
function
|
|
1961
|
+
function jn(...e) {
|
|
1870
1962
|
return Array.from(new Set(e.filter((e) => !!e))).join(" ");
|
|
1871
1963
|
}
|
|
1872
|
-
function
|
|
1873
|
-
let t = e ?
|
|
1964
|
+
function Mn(e) {
|
|
1965
|
+
let t = e ? An(e) : void 0, n = jn("'unsafe-inline'", "'unsafe-eval'", "'self'", "https:", t), r = jn("'self'", "https:", t);
|
|
1874
1966
|
return [
|
|
1875
1967
|
"default-src 'none'",
|
|
1876
1968
|
`script-src ${n}`,
|
|
@@ -1884,7 +1976,7 @@ function Dn(e) {
|
|
|
1884
1976
|
"base-uri 'self'"
|
|
1885
1977
|
].join("; ");
|
|
1886
1978
|
}
|
|
1887
|
-
function
|
|
1979
|
+
function Nn(e) {
|
|
1888
1980
|
try {
|
|
1889
1981
|
let t = new URL(e, window.location.href);
|
|
1890
1982
|
return [
|
|
@@ -1896,8 +1988,8 @@ function On(e) {
|
|
|
1896
1988
|
return !1;
|
|
1897
1989
|
}
|
|
1898
1990
|
}
|
|
1899
|
-
function
|
|
1900
|
-
let { channelId: n, basePath: r } = typeof t == "string" ? { channelId: t } : t, i =
|
|
1991
|
+
function Pn(e, t = {}) {
|
|
1992
|
+
let { channelId: n, basePath: r } = typeof t == "string" ? { channelId: t } : t, i = Mn(r), a = `<script>
|
|
1901
1993
|
function ksadkScrollToHash(rawHref) {
|
|
1902
1994
|
if (!rawHref || rawHref === '#') return;
|
|
1903
1995
|
var rawId = rawHref.slice(1);
|
|
@@ -1929,24 +2021,24 @@ document.addEventListener('click', function(event) {
|
|
|
1929
2021
|
}, '*');
|
|
1930
2022
|
}
|
|
1931
2023
|
}, true);
|
|
1932
|
-
<\/script>`, o = `${`<meta http-equiv="Content-Security-Policy" content="${
|
|
2024
|
+
<\/script>`, o = `${`<meta http-equiv="Content-Security-Policy" content="${kn(i)}">`}${r ? `<base href="${kn(r)}">` : ""}${a}`;
|
|
1933
2025
|
return /<head[^>]*>/i.test(e) ? e.replace(/<head[^>]*>/i, `$&${o}`) : `${o}${e}`;
|
|
1934
2026
|
}
|
|
1935
|
-
function
|
|
1936
|
-
let n =
|
|
1937
|
-
|
|
2027
|
+
function Fn(e, t) {
|
|
2028
|
+
let n = B(null);
|
|
2029
|
+
R(() => (n.current = (n) => {
|
|
1938
2030
|
if (n.source !== e.current?.contentWindow || n.data?.type !== "ksadk:linkClick" || t && n.data?.channelId !== t) return;
|
|
1939
2031
|
let r = n.data?.href;
|
|
1940
|
-
typeof r == "string" && r &&
|
|
2032
|
+
typeof r == "string" && r && Nn(r) && window.open(r, "_blank", "noopener,noreferrer");
|
|
1941
2033
|
}, window.addEventListener("message", n.current), () => {
|
|
1942
2034
|
n.current && window.removeEventListener("message", n.current);
|
|
1943
2035
|
}), [e, t]);
|
|
1944
2036
|
}
|
|
1945
|
-
var
|
|
2037
|
+
var In = "/_ksadk/workspace/v1/files", Ln = new Set([
|
|
1946
2038
|
".md",
|
|
1947
2039
|
".markdown",
|
|
1948
2040
|
".mdx"
|
|
1949
|
-
]),
|
|
2041
|
+
]), Rn = new Set([".pdf"]), zn = new Set([
|
|
1950
2042
|
".png",
|
|
1951
2043
|
".jpg",
|
|
1952
2044
|
".jpeg",
|
|
@@ -1955,7 +2047,7 @@ var jn = "/_ksadk/workspace/v1/files", Mn = new Set([
|
|
|
1955
2047
|
".svg",
|
|
1956
2048
|
".bmp",
|
|
1957
2049
|
".ico"
|
|
1958
|
-
]),
|
|
2050
|
+
]), Bn = 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(",")), Vn = new Set([
|
|
1959
2051
|
"application/json",
|
|
1960
2052
|
"application/ld+json",
|
|
1961
2053
|
"application/xml",
|
|
@@ -1984,40 +2076,40 @@ function $(e) {
|
|
|
1984
2076
|
}
|
|
1985
2077
|
return n.length > 0 ? n.join("/") : ".";
|
|
1986
2078
|
}
|
|
1987
|
-
function
|
|
2079
|
+
function Hn(e) {
|
|
1988
2080
|
let t = $(e);
|
|
1989
2081
|
return t === "." ? "" : t.split("/").filter(Boolean).map((e) => encodeURIComponent(e)).join("/");
|
|
1990
2082
|
}
|
|
1991
|
-
function
|
|
1992
|
-
let t =
|
|
1993
|
-
return t ? `${
|
|
2083
|
+
function Un(e) {
|
|
2084
|
+
let t = Hn(e);
|
|
2085
|
+
return t ? `${In}/${t}` : In;
|
|
1994
2086
|
}
|
|
1995
|
-
function
|
|
2087
|
+
function Wn(e) {
|
|
1996
2088
|
let t = $(e);
|
|
1997
|
-
if (t === "." || !t.includes("/")) return `${
|
|
1998
|
-
let n =
|
|
1999
|
-
return n ? `${
|
|
2089
|
+
if (t === "." || !t.includes("/")) return `${In}/`;
|
|
2090
|
+
let n = Hn(t.substring(0, t.lastIndexOf("/")));
|
|
2091
|
+
return n ? `${In}/${n}/` : `${In}/`;
|
|
2000
2092
|
}
|
|
2001
|
-
function
|
|
2093
|
+
function Gn(e) {
|
|
2002
2094
|
return $(e) === ".";
|
|
2003
2095
|
}
|
|
2004
|
-
function
|
|
2096
|
+
function Kn(e) {
|
|
2005
2097
|
let t = $(e);
|
|
2006
2098
|
return t === "." ? "/" : `/${t}`;
|
|
2007
2099
|
}
|
|
2008
|
-
function
|
|
2100
|
+
function qn(e) {
|
|
2009
2101
|
let t = String(e || "").split("/").pop() || "", n = t.lastIndexOf(".");
|
|
2010
2102
|
return n >= 0 ? t.slice(n).toLowerCase() : "";
|
|
2011
2103
|
}
|
|
2012
|
-
function
|
|
2104
|
+
function Jn(e) {
|
|
2013
2105
|
return String(e || "").split(";")[0].trim().toLowerCase();
|
|
2014
2106
|
}
|
|
2015
|
-
var
|
|
2016
|
-
function
|
|
2017
|
-
let n =
|
|
2018
|
-
return r === "text/html" ||
|
|
2107
|
+
var Yn = new Set([".html", ".htm"]);
|
|
2108
|
+
function Xn({ path: e, mimeType: t }) {
|
|
2109
|
+
let n = qn(e), r = Jn(t);
|
|
2110
|
+
return r === "text/html" || Yn.has(n) ? "html" : r === "text/markdown" || Ln.has(n) ? "markdown" : r === "application/pdf" || Rn.has(n) ? "pdf" : r.startsWith("image/") || zn.has(n) ? "image" : r.startsWith("text/") || Vn.has(r) || Bn.has(n) ? "text" : "unsupported";
|
|
2019
2111
|
}
|
|
2020
|
-
var
|
|
2112
|
+
var Zn = new Set([
|
|
2021
2113
|
".txt",
|
|
2022
2114
|
".log",
|
|
2023
2115
|
".csv",
|
|
@@ -2027,11 +2119,11 @@ var Kn = new Set([
|
|
|
2027
2119
|
".conf",
|
|
2028
2120
|
".lock"
|
|
2029
2121
|
]);
|
|
2030
|
-
function
|
|
2031
|
-
let n =
|
|
2032
|
-
return
|
|
2122
|
+
function Qn({ path: e, mimeType: t }) {
|
|
2123
|
+
let n = qn(e), r = Jn(t);
|
|
2124
|
+
return Yn.has(n) || r === "text/html" ? "html" : r === "text/markdown" || Ln.has(n) ? "markdown" : r === "application/pdf" || Rn.has(n) || r.startsWith("image/") || zn.has(n) ? null : Zn.has(n) || r === "text/plain" ? "text" : r.startsWith("text/") || Vn.has(r) || Bn.has(n) ? "code" : null;
|
|
2033
2125
|
}
|
|
2034
|
-
function
|
|
2126
|
+
function $n({ isMobile: e }) {
|
|
2035
2127
|
return e ? {
|
|
2036
2128
|
renderMode: "sheet",
|
|
2037
2129
|
modal: !0,
|
|
@@ -2046,7 +2138,7 @@ function Jn({ isMobile: e }) {
|
|
|
2046
2138
|
side: "right"
|
|
2047
2139
|
};
|
|
2048
2140
|
}
|
|
2049
|
-
function
|
|
2141
|
+
function er() {
|
|
2050
2142
|
let e = 0;
|
|
2051
2143
|
return {
|
|
2052
2144
|
next(t) {
|
|
@@ -2063,168 +2155,168 @@ function Yn() {
|
|
|
2063
2155
|
}
|
|
2064
2156
|
};
|
|
2065
2157
|
}
|
|
2066
|
-
function
|
|
2158
|
+
function tr({ workspaceFiles: e, accessMode: t }) {
|
|
2067
2159
|
if (!e?.Enabled) return !1;
|
|
2068
2160
|
let n = String(t || "").trim().toLowerCase();
|
|
2069
2161
|
return n === "owner" || n === "private";
|
|
2070
2162
|
}
|
|
2071
2163
|
//#endregion
|
|
2072
2164
|
//#region src/components/workspace/HtmlPreview.tsx
|
|
2073
|
-
function
|
|
2074
|
-
let l =
|
|
2165
|
+
function nr({ content: e, path: t, onSave: n, onDirtyChange: r, getContentRef: a, isMobile: o }) {
|
|
2166
|
+
let l = B(null), u = z(), [d, f] = V("preview"), p = Wn(t), m = Un(t), h = L(() => Pn(e, {
|
|
2075
2167
|
basePath: p,
|
|
2076
2168
|
channelId: u
|
|
2077
2169
|
}), [
|
|
2078
2170
|
e,
|
|
2079
2171
|
p,
|
|
2080
2172
|
u
|
|
2081
|
-
]), [g,
|
|
2082
|
-
|
|
2173
|
+
]), [g, _] = V(h());
|
|
2174
|
+
R(() => {
|
|
2083
2175
|
let e = setTimeout(() => {
|
|
2084
|
-
|
|
2176
|
+
_(h());
|
|
2085
2177
|
}, 300);
|
|
2086
2178
|
return () => clearTimeout(e);
|
|
2087
|
-
}, [h]),
|
|
2088
|
-
let
|
|
2179
|
+
}, [h]), Fn(l, u);
|
|
2180
|
+
let v = L(() => {
|
|
2089
2181
|
let e = new Blob([g], { type: "text/html;charset=utf-8" }), t = URL.createObjectURL(e), n = window.open(t, "_blank", "noopener,noreferrer");
|
|
2090
2182
|
window.setTimeout(() => URL.revokeObjectURL(t), 3e4), n || window.open(m, "_blank", "noopener,noreferrer");
|
|
2091
2183
|
}, [m, g]);
|
|
2092
|
-
return o ? /* @__PURE__ */
|
|
2184
|
+
return o ? /* @__PURE__ */ N("div", {
|
|
2093
2185
|
className: "flex h-full flex-col",
|
|
2094
|
-
children: [/* @__PURE__ */
|
|
2186
|
+
children: [/* @__PURE__ */ N("div", {
|
|
2095
2187
|
className: "flex items-center gap-1 border-b border-slate-200 px-2 py-1.5 dark:border-slate-700",
|
|
2096
|
-
children: [/* @__PURE__ */
|
|
2188
|
+
children: [/* @__PURE__ */ N("button", {
|
|
2097
2189
|
onClick: () => f("editor"),
|
|
2098
2190
|
className: J("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"),
|
|
2099
|
-
children: [/* @__PURE__ */
|
|
2100
|
-
}), /* @__PURE__ */
|
|
2191
|
+
children: [/* @__PURE__ */ M(i, { className: "h-3.5 w-3.5" }), "编辑"]
|
|
2192
|
+
}), /* @__PURE__ */ N("button", {
|
|
2101
2193
|
onClick: () => f("preview"),
|
|
2102
2194
|
className: J("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"),
|
|
2103
|
-
children: [/* @__PURE__ */
|
|
2195
|
+
children: [/* @__PURE__ */ M(c, { className: "h-3.5 w-3.5" }), "预览"]
|
|
2104
2196
|
})]
|
|
2105
|
-
}), d === "editor" ? /* @__PURE__ */
|
|
2197
|
+
}), d === "editor" ? /* @__PURE__ */ M(Q, {
|
|
2106
2198
|
content: e,
|
|
2107
2199
|
path: t,
|
|
2108
2200
|
onSave: n,
|
|
2109
2201
|
onDirtyChange: r,
|
|
2110
2202
|
getContentRef: a
|
|
2111
|
-
}) : /* @__PURE__ */
|
|
2203
|
+
}) : /* @__PURE__ */ M("iframe", {
|
|
2112
2204
|
ref: l,
|
|
2113
2205
|
srcDoc: g,
|
|
2114
2206
|
sandbox: "allow-scripts allow-downloads allow-same-origin",
|
|
2115
2207
|
title: "HTML 预览",
|
|
2116
2208
|
className: "h-full w-full border-0 bg-white"
|
|
2117
2209
|
})]
|
|
2118
|
-
}) : d === "editor" ? /* @__PURE__ */
|
|
2210
|
+
}) : d === "editor" ? /* @__PURE__ */ N("div", {
|
|
2119
2211
|
className: "relative flex h-full flex-col",
|
|
2120
|
-
children: [/* @__PURE__ */
|
|
2212
|
+
children: [/* @__PURE__ */ M(Q, {
|
|
2121
2213
|
content: e,
|
|
2122
2214
|
path: t,
|
|
2123
2215
|
onSave: n,
|
|
2124
2216
|
onDirtyChange: r,
|
|
2125
2217
|
getContentRef: a
|
|
2126
|
-
}), /* @__PURE__ */
|
|
2218
|
+
}), /* @__PURE__ */ N("button", {
|
|
2127
2219
|
onClick: () => f("preview"),
|
|
2128
2220
|
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",
|
|
2129
|
-
children: [/* @__PURE__ */
|
|
2221
|
+
children: [/* @__PURE__ */ M(c, { className: "h-3.5 w-3.5" }), "预览"]
|
|
2130
2222
|
})]
|
|
2131
|
-
}) : /* @__PURE__ */
|
|
2223
|
+
}) : /* @__PURE__ */ N("div", {
|
|
2132
2224
|
className: "relative flex h-full flex-col",
|
|
2133
|
-
children: [/* @__PURE__ */
|
|
2225
|
+
children: [/* @__PURE__ */ M("iframe", {
|
|
2134
2226
|
ref: l,
|
|
2135
2227
|
srcDoc: g,
|
|
2136
2228
|
sandbox: "allow-scripts allow-downloads allow-same-origin",
|
|
2137
2229
|
title: "HTML 预览",
|
|
2138
2230
|
className: "h-full w-full border-0 bg-white"
|
|
2139
|
-
}), /* @__PURE__ */
|
|
2231
|
+
}), /* @__PURE__ */ N("div", {
|
|
2140
2232
|
className: "absolute right-3 top-3 z-10 flex gap-1.5",
|
|
2141
|
-
children: [/* @__PURE__ */
|
|
2142
|
-
onClick:
|
|
2233
|
+
children: [/* @__PURE__ */ N("button", {
|
|
2234
|
+
onClick: v,
|
|
2143
2235
|
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",
|
|
2144
2236
|
title: "在新窗口中打开当前预览",
|
|
2145
|
-
children: [/* @__PURE__ */
|
|
2146
|
-
}), /* @__PURE__ */
|
|
2237
|
+
children: [/* @__PURE__ */ M(s, { className: "h-3.5 w-3.5" }), "新窗口"]
|
|
2238
|
+
}), /* @__PURE__ */ N("button", {
|
|
2147
2239
|
onClick: () => f("editor"),
|
|
2148
2240
|
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",
|
|
2149
|
-
children: [/* @__PURE__ */
|
|
2241
|
+
children: [/* @__PURE__ */ M(i, { className: "h-3.5 w-3.5" }), "编辑"]
|
|
2150
2242
|
})]
|
|
2151
2243
|
})]
|
|
2152
2244
|
});
|
|
2153
2245
|
}
|
|
2154
2246
|
//#endregion
|
|
2155
2247
|
//#region src/components/workspace/MarkdownPreview.tsx
|
|
2156
|
-
function
|
|
2248
|
+
function rr(e) {
|
|
2157
2249
|
e.current && clearTimeout(e.current);
|
|
2158
2250
|
}
|
|
2159
|
-
function
|
|
2160
|
-
let [s, l] =
|
|
2161
|
-
return
|
|
2251
|
+
function ir({ content: e, path: t, onSave: n, onDirtyChange: r, getContentRef: a, isMobile: o }) {
|
|
2252
|
+
let [s, l] = V("editor"), [u, d] = V(e), f = B(null);
|
|
2253
|
+
return R(() => (rr(f), f.current = setTimeout(() => d(e), 300), () => rr(f)), [e]), o ? /* @__PURE__ */ N("div", {
|
|
2162
2254
|
className: "flex h-full flex-col",
|
|
2163
|
-
children: [/* @__PURE__ */
|
|
2255
|
+
children: [/* @__PURE__ */ N("div", {
|
|
2164
2256
|
className: "flex items-center gap-1 border-b border-slate-200/30 px-2 py-1.5 dark:border-slate-700/30",
|
|
2165
|
-
children: [/* @__PURE__ */
|
|
2257
|
+
children: [/* @__PURE__ */ N("button", {
|
|
2166
2258
|
onClick: () => l("editor"),
|
|
2167
2259
|
className: J("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"),
|
|
2168
|
-
children: [/* @__PURE__ */
|
|
2169
|
-
}), /* @__PURE__ */
|
|
2260
|
+
children: [/* @__PURE__ */ M(i, { className: "h-3.5 w-3.5" }), "编辑"]
|
|
2261
|
+
}), /* @__PURE__ */ N("button", {
|
|
2170
2262
|
onClick: () => l("preview"),
|
|
2171
2263
|
className: J("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"),
|
|
2172
|
-
children: [/* @__PURE__ */
|
|
2264
|
+
children: [/* @__PURE__ */ M(c, { className: "h-3.5 w-3.5" }), "预览"]
|
|
2173
2265
|
})]
|
|
2174
|
-
}), s === "editor" ? /* @__PURE__ */
|
|
2266
|
+
}), s === "editor" ? /* @__PURE__ */ M(Q, {
|
|
2175
2267
|
content: e,
|
|
2176
2268
|
path: t,
|
|
2177
2269
|
onSave: n,
|
|
2178
2270
|
onDirtyChange: r,
|
|
2179
2271
|
getContentRef: a
|
|
2180
|
-
}) : /* @__PURE__ */
|
|
2272
|
+
}) : /* @__PURE__ */ M("div", {
|
|
2181
2273
|
className: "flex-1 overflow-auto p-4",
|
|
2182
|
-
children: /* @__PURE__ */
|
|
2274
|
+
children: /* @__PURE__ */ M(X, { content: u })
|
|
2183
2275
|
})]
|
|
2184
|
-
}) : s === "editor" ? /* @__PURE__ */
|
|
2276
|
+
}) : s === "editor" ? /* @__PURE__ */ N("div", {
|
|
2185
2277
|
className: "relative flex h-full flex-col",
|
|
2186
|
-
children: [/* @__PURE__ */
|
|
2278
|
+
children: [/* @__PURE__ */ M(Q, {
|
|
2187
2279
|
content: e,
|
|
2188
2280
|
path: t,
|
|
2189
2281
|
onSave: n,
|
|
2190
2282
|
onDirtyChange: r,
|
|
2191
2283
|
getContentRef: a
|
|
2192
|
-
}), /* @__PURE__ */
|
|
2284
|
+
}), /* @__PURE__ */ N("button", {
|
|
2193
2285
|
onClick: () => l("preview"),
|
|
2194
2286
|
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",
|
|
2195
|
-
children: [/* @__PURE__ */
|
|
2287
|
+
children: [/* @__PURE__ */ M(c, { className: "h-3.5 w-3.5" }), "预览"]
|
|
2196
2288
|
})]
|
|
2197
|
-
}) : /* @__PURE__ */
|
|
2289
|
+
}) : /* @__PURE__ */ N("div", {
|
|
2198
2290
|
className: "relative flex h-full flex-col",
|
|
2199
|
-
children: [/* @__PURE__ */
|
|
2291
|
+
children: [/* @__PURE__ */ M("div", {
|
|
2200
2292
|
className: "flex-1 overflow-auto p-4",
|
|
2201
|
-
children: /* @__PURE__ */
|
|
2202
|
-
}), /* @__PURE__ */
|
|
2293
|
+
children: /* @__PURE__ */ M(X, { content: u })
|
|
2294
|
+
}), /* @__PURE__ */ N("button", {
|
|
2203
2295
|
onClick: () => l("editor"),
|
|
2204
2296
|
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",
|
|
2205
|
-
children: [/* @__PURE__ */
|
|
2297
|
+
children: [/* @__PURE__ */ M(i, { className: "h-3.5 w-3.5" }), "编辑"]
|
|
2206
2298
|
})]
|
|
2207
2299
|
});
|
|
2208
2300
|
}
|
|
2209
2301
|
//#endregion
|
|
2210
2302
|
//#region src/components/workspace/WorkspacePanel.tsx
|
|
2211
|
-
var
|
|
2212
|
-
function
|
|
2303
|
+
var ar = "/agentengine/api/v1/GetWorkspaceFileContent", or = 4e3;
|
|
2304
|
+
function sr(e) {
|
|
2213
2305
|
let t = $(e);
|
|
2214
2306
|
if (!t || t === ".") return ".";
|
|
2215
2307
|
let n = t.split("/").filter(Boolean);
|
|
2216
2308
|
return n.length <= 1 ? "." : n.slice(0, -1).join("/");
|
|
2217
2309
|
}
|
|
2218
|
-
function
|
|
2310
|
+
function cr(e) {
|
|
2219
2311
|
if (!e) return "";
|
|
2220
2312
|
let t = Date.parse(e);
|
|
2221
2313
|
return Number.isNaN(t) ? e : new Date(t).toLocaleString();
|
|
2222
2314
|
}
|
|
2223
|
-
function
|
|
2315
|
+
function lr(e) {
|
|
2224
2316
|
let t = Number(e);
|
|
2225
2317
|
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`;
|
|
2226
2318
|
}
|
|
2227
|
-
var
|
|
2319
|
+
var ur = [
|
|
2228
2320
|
{
|
|
2229
2321
|
label: "Markdown",
|
|
2230
2322
|
detail: ".md .markdown .mdx"
|
|
@@ -2246,35 +2338,35 @@ var ar = [
|
|
|
2246
2338
|
detail: "CSV TSV"
|
|
2247
2339
|
}
|
|
2248
2340
|
];
|
|
2249
|
-
function
|
|
2250
|
-
return
|
|
2341
|
+
function dr(e) {
|
|
2342
|
+
return Un(e);
|
|
2251
2343
|
}
|
|
2252
|
-
function
|
|
2253
|
-
return /* @__PURE__ */
|
|
2344
|
+
function fr({ label: e, showSupportedTypes: t = !1 }) {
|
|
2345
|
+
return /* @__PURE__ */ M("div", {
|
|
2254
2346
|
className: "flex h-full min-h-[16rem] flex-col items-center justify-center px-6 text-center",
|
|
2255
|
-
children: /* @__PURE__ */
|
|
2347
|
+
children: /* @__PURE__ */ N("div", {
|
|
2256
2348
|
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",
|
|
2257
|
-
children: [/* @__PURE__ */
|
|
2349
|
+
children: [/* @__PURE__ */ M("div", { children: e }), t ? /* @__PURE__ */ N("div", {
|
|
2258
2350
|
className: "mt-4 text-left",
|
|
2259
2351
|
children: [
|
|
2260
|
-
/* @__PURE__ */
|
|
2352
|
+
/* @__PURE__ */ M("div", {
|
|
2261
2353
|
className: "text-xs font-semibold uppercase tracking-[0.12em] text-slate-400",
|
|
2262
2354
|
children: "支持在线预览"
|
|
2263
2355
|
}),
|
|
2264
|
-
/* @__PURE__ */
|
|
2356
|
+
/* @__PURE__ */ M("div", {
|
|
2265
2357
|
className: "mt-2 grid gap-2",
|
|
2266
|
-
children:
|
|
2358
|
+
children: ur.map((e) => /* @__PURE__ */ N("div", {
|
|
2267
2359
|
className: "rounded-xl border border-slate-200 bg-white px-3 py-2 dark:border-slate-800 dark:bg-slate-950",
|
|
2268
|
-
children: [/* @__PURE__ */
|
|
2360
|
+
children: [/* @__PURE__ */ M("div", {
|
|
2269
2361
|
className: "text-sm font-medium text-slate-700 dark:text-slate-200",
|
|
2270
2362
|
children: e.label
|
|
2271
|
-
}), /* @__PURE__ */
|
|
2363
|
+
}), /* @__PURE__ */ M("div", {
|
|
2272
2364
|
className: "mt-0.5 font-mono text-[11px] text-slate-400",
|
|
2273
2365
|
children: e.detail
|
|
2274
2366
|
})]
|
|
2275
2367
|
}, e.label))
|
|
2276
2368
|
}),
|
|
2277
|
-
/* @__PURE__ */
|
|
2369
|
+
/* @__PURE__ */ M("div", {
|
|
2278
2370
|
className: "mt-3 text-xs leading-5 text-slate-400",
|
|
2279
2371
|
children: "Word、Excel、PPT 当前不支持在线预览,可下载后查看。"
|
|
2280
2372
|
})
|
|
@@ -2283,20 +2375,20 @@ function sr({ label: e, showSupportedTypes: t = !1 }) {
|
|
|
2283
2375
|
})
|
|
2284
2376
|
});
|
|
2285
2377
|
}
|
|
2286
|
-
function
|
|
2287
|
-
let g =
|
|
2378
|
+
function pr({ agentId: t, capability: n, open: r, onClose: i, isFullscreen: a = !1, onToggleFullscreen: s, isMobile: c = !1, api: m }) {
|
|
2379
|
+
let g = B(null), v = B(null), [b, ee] = V(!1), [x, te] = V("."), [S, ne] = V([]), [C, w] = V(!1), [ae, T] = V(!1), [E, D] = V(!1), [oe, O] = V(""), [k, ue] = V(null), [A, j] = V(null), [P, F] = V(!1), [I, de] = V(!1), z = B(null), fe = B(null), H = B("selection"), U = B(er()), W = pe(() => S.find((e) => e.Path === k) ?? null, [S, k]), me = pe(() => W ? Qn({
|
|
2288
2380
|
path: W.Path,
|
|
2289
2381
|
mimeType: W.MimeType
|
|
2290
|
-
}) : null, [W]),
|
|
2291
|
-
|
|
2382
|
+
}) : null, [W]), he = L(() => P ? window.confirm("当前文件有未保存的更改,确定要离开吗?") : !0, [P]), ge = n.ContentPath || ar, _e = n.RootLabel || "Workspace", ve = _e ? `${_e.charAt(0).toUpperCase()}${_e.slice(1)}` : "Workspace", ye = Kn(x), G = L(() => {
|
|
2383
|
+
v.current &&= (URL.revokeObjectURL(v.current), null);
|
|
2292
2384
|
}, []);
|
|
2293
|
-
|
|
2294
|
-
let
|
|
2385
|
+
R(() => () => G(), [G]);
|
|
2386
|
+
let K = L(async (e, n = {}) => {
|
|
2295
2387
|
let r = !!n.background;
|
|
2296
|
-
r ?
|
|
2388
|
+
r ? T(!0) : w(!0), r || O("");
|
|
2297
2389
|
try {
|
|
2298
2390
|
let n = await m.listWorkspaceFiles(t, e, !1), i = $(String(n?.Path || e || ".")), a = Array.isArray(n?.Entries) ? n.Entries : [];
|
|
2299
|
-
|
|
2391
|
+
te(i), ne(a), H.current = r ? "background-refresh" : "selection", ue((e) => {
|
|
2300
2392
|
if (e) {
|
|
2301
2393
|
let t = a.find((t) => t.Path === e);
|
|
2302
2394
|
if (t && t.Type === "file") return e;
|
|
@@ -2304,37 +2396,37 @@ function cr({ agentId: t, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
2304
2396
|
return a.find((e) => e.Type === "file")?.Path ?? null;
|
|
2305
2397
|
});
|
|
2306
2398
|
} catch (e) {
|
|
2307
|
-
console.error("Failed to load workspace entries:", e), r ||
|
|
2399
|
+
console.error("Failed to load workspace entries:", e), r || O(e instanceof Error ? e.message : String(e));
|
|
2308
2400
|
} finally {
|
|
2309
|
-
r ?
|
|
2401
|
+
r ? T(!1) : w(!1);
|
|
2310
2402
|
}
|
|
2311
2403
|
}, [t, m]);
|
|
2312
|
-
|
|
2313
|
-
!r ||
|
|
2404
|
+
R(() => {
|
|
2405
|
+
!r || b || (ee(!0), K("."));
|
|
2314
2406
|
}, [
|
|
2315
|
-
|
|
2316
|
-
|
|
2407
|
+
b,
|
|
2408
|
+
K,
|
|
2317
2409
|
r
|
|
2318
|
-
]),
|
|
2319
|
-
if (!r || P || !
|
|
2410
|
+
]), R(() => {
|
|
2411
|
+
if (!r || P || !b) return;
|
|
2320
2412
|
let e = window.setInterval(() => {
|
|
2321
|
-
|
|
2322
|
-
},
|
|
2413
|
+
K(x, { background: !0 });
|
|
2414
|
+
}, or);
|
|
2323
2415
|
return () => window.clearInterval(e);
|
|
2324
2416
|
}, [
|
|
2325
|
-
|
|
2417
|
+
x,
|
|
2326
2418
|
P,
|
|
2327
|
-
|
|
2328
|
-
|
|
2419
|
+
b,
|
|
2420
|
+
K,
|
|
2329
2421
|
r
|
|
2330
2422
|
]);
|
|
2331
|
-
let
|
|
2332
|
-
let n = U.current.next(e.Path), r =
|
|
2423
|
+
let be = L(async (e) => {
|
|
2424
|
+
let n = U.current.next(e.Path), r = Xn({
|
|
2333
2425
|
path: e.Path,
|
|
2334
2426
|
mimeType: e.MimeType
|
|
2335
2427
|
});
|
|
2336
|
-
if (
|
|
2337
|
-
|
|
2428
|
+
if (fe.current = e.Path, r === "unsupported") {
|
|
2429
|
+
G(), j({
|
|
2338
2430
|
path: e.Path,
|
|
2339
2431
|
kind: r,
|
|
2340
2432
|
status: "ready",
|
|
@@ -2342,7 +2434,7 @@ function cr({ agentId: t, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
2342
2434
|
});
|
|
2343
2435
|
return;
|
|
2344
2436
|
}
|
|
2345
|
-
|
|
2437
|
+
G(), j({
|
|
2346
2438
|
path: e.Path,
|
|
2347
2439
|
kind: r,
|
|
2348
2440
|
status: "loading",
|
|
@@ -2352,13 +2444,13 @@ function cr({ agentId: t, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
2352
2444
|
let r = await m.getWorkspaceFileContent(t, e.Path, { asText: !1 });
|
|
2353
2445
|
if (!U.current.isCurrent(n)) return;
|
|
2354
2446
|
if (r instanceof Blob) {
|
|
2355
|
-
let t = e.MimeType || "", i =
|
|
2447
|
+
let t = e.MimeType || "", i = Xn({
|
|
2356
2448
|
path: e.Path,
|
|
2357
2449
|
mimeType: t
|
|
2358
2450
|
});
|
|
2359
2451
|
if (i === "image" || i === "pdf") {
|
|
2360
2452
|
let n = URL.createObjectURL(r);
|
|
2361
|
-
|
|
2453
|
+
v.current = n, j({
|
|
2362
2454
|
path: e.Path,
|
|
2363
2455
|
kind: i,
|
|
2364
2456
|
status: "ready",
|
|
@@ -2369,11 +2461,11 @@ function cr({ agentId: t, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
2369
2461
|
}
|
|
2370
2462
|
let a = await r.text();
|
|
2371
2463
|
if (!U.current.isCurrent(n)) return;
|
|
2372
|
-
let o =
|
|
2464
|
+
let o = Xn({
|
|
2373
2465
|
path: e.Path,
|
|
2374
2466
|
mimeType: t
|
|
2375
2467
|
});
|
|
2376
|
-
|
|
2468
|
+
j({
|
|
2377
2469
|
path: e.Path,
|
|
2378
2470
|
kind: o,
|
|
2379
2471
|
status: "ready",
|
|
@@ -2381,11 +2473,11 @@ function cr({ agentId: t, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
2381
2473
|
content: a
|
|
2382
2474
|
});
|
|
2383
2475
|
} else {
|
|
2384
|
-
let t = e.MimeType || "", n =
|
|
2476
|
+
let t = e.MimeType || "", n = Xn({
|
|
2385
2477
|
path: e.Path,
|
|
2386
2478
|
mimeType: t
|
|
2387
2479
|
});
|
|
2388
|
-
|
|
2480
|
+
j({
|
|
2389
2481
|
path: e.Path,
|
|
2390
2482
|
kind: n,
|
|
2391
2483
|
status: "ready",
|
|
@@ -2395,7 +2487,7 @@ function cr({ agentId: t, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
2395
2487
|
}
|
|
2396
2488
|
} catch (t) {
|
|
2397
2489
|
if (!U.current.isCurrent(n)) return;
|
|
2398
|
-
console.error("Failed to preview workspace file:", t),
|
|
2490
|
+
console.error("Failed to preview workspace file:", t), j({
|
|
2399
2491
|
path: e.Path,
|
|
2400
2492
|
kind: r,
|
|
2401
2493
|
status: "error",
|
|
@@ -2406,349 +2498,349 @@ function cr({ agentId: t, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
2406
2498
|
}, [
|
|
2407
2499
|
t,
|
|
2408
2500
|
m,
|
|
2409
|
-
|
|
2501
|
+
G
|
|
2410
2502
|
]);
|
|
2411
|
-
|
|
2503
|
+
R(() => {
|
|
2412
2504
|
if (!W || W.Type !== "file") {
|
|
2413
|
-
|
|
2505
|
+
G(), j(null), F(!1), fe.current = null;
|
|
2414
2506
|
return;
|
|
2415
2507
|
}
|
|
2416
|
-
if (H.current === "background-refresh" &&
|
|
2508
|
+
if (H.current === "background-refresh" && fe.current === W.Path) {
|
|
2417
2509
|
H.current = "selection";
|
|
2418
2510
|
return;
|
|
2419
2511
|
}
|
|
2420
|
-
H.current = "selection",
|
|
2512
|
+
H.current = "selection", be(W);
|
|
2421
2513
|
}, [
|
|
2422
|
-
|
|
2423
|
-
|
|
2514
|
+
G,
|
|
2515
|
+
be,
|
|
2424
2516
|
W
|
|
2425
2517
|
]);
|
|
2426
|
-
let
|
|
2518
|
+
let xe = async (e) => {
|
|
2427
2519
|
if (!(!e || e.length === 0)) {
|
|
2428
|
-
|
|
2520
|
+
D(!0), O("");
|
|
2429
2521
|
try {
|
|
2430
2522
|
for (let r of Array.from(e)) {
|
|
2431
2523
|
if (r.size > n.MaxUploadBytes) throw Error(`文件 ${r.name} 超过上传上限`);
|
|
2432
|
-
let e =
|
|
2524
|
+
let e = Gn(x) ? r.name : `${x}/${r.name}`, i = new FormData();
|
|
2433
2525
|
i.append("file", r), i.append("AgentId", t), i.append("Path", e), await m.addWorkspaceFile(i);
|
|
2434
2526
|
}
|
|
2435
|
-
await
|
|
2527
|
+
await K(x);
|
|
2436
2528
|
} catch (e) {
|
|
2437
|
-
console.error("Failed to upload workspace files:", e),
|
|
2529
|
+
console.error("Failed to upload workspace files:", e), O(e instanceof Error ? e.message : String(e));
|
|
2438
2530
|
} finally {
|
|
2439
|
-
g.current && (g.current.value = ""),
|
|
2531
|
+
g.current && (g.current.value = ""), D(!1);
|
|
2440
2532
|
}
|
|
2441
2533
|
}
|
|
2442
|
-
},
|
|
2534
|
+
}, Se = async (e) => {
|
|
2443
2535
|
if (!n.SupportsDelete) return;
|
|
2444
2536
|
let r = $(e.Path);
|
|
2445
2537
|
if (window.confirm(`删除 ${r} ?`)) {
|
|
2446
|
-
|
|
2538
|
+
O("");
|
|
2447
2539
|
try {
|
|
2448
|
-
await m.deleteWorkspaceFile(t, r),
|
|
2540
|
+
await m.deleteWorkspaceFile(t, r), k && $(k) === r && (ue(null), F(!1)), await K(e.Type === "directory" && ($(x) === r || $(x).startsWith(`${r}/`)) ? sr(r) : x);
|
|
2449
2541
|
} catch (e) {
|
|
2450
|
-
console.error("Failed to delete workspace file:", e),
|
|
2542
|
+
console.error("Failed to delete workspace file:", e), O(e instanceof Error ? e.message : String(e));
|
|
2451
2543
|
}
|
|
2452
2544
|
}
|
|
2453
|
-
},
|
|
2545
|
+
}, Ce = () => !W || W.Type !== "file" ? /* @__PURE__ */ M(fr, {
|
|
2454
2546
|
label: "从左侧选择文件后在这里查看内容预览。",
|
|
2455
2547
|
showSupportedTypes: !0
|
|
2456
|
-
}) : !
|
|
2548
|
+
}) : !A || A.path !== W.Path || A.status === "loading" ? /* @__PURE__ */ M("div", {
|
|
2457
2549
|
className: "flex h-full min-h-[16rem] items-center justify-center",
|
|
2458
|
-
children: /* @__PURE__ */
|
|
2550
|
+
children: /* @__PURE__ */ N("div", {
|
|
2459
2551
|
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",
|
|
2460
|
-
children: [/* @__PURE__ */
|
|
2552
|
+
children: [/* @__PURE__ */ M(p, { className: "h-4 w-4 animate-spin" }), "正在加载预览..."]
|
|
2461
2553
|
})
|
|
2462
|
-
}) :
|
|
2463
|
-
content:
|
|
2554
|
+
}) : A.status === "error" ? /* @__PURE__ */ M(fr, { label: A.error || "文件预览加载失败。" }) : A.kind === "markdown" ? /* @__PURE__ */ M(ir, {
|
|
2555
|
+
content: A.content || "",
|
|
2464
2556
|
path: W.Path,
|
|
2465
|
-
onSave:
|
|
2557
|
+
onSave: q,
|
|
2466
2558
|
onDirtyChange: F,
|
|
2467
|
-
getContentRef:
|
|
2559
|
+
getContentRef: z,
|
|
2468
2560
|
isMobile: c
|
|
2469
|
-
}) :
|
|
2561
|
+
}) : A.kind === "image" && A.objectUrl ? /* @__PURE__ */ M(On, {
|
|
2470
2562
|
content: null,
|
|
2471
|
-
objectUrl:
|
|
2563
|
+
objectUrl: A.objectUrl,
|
|
2472
2564
|
kind: "image",
|
|
2473
2565
|
filename: W.Name,
|
|
2474
|
-
mimeType:
|
|
2475
|
-
}) :
|
|
2566
|
+
mimeType: A.mimeType || ""
|
|
2567
|
+
}) : A.kind === "pdf" && A.objectUrl ? /* @__PURE__ */ M(On, {
|
|
2476
2568
|
content: null,
|
|
2477
|
-
objectUrl:
|
|
2569
|
+
objectUrl: A.objectUrl,
|
|
2478
2570
|
kind: "pdf",
|
|
2479
2571
|
filename: W.Name,
|
|
2480
|
-
mimeType:
|
|
2481
|
-
}) :
|
|
2482
|
-
content:
|
|
2572
|
+
mimeType: A.mimeType || ""
|
|
2573
|
+
}) : A.kind === "html" ? /* @__PURE__ */ M(nr, {
|
|
2574
|
+
content: A.content || "",
|
|
2483
2575
|
path: W.Path,
|
|
2484
|
-
onSave:
|
|
2576
|
+
onSave: q,
|
|
2485
2577
|
onDirtyChange: F,
|
|
2486
|
-
getContentRef:
|
|
2578
|
+
getContentRef: z,
|
|
2487
2579
|
isMobile: c,
|
|
2488
2580
|
agentId: t,
|
|
2489
|
-
contentPath:
|
|
2490
|
-
}) :
|
|
2491
|
-
content:
|
|
2581
|
+
contentPath: ge
|
|
2582
|
+
}) : A.kind === "text" || A.kind === "code" ? /* @__PURE__ */ M(Q, {
|
|
2583
|
+
content: A.content || "",
|
|
2492
2584
|
path: W.Path,
|
|
2493
|
-
onSave:
|
|
2585
|
+
onSave: q,
|
|
2494
2586
|
onDirtyChange: F,
|
|
2495
|
-
getContentRef:
|
|
2496
|
-
}) : /* @__PURE__ */
|
|
2587
|
+
getContentRef: z
|
|
2588
|
+
}) : /* @__PURE__ */ M(On, {
|
|
2497
2589
|
content: null,
|
|
2498
2590
|
kind: "unsupported",
|
|
2499
2591
|
filename: W.Name,
|
|
2500
|
-
mimeType:
|
|
2501
|
-
}),
|
|
2592
|
+
mimeType: A.mimeType || ""
|
|
2593
|
+
}), q = async (e) => {
|
|
2502
2594
|
if (W) {
|
|
2503
|
-
|
|
2595
|
+
de(!0), O("");
|
|
2504
2596
|
try {
|
|
2505
2597
|
let n = new Blob([e], { type: W.MimeType || "text/plain" }), r = new FormData();
|
|
2506
|
-
r.append("file", n, W.Name), r.append("AgentId", t), r.append("Path", W.Path), await m.addWorkspaceFile(r), U.current.invalidate(), F(!1),
|
|
2598
|
+
r.append("file", n, W.Name), r.append("AgentId", t), r.append("Path", W.Path), await m.addWorkspaceFile(r), U.current.invalidate(), F(!1), j((t) => t && t.path === W.Path ? {
|
|
2507
2599
|
...t,
|
|
2508
2600
|
content: e
|
|
2509
|
-
} : t),
|
|
2601
|
+
} : t), fe.current = W.Path, await K(x, { background: !0 });
|
|
2510
2602
|
} catch (e) {
|
|
2511
|
-
console.error("Failed to save workspace file:", e),
|
|
2603
|
+
console.error("Failed to save workspace file:", e), O(e instanceof Error ? e.message : String(e));
|
|
2512
2604
|
} finally {
|
|
2513
|
-
|
|
2605
|
+
de(!1);
|
|
2514
2606
|
}
|
|
2515
2607
|
}
|
|
2516
|
-
}, we = W?.Type === "file" &&
|
|
2517
|
-
return /* @__PURE__ */
|
|
2608
|
+
}, we = W?.Type === "file" && A?.path === W.Path && A.status === "ready" && (A.kind === "text" || A.kind === "code" || A.kind === "html" || A.kind === "markdown"), Te = W?.Type === "file" && A?.path === W.Path && A.status === "ready" && A.kind === "pdf";
|
|
2609
|
+
return /* @__PURE__ */ N("div", {
|
|
2518
2610
|
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",
|
|
2519
|
-
children: [/* @__PURE__ */
|
|
2611
|
+
children: [/* @__PURE__ */ N("div", {
|
|
2520
2612
|
className: "flex h-14 flex-shrink-0 items-center gap-3 border-b border-slate-200/30 px-4 dark:border-slate-800/40",
|
|
2521
|
-
children: [/* @__PURE__ */
|
|
2613
|
+
children: [/* @__PURE__ */ N("div", {
|
|
2522
2614
|
className: "flex min-w-0 flex-1 items-center gap-3",
|
|
2523
2615
|
children: [
|
|
2524
|
-
/* @__PURE__ */
|
|
2616
|
+
/* @__PURE__ */ M("div", {
|
|
2525
2617
|
className: "truncate text-sm font-semibold text-slate-900 dark:text-slate-100",
|
|
2526
|
-
children:
|
|
2618
|
+
children: ve
|
|
2527
2619
|
}),
|
|
2528
|
-
/* @__PURE__ */
|
|
2529
|
-
/* @__PURE__ */
|
|
2620
|
+
/* @__PURE__ */ M("div", { className: "hidden h-4 w-px bg-slate-200/70 dark:bg-slate-800 sm:block" }),
|
|
2621
|
+
/* @__PURE__ */ N("div", {
|
|
2530
2622
|
className: "flex min-w-0 items-center gap-2",
|
|
2531
|
-
children: [/* @__PURE__ */
|
|
2623
|
+
children: [/* @__PURE__ */ M("span", {
|
|
2532
2624
|
className: "flex-shrink-0 text-xs text-slate-400",
|
|
2533
2625
|
children: "当前目录"
|
|
2534
|
-
}), /* @__PURE__ */
|
|
2626
|
+
}), /* @__PURE__ */ M("div", {
|
|
2535
2627
|
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",
|
|
2536
|
-
title: `${
|
|
2537
|
-
children:
|
|
2628
|
+
title: `${ye},来自 ListWorkspaceFiles 返回的 Data.Path 字段`,
|
|
2629
|
+
children: ye
|
|
2538
2630
|
})]
|
|
2539
2631
|
}),
|
|
2540
|
-
/* @__PURE__ */
|
|
2632
|
+
/* @__PURE__ */ M("div", {
|
|
2541
2633
|
className: "hidden truncate text-[11px] text-slate-400 xl:block",
|
|
2542
2634
|
children: "工作区内相对路径,不是宿主机绝对路径。"
|
|
2543
2635
|
})
|
|
2544
2636
|
]
|
|
2545
|
-
}), /* @__PURE__ */
|
|
2637
|
+
}), /* @__PURE__ */ N("div", {
|
|
2546
2638
|
className: "flex flex-shrink-0 items-center gap-1.5",
|
|
2547
2639
|
children: [
|
|
2548
|
-
/* @__PURE__ */
|
|
2640
|
+
/* @__PURE__ */ M("input", {
|
|
2549
2641
|
ref: g,
|
|
2550
2642
|
type: "file",
|
|
2551
2643
|
multiple: !0,
|
|
2552
2644
|
className: "hidden",
|
|
2553
|
-
onChange: (e) => void
|
|
2645
|
+
onChange: (e) => void xe(e.target.files)
|
|
2554
2646
|
}),
|
|
2555
|
-
/* @__PURE__ */
|
|
2647
|
+
/* @__PURE__ */ N("button", {
|
|
2556
2648
|
type: "button",
|
|
2557
2649
|
onClick: () => g.current?.click(),
|
|
2558
|
-
disabled:
|
|
2650
|
+
disabled: E,
|
|
2559
2651
|
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",
|
|
2560
2652
|
title: `上传文件,上限 ${Math.floor(n.MaxUploadBytes / (1024 * 1024))}MB`,
|
|
2561
|
-
children: [/* @__PURE__ */
|
|
2653
|
+
children: [/* @__PURE__ */ M(ce, { className: "h-3.5 w-3.5" }), E ? "上传中" : "上传"]
|
|
2562
2654
|
}),
|
|
2563
|
-
/* @__PURE__ */
|
|
2655
|
+
/* @__PURE__ */ N("button", {
|
|
2564
2656
|
type: "button",
|
|
2565
2657
|
onClick: () => {
|
|
2566
|
-
let e = new URLSearchParams({ Path:
|
|
2658
|
+
let e = new URLSearchParams({ Path: x }).toString();
|
|
2567
2659
|
window.open(`/agentengine/api/v1/ExportWorkspaceZip?${e}`, "_blank", "noopener,noreferrer");
|
|
2568
2660
|
},
|
|
2569
2661
|
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",
|
|
2570
2662
|
title: "导出当前目录为 ZIP",
|
|
2571
|
-
children: [/* @__PURE__ */
|
|
2663
|
+
children: [/* @__PURE__ */ M(y, { className: "h-3.5 w-3.5" }), "导出"]
|
|
2572
2664
|
}),
|
|
2573
|
-
s ? /* @__PURE__ */
|
|
2665
|
+
s ? /* @__PURE__ */ M("button", {
|
|
2574
2666
|
type: "button",
|
|
2575
2667
|
onClick: s,
|
|
2576
2668
|
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",
|
|
2577
2669
|
"aria-label": a ? "退出全屏" : "全屏查看 Workspace",
|
|
2578
2670
|
title: a ? "退出全屏" : "全屏查看",
|
|
2579
|
-
children:
|
|
2671
|
+
children: M(a ? _ : h, { className: "h-4 w-4" })
|
|
2580
2672
|
}) : null,
|
|
2581
|
-
i ? /* @__PURE__ */
|
|
2673
|
+
i ? /* @__PURE__ */ M("button", {
|
|
2582
2674
|
type: "button",
|
|
2583
2675
|
onClick: () => {
|
|
2584
|
-
|
|
2676
|
+
he() && i?.();
|
|
2585
2677
|
},
|
|
2586
2678
|
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",
|
|
2587
2679
|
"aria-label": "关闭 Workspace",
|
|
2588
2680
|
title: "关闭",
|
|
2589
|
-
children: /* @__PURE__ */
|
|
2681
|
+
children: /* @__PURE__ */ M(le, { className: "h-4 w-4" })
|
|
2590
2682
|
}) : null
|
|
2591
2683
|
]
|
|
2592
2684
|
})]
|
|
2593
|
-
}), /* @__PURE__ */
|
|
2685
|
+
}), /* @__PURE__ */ N("div", {
|
|
2594
2686
|
className: "flex min-h-0 flex-1 flex-col md:flex-row",
|
|
2595
|
-
children: [/* @__PURE__ */
|
|
2687
|
+
children: [/* @__PURE__ */ N("div", {
|
|
2596
2688
|
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",
|
|
2597
|
-
children: [/* @__PURE__ */
|
|
2689
|
+
children: [/* @__PURE__ */ N("div", {
|
|
2598
2690
|
className: "flex h-14 flex-shrink-0 items-center border-b border-slate-200/30 px-3 dark:border-slate-800/40",
|
|
2599
|
-
children: [/* @__PURE__ */
|
|
2691
|
+
children: [/* @__PURE__ */ N("div", {
|
|
2600
2692
|
className: "flex items-center justify-between gap-2",
|
|
2601
|
-
children: [/* @__PURE__ */
|
|
2693
|
+
children: [/* @__PURE__ */ N("div", {
|
|
2602
2694
|
className: "min-w-0",
|
|
2603
|
-
children: [/* @__PURE__ */
|
|
2695
|
+
children: [/* @__PURE__ */ M("div", {
|
|
2604
2696
|
className: "text-xs font-medium text-slate-900 dark:text-slate-100",
|
|
2605
2697
|
children: "文件"
|
|
2606
|
-
}), /* @__PURE__ */
|
|
2698
|
+
}), /* @__PURE__ */ N("div", {
|
|
2607
2699
|
className: "flex items-center gap-1 text-[11px] text-slate-400",
|
|
2608
|
-
children: [/* @__PURE__ */
|
|
2700
|
+
children: [/* @__PURE__ */ N("span", { children: [S.length, " 项"] }), ae ? /* @__PURE__ */ M(re, {
|
|
2609
2701
|
className: "h-3 w-3 animate-spin",
|
|
2610
2702
|
"aria-label": "正在同步 Workspace 目录"
|
|
2611
2703
|
}) : null]
|
|
2612
2704
|
})]
|
|
2613
|
-
}), /* @__PURE__ */
|
|
2705
|
+
}), /* @__PURE__ */ N("div", {
|
|
2614
2706
|
className: "flex items-center gap-1",
|
|
2615
|
-
children: [/* @__PURE__ */
|
|
2707
|
+
children: [/* @__PURE__ */ M("button", {
|
|
2616
2708
|
type: "button",
|
|
2617
2709
|
onClick: () => {
|
|
2618
|
-
|
|
2710
|
+
he() && K(sr(x));
|
|
2619
2711
|
},
|
|
2620
|
-
disabled: C ||
|
|
2712
|
+
disabled: C || Gn(x),
|
|
2621
2713
|
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",
|
|
2622
2714
|
title: "返回上级目录",
|
|
2623
|
-
children: /* @__PURE__ */
|
|
2624
|
-
}), /* @__PURE__ */
|
|
2715
|
+
children: /* @__PURE__ */ M(e, { className: "h-4 w-4" })
|
|
2716
|
+
}), /* @__PURE__ */ M("button", {
|
|
2625
2717
|
type: "button",
|
|
2626
2718
|
onClick: () => {
|
|
2627
|
-
|
|
2719
|
+
he() && K(x);
|
|
2628
2720
|
},
|
|
2629
2721
|
disabled: C,
|
|
2630
2722
|
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",
|
|
2631
2723
|
title: "刷新目录",
|
|
2632
|
-
children: /* @__PURE__ */
|
|
2724
|
+
children: /* @__PURE__ */ M(re, { className: `h-4 w-4 ${C ? "animate-spin" : ""}` })
|
|
2633
2725
|
})]
|
|
2634
2726
|
})]
|
|
2635
|
-
}),
|
|
2727
|
+
}), oe ? /* @__PURE__ */ M("div", {
|
|
2636
2728
|
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",
|
|
2637
|
-
children:
|
|
2729
|
+
children: oe
|
|
2638
2730
|
}) : null]
|
|
2639
|
-
}), /* @__PURE__ */
|
|
2731
|
+
}), /* @__PURE__ */ M("div", {
|
|
2640
2732
|
className: "custom-scrollbar min-h-0 flex-1 overflow-y-auto px-2 py-2",
|
|
2641
|
-
children: !
|
|
2733
|
+
children: !b && !r ? /* @__PURE__ */ M("div", {
|
|
2642
2734
|
className: "px-3 py-4 text-sm text-slate-400",
|
|
2643
2735
|
children: "打开面板后加载 workspace 文件。"
|
|
2644
|
-
}) : C ? /* @__PURE__ */
|
|
2736
|
+
}) : C ? /* @__PURE__ */ M("div", {
|
|
2645
2737
|
className: "px-3 py-4 text-sm text-slate-400",
|
|
2646
2738
|
children: "正在加载目录..."
|
|
2647
|
-
}) :
|
|
2739
|
+
}) : S.length === 0 ? /* @__PURE__ */ M("div", {
|
|
2648
2740
|
className: "px-3 py-4 text-sm text-slate-400",
|
|
2649
2741
|
children: "当前目录为空。"
|
|
2650
|
-
}) : /* @__PURE__ */
|
|
2742
|
+
}) : /* @__PURE__ */ M("div", {
|
|
2651
2743
|
className: "space-y-0.5",
|
|
2652
|
-
children:
|
|
2653
|
-
let t =
|
|
2744
|
+
children: S.map((e) => {
|
|
2745
|
+
let t = Xn({
|
|
2654
2746
|
path: e.Path,
|
|
2655
2747
|
mimeType: e.MimeType
|
|
2656
|
-
}), r =
|
|
2657
|
-
return /* @__PURE__ */
|
|
2748
|
+
}), r = k === e.Path, i = e.Type === "file" ? dr(e.Path) : "";
|
|
2749
|
+
return /* @__PURE__ */ N("div", {
|
|
2658
2750
|
title: e.Path,
|
|
2659
2751
|
className: J("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"),
|
|
2660
|
-
children: [/* @__PURE__ */
|
|
2752
|
+
children: [/* @__PURE__ */ N("button", {
|
|
2661
2753
|
type: "button",
|
|
2662
2754
|
onClick: () => {
|
|
2663
2755
|
if (e.Type === "directory") {
|
|
2664
|
-
|
|
2756
|
+
K(e.Path);
|
|
2665
2757
|
return;
|
|
2666
2758
|
}
|
|
2667
|
-
|
|
2759
|
+
k !== e.Path && !he() || ue(e.Path);
|
|
2668
2760
|
},
|
|
2669
2761
|
className: "flex min-w-0 flex-1 items-center gap-2 text-left",
|
|
2670
|
-
children: [/* @__PURE__ */
|
|
2762
|
+
children: [/* @__PURE__ */ M("div", {
|
|
2671
2763
|
className: J("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"),
|
|
2672
|
-
children: e.Type === "directory" ? /* @__PURE__ */
|
|
2673
|
-
}), /* @__PURE__ */
|
|
2764
|
+
children: e.Type === "directory" ? /* @__PURE__ */ M(d, { className: "h-3.5 w-3.5" }) : M(t === "image" ? f : t === "markdown" || t === "text" || t === "html" ? l : u, { className: "h-3.5 w-3.5" })
|
|
2765
|
+
}), /* @__PURE__ */ N("div", {
|
|
2674
2766
|
className: "min-w-0 flex-1",
|
|
2675
|
-
children: [/* @__PURE__ */
|
|
2767
|
+
children: [/* @__PURE__ */ M("div", {
|
|
2676
2768
|
className: "truncate text-[13px] leading-5",
|
|
2677
2769
|
children: e.Name
|
|
2678
|
-
}), /* @__PURE__ */
|
|
2770
|
+
}), /* @__PURE__ */ M("div", {
|
|
2679
2771
|
className: J("truncate text-[11px] leading-4", r ? "text-slate-500 dark:text-slate-400" : "text-slate-400"),
|
|
2680
|
-
children: e.Type === "directory" ? "目录" :
|
|
2772
|
+
children: e.Type === "directory" ? "目录" : lr(e.SizeBytes)
|
|
2681
2773
|
})]
|
|
2682
2774
|
})]
|
|
2683
|
-
}), /* @__PURE__ */
|
|
2775
|
+
}), /* @__PURE__ */ N("div", {
|
|
2684
2776
|
className: "flex flex-shrink-0 items-center gap-0.5 opacity-0 transition group-hover:opacity-100",
|
|
2685
|
-
children: [e.Type === "file" ? /* @__PURE__ */
|
|
2777
|
+
children: [e.Type === "file" ? /* @__PURE__ */ M("a", {
|
|
2686
2778
|
href: i,
|
|
2687
2779
|
download: e.Name,
|
|
2688
2780
|
className: J("rounded-md p-1.5 transition", r ? "hover:bg-white dark:hover:bg-slate-700" : "hover:bg-slate-100 dark:hover:bg-slate-800"),
|
|
2689
2781
|
title: "下载",
|
|
2690
|
-
children: /* @__PURE__ */
|
|
2691
|
-
}) : null, n.SupportsDelete ? /* @__PURE__ */
|
|
2782
|
+
children: /* @__PURE__ */ M(o, { className: "h-3.5 w-3.5" })
|
|
2783
|
+
}) : null, n.SupportsDelete ? /* @__PURE__ */ M("button", {
|
|
2692
2784
|
type: "button",
|
|
2693
|
-
onClick: () => void
|
|
2785
|
+
onClick: () => void Se(e),
|
|
2694
2786
|
className: J("rounded-md p-1.5 transition", r ? "hover:bg-white dark:hover:bg-slate-700" : "hover:bg-slate-100 dark:hover:bg-slate-800"),
|
|
2695
2787
|
title: "删除",
|
|
2696
|
-
children: /* @__PURE__ */
|
|
2788
|
+
children: /* @__PURE__ */ M(se, { className: "h-3.5 w-3.5" })
|
|
2697
2789
|
}) : null]
|
|
2698
2790
|
})]
|
|
2699
2791
|
}, e.Path);
|
|
2700
2792
|
})
|
|
2701
2793
|
})
|
|
2702
2794
|
})]
|
|
2703
|
-
}), /* @__PURE__ */
|
|
2795
|
+
}), /* @__PURE__ */ N("div", {
|
|
2704
2796
|
className: "flex min-h-0 min-w-0 flex-1 flex-col",
|
|
2705
|
-
children: [/* @__PURE__ */
|
|
2797
|
+
children: [/* @__PURE__ */ M("div", {
|
|
2706
2798
|
className: "flex h-14 flex-shrink-0 items-center border-b border-slate-200/30 px-4 dark:border-slate-800/40",
|
|
2707
|
-
children: W ? /* @__PURE__ */
|
|
2799
|
+
children: W ? /* @__PURE__ */ N("div", {
|
|
2708
2800
|
className: "flex w-full items-start justify-between gap-3",
|
|
2709
|
-
children: [/* @__PURE__ */
|
|
2801
|
+
children: [/* @__PURE__ */ N("div", {
|
|
2710
2802
|
className: "min-w-0",
|
|
2711
2803
|
children: [
|
|
2712
|
-
/* @__PURE__ */
|
|
2804
|
+
/* @__PURE__ */ M("div", {
|
|
2713
2805
|
className: "truncate text-sm font-semibold text-slate-900 dark:text-slate-100",
|
|
2714
2806
|
children: W.Name
|
|
2715
2807
|
}),
|
|
2716
|
-
/* @__PURE__ */
|
|
2808
|
+
/* @__PURE__ */ M("div", {
|
|
2717
2809
|
className: "mt-0.5 break-all font-mono text-[11px] text-slate-400",
|
|
2718
2810
|
children: W.Path
|
|
2719
2811
|
}),
|
|
2720
|
-
/* @__PURE__ */
|
|
2812
|
+
/* @__PURE__ */ N("div", {
|
|
2721
2813
|
className: "mt-1 text-[11px] text-slate-400",
|
|
2722
2814
|
children: [
|
|
2723
|
-
|
|
2815
|
+
lr(W.SizeBytes),
|
|
2724
2816
|
W.MimeType ? ` · ${W.MimeType}` : "",
|
|
2725
|
-
W.ModifiedAt ? ` · ${
|
|
2817
|
+
W.ModifiedAt ? ` · ${cr(W.ModifiedAt)}` : ""
|
|
2726
2818
|
]
|
|
2727
2819
|
})
|
|
2728
2820
|
]
|
|
2729
|
-
}),
|
|
2821
|
+
}), me === "text" || me === "code" || me === "html" || me === "markdown" ? /* @__PURE__ */ N("button", {
|
|
2730
2822
|
type: "button",
|
|
2731
2823
|
onClick: () => {
|
|
2732
|
-
let e =
|
|
2733
|
-
e &&
|
|
2824
|
+
let e = z.current;
|
|
2825
|
+
e && q(e());
|
|
2734
2826
|
},
|
|
2735
|
-
disabled: !P ||
|
|
2736
|
-
className: J("inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition", P && !
|
|
2737
|
-
children: [/* @__PURE__ */
|
|
2827
|
+
disabled: !P || I,
|
|
2828
|
+
className: J("inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition", P && !I ? "bg-blue-600 text-white hover:bg-blue-700" : "text-slate-400 dark:text-slate-500 cursor-not-allowed"),
|
|
2829
|
+
children: [/* @__PURE__ */ M(ie, { className: "h-3.5 w-3.5" }), I ? "保存中" : P ? "保存" : "已保存"]
|
|
2738
2830
|
}) : null]
|
|
2739
|
-
}) : /* @__PURE__ */
|
|
2831
|
+
}) : /* @__PURE__ */ N("div", {
|
|
2740
2832
|
className: "w-full",
|
|
2741
|
-
children: [/* @__PURE__ */
|
|
2833
|
+
children: [/* @__PURE__ */ M("div", {
|
|
2742
2834
|
className: "text-sm font-semibold text-slate-900 dark:text-slate-100",
|
|
2743
2835
|
children: "文件预览"
|
|
2744
|
-
}), /* @__PURE__ */
|
|
2836
|
+
}), /* @__PURE__ */ M("div", {
|
|
2745
2837
|
className: "mt-0.5 text-xs text-slate-500 dark:text-slate-400",
|
|
2746
2838
|
children: "选择左侧文件后可在此查看内容。"
|
|
2747
2839
|
})]
|
|
2748
2840
|
})
|
|
2749
|
-
}), /* @__PURE__ */
|
|
2841
|
+
}), /* @__PURE__ */ M("div", {
|
|
2750
2842
|
className: J("custom-scrollbar min-h-0 flex-1", Te || we ? "overflow-hidden p-0" : "overflow-y-auto px-4 py-4"),
|
|
2751
|
-
children:
|
|
2843
|
+
children: Ce()
|
|
2752
2844
|
})]
|
|
2753
2845
|
})]
|
|
2754
2846
|
})]
|
|
@@ -2756,34 +2848,34 @@ function cr({ agentId: t, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
2756
2848
|
}
|
|
2757
2849
|
//#endregion
|
|
2758
2850
|
//#region src/components/workspace/WorkspacePanelContainer.tsx
|
|
2759
|
-
function
|
|
2851
|
+
function mr({ agentId: e, capability: t, workspacePanelOpen: n, workspacePanelWidth: r, workspacePanelFullscreen: i, isMobile: a, workspaceEnabled: o, workspaceFiles: s, workspacePanelPresentation: c, closeWorkspacePanel: l, handleWorkspacePanelResizeStart: u, api: d }) {
|
|
2760
2852
|
let f = c.renderMode === "inline", p = c.renderMode === "sheet";
|
|
2761
|
-
return !o || !s ? null : /* @__PURE__ */ j
|
|
2853
|
+
return !o || !s ? null : /* @__PURE__ */ N(j, { children: [f ? /* @__PURE__ */ N(j, { children: [n && !i ? /* @__PURE__ */ M("div", {
|
|
2762
2854
|
role: "separator",
|
|
2763
2855
|
"aria-label": "调整 Workspace 宽度",
|
|
2764
2856
|
"aria-orientation": "vertical",
|
|
2765
2857
|
onPointerDown: u,
|
|
2766
2858
|
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"
|
|
2767
|
-
}) : null, /* @__PURE__ */
|
|
2859
|
+
}) : null, /* @__PURE__ */ M("aside", {
|
|
2768
2860
|
style: n && !i ? { width: `${r}px` } : void 0,
|
|
2769
2861
|
className: J(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"),
|
|
2770
|
-
children: n ? /* @__PURE__ */
|
|
2862
|
+
children: n ? /* @__PURE__ */ M(pr, {
|
|
2771
2863
|
agentId: e,
|
|
2772
2864
|
capability: t,
|
|
2773
2865
|
open: n,
|
|
2774
2866
|
onClose: l,
|
|
2775
2867
|
isFullscreen: i,
|
|
2776
|
-
onToggleFullscreen: () =>
|
|
2868
|
+
onToggleFullscreen: () => Tn.getState().setWorkspacePanelFullscreen(!i),
|
|
2777
2869
|
isMobile: a,
|
|
2778
2870
|
api: d
|
|
2779
2871
|
}) : null
|
|
2780
|
-
})] }) : null, p ? /* @__PURE__ */
|
|
2872
|
+
})] }) : null, p ? /* @__PURE__ */ M(We, {
|
|
2781
2873
|
open: n,
|
|
2782
2874
|
onOpenChange: (e) => {
|
|
2783
|
-
e ||
|
|
2875
|
+
e || Tn.getState().setWorkspacePanelFullscreen(!1), Tn.getState().setWorkspacePanelOpen(e);
|
|
2784
2876
|
},
|
|
2785
2877
|
modal: c.modal,
|
|
2786
|
-
children: /* @__PURE__ */
|
|
2878
|
+
children: /* @__PURE__ */ N(Je, {
|
|
2787
2879
|
side: c.side,
|
|
2788
2880
|
showOverlay: c.showOverlay,
|
|
2789
2881
|
onInteractOutside: (e) => {
|
|
@@ -2792,15 +2884,15 @@ function lr({ agentId: e, capability: t, workspacePanelOpen: n, workspacePanelWi
|
|
|
2792
2884
|
showCloseButton: !1,
|
|
2793
2885
|
className: J("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"),
|
|
2794
2886
|
children: [
|
|
2795
|
-
/* @__PURE__ */
|
|
2887
|
+
/* @__PURE__ */ M(Ze, {
|
|
2796
2888
|
className: "sr-only",
|
|
2797
2889
|
children: "Workspace 文件"
|
|
2798
2890
|
}),
|
|
2799
|
-
/* @__PURE__ */
|
|
2891
|
+
/* @__PURE__ */ M(Qe, {
|
|
2800
2892
|
className: "sr-only",
|
|
2801
2893
|
children: "浏览、上传和预览 Workspace 文件。"
|
|
2802
2894
|
}),
|
|
2803
|
-
/* @__PURE__ */
|
|
2895
|
+
/* @__PURE__ */ M(pr, {
|
|
2804
2896
|
agentId: e,
|
|
2805
2897
|
capability: t,
|
|
2806
2898
|
open: n,
|
|
@@ -2813,4 +2905,4 @@ function lr({ agentId: e, capability: t, workspacePanelOpen: n, workspacePanelWi
|
|
|
2813
2905
|
}) : null] });
|
|
2814
2906
|
}
|
|
2815
2907
|
//#endregion
|
|
2816
|
-
export {
|
|
2908
|
+
export { tt as C, Ze as D, Qe as E, Ue as O, pt as S, Je as T, Et as _, Fn as a, St as b, xn as c, Bt as d, Rt as f, Ot as g, wt as h, Pn as i, J as k, dn as l, Ct as m, tr as n, Tn as o, Tt as p, $n as r, Cn as s, mr as t, Vt as u, xt as v, We as w, X as x, Dt as y };
|