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