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