@xpert-ai/chatkit-ui 0.4.12 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/assets/{_baseUniq-DDAF6NS1.js → _baseUniq-Ce9kroYt.js} +1 -1
- package/dist/app/assets/{abap-B5kuZMBU.js → abap-n34Q__Y2.js} +1 -1
- package/dist/app/assets/{abnf-vB7f2WMu.js → abnf-C6UcGmhd.js} +1 -1
- package/dist/app/assets/{actionscript-DdKBH_MP.js → actionscript-CorZU6Nf.js} +1 -1
- package/dist/app/assets/{ada-UAF-C5fV.js → ada-tLvNZOQh.js} +1 -1
- package/dist/app/assets/{agda-Df0jhwc3.js → agda-DbFkZh7g.js} +1 -1
- package/dist/app/assets/{al-atU_jzsj.js → al-D0vYS2t5.js} +1 -1
- package/dist/app/assets/{antlr4-DFy3C0i-.js → antlr4-CnwZDtYg.js} +1 -1
- package/dist/app/assets/{apacheconf-oqf3cl-S.js → apacheconf-xvN2ZspY.js} +1 -1
- package/dist/app/assets/{apex-BH2e-BHs.js → apex-Ca7x_VSV.js} +1 -1
- package/dist/app/assets/{apl-DQSChDxy.js → apl-Nlqpwd_h.js} +1 -1
- package/dist/app/assets/{applescript-DKiAqciQ.js → applescript-B7voCk61.js} +1 -1
- package/dist/app/assets/{aql-CaPJIphH.js → aql-DgJPtgpm.js} +1 -1
- package/dist/app/assets/{arc-CebqIIwp.js → arc-CsunRIF0.js} +1 -1
- package/dist/app/assets/{architectureDiagram-Q4EWVU46-BGCwMfQN.js → architectureDiagram-Q4EWVU46-pomq3v1V.js} +1 -1
- package/dist/app/assets/{arduino-BBjE6dsG.js → arduino-o8aJCPRY.js} +1 -1
- package/dist/app/assets/{arff-CNCoJ57r.js → arff-BUeLNSP_.js} +1 -1
- package/dist/app/assets/{asciidoc-DKCMYIb5.js → asciidoc-CCuKAHbX.js} +1 -1
- package/dist/app/assets/{asm6502-KuppTAQi.js → asm6502-nv6NOrZ1.js} +1 -1
- package/dist/app/assets/{asmatmel-5HYURTVr.js → asmatmel-CnOLubJx.js} +1 -1
- package/dist/app/assets/{aspnet-VRY1dAhW.js → aspnet-DVUcYapb.js} +1 -1
- package/dist/app/assets/{autohotkey-Bgr_lUvQ.js → autohotkey-CGe8-Vkb.js} +1 -1
- package/dist/app/assets/{autoit-Dq59UEgn.js → autoit-DLNStY8z.js} +1 -1
- package/dist/app/assets/{avisynth-BlWjnAOD.js → avisynth-zfhebB-x.js} +1 -1
- package/dist/app/assets/{avro-idl-BQp8Ix-w.js → avro-idl-B6HK8dnl.js} +1 -1
- package/dist/app/assets/{bash-LWvFzRGa.js → bash-DKyhbfmw.js} +1 -1
- package/dist/app/assets/{basic-VqcPtabW.js → basic-BGbUzkZk.js} +1 -1
- package/dist/app/assets/{batch-uVNhIbGZ.js → batch-B_xESmm_.js} +1 -1
- package/dist/app/assets/{bbcode-CCcQPp5e.js → bbcode-Bb7EayNp.js} +1 -1
- package/dist/app/assets/{bicep-Bb19eGzd.js → bicep-DgMgkIZg.js} +1 -1
- package/dist/app/assets/{birb-4bthZwkl.js → birb-DLc39bo4.js} +1 -1
- package/dist/app/assets/{bison-BF4Jifgg.js → bison-DP2ldkO8.js} +1 -1
- package/dist/app/assets/{blockDiagram-DXYQGD6D-CgPQseHK.js → blockDiagram-DXYQGD6D-CHPjX37-.js} +1 -1
- package/dist/app/assets/{bnf-B1jl6Wb4.js → bnf-Br-Qarn0.js} +1 -1
- package/dist/app/assets/{brainfuck-B4A_qSfv.js → brainfuck-DmZ-6z5e.js} +1 -1
- package/dist/app/assets/{brightscript-BQKGhJ6R.js → brightscript-BmorAJiX.js} +1 -1
- package/dist/app/assets/{bro-B2NgcV4s.js → bro-ui-o0ljK.js} +1 -1
- package/dist/app/assets/{bsl-BGr1F29Q.js → bsl-CP9I-0dQ.js} +1 -1
- package/dist/app/assets/{c-r9YaBxRP.js → c-C4OyJNBq.js} +1 -1
- package/dist/app/assets/{c4Diagram-AHTNJAMY-Y45uJy2D.js → c4Diagram-AHTNJAMY-DTeO2JDt.js} +1 -1
- package/dist/app/assets/{cfscript-CQ4VHw9c.js → cfscript-DX-iTpAV.js} +1 -1
- package/dist/app/assets/{chaiscript-DrQAGaNh.js → chaiscript-BR2QXPQ1.js} +1 -1
- package/dist/app/assets/channel-BfT1OHH9.js +1 -0
- package/dist/app/assets/{chunk-4BX2VUAB-DR0YnzMw.js → chunk-4BX2VUAB-CjtJRi8f.js} +1 -1
- package/dist/app/assets/{chunk-4TB4RGXK-Dc4lLBE6.js → chunk-4TB4RGXK-CM0eB5d0.js} +1 -1
- package/dist/app/assets/{chunk-55IACEB6-C-TU0K9X.js → chunk-55IACEB6-BxP67n9y.js} +1 -1
- package/dist/app/assets/{chunk-EDXVE4YY-BaOX0v_0.js → chunk-EDXVE4YY-Bt3onUxq.js} +1 -1
- package/dist/app/assets/{chunk-FMBD7UC4-D359WI80.js → chunk-FMBD7UC4-9UeRly0Y.js} +1 -1
- package/dist/app/assets/{chunk-OYMX7WX6-BuRuBFpQ.js → chunk-OYMX7WX6-B34wN_7o.js} +1 -1
- package/dist/app/assets/{chunk-QZHKN3VN-CyEi-ra2.js → chunk-QZHKN3VN-ClX44MR5.js} +1 -1
- package/dist/app/assets/{chunk-YZCP3GAM-BEEy2K1W.js → chunk-YZCP3GAM-6U6v2Ij5.js} +1 -1
- package/dist/app/assets/{cil-BuADaDKW.js → cil-DTGWd9p2.js} +1 -1
- package/dist/app/assets/classDiagram-6PBFFD2Q-CYuX4PUt.js +1 -0
- package/dist/app/assets/classDiagram-v2-HSJHXN6E-CYuX4PUt.js +1 -0
- package/dist/app/assets/{clike-B1D1DBL3.js → clike-Drp-qkIS.js} +1 -1
- package/dist/app/assets/{clojure-B3SPLK7c.js → clojure-DPhPcpXc.js} +1 -1
- package/dist/app/assets/clone-Cv1YxYN0.js +1 -0
- package/dist/app/assets/{cmake-COH8dih1.js → cmake-C5ihWdjd.js} +1 -1
- package/dist/app/assets/{cobol-C7vZDD37.js → cobol-DfdQKzy-.js} +1 -1
- package/dist/app/assets/{coffeescript-B94CG8h3.js → coffeescript-ILUZkjNM.js} +1 -1
- package/dist/app/assets/{concurnas-DhVx0CX_.js → concurnas-CDS4cF-K.js} +1 -1
- package/dist/app/assets/{coq-DYvqTP2L.js → coq-CMcikezn.js} +1 -1
- package/dist/app/assets/{core-B-Vt8qye.js → core-DNVeH_3a.js} +1 -1
- package/dist/app/assets/{cose-bilkent-S5V4N54A-cnDgdkBZ.js → cose-bilkent-S5V4N54A-BSyBdp9N.js} +1 -1
- package/dist/app/assets/{cpp-DepCH_qd.js → cpp-BRKriMlK.js} +1 -1
- package/dist/app/assets/{crystal-D-5NBLXj.js → crystal-B-fnvxvI.js} +1 -1
- package/dist/app/assets/{csharp-nWa20obb.js → csharp-DpXgCaWk.js} +1 -1
- package/dist/app/assets/{cshtml-7093-HJ_.js → cshtml-dmLvM2uH.js} +1 -1
- package/dist/app/assets/{csp-JmmQah6c.js → csp-Dbw-zK12.js} +1 -1
- package/dist/app/assets/{css-BuEd2fz2.js → css-DQ6uGRR1.js} +1 -1
- package/dist/app/assets/{css-extras-DiYkseu8.js → css-extras-DBnbwFR3.js} +1 -1
- package/dist/app/assets/{csv-Bbn7Sw0h.js → csv-gTIFW0jL.js} +1 -1
- package/dist/app/assets/{cypher-SppGYMTi.js → cypher-BrMaFn8s.js} +1 -1
- package/dist/app/assets/{d-nLANT3dy.js → d-DTUwRQFn.js} +1 -1
- package/dist/app/assets/{dagre-KV5264BT-B1i-BBiR.js → dagre-KV5264BT-BL-XJIT6.js} +1 -1
- package/dist/app/assets/{dart-Dhl_qWV4.js → dart-B0eIMGx2.js} +1 -1
- package/dist/app/assets/{dataweave-DCCRWXjr.js → dataweave-BDWjNgl1.js} +1 -1
- package/dist/app/assets/{dax-BoA2R2N8.js → dax-B3X4ILlW.js} +1 -1
- package/dist/app/assets/{dhall-DTGUaN-4.js → dhall-D2V6j5gZ.js} +1 -1
- package/dist/app/assets/{diagram-5BDNPKRD-Dow19hef.js → diagram-5BDNPKRD-DjSf5aPM.js} +1 -1
- package/dist/app/assets/{diagram-G4DWMVQ6-D0pE9nCA.js → diagram-G4DWMVQ6-CjgjKQZL.js} +1 -1
- package/dist/app/assets/{diagram-MMDJMWI5-DbcRh2vE.js → diagram-MMDJMWI5-7h7nqJCu.js} +1 -1
- package/dist/app/assets/{diagram-TYMM5635-CXx2ZaT4.js → diagram-TYMM5635-Blv4tCDc.js} +1 -1
- package/dist/app/assets/{diff-2OXQn6o9.js → diff-B9ExgdIq.js} +1 -1
- package/dist/app/assets/{django-CdPAzoCC.js → django-DORrnMzH.js} +1 -1
- package/dist/app/assets/{dns-zone-file-BBwevRlw.js → dns-zone-file-C8pb3-VQ.js} +1 -1
- package/dist/app/assets/{docker-DjHVT1mA.js → docker-K5zfOBbh.js} +1 -1
- package/dist/app/assets/{dot-BSnCaGTC.js → dot-CvXtQhe1.js} +1 -1
- package/dist/app/assets/{ebnf-DdZmyGKH.js → ebnf-N8Sygx-N.js} +1 -1
- package/dist/app/assets/{editorconfig-CUSgZ2y_.js → editorconfig-CrLAxwn-.js} +1 -1
- package/dist/app/assets/{eiffel-DsJFaSFl.js → eiffel-BJwHlQOK.js} +1 -1
- package/dist/app/assets/{ejs-BbBJ5QIA.js → ejs-GGhkWnqP.js} +1 -1
- package/dist/app/assets/{elixir-SDkPmJm7.js → elixir-DNWJz4Xa.js} +1 -1
- package/dist/app/assets/{elm-Dug0EDUq.js → elm-BDj2cjFK.js} +1 -1
- package/dist/app/assets/{erDiagram-SMLLAGMA-CeMLsOHD.js → erDiagram-SMLLAGMA-Qd-vYbo0.js} +1 -1
- package/dist/app/assets/{erb-DyyrQtQr.js → erb-DZbc5cT0.js} +1 -1
- package/dist/app/assets/{erlang-ChCNopdz.js → erlang-HJFTxOlp.js} +1 -1
- package/dist/app/assets/{etlua-Dl5Qy9QZ.js → etlua-DQuXDXVj.js} +1 -1
- package/dist/app/assets/{excel-formula-DwMTBw2T.js → excel-formula-CLcITwv0.js} +1 -1
- package/dist/app/assets/{factor-DauUqCmK.js → factor-D6TFKT97.js} +1 -1
- package/dist/app/assets/{false-BXnJ9_dh.js → false-CYOIbDmC.js} +1 -1
- package/dist/app/assets/{firestore-security-rules-ORamZFqd.js → firestore-security-rules-BuK7qGD7.js} +1 -1
- package/dist/app/assets/{flow-21ezBa1O.js → flow-C9RrJxhr.js} +1 -1
- package/dist/app/assets/{flowDiagram-DWJPFMVM-DFUCTxTh.js → flowDiagram-DWJPFMVM-B4wKPM8W.js} +1 -1
- package/dist/app/assets/{fortran-Z9uQlm38.js → fortran-Cd_ZN6vC.js} +1 -1
- package/dist/app/assets/{fsharp-DdLoygGu.js → fsharp-GjO2h33T.js} +1 -1
- package/dist/app/assets/{ftl-DqQYPDj9.js → ftl-aJWw1c8T.js} +1 -1
- package/dist/app/assets/{ganttDiagram-T4ZO3ILL-D3MmdPUG.js → ganttDiagram-T4ZO3ILL-rd9NbSdv.js} +1 -1
- package/dist/app/assets/{gap-DpSNB7Jg.js → gap-DNVVFLRr.js} +1 -1
- package/dist/app/assets/{gcode-CBAQGw-1.js → gcode-D4lPKbIg.js} +1 -1
- package/dist/app/assets/{gdscript-BsIrRHU-.js → gdscript-DfNV-tUB.js} +1 -1
- package/dist/app/assets/{gedcom-CGU-RC0C.js → gedcom-BYPvubZJ.js} +1 -1
- package/dist/app/assets/{gherkin-DIE5QZSL.js → gherkin-BMNoBcck.js} +1 -1
- package/dist/app/assets/{git-CkU9sVQK.js → git-CPJZLB2T.js} +1 -1
- package/dist/app/assets/{gitGraphDiagram-UUTBAWPF-u7-eDWQK.js → gitGraphDiagram-UUTBAWPF-C99FXzLh.js} +1 -1
- package/dist/app/assets/{glsl-Blh9LfIt.js → glsl-Nh5fsOnK.js} +1 -1
- package/dist/app/assets/{gml-Cc45yLFS.js → gml-txELJam3.js} +1 -1
- package/dist/app/assets/{gn-DZ0DddHN.js → gn-CgbeYSf5.js} +1 -1
- package/dist/app/assets/{go-mGyH9IXp.js → go-Dk6Du7he.js} +1 -1
- package/dist/app/assets/{go-module-BvUYZ0sz.js → go-module-Bo2KYSxb.js} +1 -1
- package/dist/app/assets/{graph-BoY8t1-O.js → graph-CLnrzjFn.js} +1 -1
- package/dist/app/assets/{graphql-u2Rgmvln.js → graphql-4dWoWhbW.js} +1 -1
- package/dist/app/assets/{groovy-zZaRUKNR.js → groovy-B4OrjFbV.js} +1 -1
- package/dist/app/assets/{haml-Su2CtJnF.js → haml-BvDou6bp.js} +1 -1
- package/dist/app/assets/{handlebars-F5ADzMhi.js → handlebars-M16IKRgI.js} +1 -1
- package/dist/app/assets/{haskell-DzWmpx32.js → haskell-DfIt0IAN.js} +1 -1
- package/dist/app/assets/{haxe-BGpweLG2.js → haxe-C85tjL19.js} +1 -1
- package/dist/app/assets/{hcl-BjhBcKSg.js → hcl-DmdFYIW6.js} +1 -1
- package/dist/app/assets/{hlsl-SjDbMdjn.js → hlsl-spPkbYrW.js} +1 -1
- package/dist/app/assets/{hoon-Cx3E-s_o.js → hoon-CG21lORC.js} +1 -1
- package/dist/app/assets/{hpkp-DPoMyYoU.js → hpkp-oexmO6k-.js} +1 -1
- package/dist/app/assets/{hsts-lhpshNTY.js → hsts-DdwaHzev.js} +1 -1
- package/dist/app/assets/{http-C3R3gVhT.js → http-Cg3ksPMe.js} +1 -1
- package/dist/app/assets/{ichigojam-CwUu39sX.js → ichigojam-BdxMuPXk.js} +1 -1
- package/dist/app/assets/{icon-TJHjWHXx.js → icon-wGd3Tmq9.js} +1 -1
- package/dist/app/assets/{icu-message-format-DxKTlbxf.js → icu-message-format-CPXO2yc9.js} +1 -1
- package/dist/app/assets/{idris-DWqaccK2.js → idris-D5u9JHmM.js} +1 -1
- package/dist/app/assets/{iecst-DORlcjzm.js → iecst-DYq8QbAy.js} +1 -1
- package/dist/app/assets/{ignore-B9gAYbh1.js → ignore-Ci5lSqDb.js} +1 -1
- package/dist/app/assets/index-B_RltYYB.js +783 -0
- package/dist/app/assets/index-ByEJy9Db.css +1 -0
- package/dist/app/assets/{infoDiagram-42DDH7IO-tYjxziGL.js → infoDiagram-42DDH7IO-BoJMIP_v.js} +1 -1
- package/dist/app/assets/{inform7-DkK-RZMY.js → inform7-DUJXcXaB.js} +1 -1
- package/dist/app/assets/{ini-0w9Xb91U.js → ini-CuJ_bmMO.js} +1 -1
- package/dist/app/assets/{io-DvaCkiMR.js → io-C-FJQSO3.js} +1 -1
- package/dist/app/assets/{ishikawaDiagram-UXIWVN3A-2JB0y6an.js → ishikawaDiagram-UXIWVN3A-BAmPMiIi.js} +1 -1
- package/dist/app/assets/{j-C0RkbTNn.js → j-DtaSK1sz.js} +1 -1
- package/dist/app/assets/{java-D75f0yzo.js → java-CDetIt27.js} +1 -1
- package/dist/app/assets/{javadoc-DJI4x2pb.js → javadoc-CZ3CDS4n.js} +1 -1
- package/dist/app/assets/{javadoclike-CDXreW48.js → javadoclike-BeacuSWR.js} +1 -1
- package/dist/app/assets/{javascript-CYoWsxZG.js → javascript-BfOPyJLM.js} +1 -1
- package/dist/app/assets/{javastacktrace-DxkS056-.js → javastacktrace-29iN0R0u.js} +1 -1
- package/dist/app/assets/{jexl-CDS1hv_s.js → jexl-BnpIjElm.js} +1 -1
- package/dist/app/assets/{jolie-EuNI73RV.js → jolie-D93yxHe4.js} +1 -1
- package/dist/app/assets/{journeyDiagram-VCZTEJTY-B1X5hCIz.js → journeyDiagram-VCZTEJTY-DMpcabcO.js} +1 -1
- package/dist/app/assets/{jq-PhGKEDcu.js → jq-BugvYH1H.js} +1 -1
- package/dist/app/assets/{js-extras-jtc33ycC.js → js-extras-C0MSZLc1.js} +1 -1
- package/dist/app/assets/{js-templates-B3cXQFLp.js → js-templates-CIxTZsvj.js} +1 -1
- package/dist/app/assets/{jsdoc-CqjI_w-r.js → jsdoc-p5Pfu_De.js} +1 -1
- package/dist/app/assets/{json-Ne2BRWg4.js → json-BQjux9AS.js} +1 -1
- package/dist/app/assets/{json5-CiKaM-_C.js → json5-DtGyU4mC.js} +1 -1
- package/dist/app/assets/{jsonp-zvJEur-6.js → jsonp-nmJM1qGA.js} +1 -1
- package/dist/app/assets/{jsstacktrace-CiHGr1oh.js → jsstacktrace-idjkM4Fl.js} +1 -1
- package/dist/app/assets/{jsx-Cjxo93ea.js → jsx-Bgnu51Le.js} +1 -1
- package/dist/app/assets/{julia-BRHMuu5e.js → julia-Bn7OUNnL.js} +1 -1
- package/dist/app/assets/{kanban-definition-6JOO6SKY-DOIj_2Hw.js → kanban-definition-6JOO6SKY-bkQodnTu.js} +1 -1
- package/dist/app/assets/{keepalived-B17LIaaB.js → keepalived-D4SLcdBV.js} +1 -1
- package/dist/app/assets/{keyman-BC0CTO_c.js → keyman-PLQYqBep.js} +1 -1
- package/dist/app/assets/{kotlin-DSDl2yr2.js → kotlin-C4WnY-H1.js} +1 -1
- package/dist/app/assets/{kumir-DH3qkefY.js → kumir-BNZk5sfe.js} +1 -1
- package/dist/app/assets/{kusto-CJxTK0ap.js → kusto-3PKAizI3.js} +1 -1
- package/dist/app/assets/{latex-BN2yX_Ed.js → latex-6XZaVCJa.js} +1 -1
- package/dist/app/assets/{latte-Bvavolyx.js → latte-CV-fKPnc.js} +1 -1
- package/dist/app/assets/{layout-DGwxOXfn.js → layout-1vS3Wjec.js} +1 -1
- package/dist/app/assets/{less-BHMIRXn5.js → less-SX3s-KN_.js} +1 -1
- package/dist/app/assets/{lilypond-Dks2Yn4E.js → lilypond-Dy86N6CJ.js} +1 -1
- package/dist/app/assets/{linear-BbQHAsyX.js → linear-C0n3Pq7-.js} +1 -1
- package/dist/app/assets/{liquid-1Rh_VBgV.js → liquid-L9Zjy8lu.js} +1 -1
- package/dist/app/assets/{lisp-B8F7GnzZ.js → lisp-DJFjEPwB.js} +1 -1
- package/dist/app/assets/{livescript-CnMl3GUW.js → livescript-DQotEykh.js} +1 -1
- package/dist/app/assets/{llvm-kit0j3fk.js → llvm-DvKCeTL1.js} +1 -1
- package/dist/app/assets/{log-BceSrVhl.js → log--xBJ8aU-.js} +1 -1
- package/dist/app/assets/{lolcode-BnIVqr1e.js → lolcode-Cg9QnKMI.js} +1 -1
- package/dist/app/assets/{lua-T-5MUo9C.js → lua-DEQhbUQJ.js} +1 -1
- package/dist/app/assets/{magma-gHe2O1FT.js → magma-D1XGKRht.js} +1 -1
- package/dist/app/assets/{makefile-bjFHqbvE.js → makefile-BLlH1MLd.js} +1 -1
- package/dist/app/assets/{markdown-CuFRHNGb.js → markdown-Dj_RZXj9.js} +1 -1
- package/dist/app/assets/{markup-BvcMGiKs.js → markup-BXU1zXD3.js} +1 -1
- package/dist/app/assets/{markup-templating-BmOIQpVF.js → markup-templating-D0wFjPUm.js} +1 -1
- package/dist/app/assets/{matlab-MUaweOP2.js → matlab-C6S4uunt.js} +1 -1
- package/dist/app/assets/{maxscript-C-vFH8dn.js → maxscript-BdKoHZYI.js} +1 -1
- package/dist/app/assets/{mel-Des6FEsu.js → mel-Couq0V6g.js} +1 -1
- package/dist/app/assets/{mermaid-uLNvYeU7.js → mermaid-CMZsziQ6.js} +1 -1
- package/dist/app/assets/{min-xlulTJHq.js → min-BzZkQG2V.js} +1 -1
- package/dist/app/assets/{mindmap-definition-QFDTVHPH-CfBB94BK.js → mindmap-definition-QFDTVHPH-DiRQVvqc.js} +1 -1
- package/dist/app/assets/{mizar-D6rM1QfB.js → mizar-CmFVSskP.js} +1 -1
- package/dist/app/assets/{mongodb-yE586N9z.js → mongodb-CLcoBk0S.js} +1 -1
- package/dist/app/assets/{monkey-F6R8O6cT.js → monkey-C9CvZyfC.js} +1 -1
- package/dist/app/assets/{moonscript-BRGQgk_O.js → moonscript-BuimfgIY.js} +1 -1
- package/dist/app/assets/{n1ql-C5HrwbXh.js → n1ql-CTSd0zm2.js} +1 -1
- package/dist/app/assets/{n4js-CJi-EH8r.js → n4js-CbUC_VS8.js} +1 -1
- package/dist/app/assets/{nand2tetris-hdl-DxBTUunr.js → nand2tetris-hdl-CCeNYzYf.js} +1 -1
- package/dist/app/assets/{naniscript-BBXcDzDo.js → naniscript-x_Bk9Hzy.js} +1 -1
- package/dist/app/assets/{nasm-CXaelFZU.js → nasm-2Q9W1sFN.js} +1 -1
- package/dist/app/assets/{neon-DoPefS15.js → neon-C1WpBpfz.js} +1 -1
- package/dist/app/assets/{nevod-CX8n8gut.js → nevod-DDSjKKhW.js} +1 -1
- package/dist/app/assets/{nginx-BXXCb5zs.js → nginx-iykGSiRV.js} +1 -1
- package/dist/app/assets/{nim-Dryxvpf7.js → nim-CQWNrhbj.js} +1 -1
- package/dist/app/assets/{nix-C3SgS0sm.js → nix-JWm7pRtl.js} +1 -1
- package/dist/app/assets/{nsis-CuoIbU9u.js → nsis-BETMjcJ8.js} +1 -1
- package/dist/app/assets/{objectivec-ByW5tlUk.js → objectivec-EAqrfrLq.js} +1 -1
- package/dist/app/assets/{ocaml-BwrG1vxe.js → ocaml-B73L71D-.js} +1 -1
- package/dist/app/assets/{opencl-DUXY7e6n.js → opencl-Dv19N-y4.js} +1 -1
- package/dist/app/assets/{openqasm--XSPIHP9.js → openqasm-BmgYVbuD.js} +1 -1
- package/dist/app/assets/{oz-BxcK1fCk.js → oz-D7xUetz0.js} +1 -1
- package/dist/app/assets/{parigp-Cq_RScYD.js → parigp-BGPB83BL.js} +1 -1
- package/dist/app/assets/{parser-BhBh9_yj.js → parser-DFwHmecM.js} +1 -1
- package/dist/app/assets/{pascal-B8xwG_-H.js → pascal-Bg0EHupl.js} +1 -1
- package/dist/app/assets/{pascaligo-DVI5vd0W.js → pascaligo-qppvQVZh.js} +1 -1
- package/dist/app/assets/{pcaxis-CVhxW8dN.js → pcaxis-zxwNMmzG.js} +1 -1
- package/dist/app/assets/{peoplecode-6atfhw90.js → peoplecode-aPBh21FL.js} +1 -1
- package/dist/app/assets/{perl-Bii6ZVZr.js → perl-DPlCkPwa.js} +1 -1
- package/dist/app/assets/{php-CUw8Uhwa.js → php-DlClIcn1.js} +1 -1
- package/dist/app/assets/{php-extras-DPujDZz7.js → php-extras-B6nC-epf.js} +1 -1
- package/dist/app/assets/{phpdoc-DfEawTrK.js → phpdoc-CQwATDWr.js} +1 -1
- package/dist/app/assets/{pieDiagram-DEJITSTG-BdxkrLEe.js → pieDiagram-DEJITSTG-ZZdynjQu.js} +1 -1
- package/dist/app/assets/{plsql-BwYNPHZc.js → plsql-gwEVqfo5.js} +1 -1
- package/dist/app/assets/{powerquery-BQQvuflw.js → powerquery-BLpUU-Qe.js} +1 -1
- package/dist/app/assets/{powershell-IqR72QQg.js → powershell-CIWIjKwt.js} +1 -1
- package/dist/app/assets/{processing-DBFWv5cx.js → processing-DKWcA2i2.js} +1 -1
- package/dist/app/assets/{prolog-IDQzlcDI.js → prolog-9OQJdrqd.js} +1 -1
- package/dist/app/assets/{promql-pvhJxEyv.js → promql-DKIqOQse.js} +1 -1
- package/dist/app/assets/{properties-DMEQb5Fo.js → properties-HZOZNshI.js} +1 -1
- package/dist/app/assets/{protobuf-pPaOApuw.js → protobuf-D4e9GvZm.js} +1 -1
- package/dist/app/assets/{psl-7h3UTxBj.js → psl-BDJcNy4H.js} +1 -1
- package/dist/app/assets/{pug-BSBM9dXD.js → pug-BciWBcyM.js} +1 -1
- package/dist/app/assets/{puppet-dYx_z5u4.js → puppet-BwKdHDrd.js} +1 -1
- package/dist/app/assets/{pure-DV_eZfCY.js → pure-BSz8_WDZ.js} +1 -1
- package/dist/app/assets/{purebasic-BOeezX__.js → purebasic-Ce_8iIHd.js} +1 -1
- package/dist/app/assets/{purescript-BgbK6O1d.js → purescript-CHrsPtZ9.js} +1 -1
- package/dist/app/assets/{q-DXmJs7IN.js → q-Djr7XowN.js} +1 -1
- package/dist/app/assets/{qml-CXjat1gE.js → qml-DbX95iXW.js} +1 -1
- package/dist/app/assets/{qore-DJTbKkUa.js → qore-BHW3iBdM.js} +1 -1
- package/dist/app/assets/{qsharp-D7KET1nO.js → qsharp-BaAkOfW0.js} +1 -1
- package/dist/app/assets/{quadrantDiagram-34T5L4WZ-BZQlafcX.js → quadrantDiagram-34T5L4WZ-dzekw0wf.js} +1 -1
- package/dist/app/assets/{r-ojalpXiN.js → r-C2Wi4ctz.js} +1 -1
- package/dist/app/assets/{racket-CEfT6hAc.js → racket-CtmIzacn.js} +1 -1
- package/dist/app/assets/{reason-DBNmE4oL.js → reason-BLzyiTlK.js} +1 -1
- package/dist/app/assets/{regex-COhTZxZE.js → regex-CH5UvELj.js} +1 -1
- package/dist/app/assets/{rego-wNAgtW3q.js → rego-v3vNlK8Q.js} +1 -1
- package/dist/app/assets/{renpy-DGwLL0fG.js → renpy-BsOG2Btw.js} +1 -1
- package/dist/app/assets/{requirementDiagram-MS252O5E-CcAhbUz5.js → requirementDiagram-MS252O5E-CMtqQ9Uq.js} +1 -1
- package/dist/app/assets/{rest-DYSbFKPV.js → rest-DiRiIIU_.js} +1 -1
- package/dist/app/assets/{rip-Bfbupelm.js → rip-Dn-VCwd0.js} +1 -1
- package/dist/app/assets/{roboconf-DAfuDy2O.js → roboconf-XNQCqxFr.js} +1 -1
- package/dist/app/assets/{robotframework-BUPkauKC.js → robotframework-8GvGUNLP.js} +1 -1
- package/dist/app/assets/{ruby-9VNUAQYV.js → ruby-DTQqq5Uk.js} +1 -1
- package/dist/app/assets/{rust-BeuepAML.js → rust-D6sLZv9h.js} +1 -1
- package/dist/app/assets/{sankeyDiagram-XADWPNL6-jLgXeIwH.js → sankeyDiagram-XADWPNL6-DWO_8lqE.js} +1 -1
- package/dist/app/assets/{sas-e7kS8SsS.js → sas-BZ3aX4ak.js} +1 -1
- package/dist/app/assets/{sass-DYKC0MKE.js → sass-B5upkPlg.js} +1 -1
- package/dist/app/assets/{scala-ClrUfcj7.js → scala-C2MBe7Td.js} +1 -1
- package/dist/app/assets/{scheme-CfwROFXg.js → scheme-B6zEBCUv.js} +1 -1
- package/dist/app/assets/{scss-2lQldpbe.js → scss-m1aDBK-3.js} +1 -1
- package/dist/app/assets/{sequenceDiagram-FGHM5R23-B2LyA3XJ.js → sequenceDiagram-FGHM5R23-Bk8amHDy.js} +1 -1
- package/dist/app/assets/{shell-session-DPaZHV-K.js → shell-session-BVS7EgIU.js} +1 -1
- package/dist/app/assets/{smali-CKuJc0cP.js → smali-DHLQ25o5.js} +1 -1
- package/dist/app/assets/{smalltalk-PubA0-OK.js → smalltalk-C5AE6G6i.js} +1 -1
- package/dist/app/assets/{smarty-_JLI79Cv.js → smarty-C6oBJXh8.js} +1 -1
- package/dist/app/assets/{sml-Bg8pvE9C.js → sml-CBjer1Ju.js} +1 -1
- package/dist/app/assets/{solidity-DP74t6-m.js → solidity-Hg07d2HS.js} +1 -1
- package/dist/app/assets/{solution-file-CstqiDH0.js → solution-file-Knd6ACih.js} +1 -1
- package/dist/app/assets/{soy-QD4r-fge.js → soy-DYzVZHI3.js} +1 -1
- package/dist/app/assets/{sparql-Ctv8wN_S.js → sparql-C-Jfk-cp.js} +1 -1
- package/dist/app/assets/{splunk-spl-DXfTugwh.js → splunk-spl-BzboKtD3.js} +1 -1
- package/dist/app/assets/{sqf-DDYE8u1s.js → sqf-DPSSziDQ.js} +1 -1
- package/dist/app/assets/{sql-CwcCLvnC.js → sql-BpvJJLoy.js} +1 -1
- package/dist/app/assets/{squirrel-Cnsc9D7K.js → squirrel-DvWBwB7O.js} +1 -1
- package/dist/app/assets/{stan-AKGk2epv.js → stan-DG_yEc3A.js} +1 -1
- package/dist/app/assets/{stateDiagram-FHFEXIEX-BSl_DTWy.js → stateDiagram-FHFEXIEX-BGAhAMai.js} +1 -1
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-BaAQ_O_b.js +1 -0
- package/dist/app/assets/{stylus-BZzQ2RYd.js → stylus-DYUYpQhv.js} +1 -1
- package/dist/app/assets/{swift-DE2c2XNt.js → swift-D5VOcoR8.js} +1 -1
- package/dist/app/assets/{systemd-B4iOELli.js → systemd-KJkpMcrQ.js} +1 -1
- package/dist/app/assets/{t4-cs-Drfumg_5.js → t4-cs-CE0gFjd-.js} +1 -1
- package/dist/app/assets/{t4-templating-CWe1Wj1T.js → t4-templating-BMkR24_U.js} +1 -1
- package/dist/app/assets/{t4-vb-Dw48h-8D.js → t4-vb-CcnWMj0o.js} +1 -1
- package/dist/app/assets/{tap-QOawf4s6.js → tap-B-ocJA2K.js} +1 -1
- package/dist/app/assets/{tcl-DCNBICRw.js → tcl-Bo29AqFv.js} +1 -1
- package/dist/app/assets/{textile-DIZodGDg.js → textile-DKIJinMX.js} +1 -1
- package/dist/app/assets/{timeline-definition-GMOUNBTQ-Z9RQmNUy.js → timeline-definition-GMOUNBTQ-DmlLkskM.js} +1 -1
- package/dist/app/assets/{toml-CiK0hA2t.js → toml-TiCqiK8W.js} +1 -1
- package/dist/app/assets/{tremor-zgXyG1cv.js → tremor-TviGxnOS.js} +1 -1
- package/dist/app/assets/{tt2-D1YpVJXr.js → tt2-BDrpTMf6.js} +1 -1
- package/dist/app/assets/{turtle-B1trqDSm.js → turtle-CeKxSdxX.js} +1 -1
- package/dist/app/assets/{twig-Bf9SEHBb.js → twig-M1UoMMo1.js} +1 -1
- package/dist/app/assets/{typescript-C-4JYtNM.js → typescript-dmFE31vI.js} +1 -1
- package/dist/app/assets/{typoscript-hB_DOtTY.js → typoscript-Cs5VF1Pa.js} +1 -1
- package/dist/app/assets/{unrealscript-D8m_f-UH.js → unrealscript-BaCib-aq.js} +1 -1
- package/dist/app/assets/{uorazor-7OFkiaZN.js → uorazor-cOXF8C6j.js} +1 -1
- package/dist/app/assets/{uri-Bg5uoy-A.js → uri-C3nd05kl.js} +1 -1
- package/dist/app/assets/{v-crNEWQ0o.js → v-BFr1Nrw0.js} +1 -1
- package/dist/app/assets/{vala-I7-r3sF5.js → vala-jfSJop5D.js} +1 -1
- package/dist/app/assets/{vbnet-Ch5CuGnJ.js → vbnet-jaTxhVMf.js} +1 -1
- package/dist/app/assets/{velocity-DOxzqRXl.js → velocity-CVfdGYZP.js} +1 -1
- package/dist/app/assets/{vennDiagram-DHZGUBPP-YeOFYz1P.js → vennDiagram-DHZGUBPP-D86j4tQE.js} +1 -1
- package/dist/app/assets/{verilog-D41Pfqh8.js → verilog-BaTLhycC.js} +1 -1
- package/dist/app/assets/{vhdl-CTcWCQJD.js → vhdl-x7L2ZBgk.js} +1 -1
- package/dist/app/assets/{vim-BuN7t_SM.js → vim-CRU4WmNE.js} +1 -1
- package/dist/app/assets/{visual-basic-JQAH8AZk.js → visual-basic-vAcTdpjq.js} +1 -1
- package/dist/app/assets/{wardley-RL74JXVD-BUjHb5HT.js → wardley-RL74JXVD-BDTrCqQK.js} +1 -1
- package/dist/app/assets/{wardleyDiagram-NUSXRM2D-C15gNPrf.js → wardleyDiagram-NUSXRM2D-DqIrmIbD.js} +1 -1
- package/dist/app/assets/{warpscript-Ch53ljcr.js → warpscript-lYsG9Rkh.js} +1 -1
- package/dist/app/assets/{wasm-BOYqb1W1.js → wasm-oxbyypoF.js} +1 -1
- package/dist/app/assets/{web-idl-B-9jGBdG.js → web-idl-DBv_A4kj.js} +1 -1
- package/dist/app/assets/{wiki-BED0tcyV.js → wiki-zAnycImx.js} +1 -1
- package/dist/app/assets/{wolfram-BzxMBieL.js → wolfram-DtHwCvJp.js} +1 -1
- package/dist/app/assets/{wren-BGHq8rsm.js → wren-C0U7cO-m.js} +1 -1
- package/dist/app/assets/{xeora-B9qNkvY8.js → xeora-YTtLCsFY.js} +1 -1
- package/dist/app/assets/{xml-doc-DSfu_FBO.js → xml-doc-BQ4V5a_v.js} +1 -1
- package/dist/app/assets/{xojo-BT2W_WXT.js → xojo-CrVjUIj3.js} +1 -1
- package/dist/app/assets/{xquery-D1t5F9ed.js → xquery-Pt47xtXe.js} +1 -1
- package/dist/app/assets/{xychartDiagram-5P7HB3ND-DCVn10Kq.js → xychartDiagram-5P7HB3ND-psgl64K2.js} +1 -1
- package/dist/app/assets/{yaml-D2dqe7Hw.js → yaml-BH2r0ki2.js} +1 -1
- package/dist/app/assets/{yang-5UPIMSAR.js → yang-BqFz9lM6.js} +1 -1
- package/dist/app/assets/{zig-BvxlkZ0r.js → zig-Dkt3Koao.js} +1 -1
- package/dist/app/index.html +2 -2
- package/dist/index.cjs +1198 -871
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1161 -829
- package/package.json +3 -3
- package/dist/app/assets/channel-VVzQBc9p.js +0 -1
- package/dist/app/assets/classDiagram-6PBFFD2Q-e30oqMPQ.js +0 -1
- package/dist/app/assets/classDiagram-v2-HSJHXN6E-e30oqMPQ.js +0 -1
- package/dist/app/assets/clone-qx55TFbv.js +0 -1
- package/dist/app/assets/index-CUC_NpQM.js +0 -762
- package/dist/app/assets/index-CtioO_Xd.css +0 -1
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-BJqUpXJV.js +0 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// src/components/chat.tsx
|
|
2
|
-
import * as
|
|
2
|
+
import * as React56 from "react";
|
|
3
3
|
import {
|
|
4
4
|
ArrowDown as ArrowDown2,
|
|
5
5
|
ChevronDown as ChevronDown5,
|
|
6
6
|
FileText as FileText5,
|
|
7
|
-
ImageIcon,
|
|
8
|
-
Loader2 as
|
|
7
|
+
ImageIcon as ImageIcon2,
|
|
8
|
+
Loader2 as Loader212,
|
|
9
9
|
Minus,
|
|
10
10
|
Pause,
|
|
11
11
|
Pencil as Pencil4,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
Settings as Settings2,
|
|
15
15
|
Target as Target3,
|
|
16
16
|
Trash2 as Trash23,
|
|
17
|
-
X as
|
|
17
|
+
X as X10
|
|
18
18
|
} from "lucide-react";
|
|
19
19
|
import { CHATKIT_TASK_SUMMARY_OPEN_RESOURCE_EFFECT } from "@xpert-ai/chatkit-types";
|
|
20
20
|
|
|
@@ -351,6 +351,9 @@ import {
|
|
|
351
351
|
import {
|
|
352
352
|
STATE_VARIABLE_HUMAN as STATE_VARIABLE_HUMAN2
|
|
353
353
|
} from "@xpert-ai/chatkit-types";
|
|
354
|
+
import {
|
|
355
|
+
isTrustedChatKitMessageEvent
|
|
356
|
+
} from "@xpert-ai/chatkit-web-shared";
|
|
354
357
|
|
|
355
358
|
// src/hooks/useStream.ts
|
|
356
359
|
var streamRef = { current: null };
|
|
@@ -825,6 +828,7 @@ var createNonce = () => {
|
|
|
825
828
|
};
|
|
826
829
|
var ParentMessengerContext = createContext(null);
|
|
827
830
|
function ParentMessengerProvider({
|
|
831
|
+
channelId,
|
|
828
832
|
children
|
|
829
833
|
}) {
|
|
830
834
|
const { streamRef: streamRef2 } = useStreamManager();
|
|
@@ -895,6 +899,7 @@ function ParentMessengerProvider({
|
|
|
895
899
|
const sendResponse = (nonce, response, error) => {
|
|
896
900
|
const message = {
|
|
897
901
|
__xpaiChatKit: true,
|
|
902
|
+
...channelId ? { channelId } : {},
|
|
898
903
|
type: "response",
|
|
899
904
|
nonce,
|
|
900
905
|
response,
|
|
@@ -903,13 +908,14 @@ function ParentMessengerProvider({
|
|
|
903
908
|
window.parent.postMessage(message, parentOriginRef.current);
|
|
904
909
|
};
|
|
905
910
|
const handleMessage = (event) => {
|
|
906
|
-
if (event
|
|
907
|
-
|
|
908
|
-
|
|
911
|
+
if (!isTrustedChatKitMessageEvent(event, {
|
|
912
|
+
channelId,
|
|
913
|
+
expectedOrigin: parentOriginRef.current,
|
|
914
|
+
expectedSource: window.parent
|
|
915
|
+
})) {
|
|
909
916
|
return;
|
|
910
917
|
}
|
|
911
918
|
const payload = event.data;
|
|
912
|
-
if (payload.__xpaiChatKit !== true) return;
|
|
913
919
|
if (payload.type === "command" && payload.command === "onSendUserMessage") {
|
|
914
920
|
const nonce = typeof payload.nonce === "string" ? payload.nonce : null;
|
|
915
921
|
if (nonce) {
|
|
@@ -1101,7 +1107,7 @@ function ParentMessengerProvider({
|
|
|
1101
1107
|
});
|
|
1102
1108
|
pendingRef.current.clear();
|
|
1103
1109
|
};
|
|
1104
|
-
}, [isParentAvailable, streamRef2]);
|
|
1110
|
+
}, [channelId, isParentAvailable, streamRef2]);
|
|
1105
1111
|
const sendCommand = useCallback(
|
|
1106
1112
|
(command, data, transfer) => {
|
|
1107
1113
|
if (!isParentAvailable) {
|
|
@@ -1110,6 +1116,7 @@ function ParentMessengerProvider({
|
|
|
1110
1116
|
const nonce = createNonce();
|
|
1111
1117
|
const message = {
|
|
1112
1118
|
__xpaiChatKit: true,
|
|
1119
|
+
...channelId ? { channelId } : {},
|
|
1113
1120
|
type: "command",
|
|
1114
1121
|
nonce,
|
|
1115
1122
|
command,
|
|
@@ -1120,7 +1127,7 @@ function ParentMessengerProvider({
|
|
|
1120
1127
|
window.parent.postMessage(message, parentOriginRef.current, transfer);
|
|
1121
1128
|
});
|
|
1122
1129
|
},
|
|
1123
|
-
[isParentAvailable]
|
|
1130
|
+
[channelId, isParentAvailable]
|
|
1124
1131
|
);
|
|
1125
1132
|
const sendEvent = useCallback(
|
|
1126
1133
|
(event, data, transfer) => {
|
|
@@ -1137,13 +1144,14 @@ function ParentMessengerProvider({
|
|
|
1137
1144
|
if (!isParentAvailable) return;
|
|
1138
1145
|
const message = {
|
|
1139
1146
|
__xpaiChatKit: true,
|
|
1147
|
+
...channelId ? { channelId } : {},
|
|
1140
1148
|
type: "event",
|
|
1141
1149
|
event,
|
|
1142
1150
|
data
|
|
1143
1151
|
};
|
|
1144
1152
|
window.parent.postMessage(message, parentOriginRef.current, transfer);
|
|
1145
1153
|
},
|
|
1146
|
-
[isParentAvailable]
|
|
1154
|
+
[channelId, isParentAvailable]
|
|
1147
1155
|
);
|
|
1148
1156
|
const value = useMemo(
|
|
1149
1157
|
() => ({
|
|
@@ -2555,6 +2563,19 @@ var en_US_default = {
|
|
|
2555
2563
|
copy: "Copy",
|
|
2556
2564
|
copied: "Copied",
|
|
2557
2565
|
separator: ", ",
|
|
2566
|
+
attachments: {
|
|
2567
|
+
imageTitle: "Image {{index}}",
|
|
2568
|
+
loading: "Loading {{title}}",
|
|
2569
|
+
unavailable: "Preview unavailable",
|
|
2570
|
+
retry: "Retry",
|
|
2571
|
+
open: "Open {{title}}",
|
|
2572
|
+
close: "Close image preview",
|
|
2573
|
+
modelDetail: "Model detail: {{detail}}",
|
|
2574
|
+
sources: {
|
|
2575
|
+
"knowledge-document": "Knowledge document",
|
|
2576
|
+
sandbox: "Sandbox"
|
|
2577
|
+
}
|
|
2578
|
+
},
|
|
2558
2579
|
shell: {
|
|
2559
2580
|
success: "Success",
|
|
2560
2581
|
running: "Running",
|
|
@@ -3025,6 +3046,19 @@ var zh_CN_default = {
|
|
|
3025
3046
|
copy: "\u590D\u5236",
|
|
3026
3047
|
copied: "\u5DF2\u590D\u5236",
|
|
3027
3048
|
separator: "\uFF0C",
|
|
3049
|
+
attachments: {
|
|
3050
|
+
imageTitle: "\u56FE\u7247 {{index}}",
|
|
3051
|
+
loading: "\u6B63\u5728\u52A0\u8F7D{{title}}",
|
|
3052
|
+
unavailable: "\u56FE\u7247\u9884\u89C8\u4E0D\u53EF\u7528",
|
|
3053
|
+
retry: "\u91CD\u8BD5",
|
|
3054
|
+
open: "\u67E5\u770B{{title}}",
|
|
3055
|
+
close: "\u5173\u95ED\u56FE\u7247\u9884\u89C8",
|
|
3056
|
+
modelDetail: "\u6A21\u578B\u6E05\u6670\u5EA6\uFF1A{{detail}}",
|
|
3057
|
+
sources: {
|
|
3058
|
+
"knowledge-document": "\u77E5\u8BC6\u6587\u6863",
|
|
3059
|
+
sandbox: "\u6C99\u7BB1"
|
|
3060
|
+
}
|
|
3061
|
+
},
|
|
3028
3062
|
shell: {
|
|
3029
3063
|
success: "\u6210\u529F",
|
|
3030
3064
|
running: "\u8FD0\u884C\u4E2D",
|
|
@@ -8831,8 +8865,8 @@ function useSlashCommands({
|
|
|
8831
8865
|
}
|
|
8832
8866
|
|
|
8833
8867
|
// src/components/thread/messages/ai.tsx
|
|
8834
|
-
import * as
|
|
8835
|
-
import { ChevronDown as ChevronDown4, Clock3 as Clock32, Loader2 as
|
|
8868
|
+
import * as React38 from "react";
|
|
8869
|
+
import { ChevronDown as ChevronDown4, Clock3 as Clock32, Loader2 as Loader29 } from "lucide-react";
|
|
8836
8870
|
|
|
8837
8871
|
// src/lib/agent-run-render-tree.ts
|
|
8838
8872
|
function isTextContent(content) {
|
|
@@ -11341,7 +11375,7 @@ function hasComponentMessageRendererDetails(renderer, content, data) {
|
|
|
11341
11375
|
}
|
|
11342
11376
|
|
|
11343
11377
|
// src/components/thread/messages/tool-component-group.tsx
|
|
11344
|
-
import * as
|
|
11378
|
+
import * as React35 from "react";
|
|
11345
11379
|
import {
|
|
11346
11380
|
BookOpen,
|
|
11347
11381
|
Brain as Brain3,
|
|
@@ -11353,7 +11387,7 @@ import {
|
|
|
11353
11387
|
Copy as Copy2,
|
|
11354
11388
|
FileText as FileText4,
|
|
11355
11389
|
Files,
|
|
11356
|
-
Loader2 as
|
|
11390
|
+
Loader2 as Loader27,
|
|
11357
11391
|
ListTodo as ListTodo2,
|
|
11358
11392
|
Network,
|
|
11359
11393
|
Repeat2,
|
|
@@ -11363,6 +11397,72 @@ import {
|
|
|
11363
11397
|
XCircle as XCircle3
|
|
11364
11398
|
} from "lucide-react";
|
|
11365
11399
|
|
|
11400
|
+
// src/lib/tool-output-attachments.ts
|
|
11401
|
+
import {
|
|
11402
|
+
TOOL_OUTPUT_PRESENTATION_TYPE,
|
|
11403
|
+
TOOL_OUTPUT_PRESENTATION_VERSION
|
|
11404
|
+
} from "@xpert-ai/chatkit-types";
|
|
11405
|
+
import { z } from "zod";
|
|
11406
|
+
var boundedId = z.string().trim().min(1).max(256);
|
|
11407
|
+
var boundedLabel = z.string().trim().min(1).max(500);
|
|
11408
|
+
var toolOutputImageAnchorsSchema = z.object({
|
|
11409
|
+
knowledgeDocumentId: boundedId.optional(),
|
|
11410
|
+
page: z.number().int().positive().max(1e6).optional(),
|
|
11411
|
+
chunkId: boundedId.optional(),
|
|
11412
|
+
sourceBlockIds: z.array(boundedId).max(100).optional(),
|
|
11413
|
+
visualAssetId: boundedId.optional()
|
|
11414
|
+
}).strict();
|
|
11415
|
+
var toolOutputImageAttachmentSchema = z.object({
|
|
11416
|
+
type: z.literal("image"),
|
|
11417
|
+
artifactId: boundedId,
|
|
11418
|
+
artifactVersionId: boundedId,
|
|
11419
|
+
sha256: z.string().regex(/^[a-f0-9]{64}$/i),
|
|
11420
|
+
mimeType: z.enum(["image/png", "image/jpeg", "image/webp"]),
|
|
11421
|
+
width: z.number().int().positive().max(1e5).optional(),
|
|
11422
|
+
height: z.number().int().positive().max(1e5).optional(),
|
|
11423
|
+
title: boundedLabel.optional(),
|
|
11424
|
+
alt: boundedLabel.optional(),
|
|
11425
|
+
source: z.enum(["knowledge-document", "sandbox"]),
|
|
11426
|
+
modelDetail: z.enum(["auto", "low", "high"]),
|
|
11427
|
+
anchors: toolOutputImageAnchorsSchema.optional()
|
|
11428
|
+
}).strict();
|
|
11429
|
+
var toolOutputPresentationSchema = z.object({
|
|
11430
|
+
type: z.literal(TOOL_OUTPUT_PRESENTATION_TYPE),
|
|
11431
|
+
version: z.literal(TOOL_OUTPUT_PRESENTATION_VERSION),
|
|
11432
|
+
attachments: z.array(toolOutputImageAttachmentSchema).min(1).max(20)
|
|
11433
|
+
}).strict();
|
|
11434
|
+
var toolOutputAttachmentPreviewSchema = z.object({
|
|
11435
|
+
previewUrl: z.string().url(),
|
|
11436
|
+
expiresAt: z.string().optional()
|
|
11437
|
+
}).strict().superRefine((preview, context) => {
|
|
11438
|
+
const protocol = new URL(preview.previewUrl).protocol;
|
|
11439
|
+
if (protocol !== "https:" && protocol !== "http:") {
|
|
11440
|
+
context.addIssue({
|
|
11441
|
+
code: "custom",
|
|
11442
|
+
message: "Tool-output previews must use an HTTP(S) URL.",
|
|
11443
|
+
path: ["previewUrl"]
|
|
11444
|
+
});
|
|
11445
|
+
}
|
|
11446
|
+
if (preview.expiresAt && Number.isNaN(Date.parse(preview.expiresAt))) {
|
|
11447
|
+
context.addIssue({
|
|
11448
|
+
code: "custom",
|
|
11449
|
+
message: "Tool-output preview expiry must be an ISO date string.",
|
|
11450
|
+
path: ["expiresAt"]
|
|
11451
|
+
});
|
|
11452
|
+
}
|
|
11453
|
+
});
|
|
11454
|
+
function parseToolOutputPresentation(value) {
|
|
11455
|
+
const result = toolOutputPresentationSchema.safeParse(value);
|
|
11456
|
+
return result.success ? result.data : null;
|
|
11457
|
+
}
|
|
11458
|
+
function parseToolOutputAttachmentPreview(value) {
|
|
11459
|
+
const result = toolOutputAttachmentPreviewSchema.safeParse(value);
|
|
11460
|
+
return result.success ? result.data : null;
|
|
11461
|
+
}
|
|
11462
|
+
function toolOutputAttachmentKey(attachment) {
|
|
11463
|
+
return `${attachment.artifactId}:${attachment.artifactVersionId}:${attachment.sha256}`;
|
|
11464
|
+
}
|
|
11465
|
+
|
|
11366
11466
|
// src/components/thread/messages/sandbox-shell-tool-call.tsx
|
|
11367
11467
|
import * as React33 from "react";
|
|
11368
11468
|
import { Check as Check3, Copy } from "lucide-react";
|
|
@@ -11602,8 +11702,221 @@ function SandboxShellToolCallCard({ data }) {
|
|
|
11602
11702
|
);
|
|
11603
11703
|
}
|
|
11604
11704
|
|
|
11605
|
-
// src/components/thread/messages/tool-
|
|
11705
|
+
// src/components/thread/messages/tool-output-attachments.tsx
|
|
11706
|
+
import * as React34 from "react";
|
|
11707
|
+
import * as Dialog2 from "@radix-ui/react-dialog";
|
|
11708
|
+
import { ImageIcon, Loader2 as Loader26, RefreshCw as RefreshCw3, X as X7 } from "lucide-react";
|
|
11606
11709
|
import { jsx as jsx39, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
11710
|
+
function useToolOutputAttachmentPreview(request) {
|
|
11711
|
+
const parentMessenger = React34.useContext(ParentMessengerContext);
|
|
11712
|
+
const [attempt, setAttempt] = React34.useState(0);
|
|
11713
|
+
const [state, setState] = React34.useState({
|
|
11714
|
+
status: "loading"
|
|
11715
|
+
});
|
|
11716
|
+
const attachmentKey = toolOutputAttachmentKey(request.attachment);
|
|
11717
|
+
React34.useEffect(() => {
|
|
11718
|
+
if (!parentMessenger?.isParentAvailable) {
|
|
11719
|
+
setState({ status: "error" });
|
|
11720
|
+
return;
|
|
11721
|
+
}
|
|
11722
|
+
let cancelled = false;
|
|
11723
|
+
let refreshTimer = null;
|
|
11724
|
+
setState({ status: "loading" });
|
|
11725
|
+
void parentMessenger.sendCommand("onToolOutputAttachmentPreview", request).then((response) => {
|
|
11726
|
+
if (cancelled) return;
|
|
11727
|
+
const preview = parseToolOutputAttachmentPreview(response);
|
|
11728
|
+
if (!preview) {
|
|
11729
|
+
setState({ status: "error" });
|
|
11730
|
+
return;
|
|
11731
|
+
}
|
|
11732
|
+
if (preview.expiresAt) {
|
|
11733
|
+
const remainingLifetime = Date.parse(preview.expiresAt) - Date.now();
|
|
11734
|
+
if (remainingLifetime <= 0) {
|
|
11735
|
+
setState({ status: "error" });
|
|
11736
|
+
return;
|
|
11737
|
+
}
|
|
11738
|
+
refreshTimer = window.setTimeout(
|
|
11739
|
+
() => setAttempt((current) => current + 1),
|
|
11740
|
+
Math.max(1e3, Math.floor(remainingLifetime * 0.8))
|
|
11741
|
+
);
|
|
11742
|
+
}
|
|
11743
|
+
setState({ status: "success", previewUrl: preview.previewUrl });
|
|
11744
|
+
}).catch(() => {
|
|
11745
|
+
if (!cancelled) setState({ status: "error" });
|
|
11746
|
+
});
|
|
11747
|
+
return () => {
|
|
11748
|
+
cancelled = true;
|
|
11749
|
+
if (refreshTimer !== null) window.clearTimeout(refreshTimer);
|
|
11750
|
+
};
|
|
11751
|
+
}, [attachmentKey, attempt, parentMessenger, request]);
|
|
11752
|
+
return {
|
|
11753
|
+
state,
|
|
11754
|
+
fail: () => setState({ status: "error" }),
|
|
11755
|
+
retry: () => setAttempt((current) => current + 1)
|
|
11756
|
+
};
|
|
11757
|
+
}
|
|
11758
|
+
function attachmentTitle(attachment, fallback) {
|
|
11759
|
+
return attachment.title ?? attachment.alt ?? (attachment.anchors?.page ? `${fallback} \xB7 ${attachment.anchors.page}` : fallback);
|
|
11760
|
+
}
|
|
11761
|
+
function ToolOutputImageAttachmentCard({
|
|
11762
|
+
attachment,
|
|
11763
|
+
index,
|
|
11764
|
+
toolCallId,
|
|
11765
|
+
executionId
|
|
11766
|
+
}) {
|
|
11767
|
+
const { t } = useChatkitTranslation();
|
|
11768
|
+
const request = React34.useMemo(
|
|
11769
|
+
() => ({ attachment, toolCallId, executionId }),
|
|
11770
|
+
[attachment, executionId, toolCallId]
|
|
11771
|
+
);
|
|
11772
|
+
const { state, fail, retry } = useToolOutputAttachmentPreview(request);
|
|
11773
|
+
const fallbackTitle = t("message.toolGroup.attachments.imageTitle", {
|
|
11774
|
+
index: index + 1
|
|
11775
|
+
});
|
|
11776
|
+
const title = attachmentTitle(attachment, fallbackTitle);
|
|
11777
|
+
const dimensions = attachment.width && attachment.height ? `${attachment.width} \xD7 ${attachment.height}` : null;
|
|
11778
|
+
const sourceLabel = t(
|
|
11779
|
+
`message.toolGroup.attachments.sources.${attachment.source}`
|
|
11780
|
+
);
|
|
11781
|
+
const description = [
|
|
11782
|
+
sourceLabel,
|
|
11783
|
+
dimensions,
|
|
11784
|
+
t("message.toolGroup.attachments.modelDetail", {
|
|
11785
|
+
detail: attachment.modelDetail
|
|
11786
|
+
})
|
|
11787
|
+
].filter(Boolean).join(" \xB7 ");
|
|
11788
|
+
if (state.status === "loading") {
|
|
11789
|
+
return /* @__PURE__ */ jsx39(
|
|
11790
|
+
"div",
|
|
11791
|
+
{
|
|
11792
|
+
className: "flex aspect-video min-w-0 items-center justify-center rounded-lg border border-border bg-background",
|
|
11793
|
+
"aria-label": t("message.toolGroup.attachments.loading", { title }),
|
|
11794
|
+
children: /* @__PURE__ */ jsx39(
|
|
11795
|
+
Loader26,
|
|
11796
|
+
{
|
|
11797
|
+
className: "h-5 w-5 animate-spin text-muted-foreground",
|
|
11798
|
+
"aria-hidden": "true"
|
|
11799
|
+
}
|
|
11800
|
+
)
|
|
11801
|
+
}
|
|
11802
|
+
);
|
|
11803
|
+
}
|
|
11804
|
+
if (state.status === "error") {
|
|
11805
|
+
return /* @__PURE__ */ jsxs26("div", { className: "flex aspect-video min-w-0 flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-border bg-background px-3 text-center", children: [
|
|
11806
|
+
/* @__PURE__ */ jsx39(
|
|
11807
|
+
ImageIcon,
|
|
11808
|
+
{
|
|
11809
|
+
className: "h-5 w-5 text-muted-foreground",
|
|
11810
|
+
"aria-hidden": "true"
|
|
11811
|
+
}
|
|
11812
|
+
),
|
|
11813
|
+
/* @__PURE__ */ jsx39("span", { className: "line-clamp-2 text-[11px] text-muted-foreground", children: t("message.toolGroup.attachments.unavailable") }),
|
|
11814
|
+
/* @__PURE__ */ jsxs26(
|
|
11815
|
+
"button",
|
|
11816
|
+
{
|
|
11817
|
+
type: "button",
|
|
11818
|
+
className: "inline-flex h-7 items-center gap-1 rounded-md px-2 text-[11px] font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
11819
|
+
onClick: retry,
|
|
11820
|
+
children: [
|
|
11821
|
+
/* @__PURE__ */ jsx39(RefreshCw3, { className: "h-3 w-3", "aria-hidden": "true" }),
|
|
11822
|
+
t("message.toolGroup.attachments.retry")
|
|
11823
|
+
]
|
|
11824
|
+
}
|
|
11825
|
+
)
|
|
11826
|
+
] });
|
|
11827
|
+
}
|
|
11828
|
+
return /* @__PURE__ */ jsxs26(Dialog2.Root, { children: [
|
|
11829
|
+
/* @__PURE__ */ jsx39(Dialog2.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs26(
|
|
11830
|
+
"button",
|
|
11831
|
+
{
|
|
11832
|
+
type: "button",
|
|
11833
|
+
className: "group relative aspect-video min-w-0 overflow-hidden rounded-lg border border-border bg-background text-left shadow-sm transition hover:border-ring/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
11834
|
+
"aria-label": t("message.toolGroup.attachments.open", { title }),
|
|
11835
|
+
children: [
|
|
11836
|
+
/* @__PURE__ */ jsx39(
|
|
11837
|
+
"img",
|
|
11838
|
+
{
|
|
11839
|
+
className: "h-full w-full object-cover transition-transform group-hover:scale-[1.02]",
|
|
11840
|
+
src: state.previewUrl,
|
|
11841
|
+
alt: attachment.alt ?? title,
|
|
11842
|
+
loading: "lazy",
|
|
11843
|
+
referrerPolicy: "no-referrer",
|
|
11844
|
+
onError: fail
|
|
11845
|
+
}
|
|
11846
|
+
),
|
|
11847
|
+
/* @__PURE__ */ jsxs26("span", { className: "absolute inset-x-0 bottom-0 bg-black/65 px-2 py-1.5 text-[11px] font-medium leading-4 text-white", children: [
|
|
11848
|
+
/* @__PURE__ */ jsx39("span", { className: "line-clamp-1", children: title }),
|
|
11849
|
+
/* @__PURE__ */ jsx39("span", { className: "block truncate text-white/70", children: description })
|
|
11850
|
+
] })
|
|
11851
|
+
]
|
|
11852
|
+
}
|
|
11853
|
+
) }),
|
|
11854
|
+
/* @__PURE__ */ jsxs26(Dialog2.Portal, { children: [
|
|
11855
|
+
/* @__PURE__ */ jsx39(Dialog2.Overlay, { className: "fixed inset-0 z-[80] bg-black/80 data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" }),
|
|
11856
|
+
/* @__PURE__ */ jsxs26(
|
|
11857
|
+
Dialog2.Content,
|
|
11858
|
+
{
|
|
11859
|
+
className: cn(
|
|
11860
|
+
"fixed left-1/2 top-1/2 z-[81] flex max-h-[92vh] w-[min(92vw,1200px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-border bg-background shadow-2xl",
|
|
11861
|
+
"focus:outline-none data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"
|
|
11862
|
+
),
|
|
11863
|
+
children: [
|
|
11864
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex min-w-0 items-start justify-between gap-3 border-b border-border px-4 py-3", children: [
|
|
11865
|
+
/* @__PURE__ */ jsxs26("div", { className: "min-w-0", children: [
|
|
11866
|
+
/* @__PURE__ */ jsx39(Dialog2.Title, { className: "truncate text-sm font-semibold text-foreground", children: title }),
|
|
11867
|
+
/* @__PURE__ */ jsx39(Dialog2.Description, { className: "mt-0.5 text-xs text-muted-foreground", children: description })
|
|
11868
|
+
] }),
|
|
11869
|
+
/* @__PURE__ */ jsx39(
|
|
11870
|
+
Dialog2.Close,
|
|
11871
|
+
{
|
|
11872
|
+
className: "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
11873
|
+
"aria-label": t("message.toolGroup.attachments.close"),
|
|
11874
|
+
children: /* @__PURE__ */ jsx39(X7, { className: "h-4 w-4", "aria-hidden": "true" })
|
|
11875
|
+
}
|
|
11876
|
+
)
|
|
11877
|
+
] }),
|
|
11878
|
+
/* @__PURE__ */ jsx39("div", { className: "min-h-0 flex-1 overflow-auto bg-black/95 p-4", children: /* @__PURE__ */ jsx39(
|
|
11879
|
+
"img",
|
|
11880
|
+
{
|
|
11881
|
+
className: "mx-auto h-auto max-h-[calc(92vh-6rem)] max-w-full object-contain",
|
|
11882
|
+
src: state.previewUrl,
|
|
11883
|
+
alt: attachment.alt ?? title,
|
|
11884
|
+
referrerPolicy: "no-referrer",
|
|
11885
|
+
onError: fail
|
|
11886
|
+
}
|
|
11887
|
+
) })
|
|
11888
|
+
]
|
|
11889
|
+
}
|
|
11890
|
+
)
|
|
11891
|
+
] })
|
|
11892
|
+
] });
|
|
11893
|
+
}
|
|
11894
|
+
function ToolOutputAttachments({
|
|
11895
|
+
presentation,
|
|
11896
|
+
toolCallId,
|
|
11897
|
+
executionId
|
|
11898
|
+
}) {
|
|
11899
|
+
return /* @__PURE__ */ jsx39(
|
|
11900
|
+
"div",
|
|
11901
|
+
{
|
|
11902
|
+
className: "grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",
|
|
11903
|
+
"data-testid": "tool-output-attachments",
|
|
11904
|
+
children: presentation.attachments.map((attachment, index) => /* @__PURE__ */ jsx39(
|
|
11905
|
+
ToolOutputImageAttachmentCard,
|
|
11906
|
+
{
|
|
11907
|
+
attachment,
|
|
11908
|
+
index,
|
|
11909
|
+
toolCallId,
|
|
11910
|
+
executionId
|
|
11911
|
+
},
|
|
11912
|
+
toolOutputAttachmentKey(attachment)
|
|
11913
|
+
))
|
|
11914
|
+
}
|
|
11915
|
+
);
|
|
11916
|
+
}
|
|
11917
|
+
|
|
11918
|
+
// src/components/thread/messages/tool-component-group.tsx
|
|
11919
|
+
import { Fragment as Fragment7, jsx as jsx40, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
11607
11920
|
var toolStatusConfig = {
|
|
11608
11921
|
success: {
|
|
11609
11922
|
iconClass: "border-green-500 text-green-700",
|
|
@@ -11615,7 +11928,7 @@ var toolStatusConfig = {
|
|
|
11615
11928
|
},
|
|
11616
11929
|
running: {
|
|
11617
11930
|
iconClass: "border-blue-500 text-blue-700",
|
|
11618
|
-
icon:
|
|
11931
|
+
icon: Loader27
|
|
11619
11932
|
}
|
|
11620
11933
|
};
|
|
11621
11934
|
var TOOL_GROUP_CATEGORY_ORDER = [
|
|
@@ -11709,10 +12022,10 @@ function formatStepDuration2(durationMs) {
|
|
|
11709
12022
|
return `${minutes}m ${seconds}s`;
|
|
11710
12023
|
}
|
|
11711
12024
|
function useFrozenTimestamp(shouldFreeze) {
|
|
11712
|
-
const [frozenAt, setFrozenAt] =
|
|
12025
|
+
const [frozenAt, setFrozenAt] = React35.useState(
|
|
11713
12026
|
() => shouldFreeze ? Date.now() : null
|
|
11714
12027
|
);
|
|
11715
|
-
|
|
12028
|
+
React35.useEffect(() => {
|
|
11716
12029
|
if (shouldFreeze) {
|
|
11717
12030
|
setFrozenAt((current) => current ?? Date.now());
|
|
11718
12031
|
return;
|
|
@@ -11722,12 +12035,12 @@ function useFrozenTimestamp(shouldFreeze) {
|
|
|
11722
12035
|
return frozenAt;
|
|
11723
12036
|
}
|
|
11724
12037
|
function useToolStepDurationLabel(data, options) {
|
|
11725
|
-
const [durationNow, setDurationNow] =
|
|
12038
|
+
const [durationNow, setDurationNow] = React35.useState(() => Date.now());
|
|
11726
12039
|
const createdAt = parseStepDate(data.created_date);
|
|
11727
12040
|
const explicitEndedAt = parseStepDate(data.end_date);
|
|
11728
12041
|
const status = options?.status ?? data.status;
|
|
11729
12042
|
const endedAt = explicitEndedAt ?? (status !== "running" ? options?.fallbackEndedAt ?? null : null);
|
|
11730
|
-
|
|
12043
|
+
React35.useEffect(() => {
|
|
11731
12044
|
if (status !== "running" || createdAt === null || endedAt !== null) {
|
|
11732
12045
|
return;
|
|
11733
12046
|
}
|
|
@@ -11794,7 +12107,8 @@ function classifyToolToken(value) {
|
|
|
11794
12107
|
return "commands";
|
|
11795
12108
|
}
|
|
11796
12109
|
if (normalized.includes("list")) return "lists";
|
|
11797
|
-
if (normalized.includes("task") || normalized.includes("todo"))
|
|
12110
|
+
if (normalized.includes("task") || normalized.includes("todo"))
|
|
12111
|
+
return "tasks";
|
|
11798
12112
|
if (normalized.includes("knowledge") || normalized.includes("retriever")) {
|
|
11799
12113
|
return "knowledges";
|
|
11800
12114
|
}
|
|
@@ -11806,11 +12120,14 @@ function getToolGroupCategory(content) {
|
|
|
11806
12120
|
return classifyToolToken(data.type) ?? classifyToolToken(data.tool) ?? classifyToolToken(data.title) ?? classifyToolToken(data.message) ?? "tools";
|
|
11807
12121
|
}
|
|
11808
12122
|
function getToolGroupCategoryCounts(items) {
|
|
11809
|
-
return items.reduce(
|
|
11810
|
-
|
|
11811
|
-
|
|
11812
|
-
|
|
11813
|
-
|
|
12123
|
+
return items.reduce(
|
|
12124
|
+
(counts, item) => {
|
|
12125
|
+
const category = getToolGroupCategory(item);
|
|
12126
|
+
counts[category] = (counts[category] ?? 0) + 1;
|
|
12127
|
+
return counts;
|
|
12128
|
+
},
|
|
12129
|
+
{}
|
|
12130
|
+
);
|
|
11814
12131
|
}
|
|
11815
12132
|
function getToolActivityLabel(content, language, statusOverride) {
|
|
11816
12133
|
const data = getToolStepData(content);
|
|
@@ -11915,8 +12232,8 @@ function shouldUseToolsetAvatar(toolset) {
|
|
|
11915
12232
|
}
|
|
11916
12233
|
function useToolsetAvatar(toolsetId, enabled, apiUrl) {
|
|
11917
12234
|
const avatarUrl = enabled ? createToolsetAvatarUrl(toolsetId, apiUrl) : null;
|
|
11918
|
-
const [avatar, setAvatar] =
|
|
11919
|
-
|
|
12235
|
+
const [avatar, setAvatar] = React35.useState(null);
|
|
12236
|
+
React35.useEffect(() => {
|
|
11920
12237
|
if (!avatarUrl) {
|
|
11921
12238
|
setAvatar(null);
|
|
11922
12239
|
return;
|
|
@@ -11948,7 +12265,7 @@ function ToolAvatarIcon({
|
|
|
11948
12265
|
className
|
|
11949
12266
|
}) {
|
|
11950
12267
|
if (avatar.url) {
|
|
11951
|
-
return /* @__PURE__ */
|
|
12268
|
+
return /* @__PURE__ */ jsx40(
|
|
11952
12269
|
"img",
|
|
11953
12270
|
{
|
|
11954
12271
|
alt: "",
|
|
@@ -11961,7 +12278,7 @@ function ToolAvatarIcon({
|
|
|
11961
12278
|
}
|
|
11962
12279
|
const emoji = unicodeFromUnified2(avatar.emoji?.unified);
|
|
11963
12280
|
if (emoji) {
|
|
11964
|
-
return /* @__PURE__ */
|
|
12281
|
+
return /* @__PURE__ */ jsx40(
|
|
11965
12282
|
"span",
|
|
11966
12283
|
{
|
|
11967
12284
|
"aria-hidden": "true",
|
|
@@ -11976,7 +12293,7 @@ function ToolAvatarIcon({
|
|
|
11976
12293
|
}
|
|
11977
12294
|
);
|
|
11978
12295
|
}
|
|
11979
|
-
return /* @__PURE__ */
|
|
12296
|
+
return /* @__PURE__ */ jsx40(
|
|
11980
12297
|
CircleHelp,
|
|
11981
12298
|
{
|
|
11982
12299
|
className,
|
|
@@ -12033,18 +12350,14 @@ function ToolStepIcon({
|
|
|
12033
12350
|
apiUrl
|
|
12034
12351
|
}) {
|
|
12035
12352
|
const usesToolsetAvatar = shouldUseToolsetAvatar(data.toolset);
|
|
12036
|
-
const avatar = useToolsetAvatar(
|
|
12037
|
-
data.toolset_id,
|
|
12038
|
-
usesToolsetAvatar,
|
|
12039
|
-
apiUrl
|
|
12040
|
-
);
|
|
12353
|
+
const avatar = useToolsetAvatar(data.toolset_id, usesToolsetAvatar, apiUrl);
|
|
12041
12354
|
const iconUrl = createToolsetIconUrl(data.toolset, organizationId, apiUrl);
|
|
12042
|
-
const [failedIconUrl, setFailedIconUrl] =
|
|
12043
|
-
|
|
12355
|
+
const [failedIconUrl, setFailedIconUrl] = React35.useState(null);
|
|
12356
|
+
React35.useEffect(() => {
|
|
12044
12357
|
setFailedIconUrl(null);
|
|
12045
12358
|
}, [iconUrl]);
|
|
12046
12359
|
if (avatar) {
|
|
12047
|
-
return /* @__PURE__ */
|
|
12360
|
+
return /* @__PURE__ */ jsx40(
|
|
12048
12361
|
ToolAvatarIcon,
|
|
12049
12362
|
{
|
|
12050
12363
|
avatar,
|
|
@@ -12054,7 +12367,7 @@ function ToolStepIcon({
|
|
|
12054
12367
|
);
|
|
12055
12368
|
}
|
|
12056
12369
|
if (iconUrl && failedIconUrl !== iconUrl) {
|
|
12057
|
-
return /* @__PURE__ */
|
|
12370
|
+
return /* @__PURE__ */ jsx40(
|
|
12058
12371
|
"img",
|
|
12059
12372
|
{
|
|
12060
12373
|
alt: "",
|
|
@@ -12068,7 +12381,7 @@ function ToolStepIcon({
|
|
|
12068
12381
|
}
|
|
12069
12382
|
const TypeIcon = getStepTypeIcon(data.type);
|
|
12070
12383
|
if (TypeIcon) {
|
|
12071
|
-
return /* @__PURE__ */
|
|
12384
|
+
return /* @__PURE__ */ jsx40(
|
|
12072
12385
|
TypeIcon,
|
|
12073
12386
|
{
|
|
12074
12387
|
className,
|
|
@@ -12079,7 +12392,7 @@ function ToolStepIcon({
|
|
|
12079
12392
|
}
|
|
12080
12393
|
const ToolsetIcon = getKnownToolsetIcon(data.toolset);
|
|
12081
12394
|
if (ToolsetIcon) {
|
|
12082
|
-
return /* @__PURE__ */
|
|
12395
|
+
return /* @__PURE__ */ jsx40(
|
|
12083
12396
|
ToolsetIcon,
|
|
12084
12397
|
{
|
|
12085
12398
|
className,
|
|
@@ -12089,7 +12402,7 @@ function ToolStepIcon({
|
|
|
12089
12402
|
);
|
|
12090
12403
|
}
|
|
12091
12404
|
if (usesToolsetAvatar) {
|
|
12092
|
-
return /* @__PURE__ */
|
|
12405
|
+
return /* @__PURE__ */ jsx40(
|
|
12093
12406
|
CircleHelp,
|
|
12094
12407
|
{
|
|
12095
12408
|
className,
|
|
@@ -12098,7 +12411,7 @@ function ToolStepIcon({
|
|
|
12098
12411
|
}
|
|
12099
12412
|
);
|
|
12100
12413
|
}
|
|
12101
|
-
return /* @__PURE__ */
|
|
12414
|
+
return /* @__PURE__ */ jsx40(
|
|
12102
12415
|
CircleHelp,
|
|
12103
12416
|
{
|
|
12104
12417
|
className,
|
|
@@ -12112,15 +12425,15 @@ function ToolCallCopyButton({
|
|
|
12112
12425
|
className
|
|
12113
12426
|
}) {
|
|
12114
12427
|
const { t } = useChatkitTranslation();
|
|
12115
|
-
const [isCopied, setIsCopied] =
|
|
12116
|
-
const resetTimeoutRef =
|
|
12117
|
-
const clearResetTimeout =
|
|
12428
|
+
const [isCopied, setIsCopied] = React35.useState(false);
|
|
12429
|
+
const resetTimeoutRef = React35.useRef(null);
|
|
12430
|
+
const clearResetTimeout = React35.useCallback(() => {
|
|
12118
12431
|
if (resetTimeoutRef.current === null) return;
|
|
12119
12432
|
window.clearTimeout(resetTimeoutRef.current);
|
|
12120
12433
|
resetTimeoutRef.current = null;
|
|
12121
12434
|
}, []);
|
|
12122
|
-
|
|
12123
|
-
const handleCopy =
|
|
12435
|
+
React35.useEffect(() => clearResetTimeout, [clearResetTimeout]);
|
|
12436
|
+
const handleCopy = React35.useCallback(() => {
|
|
12124
12437
|
if (typeof navigator === "undefined" || !navigator.clipboard) return;
|
|
12125
12438
|
void navigator.clipboard.writeText(value).then(() => {
|
|
12126
12439
|
setIsCopied(true);
|
|
@@ -12132,7 +12445,7 @@ function ToolCallCopyButton({
|
|
|
12132
12445
|
}).catch(() => void 0);
|
|
12133
12446
|
}, [clearResetTimeout, value]);
|
|
12134
12447
|
const label = isCopied ? t("message.toolGroup.copied") : t("message.toolGroup.copy");
|
|
12135
|
-
return /* @__PURE__ */
|
|
12448
|
+
return /* @__PURE__ */ jsx40(
|
|
12136
12449
|
"button",
|
|
12137
12450
|
{
|
|
12138
12451
|
type: "button",
|
|
@@ -12143,7 +12456,7 @@ function ToolCallCopyButton({
|
|
|
12143
12456
|
"aria-label": label,
|
|
12144
12457
|
title: label,
|
|
12145
12458
|
onClick: handleCopy,
|
|
12146
|
-
children: isCopied ? /* @__PURE__ */
|
|
12459
|
+
children: isCopied ? /* @__PURE__ */ jsx40(Check4, { className: "h-3.5 w-3.5", "aria-hidden": "true" }) : /* @__PURE__ */ jsx40(Copy2, { className: "h-3.5 w-3.5", "aria-hidden": "true" })
|
|
12147
12460
|
}
|
|
12148
12461
|
);
|
|
12149
12462
|
}
|
|
@@ -12154,69 +12467,89 @@ function ToolCallValueBlock({
|
|
|
12154
12467
|
const { t } = useChatkitTranslation();
|
|
12155
12468
|
const detected = detectJsonValue(value);
|
|
12156
12469
|
if (detected.kind === "text") {
|
|
12157
|
-
return /* @__PURE__ */
|
|
12158
|
-
/* @__PURE__ */
|
|
12159
|
-
/* @__PURE__ */
|
|
12470
|
+
return /* @__PURE__ */ jsxs27("div", { className: "min-w-0 space-y-1", children: [
|
|
12471
|
+
/* @__PURE__ */ jsx40("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx40(ToolCallCopyButton, { value: detected.text }) }),
|
|
12472
|
+
/* @__PURE__ */ jsx40(PlainTextBlock, { value: detected.text, destructive })
|
|
12160
12473
|
] });
|
|
12161
12474
|
}
|
|
12162
|
-
return /* @__PURE__ */
|
|
12163
|
-
/* @__PURE__ */
|
|
12164
|
-
/* @__PURE__ */
|
|
12475
|
+
return /* @__PURE__ */ jsxs27(Tabs, { defaultValue: "tree", className: "min-w-0", children: [
|
|
12476
|
+
/* @__PURE__ */ jsxs27("div", { className: "mb-2 flex min-w-0 items-center justify-between gap-2", children: [
|
|
12477
|
+
/* @__PURE__ */ jsxs27("span", { className: "min-w-0 truncate text-[11px] text-muted-foreground", children: [
|
|
12165
12478
|
t("message.toolGroup.jsonTitle"),
|
|
12166
|
-
" \xB7
|
|
12479
|
+
" \xB7",
|
|
12480
|
+
" ",
|
|
12167
12481
|
getJsonValueSummary(detected.value)
|
|
12168
12482
|
] }),
|
|
12169
|
-
/* @__PURE__ */
|
|
12170
|
-
/* @__PURE__ */
|
|
12171
|
-
/* @__PURE__ */
|
|
12172
|
-
/* @__PURE__ */
|
|
12173
|
-
/* @__PURE__ */
|
|
12483
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
12484
|
+
/* @__PURE__ */ jsx40(ToolCallCopyButton, { value: detected.raw }),
|
|
12485
|
+
/* @__PURE__ */ jsxs27(TabsList, { className: "rounded-md p-0.5", children: [
|
|
12486
|
+
/* @__PURE__ */ jsx40(TabsTrigger, { className: "px-2 py-0.5 text-[11px]", value: "tree", children: t("message.toolGroup.jsonTree") }),
|
|
12487
|
+
/* @__PURE__ */ jsx40(TabsTrigger, { className: "px-2 py-0.5 text-[11px]", value: "raw", children: t("message.toolGroup.jsonRaw") })
|
|
12174
12488
|
] })
|
|
12175
12489
|
] })
|
|
12176
12490
|
] }),
|
|
12177
|
-
/* @__PURE__ */
|
|
12178
|
-
/* @__PURE__ */
|
|
12491
|
+
/* @__PURE__ */ jsx40(TabsContent, { value: "tree", className: "mt-0", children: /* @__PURE__ */ jsx40(JsonTreeView, { value: detected.value }) }),
|
|
12492
|
+
/* @__PURE__ */ jsx40(TabsContent, { value: "raw", className: "mt-0", children: /* @__PURE__ */ jsx40(RawJsonBlock, { raw: detected.raw }) })
|
|
12179
12493
|
] });
|
|
12180
12494
|
}
|
|
12181
|
-
function DefaultToolCallOutput({
|
|
12495
|
+
function DefaultToolCallOutput({
|
|
12496
|
+
content,
|
|
12497
|
+
data
|
|
12498
|
+
}) {
|
|
12182
12499
|
const { t } = useChatkitTranslation();
|
|
12183
|
-
const
|
|
12500
|
+
const presentation = parseToolOutputPresentation(data.artifact);
|
|
12501
|
+
const output = data.output ?? (presentation ? null : data.artifact) ?? null;
|
|
12184
12502
|
const error = data.error ?? null;
|
|
12185
12503
|
if (error) {
|
|
12186
|
-
return /* @__PURE__ */
|
|
12187
|
-
/* @__PURE__ */
|
|
12188
|
-
/* @__PURE__ */
|
|
12504
|
+
return /* @__PURE__ */ jsxs27("div", { className: "space-y-1", children: [
|
|
12505
|
+
/* @__PURE__ */ jsx40("div", { className: "text-[11px] font-medium text-destructive", children: t("message.toolGroup.errorTitle") }),
|
|
12506
|
+
/* @__PURE__ */ jsx40(ToolCallValueBlock, { value: error, destructive: true })
|
|
12189
12507
|
] });
|
|
12190
12508
|
}
|
|
12191
|
-
if (output === null) return null;
|
|
12192
|
-
return /* @__PURE__ */
|
|
12193
|
-
/* @__PURE__ */
|
|
12194
|
-
/* @__PURE__ */
|
|
12509
|
+
if (output === null && !presentation) return null;
|
|
12510
|
+
return /* @__PURE__ */ jsxs27("div", { className: "space-y-2", children: [
|
|
12511
|
+
/* @__PURE__ */ jsx40("div", { className: "text-[11px] font-medium text-muted-foreground", children: t("message.toolGroup.outputTitle") }),
|
|
12512
|
+
presentation ? /* @__PURE__ */ jsx40(
|
|
12513
|
+
ToolOutputAttachments,
|
|
12514
|
+
{
|
|
12515
|
+
presentation,
|
|
12516
|
+
toolCallId: content.id,
|
|
12517
|
+
executionId: content.executionId
|
|
12518
|
+
}
|
|
12519
|
+
) : null,
|
|
12520
|
+
output !== null ? /* @__PURE__ */ jsx40(ToolCallValueBlock, { value: output }) : null
|
|
12195
12521
|
] });
|
|
12196
12522
|
}
|
|
12197
12523
|
function ToolCallDetails({ content }) {
|
|
12198
|
-
const { t } = useChatkitTranslation();
|
|
12524
|
+
const { i18n: i18n2, t } = useChatkitTranslation();
|
|
12199
12525
|
const data = getToolStepData(content);
|
|
12200
12526
|
if (isSandboxShellStep(data)) {
|
|
12201
|
-
return /* @__PURE__ */
|
|
12527
|
+
return /* @__PURE__ */ jsx40("div", { className: "ml-2 mt-1", children: /* @__PURE__ */ jsx40(SandboxShellToolCallCard, { data }) });
|
|
12202
12528
|
}
|
|
12203
12529
|
const renderer = getComponentMessageRenderer(content, data);
|
|
12204
12530
|
const hasCustomDetails = data.error === void 0 && hasComponentMessageRendererDetails(renderer, content, data);
|
|
12205
12531
|
const CustomDetailsRenderer = hasCustomDetails ? renderer?.renderDetails : void 0;
|
|
12206
12532
|
if (CustomDetailsRenderer) {
|
|
12207
|
-
return /* @__PURE__ */
|
|
12533
|
+
return /* @__PURE__ */ jsx40("div", { className: "ml-6 mt-1 max-h-60 overflow-auto rounded-md bg-muted/30 text-xs text-muted-foreground", children: /* @__PURE__ */ jsx40(CustomDetailsRenderer, { content, data }) });
|
|
12208
12534
|
}
|
|
12209
12535
|
const OutputRenderer = getToolCallOutputRenderer(data);
|
|
12536
|
+
const toolName = resolveLocalizedText(data.tool, i18n2.language);
|
|
12210
12537
|
const hasInput = data.input !== void 0 && data.input !== null;
|
|
12211
|
-
const hasOutput = data.error !== void 0 || data.output !== void 0;
|
|
12538
|
+
const hasOutput = data.error !== void 0 || data.output !== void 0 || data.artifact !== void 0;
|
|
12212
12539
|
if (!hasInput && !hasOutput) return null;
|
|
12213
|
-
return /* @__PURE__ */
|
|
12214
|
-
hasInput && /* @__PURE__ */
|
|
12215
|
-
/* @__PURE__ */
|
|
12216
|
-
|
|
12540
|
+
return /* @__PURE__ */ jsxs27("div", { className: "ml-6 mt-1 max-h-60 overflow-auto rounded-md bg-muted/30 px-3 py-2 text-xs text-muted-foreground", children: [
|
|
12541
|
+
hasInput && /* @__PURE__ */ jsxs27("div", { className: "space-y-1", children: [
|
|
12542
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex min-w-0 items-baseline gap-1 text-[11px] font-medium text-muted-foreground", children: [
|
|
12543
|
+
toolName ? /* @__PURE__ */ jsxs27(Fragment7, { children: [
|
|
12544
|
+
/* @__PURE__ */ jsx40("span", { className: "min-w-0 break-all font-mono text-foreground/80", children: toolName }),
|
|
12545
|
+
/* @__PURE__ */ jsx40("span", { "aria-hidden": "true", children: "\xB7" })
|
|
12546
|
+
] }) : null,
|
|
12547
|
+
/* @__PURE__ */ jsx40("span", { className: "shrink-0", children: t("message.toolGroup.inputTitle") })
|
|
12548
|
+
] }),
|
|
12549
|
+
/* @__PURE__ */ jsx40(ToolCallValueBlock, { value: data.input })
|
|
12217
12550
|
] }),
|
|
12218
|
-
hasInput && hasOutput ? /* @__PURE__ */
|
|
12219
|
-
hasOutput ? /* @__PURE__ */
|
|
12551
|
+
hasInput && hasOutput ? /* @__PURE__ */ jsx40("div", { className: "h-2" }) : null,
|
|
12552
|
+
hasOutput ? /* @__PURE__ */ jsx40(OutputRenderer, { content, data }) : null
|
|
12220
12553
|
] });
|
|
12221
12554
|
}
|
|
12222
12555
|
function areToolCallRowPropsEqual(previous, next) {
|
|
@@ -12233,11 +12566,11 @@ function ToolCallRowContent({
|
|
|
12233
12566
|
const status = getEffectiveToolStepStatus(data, isThreadRunning);
|
|
12234
12567
|
const hasError = status === "fail" || Boolean(data.error);
|
|
12235
12568
|
const isSandboxShell = isSandboxShellStep(data);
|
|
12236
|
-
const detailsId =
|
|
12569
|
+
const detailsId = React35.useId();
|
|
12237
12570
|
const renderer = getComponentMessageRenderer(content, data);
|
|
12238
12571
|
const label = isSandboxShell ? getSandboxShellActivityLabel(data, status, i18n2.language, t) : renderer?.getTitle?.(content, data, i18n2.language) ?? getToolActivityLabel(content, i18n2.language, status);
|
|
12239
12572
|
const hasCustomDetails = data.error === void 0 && hasComponentMessageRendererDetails(renderer, content, data);
|
|
12240
|
-
const hasDetails = isSandboxShell || data.input !== void 0 || data.error !== void 0 || data.output !== void 0 || hasCustomDetails;
|
|
12573
|
+
const hasDetails = isSandboxShell || data.input !== void 0 || data.error !== void 0 || data.output !== void 0 || data.artifact !== void 0 || hasCustomDetails;
|
|
12241
12574
|
const fallbackEndedAt = useFrozenTimestamp(
|
|
12242
12575
|
data.status === "running" && status === "fail"
|
|
12243
12576
|
);
|
|
@@ -12245,14 +12578,14 @@ function ToolCallRowContent({
|
|
|
12245
12578
|
status,
|
|
12246
12579
|
fallbackEndedAt
|
|
12247
12580
|
});
|
|
12248
|
-
const [isExpanded, setIsExpanded] =
|
|
12249
|
-
|
|
12250
|
-
if (status === "running" && data.output !== void 0) {
|
|
12581
|
+
const [isExpanded, setIsExpanded] = React35.useState(false);
|
|
12582
|
+
React35.useEffect(() => {
|
|
12583
|
+
if (status === "running" && (data.output !== void 0 || data.artifact !== void 0)) {
|
|
12251
12584
|
setIsExpanded(true);
|
|
12252
12585
|
}
|
|
12253
|
-
}, [data.output, status]);
|
|
12254
|
-
return /* @__PURE__ */
|
|
12255
|
-
/* @__PURE__ */
|
|
12586
|
+
}, [data.artifact, data.output, status]);
|
|
12587
|
+
return /* @__PURE__ */ jsxs27("li", { className: "ck-tool-call-row-enter min-w-0", children: [
|
|
12588
|
+
/* @__PURE__ */ jsxs27(
|
|
12256
12589
|
"button",
|
|
12257
12590
|
{
|
|
12258
12591
|
type: "button",
|
|
@@ -12269,7 +12602,7 @@ function ToolCallRowContent({
|
|
|
12269
12602
|
if (hasDetails) setIsExpanded((prev) => !prev);
|
|
12270
12603
|
},
|
|
12271
12604
|
children: [
|
|
12272
|
-
status ? /* @__PURE__ */
|
|
12605
|
+
status ? /* @__PURE__ */ jsx40(
|
|
12273
12606
|
ToolStepIcon,
|
|
12274
12607
|
{
|
|
12275
12608
|
data,
|
|
@@ -12280,8 +12613,8 @@ function ToolCallRowContent({
|
|
|
12280
12613
|
hasError && !isSandboxShell ? "text-destructive" : "text-muted-foreground"
|
|
12281
12614
|
)
|
|
12282
12615
|
}
|
|
12283
|
-
) : /* @__PURE__ */
|
|
12284
|
-
/* @__PURE__ */
|
|
12616
|
+
) : /* @__PURE__ */ jsx40("span", { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": "true" }),
|
|
12617
|
+
/* @__PURE__ */ jsx40(
|
|
12285
12618
|
"span",
|
|
12286
12619
|
{
|
|
12287
12620
|
className: cn(
|
|
@@ -12292,8 +12625,8 @@ function ToolCallRowContent({
|
|
|
12292
12625
|
children: label
|
|
12293
12626
|
}
|
|
12294
12627
|
),
|
|
12295
|
-
durationLabel ? /* @__PURE__ */
|
|
12296
|
-
hasDetails ? /* @__PURE__ */
|
|
12628
|
+
durationLabel ? /* @__PURE__ */ jsx40("span", { className: "shrink-0 text-[11px] tabular-nums text-muted-foreground/80", children: durationLabel }) : null,
|
|
12629
|
+
hasDetails ? /* @__PURE__ */ jsx40(
|
|
12297
12630
|
ChevronRight7,
|
|
12298
12631
|
{
|
|
12299
12632
|
"aria-hidden": "true",
|
|
@@ -12306,10 +12639,10 @@ function ToolCallRowContent({
|
|
|
12306
12639
|
]
|
|
12307
12640
|
}
|
|
12308
12641
|
),
|
|
12309
|
-
hasDetails && isExpanded ? /* @__PURE__ */
|
|
12642
|
+
hasDetails && isExpanded ? /* @__PURE__ */ jsx40("div", { id: detailsId, children: /* @__PURE__ */ jsx40(ToolCallDetails, { content }) }) : null
|
|
12310
12643
|
] });
|
|
12311
12644
|
}
|
|
12312
|
-
var ToolCallRow =
|
|
12645
|
+
var ToolCallRow = React35.memo(ToolCallRowContent, areToolCallRowPropsEqual);
|
|
12313
12646
|
ToolCallRow.displayName = "ToolCallRow";
|
|
12314
12647
|
function ToolComponentGroup({
|
|
12315
12648
|
items,
|
|
@@ -12319,8 +12652,8 @@ function ToolComponentGroup({
|
|
|
12319
12652
|
apiUrl
|
|
12320
12653
|
}) {
|
|
12321
12654
|
const { t } = useChatkitTranslation();
|
|
12322
|
-
const contentId =
|
|
12323
|
-
const [isExpanded, setIsExpanded] =
|
|
12655
|
+
const contentId = React35.useId();
|
|
12656
|
+
const [isExpanded, setIsExpanded] = React35.useState(!hasFollowingItem);
|
|
12324
12657
|
const categoryCounts = getToolGroupCategoryCounts(items);
|
|
12325
12658
|
const categorySummary = TOOL_GROUP_CATEGORY_ORDER.flatMap((category) => {
|
|
12326
12659
|
const count = categoryCounts[category] ?? 0;
|
|
@@ -12335,11 +12668,11 @@ function ToolComponentGroup({
|
|
|
12335
12668
|
const summary = `${t("message.toolGroup.status.success")} ${categorySummary}`;
|
|
12336
12669
|
const config = toolStatusConfig.success;
|
|
12337
12670
|
const StatusIcon = config.icon;
|
|
12338
|
-
|
|
12671
|
+
React35.useEffect(() => {
|
|
12339
12672
|
setIsExpanded(!hasFollowingItem);
|
|
12340
12673
|
}, [hasFollowingItem]);
|
|
12341
|
-
return /* @__PURE__ */
|
|
12342
|
-
/* @__PURE__ */
|
|
12674
|
+
return /* @__PURE__ */ jsxs27("div", { className: "px-1 py-1", children: [
|
|
12675
|
+
/* @__PURE__ */ jsxs27(
|
|
12343
12676
|
"button",
|
|
12344
12677
|
{
|
|
12345
12678
|
type: "button",
|
|
@@ -12348,19 +12681,11 @@ function ToolComponentGroup({
|
|
|
12348
12681
|
"aria-controls": contentId,
|
|
12349
12682
|
onClick: () => setIsExpanded((prev) => !prev),
|
|
12350
12683
|
children: [
|
|
12351
|
-
/* @__PURE__ */
|
|
12352
|
-
/* @__PURE__ */
|
|
12353
|
-
|
|
12354
|
-
{
|
|
12355
|
-
className: cn(
|
|
12356
|
-
"h-4 w-4 shrink-0",
|
|
12357
|
-
config.iconClass
|
|
12358
|
-
)
|
|
12359
|
-
}
|
|
12360
|
-
),
|
|
12361
|
-
/* @__PURE__ */ jsx39("span", { className: "truncate", children: summary })
|
|
12684
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex min-w-0 items-center gap-2 text-sm font-medium text-muted-foreground", children: [
|
|
12685
|
+
/* @__PURE__ */ jsx40(StatusIcon, { className: cn("h-4 w-4 shrink-0", config.iconClass) }),
|
|
12686
|
+
/* @__PURE__ */ jsx40("span", { className: "truncate", children: summary })
|
|
12362
12687
|
] }),
|
|
12363
|
-
/* @__PURE__ */
|
|
12688
|
+
/* @__PURE__ */ jsx40(
|
|
12364
12689
|
ChevronRight7,
|
|
12365
12690
|
{
|
|
12366
12691
|
"aria-hidden": "true",
|
|
@@ -12373,7 +12698,7 @@ function ToolComponentGroup({
|
|
|
12373
12698
|
]
|
|
12374
12699
|
}
|
|
12375
12700
|
),
|
|
12376
|
-
isExpanded && /* @__PURE__ */
|
|
12701
|
+
isExpanded && /* @__PURE__ */ jsx40("ul", { id: contentId, className: "mt-2 space-y-1.5 overflow-y-auto pr-1", children: items.map((item, index) => /* @__PURE__ */ jsx40(
|
|
12377
12702
|
ToolCallRow,
|
|
12378
12703
|
{
|
|
12379
12704
|
content: item,
|
|
@@ -12393,7 +12718,7 @@ import {
|
|
|
12393
12718
|
REQUEST_USER_INPUT_TOOL_NAME as REQUEST_USER_INPUT_TOOL_NAME2
|
|
12394
12719
|
} from "@xpert-ai/chatkit-types";
|
|
12395
12720
|
import { CheckCircle2 as CheckCircle24 } from "lucide-react";
|
|
12396
|
-
import { jsx as
|
|
12721
|
+
import { jsx as jsx41, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
12397
12722
|
function isRecord4(value) {
|
|
12398
12723
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
12399
12724
|
}
|
|
@@ -12505,7 +12830,7 @@ function RequestUserInputResultCard({
|
|
|
12505
12830
|
className
|
|
12506
12831
|
}) {
|
|
12507
12832
|
const { t } = useChatkitTranslation();
|
|
12508
|
-
return /* @__PURE__ */
|
|
12833
|
+
return /* @__PURE__ */ jsxs28(
|
|
12509
12834
|
"section",
|
|
12510
12835
|
{
|
|
12511
12836
|
"aria-label": t("message.requestUserInputResult.title"),
|
|
@@ -12514,23 +12839,23 @@ function RequestUserInputResultCard({
|
|
|
12514
12839
|
className
|
|
12515
12840
|
),
|
|
12516
12841
|
children: [
|
|
12517
|
-
/* @__PURE__ */
|
|
12518
|
-
/* @__PURE__ */
|
|
12519
|
-
/* @__PURE__ */
|
|
12842
|
+
/* @__PURE__ */ jsxs28("div", { className: "mb-2 flex items-center gap-2 text-sm font-semibold text-foreground", children: [
|
|
12843
|
+
/* @__PURE__ */ jsx41(CheckCircle24, { className: "h-4 w-4 text-primary" }),
|
|
12844
|
+
/* @__PURE__ */ jsx41("span", { children: t("message.requestUserInputResult.title") })
|
|
12520
12845
|
] }),
|
|
12521
|
-
/* @__PURE__ */
|
|
12846
|
+
/* @__PURE__ */ jsx41("div", { className: "space-y-2", children: result.answers.map((answer, index) => /* @__PURE__ */ jsxs28(
|
|
12522
12847
|
"div",
|
|
12523
12848
|
{
|
|
12524
12849
|
className: "rounded-md bg-background/70 px-2.5 py-2",
|
|
12525
12850
|
children: [
|
|
12526
|
-
/* @__PURE__ */
|
|
12527
|
-
/* @__PURE__ */
|
|
12528
|
-
/* @__PURE__ */
|
|
12529
|
-
/* @__PURE__ */
|
|
12851
|
+
/* @__PURE__ */ jsx41("div", { className: "text-xs font-medium leading-5 text-muted-foreground", children: answer.question }),
|
|
12852
|
+
/* @__PURE__ */ jsxs28("div", { className: "mt-0.5 flex min-w-0 flex-wrap items-center gap-1.5", children: [
|
|
12853
|
+
/* @__PURE__ */ jsx41("span", { className: "min-w-0 wrap-break-word text-sm font-semibold text-foreground", children: answer.label ?? answer.value }),
|
|
12854
|
+
/* @__PURE__ */ jsx41("span", { className: "rounded-full bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground", children: t(
|
|
12530
12855
|
answer.type === "other" ? "message.requestUserInputResult.other" : "message.requestUserInputResult.option"
|
|
12531
12856
|
) })
|
|
12532
12857
|
] }),
|
|
12533
|
-
answer.description ? /* @__PURE__ */
|
|
12858
|
+
answer.description ? /* @__PURE__ */ jsx41("div", { className: "mt-1 text-xs leading-5 text-muted-foreground", children: answer.description }) : null
|
|
12534
12859
|
]
|
|
12535
12860
|
},
|
|
12536
12861
|
`${answer.id}-${index}`
|
|
@@ -12541,23 +12866,23 @@ function RequestUserInputResultCard({
|
|
|
12541
12866
|
}
|
|
12542
12867
|
|
|
12543
12868
|
// src/components/thread/messages/widget.tsx
|
|
12544
|
-
import { useEffect as
|
|
12869
|
+
import { useEffect as useEffect18, useMemo as useMemo13, useState as useState20 } from "react";
|
|
12545
12870
|
import {
|
|
12546
12871
|
A2UIRenderer,
|
|
12547
12872
|
SurfaceRenderer,
|
|
12548
12873
|
useA2UI
|
|
12549
12874
|
} from "@xpert-ai/a2ui-react";
|
|
12550
|
-
import { jsx as
|
|
12875
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
12551
12876
|
function WidgetMessage({ messageId, data }) {
|
|
12552
12877
|
const widgets = Array.isArray(data.widgets) ? data.widgets : [];
|
|
12553
12878
|
if (widgets.length === 0) return null;
|
|
12554
12879
|
const baseSurfaceId = `widget-${messageId}`;
|
|
12555
|
-
return /* @__PURE__ */
|
|
12880
|
+
return /* @__PURE__ */ jsx42("div", { className: "space-y-3", children: widgets.map((widget, index) => {
|
|
12556
12881
|
const config = widget?.config;
|
|
12557
12882
|
const messages = Array.isArray(widget?.messages) ? widget.messages : [];
|
|
12558
12883
|
const surfaceId = widgets.length > 1 ? `${baseSurfaceId}-${index}` : baseSurfaceId;
|
|
12559
12884
|
if (messages.length > 0) {
|
|
12560
|
-
return /* @__PURE__ */
|
|
12885
|
+
return /* @__PURE__ */ jsx42(
|
|
12561
12886
|
FlatWidgetSurface,
|
|
12562
12887
|
{
|
|
12563
12888
|
messages,
|
|
@@ -12569,7 +12894,7 @@ function WidgetMessage({ messageId, data }) {
|
|
|
12569
12894
|
if (!hasLegacySurface(config)) {
|
|
12570
12895
|
return null;
|
|
12571
12896
|
}
|
|
12572
|
-
return /* @__PURE__ */
|
|
12897
|
+
return /* @__PURE__ */ jsx42(
|
|
12573
12898
|
SurfaceRenderer,
|
|
12574
12899
|
{
|
|
12575
12900
|
surfaceId,
|
|
@@ -12584,12 +12909,12 @@ function FlatWidgetSurface({
|
|
|
12584
12909
|
surfaceId
|
|
12585
12910
|
}) {
|
|
12586
12911
|
const { processMessages } = useA2UI();
|
|
12587
|
-
const [renderError, setRenderError] =
|
|
12588
|
-
const normalizedMessages =
|
|
12912
|
+
const [renderError, setRenderError] = useState20(false);
|
|
12913
|
+
const normalizedMessages = useMemo13(
|
|
12589
12914
|
() => normalizeFlatWidgetMessages(messages, surfaceId),
|
|
12590
12915
|
[messages, surfaceId]
|
|
12591
12916
|
);
|
|
12592
|
-
|
|
12917
|
+
useEffect18(() => {
|
|
12593
12918
|
if (normalizedMessages.length === 0) return;
|
|
12594
12919
|
setRenderError(false);
|
|
12595
12920
|
try {
|
|
@@ -12607,12 +12932,12 @@ function FlatWidgetSurface({
|
|
|
12607
12932
|
};
|
|
12608
12933
|
}, [normalizedMessages, processMessages, surfaceId]);
|
|
12609
12934
|
if (renderError) {
|
|
12610
|
-
return /* @__PURE__ */
|
|
12935
|
+
return /* @__PURE__ */ jsx42(WidgetRenderErrorFallback, {});
|
|
12611
12936
|
}
|
|
12612
|
-
return /* @__PURE__ */
|
|
12937
|
+
return /* @__PURE__ */ jsx42(A2UIRenderer, { surfaceId });
|
|
12613
12938
|
}
|
|
12614
12939
|
function WidgetRenderErrorFallback() {
|
|
12615
|
-
return /* @__PURE__ */
|
|
12940
|
+
return /* @__PURE__ */ jsx42(
|
|
12616
12941
|
"div",
|
|
12617
12942
|
{
|
|
12618
12943
|
role: "alert",
|
|
@@ -12882,12 +13207,12 @@ function hasLegacySurface(surface) {
|
|
|
12882
13207
|
}
|
|
12883
13208
|
|
|
12884
13209
|
// src/components/thread/messages/mcp-app.tsx
|
|
12885
|
-
import * as
|
|
13210
|
+
import * as React37 from "react";
|
|
12886
13211
|
import {
|
|
12887
13212
|
resolveLocalizedText as resolveLocalizedText3
|
|
12888
13213
|
} from "@xpert-ai/chatkit-types";
|
|
12889
|
-
import { AlertCircle as AlertCircle2, Loader2 as
|
|
12890
|
-
import { jsx as
|
|
13214
|
+
import { AlertCircle as AlertCircle2, Loader2 as Loader28 } from "lucide-react";
|
|
13215
|
+
import { jsx as jsx43, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
12891
13216
|
var EMPTY_INPUT_SCHEMA = {
|
|
12892
13217
|
type: "object",
|
|
12893
13218
|
properties: {}
|
|
@@ -13473,18 +13798,18 @@ function McpAppMessage({
|
|
|
13473
13798
|
isLoading: streamIsLoading,
|
|
13474
13799
|
submit
|
|
13475
13800
|
} = useStreamContext();
|
|
13476
|
-
const iframeRef =
|
|
13477
|
-
const containerRef =
|
|
13478
|
-
const initializedRef =
|
|
13479
|
-
const sentInitialResultRef =
|
|
13480
|
-
const modelContextRef =
|
|
13481
|
-
const [resource, setResource] =
|
|
13482
|
-
const [runtimeAppInstanceToken, setRuntimeAppInstanceToken] =
|
|
13483
|
-
const [srcDoc, setSrcDoc] =
|
|
13484
|
-
const [height, setHeight] =
|
|
13485
|
-
const [error, setError] =
|
|
13486
|
-
const [isLoading, setIsLoading] =
|
|
13487
|
-
const resourceUrl =
|
|
13801
|
+
const iframeRef = React37.useRef(null);
|
|
13802
|
+
const containerRef = React37.useRef(null);
|
|
13803
|
+
const initializedRef = React37.useRef(false);
|
|
13804
|
+
const sentInitialResultRef = React37.useRef(false);
|
|
13805
|
+
const modelContextRef = React37.useRef(null);
|
|
13806
|
+
const [resource, setResource] = React37.useState(null);
|
|
13807
|
+
const [runtimeAppInstanceToken, setRuntimeAppInstanceToken] = React37.useState(data.appInstanceToken);
|
|
13808
|
+
const [srcDoc, setSrcDoc] = React37.useState(null);
|
|
13809
|
+
const [height, setHeight] = React37.useState(420);
|
|
13810
|
+
const [error, setError] = React37.useState(null);
|
|
13811
|
+
const [isLoading, setIsLoading] = React37.useState(true);
|
|
13812
|
+
const resourceUrl = React37.useMemo(
|
|
13488
13813
|
() => buildXpertApiUrl(
|
|
13489
13814
|
apiUrl,
|
|
13490
13815
|
buildMcpAppEndpointPath(data, "resource", {
|
|
@@ -13493,7 +13818,7 @@ function McpAppMessage({
|
|
|
13493
13818
|
),
|
|
13494
13819
|
[apiUrl, data, messageId]
|
|
13495
13820
|
);
|
|
13496
|
-
const rpcUrl =
|
|
13821
|
+
const rpcUrl = React37.useMemo(
|
|
13497
13822
|
() => buildXpertApiUrl(
|
|
13498
13823
|
apiUrl,
|
|
13499
13824
|
buildMcpAppEndpointPath(data, "rpc", {
|
|
@@ -13503,10 +13828,10 @@ function McpAppMessage({
|
|
|
13503
13828
|
),
|
|
13504
13829
|
[apiUrl, data, messageId, runtimeAppInstanceToken]
|
|
13505
13830
|
);
|
|
13506
|
-
const postToApp =
|
|
13831
|
+
const postToApp = React37.useCallback((message) => {
|
|
13507
13832
|
iframeRef.current?.contentWindow?.postMessage(message, "*");
|
|
13508
13833
|
}, []);
|
|
13509
|
-
const callHostRpc =
|
|
13834
|
+
const callHostRpc = React37.useCallback(
|
|
13510
13835
|
async (request) => {
|
|
13511
13836
|
const response = await authenticatedFetch(rpcUrl, {
|
|
13512
13837
|
method: "POST",
|
|
@@ -13527,7 +13852,7 @@ function McpAppMessage({
|
|
|
13527
13852
|
},
|
|
13528
13853
|
[authenticatedFetch, rpcUrl]
|
|
13529
13854
|
);
|
|
13530
|
-
const sendInitialToolNotifications =
|
|
13855
|
+
const sendInitialToolNotifications = React37.useCallback(() => {
|
|
13531
13856
|
if (!initializedRef.current || sentInitialResultRef.current || !resource) {
|
|
13532
13857
|
return;
|
|
13533
13858
|
}
|
|
@@ -13554,7 +13879,7 @@ function McpAppMessage({
|
|
|
13554
13879
|
}
|
|
13555
13880
|
});
|
|
13556
13881
|
}, [data.toolCallId, data.toolName, postToApp, resource]);
|
|
13557
|
-
|
|
13882
|
+
React37.useEffect(() => {
|
|
13558
13883
|
const controller = new AbortController();
|
|
13559
13884
|
initializedRef.current = false;
|
|
13560
13885
|
sentInitialResultRef.current = false;
|
|
@@ -13612,10 +13937,10 @@ function McpAppMessage({
|
|
|
13612
13937
|
i18n2.language,
|
|
13613
13938
|
resourceUrl
|
|
13614
13939
|
]);
|
|
13615
|
-
|
|
13940
|
+
React37.useEffect(() => {
|
|
13616
13941
|
sendInitialToolNotifications();
|
|
13617
13942
|
}, [sendInitialToolNotifications]);
|
|
13618
|
-
|
|
13943
|
+
React37.useEffect(() => {
|
|
13619
13944
|
const handleMessage = async (event) => {
|
|
13620
13945
|
if (event.source !== iframeRef.current?.contentWindow) {
|
|
13621
13946
|
return;
|
|
@@ -13808,11 +14133,11 @@ function McpAppMessage({
|
|
|
13808
14133
|
submit
|
|
13809
14134
|
]);
|
|
13810
14135
|
const iframePermissions = resource?.permissions ?? data.permissions;
|
|
13811
|
-
const iframeAllow =
|
|
14136
|
+
const iframeAllow = React37.useMemo(
|
|
13812
14137
|
() => buildIframeAllow(iframePermissions),
|
|
13813
14138
|
[iframePermissions]
|
|
13814
14139
|
);
|
|
13815
|
-
const sandbox =
|
|
14140
|
+
const sandbox = React37.useMemo(() => buildSandboxAttribute(), []);
|
|
13816
14141
|
const prefersBorder = resource?.prefersBorder ?? data.prefersBorder ?? true;
|
|
13817
14142
|
const displayTitle = resolveLocalizedText3(resource?.title ?? data.title, i18n2.language) ?? data.toolName;
|
|
13818
14143
|
const displayDescription = resolveLocalizedText3(
|
|
@@ -13820,7 +14145,7 @@ function McpAppMessage({
|
|
|
13820
14145
|
i18n2.language
|
|
13821
14146
|
);
|
|
13822
14147
|
const displayIcon = resource?.icon ?? data.icon;
|
|
13823
|
-
return /* @__PURE__ */
|
|
14148
|
+
return /* @__PURE__ */ jsxs29(
|
|
13824
14149
|
"div",
|
|
13825
14150
|
{
|
|
13826
14151
|
ref: containerRef,
|
|
@@ -13830,9 +14155,9 @@ function McpAppMessage({
|
|
|
13830
14155
|
className
|
|
13831
14156
|
),
|
|
13832
14157
|
children: [
|
|
13833
|
-
/* @__PURE__ */
|
|
13834
|
-
/* @__PURE__ */
|
|
13835
|
-
displayIcon ? /* @__PURE__ */
|
|
14158
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex min-h-10 items-center justify-between gap-3 border-b px-3 py-2", children: [
|
|
14159
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
14160
|
+
displayIcon ? /* @__PURE__ */ jsx43(
|
|
13836
14161
|
IconDefinitionRenderer,
|
|
13837
14162
|
{
|
|
13838
14163
|
icon: displayIcon,
|
|
@@ -13841,20 +14166,20 @@ function McpAppMessage({
|
|
|
13841
14166
|
decorative: true
|
|
13842
14167
|
}
|
|
13843
14168
|
) : null,
|
|
13844
|
-
/* @__PURE__ */
|
|
13845
|
-
/* @__PURE__ */
|
|
13846
|
-
/* @__PURE__ */
|
|
14169
|
+
/* @__PURE__ */ jsxs29("div", { className: "min-w-0", children: [
|
|
14170
|
+
/* @__PURE__ */ jsx43("div", { className: "truncate text-sm font-medium", children: displayTitle }),
|
|
14171
|
+
/* @__PURE__ */ jsx43("div", { className: "truncate text-[11px] text-muted-foreground", children: displayDescription ?? data.resourceUri })
|
|
13847
14172
|
] })
|
|
13848
14173
|
] }),
|
|
13849
|
-
/* @__PURE__ */
|
|
14174
|
+
/* @__PURE__ */ jsx43(Badge, { variant: "secondary", className: "shrink-0 rounded-md", children: "MCP App" })
|
|
13850
14175
|
] }),
|
|
13851
|
-
isLoading ? /* @__PURE__ */
|
|
13852
|
-
/* @__PURE__ */
|
|
13853
|
-
/* @__PURE__ */
|
|
13854
|
-
] }) : error ? /* @__PURE__ */
|
|
13855
|
-
/* @__PURE__ */
|
|
13856
|
-
/* @__PURE__ */
|
|
13857
|
-
] }) : srcDoc ? /* @__PURE__ */
|
|
14176
|
+
isLoading ? /* @__PURE__ */ jsxs29("div", { className: "flex h-40 items-center justify-center gap-2 text-sm text-muted-foreground", children: [
|
|
14177
|
+
/* @__PURE__ */ jsx43(Loader28, { className: "h-4 w-4 animate-spin" }),
|
|
14178
|
+
/* @__PURE__ */ jsx43("span", { children: i18n2.t("message.mcpApp.loading") })
|
|
14179
|
+
] }) : error ? /* @__PURE__ */ jsxs29("div", { className: "flex h-40 items-center justify-center gap-2 px-4 text-sm text-destructive", children: [
|
|
14180
|
+
/* @__PURE__ */ jsx43(AlertCircle2, { className: "h-4 w-4 shrink-0" }),
|
|
14181
|
+
/* @__PURE__ */ jsx43("span", { className: "min-w-0 break-words", children: error })
|
|
14182
|
+
] }) : srcDoc ? /* @__PURE__ */ jsx43(
|
|
13858
14183
|
"iframe",
|
|
13859
14184
|
{
|
|
13860
14185
|
ref: iframeRef,
|
|
@@ -13873,7 +14198,7 @@ function McpAppMessage({
|
|
|
13873
14198
|
}
|
|
13874
14199
|
|
|
13875
14200
|
// src/components/thread/messages/ai.tsx
|
|
13876
|
-
import { jsx as
|
|
14201
|
+
import { jsx as jsx44, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
13877
14202
|
var assistantMessageStackClassName = "space-y-3 in-data-[density=compact]:space-y-2 in-data-[density=spacious]:space-y-4";
|
|
13878
14203
|
function isTextContent3(content) {
|
|
13879
14204
|
return content.type === "text";
|
|
@@ -13915,11 +14240,11 @@ function ReasoningBlock({
|
|
|
13915
14240
|
}) {
|
|
13916
14241
|
const blocks = reasoning.filter((item) => item.text?.trim());
|
|
13917
14242
|
if (blocks.length === 0) return null;
|
|
13918
|
-
return /* @__PURE__ */
|
|
14243
|
+
return /* @__PURE__ */ jsx44("div", { className: "space-y-2", children: blocks.map((item, index) => /* @__PURE__ */ jsx44(
|
|
13919
14244
|
"div",
|
|
13920
14245
|
{
|
|
13921
14246
|
className: "rounded-lg border bg-muted/40 p-3 text-xs text-muted-foreground",
|
|
13922
|
-
children: /* @__PURE__ */
|
|
14247
|
+
children: /* @__PURE__ */ jsx44("p", { className: "whitespace-pre-wrap wrap-break-word leading-relaxed", children: item.text })
|
|
13923
14248
|
},
|
|
13924
14249
|
item.id ?? `reasoning-${index}`
|
|
13925
14250
|
)) });
|
|
@@ -13927,12 +14252,12 @@ function ReasoningBlock({
|
|
|
13927
14252
|
function ImageBlock({ content }) {
|
|
13928
14253
|
const imageUrl = typeof content.image_url === "string" ? content.image_url : typeof content.image_url?.url === "string" ? content.image_url.url : null;
|
|
13929
14254
|
if (!imageUrl) {
|
|
13930
|
-
return /* @__PURE__ */
|
|
13931
|
-
/* @__PURE__ */
|
|
13932
|
-
/* @__PURE__ */
|
|
14255
|
+
return /* @__PURE__ */ jsxs30(Card, { children: [
|
|
14256
|
+
/* @__PURE__ */ jsx44(CardHeader, { className: "space-y-1", children: /* @__PURE__ */ jsx44(CardTitle, { className: "text-sm", children: "Image" }) }),
|
|
14257
|
+
/* @__PURE__ */ jsx44(CardContent, { className: "text-xs text-muted-foreground", children: safeJson3(content) })
|
|
13933
14258
|
] });
|
|
13934
14259
|
}
|
|
13935
|
-
return /* @__PURE__ */
|
|
14260
|
+
return /* @__PURE__ */ jsx44("figure", { className: "overflow-hidden rounded-lg border bg-background", children: /* @__PURE__ */ jsx44(
|
|
13936
14261
|
"img",
|
|
13937
14262
|
{
|
|
13938
14263
|
src: imageUrl,
|
|
@@ -13942,12 +14267,12 @@ function ImageBlock({ content }) {
|
|
|
13942
14267
|
) });
|
|
13943
14268
|
}
|
|
13944
14269
|
function MemoryBlock({ content }) {
|
|
13945
|
-
return /* @__PURE__ */
|
|
13946
|
-
/* @__PURE__ */
|
|
13947
|
-
/* @__PURE__ */
|
|
13948
|
-
/* @__PURE__ */
|
|
14270
|
+
return /* @__PURE__ */ jsxs30(Card, { children: [
|
|
14271
|
+
/* @__PURE__ */ jsxs30(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
14272
|
+
/* @__PURE__ */ jsx44(CardTitle, { className: "text-sm", children: "Memory" }),
|
|
14273
|
+
/* @__PURE__ */ jsx44(Badge, { variant: "secondary", children: "Memory" })
|
|
13949
14274
|
] }),
|
|
13950
|
-
/* @__PURE__ */
|
|
14275
|
+
/* @__PURE__ */ jsx44(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ jsx44("pre", { className: "whitespace-pre-wrap wrap-break-word", children: safeJson3(content.data ?? []) }) })
|
|
13951
14276
|
] });
|
|
13952
14277
|
}
|
|
13953
14278
|
function parseStepDate2(value) {
|
|
@@ -13981,11 +14306,11 @@ function formatStepDuration3(durationMs) {
|
|
|
13981
14306
|
}
|
|
13982
14307
|
function ComponentBlock({ content }) {
|
|
13983
14308
|
const { i18n: i18n2 } = useChatkitTranslation();
|
|
13984
|
-
const [isExpanded, setIsExpanded] =
|
|
13985
|
-
const contentRef =
|
|
13986
|
-
const shouldAutoScrollRef =
|
|
13987
|
-
const previousScrollTopRef =
|
|
13988
|
-
const [durationNow, setDurationNow] =
|
|
14309
|
+
const [isExpanded, setIsExpanded] = React38.useState(false);
|
|
14310
|
+
const contentRef = React38.useRef(null);
|
|
14311
|
+
const shouldAutoScrollRef = React38.useRef(true);
|
|
14312
|
+
const previousScrollTopRef = React38.useRef(0);
|
|
14313
|
+
const [durationNow, setDurationNow] = React38.useState(() => Date.now());
|
|
13989
14314
|
const data = getToolStepData(content);
|
|
13990
14315
|
const category = data.category ?? "Component";
|
|
13991
14316
|
const title = getToolActivityLabel(content, i18n2.language);
|
|
@@ -13999,10 +14324,10 @@ function ComponentBlock({ content }) {
|
|
|
13999
14324
|
const endedAt = parseStepDate2(data.end_date);
|
|
14000
14325
|
const durationMs = createdAt === null ? null : Math.max(0, (endedAt ?? durationNow) - createdAt);
|
|
14001
14326
|
const durationLabel = durationMs === null ? null : formatStepDuration3(durationMs);
|
|
14002
|
-
|
|
14327
|
+
React38.useEffect(() => {
|
|
14003
14328
|
if (status === "running" && output !== null) setIsExpanded(true);
|
|
14004
14329
|
}, [status, output]);
|
|
14005
|
-
|
|
14330
|
+
React38.useEffect(() => {
|
|
14006
14331
|
if (status !== "running" || createdAt === null || endedAt !== null) {
|
|
14007
14332
|
return;
|
|
14008
14333
|
}
|
|
@@ -14014,7 +14339,7 @@ function ComponentBlock({ content }) {
|
|
|
14014
14339
|
window.clearInterval(timer);
|
|
14015
14340
|
};
|
|
14016
14341
|
}, [createdAt, endedAt, status]);
|
|
14017
|
-
|
|
14342
|
+
React38.useEffect(() => {
|
|
14018
14343
|
const element = contentRef.current;
|
|
14019
14344
|
if (!element) return;
|
|
14020
14345
|
previousScrollTopRef.current = element.scrollTop;
|
|
@@ -14036,7 +14361,7 @@ function ComponentBlock({ content }) {
|
|
|
14036
14361
|
element.removeEventListener("scroll", updateAutoScrollState);
|
|
14037
14362
|
};
|
|
14038
14363
|
}, [isExpanded]);
|
|
14039
|
-
|
|
14364
|
+
React38.useEffect(() => {
|
|
14040
14365
|
if (status !== "running") {
|
|
14041
14366
|
shouldAutoScrollRef.current = true;
|
|
14042
14367
|
return;
|
|
@@ -14049,15 +14374,15 @@ function ComponentBlock({ content }) {
|
|
|
14049
14374
|
}, [isExpanded, output, status]);
|
|
14050
14375
|
const config = status ? toolStatusConfig[status] : null;
|
|
14051
14376
|
const StatusIcon = config?.icon;
|
|
14052
|
-
return /* @__PURE__ */
|
|
14053
|
-
/* @__PURE__ */
|
|
14377
|
+
return /* @__PURE__ */ jsxs30(Card, { children: [
|
|
14378
|
+
/* @__PURE__ */ jsxs30(
|
|
14054
14379
|
CardHeader,
|
|
14055
14380
|
{
|
|
14056
14381
|
className: "flex flex-row items-center justify-between gap-2 px-2 py-1 cursor-pointer",
|
|
14057
14382
|
onClick: () => setIsExpanded(!isExpanded),
|
|
14058
14383
|
children: [
|
|
14059
|
-
/* @__PURE__ */
|
|
14060
|
-
status && StatusIcon && /* @__PURE__ */
|
|
14384
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-center space-x-1 flex-1 min-w-0", children: [
|
|
14385
|
+
status && StatusIcon && /* @__PURE__ */ jsx44(
|
|
14061
14386
|
StatusIcon,
|
|
14062
14387
|
{
|
|
14063
14388
|
className: cn(
|
|
@@ -14067,20 +14392,20 @@ function ComponentBlock({ content }) {
|
|
|
14067
14392
|
)
|
|
14068
14393
|
}
|
|
14069
14394
|
),
|
|
14070
|
-
/* @__PURE__ */
|
|
14395
|
+
/* @__PURE__ */ jsx44(CardTitle, { className: "text-sm truncate", children: title })
|
|
14071
14396
|
] }),
|
|
14072
|
-
/* @__PURE__ */
|
|
14073
|
-
durationLabel && /* @__PURE__ */
|
|
14074
|
-
/* @__PURE__ */
|
|
14075
|
-
/* @__PURE__ */
|
|
14397
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex flex-wrap items-center gap-2 shrink-0", children: [
|
|
14398
|
+
durationLabel && /* @__PURE__ */ jsxs30("div", { className: "inline-flex items-center gap-1 text-[11px] text-muted-foreground tabular-nums", children: [
|
|
14399
|
+
/* @__PURE__ */ jsx44(Clock32, { className: "h-3 w-3" }),
|
|
14400
|
+
/* @__PURE__ */ jsx44("span", { children: durationLabel })
|
|
14076
14401
|
] }),
|
|
14077
|
-
/* @__PURE__ */
|
|
14078
|
-
/* @__PURE__ */
|
|
14402
|
+
/* @__PURE__ */ jsx44(Badge, { variant: "secondary", className: "rounded-lg px-1.5", children: category }),
|
|
14403
|
+
/* @__PURE__ */ jsx44(
|
|
14079
14404
|
"button",
|
|
14080
14405
|
{
|
|
14081
14406
|
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
14082
14407
|
"aria-label": isExpanded ? "Collapse" : "Expand",
|
|
14083
|
-
children: /* @__PURE__ */
|
|
14408
|
+
children: /* @__PURE__ */ jsx44(
|
|
14084
14409
|
ChevronDown4,
|
|
14085
14410
|
{
|
|
14086
14411
|
className: cn(
|
|
@@ -14095,53 +14420,53 @@ function ComponentBlock({ content }) {
|
|
|
14095
14420
|
]
|
|
14096
14421
|
}
|
|
14097
14422
|
),
|
|
14098
|
-
isExpanded && /* @__PURE__ */
|
|
14423
|
+
isExpanded && /* @__PURE__ */ jsxs30(
|
|
14099
14424
|
CardContent,
|
|
14100
14425
|
{
|
|
14101
14426
|
ref: contentRef,
|
|
14102
14427
|
className: "text-xs text-muted-foreground max-h-60 overflow-auto",
|
|
14103
14428
|
children: [
|
|
14104
|
-
data.input && /* @__PURE__ */
|
|
14105
|
-
error ? /* @__PURE__ */
|
|
14429
|
+
data.input && /* @__PURE__ */ jsx44("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue3(data.input) }),
|
|
14430
|
+
error ? /* @__PURE__ */ jsx44("pre", { className: "whitespace-pre-wrap wrap-break-word text-destructive", children: formatDisplayValue3(error) }) : hasOutput && /* @__PURE__ */ jsx44("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue3(fallback) })
|
|
14106
14431
|
]
|
|
14107
14432
|
}
|
|
14108
14433
|
)
|
|
14109
14434
|
] });
|
|
14110
14435
|
}
|
|
14111
14436
|
function UnknownBlock({ content }) {
|
|
14112
|
-
return /* @__PURE__ */
|
|
14113
|
-
/* @__PURE__ */
|
|
14114
|
-
/* @__PURE__ */
|
|
14115
|
-
/* @__PURE__ */
|
|
14437
|
+
return /* @__PURE__ */ jsxs30(Card, { children: [
|
|
14438
|
+
/* @__PURE__ */ jsxs30(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
14439
|
+
/* @__PURE__ */ jsx44(CardTitle, { className: "text-sm", children: "Assistant Content" }),
|
|
14440
|
+
/* @__PURE__ */ jsx44(Badge, { variant: "outline", children: content.type ?? "unknown" })
|
|
14116
14441
|
] }),
|
|
14117
|
-
/* @__PURE__ */
|
|
14442
|
+
/* @__PURE__ */ jsx44(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ jsx44("pre", { className: "whitespace-pre-wrap break-words", children: safeJson3(content) }) })
|
|
14118
14443
|
] });
|
|
14119
14444
|
}
|
|
14120
14445
|
function renderContentItem(content, index, message, lookupMessages, options) {
|
|
14121
14446
|
const messageId = message.id;
|
|
14122
14447
|
const textClassName = options?.isAgentOutput ? "text-sm [&_.markdown-content_p]:!leading-6" : void 0;
|
|
14123
14448
|
if (typeof content === "string") {
|
|
14124
|
-
return /* @__PURE__ */
|
|
14449
|
+
return /* @__PURE__ */ jsx44("div", { className: textClassName, children: /* @__PURE__ */ jsx44(MarkdownText, { children: content }) }, `text-${index}`);
|
|
14125
14450
|
}
|
|
14126
14451
|
if (isThreadContextUsageRenderArtifact(content)) {
|
|
14127
14452
|
return null;
|
|
14128
14453
|
}
|
|
14129
14454
|
if (isTextContent3(content)) {
|
|
14130
|
-
return /* @__PURE__ */
|
|
14455
|
+
return /* @__PURE__ */ jsx44("div", { className: textClassName, children: /* @__PURE__ */ jsx44(MarkdownText, { children: content.text }) }, content.id ?? `text-${index}`);
|
|
14131
14456
|
}
|
|
14132
14457
|
if (isReasoningContent3(content)) {
|
|
14133
|
-
return /* @__PURE__ */
|
|
14458
|
+
return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(ReasoningBlock, { reasoning: [content] }) }, content.id ?? `reasoning-${index}`);
|
|
14134
14459
|
}
|
|
14135
14460
|
if (isImageContent(content)) {
|
|
14136
|
-
return /* @__PURE__ */
|
|
14461
|
+
return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(ImageBlock, { content }) }, content.id ?? `image-${index}`);
|
|
14137
14462
|
}
|
|
14138
14463
|
if (isComponentContent3(content)) {
|
|
14139
14464
|
if (isContextCompressionComponent(content)) {
|
|
14140
|
-
return /* @__PURE__ */
|
|
14465
|
+
return /* @__PURE__ */ jsx44(
|
|
14141
14466
|
"div",
|
|
14142
14467
|
{
|
|
14143
14468
|
className: "w-full",
|
|
14144
|
-
children: /* @__PURE__ */
|
|
14469
|
+
children: /* @__PURE__ */ jsx44(ContextCompressionMessage, { content })
|
|
14145
14470
|
},
|
|
14146
14471
|
content.id ?? `context-compression-${index}`
|
|
14147
14472
|
);
|
|
@@ -14151,16 +14476,16 @@ function renderContentItem(content, index, message, lookupMessages, options) {
|
|
|
14151
14476
|
lookupMessages
|
|
14152
14477
|
);
|
|
14153
14478
|
if (requestUserInputResult) {
|
|
14154
|
-
return /* @__PURE__ */
|
|
14479
|
+
return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(RequestUserInputResultCard, { result: requestUserInputResult }) }, content.id ?? `request-user-input-result-${index}`);
|
|
14155
14480
|
}
|
|
14156
14481
|
if (isWidgetComponent2(content)) {
|
|
14157
|
-
return /* @__PURE__ */
|
|
14482
|
+
return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(WidgetMessage, { messageId, data: content.data }) }, content.id ?? `widget-${index}`);
|
|
14158
14483
|
}
|
|
14159
14484
|
if (isMcpAppComponent(content)) {
|
|
14160
|
-
return /* @__PURE__ */
|
|
14485
|
+
return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(McpAppMessage, { messageId, data: content.data }) }, content.id ?? `mcp-app-${index}`);
|
|
14161
14486
|
}
|
|
14162
14487
|
if (getComponentMessagePresentation(content, getToolStepData(content)) === "grouped-step") {
|
|
14163
|
-
return /* @__PURE__ */
|
|
14488
|
+
return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(
|
|
14164
14489
|
ToolComponentGroup,
|
|
14165
14490
|
{
|
|
14166
14491
|
items: [content],
|
|
@@ -14171,15 +14496,15 @@ function renderContentItem(content, index, message, lookupMessages, options) {
|
|
|
14171
14496
|
}
|
|
14172
14497
|
) }, content.id ?? `component-group-${index}`);
|
|
14173
14498
|
}
|
|
14174
|
-
return /* @__PURE__ */
|
|
14499
|
+
return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(ComponentBlock, { content }) }, content.id ?? `component-${index}`);
|
|
14175
14500
|
}
|
|
14176
14501
|
if (isMemoryContent(content)) {
|
|
14177
|
-
return /* @__PURE__ */
|
|
14502
|
+
return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(MemoryBlock, { content }) }, content.id ?? `memory-${index}`);
|
|
14178
14503
|
}
|
|
14179
14504
|
if (isAgentEventContent(content)) {
|
|
14180
|
-
return /* @__PURE__ */
|
|
14505
|
+
return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(AgentEventRow, { content }) }, content.id ?? `agent-event-${index}`);
|
|
14181
14506
|
}
|
|
14182
|
-
return /* @__PURE__ */
|
|
14507
|
+
return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(UnknownBlock, { content }) }, content.id ?? `unknown-${index}`);
|
|
14183
14508
|
}
|
|
14184
14509
|
function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, options) {
|
|
14185
14510
|
if (unit.type === "item") {
|
|
@@ -14190,7 +14515,7 @@ function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, opti
|
|
|
14190
14515
|
isAgentOutput: options?.isAgentOutput
|
|
14191
14516
|
});
|
|
14192
14517
|
}
|
|
14193
|
-
return /* @__PURE__ */
|
|
14518
|
+
return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(
|
|
14194
14519
|
ToolComponentGroup,
|
|
14195
14520
|
{
|
|
14196
14521
|
items: unit.items,
|
|
@@ -14227,7 +14552,7 @@ function renderAssistantRenderUnits(units, message, lookupMessages, options, dep
|
|
|
14227
14552
|
const batch = entryBatch;
|
|
14228
14553
|
entryBatch = [];
|
|
14229
14554
|
rendered.push(
|
|
14230
|
-
/* @__PURE__ */
|
|
14555
|
+
/* @__PURE__ */ jsx44(React38.Fragment, { children: renderEntryBatch(batch, message, lookupMessages, hasFollowingItem, {
|
|
14231
14556
|
...options,
|
|
14232
14557
|
isAgentOutput: depth > 0
|
|
14233
14558
|
}) }, `entries-${batch[0]?.order ?? rendered.length}`)
|
|
@@ -14244,7 +14569,7 @@ function renderAssistantRenderUnits(units, message, lookupMessages, options, dep
|
|
|
14244
14569
|
}
|
|
14245
14570
|
flushEntries(true);
|
|
14246
14571
|
rendered.push(
|
|
14247
|
-
/* @__PURE__ */
|
|
14572
|
+
/* @__PURE__ */ jsx44(
|
|
14248
14573
|
AgentRunGroup,
|
|
14249
14574
|
{
|
|
14250
14575
|
node: unit.node,
|
|
@@ -14269,7 +14594,7 @@ function renderContent(message, lookupMessages, options) {
|
|
|
14269
14594
|
message
|
|
14270
14595
|
);
|
|
14271
14596
|
if (renderTree.hasAgentRuns) {
|
|
14272
|
-
return /* @__PURE__ */
|
|
14597
|
+
return /* @__PURE__ */ jsx44("div", { className: assistantMessageStackClassName, children: renderAssistantRenderUnits(
|
|
14273
14598
|
renderTree.units,
|
|
14274
14599
|
message,
|
|
14275
14600
|
lookupMessages,
|
|
@@ -14279,13 +14604,13 @@ function renderContent(message, lookupMessages, options) {
|
|
|
14279
14604
|
const content = message.content;
|
|
14280
14605
|
if (typeof content === "string") {
|
|
14281
14606
|
if (!content.trim()) return null;
|
|
14282
|
-
return /* @__PURE__ */
|
|
14607
|
+
return /* @__PURE__ */ jsx44(MarkdownText, { children: content });
|
|
14283
14608
|
}
|
|
14284
14609
|
if (!Array.isArray(content) || content.length === 0) return null;
|
|
14285
14610
|
const renderUnits = buildToolComponentRenderUnits(content, {
|
|
14286
14611
|
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null && !isMcpAppComponent(item)
|
|
14287
14612
|
});
|
|
14288
|
-
return /* @__PURE__ */
|
|
14613
|
+
return /* @__PURE__ */ jsx44("div", { className: "space-y-3", children: renderUnits.map(
|
|
14289
14614
|
(unit, index) => renderContentUnit(
|
|
14290
14615
|
unit,
|
|
14291
14616
|
message,
|
|
@@ -14305,7 +14630,7 @@ function AssistantStreamingIndicator({
|
|
|
14305
14630
|
thinking: t("message.thinking"),
|
|
14306
14631
|
answering: t("message.answering")
|
|
14307
14632
|
};
|
|
14308
|
-
return /* @__PURE__ */
|
|
14633
|
+
return /* @__PURE__ */ jsxs30(
|
|
14309
14634
|
"div",
|
|
14310
14635
|
{
|
|
14311
14636
|
className: cn(
|
|
@@ -14313,18 +14638,18 @@ function AssistantStreamingIndicator({
|
|
|
14313
14638
|
className
|
|
14314
14639
|
),
|
|
14315
14640
|
children: [
|
|
14316
|
-
status === "loading" && /* @__PURE__ */
|
|
14317
|
-
status === "thinking" && /* @__PURE__ */
|
|
14318
|
-
/* @__PURE__ */
|
|
14319
|
-
/* @__PURE__ */
|
|
14320
|
-
/* @__PURE__ */
|
|
14641
|
+
status === "loading" && /* @__PURE__ */ jsx44(Loader29, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
14642
|
+
status === "thinking" && /* @__PURE__ */ jsxs30("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
14643
|
+
/* @__PURE__ */ jsx44("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.3s]" }),
|
|
14644
|
+
/* @__PURE__ */ jsx44("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.15s]" }),
|
|
14645
|
+
/* @__PURE__ */ jsx44("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce" })
|
|
14321
14646
|
] }),
|
|
14322
|
-
status === "answering" && /* @__PURE__ */
|
|
14323
|
-
/* @__PURE__ */
|
|
14324
|
-
/* @__PURE__ */
|
|
14325
|
-
/* @__PURE__ */
|
|
14647
|
+
status === "answering" && /* @__PURE__ */ jsxs30("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
14648
|
+
/* @__PURE__ */ jsx44("span", { className: "h-2 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.25s]" }),
|
|
14649
|
+
/* @__PURE__ */ jsx44("span", { className: "h-3 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.1s]" }),
|
|
14650
|
+
/* @__PURE__ */ jsx44("span", { className: "h-2.5 w-0.5 rounded-full bg-current animate-pulse" })
|
|
14326
14651
|
] }),
|
|
14327
|
-
/* @__PURE__ */
|
|
14652
|
+
/* @__PURE__ */ jsx44("span", { children: labelMap[status] })
|
|
14328
14653
|
]
|
|
14329
14654
|
}
|
|
14330
14655
|
);
|
|
@@ -14350,56 +14675,56 @@ function AssistantMessage({
|
|
|
14350
14675
|
const resolvedStreamingStatus = streamingStatus ?? getAssistantStreamingStatus(message, isStreaming);
|
|
14351
14676
|
const lookupMessages = messages?.length ? messages : [message];
|
|
14352
14677
|
const inlinePetState = resolvedStreamingStatus ? getInlinePetState(resolvedStreamingStatus) : null;
|
|
14353
|
-
const inlinePet = inlinePetState ? /* @__PURE__ */
|
|
14678
|
+
const inlinePet = inlinePetState ? /* @__PURE__ */ jsx44(InlinePetStatus, { pet, state: inlinePetState }) : null;
|
|
14354
14679
|
const answerNode = renderContent(message, lookupMessages, {
|
|
14355
14680
|
isThreadRunning,
|
|
14356
14681
|
organizationId,
|
|
14357
14682
|
apiUrl
|
|
14358
14683
|
});
|
|
14359
|
-
const reasoningNode = hasReasoning ? /* @__PURE__ */
|
|
14684
|
+
const reasoningNode = hasReasoning ? /* @__PURE__ */ jsx44(ReasoningBlock, { reasoning: rootReasoning ?? [] }) : null;
|
|
14360
14685
|
if (!hasContent && !hasReasoning && !resolvedStreamingStatus) return null;
|
|
14361
14686
|
const streamingClass = isStreaming ? "streaming-active" : "";
|
|
14362
14687
|
if (!hasContent && !hasReasoning && resolvedStreamingStatus) {
|
|
14363
|
-
return /* @__PURE__ */
|
|
14688
|
+
return /* @__PURE__ */ jsx44("div", { className: cn("space-y-3", streamingClass, className), children: /* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-2", children: [
|
|
14364
14689
|
inlinePet,
|
|
14365
|
-
/* @__PURE__ */
|
|
14690
|
+
/* @__PURE__ */ jsx44(AssistantStreamingIndicator, { status: resolvedStreamingStatus })
|
|
14366
14691
|
] }) });
|
|
14367
14692
|
}
|
|
14368
14693
|
if (hasContent && hasReasoning) {
|
|
14369
|
-
return /* @__PURE__ */
|
|
14370
|
-
/* @__PURE__ */
|
|
14694
|
+
return /* @__PURE__ */ jsxs30("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
14695
|
+
/* @__PURE__ */ jsxs30(
|
|
14371
14696
|
Tabs,
|
|
14372
14697
|
{
|
|
14373
14698
|
defaultValue: message.status === "reasoning" ? "reasoning" : "answer",
|
|
14374
14699
|
className: "w-full",
|
|
14375
14700
|
children: [
|
|
14376
|
-
/* @__PURE__ */
|
|
14701
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-2", children: [
|
|
14377
14702
|
inlinePet,
|
|
14378
|
-
/* @__PURE__ */
|
|
14379
|
-
/* @__PURE__ */
|
|
14380
|
-
/* @__PURE__ */
|
|
14703
|
+
/* @__PURE__ */ jsxs30(TabsList, { className: "", children: [
|
|
14704
|
+
/* @__PURE__ */ jsx44(TabsTrigger, { value: "answer", children: t("message.answer") }),
|
|
14705
|
+
/* @__PURE__ */ jsx44(TabsTrigger, { value: "reasoning", children: t("message.reasoning") })
|
|
14381
14706
|
] })
|
|
14382
14707
|
] }),
|
|
14383
|
-
/* @__PURE__ */
|
|
14384
|
-
/* @__PURE__ */
|
|
14708
|
+
/* @__PURE__ */ jsx44(TabsContent, { value: "answer", className: "space-y-3", children: answerNode }),
|
|
14709
|
+
/* @__PURE__ */ jsx44(TabsContent, { value: "reasoning", className: "space-y-3", children: reasoningNode })
|
|
14385
14710
|
]
|
|
14386
14711
|
}
|
|
14387
14712
|
),
|
|
14388
|
-
resolvedStreamingStatus ? /* @__PURE__ */
|
|
14713
|
+
resolvedStreamingStatus ? /* @__PURE__ */ jsx44(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
14389
14714
|
] });
|
|
14390
14715
|
}
|
|
14391
|
-
return /* @__PURE__ */
|
|
14716
|
+
return /* @__PURE__ */ jsxs30("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
14392
14717
|
hasReasoning ? reasoningNode : answerNode,
|
|
14393
|
-
resolvedStreamingStatus ? /* @__PURE__ */
|
|
14718
|
+
resolvedStreamingStatus ? /* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-2", children: [
|
|
14394
14719
|
inlinePet,
|
|
14395
|
-
/* @__PURE__ */
|
|
14720
|
+
/* @__PURE__ */ jsx44(AssistantStreamingIndicator, { status: resolvedStreamingStatus })
|
|
14396
14721
|
] }) : null
|
|
14397
14722
|
] });
|
|
14398
14723
|
}
|
|
14399
14724
|
|
|
14400
14725
|
// src/components/thread/MessageNavigator.tsx
|
|
14401
|
-
import * as
|
|
14402
|
-
import { jsx as
|
|
14726
|
+
import * as React39 from "react";
|
|
14727
|
+
import { jsx as jsx45, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
14403
14728
|
var ACTIVE_OFFSET_PX = 12;
|
|
14404
14729
|
function getMarkerWidthClass(index, active, interactionIndex) {
|
|
14405
14730
|
if (interactionIndex >= 0) {
|
|
@@ -14446,17 +14771,17 @@ function MessageNavigator({
|
|
|
14446
14771
|
label,
|
|
14447
14772
|
tagsOverflowLabel
|
|
14448
14773
|
}) {
|
|
14449
|
-
const [hoveredId, setHoveredId] =
|
|
14450
|
-
const [focusedId, setFocusedId] =
|
|
14451
|
-
const [activeId, setActiveId] =
|
|
14452
|
-
const updateActiveItem =
|
|
14774
|
+
const [hoveredId, setHoveredId] = React39.useState(null);
|
|
14775
|
+
const [focusedId, setFocusedId] = React39.useState(null);
|
|
14776
|
+
const [activeId, setActiveId] = React39.useState(null);
|
|
14777
|
+
const updateActiveItem = React39.useCallback(() => {
|
|
14453
14778
|
const viewport = viewportRef.current;
|
|
14454
14779
|
setActiveId(resolveActiveItemId(items, viewport, getAnchor));
|
|
14455
14780
|
}, [getAnchor, items, viewportRef]);
|
|
14456
|
-
|
|
14781
|
+
React39.useLayoutEffect(() => {
|
|
14457
14782
|
updateActiveItem();
|
|
14458
14783
|
}, [updateActiveItem]);
|
|
14459
|
-
|
|
14784
|
+
React39.useEffect(() => {
|
|
14460
14785
|
const viewport = viewportRef.current;
|
|
14461
14786
|
if (!viewport) return;
|
|
14462
14787
|
let frame = null;
|
|
@@ -14480,7 +14805,7 @@ function MessageNavigator({
|
|
|
14480
14805
|
resizeObserver?.disconnect();
|
|
14481
14806
|
};
|
|
14482
14807
|
}, [updateActiveItem, viewportRef]);
|
|
14483
|
-
const handleNavigate =
|
|
14808
|
+
const handleNavigate = React39.useCallback(
|
|
14484
14809
|
(item) => {
|
|
14485
14810
|
const viewport = viewportRef.current;
|
|
14486
14811
|
const anchor = getAnchor(item);
|
|
@@ -14494,7 +14819,7 @@ function MessageNavigator({
|
|
|
14494
14819
|
if (items.length === 0) return null;
|
|
14495
14820
|
const interactionId = focusedId ?? hoveredId;
|
|
14496
14821
|
const interactionIndex = interactionId ? items.findIndex((item) => item.id === interactionId) : -1;
|
|
14497
|
-
return /* @__PURE__ */
|
|
14822
|
+
return /* @__PURE__ */ jsx45(
|
|
14498
14823
|
"nav",
|
|
14499
14824
|
{
|
|
14500
14825
|
"aria-label": label,
|
|
@@ -14503,11 +14828,11 @@ function MessageNavigator({
|
|
|
14503
14828
|
className
|
|
14504
14829
|
),
|
|
14505
14830
|
"data-slot": "chatkit-message-navigator",
|
|
14506
|
-
children: /* @__PURE__ */
|
|
14831
|
+
children: /* @__PURE__ */ jsx45("div", { className: "group/nav relative h-[calc(100vh-9rem)] w-12", children: /* @__PURE__ */ jsx45("div", { className: "absolute left-2 top-1/2 flex max-h-full w-10 -translate-y-1/2 flex-col gap-0.5 py-1", children: items.map((item, index) => {
|
|
14507
14832
|
const isActive = item.id === activeId;
|
|
14508
14833
|
const isPreviewed = item.id === hoveredId || item.id === focusedId;
|
|
14509
|
-
return /* @__PURE__ */
|
|
14510
|
-
/* @__PURE__ */
|
|
14834
|
+
return /* @__PURE__ */ jsxs31("div", { className: "relative h-3.5 w-10 shrink-0", children: [
|
|
14835
|
+
/* @__PURE__ */ jsx45(
|
|
14511
14836
|
"button",
|
|
14512
14837
|
{
|
|
14513
14838
|
type: "button",
|
|
@@ -14522,7 +14847,7 @@ function MessageNavigator({
|
|
|
14522
14847
|
onMouseLeave: () => setHoveredId((id) => id === item.id ? null : id),
|
|
14523
14848
|
onFocus: () => setFocusedId(item.id),
|
|
14524
14849
|
onBlur: () => setFocusedId((id) => id === item.id ? null : id),
|
|
14525
|
-
children: /* @__PURE__ */
|
|
14850
|
+
children: /* @__PURE__ */ jsx45(
|
|
14526
14851
|
"span",
|
|
14527
14852
|
{
|
|
14528
14853
|
className: cn(
|
|
@@ -14536,7 +14861,7 @@ function MessageNavigator({
|
|
|
14536
14861
|
)
|
|
14537
14862
|
}
|
|
14538
14863
|
),
|
|
14539
|
-
isPreviewed && /* @__PURE__ */
|
|
14864
|
+
isPreviewed && /* @__PURE__ */ jsxs31(
|
|
14540
14865
|
"div",
|
|
14541
14866
|
{
|
|
14542
14867
|
className: cn(
|
|
@@ -14544,10 +14869,10 @@ function MessageNavigator({
|
|
|
14544
14869
|
"rounded-lg border border-border bg-background/95 p-3 text-left shadow-xl backdrop-blur"
|
|
14545
14870
|
),
|
|
14546
14871
|
children: [
|
|
14547
|
-
/* @__PURE__ */
|
|
14548
|
-
/* @__PURE__ */
|
|
14549
|
-
item.tags.length > 0 && /* @__PURE__ */
|
|
14550
|
-
item.tags.slice(0, 3).map((tag) => /* @__PURE__ */
|
|
14872
|
+
/* @__PURE__ */ jsx45("div", { className: "mb-1 truncate text-sm font-medium text-foreground", children: item.title }),
|
|
14873
|
+
/* @__PURE__ */ jsx45("div", { className: "line-clamp-2 text-sm leading-5 text-muted-foreground", children: item.preview }),
|
|
14874
|
+
item.tags.length > 0 && /* @__PURE__ */ jsxs31("div", { className: "mt-2 flex flex-wrap gap-1.5", children: [
|
|
14875
|
+
item.tags.slice(0, 3).map((tag) => /* @__PURE__ */ jsx45(
|
|
14551
14876
|
"span",
|
|
14552
14877
|
{
|
|
14553
14878
|
className: "max-w-[8rem] truncate rounded-md bg-muted px-1.5 py-0.5 text-[11px] leading-4 text-muted-foreground",
|
|
@@ -14555,7 +14880,7 @@ function MessageNavigator({
|
|
|
14555
14880
|
},
|
|
14556
14881
|
tag
|
|
14557
14882
|
)),
|
|
14558
|
-
item.tags.length > 3 && /* @__PURE__ */
|
|
14883
|
+
item.tags.length > 3 && /* @__PURE__ */ jsx45("span", { className: "rounded-md bg-muted px-1.5 py-0.5 text-[11px] leading-4 text-muted-foreground", children: tagsOverflowLabel(item.tags.length - 3) })
|
|
14559
14884
|
] })
|
|
14560
14885
|
]
|
|
14561
14886
|
}
|
|
@@ -14567,9 +14892,9 @@ function MessageNavigator({
|
|
|
14567
14892
|
}
|
|
14568
14893
|
|
|
14569
14894
|
// src/components/thread/MessageActions.tsx
|
|
14570
|
-
import * as
|
|
14571
|
-
import { Check as Check5, Copy as Copy3, RefreshCw as
|
|
14572
|
-
import { jsx as
|
|
14895
|
+
import * as React40 from "react";
|
|
14896
|
+
import { Check as Check5, Copy as Copy3, RefreshCw as RefreshCw4 } from "lucide-react";
|
|
14897
|
+
import { jsx as jsx46, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
14573
14898
|
function MessageActions({
|
|
14574
14899
|
content,
|
|
14575
14900
|
isAssistant = false,
|
|
@@ -14578,7 +14903,7 @@ function MessageActions({
|
|
|
14578
14903
|
className
|
|
14579
14904
|
}) {
|
|
14580
14905
|
const { t } = useChatkitTranslation();
|
|
14581
|
-
const [copied, setCopied] =
|
|
14906
|
+
const [copied, setCopied] = React40.useState(false);
|
|
14582
14907
|
const handleCopy = async () => {
|
|
14583
14908
|
try {
|
|
14584
14909
|
await navigator.clipboard.writeText(content);
|
|
@@ -14591,7 +14916,7 @@ function MessageActions({
|
|
|
14591
14916
|
if (isStreaming) {
|
|
14592
14917
|
return null;
|
|
14593
14918
|
}
|
|
14594
|
-
return /* @__PURE__ */
|
|
14919
|
+
return /* @__PURE__ */ jsxs32(
|
|
14595
14920
|
"div",
|
|
14596
14921
|
{
|
|
14597
14922
|
className: cn(
|
|
@@ -14599,7 +14924,7 @@ function MessageActions({
|
|
|
14599
14924
|
className
|
|
14600
14925
|
),
|
|
14601
14926
|
children: [
|
|
14602
|
-
/* @__PURE__ */
|
|
14927
|
+
/* @__PURE__ */ jsx46(
|
|
14603
14928
|
"button",
|
|
14604
14929
|
{
|
|
14605
14930
|
type: "button",
|
|
@@ -14609,17 +14934,17 @@ function MessageActions({
|
|
|
14609
14934
|
copied && "text-green-500"
|
|
14610
14935
|
),
|
|
14611
14936
|
title: copied ? t("messageActions.copied") : t("messageActions.copy"),
|
|
14612
|
-
children: copied ? /* @__PURE__ */
|
|
14937
|
+
children: copied ? /* @__PURE__ */ jsx46(Check5, { size: 14 }) : /* @__PURE__ */ jsx46(Copy3, { size: 14 })
|
|
14613
14938
|
}
|
|
14614
14939
|
),
|
|
14615
|
-
isAssistant && onRetry && /* @__PURE__ */
|
|
14940
|
+
isAssistant && onRetry && /* @__PURE__ */ jsx46(
|
|
14616
14941
|
"button",
|
|
14617
14942
|
{
|
|
14618
14943
|
type: "button",
|
|
14619
14944
|
onClick: onRetry,
|
|
14620
14945
|
className: "p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",
|
|
14621
14946
|
title: t("messageActions.regenerate"),
|
|
14622
|
-
children: /* @__PURE__ */
|
|
14947
|
+
children: /* @__PURE__ */ jsx46(RefreshCw4, { size: 14 })
|
|
14623
14948
|
}
|
|
14624
14949
|
)
|
|
14625
14950
|
]
|
|
@@ -14640,18 +14965,18 @@ import {
|
|
|
14640
14965
|
Sparkles as Sparkles3,
|
|
14641
14966
|
Zap
|
|
14642
14967
|
} from "lucide-react";
|
|
14643
|
-
import { jsx as
|
|
14968
|
+
import { jsx as jsx47, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
14644
14969
|
function getIconComponent2(icon) {
|
|
14645
14970
|
const iconMap = {
|
|
14646
|
-
"circle-question": /* @__PURE__ */
|
|
14647
|
-
"lightbulb": /* @__PURE__ */
|
|
14648
|
-
"sparkle": /* @__PURE__ */
|
|
14649
|
-
"write": /* @__PURE__ */
|
|
14650
|
-
"search": /* @__PURE__ */
|
|
14651
|
-
"globe": /* @__PURE__ */
|
|
14652
|
-
"book-open": /* @__PURE__ */
|
|
14653
|
-
"compass": /* @__PURE__ */
|
|
14654
|
-
"bolt": /* @__PURE__ */
|
|
14971
|
+
"circle-question": /* @__PURE__ */ jsx47(HelpCircle, { size: 20 }),
|
|
14972
|
+
"lightbulb": /* @__PURE__ */ jsx47(Lightbulb2, { size: 20 }),
|
|
14973
|
+
"sparkle": /* @__PURE__ */ jsx47(Sparkles3, { size: 20 }),
|
|
14974
|
+
"write": /* @__PURE__ */ jsx47(Pencil3, { size: 20 }),
|
|
14975
|
+
"search": /* @__PURE__ */ jsx47(Search3, { size: 20 }),
|
|
14976
|
+
"globe": /* @__PURE__ */ jsx47(Globe2, { size: 20 }),
|
|
14977
|
+
"book-open": /* @__PURE__ */ jsx47(BookOpen2, { size: 20 }),
|
|
14978
|
+
"compass": /* @__PURE__ */ jsx47(Compass, { size: 20 }),
|
|
14979
|
+
"bolt": /* @__PURE__ */ jsx47(Zap, { size: 20 })
|
|
14655
14980
|
};
|
|
14656
14981
|
return icon ? iconMap[icon] || iconMap["sparkle"] : iconMap["sparkle"];
|
|
14657
14982
|
}
|
|
@@ -14667,7 +14992,7 @@ function StartScreen({
|
|
|
14667
14992
|
const greeting = startScreen?.greeting ?? t("startScreen.greeting");
|
|
14668
14993
|
const prompts = startScreen?.prompts ?? [];
|
|
14669
14994
|
const editPromptLabel = t("startScreen.editPrompt");
|
|
14670
|
-
return /* @__PURE__ */
|
|
14995
|
+
return /* @__PURE__ */ jsxs33(
|
|
14671
14996
|
"div",
|
|
14672
14997
|
{
|
|
14673
14998
|
className: cn(
|
|
@@ -14675,8 +15000,8 @@ function StartScreen({
|
|
|
14675
15000
|
className
|
|
14676
15001
|
),
|
|
14677
15002
|
children: [
|
|
14678
|
-
/* @__PURE__ */
|
|
14679
|
-
prompts.length > 0 && /* @__PURE__ */
|
|
15003
|
+
/* @__PURE__ */ jsx47("div", { className: "mb-8 text-center", children: /* @__PURE__ */ jsx47("h2", { className: "text-2xl font-semibold text-foreground mb-2", children: greeting }) }),
|
|
15004
|
+
prompts.length > 0 && /* @__PURE__ */ jsx47("div", { className: "w-full max-w-2xl", children: /* @__PURE__ */ jsx47("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: prompts.map((item, index) => /* @__PURE__ */ jsxs33(
|
|
14680
15005
|
"div",
|
|
14681
15006
|
{
|
|
14682
15007
|
className: cn(
|
|
@@ -14685,23 +15010,23 @@ function StartScreen({
|
|
|
14685
15010
|
"focus-within:ring-2 focus-within:ring-primary/20"
|
|
14686
15011
|
),
|
|
14687
15012
|
children: [
|
|
14688
|
-
/* @__PURE__ */
|
|
15013
|
+
/* @__PURE__ */ jsxs33(
|
|
14689
15014
|
"button",
|
|
14690
15015
|
{
|
|
14691
15016
|
type: "button",
|
|
14692
15017
|
disabled: promptSendDisabled,
|
|
14693
15018
|
onClick: () => onPromptClick?.(item.prompt),
|
|
14694
15019
|
className: cn(
|
|
14695
|
-
"flex min-w-0 flex-1 items-center gap-3 p-4 text-left",
|
|
15020
|
+
"flex min-w-0 flex-1 items-center gap-3 p-4 text-left overflow-hidden",
|
|
14696
15021
|
"focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
|
|
14697
15022
|
),
|
|
14698
15023
|
children: [
|
|
14699
|
-
/* @__PURE__ */
|
|
14700
|
-
/* @__PURE__ */
|
|
15024
|
+
/* @__PURE__ */ jsx47("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: getIconComponent2(item.icon) }),
|
|
15025
|
+
/* @__PURE__ */ jsx47("div", { className: "text-sm font-medium text-foreground line-clamp-3 overflow-hidden", title: item.label, children: item.label })
|
|
14701
15026
|
]
|
|
14702
15027
|
}
|
|
14703
15028
|
),
|
|
14704
|
-
/* @__PURE__ */
|
|
15029
|
+
/* @__PURE__ */ jsx47(
|
|
14705
15030
|
"button",
|
|
14706
15031
|
{
|
|
14707
15032
|
type: "button",
|
|
@@ -14714,7 +15039,7 @@ function StartScreen({
|
|
|
14714
15039
|
"rounded-r-xl transition-colors hover:bg-muted hover:text-foreground",
|
|
14715
15040
|
"focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
|
|
14716
15041
|
),
|
|
14717
|
-
children: /* @__PURE__ */
|
|
15042
|
+
children: /* @__PURE__ */ jsx47(Pencil3, { size: 16 })
|
|
14718
15043
|
}
|
|
14719
15044
|
)
|
|
14720
15045
|
]
|
|
@@ -14727,7 +15052,7 @@ function StartScreen({
|
|
|
14727
15052
|
}
|
|
14728
15053
|
|
|
14729
15054
|
// src/hooks/useThreads.ts
|
|
14730
|
-
import * as
|
|
15055
|
+
import * as React42 from "react";
|
|
14731
15056
|
var DEFAULT_LIMIT = 50;
|
|
14732
15057
|
var getThreadTitle = (threadRecord) => {
|
|
14733
15058
|
const title = threadRecord.title?.trim();
|
|
@@ -14780,16 +15105,16 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
14780
15105
|
isLoading: isStreamLoading,
|
|
14781
15106
|
error: streamError
|
|
14782
15107
|
} = useStreamContext();
|
|
14783
|
-
const [threadRecords, setThreadRecords] =
|
|
14784
|
-
const [isLoading, setIsLoading] =
|
|
14785
|
-
const [error, setError] =
|
|
14786
|
-
const upsertThreadRecord =
|
|
15108
|
+
const [threadRecords, setThreadRecords] = React42.useState([]);
|
|
15109
|
+
const [isLoading, setIsLoading] = React42.useState(false);
|
|
15110
|
+
const [error, setError] = React42.useState(null);
|
|
15111
|
+
const upsertThreadRecord = React42.useCallback((threadRecord) => {
|
|
14787
15112
|
setThreadRecords((prev) => {
|
|
14788
15113
|
const next = prev.filter((item) => item.id !== threadRecord.id);
|
|
14789
15114
|
return sortThreadRecords([threadRecord, ...next]);
|
|
14790
15115
|
});
|
|
14791
15116
|
}, []);
|
|
14792
|
-
const refreshThreads =
|
|
15117
|
+
const refreshThreads = React42.useCallback(async () => {
|
|
14793
15118
|
setIsLoading(true);
|
|
14794
15119
|
setError(null);
|
|
14795
15120
|
try {
|
|
@@ -14805,7 +15130,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
14805
15130
|
setIsLoading(false);
|
|
14806
15131
|
}
|
|
14807
15132
|
}, [client, limit, assistantId]);
|
|
14808
|
-
const createThread =
|
|
15133
|
+
const createThread = React42.useCallback(
|
|
14809
15134
|
async (input) => {
|
|
14810
15135
|
setError(null);
|
|
14811
15136
|
const payload = {};
|
|
@@ -14819,7 +15144,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
14819
15144
|
},
|
|
14820
15145
|
[client, upsertThreadRecord]
|
|
14821
15146
|
);
|
|
14822
|
-
const updateThread =
|
|
15147
|
+
const updateThread = React42.useCallback(
|
|
14823
15148
|
async (recordId, payload) => {
|
|
14824
15149
|
setError(null);
|
|
14825
15150
|
const updated = await client.conversations.update(recordId, payload);
|
|
@@ -14828,7 +15153,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
14828
15153
|
},
|
|
14829
15154
|
[client, upsertThreadRecord]
|
|
14830
15155
|
);
|
|
14831
|
-
const deleteThread =
|
|
15156
|
+
const deleteThread = React42.useCallback(
|
|
14832
15157
|
async (recordId) => {
|
|
14833
15158
|
setError(null);
|
|
14834
15159
|
await client.conversations.delete(recordId);
|
|
@@ -14836,11 +15161,11 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
14836
15161
|
},
|
|
14837
15162
|
[client]
|
|
14838
15163
|
);
|
|
14839
|
-
|
|
15164
|
+
React42.useEffect(() => {
|
|
14840
15165
|
if (!isReady) return;
|
|
14841
15166
|
void refreshThreads();
|
|
14842
15167
|
}, [refreshThreads, isReady]);
|
|
14843
|
-
|
|
15168
|
+
React42.useEffect(() => {
|
|
14844
15169
|
if (!threadId || !isStreamLoading) return;
|
|
14845
15170
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
14846
15171
|
const busyStatus = "busy";
|
|
@@ -14861,7 +15186,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
14861
15186
|
return changed ? sortThreadRecords(next) : prev;
|
|
14862
15187
|
});
|
|
14863
15188
|
}, [threadId, isStreamLoading]);
|
|
14864
|
-
|
|
15189
|
+
React42.useEffect(() => {
|
|
14865
15190
|
const message = getErrorMessage2(streamError)?.trim();
|
|
14866
15191
|
if (!threadId || !message) return;
|
|
14867
15192
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -14883,7 +15208,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
14883
15208
|
return changed ? sortThreadRecords(next) : prev;
|
|
14884
15209
|
});
|
|
14885
15210
|
}, [threadId, streamError]);
|
|
14886
|
-
|
|
15211
|
+
React42.useEffect(() => {
|
|
14887
15212
|
if (!isReady || !threadId || isStreamLoading) return;
|
|
14888
15213
|
let cancelled = false;
|
|
14889
15214
|
void client.conversations.search({ where: { threadId }, limit: 1 }).then((result) => {
|
|
@@ -14897,7 +15222,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
14897
15222
|
cancelled = true;
|
|
14898
15223
|
};
|
|
14899
15224
|
}, [client, threadId, upsertThreadRecord, isReady, isStreamLoading]);
|
|
14900
|
-
const threads =
|
|
15225
|
+
const threads = React42.useMemo(
|
|
14901
15226
|
() => threadRecords.map((threadRecord) => toThreadItem(threadRecord)),
|
|
14902
15227
|
[threadRecords]
|
|
14903
15228
|
);
|
|
@@ -14914,10 +15239,10 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
14914
15239
|
}
|
|
14915
15240
|
|
|
14916
15241
|
// src/components/thread/context-usage-indicator.tsx
|
|
14917
|
-
import * as
|
|
15242
|
+
import * as React43 from "react";
|
|
14918
15243
|
|
|
14919
15244
|
// src/components/ui/progress-circle.tsx
|
|
14920
|
-
import { jsx as
|
|
15245
|
+
import { jsx as jsx48, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
14921
15246
|
function clamp2(input, a, b) {
|
|
14922
15247
|
return Math.max(Math.min(input, Math.max(a, b)), Math.min(a, b));
|
|
14923
15248
|
}
|
|
@@ -14940,7 +15265,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
14940
15265
|
return (
|
|
14941
15266
|
// biome-ignore lint/a11y/useFocusableInteractive: false positive (progress + progressbar are not focusable interactives)
|
|
14942
15267
|
// biome-ignore lint/nursery/useAriaPropsSupportedByRole: biome rule at odds with mdn docs (presumed nursary bug with rule)
|
|
14943
|
-
/* @__PURE__ */
|
|
15268
|
+
/* @__PURE__ */ jsxs34(
|
|
14944
15269
|
"svg",
|
|
14945
15270
|
{
|
|
14946
15271
|
role: "progressbar",
|
|
@@ -14951,8 +15276,8 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
14951
15276
|
"aria-valuemax": 100,
|
|
14952
15277
|
...restSvgProps,
|
|
14953
15278
|
children: [
|
|
14954
|
-
/* @__PURE__ */
|
|
14955
|
-
/* @__PURE__ */
|
|
15279
|
+
/* @__PURE__ */ jsx48("circle", { ...commonParams, className: "stroke-current/25" }),
|
|
15280
|
+
/* @__PURE__ */ jsx48(
|
|
14956
15281
|
"circle",
|
|
14957
15282
|
{
|
|
14958
15283
|
...commonParams,
|
|
@@ -14971,7 +15296,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
14971
15296
|
};
|
|
14972
15297
|
|
|
14973
15298
|
// src/components/thread/context-usage-indicator.tsx
|
|
14974
|
-
import { jsx as
|
|
15299
|
+
import { jsx as jsx49, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
14975
15300
|
var kNumberFormatter = new Intl.NumberFormat("en-US", {
|
|
14976
15301
|
minimumFractionDigits: 0,
|
|
14977
15302
|
maximumFractionDigits: 1
|
|
@@ -15004,21 +15329,21 @@ function ContextUsageIndicator({
|
|
|
15004
15329
|
}) {
|
|
15005
15330
|
const { t } = useChatkitTranslation();
|
|
15006
15331
|
const stream = useStreamContext();
|
|
15007
|
-
const [maxContextSize, setMaxContextSize] =
|
|
15008
|
-
const [usedContextSize, setUsedContextSize] =
|
|
15009
|
-
const [assistantAgentKey, setAssistantAgentKey] =
|
|
15010
|
-
const latestRealtimeUsageRef =
|
|
15332
|
+
const [maxContextSize, setMaxContextSize] = React43.useState(null);
|
|
15333
|
+
const [usedContextSize, setUsedContextSize] = React43.useState(null);
|
|
15334
|
+
const [assistantAgentKey, setAssistantAgentKey] = React43.useState(null);
|
|
15335
|
+
const latestRealtimeUsageRef = React43.useRef({
|
|
15011
15336
|
threadId: null,
|
|
15012
15337
|
agentKey: null,
|
|
15013
15338
|
usedTokens: null
|
|
15014
15339
|
});
|
|
15015
|
-
const realtimeUsage =
|
|
15340
|
+
const realtimeUsage = React43.useMemo(
|
|
15016
15341
|
() => getThreadContextUsage(stream.contextUsageByAgentKey, assistantAgentKey),
|
|
15017
15342
|
[assistantAgentKey, stream.contextUsageByAgentKey]
|
|
15018
15343
|
);
|
|
15019
15344
|
const realtimeUsedContextSize = getThreadContextUsageTotalTokens(realtimeUsage);
|
|
15020
15345
|
const hasApiConfiguration = Boolean(stream.apiUrl?.trim() && stream.apiKey?.trim());
|
|
15021
|
-
|
|
15346
|
+
React43.useEffect(() => {
|
|
15022
15347
|
if (!hasApiConfiguration || !stream.client || !stream.assistantId) {
|
|
15023
15348
|
setMaxContextSize(null);
|
|
15024
15349
|
setAssistantAgentKey(null);
|
|
@@ -15038,18 +15363,18 @@ function ContextUsageIndicator({
|
|
|
15038
15363
|
cancelled = true;
|
|
15039
15364
|
};
|
|
15040
15365
|
}, [hasApiConfiguration, stream.client, stream.assistantId]);
|
|
15041
|
-
|
|
15366
|
+
React43.useEffect(() => {
|
|
15042
15367
|
latestRealtimeUsageRef.current = {
|
|
15043
15368
|
threadId: stream.threadId ?? null,
|
|
15044
15369
|
agentKey: assistantAgentKey,
|
|
15045
15370
|
usedTokens: realtimeUsedContextSize
|
|
15046
15371
|
};
|
|
15047
15372
|
}, [assistantAgentKey, realtimeUsedContextSize, stream.threadId]);
|
|
15048
|
-
|
|
15373
|
+
React43.useEffect(() => {
|
|
15049
15374
|
if (realtimeUsedContextSize == null) return;
|
|
15050
15375
|
setUsedContextSize(realtimeUsedContextSize);
|
|
15051
15376
|
}, [realtimeUsedContextSize]);
|
|
15052
|
-
|
|
15377
|
+
React43.useEffect(() => {
|
|
15053
15378
|
if (!hasApiConfiguration || !stream.client) {
|
|
15054
15379
|
setUsedContextSize(null);
|
|
15055
15380
|
return;
|
|
@@ -15115,8 +15440,8 @@ function ContextUsageIndicator({
|
|
|
15115
15440
|
});
|
|
15116
15441
|
const usageLabelWithSuffix = usageLabel.endsWith(":") ? usageLabel : `${usageLabel}:`;
|
|
15117
15442
|
const progressClassName = percent >= 90 ? "text-destructive" : percent >= 75 ? "text-amber-500" : "text-primary dark:text-zinc-300";
|
|
15118
|
-
return /* @__PURE__ */
|
|
15119
|
-
/* @__PURE__ */
|
|
15443
|
+
return /* @__PURE__ */ jsxs35(Tooltip, { children: [
|
|
15444
|
+
/* @__PURE__ */ jsx49(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx49(
|
|
15120
15445
|
"button",
|
|
15121
15446
|
{
|
|
15122
15447
|
type: "button",
|
|
@@ -15125,31 +15450,31 @@ function ContextUsageIndicator({
|
|
|
15125
15450
|
className
|
|
15126
15451
|
),
|
|
15127
15452
|
"aria-label": `${usageLabelWithSuffix} ${usageFullLabel}. ${usageTokensLabel}`,
|
|
15128
|
-
children: /* @__PURE__ */
|
|
15453
|
+
children: /* @__PURE__ */ jsx49(ProgressCircle, { value: percent, className: cn("size-3.5", progressClassName) })
|
|
15129
15454
|
}
|
|
15130
15455
|
) }),
|
|
15131
|
-
/* @__PURE__ */
|
|
15132
|
-
/* @__PURE__ */
|
|
15133
|
-
/* @__PURE__ */
|
|
15134
|
-
/* @__PURE__ */
|
|
15456
|
+
/* @__PURE__ */ jsxs35(TooltipContent, { side: "top", sideOffset: 6, className: "space-y-0.5 px-3 py-2 text-center", children: [
|
|
15457
|
+
/* @__PURE__ */ jsx49("div", { className: "text-primary-foreground/70", children: usageLabelWithSuffix }),
|
|
15458
|
+
/* @__PURE__ */ jsx49("div", { className: "font-medium text-primary-foreground/80", children: usageFullLabel }),
|
|
15459
|
+
/* @__PURE__ */ jsx49("div", { className: "text-sm font-semibold", children: usageTokensLabel })
|
|
15135
15460
|
] })
|
|
15136
15461
|
] });
|
|
15137
15462
|
}
|
|
15138
15463
|
|
|
15139
15464
|
// src/components/pet/PetBridge.tsx
|
|
15140
|
-
import * as
|
|
15465
|
+
import * as React44 from "react";
|
|
15141
15466
|
import { normalizePetOptions as normalizePetOptions2 } from "@xpert-ai/chatkit-types";
|
|
15142
15467
|
function PetBridge({ pet, state }) {
|
|
15143
15468
|
const parentMessenger = useParentMessenger();
|
|
15144
15469
|
const sendEvent = parentMessenger?.sendEvent;
|
|
15145
|
-
const options =
|
|
15146
|
-
|
|
15470
|
+
const options = React44.useMemo(() => normalizePetOptions2(pet), [pet]);
|
|
15471
|
+
React44.useEffect(() => {
|
|
15147
15472
|
if (!sendEvent) {
|
|
15148
15473
|
return;
|
|
15149
15474
|
}
|
|
15150
15475
|
sendEvent("pet_options_change", { pet: pet ?? null });
|
|
15151
15476
|
}, [sendEvent, pet]);
|
|
15152
|
-
|
|
15477
|
+
React44.useEffect(() => {
|
|
15153
15478
|
if (!sendEvent || !options) {
|
|
15154
15479
|
return;
|
|
15155
15480
|
}
|
|
@@ -15159,15 +15484,15 @@ function PetBridge({ pet, state }) {
|
|
|
15159
15484
|
}
|
|
15160
15485
|
|
|
15161
15486
|
// src/components/settings/SettingsSheet.tsx
|
|
15162
|
-
import * as
|
|
15487
|
+
import * as React51 from "react";
|
|
15163
15488
|
import { PawPrint, Settings } from "lucide-react";
|
|
15164
15489
|
|
|
15165
15490
|
// src/components/ui/input.tsx
|
|
15166
|
-
import * as
|
|
15167
|
-
import { jsx as
|
|
15168
|
-
var Input =
|
|
15491
|
+
import * as React45 from "react";
|
|
15492
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
15493
|
+
var Input = React45.forwardRef(
|
|
15169
15494
|
({ className, type, ...props }, ref) => {
|
|
15170
|
-
return /* @__PURE__ */
|
|
15495
|
+
return /* @__PURE__ */ jsx50(
|
|
15171
15496
|
"input",
|
|
15172
15497
|
{
|
|
15173
15498
|
ref,
|
|
@@ -15187,17 +15512,17 @@ Input.displayName = "Input";
|
|
|
15187
15512
|
import "react";
|
|
15188
15513
|
import { Select as SelectPrimitive } from "radix-ui";
|
|
15189
15514
|
import { ChevronDownIcon as ChevronDownIcon2, CheckIcon as CheckIcon4, ChevronUpIcon } from "lucide-react";
|
|
15190
|
-
import { jsx as
|
|
15515
|
+
import { jsx as jsx51, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
15191
15516
|
function Select({
|
|
15192
15517
|
...props
|
|
15193
15518
|
}) {
|
|
15194
|
-
return /* @__PURE__ */
|
|
15519
|
+
return /* @__PURE__ */ jsx51(SelectPrimitive.Root, { "data-slot": "select", ...props });
|
|
15195
15520
|
}
|
|
15196
15521
|
function SelectGroup({
|
|
15197
15522
|
className,
|
|
15198
15523
|
...props
|
|
15199
15524
|
}) {
|
|
15200
|
-
return /* @__PURE__ */
|
|
15525
|
+
return /* @__PURE__ */ jsx51(
|
|
15201
15526
|
SelectPrimitive.Group,
|
|
15202
15527
|
{
|
|
15203
15528
|
"data-slot": "select-group",
|
|
@@ -15209,7 +15534,7 @@ function SelectGroup({
|
|
|
15209
15534
|
function SelectValue({
|
|
15210
15535
|
...props
|
|
15211
15536
|
}) {
|
|
15212
|
-
return /* @__PURE__ */
|
|
15537
|
+
return /* @__PURE__ */ jsx51(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
|
|
15213
15538
|
}
|
|
15214
15539
|
function SelectTrigger({
|
|
15215
15540
|
className,
|
|
@@ -15217,7 +15542,7 @@ function SelectTrigger({
|
|
|
15217
15542
|
children,
|
|
15218
15543
|
...props
|
|
15219
15544
|
}) {
|
|
15220
|
-
return /* @__PURE__ */
|
|
15545
|
+
return /* @__PURE__ */ jsxs36(
|
|
15221
15546
|
SelectPrimitive.Trigger,
|
|
15222
15547
|
{
|
|
15223
15548
|
"data-slot": "select-trigger",
|
|
@@ -15229,7 +15554,7 @@ function SelectTrigger({
|
|
|
15229
15554
|
...props,
|
|
15230
15555
|
children: [
|
|
15231
15556
|
children,
|
|
15232
|
-
/* @__PURE__ */
|
|
15557
|
+
/* @__PURE__ */ jsx51(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx51(ChevronDownIcon2, { className: "pointer-events-none size-4 text-muted-foreground" }) })
|
|
15233
15558
|
]
|
|
15234
15559
|
}
|
|
15235
15560
|
);
|
|
@@ -15241,7 +15566,7 @@ function SelectContent({
|
|
|
15241
15566
|
align = "center",
|
|
15242
15567
|
...props
|
|
15243
15568
|
}) {
|
|
15244
|
-
return /* @__PURE__ */
|
|
15569
|
+
return /* @__PURE__ */ jsx51(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs36(
|
|
15245
15570
|
SelectPrimitive.Content,
|
|
15246
15571
|
{
|
|
15247
15572
|
"data-slot": "select-content",
|
|
@@ -15251,8 +15576,8 @@ function SelectContent({
|
|
|
15251
15576
|
align,
|
|
15252
15577
|
...props,
|
|
15253
15578
|
children: [
|
|
15254
|
-
/* @__PURE__ */
|
|
15255
|
-
/* @__PURE__ */
|
|
15579
|
+
/* @__PURE__ */ jsx51(SelectScrollUpButton, {}),
|
|
15580
|
+
/* @__PURE__ */ jsx51(
|
|
15256
15581
|
SelectPrimitive.Viewport,
|
|
15257
15582
|
{
|
|
15258
15583
|
"data-position": position,
|
|
@@ -15263,7 +15588,7 @@ function SelectContent({
|
|
|
15263
15588
|
children
|
|
15264
15589
|
}
|
|
15265
15590
|
),
|
|
15266
|
-
/* @__PURE__ */
|
|
15591
|
+
/* @__PURE__ */ jsx51(SelectScrollDownButton, {})
|
|
15267
15592
|
]
|
|
15268
15593
|
}
|
|
15269
15594
|
) });
|
|
@@ -15273,7 +15598,7 @@ function SelectItem({
|
|
|
15273
15598
|
children,
|
|
15274
15599
|
...props
|
|
15275
15600
|
}) {
|
|
15276
|
-
return /* @__PURE__ */
|
|
15601
|
+
return /* @__PURE__ */ jsxs36(
|
|
15277
15602
|
SelectPrimitive.Item,
|
|
15278
15603
|
{
|
|
15279
15604
|
"data-slot": "select-item",
|
|
@@ -15283,8 +15608,8 @@ function SelectItem({
|
|
|
15283
15608
|
),
|
|
15284
15609
|
...props,
|
|
15285
15610
|
children: [
|
|
15286
|
-
/* @__PURE__ */
|
|
15287
|
-
/* @__PURE__ */
|
|
15611
|
+
/* @__PURE__ */ jsx51("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsx51(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx51(CheckIcon4, { className: "pointer-events-none" }) }) }),
|
|
15612
|
+
/* @__PURE__ */ jsx51(SelectPrimitive.ItemText, { children })
|
|
15288
15613
|
]
|
|
15289
15614
|
}
|
|
15290
15615
|
);
|
|
@@ -15293,7 +15618,7 @@ function SelectScrollUpButton({
|
|
|
15293
15618
|
className,
|
|
15294
15619
|
...props
|
|
15295
15620
|
}) {
|
|
15296
|
-
return /* @__PURE__ */
|
|
15621
|
+
return /* @__PURE__ */ jsx51(
|
|
15297
15622
|
SelectPrimitive.ScrollUpButton,
|
|
15298
15623
|
{
|
|
15299
15624
|
"data-slot": "select-scroll-up-button",
|
|
@@ -15302,7 +15627,7 @@ function SelectScrollUpButton({
|
|
|
15302
15627
|
className
|
|
15303
15628
|
),
|
|
15304
15629
|
...props,
|
|
15305
|
-
children: /* @__PURE__ */
|
|
15630
|
+
children: /* @__PURE__ */ jsx51(
|
|
15306
15631
|
ChevronUpIcon,
|
|
15307
15632
|
{}
|
|
15308
15633
|
)
|
|
@@ -15313,7 +15638,7 @@ function SelectScrollDownButton({
|
|
|
15313
15638
|
className,
|
|
15314
15639
|
...props
|
|
15315
15640
|
}) {
|
|
15316
|
-
return /* @__PURE__ */
|
|
15641
|
+
return /* @__PURE__ */ jsx51(
|
|
15317
15642
|
SelectPrimitive.ScrollDownButton,
|
|
15318
15643
|
{
|
|
15319
15644
|
"data-slot": "select-scroll-down-button",
|
|
@@ -15322,7 +15647,7 @@ function SelectScrollDownButton({
|
|
|
15322
15647
|
className
|
|
15323
15648
|
),
|
|
15324
15649
|
...props,
|
|
15325
|
-
children: /* @__PURE__ */
|
|
15650
|
+
children: /* @__PURE__ */ jsx51(
|
|
15326
15651
|
ChevronDownIcon2,
|
|
15327
15652
|
{}
|
|
15328
15653
|
)
|
|
@@ -15331,9 +15656,9 @@ function SelectScrollDownButton({
|
|
|
15331
15656
|
}
|
|
15332
15657
|
|
|
15333
15658
|
// src/components/ui/slider.tsx
|
|
15334
|
-
import * as
|
|
15659
|
+
import * as React47 from "react";
|
|
15335
15660
|
import { Slider as SliderPrimitive } from "radix-ui";
|
|
15336
|
-
import { jsx as
|
|
15661
|
+
import { jsx as jsx52, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
15337
15662
|
function Slider({
|
|
15338
15663
|
className,
|
|
15339
15664
|
defaultValue,
|
|
@@ -15342,11 +15667,11 @@ function Slider({
|
|
|
15342
15667
|
max = 100,
|
|
15343
15668
|
...props
|
|
15344
15669
|
}) {
|
|
15345
|
-
const _values =
|
|
15670
|
+
const _values = React47.useMemo(
|
|
15346
15671
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
15347
15672
|
[value, defaultValue, min, max]
|
|
15348
15673
|
);
|
|
15349
|
-
return /* @__PURE__ */
|
|
15674
|
+
return /* @__PURE__ */ jsxs37(
|
|
15350
15675
|
SliderPrimitive.Root,
|
|
15351
15676
|
{
|
|
15352
15677
|
"data-slot": "slider",
|
|
@@ -15360,12 +15685,12 @@ function Slider({
|
|
|
15360
15685
|
),
|
|
15361
15686
|
...props,
|
|
15362
15687
|
children: [
|
|
15363
|
-
/* @__PURE__ */
|
|
15688
|
+
/* @__PURE__ */ jsx52(
|
|
15364
15689
|
SliderPrimitive.Track,
|
|
15365
15690
|
{
|
|
15366
15691
|
"data-slot": "slider-track",
|
|
15367
15692
|
className: "relative grow overflow-hidden rounded-full bg-muted data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1",
|
|
15368
|
-
children: /* @__PURE__ */
|
|
15693
|
+
children: /* @__PURE__ */ jsx52(
|
|
15369
15694
|
SliderPrimitive.Range,
|
|
15370
15695
|
{
|
|
15371
15696
|
"data-slot": "slider-range",
|
|
@@ -15374,7 +15699,7 @@ function Slider({
|
|
|
15374
15699
|
)
|
|
15375
15700
|
}
|
|
15376
15701
|
),
|
|
15377
|
-
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */
|
|
15702
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx52(
|
|
15378
15703
|
SliderPrimitive.Thumb,
|
|
15379
15704
|
{
|
|
15380
15705
|
"data-slot": "slider-thumb",
|
|
@@ -15388,7 +15713,7 @@ function Slider({
|
|
|
15388
15713
|
}
|
|
15389
15714
|
|
|
15390
15715
|
// src/components/ui/toggle-group.tsx
|
|
15391
|
-
import * as
|
|
15716
|
+
import * as React49 from "react";
|
|
15392
15717
|
import "class-variance-authority";
|
|
15393
15718
|
import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
|
|
15394
15719
|
|
|
@@ -15396,7 +15721,7 @@ import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
|
|
|
15396
15721
|
import "react";
|
|
15397
15722
|
import { cva as cva2 } from "class-variance-authority";
|
|
15398
15723
|
import { Toggle as TogglePrimitive } from "radix-ui";
|
|
15399
|
-
import { jsx as
|
|
15724
|
+
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
15400
15725
|
var toggleVariants = cva2(
|
|
15401
15726
|
"group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
15402
15727
|
{
|
|
@@ -15419,8 +15744,8 @@ var toggleVariants = cva2(
|
|
|
15419
15744
|
);
|
|
15420
15745
|
|
|
15421
15746
|
// src/components/ui/toggle-group.tsx
|
|
15422
|
-
import { jsx as
|
|
15423
|
-
var ToggleGroupContext =
|
|
15747
|
+
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
15748
|
+
var ToggleGroupContext = React49.createContext({
|
|
15424
15749
|
size: "default",
|
|
15425
15750
|
variant: "default",
|
|
15426
15751
|
spacing: 0,
|
|
@@ -15435,7 +15760,7 @@ function ToggleGroup({
|
|
|
15435
15760
|
children,
|
|
15436
15761
|
...props
|
|
15437
15762
|
}) {
|
|
15438
|
-
return /* @__PURE__ */
|
|
15763
|
+
return /* @__PURE__ */ jsx54(
|
|
15439
15764
|
ToggleGroupPrimitive.Root,
|
|
15440
15765
|
{
|
|
15441
15766
|
"data-slot": "toggle-group",
|
|
@@ -15449,7 +15774,7 @@ function ToggleGroup({
|
|
|
15449
15774
|
className
|
|
15450
15775
|
),
|
|
15451
15776
|
...props,
|
|
15452
|
-
children: /* @__PURE__ */
|
|
15777
|
+
children: /* @__PURE__ */ jsx54(
|
|
15453
15778
|
ToggleGroupContext.Provider,
|
|
15454
15779
|
{
|
|
15455
15780
|
value: { variant, size: size2, spacing, orientation },
|
|
@@ -15466,8 +15791,8 @@ function ToggleGroupItem({
|
|
|
15466
15791
|
size: size2 = "default",
|
|
15467
15792
|
...props
|
|
15468
15793
|
}) {
|
|
15469
|
-
const context =
|
|
15470
|
-
return /* @__PURE__ */
|
|
15794
|
+
const context = React49.useContext(ToggleGroupContext);
|
|
15795
|
+
return /* @__PURE__ */ jsx54(
|
|
15471
15796
|
ToggleGroupPrimitive.Item,
|
|
15472
15797
|
{
|
|
15473
15798
|
"data-slot": "toggle-group-item",
|
|
@@ -15707,7 +16032,7 @@ import {
|
|
|
15707
16032
|
} from "@xpert-ai/chatkit-types";
|
|
15708
16033
|
|
|
15709
16034
|
// src/components/pet/PetPreview.tsx
|
|
15710
|
-
import { jsx as
|
|
16035
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
15711
16036
|
function escapeCssUrl2(value) {
|
|
15712
16037
|
return value.replace(/["\\]/g, "\\$&");
|
|
15713
16038
|
}
|
|
@@ -15715,7 +16040,7 @@ function PetPreview({ src, label, className }) {
|
|
|
15715
16040
|
const scale = 0.13;
|
|
15716
16041
|
const width = petSpriteAtlas.cellWidth;
|
|
15717
16042
|
const height = petSpriteAtlas.cellHeight;
|
|
15718
|
-
return /* @__PURE__ */
|
|
16043
|
+
return /* @__PURE__ */ jsx55(
|
|
15719
16044
|
"span",
|
|
15720
16045
|
{
|
|
15721
16046
|
className: cn(
|
|
@@ -15724,7 +16049,7 @@ function PetPreview({ src, label, className }) {
|
|
|
15724
16049
|
),
|
|
15725
16050
|
"aria-hidden": "true",
|
|
15726
16051
|
title: label,
|
|
15727
|
-
children: /* @__PURE__ */
|
|
16052
|
+
children: /* @__PURE__ */ jsx55(
|
|
15728
16053
|
"span",
|
|
15729
16054
|
{
|
|
15730
16055
|
className: "absolute left-1/2 top-1/2 block",
|
|
@@ -15746,7 +16071,7 @@ function PetPreview({ src, label, className }) {
|
|
|
15746
16071
|
}
|
|
15747
16072
|
|
|
15748
16073
|
// src/components/settings/SettingsSheet.tsx
|
|
15749
|
-
import { jsx as
|
|
16074
|
+
import { jsx as jsx56, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
15750
16075
|
var CHARACTER_TYPES2 = [
|
|
15751
16076
|
"builtin",
|
|
15752
16077
|
"atlas"
|
|
@@ -15762,13 +16087,13 @@ function SettingsSheet({
|
|
|
15762
16087
|
onSave
|
|
15763
16088
|
}) {
|
|
15764
16089
|
const { t } = useChatkitTranslation();
|
|
15765
|
-
const [draft, setDraft] =
|
|
15766
|
-
|
|
16090
|
+
const [draft, setDraft] = React51.useState(settings);
|
|
16091
|
+
React51.useEffect(() => {
|
|
15767
16092
|
if (open) {
|
|
15768
16093
|
setDraft(petRequired ? { ...settings, enabled: true } : settings);
|
|
15769
16094
|
}
|
|
15770
16095
|
}, [open, petRequired, settings]);
|
|
15771
|
-
const updateDraft =
|
|
16096
|
+
const updateDraft = React51.useCallback(
|
|
15772
16097
|
(patch) => {
|
|
15773
16098
|
setDraft((previous) => ({ ...previous, ...patch }));
|
|
15774
16099
|
},
|
|
@@ -15786,23 +16111,23 @@ function SettingsSheet({
|
|
|
15786
16111
|
defaultValue: selectedBuiltinPet.label
|
|
15787
16112
|
}
|
|
15788
16113
|
);
|
|
15789
|
-
return /* @__PURE__ */
|
|
15790
|
-
/* @__PURE__ */
|
|
15791
|
-
/* @__PURE__ */
|
|
15792
|
-
/* @__PURE__ */
|
|
16114
|
+
return /* @__PURE__ */ jsx56(Sheet, { open, onOpenChange, children: /* @__PURE__ */ jsxs38(SheetContent, { side: "right", className: "w-[min(92vw,26rem)] overflow-y-auto", children: [
|
|
16115
|
+
/* @__PURE__ */ jsx56(SheetHeader, { children: /* @__PURE__ */ jsxs38("div", { className: "flex items-center gap-2", children: [
|
|
16116
|
+
/* @__PURE__ */ jsx56("span", { className: "flex h-8 w-8 items-center justify-center rounded-md bg-primary/10 text-primary", children: /* @__PURE__ */ jsx56(Settings, { size: 16 }) }),
|
|
16117
|
+
/* @__PURE__ */ jsx56(SheetTitle, { children: t("settings.title") })
|
|
15793
16118
|
] }) }),
|
|
15794
|
-
/* @__PURE__ */
|
|
15795
|
-
/* @__PURE__ */
|
|
15796
|
-
/* @__PURE__ */
|
|
15797
|
-
/* @__PURE__ */
|
|
15798
|
-
/* @__PURE__ */
|
|
16119
|
+
/* @__PURE__ */ jsxs38("form", { className: "mt-6 space-y-5", onSubmit: handleSubmit, children: [
|
|
16120
|
+
/* @__PURE__ */ jsxs38("section", { className: "space-y-5", children: [
|
|
16121
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex items-center gap-2", children: [
|
|
16122
|
+
/* @__PURE__ */ jsx56("span", { className: "flex h-7 w-7 items-center justify-center rounded-md bg-muted text-muted-foreground", children: /* @__PURE__ */ jsx56(PawPrint, { size: 15 }) }),
|
|
16123
|
+
/* @__PURE__ */ jsx56("h3", { className: "text-sm font-semibold", children: t("pet.settings.title") })
|
|
15799
16124
|
] }),
|
|
15800
|
-
/* @__PURE__ */
|
|
15801
|
-
/* @__PURE__ */
|
|
15802
|
-
/* @__PURE__ */
|
|
15803
|
-
petRequired && /* @__PURE__ */
|
|
16125
|
+
/* @__PURE__ */ jsxs38("label", { className: "flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2", children: [
|
|
16126
|
+
/* @__PURE__ */ jsxs38("span", { className: "min-w-0", children: [
|
|
16127
|
+
/* @__PURE__ */ jsx56("span", { className: "block text-sm font-medium", children: t("pet.settings.enabled") }),
|
|
16128
|
+
petRequired && /* @__PURE__ */ jsx56("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: t("pet.settings.requiredHint") })
|
|
15804
16129
|
] }),
|
|
15805
|
-
/* @__PURE__ */
|
|
16130
|
+
/* @__PURE__ */ jsx56(
|
|
15806
16131
|
"button",
|
|
15807
16132
|
{
|
|
15808
16133
|
type: "button",
|
|
@@ -15815,7 +16140,7 @@ function SettingsSheet({
|
|
|
15815
16140
|
draft.enabled ? "bg-primary" : "bg-muted-foreground/20",
|
|
15816
16141
|
petRequired ? "cursor-not-allowed opacity-70" : ""
|
|
15817
16142
|
].join(" "),
|
|
15818
|
-
children: /* @__PURE__ */
|
|
16143
|
+
children: /* @__PURE__ */ jsx56(
|
|
15819
16144
|
"span",
|
|
15820
16145
|
{
|
|
15821
16146
|
className: [
|
|
@@ -15828,9 +16153,9 @@ function SettingsSheet({
|
|
|
15828
16153
|
)
|
|
15829
16154
|
] })
|
|
15830
16155
|
] }),
|
|
15831
|
-
/* @__PURE__ */
|
|
15832
|
-
/* @__PURE__ */
|
|
15833
|
-
/* @__PURE__ */
|
|
16156
|
+
/* @__PURE__ */ jsxs38("div", { className: "space-y-2", children: [
|
|
16157
|
+
/* @__PURE__ */ jsx56("span", { id: "chatkit-pet-type-label", className: "text-sm font-medium", children: t("pet.settings.characterType") }),
|
|
16158
|
+
/* @__PURE__ */ jsx56(
|
|
15834
16159
|
ToggleGroup,
|
|
15835
16160
|
{
|
|
15836
16161
|
id: "chatkit-pet-type",
|
|
@@ -15845,7 +16170,7 @@ function SettingsSheet({
|
|
|
15845
16170
|
variant: "outline",
|
|
15846
16171
|
spacing: 2,
|
|
15847
16172
|
className: "!w-full",
|
|
15848
|
-
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */
|
|
16173
|
+
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ jsx56(
|
|
15849
16174
|
ToggleGroupItem,
|
|
15850
16175
|
{
|
|
15851
16176
|
value: type,
|
|
@@ -15857,8 +16182,8 @@ function SettingsSheet({
|
|
|
15857
16182
|
}
|
|
15858
16183
|
)
|
|
15859
16184
|
] }),
|
|
15860
|
-
draft.characterType === "builtin" && /* @__PURE__ */
|
|
15861
|
-
/* @__PURE__ */
|
|
16185
|
+
draft.characterType === "builtin" && /* @__PURE__ */ jsxs38("div", { className: "space-y-2", children: [
|
|
16186
|
+
/* @__PURE__ */ jsx56(
|
|
15862
16187
|
"label",
|
|
15863
16188
|
{
|
|
15864
16189
|
htmlFor: "chatkit-pet-builtin",
|
|
@@ -15866,7 +16191,7 @@ function SettingsSheet({
|
|
|
15866
16191
|
children: t("pet.settings.builtin")
|
|
15867
16192
|
}
|
|
15868
16193
|
),
|
|
15869
|
-
/* @__PURE__ */
|
|
16194
|
+
/* @__PURE__ */ jsxs38(
|
|
15870
16195
|
Select,
|
|
15871
16196
|
{
|
|
15872
16197
|
value: selectedBuiltinPet.id,
|
|
@@ -15877,26 +16202,26 @@ function SettingsSheet({
|
|
|
15877
16202
|
}
|
|
15878
16203
|
},
|
|
15879
16204
|
children: [
|
|
15880
|
-
/* @__PURE__ */
|
|
16205
|
+
/* @__PURE__ */ jsx56(
|
|
15881
16206
|
SelectTrigger,
|
|
15882
16207
|
{
|
|
15883
16208
|
id: "chatkit-pet-builtin",
|
|
15884
16209
|
className: "min-h-12 w-full px-3 py-2",
|
|
15885
|
-
children: /* @__PURE__ */
|
|
16210
|
+
children: /* @__PURE__ */ jsx56(SelectValue, { placeholder: selectedBuiltinPetLabel })
|
|
15886
16211
|
}
|
|
15887
16212
|
),
|
|
15888
|
-
/* @__PURE__ */
|
|
16213
|
+
/* @__PURE__ */ jsx56(SelectContent, { className: "w-[var(--radix-select-trigger-width)]", children: /* @__PURE__ */ jsx56(SelectGroup, { children: INCLUDED_PET_OPTIONS.map((pet) => {
|
|
15889
16214
|
const label = t(`pet.settings.builtins.${pet.id}`, {
|
|
15890
16215
|
defaultValue: pet.label
|
|
15891
16216
|
});
|
|
15892
|
-
return /* @__PURE__ */
|
|
16217
|
+
return /* @__PURE__ */ jsx56(
|
|
15893
16218
|
SelectItem,
|
|
15894
16219
|
{
|
|
15895
16220
|
value: pet.id,
|
|
15896
16221
|
className: "min-h-10 py-1.5 pl-2 pr-8",
|
|
15897
|
-
children: /* @__PURE__ */
|
|
15898
|
-
/* @__PURE__ */
|
|
15899
|
-
/* @__PURE__ */
|
|
16222
|
+
children: /* @__PURE__ */ jsxs38("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
16223
|
+
/* @__PURE__ */ jsx56(PetPreview, { src: pet.previewSrc, label }),
|
|
16224
|
+
/* @__PURE__ */ jsx56("span", { className: "min-w-0 truncate", children: label })
|
|
15900
16225
|
] })
|
|
15901
16226
|
},
|
|
15902
16227
|
pet.id
|
|
@@ -15906,8 +16231,8 @@ function SettingsSheet({
|
|
|
15906
16231
|
}
|
|
15907
16232
|
)
|
|
15908
16233
|
] }),
|
|
15909
|
-
draft.characterType === "atlas" && /* @__PURE__ */
|
|
15910
|
-
/* @__PURE__ */
|
|
16234
|
+
draft.characterType === "atlas" && /* @__PURE__ */ jsxs38("div", { className: "space-y-2", children: [
|
|
16235
|
+
/* @__PURE__ */ jsx56(
|
|
15911
16236
|
"label",
|
|
15912
16237
|
{
|
|
15913
16238
|
className: "text-sm font-medium",
|
|
@@ -15915,7 +16240,7 @@ function SettingsSheet({
|
|
|
15915
16240
|
children: t("pet.settings.atlasUrl")
|
|
15916
16241
|
}
|
|
15917
16242
|
),
|
|
15918
|
-
/* @__PURE__ */
|
|
16243
|
+
/* @__PURE__ */ jsx56(
|
|
15919
16244
|
Input,
|
|
15920
16245
|
{
|
|
15921
16246
|
id: "chatkit-pet-atlas",
|
|
@@ -15925,15 +16250,15 @@ function SettingsSheet({
|
|
|
15925
16250
|
}
|
|
15926
16251
|
)
|
|
15927
16252
|
] }),
|
|
15928
|
-
/* @__PURE__ */
|
|
15929
|
-
/* @__PURE__ */
|
|
15930
|
-
/* @__PURE__ */
|
|
15931
|
-
/* @__PURE__ */
|
|
16253
|
+
/* @__PURE__ */ jsxs38("div", { className: "space-y-2", children: [
|
|
16254
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex items-center justify-between gap-4", children: [
|
|
16255
|
+
/* @__PURE__ */ jsx56("label", { className: "text-sm font-medium", htmlFor: "chatkit-pet-scale", children: t("pet.settings.scale") }),
|
|
16256
|
+
/* @__PURE__ */ jsxs38("span", { className: "text-xs tabular-nums text-muted-foreground", children: [
|
|
15932
16257
|
draft.scale.toFixed(2),
|
|
15933
16258
|
"x"
|
|
15934
16259
|
] })
|
|
15935
16260
|
] }),
|
|
15936
|
-
/* @__PURE__ */
|
|
16261
|
+
/* @__PURE__ */ jsx56(
|
|
15937
16262
|
Slider,
|
|
15938
16263
|
{
|
|
15939
16264
|
id: "chatkit-pet-scale",
|
|
@@ -15947,8 +16272,8 @@ function SettingsSheet({
|
|
|
15947
16272
|
}
|
|
15948
16273
|
)
|
|
15949
16274
|
] }),
|
|
15950
|
-
/* @__PURE__ */
|
|
15951
|
-
/* @__PURE__ */
|
|
16275
|
+
/* @__PURE__ */ jsxs38("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
16276
|
+
/* @__PURE__ */ jsx56(
|
|
15952
16277
|
"input",
|
|
15953
16278
|
{
|
|
15954
16279
|
type: "checkbox",
|
|
@@ -15959,8 +16284,8 @@ function SettingsSheet({
|
|
|
15959
16284
|
),
|
|
15960
16285
|
t("pet.settings.draggable")
|
|
15961
16286
|
] }),
|
|
15962
|
-
/* @__PURE__ */
|
|
15963
|
-
/* @__PURE__ */
|
|
16287
|
+
/* @__PURE__ */ jsxs38("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
16288
|
+
/* @__PURE__ */ jsx56(
|
|
15964
16289
|
"input",
|
|
15965
16290
|
{
|
|
15966
16291
|
type: "checkbox",
|
|
@@ -15971,8 +16296,8 @@ function SettingsSheet({
|
|
|
15971
16296
|
),
|
|
15972
16297
|
t("pet.settings.persistPosition")
|
|
15973
16298
|
] }),
|
|
15974
|
-
/* @__PURE__ */
|
|
15975
|
-
/* @__PURE__ */
|
|
16299
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex justify-end gap-2 pt-2", children: [
|
|
16300
|
+
/* @__PURE__ */ jsx56(
|
|
15976
16301
|
Button,
|
|
15977
16302
|
{
|
|
15978
16303
|
type: "button",
|
|
@@ -15981,7 +16306,7 @@ function SettingsSheet({
|
|
|
15981
16306
|
children: t("pet.settings.cancel")
|
|
15982
16307
|
}
|
|
15983
16308
|
),
|
|
15984
|
-
/* @__PURE__ */
|
|
16309
|
+
/* @__PURE__ */ jsx56(Button, { type: "submit", children: t("pet.settings.save") })
|
|
15985
16310
|
] })
|
|
15986
16311
|
] })
|
|
15987
16312
|
] }) });
|
|
@@ -16608,21 +16933,21 @@ function findDomPointForComposerOffset(root, offset) {
|
|
|
16608
16933
|
}
|
|
16609
16934
|
|
|
16610
16935
|
// src/workbench/WorkbenchShell.tsx
|
|
16611
|
-
import * as
|
|
16936
|
+
import * as React52 from "react";
|
|
16612
16937
|
import {
|
|
16613
16938
|
ASSISTANT_CHAT_SEND_MESSAGE_COMMAND,
|
|
16614
16939
|
ASSISTANT_CONTEXT_SET_COMMAND
|
|
16615
16940
|
} from "@xpert-ai/xpert-sdk";
|
|
16616
16941
|
import {
|
|
16617
|
-
Loader2 as
|
|
16942
|
+
Loader2 as Loader210,
|
|
16618
16943
|
Maximize2,
|
|
16619
16944
|
Minimize2,
|
|
16620
16945
|
PanelRight,
|
|
16621
16946
|
RotateCcw,
|
|
16622
|
-
X as
|
|
16947
|
+
X as X8
|
|
16623
16948
|
} from "lucide-react";
|
|
16624
|
-
import { Fragment as
|
|
16625
|
-
var WorkbenchContext =
|
|
16949
|
+
import { Fragment as Fragment9, jsx as jsx57, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
16950
|
+
var WorkbenchContext = React52.createContext({
|
|
16626
16951
|
enabled: false,
|
|
16627
16952
|
open: false,
|
|
16628
16953
|
loading: false,
|
|
@@ -16630,7 +16955,7 @@ var WorkbenchContext = React51.createContext({
|
|
|
16630
16955
|
toggle: () => void 0
|
|
16631
16956
|
});
|
|
16632
16957
|
function useWorkbench() {
|
|
16633
|
-
return
|
|
16958
|
+
return React52.useContext(WorkbenchContext);
|
|
16634
16959
|
}
|
|
16635
16960
|
function WorkbenchToggleButton() {
|
|
16636
16961
|
const workbench = useWorkbench();
|
|
@@ -16638,8 +16963,8 @@ function WorkbenchToggleButton() {
|
|
|
16638
16963
|
if (!workbench.enabled || workbench.open) return null;
|
|
16639
16964
|
const label = t("workbench.open");
|
|
16640
16965
|
const tooltip = workbench.disabledReason ?? label;
|
|
16641
|
-
return /* @__PURE__ */
|
|
16642
|
-
/* @__PURE__ */
|
|
16966
|
+
return /* @__PURE__ */ jsxs39(Tooltip, { children: [
|
|
16967
|
+
/* @__PURE__ */ jsx57(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx57("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ jsx57(
|
|
16643
16968
|
"button",
|
|
16644
16969
|
{
|
|
16645
16970
|
type: "button",
|
|
@@ -16652,17 +16977,17 @@ function WorkbenchToggleButton() {
|
|
|
16652
16977
|
),
|
|
16653
16978
|
"aria-label": label,
|
|
16654
16979
|
"aria-expanded": false,
|
|
16655
|
-
children: workbench.loading ? /* @__PURE__ */
|
|
16980
|
+
children: workbench.loading ? /* @__PURE__ */ jsx57(Loader210, { size: 16, className: "animate-spin" }) : /* @__PURE__ */ jsx57(PanelRight, { size: 16 })
|
|
16656
16981
|
}
|
|
16657
16982
|
) }) }),
|
|
16658
|
-
/* @__PURE__ */
|
|
16983
|
+
/* @__PURE__ */ jsx57(TooltipContent, { side: "bottom", children: tooltip })
|
|
16659
16984
|
] });
|
|
16660
16985
|
}
|
|
16661
16986
|
|
|
16662
16987
|
// src/components/chat/runtime-capabilities.tsx
|
|
16663
|
-
import * as
|
|
16664
|
-
import { X as
|
|
16665
|
-
import { jsx as
|
|
16988
|
+
import * as React53 from "react";
|
|
16989
|
+
import { X as X9 } from "lucide-react";
|
|
16990
|
+
import { jsx as jsx58, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
16666
16991
|
function createComposerCapabilityInsertionParts(options) {
|
|
16667
16992
|
return options.flatMap((option) => [
|
|
16668
16993
|
createComposerCapabilityPart(option, createMessageId()),
|
|
@@ -16735,29 +17060,29 @@ function useRuntimeCapabilitiesState({
|
|
|
16735
17060
|
disabled,
|
|
16736
17061
|
composerParts
|
|
16737
17062
|
}) {
|
|
16738
|
-
const [runtimeCapabilities, setRuntimeCapabilities] =
|
|
16739
|
-
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] =
|
|
16740
|
-
const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] =
|
|
17063
|
+
const [runtimeCapabilities, setRuntimeCapabilities] = React53.useState(null);
|
|
17064
|
+
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] = React53.useState(false);
|
|
17065
|
+
const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] = React53.useState(
|
|
16741
17066
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
16742
17067
|
);
|
|
16743
|
-
const [runRuntimeCapabilities, setRunRuntimeCapabilities] =
|
|
17068
|
+
const [runRuntimeCapabilities, setRunRuntimeCapabilities] = React53.useState(
|
|
16744
17069
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
16745
17070
|
);
|
|
16746
|
-
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] =
|
|
16747
|
-
const runtimeCapabilityPreferenceLoadRef =
|
|
16748
|
-
const pendingExternalRuntimeCapabilitiesRef =
|
|
16749
|
-
const runtimeCapabilityOptions =
|
|
17071
|
+
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] = React53.useState(null);
|
|
17072
|
+
const runtimeCapabilityPreferenceLoadRef = React53.useRef(0);
|
|
17073
|
+
const pendingExternalRuntimeCapabilitiesRef = React53.useRef(null);
|
|
17074
|
+
const runtimeCapabilityOptions = React53.useMemo(
|
|
16750
17075
|
() => getRuntimeCapabilityOptions(runtimeCapabilities),
|
|
16751
17076
|
[runtimeCapabilities]
|
|
16752
17077
|
);
|
|
16753
|
-
const effectiveSessionRuntimeCapabilities =
|
|
17078
|
+
const effectiveSessionRuntimeCapabilities = React53.useMemo(
|
|
16754
17079
|
() => runtimeCapabilitiesReady && runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
16755
17080
|
runtimeCapabilities,
|
|
16756
17081
|
sessionRuntimeCapabilities
|
|
16757
17082
|
) : null,
|
|
16758
17083
|
[runtimeCapabilities, runtimeCapabilitiesReady, sessionRuntimeCapabilities]
|
|
16759
17084
|
);
|
|
16760
|
-
const runRuntimeCapabilityOptions =
|
|
17085
|
+
const runRuntimeCapabilityOptions = React53.useMemo(
|
|
16761
17086
|
() => runtimeCapabilityOptions.filter(
|
|
16762
17087
|
(option) => isRuntimeCapabilitySelected(
|
|
16763
17088
|
runRuntimeCapabilities,
|
|
@@ -16767,11 +17092,11 @@ function useRuntimeCapabilitiesState({
|
|
|
16767
17092
|
),
|
|
16768
17093
|
[runRuntimeCapabilities, runtimeCapabilityOptions]
|
|
16769
17094
|
);
|
|
16770
|
-
const composerRuntimeCapabilitySelectionKeys =
|
|
17095
|
+
const composerRuntimeCapabilitySelectionKeys = React53.useMemo(
|
|
16771
17096
|
() => getComposerCapabilitySelectionKeys(composerParts),
|
|
16772
17097
|
[composerParts]
|
|
16773
17098
|
);
|
|
16774
|
-
const detachedRunRuntimeCapabilityOptions =
|
|
17099
|
+
const detachedRunRuntimeCapabilityOptions = React53.useMemo(
|
|
16775
17100
|
() => runRuntimeCapabilityOptions.filter(
|
|
16776
17101
|
(option) => !composerRuntimeCapabilitySelectionKeys.has(
|
|
16777
17102
|
getRuntimeCapabilityOptionKey(option)
|
|
@@ -16779,7 +17104,7 @@ function useRuntimeCapabilitiesState({
|
|
|
16779
17104
|
),
|
|
16780
17105
|
[composerRuntimeCapabilitySelectionKeys, runRuntimeCapabilityOptions]
|
|
16781
17106
|
);
|
|
16782
|
-
const persistSessionRuntimeCapabilities =
|
|
17107
|
+
const persistSessionRuntimeCapabilities = React53.useCallback(
|
|
16783
17108
|
async (nextThreadId, selection) => {
|
|
16784
17109
|
if (!runtimeCapabilities || !selection || !client) {
|
|
16785
17110
|
return;
|
|
@@ -16804,7 +17129,7 @@ function useRuntimeCapabilitiesState({
|
|
|
16804
17129
|
},
|
|
16805
17130
|
[client, runtimeCapabilities]
|
|
16806
17131
|
);
|
|
16807
|
-
const applyExternalRuntimeCapabilities =
|
|
17132
|
+
const applyExternalRuntimeCapabilities = React53.useCallback(
|
|
16808
17133
|
(selection) => {
|
|
16809
17134
|
pendingExternalRuntimeCapabilitiesRef.current = selection;
|
|
16810
17135
|
setRunRuntimeCapabilities(() => {
|
|
@@ -16825,7 +17150,7 @@ function useRuntimeCapabilitiesState({
|
|
|
16825
17150
|
},
|
|
16826
17151
|
[runtimeCapabilities]
|
|
16827
17152
|
);
|
|
16828
|
-
const handleSessionRuntimeCapabilityToggle =
|
|
17153
|
+
const handleSessionRuntimeCapabilityToggle = React53.useCallback(
|
|
16829
17154
|
(type, id, selected) => {
|
|
16830
17155
|
setSessionRuntimeCapabilities((previous) => {
|
|
16831
17156
|
const nextSelection = toggleRuntimeCapabilitySelection(
|
|
@@ -16846,7 +17171,7 @@ function useRuntimeCapabilitiesState({
|
|
|
16846
17171
|
},
|
|
16847
17172
|
[persistSessionRuntimeCapabilities, threadId]
|
|
16848
17173
|
);
|
|
16849
|
-
const addRunRuntimeCapabilities =
|
|
17174
|
+
const addRunRuntimeCapabilities = React53.useCallback(
|
|
16850
17175
|
(selection) => {
|
|
16851
17176
|
setRunRuntimeCapabilities(
|
|
16852
17177
|
(previous) => runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
@@ -16858,13 +17183,13 @@ function useRuntimeCapabilitiesState({
|
|
|
16858
17183
|
},
|
|
16859
17184
|
[runtimeCapabilities]
|
|
16860
17185
|
);
|
|
16861
|
-
const resetRunRuntimeCapabilities =
|
|
17186
|
+
const resetRunRuntimeCapabilities = React53.useCallback(() => {
|
|
16862
17187
|
setRunRuntimeCapabilities(
|
|
16863
17188
|
createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
|
|
16864
17189
|
);
|
|
16865
17190
|
setRuntimeCapabilityPalette(null);
|
|
16866
17191
|
}, [runtimeCapabilities]);
|
|
16867
|
-
const getRuntimeCapabilitiesForSubmit =
|
|
17192
|
+
const getRuntimeCapabilitiesForSubmit = React53.useCallback(
|
|
16868
17193
|
(recommended) => {
|
|
16869
17194
|
const recommendedRuntimeCapabilitiesForSubmit = recommended && runtimeCapabilities && runtimeCapabilitiesReady ? mergeRuntimeCapabilitiesSelections(
|
|
16870
17195
|
runtimeCapabilities,
|
|
@@ -16895,7 +17220,7 @@ function useRuntimeCapabilitiesState({
|
|
|
16895
17220
|
runtimeCapabilityOptions
|
|
16896
17221
|
]
|
|
16897
17222
|
);
|
|
16898
|
-
const getRuntimeCapabilitiesForCommand =
|
|
17223
|
+
const getRuntimeCapabilitiesForCommand = React53.useCallback(
|
|
16899
17224
|
(recommended) => runtimeCapabilities && runtimeCapabilitiesReady ? createRuntimeCapabilitiesForSubmit({
|
|
16900
17225
|
capabilities: runtimeCapabilities,
|
|
16901
17226
|
available: effectiveSessionRuntimeCapabilities,
|
|
@@ -16907,7 +17232,7 @@ function useRuntimeCapabilitiesState({
|
|
|
16907
17232
|
runtimeCapabilitiesReady
|
|
16908
17233
|
]
|
|
16909
17234
|
);
|
|
16910
|
-
|
|
17235
|
+
React53.useEffect(() => {
|
|
16911
17236
|
if (disabled || !client || !assistantId) {
|
|
16912
17237
|
pendingExternalRuntimeCapabilitiesRef.current = null;
|
|
16913
17238
|
setRuntimeCapabilities(null);
|
|
@@ -16955,7 +17280,7 @@ function useRuntimeCapabilitiesState({
|
|
|
16955
17280
|
});
|
|
16956
17281
|
return () => controller.abort();
|
|
16957
17282
|
}, [assistantId, client, disabled]);
|
|
16958
|
-
|
|
17283
|
+
React53.useEffect(() => {
|
|
16959
17284
|
const emptyRunSelection = createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities);
|
|
16960
17285
|
const pendingExternalSelection = pendingExternalRuntimeCapabilitiesRef.current;
|
|
16961
17286
|
if (pendingExternalSelection && runtimeCapabilities) {
|
|
@@ -17047,8 +17372,8 @@ function useRuntimeCapabilityComposerActions({
|
|
|
17047
17372
|
commitComposerParts,
|
|
17048
17373
|
focusComposerAt
|
|
17049
17374
|
}) {
|
|
17050
|
-
const pendingExternalRuntimeCapabilityInsertRef =
|
|
17051
|
-
const insertExternalRuntimeCapabilities =
|
|
17375
|
+
const pendingExternalRuntimeCapabilityInsertRef = React53.useRef(null);
|
|
17376
|
+
const insertExternalRuntimeCapabilities = React53.useCallback(
|
|
17052
17377
|
(selection, options) => {
|
|
17053
17378
|
applyExternalRuntimeCapabilities(selection);
|
|
17054
17379
|
if (!selection) {
|
|
@@ -17103,7 +17428,7 @@ function useRuntimeCapabilityComposerActions({
|
|
|
17103
17428
|
setRuntimeCapabilityPalette
|
|
17104
17429
|
]
|
|
17105
17430
|
);
|
|
17106
|
-
const applyComposerValueRuntimeCapabilities =
|
|
17431
|
+
const applyComposerValueRuntimeCapabilities = React53.useCallback(
|
|
17107
17432
|
(payload, options) => {
|
|
17108
17433
|
const runtimeCapabilitiesPayload = isRuntimeCapabilitiesSelection(
|
|
17109
17434
|
payload.runtimeCapabilities
|
|
@@ -17119,7 +17444,7 @@ function useRuntimeCapabilityComposerActions({
|
|
|
17119
17444
|
},
|
|
17120
17445
|
[applyExternalRuntimeCapabilities, insertExternalRuntimeCapabilities]
|
|
17121
17446
|
);
|
|
17122
|
-
const updateRuntimeCapabilityPalette =
|
|
17447
|
+
const updateRuntimeCapabilityPalette = React53.useCallback(
|
|
17123
17448
|
(parts, selectionStart) => {
|
|
17124
17449
|
const input = composerInputRef.current;
|
|
17125
17450
|
const editingText = getComposerEditingText(parts);
|
|
@@ -17131,7 +17456,7 @@ function useRuntimeCapabilityComposerActions({
|
|
|
17131
17456
|
},
|
|
17132
17457
|
[composerInputRef, setRuntimeCapabilityPalette]
|
|
17133
17458
|
);
|
|
17134
|
-
const removeRunRuntimeCapability =
|
|
17459
|
+
const removeRunRuntimeCapability = React53.useCallback(
|
|
17135
17460
|
(option) => {
|
|
17136
17461
|
setRunRuntimeCapabilities(
|
|
17137
17462
|
(previous) => toggleRuntimeCapabilitySelection(
|
|
@@ -17151,7 +17476,7 @@ function useRuntimeCapabilityComposerActions({
|
|
|
17151
17476
|
},
|
|
17152
17477
|
[commitComposerParts, composerPartsRef, setRunRuntimeCapabilities]
|
|
17153
17478
|
);
|
|
17154
|
-
const insertComposerCapabilityToken =
|
|
17479
|
+
const insertComposerCapabilityToken = React53.useCallback(
|
|
17155
17480
|
(capability, range) => {
|
|
17156
17481
|
const replacementParts = createComposerCapabilityInsertionParts([
|
|
17157
17482
|
capability
|
|
@@ -17192,7 +17517,7 @@ function useRuntimeCapabilityComposerActions({
|
|
|
17192
17517
|
setRuntimeCapabilityPalette
|
|
17193
17518
|
]
|
|
17194
17519
|
);
|
|
17195
|
-
|
|
17520
|
+
React53.useEffect(() => {
|
|
17196
17521
|
if (!runtimeCapabilitiesReady || !runtimeCapabilities) {
|
|
17197
17522
|
return;
|
|
17198
17523
|
}
|
|
@@ -17222,16 +17547,16 @@ function HumanRuntimeCapabilityChips({
|
|
|
17222
17547
|
if (options.length === 0) {
|
|
17223
17548
|
return null;
|
|
17224
17549
|
}
|
|
17225
|
-
return /* @__PURE__ */
|
|
17550
|
+
return /* @__PURE__ */ jsx58("div", { className: "mb-2 flex flex-wrap gap-1.5", children: options.map((option) => {
|
|
17226
17551
|
const color = option.type === "skill" ? void 0 : getRuntimeCapabilityColor(option);
|
|
17227
|
-
return /* @__PURE__ */
|
|
17552
|
+
return /* @__PURE__ */ jsxs40(
|
|
17228
17553
|
"span",
|
|
17229
17554
|
{
|
|
17230
17555
|
className: "inline-flex max-w-full items-center gap-1 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs font-medium text-primary-foreground",
|
|
17231
17556
|
style: color ? { color } : void 0,
|
|
17232
17557
|
children: [
|
|
17233
|
-
/* @__PURE__ */
|
|
17234
|
-
/* @__PURE__ */
|
|
17558
|
+
/* @__PURE__ */ jsx58(RuntimeCapabilityIcon, { option, variant: "chip" }),
|
|
17559
|
+
/* @__PURE__ */ jsx58("span", { className: "max-w-[9rem] truncate", children: option.label })
|
|
17235
17560
|
]
|
|
17236
17561
|
},
|
|
17237
17562
|
`${option.type}:${option.id}`
|
|
@@ -17247,19 +17572,19 @@ function DetachedRunRuntimeCapabilities({
|
|
|
17247
17572
|
if (options.length === 0) {
|
|
17248
17573
|
return null;
|
|
17249
17574
|
}
|
|
17250
|
-
return /* @__PURE__ */
|
|
17251
|
-
/* @__PURE__ */
|
|
17575
|
+
return /* @__PURE__ */ jsxs40("div", { className: "mb-2 flex flex-wrap items-center gap-2", children: [
|
|
17576
|
+
/* @__PURE__ */ jsx58("span", { className: "text-xs text-muted-foreground", children: runOnlyLabel }),
|
|
17252
17577
|
options.map((option) => {
|
|
17253
17578
|
const color = getRuntimeCapabilityColor(option);
|
|
17254
|
-
return /* @__PURE__ */
|
|
17579
|
+
return /* @__PURE__ */ jsxs40(
|
|
17255
17580
|
"span",
|
|
17256
17581
|
{
|
|
17257
17582
|
className: "inline-flex max-w-full items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",
|
|
17258
17583
|
style: color ? { color } : void 0,
|
|
17259
17584
|
children: [
|
|
17260
|
-
/* @__PURE__ */
|
|
17261
|
-
/* @__PURE__ */
|
|
17262
|
-
/* @__PURE__ */
|
|
17585
|
+
/* @__PURE__ */ jsx58(RuntimeCapabilityIcon, { option, variant: "chip" }),
|
|
17586
|
+
/* @__PURE__ */ jsx58("span", { className: "max-w-40 truncate", children: option.label }),
|
|
17587
|
+
/* @__PURE__ */ jsx58(
|
|
17263
17588
|
"button",
|
|
17264
17589
|
{
|
|
17265
17590
|
type: "button",
|
|
@@ -17267,7 +17592,7 @@ function DetachedRunRuntimeCapabilities({
|
|
|
17267
17592
|
className: "rounded-full p-0.5 hover:bg-primary/15",
|
|
17268
17593
|
title: removeLabel,
|
|
17269
17594
|
"aria-label": removeLabel,
|
|
17270
|
-
children: /* @__PURE__ */
|
|
17595
|
+
children: /* @__PURE__ */ jsx58(X9, { size: 11 })
|
|
17271
17596
|
}
|
|
17272
17597
|
)
|
|
17273
17598
|
]
|
|
@@ -17281,7 +17606,7 @@ function ComposerCapabilityToken({
|
|
|
17281
17606
|
part
|
|
17282
17607
|
}) {
|
|
17283
17608
|
const color = getRuntimeCapabilityColor(part.capability);
|
|
17284
|
-
return /* @__PURE__ */
|
|
17609
|
+
return /* @__PURE__ */ jsxs40(
|
|
17285
17610
|
"span",
|
|
17286
17611
|
{
|
|
17287
17612
|
"data-composer-capability-key": part.key,
|
|
@@ -17291,8 +17616,8 @@ function ComposerCapabilityToken({
|
|
|
17291
17616
|
className: "mx-0.5 inline-flex max-w-[14rem] select-none items-center gap-1 text-sm font-semibold text-primary align-baseline",
|
|
17292
17617
|
style: color ? { color } : void 0,
|
|
17293
17618
|
children: [
|
|
17294
|
-
/* @__PURE__ */
|
|
17295
|
-
/* @__PURE__ */
|
|
17619
|
+
/* @__PURE__ */ jsx58(RuntimeCapabilityIcon, { option: part.capability, variant: "chip" }),
|
|
17620
|
+
/* @__PURE__ */ jsx58("span", { className: "truncate", children: part.capability.label })
|
|
17296
17621
|
]
|
|
17297
17622
|
},
|
|
17298
17623
|
part.key
|
|
@@ -17552,30 +17877,30 @@ function buildMessageNavigationItems(messages, options) {
|
|
|
17552
17877
|
}
|
|
17553
17878
|
|
|
17554
17879
|
// src/hooks/useTaskSummary.ts
|
|
17555
|
-
import * as
|
|
17880
|
+
import * as React54 from "react";
|
|
17556
17881
|
function useTaskSummary({
|
|
17557
17882
|
enabled,
|
|
17558
17883
|
conversationId,
|
|
17559
17884
|
client,
|
|
17560
17885
|
live
|
|
17561
17886
|
}) {
|
|
17562
|
-
const [loaded, setLoaded] =
|
|
17563
|
-
const [historySections, setHistorySections] =
|
|
17564
|
-
const [historySectionsConversationId, setHistorySectionsConversationId] =
|
|
17565
|
-
const [loadingSections, setLoadingSections] =
|
|
17566
|
-
const [error, setError] =
|
|
17567
|
-
const [retryVersion, setRetryVersion] =
|
|
17568
|
-
const requestVersionRef =
|
|
17569
|
-
const conversationIdRef =
|
|
17570
|
-
const sectionControllersRef =
|
|
17887
|
+
const [loaded, setLoaded] = React54.useState(null);
|
|
17888
|
+
const [historySections, setHistorySections] = React54.useState({});
|
|
17889
|
+
const [historySectionsConversationId, setHistorySectionsConversationId] = React54.useState(null);
|
|
17890
|
+
const [loadingSections, setLoadingSections] = React54.useState({});
|
|
17891
|
+
const [error, setError] = React54.useState(null);
|
|
17892
|
+
const [retryVersion, setRetryVersion] = React54.useState(0);
|
|
17893
|
+
const requestVersionRef = React54.useRef(0);
|
|
17894
|
+
const conversationIdRef = React54.useRef(conversationId);
|
|
17895
|
+
const sectionControllersRef = React54.useRef(
|
|
17571
17896
|
/* @__PURE__ */ new Map()
|
|
17572
17897
|
);
|
|
17573
17898
|
conversationIdRef.current = conversationId;
|
|
17574
|
-
const abortSectionRequests =
|
|
17899
|
+
const abortSectionRequests = React54.useCallback(() => {
|
|
17575
17900
|
sectionControllersRef.current.forEach((controller) => controller.abort());
|
|
17576
17901
|
sectionControllersRef.current.clear();
|
|
17577
17902
|
}, []);
|
|
17578
|
-
|
|
17903
|
+
React54.useEffect(() => {
|
|
17579
17904
|
abortSectionRequests();
|
|
17580
17905
|
setHistorySections({});
|
|
17581
17906
|
setHistorySectionsConversationId(conversationId);
|
|
@@ -17604,11 +17929,11 @@ function useTaskSummary({
|
|
|
17604
17929
|
};
|
|
17605
17930
|
}, [abortSectionRequests, client, conversationId, enabled, retryVersion]);
|
|
17606
17931
|
const snapshot = loaded?.conversationId === conversationId ? loaded.snapshot : null;
|
|
17607
|
-
const activeHistorySections =
|
|
17932
|
+
const activeHistorySections = React54.useMemo(
|
|
17608
17933
|
() => historySectionsConversationId === conversationId ? historySections : {},
|
|
17609
17934
|
[conversationId, historySections, historySectionsConversationId]
|
|
17610
17935
|
);
|
|
17611
|
-
const loadSection =
|
|
17936
|
+
const loadSection = React54.useCallback(
|
|
17612
17937
|
async (section) => {
|
|
17613
17938
|
if (!enabled || !conversationId || loadingSections[section]) {
|
|
17614
17939
|
return;
|
|
@@ -17668,7 +17993,7 @@ function useTaskSummary({
|
|
|
17668
17993
|
}
|
|
17669
17994
|
|
|
17670
17995
|
// src/components/task-summary/TaskSummary.tsx
|
|
17671
|
-
import * as
|
|
17996
|
+
import * as React55 from "react";
|
|
17672
17997
|
import {
|
|
17673
17998
|
Bot as Bot4,
|
|
17674
17999
|
BookOpen as BookOpen3,
|
|
@@ -17677,12 +18002,12 @@ import {
|
|
|
17677
18002
|
ExternalLink,
|
|
17678
18003
|
FileOutput,
|
|
17679
18004
|
ListChecks as ListChecks3,
|
|
17680
|
-
Loader2 as
|
|
18005
|
+
Loader2 as Loader211,
|
|
17681
18006
|
PlayCircle,
|
|
17682
18007
|
RotateCcw as RotateCcw2,
|
|
17683
18008
|
Target as Target2
|
|
17684
18009
|
} from "lucide-react";
|
|
17685
|
-
import { jsx as
|
|
18010
|
+
import { jsx as jsx59, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
17686
18011
|
var PREVIEW_SIZE = 3;
|
|
17687
18012
|
function TaskSummaryTrigger({
|
|
17688
18013
|
displayMode = "popover",
|
|
@@ -17691,9 +18016,9 @@ function TaskSummaryTrigger({
|
|
|
17691
18016
|
...props
|
|
17692
18017
|
}) {
|
|
17693
18018
|
const { t } = useChatkitTranslation();
|
|
17694
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
18019
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React55.useState(false);
|
|
17695
18020
|
const open = controlledOpen ?? uncontrolledOpen;
|
|
17696
|
-
const setOpen =
|
|
18021
|
+
const setOpen = React55.useCallback(
|
|
17697
18022
|
(nextOpen) => {
|
|
17698
18023
|
if (controlledOpen === void 0) {
|
|
17699
18024
|
setUncontrolledOpen(nextOpen);
|
|
@@ -17702,7 +18027,7 @@ function TaskSummaryTrigger({
|
|
|
17702
18027
|
},
|
|
17703
18028
|
[controlledOpen, onOpenChange]
|
|
17704
18029
|
);
|
|
17705
|
-
const triggerButton = /* @__PURE__ */
|
|
18030
|
+
const triggerButton = /* @__PURE__ */ jsx59(
|
|
17706
18031
|
"button",
|
|
17707
18032
|
{
|
|
17708
18033
|
type: "button",
|
|
@@ -17710,28 +18035,28 @@ function TaskSummaryTrigger({
|
|
|
17710
18035
|
"aria-label": t("taskSummary.open"),
|
|
17711
18036
|
"aria-expanded": open,
|
|
17712
18037
|
onClick: displayMode === "docked" ? () => setOpen(!open) : void 0,
|
|
17713
|
-
children: /* @__PURE__ */
|
|
18038
|
+
children: /* @__PURE__ */ jsx59(ListChecks3, { size: 16 })
|
|
17714
18039
|
}
|
|
17715
18040
|
);
|
|
17716
18041
|
if (displayMode === "docked") {
|
|
17717
|
-
return /* @__PURE__ */
|
|
17718
|
-
/* @__PURE__ */
|
|
17719
|
-
/* @__PURE__ */
|
|
18042
|
+
return /* @__PURE__ */ jsxs41(Tooltip, { children: [
|
|
18043
|
+
/* @__PURE__ */ jsx59(TooltipTrigger, { asChild: true, children: triggerButton }),
|
|
18044
|
+
/* @__PURE__ */ jsx59(TooltipContent, { side: "bottom", children: t("taskSummary.open") })
|
|
17720
18045
|
] });
|
|
17721
18046
|
}
|
|
17722
|
-
return /* @__PURE__ */
|
|
17723
|
-
/* @__PURE__ */
|
|
17724
|
-
/* @__PURE__ */
|
|
17725
|
-
/* @__PURE__ */
|
|
18047
|
+
return /* @__PURE__ */ jsxs41(Popover, { open, onOpenChange: setOpen, children: [
|
|
18048
|
+
/* @__PURE__ */ jsxs41(Tooltip, { children: [
|
|
18049
|
+
/* @__PURE__ */ jsx59(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx59(PopoverTrigger, { asChild: true, children: triggerButton }) }),
|
|
18050
|
+
/* @__PURE__ */ jsx59(TooltipContent, { side: "bottom", children: t("taskSummary.open") })
|
|
17726
18051
|
] }),
|
|
17727
|
-
/* @__PURE__ */
|
|
18052
|
+
/* @__PURE__ */ jsx59(
|
|
17728
18053
|
PopoverContent,
|
|
17729
18054
|
{
|
|
17730
18055
|
align: "end",
|
|
17731
18056
|
sideOffset: 8,
|
|
17732
18057
|
className: "w-[min(20rem,calc(100vw-2rem))] max-h-[min(44rem,calc(100vh-5rem))] overflow-y-auto rounded-2xl border-border/70 bg-popover p-0 shadow-lg",
|
|
17733
18058
|
"aria-label": t("taskSummary.title"),
|
|
17734
|
-
children: /* @__PURE__ */
|
|
18059
|
+
children: /* @__PURE__ */ jsx59(TaskSummaryContent, { ...props })
|
|
17735
18060
|
}
|
|
17736
18061
|
)
|
|
17737
18062
|
] });
|
|
@@ -17741,7 +18066,7 @@ function TaskSummaryPanel({
|
|
|
17741
18066
|
...props
|
|
17742
18067
|
}) {
|
|
17743
18068
|
const { t } = useChatkitTranslation();
|
|
17744
|
-
return /* @__PURE__ */
|
|
18069
|
+
return /* @__PURE__ */ jsx59(
|
|
17745
18070
|
"aside",
|
|
17746
18071
|
{
|
|
17747
18072
|
"data-slot": "task-summary-panel",
|
|
@@ -17750,7 +18075,7 @@ function TaskSummaryPanel({
|
|
|
17750
18075
|
"h-fit max-h-full overflow-y-auto rounded-2xl border border-border/70 bg-popover text-popover-foreground shadow-lg",
|
|
17751
18076
|
className
|
|
17752
18077
|
),
|
|
17753
|
-
children: /* @__PURE__ */
|
|
18078
|
+
children: /* @__PURE__ */ jsx59(TaskSummaryContent, { ...props })
|
|
17754
18079
|
}
|
|
17755
18080
|
);
|
|
17756
18081
|
}
|
|
@@ -17766,7 +18091,7 @@ function TaskSummaryContent({
|
|
|
17766
18091
|
onOpenResource
|
|
17767
18092
|
}) {
|
|
17768
18093
|
const { t } = useChatkitTranslation();
|
|
17769
|
-
const [expanded, setExpanded] =
|
|
18094
|
+
const [expanded, setExpanded] = React55.useState({});
|
|
17770
18095
|
const hasTask = Boolean(
|
|
17771
18096
|
summary.goal || summary.plan || summary.todos?.items.length
|
|
17772
18097
|
);
|
|
@@ -17798,7 +18123,7 @@ function TaskSummaryContent({
|
|
|
17798
18123
|
if (total2 <= PREVIEW_SIZE && !expanded[section]) return null;
|
|
17799
18124
|
const loading = loadingSections[section];
|
|
17800
18125
|
const canLoadMore = Boolean(expanded[section]) && loadedSectionCounts[section] < total2;
|
|
17801
|
-
return /* @__PURE__ */
|
|
18126
|
+
return /* @__PURE__ */ jsxs41(
|
|
17802
18127
|
"button",
|
|
17803
18128
|
{
|
|
17804
18129
|
type: "button",
|
|
@@ -17806,41 +18131,41 @@ function TaskSummaryContent({
|
|
|
17806
18131
|
disabled: loading,
|
|
17807
18132
|
onClick: () => canLoadMore ? void onLoadSection(section) : toggleSection(section),
|
|
17808
18133
|
children: [
|
|
17809
|
-
loading && /* @__PURE__ */
|
|
17810
|
-
!loading && /* @__PURE__ */
|
|
18134
|
+
loading && /* @__PURE__ */ jsx59(Loader211, { className: "size-3 animate-spin" }),
|
|
18135
|
+
!loading && /* @__PURE__ */ jsx59(ListChecks3, { className: "size-3.5" }),
|
|
17811
18136
|
canLoadMore ? t("taskSummary.loadMore") : expanded[section] ? t("taskSummary.collapse") : t("taskSummary.viewAll", { count: total2 })
|
|
17812
18137
|
]
|
|
17813
18138
|
}
|
|
17814
18139
|
);
|
|
17815
18140
|
};
|
|
17816
|
-
return /* @__PURE__ */
|
|
17817
|
-
Boolean(historyError) && /* @__PURE__ */
|
|
17818
|
-
/* @__PURE__ */
|
|
17819
|
-
/* @__PURE__ */
|
|
18141
|
+
return /* @__PURE__ */ jsxs41("div", { className: "divide-y divide-border/70", children: [
|
|
18142
|
+
Boolean(historyError) && /* @__PURE__ */ jsxs41("div", { className: "m-3 flex items-start justify-between gap-3 rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 text-xs text-destructive", children: [
|
|
18143
|
+
/* @__PURE__ */ jsx59("span", { children: t("taskSummary.historyError") }),
|
|
18144
|
+
/* @__PURE__ */ jsxs41(
|
|
17820
18145
|
"button",
|
|
17821
18146
|
{
|
|
17822
18147
|
type: "button",
|
|
17823
18148
|
className: "inline-flex shrink-0 items-center gap-1 font-medium hover:underline",
|
|
17824
18149
|
onClick: onRetryHistory,
|
|
17825
18150
|
children: [
|
|
17826
|
-
/* @__PURE__ */
|
|
18151
|
+
/* @__PURE__ */ jsx59(RotateCcw2, { className: "size-3" }),
|
|
17827
18152
|
t("taskSummary.retry")
|
|
17828
18153
|
]
|
|
17829
18154
|
}
|
|
17830
18155
|
)
|
|
17831
18156
|
] }),
|
|
17832
|
-
/* @__PURE__ */
|
|
18157
|
+
/* @__PURE__ */ jsxs41(
|
|
17833
18158
|
SummarySection,
|
|
17834
18159
|
{
|
|
17835
18160
|
title: t("taskSummary.sections.outputs"),
|
|
17836
18161
|
children: [
|
|
17837
|
-
summary.outputs.length === 0 ? /* @__PURE__ */
|
|
18162
|
+
summary.outputs.length === 0 ? /* @__PURE__ */ jsx59(SummaryPrompt, { onClick: onFocusComposer, children: t("taskSummary.createOutput") }) : sectionItems("outputs", summary.outputs).map((item) => /* @__PURE__ */ jsx59(
|
|
17838
18163
|
SummaryButton,
|
|
17839
18164
|
{
|
|
17840
18165
|
title: item.title,
|
|
17841
18166
|
description: item.description ?? item.status,
|
|
17842
|
-
leading: /* @__PURE__ */
|
|
17843
|
-
trailing: item.resource && item.resource.type !== "message" ? /* @__PURE__ */
|
|
18167
|
+
leading: /* @__PURE__ */ jsx59(FileOutput, { className: "size-4" }),
|
|
18168
|
+
trailing: item.resource && item.resource.type !== "message" ? /* @__PURE__ */ jsx59(ExternalLink, { className: "size-3.5" }) : void 0,
|
|
17844
18169
|
onClick: () => openSummaryItem(item.resource, item.messageId, item.title)
|
|
17845
18170
|
},
|
|
17846
18171
|
item.id
|
|
@@ -17849,18 +18174,18 @@ function TaskSummaryContent({
|
|
|
17849
18174
|
]
|
|
17850
18175
|
}
|
|
17851
18176
|
),
|
|
17852
|
-
/* @__PURE__ */
|
|
18177
|
+
/* @__PURE__ */ jsxs41(
|
|
17853
18178
|
SummarySection,
|
|
17854
18179
|
{
|
|
17855
18180
|
title: t("taskSummary.sections.sources"),
|
|
17856
18181
|
children: [
|
|
17857
|
-
sectionItems("sources", summary.sources).map((item) => /* @__PURE__ */
|
|
18182
|
+
sectionItems("sources", summary.sources).map((item) => /* @__PURE__ */ jsx59(
|
|
17858
18183
|
SummaryButton,
|
|
17859
18184
|
{
|
|
17860
18185
|
title: item.title,
|
|
17861
18186
|
description: item.description,
|
|
17862
|
-
leading: /* @__PURE__ */
|
|
17863
|
-
trailing: item.resource && item.resource.type !== "message" ? /* @__PURE__ */
|
|
18187
|
+
leading: /* @__PURE__ */ jsx59(BookOpen3, { className: "size-4" }),
|
|
18188
|
+
trailing: item.resource && item.resource.type !== "message" ? /* @__PURE__ */ jsx59(ExternalLink, { className: "size-3.5" }) : void 0,
|
|
17864
18189
|
onClick: () => openSummaryItem(item.resource, item.messageId, item.title)
|
|
17865
18190
|
},
|
|
17866
18191
|
item.id
|
|
@@ -17869,67 +18194,67 @@ function TaskSummaryContent({
|
|
|
17869
18194
|
]
|
|
17870
18195
|
}
|
|
17871
18196
|
),
|
|
17872
|
-
hasTask && /* @__PURE__ */
|
|
17873
|
-
summary.goal && /* @__PURE__ */
|
|
18197
|
+
hasTask && /* @__PURE__ */ jsxs41(SummarySection, { title: t("taskSummary.sections.task"), children: [
|
|
18198
|
+
summary.goal && /* @__PURE__ */ jsx59(
|
|
17874
18199
|
SummaryButton,
|
|
17875
18200
|
{
|
|
17876
18201
|
title: summary.goal.objective,
|
|
17877
18202
|
description: summary.goal.status,
|
|
17878
|
-
leading: /* @__PURE__ */
|
|
18203
|
+
leading: /* @__PURE__ */ jsx59(Target2, { className: "size-4" }),
|
|
17879
18204
|
onClick: onFocusComposer
|
|
17880
18205
|
}
|
|
17881
18206
|
),
|
|
17882
|
-
summary.plan && /* @__PURE__ */
|
|
18207
|
+
summary.plan && /* @__PURE__ */ jsx59(
|
|
17883
18208
|
SummaryButton,
|
|
17884
18209
|
{
|
|
17885
18210
|
title: summary.plan.title,
|
|
17886
18211
|
description: summary.plan.excerpt,
|
|
17887
|
-
leading: /* @__PURE__ */
|
|
18212
|
+
leading: /* @__PURE__ */ jsx59(ListChecks3, { className: "size-4" }),
|
|
17888
18213
|
onClick: () => summary.plan?.messageId ? onNavigateMessage(summary.plan.messageId) : onFocusComposer()
|
|
17889
18214
|
}
|
|
17890
18215
|
),
|
|
17891
|
-
(summary.todos?.items ?? []).slice(0, PREVIEW_SIZE).map((todo) => /* @__PURE__ */
|
|
18216
|
+
(summary.todos?.items ?? []).slice(0, PREVIEW_SIZE).map((todo) => /* @__PURE__ */ jsx59(
|
|
17892
18217
|
SummaryButton,
|
|
17893
18218
|
{
|
|
17894
18219
|
title: todo.content,
|
|
17895
18220
|
description: t(`taskSummary.status.${todo.status}`),
|
|
17896
|
-
leading: todo.status === "completed" ? /* @__PURE__ */
|
|
18221
|
+
leading: todo.status === "completed" ? /* @__PURE__ */ jsx59(CheckCircle25, { className: "size-4 text-muted-foreground" }) : /* @__PURE__ */ jsx59(CircleEllipsis, { className: "size-4 text-muted-foreground" }),
|
|
17897
18222
|
onClick: () => summary.todos?.messageId ? onNavigateMessage(summary.todos.messageId) : onFocusComposer()
|
|
17898
18223
|
},
|
|
17899
18224
|
todo.id
|
|
17900
18225
|
))
|
|
17901
18226
|
] }),
|
|
17902
|
-
summary.running.length > 0 && /* @__PURE__ */
|
|
18227
|
+
summary.running.length > 0 && /* @__PURE__ */ jsx59(SummarySection, { title: t("taskSummary.sections.running"), children: summary.running.slice(0, PREVIEW_SIZE).map((item) => /* @__PURE__ */ jsx59(
|
|
17903
18228
|
SummaryButton,
|
|
17904
18229
|
{
|
|
17905
18230
|
title: item.title,
|
|
17906
18231
|
description: item.description ?? item.status,
|
|
17907
|
-
leading: /* @__PURE__ */
|
|
17908
|
-
trailing: item.resource ? /* @__PURE__ */
|
|
18232
|
+
leading: /* @__PURE__ */ jsx59(PlayCircle, { className: "size-4" }),
|
|
18233
|
+
trailing: item.resource ? /* @__PURE__ */ jsx59(ExternalLink, { className: "size-3.5" }) : void 0,
|
|
17909
18234
|
onClick: () => item.resource && onOpenResource(item.resource, void 0, item.title)
|
|
17910
18235
|
},
|
|
17911
18236
|
item.id
|
|
17912
18237
|
)) }),
|
|
17913
|
-
summary.agents.length > 0 && /* @__PURE__ */
|
|
17914
|
-
sectionItems("agents", summary.agents).map((item) => /* @__PURE__ */
|
|
18238
|
+
summary.agents.length > 0 && /* @__PURE__ */ jsxs41(SummarySection, { title: t("taskSummary.sections.agents"), children: [
|
|
18239
|
+
sectionItems("agents", summary.agents).map((item) => /* @__PURE__ */ jsx59(
|
|
17915
18240
|
SummaryButton,
|
|
17916
18241
|
{
|
|
17917
18242
|
title: item.title,
|
|
17918
18243
|
description: [item.status, formatElapsed(item.elapsedTime)].filter(Boolean).join(" \xB7 "),
|
|
17919
|
-
leading: /* @__PURE__ */
|
|
18244
|
+
leading: /* @__PURE__ */ jsx59(Bot4, { className: "size-4" }),
|
|
17920
18245
|
onClick: () => item.messageId ? onNavigateMessage(item.messageId) : onFocusComposer()
|
|
17921
18246
|
},
|
|
17922
18247
|
item.id
|
|
17923
18248
|
)),
|
|
17924
18249
|
sectionAction("agents", summary.totals.agents)
|
|
17925
18250
|
] }),
|
|
17926
|
-
summary.pending.length > 0 && /* @__PURE__ */
|
|
17927
|
-
sectionItems("pending", summary.pending).map((item) => /* @__PURE__ */
|
|
18251
|
+
summary.pending.length > 0 && /* @__PURE__ */ jsxs41(SummarySection, { title: t("taskSummary.sections.pending"), children: [
|
|
18252
|
+
sectionItems("pending", summary.pending).map((item) => /* @__PURE__ */ jsx59(
|
|
17928
18253
|
SummaryButton,
|
|
17929
18254
|
{
|
|
17930
18255
|
title: item.title,
|
|
17931
18256
|
description: item.description,
|
|
17932
|
-
leading: /* @__PURE__ */
|
|
18257
|
+
leading: /* @__PURE__ */ jsx59(CircleEllipsis, { className: "size-4" }),
|
|
17933
18258
|
onClick: () => item.messageId ? onNavigateMessage(item.messageId) : onFocusComposer()
|
|
17934
18259
|
},
|
|
17935
18260
|
item.id
|
|
@@ -17942,16 +18267,16 @@ function SummarySection({
|
|
|
17942
18267
|
title,
|
|
17943
18268
|
children
|
|
17944
18269
|
}) {
|
|
17945
|
-
return /* @__PURE__ */
|
|
17946
|
-
/* @__PURE__ */
|
|
17947
|
-
/* @__PURE__ */
|
|
18270
|
+
return /* @__PURE__ */ jsxs41("section", { "aria-label": title, className: "px-4 py-3", children: [
|
|
18271
|
+
/* @__PURE__ */ jsx59("div", { className: "flex min-h-7 items-center justify-between gap-3", children: /* @__PURE__ */ jsx59("h3", { className: "text-sm font-medium text-muted-foreground", children: title }) }),
|
|
18272
|
+
/* @__PURE__ */ jsx59("div", { className: "mt-1 space-y-0.5", children })
|
|
17948
18273
|
] });
|
|
17949
18274
|
}
|
|
17950
18275
|
function SummaryPrompt({
|
|
17951
18276
|
children,
|
|
17952
18277
|
onClick
|
|
17953
18278
|
}) {
|
|
17954
|
-
return /* @__PURE__ */
|
|
18279
|
+
return /* @__PURE__ */ jsx59(
|
|
17955
18280
|
"button",
|
|
17956
18281
|
{
|
|
17957
18282
|
type: "button",
|
|
@@ -17968,7 +18293,7 @@ function SummaryButton({
|
|
|
17968
18293
|
trailing,
|
|
17969
18294
|
onClick
|
|
17970
18295
|
}) {
|
|
17971
|
-
return /* @__PURE__ */
|
|
18296
|
+
return /* @__PURE__ */ jsxs41(
|
|
17972
18297
|
"button",
|
|
17973
18298
|
{
|
|
17974
18299
|
type: "button",
|
|
@@ -17980,12 +18305,12 @@ function SummaryButton({
|
|
|
17980
18305
|
!onClick && "cursor-default"
|
|
17981
18306
|
),
|
|
17982
18307
|
children: [
|
|
17983
|
-
leading && /* @__PURE__ */
|
|
17984
|
-
/* @__PURE__ */
|
|
17985
|
-
/* @__PURE__ */
|
|
17986
|
-
description && /* @__PURE__ */
|
|
18308
|
+
leading && /* @__PURE__ */ jsx59("span", { className: "mt-0.5 shrink-0 text-muted-foreground", children: leading }),
|
|
18309
|
+
/* @__PURE__ */ jsxs41("span", { className: "min-w-0 flex-1", children: [
|
|
18310
|
+
/* @__PURE__ */ jsx59("span", { className: "block truncate text-sm font-medium leading-5 text-foreground", children: title }),
|
|
18311
|
+
description && /* @__PURE__ */ jsx59("span", { className: "mt-0.5 block line-clamp-2 text-xs text-muted-foreground", children: description })
|
|
17987
18312
|
] }),
|
|
17988
|
-
trailing && /* @__PURE__ */
|
|
18313
|
+
trailing && /* @__PURE__ */ jsx59("span", { className: "mt-0.5 text-muted-foreground", children: trailing })
|
|
17989
18314
|
]
|
|
17990
18315
|
}
|
|
17991
18316
|
);
|
|
@@ -17997,7 +18322,7 @@ function formatElapsed(value) {
|
|
|
17997
18322
|
}
|
|
17998
18323
|
|
|
17999
18324
|
// src/components/chat.tsx
|
|
18000
|
-
import { Fragment as
|
|
18325
|
+
import { Fragment as Fragment11, jsx as jsx60, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
18001
18326
|
var defaultApiUrl2 = import.meta.env.VITE_XPERTAI_API_URL;
|
|
18002
18327
|
var COMPOSER_INPUT_MAX_HEIGHT = 128;
|
|
18003
18328
|
var LONG_TEXT_REFERENCE_THRESHOLD = 5e3;
|
|
@@ -18103,8 +18428,8 @@ function ReferenceChip({
|
|
|
18103
18428
|
}) {
|
|
18104
18429
|
const metaLine = getReferenceMetaLine(reference);
|
|
18105
18430
|
const isComposer = variant === "composer";
|
|
18106
|
-
const Icon = reference.type === "quote" ? Quote : reference.type === "image" ?
|
|
18107
|
-
return /* @__PURE__ */
|
|
18431
|
+
const Icon = reference.type === "quote" ? Quote : reference.type === "image" ? ImageIcon2 : FileText5;
|
|
18432
|
+
return /* @__PURE__ */ jsxs42(
|
|
18108
18433
|
"div",
|
|
18109
18434
|
{
|
|
18110
18435
|
className: cn(
|
|
@@ -18113,7 +18438,7 @@ function ReferenceChip({
|
|
|
18113
18438
|
),
|
|
18114
18439
|
title: getReferenceTitle(reference),
|
|
18115
18440
|
children: [
|
|
18116
|
-
/* @__PURE__ */
|
|
18441
|
+
/* @__PURE__ */ jsx60(
|
|
18117
18442
|
Icon,
|
|
18118
18443
|
{
|
|
18119
18444
|
size: isComposer ? 14 : 12,
|
|
@@ -18123,8 +18448,8 @@ function ReferenceChip({
|
|
|
18123
18448
|
)
|
|
18124
18449
|
}
|
|
18125
18450
|
),
|
|
18126
|
-
/* @__PURE__ */
|
|
18127
|
-
/* @__PURE__ */
|
|
18451
|
+
/* @__PURE__ */ jsxs42("div", { className: "min-w-0 flex-1", children: [
|
|
18452
|
+
/* @__PURE__ */ jsx60(
|
|
18128
18453
|
"div",
|
|
18129
18454
|
{
|
|
18130
18455
|
className: cn(
|
|
@@ -18134,7 +18459,7 @@ function ReferenceChip({
|
|
|
18134
18459
|
children: getReferenceLabel(reference)
|
|
18135
18460
|
}
|
|
18136
18461
|
),
|
|
18137
|
-
metaLine && /* @__PURE__ */
|
|
18462
|
+
metaLine && /* @__PURE__ */ jsx60(
|
|
18138
18463
|
"div",
|
|
18139
18464
|
{
|
|
18140
18465
|
className: cn(
|
|
@@ -18145,7 +18470,7 @@ function ReferenceChip({
|
|
|
18145
18470
|
}
|
|
18146
18471
|
)
|
|
18147
18472
|
] }),
|
|
18148
|
-
onRemove && removeLabel && /* @__PURE__ */
|
|
18473
|
+
onRemove && removeLabel && /* @__PURE__ */ jsx60(
|
|
18149
18474
|
"button",
|
|
18150
18475
|
{
|
|
18151
18476
|
type: "button",
|
|
@@ -18156,7 +18481,7 @@ function ReferenceChip({
|
|
|
18156
18481
|
),
|
|
18157
18482
|
title: removeLabel,
|
|
18158
18483
|
"aria-label": removeLabel,
|
|
18159
|
-
children: /* @__PURE__ */
|
|
18484
|
+
children: /* @__PURE__ */ jsx60(X10, { size: 12 })
|
|
18160
18485
|
}
|
|
18161
18486
|
)
|
|
18162
18487
|
]
|
|
@@ -18187,7 +18512,7 @@ function Chat({
|
|
|
18187
18512
|
clientSecret: effectiveClientSecret
|
|
18188
18513
|
});
|
|
18189
18514
|
const missingConfig = Boolean(missingConfigKind);
|
|
18190
|
-
const missingConfigShortMessage =
|
|
18515
|
+
const missingConfigShortMessage = React56.useMemo(() => {
|
|
18191
18516
|
switch (missingConfigKind) {
|
|
18192
18517
|
case "apiUrl":
|
|
18193
18518
|
return t("chat.missingApiUrlShort");
|
|
@@ -18199,7 +18524,7 @@ function Chat({
|
|
|
18199
18524
|
return t("chat.missingConfigShort");
|
|
18200
18525
|
}
|
|
18201
18526
|
}, [missingConfigKind, t]);
|
|
18202
|
-
const missingConfigDetailMessage =
|
|
18527
|
+
const missingConfigDetailMessage = React56.useMemo(() => {
|
|
18203
18528
|
switch (missingConfigKind) {
|
|
18204
18529
|
case "apiUrl":
|
|
18205
18530
|
return t("chat.missingApiUrlDetail");
|
|
@@ -18211,26 +18536,26 @@ function Chat({
|
|
|
18211
18536
|
return t("chat.missingConfigDetail");
|
|
18212
18537
|
}
|
|
18213
18538
|
}, [missingConfigKind, t]);
|
|
18214
|
-
const [isHistoryLoading, setIsHistoryLoading] =
|
|
18215
|
-
const [historyError, setHistoryError] =
|
|
18216
|
-
const [assistantName, setAssistantName] =
|
|
18217
|
-
const [assistantAvatar, setAssistantAvatar] =
|
|
18218
|
-
const [threadGoal, setThreadGoal] =
|
|
18219
|
-
const [goalError, setGoalError] =
|
|
18220
|
-
const [isGoalLoading, setIsGoalLoading] =
|
|
18221
|
-
const [isGoalPanelOpen, setIsGoalPanelOpen] =
|
|
18222
|
-
const [isGoalObjectiveExpanded, setIsGoalObjectiveExpanded] =
|
|
18223
|
-
const [goalElapsedStartedAt, setGoalElapsedStartedAt] =
|
|
18539
|
+
const [isHistoryLoading, setIsHistoryLoading] = React56.useState(false);
|
|
18540
|
+
const [historyError, setHistoryError] = React56.useState(null);
|
|
18541
|
+
const [assistantName, setAssistantName] = React56.useState(null);
|
|
18542
|
+
const [assistantAvatar, setAssistantAvatar] = React56.useState(null);
|
|
18543
|
+
const [threadGoal, setThreadGoal] = React56.useState(null);
|
|
18544
|
+
const [goalError, setGoalError] = React56.useState(null);
|
|
18545
|
+
const [isGoalLoading, setIsGoalLoading] = React56.useState(false);
|
|
18546
|
+
const [isGoalPanelOpen, setIsGoalPanelOpen] = React56.useState(false);
|
|
18547
|
+
const [isGoalObjectiveExpanded, setIsGoalObjectiveExpanded] = React56.useState(false);
|
|
18548
|
+
const [goalElapsedStartedAt, setGoalElapsedStartedAt] = React56.useState(null);
|
|
18224
18549
|
const LOADING_DOTS_MIN_DURATION = 800;
|
|
18225
18550
|
const STREAMING_STATUS_REFRESH_MS = 250;
|
|
18226
|
-
const [showLoadingDots, setShowLoadingDots] =
|
|
18227
|
-
const [streamingNow, setStreamingNow] =
|
|
18228
|
-
const loadingStartTimeRef =
|
|
18229
|
-
const lastStreamOutputAtRef =
|
|
18230
|
-
|
|
18551
|
+
const [showLoadingDots, setShowLoadingDots] = React56.useState(false);
|
|
18552
|
+
const [streamingNow, setStreamingNow] = React56.useState(() => Date.now());
|
|
18553
|
+
const loadingStartTimeRef = React56.useRef(null);
|
|
18554
|
+
const lastStreamOutputAtRef = React56.useRef(null);
|
|
18555
|
+
React56.useEffect(() => {
|
|
18231
18556
|
setStream(stream);
|
|
18232
18557
|
}, [setStream, stream]);
|
|
18233
|
-
|
|
18558
|
+
React56.useEffect(() => {
|
|
18234
18559
|
if (stream.isLoading) {
|
|
18235
18560
|
if (!loadingStartTimeRef.current) {
|
|
18236
18561
|
loadingStartTimeRef.current = Date.now();
|
|
@@ -18253,7 +18578,7 @@ function Chat({
|
|
|
18253
18578
|
}
|
|
18254
18579
|
}
|
|
18255
18580
|
}, [stream.isLoading]);
|
|
18256
|
-
|
|
18581
|
+
React56.useEffect(() => {
|
|
18257
18582
|
if (!stream.isLoading) {
|
|
18258
18583
|
lastStreamOutputAtRef.current = null;
|
|
18259
18584
|
setStreamingNow(Date.now());
|
|
@@ -18263,7 +18588,7 @@ function Chat({
|
|
|
18263
18588
|
lastStreamOutputAtRef.current = now;
|
|
18264
18589
|
setStreamingNow(now);
|
|
18265
18590
|
}, [stream.messages, stream.isLoading]);
|
|
18266
|
-
|
|
18591
|
+
React56.useEffect(() => {
|
|
18267
18592
|
if (!stream.isLoading) {
|
|
18268
18593
|
return;
|
|
18269
18594
|
}
|
|
@@ -18272,7 +18597,7 @@ function Chat({
|
|
|
18272
18597
|
}, STREAMING_STATUS_REFRESH_MS);
|
|
18273
18598
|
return () => window.clearInterval(timer);
|
|
18274
18599
|
}, [stream.isLoading]);
|
|
18275
|
-
|
|
18600
|
+
React56.useEffect(() => {
|
|
18276
18601
|
if (threadGoal?.status === "active" && stream.isLoading) {
|
|
18277
18602
|
setGoalElapsedStartedAt(Date.now());
|
|
18278
18603
|
return;
|
|
@@ -18284,55 +18609,56 @@ function Chat({
|
|
|
18284
18609
|
threadGoal?.id,
|
|
18285
18610
|
threadGoal?.status
|
|
18286
18611
|
]);
|
|
18287
|
-
|
|
18612
|
+
React56.useEffect(() => {
|
|
18288
18613
|
setIsGoalObjectiveExpanded(false);
|
|
18289
18614
|
}, [threadGoal?.id]);
|
|
18290
|
-
const [composerParts, setComposerParts] =
|
|
18291
|
-
const [renderedComposerParts, setRenderedComposerParts] =
|
|
18292
|
-
const [composerDomVersion, setComposerDomVersion] =
|
|
18293
|
-
const [selectedTool, setSelectedTool] =
|
|
18615
|
+
const [composerParts, setComposerParts] = React56.useState([]);
|
|
18616
|
+
const [renderedComposerParts, setRenderedComposerParts] = React56.useState([]);
|
|
18617
|
+
const [composerDomVersion, setComposerDomVersion] = React56.useState(0);
|
|
18618
|
+
const [selectedTool, setSelectedTool] = React56.useState(
|
|
18294
18619
|
null
|
|
18295
18620
|
);
|
|
18296
|
-
const [planModeEnabled, setPlanModeEnabled] =
|
|
18297
|
-
const [petSettingsOpen, setPetSettingsOpen] =
|
|
18298
|
-
const [petLocalSettings, setPetLocalSettings] =
|
|
18299
|
-
const [attachmentState, setAttachmentState] =
|
|
18621
|
+
const [planModeEnabled, setPlanModeEnabled] = React56.useState(false);
|
|
18622
|
+
const [petSettingsOpen, setPetSettingsOpen] = React56.useState(false);
|
|
18623
|
+
const [petLocalSettings, setPetLocalSettings] = React56.useState(() => readPetLocalSettings());
|
|
18624
|
+
const [attachmentState, setAttachmentState] = React56.useState({
|
|
18300
18625
|
uploadedFiles: [],
|
|
18301
18626
|
hasUploadingFiles: false,
|
|
18302
18627
|
hasParsingFiles: false
|
|
18303
18628
|
});
|
|
18304
|
-
const [references, setReferences] =
|
|
18305
|
-
const [isUploadingReferenceImages, setIsUploadingReferenceImages] =
|
|
18306
|
-
const [quoteSelection, setQuoteSelection] =
|
|
18307
|
-
const [isAtBottom, setIsAtBottom] =
|
|
18308
|
-
const [hasUpdatesBelow, setHasUpdatesBelow] =
|
|
18629
|
+
const [references, setReferences] = React56.useState([]);
|
|
18630
|
+
const [isUploadingReferenceImages, setIsUploadingReferenceImages] = React56.useState(false);
|
|
18631
|
+
const [quoteSelection, setQuoteSelection] = React56.useState(null);
|
|
18632
|
+
const [isAtBottom, setIsAtBottom] = React56.useState(true);
|
|
18633
|
+
const [hasUpdatesBelow, setHasUpdatesBelow] = React56.useState(false);
|
|
18309
18634
|
const {
|
|
18310
18635
|
threads,
|
|
18311
18636
|
deleteThread,
|
|
18312
18637
|
refreshThreads,
|
|
18313
18638
|
isLoading: isThreadsLoading
|
|
18314
18639
|
} = useThreads();
|
|
18315
|
-
const viewportRef =
|
|
18316
|
-
const chatColumnRef =
|
|
18317
|
-
const messageNavigationAnchorsRef =
|
|
18640
|
+
const viewportRef = React56.useRef(null);
|
|
18641
|
+
const chatColumnRef = React56.useRef(null);
|
|
18642
|
+
const messageNavigationAnchorsRef = React56.useRef(
|
|
18318
18643
|
/* @__PURE__ */ new Map()
|
|
18319
18644
|
);
|
|
18320
|
-
const attachmentsRef =
|
|
18321
|
-
const composerInputRef =
|
|
18322
|
-
const
|
|
18323
|
-
const
|
|
18645
|
+
const attachmentsRef = React56.useRef(null);
|
|
18646
|
+
const composerInputRef = React56.useRef(null);
|
|
18647
|
+
const isComposerComposingRef = React56.useRef(false);
|
|
18648
|
+
const slashPaletteRef = React56.useRef(null);
|
|
18649
|
+
const slashPaletteOptionRefs = React56.useRef(
|
|
18324
18650
|
[]
|
|
18325
18651
|
);
|
|
18326
|
-
const composerPartsRef =
|
|
18327
|
-
const pendingComposerCaretOffsetRef =
|
|
18328
|
-
const shouldAutoScrollRef =
|
|
18329
|
-
const forceFollowRef =
|
|
18330
|
-
const previousMessageCountRef =
|
|
18331
|
-
const previousScrollTopRef =
|
|
18332
|
-
const isPrependingHistoryMessagesRef =
|
|
18333
|
-
const autoScrollFrameRef =
|
|
18334
|
-
const isPointerDownRef =
|
|
18335
|
-
const lastTouchYRef =
|
|
18652
|
+
const composerPartsRef = React56.useRef([]);
|
|
18653
|
+
const pendingComposerCaretOffsetRef = React56.useRef(null);
|
|
18654
|
+
const shouldAutoScrollRef = React56.useRef(true);
|
|
18655
|
+
const forceFollowRef = React56.useRef(false);
|
|
18656
|
+
const previousMessageCountRef = React56.useRef(0);
|
|
18657
|
+
const previousScrollTopRef = React56.useRef(0);
|
|
18658
|
+
const isPrependingHistoryMessagesRef = React56.useRef(false);
|
|
18659
|
+
const autoScrollFrameRef = React56.useRef(null);
|
|
18660
|
+
const isPointerDownRef = React56.useRef(false);
|
|
18661
|
+
const lastTouchYRef = React56.useRef(null);
|
|
18336
18662
|
const {
|
|
18337
18663
|
runtimeCapabilities,
|
|
18338
18664
|
runtimeCapabilitiesReady,
|
|
@@ -18361,24 +18687,24 @@ function Chat({
|
|
|
18361
18687
|
const resolvedPlaceholder = placeholder ?? t("chat.placeholder");
|
|
18362
18688
|
const assistantTitle = assistantName || resolvedTitle;
|
|
18363
18689
|
const petRequired = options?.displayMode === "pet";
|
|
18364
|
-
const basePetSettings =
|
|
18690
|
+
const basePetSettings = React56.useMemo(
|
|
18365
18691
|
() => derivePetLocalSettings(options?.pet),
|
|
18366
18692
|
[options?.pet]
|
|
18367
18693
|
);
|
|
18368
|
-
const displayedPetSettings =
|
|
18694
|
+
const displayedPetSettings = React56.useMemo(
|
|
18369
18695
|
() => ({
|
|
18370
18696
|
...petLocalSettings ?? basePetSettings,
|
|
18371
18697
|
...petRequired ? { enabled: true } : {}
|
|
18372
18698
|
}),
|
|
18373
18699
|
[basePetSettings, petLocalSettings, petRequired]
|
|
18374
18700
|
);
|
|
18375
|
-
const effectivePet =
|
|
18701
|
+
const effectivePet = React56.useMemo(() => {
|
|
18376
18702
|
if (petRequired || petLocalSettings) {
|
|
18377
18703
|
return buildPetOptionsFromLocalSettings(displayedPetSettings);
|
|
18378
18704
|
}
|
|
18379
18705
|
return options?.pet ?? null;
|
|
18380
18706
|
}, [displayedPetSettings, options?.pet, petLocalSettings, petRequired]);
|
|
18381
|
-
const savePetLocalSettings =
|
|
18707
|
+
const savePetLocalSettings = React56.useCallback(
|
|
18382
18708
|
(settings) => {
|
|
18383
18709
|
const nextSettings = petRequired ? { ...settings, enabled: true } : settings;
|
|
18384
18710
|
setPetLocalSettings(nextSettings);
|
|
@@ -18386,7 +18712,7 @@ function Chat({
|
|
|
18386
18712
|
},
|
|
18387
18713
|
[petRequired]
|
|
18388
18714
|
);
|
|
18389
|
-
const handlePetCommand =
|
|
18715
|
+
const handlePetCommand = React56.useCallback(
|
|
18390
18716
|
(mode) => {
|
|
18391
18717
|
if (mode === "settings") {
|
|
18392
18718
|
setPetSettingsOpen(true);
|
|
@@ -18408,11 +18734,11 @@ function Chat({
|
|
|
18408
18734
|
[displayedPetSettings, effectivePet, petRequired, savePetLocalSettings]
|
|
18409
18735
|
);
|
|
18410
18736
|
const inputPlaceholder = selectedTool?.placeholderOverride ?? composer?.placeholder ?? resolvedPlaceholder;
|
|
18411
|
-
const messages =
|
|
18737
|
+
const messages = React56.useMemo(
|
|
18412
18738
|
() => stream.messages ?? [],
|
|
18413
18739
|
[stream.messages]
|
|
18414
18740
|
);
|
|
18415
|
-
const messageNavigationLabels =
|
|
18741
|
+
const messageNavigationLabels = React56.useMemo(
|
|
18416
18742
|
() => ({
|
|
18417
18743
|
user: t("chat.youLabel"),
|
|
18418
18744
|
assistant: assistantTitle,
|
|
@@ -18431,7 +18757,7 @@ function Chat({
|
|
|
18431
18757
|
}),
|
|
18432
18758
|
[assistantTitle, t]
|
|
18433
18759
|
);
|
|
18434
|
-
const messageNavigationItems =
|
|
18760
|
+
const messageNavigationItems = React56.useMemo(
|
|
18435
18761
|
() => messageNavigationEnabled ? buildMessageNavigationItems(
|
|
18436
18762
|
messages,
|
|
18437
18763
|
{
|
|
@@ -18454,7 +18780,7 @@ function Chat({
|
|
|
18454
18780
|
historyMessagePagination?.isLoadingMore
|
|
18455
18781
|
);
|
|
18456
18782
|
const canLoadMoreMessages = Boolean(historyMessagePagination?.hasMore);
|
|
18457
|
-
const draft =
|
|
18783
|
+
const draft = React56.useMemo(
|
|
18458
18784
|
() => getComposerPlainText(composerParts),
|
|
18459
18785
|
[composerParts]
|
|
18460
18786
|
);
|
|
@@ -18468,7 +18794,7 @@ function Chat({
|
|
|
18468
18794
|
isEmpty: isComposerInputEmpty,
|
|
18469
18795
|
isStacked: isComposerStacked
|
|
18470
18796
|
});
|
|
18471
|
-
const pendingFollowUps =
|
|
18797
|
+
const pendingFollowUps = React56.useMemo(
|
|
18472
18798
|
() => sortVisiblePendingFollowUps(stream.pendingFollowUps ?? []),
|
|
18473
18799
|
[stream.pendingFollowUps]
|
|
18474
18800
|
);
|
|
@@ -18477,7 +18803,7 @@ function Chat({
|
|
|
18477
18803
|
const hasPendingHITLRequest = Boolean(stream.pendingHITLRequest);
|
|
18478
18804
|
const hasPendingInteractiveRequest = hasPendingRequestUserInput || hasPendingHITLRequest;
|
|
18479
18805
|
const hasPendingTodos = Boolean(stream.todos?.items.length);
|
|
18480
|
-
const goalAdapter =
|
|
18806
|
+
const goalAdapter = React56.useMemo(() => {
|
|
18481
18807
|
if (isGoalAdapter(options?.goal)) {
|
|
18482
18808
|
return options.goal;
|
|
18483
18809
|
}
|
|
@@ -18490,10 +18816,10 @@ function Chat({
|
|
|
18490
18816
|
"goal"
|
|
18491
18817
|
);
|
|
18492
18818
|
const showGoalStatus = goalCommandAvailable && !hasCompletedGoal && (Boolean(goalError) || threadGoal?.status === "active" && stream.isLoading);
|
|
18493
|
-
const clearQuoteSelection =
|
|
18819
|
+
const clearQuoteSelection = React56.useCallback(() => {
|
|
18494
18820
|
setQuoteSelection(null);
|
|
18495
18821
|
}, []);
|
|
18496
|
-
const commitComposerParts =
|
|
18822
|
+
const commitComposerParts = React56.useCallback(
|
|
18497
18823
|
(nextParts, options2) => {
|
|
18498
18824
|
const normalized = normalizeComposerParts(nextParts);
|
|
18499
18825
|
const previous = composerPartsRef.current;
|
|
@@ -18523,7 +18849,7 @@ function Chat({
|
|
|
18523
18849
|
},
|
|
18524
18850
|
[setRunRuntimeCapabilities]
|
|
18525
18851
|
);
|
|
18526
|
-
const setComposerText =
|
|
18852
|
+
const setComposerText = React56.useCallback(
|
|
18527
18853
|
(text, caretOffset = text.length) => {
|
|
18528
18854
|
commitComposerParts(createComposerTextParts(text), {
|
|
18529
18855
|
caretOffset,
|
|
@@ -18533,7 +18859,7 @@ function Chat({
|
|
|
18533
18859
|
},
|
|
18534
18860
|
[commitComposerParts]
|
|
18535
18861
|
);
|
|
18536
|
-
const focusComposerAt =
|
|
18862
|
+
const focusComposerAt = React56.useCallback((position) => {
|
|
18537
18863
|
const nextPosition = position ?? getComposerEditingLength(composerPartsRef.current);
|
|
18538
18864
|
pendingComposerCaretOffsetRef.current = nextPosition;
|
|
18539
18865
|
requestAnimationFrame(() => {
|
|
@@ -18562,7 +18888,7 @@ function Chat({
|
|
|
18562
18888
|
focusComposerAt
|
|
18563
18889
|
});
|
|
18564
18890
|
const parentMessenger = useParentMessenger({
|
|
18565
|
-
onSetComposerValue:
|
|
18891
|
+
onSetComposerValue: React56.useCallback(
|
|
18566
18892
|
(payload) => {
|
|
18567
18893
|
if (!payload) {
|
|
18568
18894
|
return;
|
|
@@ -18590,16 +18916,16 @@ function Chat({
|
|
|
18590
18916
|
},
|
|
18591
18917
|
[applyComposerValueRuntimeCapabilities, composer?.tools, setComposerText]
|
|
18592
18918
|
),
|
|
18593
|
-
onSetRuntimeCapabilities:
|
|
18919
|
+
onSetRuntimeCapabilities: React56.useCallback(
|
|
18594
18920
|
(selection) => {
|
|
18595
18921
|
applyExternalRuntimeCapabilities(selection);
|
|
18596
18922
|
},
|
|
18597
18923
|
[applyExternalRuntimeCapabilities]
|
|
18598
18924
|
),
|
|
18599
|
-
onFocusComposer:
|
|
18925
|
+
onFocusComposer: React56.useCallback(() => {
|
|
18600
18926
|
composerInputRef.current?.focus();
|
|
18601
18927
|
}, []),
|
|
18602
|
-
onSetPetEnabled:
|
|
18928
|
+
onSetPetEnabled: React56.useCallback(
|
|
18603
18929
|
(enabled) => {
|
|
18604
18930
|
if (petRequired) {
|
|
18605
18931
|
return;
|
|
@@ -18613,10 +18939,10 @@ function Chat({
|
|
|
18613
18939
|
)
|
|
18614
18940
|
});
|
|
18615
18941
|
const canMinimizeToPet = parentMessenger?.isParentAvailable === true && isPetEnabled(effectivePet);
|
|
18616
|
-
const handleMinimizeToPet =
|
|
18942
|
+
const handleMinimizeToPet = React56.useCallback(() => {
|
|
18617
18943
|
parentMessenger?.sendEvent("chat_minimize_change", { minimized: true });
|
|
18618
18944
|
}, [parentMessenger]);
|
|
18619
|
-
const syncQuoteSelection =
|
|
18945
|
+
const syncQuoteSelection = React56.useCallback(() => {
|
|
18620
18946
|
if (typeof window === "undefined") {
|
|
18621
18947
|
clearQuoteSelection();
|
|
18622
18948
|
return;
|
|
@@ -18661,23 +18987,23 @@ function Chat({
|
|
|
18661
18987
|
left
|
|
18662
18988
|
});
|
|
18663
18989
|
}, [clearQuoteSelection]);
|
|
18664
|
-
const cancelPendingAutoScroll =
|
|
18990
|
+
const cancelPendingAutoScroll = React56.useCallback(() => {
|
|
18665
18991
|
if (autoScrollFrameRef.current !== null) {
|
|
18666
18992
|
cancelAnimationFrame(autoScrollFrameRef.current);
|
|
18667
18993
|
autoScrollFrameRef.current = null;
|
|
18668
18994
|
}
|
|
18669
18995
|
}, []);
|
|
18670
|
-
const disableAutoFollow =
|
|
18996
|
+
const disableAutoFollow = React56.useCallback(() => {
|
|
18671
18997
|
forceFollowRef.current = false;
|
|
18672
18998
|
shouldAutoScrollRef.current = false;
|
|
18673
18999
|
cancelPendingAutoScroll();
|
|
18674
19000
|
}, [cancelPendingAutoScroll]);
|
|
18675
|
-
const enableAutoFollow =
|
|
19001
|
+
const enableAutoFollow = React56.useCallback(() => {
|
|
18676
19002
|
forceFollowRef.current = true;
|
|
18677
19003
|
shouldAutoScrollRef.current = true;
|
|
18678
19004
|
setHasUpdatesBelow(false);
|
|
18679
19005
|
}, []);
|
|
18680
|
-
const scrollToBottom =
|
|
19006
|
+
const scrollToBottom = React56.useCallback(
|
|
18681
19007
|
(smooth = false, force = false) => {
|
|
18682
19008
|
if (force) {
|
|
18683
19009
|
enableAutoFollow();
|
|
@@ -18704,7 +19030,7 @@ function Chat({
|
|
|
18704
19030
|
},
|
|
18705
19031
|
[cancelPendingAutoScroll, enableAutoFollow]
|
|
18706
19032
|
);
|
|
18707
|
-
const setMessageNavigationAnchor =
|
|
19033
|
+
const setMessageNavigationAnchor = React56.useCallback(
|
|
18708
19034
|
(id, node) => {
|
|
18709
19035
|
if (node) {
|
|
18710
19036
|
messageNavigationAnchorsRef.current.set(id, node);
|
|
@@ -18714,22 +19040,22 @@ function Chat({
|
|
|
18714
19040
|
},
|
|
18715
19041
|
[]
|
|
18716
19042
|
);
|
|
18717
|
-
const getMessageNavigationAnchor =
|
|
19043
|
+
const getMessageNavigationAnchor = React56.useCallback(
|
|
18718
19044
|
(item) => messageNavigationAnchorsRef.current.get(item.id) ?? null,
|
|
18719
19045
|
[]
|
|
18720
19046
|
);
|
|
18721
|
-
const handleMessageNavigationNavigate =
|
|
19047
|
+
const handleMessageNavigationNavigate = React56.useCallback(() => {
|
|
18722
19048
|
disableAutoFollow();
|
|
18723
19049
|
clearQuoteSelection();
|
|
18724
19050
|
}, [clearQuoteSelection, disableAutoFollow]);
|
|
18725
19051
|
const taskSummaryEnabled = options?.taskSummary?.enabled === true;
|
|
18726
19052
|
const taskSummaryConversationId = stream.conversationId ?? null;
|
|
18727
|
-
const [taskSummaryDocked, setTaskSummaryDocked] =
|
|
18728
|
-
const [taskSummaryOpen, setTaskSummaryOpen] =
|
|
18729
|
-
const manuallyClosedTaskSummaryConversationIdsRef =
|
|
19053
|
+
const [taskSummaryDocked, setTaskSummaryDocked] = React56.useState(false);
|
|
19054
|
+
const [taskSummaryOpen, setTaskSummaryOpen] = React56.useState(false);
|
|
19055
|
+
const manuallyClosedTaskSummaryConversationIdsRef = React56.useRef(
|
|
18730
19056
|
/* @__PURE__ */ new Set()
|
|
18731
19057
|
);
|
|
18732
|
-
const liveTaskSummaryPending =
|
|
19058
|
+
const liveTaskSummaryPending = React56.useMemo(() => {
|
|
18733
19059
|
const followUps = pendingFollowUps.map((item) => ({
|
|
18734
19060
|
id: `follow-up:${item.id}`,
|
|
18735
19061
|
kind: "follow_up",
|
|
@@ -18764,7 +19090,7 @@ function Chat({
|
|
|
18764
19090
|
stream.pendingRequestUserInput,
|
|
18765
19091
|
t
|
|
18766
19092
|
]);
|
|
18767
|
-
const liveTaskSummaryRunning =
|
|
19093
|
+
const liveTaskSummaryRunning = React56.useMemo(
|
|
18768
19094
|
() => stream.runtimeActivities.sandboxServices.services.filter(
|
|
18769
19095
|
(service) => service.status === "starting" || service.status === "running" || service.status === "stopping"
|
|
18770
19096
|
).map((service) => ({
|
|
@@ -18781,7 +19107,7 @@ function Chat({
|
|
|
18781
19107
|
})),
|
|
18782
19108
|
[stream.runtimeActivities.sandboxServices.services]
|
|
18783
19109
|
);
|
|
18784
|
-
const taskSummaryAgentNames =
|
|
19110
|
+
const taskSummaryAgentNames = React56.useMemo(() => {
|
|
18785
19111
|
const names = /* @__PURE__ */ new Map();
|
|
18786
19112
|
runtimeCapabilityOptions.forEach((option) => {
|
|
18787
19113
|
if (option.type !== "subAgent") return;
|
|
@@ -18793,7 +19119,7 @@ function Chat({
|
|
|
18793
19119
|
});
|
|
18794
19120
|
return names;
|
|
18795
19121
|
}, [runtimeCapabilityOptions]);
|
|
18796
|
-
const liveTaskSummary =
|
|
19122
|
+
const liveTaskSummary = React56.useMemo(
|
|
18797
19123
|
() => collectLiveTaskSummary({
|
|
18798
19124
|
messages: messages.map(
|
|
18799
19125
|
(message) => ({
|
|
@@ -18830,7 +19156,7 @@ function Chat({
|
|
|
18830
19156
|
client: stream.client,
|
|
18831
19157
|
live: liveTaskSummary
|
|
18832
19158
|
});
|
|
18833
|
-
const navigateToTaskSummaryMessage =
|
|
19159
|
+
const navigateToTaskSummaryMessage = React56.useCallback(
|
|
18834
19160
|
async (messageId) => {
|
|
18835
19161
|
try {
|
|
18836
19162
|
let anchor = messageNavigationAnchorsRef.current.get(messageId);
|
|
@@ -18854,7 +19180,7 @@ function Chat({
|
|
|
18854
19180
|
},
|
|
18855
19181
|
[clearQuoteSelection, disableAutoFollow, stream]
|
|
18856
19182
|
);
|
|
18857
|
-
const openTaskSummaryResource =
|
|
19183
|
+
const openTaskSummaryResource = React56.useCallback(
|
|
18858
19184
|
(resource, messageId, resourceTitle) => {
|
|
18859
19185
|
const data = {
|
|
18860
19186
|
resource,
|
|
@@ -18872,7 +19198,7 @@ function Chat({
|
|
|
18872
19198
|
},
|
|
18873
19199
|
[parentMessenger, taskSummaryConversationId]
|
|
18874
19200
|
);
|
|
18875
|
-
|
|
19201
|
+
React56.useEffect(() => {
|
|
18876
19202
|
const viewport = viewportRef.current;
|
|
18877
19203
|
if (!viewport) return;
|
|
18878
19204
|
previousScrollTopRef.current = viewport.scrollTop;
|
|
@@ -18953,14 +19279,14 @@ function Chat({
|
|
|
18953
19279
|
window.removeEventListener("pointercancel", stopPointerTracking);
|
|
18954
19280
|
};
|
|
18955
19281
|
}, [cancelPendingAutoScroll, disableAutoFollow]);
|
|
18956
|
-
|
|
19282
|
+
React56.useEffect(() => {
|
|
18957
19283
|
shouldAutoScrollRef.current = true;
|
|
18958
19284
|
forceFollowRef.current = false;
|
|
18959
19285
|
previousScrollTopRef.current = 0;
|
|
18960
19286
|
setIsAtBottom(true);
|
|
18961
19287
|
setHasUpdatesBelow(false);
|
|
18962
19288
|
}, [stream.threadId]);
|
|
18963
|
-
|
|
19289
|
+
React56.useEffect(() => {
|
|
18964
19290
|
const messageCountChanged = messages.length !== previousMessageCountRef.current;
|
|
18965
19291
|
previousMessageCountRef.current = messages.length;
|
|
18966
19292
|
if (isPrependingHistoryMessagesRef.current) {
|
|
@@ -18982,7 +19308,7 @@ function Chat({
|
|
|
18982
19308
|
const isSubmissionBlocked = hasPendingInteractiveRequest || missingConfig || isHistoryLoading || hasUploadingFiles || isUploadingReferenceImages;
|
|
18983
19309
|
const isSendDisabled = !trimmedDraft && !hasReferences || isSubmissionBlocked;
|
|
18984
19310
|
const isPromptEditDisabled = hasPendingInteractiveRequest || missingConfig || isHistoryLoading;
|
|
18985
|
-
const resizeComposerInput =
|
|
19311
|
+
const resizeComposerInput = React56.useCallback(() => {
|
|
18986
19312
|
const input = composerInputRef.current;
|
|
18987
19313
|
if (!input) {
|
|
18988
19314
|
return;
|
|
@@ -18990,7 +19316,7 @@ function Chat({
|
|
|
18990
19316
|
input.style.maxHeight = `${COMPOSER_INPUT_MAX_HEIGHT}px`;
|
|
18991
19317
|
input.style.overflowY = input.scrollHeight > COMPOSER_INPUT_MAX_HEIGHT ? "auto" : "hidden";
|
|
18992
19318
|
}, []);
|
|
18993
|
-
|
|
19319
|
+
React56.useLayoutEffect(() => {
|
|
18994
19320
|
composerPartsRef.current = composerParts;
|
|
18995
19321
|
resizeComposerInput();
|
|
18996
19322
|
const caretOffset = pendingComposerCaretOffsetRef.current;
|
|
@@ -19002,13 +19328,13 @@ function Chat({
|
|
|
19002
19328
|
}
|
|
19003
19329
|
}
|
|
19004
19330
|
}, [composerDomVersion, composerParts, resizeComposerInput]);
|
|
19005
|
-
|
|
19331
|
+
React56.useEffect(() => {
|
|
19006
19332
|
document.addEventListener("selectionchange", syncQuoteSelection);
|
|
19007
19333
|
return () => {
|
|
19008
19334
|
document.removeEventListener("selectionchange", syncQuoteSelection);
|
|
19009
19335
|
};
|
|
19010
19336
|
}, [syncQuoteSelection]);
|
|
19011
|
-
|
|
19337
|
+
React56.useEffect(() => {
|
|
19012
19338
|
const viewport = viewportRef.current;
|
|
19013
19339
|
if (!viewport) {
|
|
19014
19340
|
return;
|
|
@@ -19025,14 +19351,14 @@ function Chat({
|
|
|
19025
19351
|
window.removeEventListener("resize", handleViewportScroll);
|
|
19026
19352
|
};
|
|
19027
19353
|
}, [clearQuoteSelection]);
|
|
19028
|
-
|
|
19354
|
+
React56.useEffect(() => {
|
|
19029
19355
|
clearQuoteSelection();
|
|
19030
19356
|
}, [messages.length, stream.threadId, clearQuoteSelection]);
|
|
19031
|
-
|
|
19357
|
+
React56.useEffect(() => {
|
|
19032
19358
|
if (missingConfig) return;
|
|
19033
19359
|
void refreshThreads();
|
|
19034
19360
|
}, [missingConfig, refreshThreads]);
|
|
19035
|
-
|
|
19361
|
+
React56.useEffect(() => {
|
|
19036
19362
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
19037
19363
|
setAssistantName(null);
|
|
19038
19364
|
setAssistantAvatar(null);
|
|
@@ -19055,10 +19381,10 @@ function Chat({
|
|
|
19055
19381
|
cancelled = true;
|
|
19056
19382
|
};
|
|
19057
19383
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
19058
|
-
|
|
19384
|
+
React56.useEffect(() => {
|
|
19059
19385
|
setThreadGoal(stream.threadGoal);
|
|
19060
19386
|
}, [stream.threadGoal]);
|
|
19061
|
-
|
|
19387
|
+
React56.useEffect(() => {
|
|
19062
19388
|
const threadId = stream.threadId?.trim();
|
|
19063
19389
|
if (!threadId || !goalCommandAvailable) {
|
|
19064
19390
|
setThreadGoal(null);
|
|
@@ -19099,7 +19425,7 @@ function Chat({
|
|
|
19099
19425
|
return () => controller.abort();
|
|
19100
19426
|
}, [goalAdapter, goalCommandAvailable, stream.threadId]);
|
|
19101
19427
|
const uploadedFiles = attachmentState.uploadedFiles;
|
|
19102
|
-
const syncComposerInputFromElement =
|
|
19428
|
+
const syncComposerInputFromElement = React56.useCallback(
|
|
19103
19429
|
(input) => {
|
|
19104
19430
|
const previousCapabilities = getComposerCapabilityPartMap(
|
|
19105
19431
|
composerPartsRef.current
|
|
@@ -19117,25 +19443,30 @@ function Chat({
|
|
|
19117
19443
|
},
|
|
19118
19444
|
[commitComposerParts, updateRuntimeCapabilityPalette]
|
|
19119
19445
|
);
|
|
19120
|
-
const handleComposerInput =
|
|
19446
|
+
const handleComposerInput = React56.useCallback(
|
|
19121
19447
|
(event) => {
|
|
19448
|
+
if (isComposerComposingRef.current) return;
|
|
19122
19449
|
syncComposerInputFromElement(event.currentTarget);
|
|
19123
19450
|
},
|
|
19124
19451
|
[syncComposerInputFromElement]
|
|
19125
19452
|
);
|
|
19126
|
-
const
|
|
19453
|
+
const handleComposerCompositionStart = React56.useCallback(() => {
|
|
19454
|
+
isComposerComposingRef.current = true;
|
|
19455
|
+
}, []);
|
|
19456
|
+
const handleComposerCompositionEnd = React56.useCallback(
|
|
19127
19457
|
(event) => {
|
|
19458
|
+
isComposerComposingRef.current = false;
|
|
19128
19459
|
syncComposerInputFromElement(event.currentTarget);
|
|
19129
19460
|
},
|
|
19130
19461
|
[syncComposerInputFromElement]
|
|
19131
19462
|
);
|
|
19132
|
-
const handleComposerSelect =
|
|
19463
|
+
const handleComposerSelect = React56.useCallback(() => {
|
|
19133
19464
|
updateRuntimeCapabilityPalette(
|
|
19134
19465
|
composerPartsRef.current,
|
|
19135
19466
|
composerInputRef.current ? getComposerSelectionOffset(composerInputRef.current) : void 0
|
|
19136
19467
|
);
|
|
19137
19468
|
}, [updateRuntimeCapabilityPalette]);
|
|
19138
|
-
const submitDraft =
|
|
19469
|
+
const submitDraft = React56.useCallback(
|
|
19139
19470
|
(submitOptions = {}) => {
|
|
19140
19471
|
if (isSubmissionBlocked) return;
|
|
19141
19472
|
const contentToSubmit = (submitOptions.inputText ?? trimmedDraft).trim();
|
|
@@ -19241,7 +19572,7 @@ function Chat({
|
|
|
19241
19572
|
t
|
|
19242
19573
|
]
|
|
19243
19574
|
);
|
|
19244
|
-
const handleGoalCommand =
|
|
19575
|
+
const handleGoalCommand = React56.useCallback(
|
|
19245
19576
|
async ({
|
|
19246
19577
|
args,
|
|
19247
19578
|
commandSource,
|
|
@@ -19347,7 +19678,7 @@ function Chat({
|
|
|
19347
19678
|
t
|
|
19348
19679
|
]
|
|
19349
19680
|
);
|
|
19350
|
-
const handleGoalPanelOpenChange =
|
|
19681
|
+
const handleGoalPanelOpenChange = React56.useCallback((open) => {
|
|
19351
19682
|
setIsGoalPanelOpen(open);
|
|
19352
19683
|
}, []);
|
|
19353
19684
|
const {
|
|
@@ -19391,7 +19722,7 @@ function Chat({
|
|
|
19391
19722
|
plugin: t("composer.slashCommands.empty.loadingCapabilities"),
|
|
19392
19723
|
subAgent: t("composer.slashCommands.empty.loadingCapabilities")
|
|
19393
19724
|
};
|
|
19394
|
-
|
|
19725
|
+
React56.useEffect(() => {
|
|
19395
19726
|
if (!runtimeCapabilityPalette) {
|
|
19396
19727
|
return;
|
|
19397
19728
|
}
|
|
@@ -19410,7 +19741,7 @@ function Chat({
|
|
|
19410
19741
|
);
|
|
19411
19742
|
}
|
|
19412
19743
|
}, [slashPaletteOptions.length, runtimeCapabilityPalette]);
|
|
19413
|
-
|
|
19744
|
+
React56.useLayoutEffect(() => {
|
|
19414
19745
|
if (!runtimeCapabilityPalette) {
|
|
19415
19746
|
return;
|
|
19416
19747
|
}
|
|
@@ -19427,7 +19758,7 @@ function Chat({
|
|
|
19427
19758
|
container.scrollTop += optionRect.bottom - containerRect.bottom;
|
|
19428
19759
|
}
|
|
19429
19760
|
}, [runtimeCapabilityPalette, slashPaletteOptions.length]);
|
|
19430
|
-
const submitGoalModeDraft =
|
|
19761
|
+
const submitGoalModeDraft = React56.useCallback(() => {
|
|
19431
19762
|
const objective = getComposerPlainText(composerPartsRef.current).trim();
|
|
19432
19763
|
if (!isGoalModeOpen || !goalCommandAvailable || !objective) {
|
|
19433
19764
|
return false;
|
|
@@ -19465,7 +19796,7 @@ function Chat({
|
|
|
19465
19796
|
}
|
|
19466
19797
|
submitDraft();
|
|
19467
19798
|
};
|
|
19468
|
-
const handleEditPendingFollowUp =
|
|
19799
|
+
const handleEditPendingFollowUp = React56.useCallback(
|
|
19469
19800
|
(id) => {
|
|
19470
19801
|
const item = pendingFollowUps.find(
|
|
19471
19802
|
(entry) => entry.id === id && entry.mode === "queue"
|
|
@@ -19492,7 +19823,7 @@ function Chat({
|
|
|
19492
19823
|
},
|
|
19493
19824
|
[pendingFollowUps, setComposerText, stream]
|
|
19494
19825
|
);
|
|
19495
|
-
const handleQuoteSelection =
|
|
19826
|
+
const handleQuoteSelection = React56.useCallback(() => {
|
|
19496
19827
|
if (!quoteSelection) {
|
|
19497
19828
|
return;
|
|
19498
19829
|
}
|
|
@@ -19508,7 +19839,7 @@ function Chat({
|
|
|
19508
19839
|
const handleAttachmentClick = () => {
|
|
19509
19840
|
attachmentsRef.current?.openFilePicker();
|
|
19510
19841
|
};
|
|
19511
|
-
const uploadContextFile =
|
|
19842
|
+
const uploadContextFile = React56.useCallback(
|
|
19512
19843
|
(file) => {
|
|
19513
19844
|
const formData = new FormData();
|
|
19514
19845
|
formData.append("file", file, file.name || "upload");
|
|
@@ -19527,13 +19858,13 @@ function Chat({
|
|
|
19527
19858
|
},
|
|
19528
19859
|
[stream.assistantId, stream.client, stream.threadId]
|
|
19529
19860
|
);
|
|
19530
|
-
const getContextFileStatus =
|
|
19861
|
+
const getContextFileStatus = React56.useCallback(
|
|
19531
19862
|
(fileId) => stream.client.contexts.fetch(`/files/${fileId}/status`, {
|
|
19532
19863
|
method: "GET"
|
|
19533
19864
|
}),
|
|
19534
19865
|
[stream.client]
|
|
19535
19866
|
);
|
|
19536
|
-
const deleteContextFile =
|
|
19867
|
+
const deleteContextFile = React56.useCallback(
|
|
19537
19868
|
(storageFileId) => stream.client.contexts.deleteFile(storageFileId),
|
|
19538
19869
|
[stream.client]
|
|
19539
19870
|
);
|
|
@@ -19641,7 +19972,7 @@ function Chat({
|
|
|
19641
19972
|
}
|
|
19642
19973
|
submitDraft();
|
|
19643
19974
|
};
|
|
19644
|
-
const handleComposerPaste =
|
|
19975
|
+
const handleComposerPaste = React56.useCallback(
|
|
19645
19976
|
(event) => {
|
|
19646
19977
|
const clipboardData = event.clipboardData;
|
|
19647
19978
|
if (!clipboardData) {
|
|
@@ -19743,13 +20074,13 @@ function Chat({
|
|
|
19743
20074
|
const handleToolSelect = (tool) => {
|
|
19744
20075
|
setSelectedTool((prev) => prev?.id === tool.id ? null : tool);
|
|
19745
20076
|
};
|
|
19746
|
-
const handlePromptClick =
|
|
20077
|
+
const handlePromptClick = React56.useCallback(
|
|
19747
20078
|
(prompt) => {
|
|
19748
20079
|
submitDraft({ inputText: prompt, displayText: prompt });
|
|
19749
20080
|
},
|
|
19750
20081
|
[submitDraft]
|
|
19751
20082
|
);
|
|
19752
|
-
const handlePromptEdit =
|
|
20083
|
+
const handlePromptEdit = React56.useCallback(
|
|
19753
20084
|
(prompt) => {
|
|
19754
20085
|
if (isPromptEditDisabled) return;
|
|
19755
20086
|
setComposerText(prompt, prompt.length);
|
|
@@ -19758,7 +20089,7 @@ function Chat({
|
|
|
19758
20089
|
},
|
|
19759
20090
|
[focusComposerAt, isPromptEditDisabled, setComposerText]
|
|
19760
20091
|
);
|
|
19761
|
-
const loadConversationMessages =
|
|
20092
|
+
const loadConversationMessages = React56.useCallback(
|
|
19762
20093
|
async (recordId) => {
|
|
19763
20094
|
if (missingConfig) {
|
|
19764
20095
|
setHistoryError(missingConfigShortMessage);
|
|
@@ -19779,7 +20110,7 @@ function Chat({
|
|
|
19779
20110
|
},
|
|
19780
20111
|
[missingConfig, missingConfigShortMessage, stream, t]
|
|
19781
20112
|
);
|
|
19782
|
-
const handleLoadMoreMessages =
|
|
20113
|
+
const handleLoadMoreMessages = React56.useCallback(async () => {
|
|
19783
20114
|
if (!canLoadMoreMessages || isLoadingMoreMessages) {
|
|
19784
20115
|
return;
|
|
19785
20116
|
}
|
|
@@ -19888,19 +20219,19 @@ function Chat({
|
|
|
19888
20219
|
};
|
|
19889
20220
|
const acceptMimes = composer?.attachments?.accept ? Object.entries(composer.attachments.accept).map(([mime, exts]) => [mime, ...exts.map((e) => `.${e}`)].join(",")).join(",") : void 0;
|
|
19890
20221
|
const canUploadDroppedFiles = composer?.attachments?.enabled === true && !missingConfig && !isHistoryLoading && !hasPendingInteractiveRequest;
|
|
19891
|
-
const handleDroppedFiles =
|
|
20222
|
+
const handleDroppedFiles = React56.useCallback((files) => {
|
|
19892
20223
|
return attachmentsRef.current?.queueFiles(files) ?? false;
|
|
19893
20224
|
}, []);
|
|
19894
|
-
const currentThread =
|
|
20225
|
+
const currentThread = React56.useMemo(
|
|
19895
20226
|
() => threads.find((item) => item.id === stream.threadId),
|
|
19896
20227
|
[threads, stream.threadId]
|
|
19897
20228
|
);
|
|
19898
|
-
const assistantStatusText =
|
|
20229
|
+
const assistantStatusText = React56.useMemo(() => {
|
|
19899
20230
|
if (!stream.threadId) return t("chat.statusOnline");
|
|
19900
20231
|
return currentThread?.title?.trim() || t("chat.statusOnline");
|
|
19901
20232
|
}, [currentThread?.title, stream.threadId, t]);
|
|
19902
20233
|
const streamErrorMessage = stream.error instanceof Error ? stream.error.message : void 0;
|
|
19903
|
-
const threadErrorMessage =
|
|
20234
|
+
const threadErrorMessage = React56.useMemo(() => {
|
|
19904
20235
|
if (streamErrorMessage?.trim()) return streamErrorMessage.trim();
|
|
19905
20236
|
if (currentThread?.status !== "error") return void 0;
|
|
19906
20237
|
const message = currentThread.error?.trim();
|
|
@@ -19931,13 +20262,13 @@ function Chat({
|
|
|
19931
20262
|
fallbackTitle: t("history.threadFallback")
|
|
19932
20263
|
});
|
|
19933
20264
|
const layoutMaxWidth = options?.layout?.maxWidth;
|
|
19934
|
-
const chatColumnStyle =
|
|
20265
|
+
const chatColumnStyle = React56.useMemo(() => {
|
|
19935
20266
|
if (layoutMaxWidth === void 0 || layoutMaxWidth === null || layoutMaxWidth === "") {
|
|
19936
20267
|
return void 0;
|
|
19937
20268
|
}
|
|
19938
20269
|
return { maxWidth: layoutMaxWidth };
|
|
19939
20270
|
}, [layoutMaxWidth]);
|
|
19940
|
-
|
|
20271
|
+
React56.useLayoutEffect(() => {
|
|
19941
20272
|
if (!taskSummaryEnabled) {
|
|
19942
20273
|
setTaskSummaryDocked(false);
|
|
19943
20274
|
return;
|
|
@@ -19972,7 +20303,7 @@ function Chat({
|
|
|
19972
20303
|
const taskSummaryAvailable = Boolean(
|
|
19973
20304
|
taskSummaryEnabled && stream.threadId && taskSummaryConversationId
|
|
19974
20305
|
);
|
|
19975
|
-
const handleTaskSummaryOpenChange =
|
|
20306
|
+
const handleTaskSummaryOpenChange = React56.useCallback(
|
|
19976
20307
|
(open) => {
|
|
19977
20308
|
setTaskSummaryOpen(open);
|
|
19978
20309
|
if (!taskSummaryConversationId) return;
|
|
@@ -19988,12 +20319,12 @@ function Chat({
|
|
|
19988
20319
|
},
|
|
19989
20320
|
[taskSummaryConversationId]
|
|
19990
20321
|
);
|
|
19991
|
-
|
|
20322
|
+
React56.useEffect(() => {
|
|
19992
20323
|
if (!taskSummaryDocked) {
|
|
19993
20324
|
setTaskSummaryOpen(false);
|
|
19994
20325
|
}
|
|
19995
20326
|
}, [taskSummaryDocked]);
|
|
19996
|
-
|
|
20327
|
+
React56.useEffect(() => {
|
|
19997
20328
|
if (!taskSummaryDocked || !taskSummaryAvailable || !taskSummaryConversationId || manuallyClosedTaskSummaryConversationIdsRef.current.has(
|
|
19998
20329
|
taskSummaryConversationId
|
|
19999
20330
|
)) {
|
|
@@ -20014,13 +20345,13 @@ function Chat({
|
|
|
20014
20345
|
onFocusComposer: () => focusComposerAt(),
|
|
20015
20346
|
onOpenResource: openTaskSummaryResource
|
|
20016
20347
|
};
|
|
20017
|
-
return /* @__PURE__ */
|
|
20348
|
+
return /* @__PURE__ */ jsxs42(
|
|
20018
20349
|
"div",
|
|
20019
20350
|
{
|
|
20020
20351
|
className: "relative flex h-full w-full min-w-0 bg-background",
|
|
20021
20352
|
"data-task-summary-layout": taskSummaryDocked ? "docked" : "popover",
|
|
20022
20353
|
children: [
|
|
20023
|
-
/* @__PURE__ */
|
|
20354
|
+
/* @__PURE__ */ jsxs42(
|
|
20024
20355
|
UploadDroppedFiles,
|
|
20025
20356
|
{
|
|
20026
20357
|
ref: viewportRef,
|
|
@@ -20035,7 +20366,7 @@ function Chat({
|
|
|
20035
20366
|
className
|
|
20036
20367
|
),
|
|
20037
20368
|
children: [
|
|
20038
|
-
/* @__PURE__ */
|
|
20369
|
+
/* @__PURE__ */ jsxs42(
|
|
20039
20370
|
"div",
|
|
20040
20371
|
{
|
|
20041
20372
|
ref: chatColumnRef,
|
|
@@ -20043,9 +20374,9 @@ function Chat({
|
|
|
20043
20374
|
className: "mx-auto flex w-full items-center justify-between border-b p-2 sticky top-0 z-10 bg-background",
|
|
20044
20375
|
style: chatColumnStyle,
|
|
20045
20376
|
children: [
|
|
20046
|
-
/* @__PURE__ */
|
|
20047
|
-
/* @__PURE__ */
|
|
20048
|
-
/* @__PURE__ */
|
|
20377
|
+
/* @__PURE__ */ jsxs42("div", { className: "flex min-w-0 items-center gap-3 overflow-hidden", children: [
|
|
20378
|
+
/* @__PURE__ */ jsxs42("div", { className: "relative shrink-0", children: [
|
|
20379
|
+
/* @__PURE__ */ jsx60(
|
|
20049
20380
|
ChatkitAvatar,
|
|
20050
20381
|
{
|
|
20051
20382
|
avatar: assistantAvatar,
|
|
@@ -20053,10 +20384,10 @@ function Chat({
|
|
|
20053
20384
|
label: assistantTitle
|
|
20054
20385
|
}
|
|
20055
20386
|
),
|
|
20056
|
-
/* @__PURE__ */
|
|
20387
|
+
/* @__PURE__ */ jsx60("span", { className: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-green-500" })
|
|
20057
20388
|
] }),
|
|
20058
|
-
/* @__PURE__ */
|
|
20059
|
-
/* @__PURE__ */
|
|
20389
|
+
/* @__PURE__ */ jsxs42("div", { className: "min-w-0", children: [
|
|
20390
|
+
/* @__PURE__ */ jsx60(
|
|
20060
20391
|
"h2",
|
|
20061
20392
|
{
|
|
20062
20393
|
className: "text-lg font-semibold truncate",
|
|
@@ -20064,7 +20395,7 @@ function Chat({
|
|
|
20064
20395
|
children: assistantTitle
|
|
20065
20396
|
}
|
|
20066
20397
|
),
|
|
20067
|
-
/* @__PURE__ */
|
|
20398
|
+
/* @__PURE__ */ jsx60(
|
|
20068
20399
|
"p",
|
|
20069
20400
|
{
|
|
20070
20401
|
className: "truncate text-xs text-muted-foreground",
|
|
@@ -20074,8 +20405,8 @@ function Chat({
|
|
|
20074
20405
|
)
|
|
20075
20406
|
] })
|
|
20076
20407
|
] }),
|
|
20077
|
-
/* @__PURE__ */
|
|
20078
|
-
taskSummaryAvailable && /* @__PURE__ */
|
|
20408
|
+
/* @__PURE__ */ jsxs42("div", { className: "flex items-center gap-1", children: [
|
|
20409
|
+
taskSummaryAvailable && /* @__PURE__ */ jsx60(
|
|
20079
20410
|
TaskSummaryTrigger,
|
|
20080
20411
|
{
|
|
20081
20412
|
...taskSummaryProps,
|
|
@@ -20084,9 +20415,9 @@ function Chat({
|
|
|
20084
20415
|
onOpenChange: handleTaskSummaryOpenChange
|
|
20085
20416
|
}
|
|
20086
20417
|
),
|
|
20087
|
-
/* @__PURE__ */
|
|
20088
|
-
canMinimizeToPet && /* @__PURE__ */
|
|
20089
|
-
/* @__PURE__ */
|
|
20418
|
+
/* @__PURE__ */ jsx60(WorkbenchToggleButton, {}),
|
|
20419
|
+
canMinimizeToPet && /* @__PURE__ */ jsxs42(Tooltip, { children: [
|
|
20420
|
+
/* @__PURE__ */ jsx60(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx60("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ jsx60(
|
|
20090
20421
|
"button",
|
|
20091
20422
|
{
|
|
20092
20423
|
type: "button",
|
|
@@ -20097,13 +20428,13 @@ function Chat({
|
|
|
20097
20428
|
"transition-colors duration-150"
|
|
20098
20429
|
),
|
|
20099
20430
|
"aria-label": t("chat.minimizeToPet"),
|
|
20100
|
-
children: /* @__PURE__ */
|
|
20431
|
+
children: /* @__PURE__ */ jsx60(Minus, { size: 16 })
|
|
20101
20432
|
}
|
|
20102
20433
|
) }) }),
|
|
20103
|
-
/* @__PURE__ */
|
|
20434
|
+
/* @__PURE__ */ jsx60(TooltipContent, { side: "bottom", children: t("chat.minimizeToPet") })
|
|
20104
20435
|
] }),
|
|
20105
|
-
/* @__PURE__ */
|
|
20106
|
-
/* @__PURE__ */
|
|
20436
|
+
/* @__PURE__ */ jsxs42(Tooltip, { children: [
|
|
20437
|
+
/* @__PURE__ */ jsx60(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx60("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ jsx60(
|
|
20107
20438
|
"button",
|
|
20108
20439
|
{
|
|
20109
20440
|
type: "button",
|
|
@@ -20114,14 +20445,14 @@ function Chat({
|
|
|
20114
20445
|
"transition-colors duration-150"
|
|
20115
20446
|
),
|
|
20116
20447
|
"aria-label": t("settings.open"),
|
|
20117
|
-
children: /* @__PURE__ */
|
|
20448
|
+
children: /* @__PURE__ */ jsx60(Settings2, { size: 16 })
|
|
20118
20449
|
}
|
|
20119
20450
|
) }) }),
|
|
20120
|
-
/* @__PURE__ */
|
|
20451
|
+
/* @__PURE__ */ jsx60(TooltipContent, { side: "bottom", children: t("settings.open") })
|
|
20121
20452
|
] }),
|
|
20122
|
-
history?.enabled !== false && /* @__PURE__ */
|
|
20123
|
-
/* @__PURE__ */
|
|
20124
|
-
/* @__PURE__ */
|
|
20453
|
+
history?.enabled !== false && /* @__PURE__ */ jsxs42(Fragment11, { children: [
|
|
20454
|
+
/* @__PURE__ */ jsxs42(Tooltip, { children: [
|
|
20455
|
+
/* @__PURE__ */ jsx60(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx60("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ jsx60(
|
|
20125
20456
|
"button",
|
|
20126
20457
|
{
|
|
20127
20458
|
type: "button",
|
|
@@ -20134,12 +20465,12 @@ function Chat({
|
|
|
20134
20465
|
"disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed"
|
|
20135
20466
|
),
|
|
20136
20467
|
"aria-label": t("history.newThread"),
|
|
20137
|
-
children: /* @__PURE__ */
|
|
20468
|
+
children: /* @__PURE__ */ jsx60(Pencil4, { size: 16 })
|
|
20138
20469
|
}
|
|
20139
20470
|
) }) }),
|
|
20140
|
-
/* @__PURE__ */
|
|
20471
|
+
/* @__PURE__ */ jsx60(TooltipContent, { side: "bottom", children: t("history.newThread") })
|
|
20141
20472
|
] }),
|
|
20142
|
-
/* @__PURE__ */
|
|
20473
|
+
/* @__PURE__ */ jsx60(
|
|
20143
20474
|
HistorySidebar,
|
|
20144
20475
|
{
|
|
20145
20476
|
threads,
|
|
@@ -20158,7 +20489,7 @@ function Chat({
|
|
|
20158
20489
|
]
|
|
20159
20490
|
}
|
|
20160
20491
|
),
|
|
20161
|
-
showMessageNavigation && /* @__PURE__ */
|
|
20492
|
+
showMessageNavigation && /* @__PURE__ */ jsx60(
|
|
20162
20493
|
MessageNavigator,
|
|
20163
20494
|
{
|
|
20164
20495
|
items: messageNavigationItems,
|
|
@@ -20169,18 +20500,18 @@ function Chat({
|
|
|
20169
20500
|
tagsOverflowLabel: (count) => t("message.navigation.moreTags", { count })
|
|
20170
20501
|
}
|
|
20171
20502
|
),
|
|
20172
|
-
/* @__PURE__ */
|
|
20503
|
+
/* @__PURE__ */ jsxs42(
|
|
20173
20504
|
"div",
|
|
20174
20505
|
{
|
|
20175
20506
|
"data-slot": "chatkit-chat-content",
|
|
20176
20507
|
className: "mx-auto w-full flex-1 p-4",
|
|
20177
20508
|
style: chatColumnStyle,
|
|
20178
20509
|
children: [
|
|
20179
|
-
errorMessage && /* @__PURE__ */
|
|
20180
|
-
historyError && /* @__PURE__ */
|
|
20181
|
-
showMissingConfig && /* @__PURE__ */
|
|
20182
|
-
isHistoryLoading && /* @__PURE__ */
|
|
20183
|
-
messages.length === 0 && !canLoadMoreMessages ? /* @__PURE__ */
|
|
20510
|
+
errorMessage && /* @__PURE__ */ jsx60("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: errorMessage }),
|
|
20511
|
+
historyError && /* @__PURE__ */ jsx60("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: historyError }),
|
|
20512
|
+
showMissingConfig && /* @__PURE__ */ jsx60("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: missingConfigDetailMessage }),
|
|
20513
|
+
isHistoryLoading && /* @__PURE__ */ jsx60("div", { className: "mb-4 rounded-lg border border-muted px-3 py-2 text-sm text-muted-foreground", children: t("chat.loadingThread") }),
|
|
20514
|
+
messages.length === 0 && !canLoadMoreMessages ? /* @__PURE__ */ jsx60(
|
|
20184
20515
|
StartScreen,
|
|
20185
20516
|
{
|
|
20186
20517
|
startScreen,
|
|
@@ -20189,10 +20520,10 @@ function Chat({
|
|
|
20189
20520
|
promptSendDisabled: isSubmissionBlocked,
|
|
20190
20521
|
promptEditDisabled: isPromptEditDisabled
|
|
20191
20522
|
}
|
|
20192
|
-
) : /* @__PURE__ */
|
|
20193
|
-
canLoadMoreMessages && /* @__PURE__ */
|
|
20194
|
-
/* @__PURE__ */
|
|
20195
|
-
/* @__PURE__ */
|
|
20523
|
+
) : /* @__PURE__ */ jsxs42("div", { className: "space-y-4", children: [
|
|
20524
|
+
canLoadMoreMessages && /* @__PURE__ */ jsxs42("div", { className: "flex items-center gap-3 py-1", children: [
|
|
20525
|
+
/* @__PURE__ */ jsx60("div", { className: "h-px min-w-8 flex-1 bg-border" }),
|
|
20526
|
+
/* @__PURE__ */ jsx60(
|
|
20196
20527
|
Button,
|
|
20197
20528
|
{
|
|
20198
20529
|
type: "button",
|
|
@@ -20204,7 +20535,7 @@ function Chat({
|
|
|
20204
20535
|
children: isLoadingMoreMessages ? t("chat.loadingMoreMessages") : t("chat.loadMoreMessages")
|
|
20205
20536
|
}
|
|
20206
20537
|
),
|
|
20207
|
-
/* @__PURE__ */
|
|
20538
|
+
/* @__PURE__ */ jsx60("div", { className: "h-px min-w-8 flex-1 bg-border" })
|
|
20208
20539
|
] }),
|
|
20209
20540
|
messages.map((message, index) => {
|
|
20210
20541
|
const messageType = String(message.type);
|
|
@@ -20248,7 +20579,7 @@ function Chat({
|
|
|
20248
20579
|
if (!isAssistantMessage && !hasPlainRenderableContent && !hasHumanAttachments && humanRuntimeCapabilityOptions.length === 0 && humanReferences.length === 0) {
|
|
20249
20580
|
return null;
|
|
20250
20581
|
}
|
|
20251
|
-
return /* @__PURE__ */
|
|
20582
|
+
return /* @__PURE__ */ jsx60(
|
|
20252
20583
|
"div",
|
|
20253
20584
|
{
|
|
20254
20585
|
ref: (node) => setMessageNavigationAnchor(messageNavigationId, node),
|
|
@@ -20258,7 +20589,7 @@ function Chat({
|
|
|
20258
20589
|
message.type === "human" ? "justify-end" : "justify-start -ml-1"
|
|
20259
20590
|
// AI messages: slightly closer to left
|
|
20260
20591
|
),
|
|
20261
|
-
children: /* @__PURE__ */
|
|
20592
|
+
children: /* @__PURE__ */ jsxs42(
|
|
20262
20593
|
"div",
|
|
20263
20594
|
{
|
|
20264
20595
|
className: cn(
|
|
@@ -20266,7 +20597,7 @@ function Chat({
|
|
|
20266
20597
|
isAssistantMessage && "min-w-0 flex-1"
|
|
20267
20598
|
),
|
|
20268
20599
|
children: [
|
|
20269
|
-
/* @__PURE__ */
|
|
20600
|
+
/* @__PURE__ */ jsx60(
|
|
20270
20601
|
"div",
|
|
20271
20602
|
{
|
|
20272
20603
|
...canQuoteMessage ? {
|
|
@@ -20278,7 +20609,7 @@ function Chat({
|
|
|
20278
20609
|
message.type === "human" ? "bg-primary text-primary-foreground px-4 py-2.5" : message.type === "system" ? "bg-muted text-muted-foreground text-xs px-4 py-2.5" : "py-1 text-chat-foreground"
|
|
20279
20610
|
// AI messages: use chat-specific foreground color
|
|
20280
20611
|
),
|
|
20281
|
-
children: isAssistantMessage ? /* @__PURE__ */
|
|
20612
|
+
children: isAssistantMessage ? /* @__PURE__ */ jsx60(
|
|
20282
20613
|
AssistantMessage,
|
|
20283
20614
|
{
|
|
20284
20615
|
message: {
|
|
@@ -20298,14 +20629,14 @@ function Chat({
|
|
|
20298
20629
|
apiUrl: stream.apiUrl,
|
|
20299
20630
|
pet: effectivePet
|
|
20300
20631
|
}
|
|
20301
|
-
) : /* @__PURE__ */
|
|
20302
|
-
message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */
|
|
20632
|
+
) : /* @__PURE__ */ jsxs42(Fragment11, { children: [
|
|
20633
|
+
message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ jsx60(
|
|
20303
20634
|
HumanRuntimeCapabilityChips,
|
|
20304
20635
|
{
|
|
20305
20636
|
options: humanRuntimeCapabilityOptions
|
|
20306
20637
|
}
|
|
20307
20638
|
),
|
|
20308
|
-
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */
|
|
20639
|
+
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ jsx60("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanReferences.map((reference) => /* @__PURE__ */ jsx60(
|
|
20309
20640
|
ReferenceChip,
|
|
20310
20641
|
{
|
|
20311
20642
|
reference,
|
|
@@ -20313,29 +20644,29 @@ function Chat({
|
|
|
20313
20644
|
},
|
|
20314
20645
|
getReferenceKey(reference)
|
|
20315
20646
|
)) }),
|
|
20316
|
-
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */
|
|
20647
|
+
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ jsx60("div", { className: "flex flex-wrap gap-1.5 mb-2", children: humanAttachments.map((file, fileIndex) => /* @__PURE__ */ jsxs42(
|
|
20317
20648
|
"div",
|
|
20318
20649
|
{
|
|
20319
20650
|
className: "flex items-center gap-1.5 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs",
|
|
20320
20651
|
children: [
|
|
20321
|
-
/* @__PURE__ */
|
|
20322
|
-
/* @__PURE__ */
|
|
20652
|
+
/* @__PURE__ */ jsx60(FileText5, { size: 12 }),
|
|
20653
|
+
/* @__PURE__ */ jsx60("span", { className: "max-w-[100px] truncate", children: file.originalName ?? file.id })
|
|
20323
20654
|
]
|
|
20324
20655
|
},
|
|
20325
20656
|
fileIndex
|
|
20326
20657
|
)) }),
|
|
20327
|
-
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */
|
|
20658
|
+
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ jsx60(
|
|
20328
20659
|
"p",
|
|
20329
20660
|
{
|
|
20330
20661
|
className: "wrap-break-word text-sm leading-relaxed",
|
|
20331
20662
|
children: formatMessageContent(part)
|
|
20332
20663
|
},
|
|
20333
20664
|
`${part.type}-${partIndex}`
|
|
20334
|
-
)) : /* @__PURE__ */
|
|
20665
|
+
)) : /* @__PURE__ */ jsx60("span", { className: "wrap-break-word text-sm leading-relaxed", children: formatMessageContent(message.content) })
|
|
20335
20666
|
] })
|
|
20336
20667
|
}
|
|
20337
20668
|
),
|
|
20338
|
-
/* @__PURE__ */
|
|
20669
|
+
/* @__PURE__ */ jsx60(
|
|
20339
20670
|
MessageActions,
|
|
20340
20671
|
{
|
|
20341
20672
|
content: messageContent,
|
|
@@ -20373,7 +20704,7 @@ function Chat({
|
|
|
20373
20704
|
stream.isLoading,
|
|
20374
20705
|
{ now: streamingNow }
|
|
20375
20706
|
);
|
|
20376
|
-
return /* @__PURE__ */
|
|
20707
|
+
return /* @__PURE__ */ jsx60("div", { className: "flex justify-start gap-3 -ml-2", children: /* @__PURE__ */ jsx60("div", { className: "max-w-full rounded-2xl py-2.5", children: /* @__PURE__ */ jsx60(
|
|
20377
20708
|
AssistantStreamingIndicator,
|
|
20378
20709
|
{
|
|
20379
20710
|
status: fallbackStreamingStatus ?? "loading"
|
|
@@ -20384,7 +20715,7 @@ function Chat({
|
|
|
20384
20715
|
]
|
|
20385
20716
|
}
|
|
20386
20717
|
),
|
|
20387
|
-
!isAtBottom && messages.length > 0 && /* @__PURE__ */
|
|
20718
|
+
!isAtBottom && messages.length > 0 && /* @__PURE__ */ jsx60("div", { className: "sticky bottom-20 z-20 flex justify-center px-4 pointer-events-none", children: /* @__PURE__ */ jsx60(
|
|
20388
20719
|
Button,
|
|
20389
20720
|
{
|
|
20390
20721
|
type: "button",
|
|
@@ -20397,10 +20728,10 @@ function Chat({
|
|
|
20397
20728
|
onClick: () => scrollToBottom(true, true),
|
|
20398
20729
|
"aria-label": t("chat.scrollToBottom"),
|
|
20399
20730
|
title: t("chat.scrollToBottom"),
|
|
20400
|
-
children: /* @__PURE__ */
|
|
20731
|
+
children: /* @__PURE__ */ jsx60(ArrowDown2, { size: 16 })
|
|
20401
20732
|
}
|
|
20402
20733
|
) }),
|
|
20403
|
-
quoteSelection && /* @__PURE__ */
|
|
20734
|
+
quoteSelection && /* @__PURE__ */ jsx60(
|
|
20404
20735
|
"div",
|
|
20405
20736
|
{
|
|
20406
20737
|
className: "pointer-events-none fixed z-50",
|
|
@@ -20409,7 +20740,7 @@ function Chat({
|
|
|
20409
20740
|
left: `${quoteSelection.left}px`,
|
|
20410
20741
|
transform: "translateX(-50%)"
|
|
20411
20742
|
},
|
|
20412
|
-
children: /* @__PURE__ */
|
|
20743
|
+
children: /* @__PURE__ */ jsxs42(
|
|
20413
20744
|
Button,
|
|
20414
20745
|
{
|
|
20415
20746
|
type: "button",
|
|
@@ -20421,22 +20752,22 @@ function Chat({
|
|
|
20421
20752
|
"aria-label": t("composer.quoteSelection"),
|
|
20422
20753
|
title: t("composer.quoteSelection"),
|
|
20423
20754
|
children: [
|
|
20424
|
-
/* @__PURE__ */
|
|
20755
|
+
/* @__PURE__ */ jsx60(Quote, { size: 14 }),
|
|
20425
20756
|
t("composer.quoteSelection")
|
|
20426
20757
|
]
|
|
20427
20758
|
}
|
|
20428
20759
|
)
|
|
20429
20760
|
}
|
|
20430
20761
|
),
|
|
20431
|
-
/* @__PURE__ */
|
|
20762
|
+
/* @__PURE__ */ jsxs42(
|
|
20432
20763
|
"div",
|
|
20433
20764
|
{
|
|
20434
20765
|
"data-slot": "chatkit-chat-composer",
|
|
20435
20766
|
className: "mx-auto w-full p-2 sticky bottom-0 z-10 bg-background",
|
|
20436
20767
|
style: chatColumnStyle,
|
|
20437
20768
|
children: [
|
|
20438
|
-
threadErrorMessage && /* @__PURE__ */
|
|
20439
|
-
/* @__PURE__ */
|
|
20769
|
+
threadErrorMessage && /* @__PURE__ */ jsx60("div", { className: "mb-3 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive overflow-auto", children: threadErrorMessage }),
|
|
20770
|
+
/* @__PURE__ */ jsx60(
|
|
20440
20771
|
ChatAttachments,
|
|
20441
20772
|
{
|
|
20442
20773
|
ref: attachmentsRef,
|
|
@@ -20450,7 +20781,7 @@ function Chat({
|
|
|
20450
20781
|
onStateChange: setAttachmentState
|
|
20451
20782
|
}
|
|
20452
20783
|
),
|
|
20453
|
-
references.length > 0 && /* @__PURE__ */
|
|
20784
|
+
references.length > 0 && /* @__PURE__ */ jsx60("div", { className: "mb-3 flex flex-wrap gap-2", children: references.map((reference) => /* @__PURE__ */ jsx60(
|
|
20454
20785
|
ReferenceChip,
|
|
20455
20786
|
{
|
|
20456
20787
|
reference,
|
|
@@ -20464,7 +20795,7 @@ function Chat({
|
|
|
20464
20795
|
},
|
|
20465
20796
|
getReferenceKey(reference)
|
|
20466
20797
|
)) }),
|
|
20467
|
-
/* @__PURE__ */
|
|
20798
|
+
/* @__PURE__ */ jsx60(
|
|
20468
20799
|
DetachedRunRuntimeCapabilities,
|
|
20469
20800
|
{
|
|
20470
20801
|
options: detachedRunRuntimeCapabilityOptions,
|
|
@@ -20473,7 +20804,7 @@ function Chat({
|
|
|
20473
20804
|
onRemove: removeRunRuntimeCapability
|
|
20474
20805
|
}
|
|
20475
20806
|
),
|
|
20476
|
-
showGoalStatus && /* @__PURE__ */
|
|
20807
|
+
showGoalStatus && /* @__PURE__ */ jsxs42(
|
|
20477
20808
|
"div",
|
|
20478
20809
|
{
|
|
20479
20810
|
className: cn(
|
|
@@ -20481,7 +20812,7 @@ function Chat({
|
|
|
20481
20812
|
isGoalObjectiveExpanded ? "items-start" : "items-center"
|
|
20482
20813
|
),
|
|
20483
20814
|
children: [
|
|
20484
|
-
/* @__PURE__ */
|
|
20815
|
+
/* @__PURE__ */ jsx60(
|
|
20485
20816
|
Target3,
|
|
20486
20817
|
{
|
|
20487
20818
|
className: cn(
|
|
@@ -20490,13 +20821,13 @@ function Chat({
|
|
|
20490
20821
|
)
|
|
20491
20822
|
}
|
|
20492
20823
|
),
|
|
20493
|
-
/* @__PURE__ */
|
|
20494
|
-
/* @__PURE__ */
|
|
20495
|
-
/* @__PURE__ */
|
|
20496
|
-
threadGoal && /* @__PURE__ */
|
|
20497
|
-
isGoalLoading && /* @__PURE__ */
|
|
20824
|
+
/* @__PURE__ */ jsxs42("div", { className: "min-w-0 flex-1", children: [
|
|
20825
|
+
/* @__PURE__ */ jsxs42("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
20826
|
+
/* @__PURE__ */ jsx60("span", { className: "font-medium", children: t("chat.goal.label") }),
|
|
20827
|
+
threadGoal && /* @__PURE__ */ jsx60("span", { className: "shrink-0 rounded-md bg-muted px-1.5 py-0.5 text-[11px] text-muted-foreground", children: t(`chat.goal.status.${threadGoal.status}`) }),
|
|
20828
|
+
isGoalLoading && /* @__PURE__ */ jsx60(Loader212, { className: "size-3 animate-spin text-muted-foreground" })
|
|
20498
20829
|
] }),
|
|
20499
|
-
/* @__PURE__ */
|
|
20830
|
+
/* @__PURE__ */ jsx60(
|
|
20500
20831
|
"div",
|
|
20501
20832
|
{
|
|
20502
20833
|
className: cn(
|
|
@@ -20506,13 +20837,13 @@ function Chat({
|
|
|
20506
20837
|
children: goalError || threadGoal?.objective
|
|
20507
20838
|
}
|
|
20508
20839
|
),
|
|
20509
|
-
threadGoal && /* @__PURE__ */
|
|
20840
|
+
threadGoal && /* @__PURE__ */ jsx60("div", { className: "mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground", children: /* @__PURE__ */ jsx60("span", { children: t("chat.goal.elapsed", {
|
|
20510
20841
|
elapsed: formatGoalElapsed(displayedGoalElapsedSeconds)
|
|
20511
20842
|
}) }) })
|
|
20512
20843
|
] }),
|
|
20513
|
-
threadGoal && /* @__PURE__ */
|
|
20514
|
-
/* @__PURE__ */
|
|
20515
|
-
/* @__PURE__ */
|
|
20844
|
+
threadGoal && /* @__PURE__ */ jsxs42("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
20845
|
+
/* @__PURE__ */ jsxs42(Tooltip, { children: [
|
|
20846
|
+
/* @__PURE__ */ jsx60(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx60(
|
|
20516
20847
|
Button,
|
|
20517
20848
|
{
|
|
20518
20849
|
type: "button",
|
|
@@ -20523,13 +20854,13 @@ function Chat({
|
|
|
20523
20854
|
const prefix = "/goal edit ";
|
|
20524
20855
|
setComposerText(`${prefix}${threadGoal.objective}`);
|
|
20525
20856
|
},
|
|
20526
|
-
children: /* @__PURE__ */
|
|
20857
|
+
children: /* @__PURE__ */ jsx60(Pencil4, { className: "size-3" })
|
|
20527
20858
|
}
|
|
20528
20859
|
) }),
|
|
20529
|
-
/* @__PURE__ */
|
|
20860
|
+
/* @__PURE__ */ jsx60(TooltipContent, { children: t("chat.goal.edit") })
|
|
20530
20861
|
] }),
|
|
20531
|
-
/* @__PURE__ */
|
|
20532
|
-
/* @__PURE__ */
|
|
20862
|
+
/* @__PURE__ */ jsxs42(Tooltip, { children: [
|
|
20863
|
+
/* @__PURE__ */ jsx60(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx60(
|
|
20533
20864
|
Button,
|
|
20534
20865
|
{
|
|
20535
20866
|
type: "button",
|
|
@@ -20545,13 +20876,13 @@ function Chat({
|
|
|
20545
20876
|
executionType: "insert_invocation"
|
|
20546
20877
|
}
|
|
20547
20878
|
}),
|
|
20548
|
-
children: threadGoal.status === "paused" ? /* @__PURE__ */
|
|
20879
|
+
children: threadGoal.status === "paused" ? /* @__PURE__ */ jsx60(Play, { className: "size-3" }) : /* @__PURE__ */ jsx60(Pause, { className: "size-3" })
|
|
20549
20880
|
}
|
|
20550
20881
|
) }),
|
|
20551
|
-
/* @__PURE__ */
|
|
20882
|
+
/* @__PURE__ */ jsx60(TooltipContent, { children: threadGoal.status === "paused" ? t("chat.goal.resume") : t("chat.goal.pause") })
|
|
20552
20883
|
] }),
|
|
20553
|
-
/* @__PURE__ */
|
|
20554
|
-
/* @__PURE__ */
|
|
20884
|
+
/* @__PURE__ */ jsxs42(Tooltip, { children: [
|
|
20885
|
+
/* @__PURE__ */ jsx60(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx60(
|
|
20555
20886
|
Button,
|
|
20556
20887
|
{
|
|
20557
20888
|
type: "button",
|
|
@@ -20567,13 +20898,13 @@ function Chat({
|
|
|
20567
20898
|
executionType: "insert_invocation"
|
|
20568
20899
|
}
|
|
20569
20900
|
}),
|
|
20570
|
-
children: /* @__PURE__ */
|
|
20901
|
+
children: /* @__PURE__ */ jsx60(Trash23, { className: "size-3" })
|
|
20571
20902
|
}
|
|
20572
20903
|
) }),
|
|
20573
|
-
/* @__PURE__ */
|
|
20904
|
+
/* @__PURE__ */ jsx60(TooltipContent, { children: t("chat.goal.clear") })
|
|
20574
20905
|
] }),
|
|
20575
|
-
threadGoal.objective && !goalError && /* @__PURE__ */
|
|
20576
|
-
/* @__PURE__ */
|
|
20906
|
+
threadGoal.objective && !goalError && /* @__PURE__ */ jsxs42(Tooltip, { children: [
|
|
20907
|
+
/* @__PURE__ */ jsx60(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx60(
|
|
20577
20908
|
Button,
|
|
20578
20909
|
{
|
|
20579
20910
|
type: "button",
|
|
@@ -20582,7 +20913,7 @@ function Chat({
|
|
|
20582
20913
|
"aria-expanded": isGoalObjectiveExpanded,
|
|
20583
20914
|
"aria-label": isGoalObjectiveExpanded ? t("chat.goal.collapseObjective") : t("chat.goal.expandObjective"),
|
|
20584
20915
|
onClick: () => setIsGoalObjectiveExpanded((expanded) => !expanded),
|
|
20585
|
-
children: /* @__PURE__ */
|
|
20916
|
+
children: /* @__PURE__ */ jsx60(
|
|
20586
20917
|
ChevronDown5,
|
|
20587
20918
|
{
|
|
20588
20919
|
className: cn(
|
|
@@ -20593,13 +20924,13 @@ function Chat({
|
|
|
20593
20924
|
)
|
|
20594
20925
|
}
|
|
20595
20926
|
) }),
|
|
20596
|
-
/* @__PURE__ */
|
|
20927
|
+
/* @__PURE__ */ jsx60(TooltipContent, { children: isGoalObjectiveExpanded ? t("chat.goal.collapseObjective") : t("chat.goal.expandObjective") })
|
|
20597
20928
|
] })
|
|
20598
20929
|
] })
|
|
20599
20930
|
]
|
|
20600
20931
|
}
|
|
20601
20932
|
),
|
|
20602
|
-
/* @__PURE__ */
|
|
20933
|
+
/* @__PURE__ */ jsx60(
|
|
20603
20934
|
PendingRuntimeServices,
|
|
20604
20935
|
{
|
|
20605
20936
|
state: stream.runtimeActivities.sandboxServices,
|
|
@@ -20608,7 +20939,7 @@ function Chat({
|
|
|
20608
20939
|
className: hasPendingTodos || hasPendingFollowUps ? "mb-2" : void 0
|
|
20609
20940
|
}
|
|
20610
20941
|
),
|
|
20611
|
-
/* @__PURE__ */
|
|
20942
|
+
/* @__PURE__ */ jsx60(
|
|
20612
20943
|
PendingTodos,
|
|
20613
20944
|
{
|
|
20614
20945
|
snapshot: stream.todos,
|
|
@@ -20616,7 +20947,7 @@ function Chat({
|
|
|
20616
20947
|
className: hasPendingFollowUps ? "mb-2" : void 0
|
|
20617
20948
|
}
|
|
20618
20949
|
),
|
|
20619
|
-
/* @__PURE__ */
|
|
20950
|
+
/* @__PURE__ */ jsx60(
|
|
20620
20951
|
PendingFollowUps,
|
|
20621
20952
|
{
|
|
20622
20953
|
items: pendingFollowUps,
|
|
@@ -20629,7 +20960,7 @@ function Chat({
|
|
|
20629
20960
|
attachToComposer: true
|
|
20630
20961
|
}
|
|
20631
20962
|
),
|
|
20632
|
-
/* @__PURE__ */
|
|
20963
|
+
/* @__PURE__ */ jsx60(
|
|
20633
20964
|
RequestUserInputPanel,
|
|
20634
20965
|
{
|
|
20635
20966
|
request: stream.pendingRequestUserInput,
|
|
@@ -20638,7 +20969,7 @@ function Chat({
|
|
|
20638
20969
|
attachToComposer: true
|
|
20639
20970
|
}
|
|
20640
20971
|
),
|
|
20641
|
-
/* @__PURE__ */
|
|
20972
|
+
/* @__PURE__ */ jsx60(
|
|
20642
20973
|
HITLApprovalPanel,
|
|
20643
20974
|
{
|
|
20644
20975
|
request: stream.pendingHITLRequest,
|
|
@@ -20647,7 +20978,7 @@ function Chat({
|
|
|
20647
20978
|
attachToComposer: true
|
|
20648
20979
|
}
|
|
20649
20980
|
),
|
|
20650
|
-
runtimeCapabilityPalette && /* @__PURE__ */
|
|
20981
|
+
runtimeCapabilityPalette && /* @__PURE__ */ jsx60(
|
|
20651
20982
|
SlashPalette,
|
|
20652
20983
|
{
|
|
20653
20984
|
palette: runtimeCapabilityPalette,
|
|
@@ -20661,7 +20992,7 @@ function Chat({
|
|
|
20661
20992
|
onSelect: selectSlashPaletteOption
|
|
20662
20993
|
}
|
|
20663
20994
|
),
|
|
20664
|
-
/* @__PURE__ */
|
|
20995
|
+
/* @__PURE__ */ jsx60("form", { className: "flex items-end", onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs42(
|
|
20665
20996
|
"div",
|
|
20666
20997
|
{
|
|
20667
20998
|
"data-slot": "composer-input-shell",
|
|
@@ -20675,7 +21006,7 @@ function Chat({
|
|
|
20675
21006
|
composerInputRoundedClass
|
|
20676
21007
|
),
|
|
20677
21008
|
children: [
|
|
20678
|
-
/* @__PURE__ */
|
|
21009
|
+
/* @__PURE__ */ jsx60(
|
|
20679
21010
|
"div",
|
|
20680
21011
|
{
|
|
20681
21012
|
ref: composerInputRef,
|
|
@@ -20685,6 +21016,7 @@ function Chat({
|
|
|
20685
21016
|
contentEditable: !(missingConfig || isHistoryLoading || hasPendingInteractiveRequest),
|
|
20686
21017
|
suppressContentEditableWarning: true,
|
|
20687
21018
|
onInput: handleComposerInput,
|
|
21019
|
+
onCompositionStart: handleComposerCompositionStart,
|
|
20688
21020
|
onCompositionEnd: handleComposerCompositionEnd,
|
|
20689
21021
|
onSelect: handleComposerSelect,
|
|
20690
21022
|
onPaste: handleComposerPaste,
|
|
@@ -20697,19 +21029,19 @@ function Chat({
|
|
|
20697
21029
|
(missingConfig || isHistoryLoading || hasPendingInteractiveRequest) && "cursor-not-allowed opacity-50"
|
|
20698
21030
|
),
|
|
20699
21031
|
children: renderedComposerParts.map(
|
|
20700
|
-
(part, index) => part.type === "text" ? /* @__PURE__ */
|
|
21032
|
+
(part, index) => part.type === "text" ? /* @__PURE__ */ jsx60(React56.Fragment, { children: part.text }, `text-${index}`) : /* @__PURE__ */ jsx60(ComposerCapabilityToken, { part }, part.key)
|
|
20701
21033
|
)
|
|
20702
21034
|
},
|
|
20703
21035
|
composerDomVersion
|
|
20704
21036
|
),
|
|
20705
|
-
/* @__PURE__ */
|
|
21037
|
+
/* @__PURE__ */ jsxs42(
|
|
20706
21038
|
"div",
|
|
20707
21039
|
{
|
|
20708
21040
|
"data-slot": "composer-action-bar",
|
|
20709
21041
|
className: "pointer-events-none absolute inset-x-1.5 bottom-1 flex min-h-10 items-center justify-between gap-2",
|
|
20710
21042
|
children: [
|
|
20711
|
-
/* @__PURE__ */
|
|
20712
|
-
/* @__PURE__ */
|
|
21043
|
+
/* @__PURE__ */ jsxs42("div", { className: "pointer-events-none flex min-w-0 flex-1 items-center gap-1.5", children: [
|
|
21044
|
+
/* @__PURE__ */ jsx60("div", { className: "pointer-events-auto flex shrink-0 items-center gap-1.5", children: /* @__PURE__ */ jsx60(
|
|
20713
21045
|
ComposerMenu,
|
|
20714
21046
|
{
|
|
20715
21047
|
composer,
|
|
@@ -20727,20 +21059,20 @@ function Chat({
|
|
|
20727
21059
|
disabled: missingConfig || isHistoryLoading || hasPendingInteractiveRequest
|
|
20728
21060
|
}
|
|
20729
21061
|
) }),
|
|
20730
|
-
selectedTool && /* @__PURE__ */
|
|
20731
|
-
/* @__PURE__ */
|
|
20732
|
-
/* @__PURE__ */
|
|
21062
|
+
selectedTool && /* @__PURE__ */ jsxs42("span", { className: "pointer-events-auto inline-flex h-8 min-w-0 max-w-[14rem] shrink items-center gap-1.5 rounded-full bg-primary/10 px-2 text-xs font-medium text-primary transition-all duration-200", children: [
|
|
21063
|
+
/* @__PURE__ */ jsx60("span", { className: "truncate", children: selectedTool.shortLabel ?? selectedTool.label }),
|
|
21064
|
+
/* @__PURE__ */ jsx60(
|
|
20733
21065
|
"button",
|
|
20734
21066
|
{
|
|
20735
21067
|
type: "button",
|
|
20736
21068
|
onClick: () => setSelectedTool(null),
|
|
20737
21069
|
className: "shrink-0 rounded-full p-0.5 text-primary/70 hover:bg-primary/10 hover:text-primary",
|
|
20738
|
-
children: /* @__PURE__ */
|
|
21070
|
+
children: /* @__PURE__ */ jsx60(X10, { size: 12 })
|
|
20739
21071
|
}
|
|
20740
21072
|
)
|
|
20741
21073
|
] })
|
|
20742
21074
|
] }),
|
|
20743
|
-
/* @__PURE__ */
|
|
21075
|
+
/* @__PURE__ */ jsx60("div", { className: "pointer-events-auto shrink-0", children: /* @__PURE__ */ jsx60(
|
|
20744
21076
|
SendButton,
|
|
20745
21077
|
{
|
|
20746
21078
|
disabled: isSendDisabled,
|
|
@@ -20763,7 +21095,7 @@ function Chat({
|
|
|
20763
21095
|
]
|
|
20764
21096
|
}
|
|
20765
21097
|
) }),
|
|
20766
|
-
disclaimer?.text && /* @__PURE__ */
|
|
21098
|
+
disclaimer?.text && /* @__PURE__ */ jsx60(
|
|
20767
21099
|
"p",
|
|
20768
21100
|
{
|
|
20769
21101
|
className: cn(
|
|
@@ -20773,14 +21105,14 @@ function Chat({
|
|
|
20773
21105
|
children: disclaimer.text
|
|
20774
21106
|
}
|
|
20775
21107
|
),
|
|
20776
|
-
/* @__PURE__ */
|
|
20777
|
-
/* @__PURE__ */
|
|
20778
|
-
/* @__PURE__ */
|
|
21108
|
+
/* @__PURE__ */ jsxs42("div", { className: "mt-2 flex items-center justify-center gap-2 text-xs text-muted-foreground", children: [
|
|
21109
|
+
/* @__PURE__ */ jsx60("span", { children: t("chat.poweredBy") }),
|
|
21110
|
+
/* @__PURE__ */ jsx60(ContextUsageIndicator, { className: "absolute right-4" })
|
|
20779
21111
|
] })
|
|
20780
21112
|
]
|
|
20781
21113
|
}
|
|
20782
21114
|
),
|
|
20783
|
-
/* @__PURE__ */
|
|
21115
|
+
/* @__PURE__ */ jsx60(
|
|
20784
21116
|
SettingsSheet,
|
|
20785
21117
|
{
|
|
20786
21118
|
open: petSettingsOpen,
|
|
@@ -20790,11 +21122,11 @@ function Chat({
|
|
|
20790
21122
|
onSave: savePetLocalSettings
|
|
20791
21123
|
}
|
|
20792
21124
|
),
|
|
20793
|
-
/* @__PURE__ */
|
|
21125
|
+
/* @__PURE__ */ jsx60(PetBridge, { pet: effectivePet, state: petAutoState })
|
|
20794
21126
|
]
|
|
20795
21127
|
}
|
|
20796
21128
|
),
|
|
20797
|
-
taskSummaryAvailable && taskSummaryDocked && taskSummaryOpen && /* @__PURE__ */
|
|
21129
|
+
taskSummaryAvailable && taskSummaryDocked && taskSummaryOpen && /* @__PURE__ */ jsx60("div", { className: "pointer-events-none absolute right-5 top-3 z-20 max-h-[calc(100%-1.5rem)] w-80", children: /* @__PURE__ */ jsx60(
|
|
20798
21130
|
TaskSummaryPanel,
|
|
20799
21131
|
{
|
|
20800
21132
|
...taskSummaryProps,
|
|
@@ -20807,10 +21139,10 @@ function Chat({
|
|
|
20807
21139
|
}
|
|
20808
21140
|
|
|
20809
21141
|
// src/components/ui/separator.tsx
|
|
20810
|
-
import * as
|
|
20811
|
-
import { jsx as
|
|
20812
|
-
var Separator =
|
|
20813
|
-
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */
|
|
21142
|
+
import * as React57 from "react";
|
|
21143
|
+
import { jsx as jsx61 } from "react/jsx-runtime";
|
|
21144
|
+
var Separator = React57.forwardRef(
|
|
21145
|
+
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ jsx61(
|
|
20814
21146
|
"div",
|
|
20815
21147
|
{
|
|
20816
21148
|
ref,
|