@xpert-ai/chatkit-ui 0.3.3 → 0.3.5
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-DxHYvQh5.js → _baseUniq-CAxobs9N.js} +1 -1
- package/dist/app/assets/{abap-DVajZIEh.js → abap-wdK8JaHa.js} +1 -1
- package/dist/app/assets/{abnf-46NjTOlf.js → abnf-B4QVrCDX.js} +1 -1
- package/dist/app/assets/{actionscript-CQpj0cg3.js → actionscript-BbKSvJrq.js} +1 -1
- package/dist/app/assets/{ada-C-kX0zii.js → ada-BkwiItKH.js} +1 -1
- package/dist/app/assets/{agda-CCA_JAgT.js → agda-BHGf_Fgl.js} +1 -1
- package/dist/app/assets/{al-Dnw0hERO.js → al-CpdhQzD9.js} +1 -1
- package/dist/app/assets/{antlr4-vIL0hfzJ.js → antlr4-CLQ7xEno.js} +1 -1
- package/dist/app/assets/{apacheconf-CsWzUs9D.js → apacheconf-6iBdrfFM.js} +1 -1
- package/dist/app/assets/{apex-QViHF4AC.js → apex-DBXBvaz5.js} +1 -1
- package/dist/app/assets/{apl-J2xZukMp.js → apl-D8vc149P.js} +1 -1
- package/dist/app/assets/{applescript-B3WjGs4M.js → applescript-BTZUYWS_.js} +1 -1
- package/dist/app/assets/{aql-NAU-bvN_.js → aql-BxB6KDJQ.js} +1 -1
- package/dist/app/assets/{arc-B8hwrBK1.js → arc-CNi1G9DJ.js} +1 -1
- package/dist/app/assets/{architectureDiagram-Q4EWVU46-CpVpAf2q.js → architectureDiagram-Q4EWVU46-BL0mPAR9.js} +1 -1
- package/dist/app/assets/{arduino-CHYJARcG.js → arduino-Cx04QCrp.js} +1 -1
- package/dist/app/assets/{arff-DqAcq_Jd.js → arff-MqnrnEC8.js} +1 -1
- package/dist/app/assets/{asciidoc-DXFN4u3C.js → asciidoc-sz7M5yXr.js} +1 -1
- package/dist/app/assets/{asm6502-yvmvLNPw.js → asm6502-BZ8xfWko.js} +1 -1
- package/dist/app/assets/{asmatmel-BNt_bXxW.js → asmatmel-D-cI_as7.js} +1 -1
- package/dist/app/assets/{aspnet-BMD5jkWc.js → aspnet-wNdsZF1M.js} +1 -1
- package/dist/app/assets/{autohotkey-CHZS5zbL.js → autohotkey-CERdGivs.js} +1 -1
- package/dist/app/assets/{autoit-DLLmQkuM.js → autoit-CQsoUza0.js} +1 -1
- package/dist/app/assets/{avisynth-C8BxdbSe.js → avisynth-DMTk2nsi.js} +1 -1
- package/dist/app/assets/{avro-idl-C6pwRw5e.js → avro-idl-VdXZfwVL.js} +1 -1
- package/dist/app/assets/{bash-CMOTacbo.js → bash-BKoQnhB6.js} +1 -1
- package/dist/app/assets/{basic-TZKBsQ-m.js → basic-BvRsQ9vo.js} +1 -1
- package/dist/app/assets/{batch-CaE8zhSL.js → batch-DkZb4POU.js} +1 -1
- package/dist/app/assets/{bbcode-DcenEstk.js → bbcode-BkkYngk6.js} +1 -1
- package/dist/app/assets/{bicep-M0WBFGSH.js → bicep-DY62eX6n.js} +1 -1
- package/dist/app/assets/{birb-EkEU1ZCa.js → birb-Cf3Wn8DP.js} +1 -1
- package/dist/app/assets/{bison-M-w8qpdO.js → bison-CMVsgR8E.js} +1 -1
- package/dist/app/assets/{blockDiagram-DXYQGD6D-Cb71R9Wk.js → blockDiagram-DXYQGD6D-DdgOXTCq.js} +1 -1
- package/dist/app/assets/{bnf-BnYdZYNM.js → bnf-C53AC5ba.js} +1 -1
- package/dist/app/assets/{brainfuck-BjHrlOp6.js → brainfuck-DBcYtGip.js} +1 -1
- package/dist/app/assets/{brightscript-D2KWeGkG.js → brightscript-uWYyj7Le.js} +1 -1
- package/dist/app/assets/{bro-Cm3J_z1e.js → bro-Bnqn5jLn.js} +1 -1
- package/dist/app/assets/{bsl-aaIhCboX.js → bsl-eeHcx6I3.js} +1 -1
- package/dist/app/assets/{c-Cromo6GX.js → c-Y_E2ZZ8h.js} +1 -1
- package/dist/app/assets/{c4Diagram-AHTNJAMY-CzSUyxD_.js → c4Diagram-AHTNJAMY-BAZeiIaA.js} +1 -1
- package/dist/app/assets/{cfscript-DjqhIng2.js → cfscript-swSriW5q.js} +1 -1
- package/dist/app/assets/{chaiscript-Vo_Ts9eo.js → chaiscript-BHR5pIfl.js} +1 -1
- package/dist/app/assets/channel-C4IK_RZn.js +1 -0
- package/dist/app/assets/{chunk-4BX2VUAB-aAUlAQil.js → chunk-4BX2VUAB-Deyo77pg.js} +1 -1
- package/dist/app/assets/{chunk-4TB4RGXK-8S_2Lm6g.js → chunk-4TB4RGXK-BSgPz1Fn.js} +1 -1
- package/dist/app/assets/{chunk-55IACEB6-Dz5quBWg.js → chunk-55IACEB6-DekOqO8-.js} +1 -1
- package/dist/app/assets/{chunk-EDXVE4YY-BhH3k95q.js → chunk-EDXVE4YY-VI2aoR3H.js} +1 -1
- package/dist/app/assets/{chunk-FMBD7UC4-BYUrcbwm.js → chunk-FMBD7UC4-DVPMFZIh.js} +1 -1
- package/dist/app/assets/{chunk-OYMX7WX6-DTytW7cJ.js → chunk-OYMX7WX6-C_5OySCp.js} +1 -1
- package/dist/app/assets/{chunk-QZHKN3VN-DCg0fs-A.js → chunk-QZHKN3VN-CQ4PJ94U.js} +1 -1
- package/dist/app/assets/{chunk-YZCP3GAM-Ck9WxSs5.js → chunk-YZCP3GAM-40VMFur6.js} +1 -1
- package/dist/app/assets/{cil-Dy9yDCJC.js → cil-BlB-Qnhz.js} +1 -1
- package/dist/app/assets/classDiagram-6PBFFD2Q-LicCc7Qv.js +1 -0
- package/dist/app/assets/classDiagram-v2-HSJHXN6E-LicCc7Qv.js +1 -0
- package/dist/app/assets/{clike-B3pqz2AZ.js → clike-cGW_OpAz.js} +1 -1
- package/dist/app/assets/{clojure-DVRtvSwX.js → clojure-BwM8_y2w.js} +1 -1
- package/dist/app/assets/clone-BC1Apkgy.js +1 -0
- package/dist/app/assets/{cmake-13muG7rK.js → cmake-B_tPIs0N.js} +1 -1
- package/dist/app/assets/{cobol-Jbr347RJ.js → cobol-awMTn3SL.js} +1 -1
- package/dist/app/assets/{coffeescript-B3DOm1Ne.js → coffeescript-BdPUATdq.js} +1 -1
- package/dist/app/assets/{concurnas-CNySoRHf.js → concurnas-DD4NroNG.js} +1 -1
- package/dist/app/assets/{coq-K-m5AUlH.js → coq-WP9t6Mya.js} +1 -1
- package/dist/app/assets/{core-BPN6CWxM.js → core-Dl1d1z_B.js} +1 -1
- package/dist/app/assets/{cose-bilkent-S5V4N54A-Dr0iADox.js → cose-bilkent-S5V4N54A-CIsQWWLS.js} +1 -1
- package/dist/app/assets/{cpp-BCnzQvRU.js → cpp-DRq2558J.js} +1 -1
- package/dist/app/assets/{crystal-PCOcWoSI.js → crystal-CmMEvlYk.js} +1 -1
- package/dist/app/assets/{csharp-8stZQY6C.js → csharp-CmdWJQ_7.js} +1 -1
- package/dist/app/assets/{cshtml-DoI3CcDS.js → cshtml-D-PG0yKy.js} +1 -1
- package/dist/app/assets/{csp-BKUbys7F.js → csp-CoYEQK4_.js} +1 -1
- package/dist/app/assets/{css-extras-BjUA2auB.js → css-extras-CvcfPwL5.js} +1 -1
- package/dist/app/assets/{css-0jn1p1e6.js → css-qzCJaYzE.js} +1 -1
- package/dist/app/assets/{csv-ChtyJ7Mw.js → csv-BOSHHM-P.js} +1 -1
- package/dist/app/assets/{cypher-BSoDMy4m.js → cypher-DF-LRYf2.js} +1 -1
- package/dist/app/assets/{d-CAzhRG-Z.js → d-DT7HGItG.js} +1 -1
- package/dist/app/assets/{dagre-KV5264BT-BSVO3dNV.js → dagre-KV5264BT-BXDHR3FY.js} +1 -1
- package/dist/app/assets/{dart-C8bLX20e.js → dart-C53tv9tc.js} +1 -1
- package/dist/app/assets/{dataweave-Dmo6CZIu.js → dataweave-DfVl-B8U.js} +1 -1
- package/dist/app/assets/{dax-CmqnMRUH.js → dax-CtLDIvLu.js} +1 -1
- package/dist/app/assets/{dhall-QKB0WE21.js → dhall-B4vfpjKK.js} +1 -1
- package/dist/app/assets/{diagram-5BDNPKRD-r0Fz26nD.js → diagram-5BDNPKRD-C2jQZSnh.js} +1 -1
- package/dist/app/assets/{diagram-G4DWMVQ6-tVV9XZ9V.js → diagram-G4DWMVQ6-DkBF8pst.js} +1 -1
- package/dist/app/assets/{diagram-MMDJMWI5-B9rbYdY4.js → diagram-MMDJMWI5-DkBy1EJI.js} +1 -1
- package/dist/app/assets/{diagram-TYMM5635-Dsm73wxz.js → diagram-TYMM5635-BG7IFHFj.js} +1 -1
- package/dist/app/assets/{diff-PAv23eqQ.js → diff-CAGXr455.js} +1 -1
- package/dist/app/assets/{django-BIrl2Lvz.js → django-Bt-Xandi.js} +1 -1
- package/dist/app/assets/{dns-zone-file-ClLpdqMT.js → dns-zone-file-CUQqHN_u.js} +1 -1
- package/dist/app/assets/{docker-BDozNG3x.js → docker-Cmx-jfGB.js} +1 -1
- package/dist/app/assets/{dot-I-WZKdgb.js → dot-CtNw9lX4.js} +1 -1
- package/dist/app/assets/{ebnf-DkRUuKnr.js → ebnf-Dl_Q5Or1.js} +1 -1
- package/dist/app/assets/{editorconfig-BmLG6Etr.js → editorconfig-DZYXnV_C.js} +1 -1
- package/dist/app/assets/{eiffel-Bm2GdSQ2.js → eiffel-CgccC4xz.js} +1 -1
- package/dist/app/assets/{ejs-C48N5ZIG.js → ejs-Cj1dQzfI.js} +1 -1
- package/dist/app/assets/{elixir-CdyVGNb8.js → elixir-B3SWPivz.js} +1 -1
- package/dist/app/assets/{elm-CkQhPVjT.js → elm-Bp_TQfaA.js} +1 -1
- package/dist/app/assets/{erDiagram-SMLLAGMA-Hyk82Vhv.js → erDiagram-SMLLAGMA-Cby23XmU.js} +1 -1
- package/dist/app/assets/{erb-BX1eAGBM.js → erb-Cb-K6pZE.js} +1 -1
- package/dist/app/assets/{erlang-Czbnuk55.js → erlang-F72Fjwv2.js} +1 -1
- package/dist/app/assets/{etlua-i8hW4tPr.js → etlua-DFUJG9GZ.js} +1 -1
- package/dist/app/assets/{excel-formula-CyZOfUTa.js → excel-formula-B8hn4WlO.js} +1 -1
- package/dist/app/assets/{factor-AjGk3DF8.js → factor-BlEqbeI0.js} +1 -1
- package/dist/app/assets/{false-GhEvxGmO.js → false-DMURsqlU.js} +1 -1
- package/dist/app/assets/{firestore-security-rules-BjwnXyDp.js → firestore-security-rules-DswDVNNa.js} +1 -1
- package/dist/app/assets/{flow-h4-WME33.js → flow-C4reo-gu.js} +1 -1
- package/dist/app/assets/{flowDiagram-DWJPFMVM-BHEn2Y5w.js → flowDiagram-DWJPFMVM-BxNNsar9.js} +1 -1
- package/dist/app/assets/{fortran-8lcbfijs.js → fortran-BAmD5KHF.js} +1 -1
- package/dist/app/assets/{fsharp-x47H8jRh.js → fsharp-CPq2O12L.js} +1 -1
- package/dist/app/assets/{ftl-DBidAr07.js → ftl-Cgbeq2-z.js} +1 -1
- package/dist/app/assets/{ganttDiagram-T4ZO3ILL-eZ852Es7.js → ganttDiagram-T4ZO3ILL-BLd3DH-5.js} +1 -1
- package/dist/app/assets/{gap-gWkYaxLH.js → gap-Bge3tvcZ.js} +1 -1
- package/dist/app/assets/{gcode-C-XTnxAD.js → gcode-CAVcsFdN.js} +1 -1
- package/dist/app/assets/{gdscript-D4fLzJ7v.js → gdscript-nkDP0xMM.js} +1 -1
- package/dist/app/assets/{gedcom-D1MSjhRT.js → gedcom-BA8GnDnW.js} +1 -1
- package/dist/app/assets/{gherkin-BO4O8Wru.js → gherkin-DvBWzm8E.js} +1 -1
- package/dist/app/assets/{git-ClZL4XcF.js → git-LJ9ums7L.js} +1 -1
- package/dist/app/assets/{gitGraphDiagram-UUTBAWPF-C8frR-gR.js → gitGraphDiagram-UUTBAWPF-JZEE6gBT.js} +1 -1
- package/dist/app/assets/{glsl-BqI-_xG4.js → glsl-D4U4_9LH.js} +1 -1
- package/dist/app/assets/{gml-0_OiiWgt.js → gml-CQtoiCZT.js} +1 -1
- package/dist/app/assets/{gn-D1DB4wuu.js → gn-DxTb0Jqi.js} +1 -1
- package/dist/app/assets/{go-DRI0xPfv.js → go-D7ELL60F.js} +1 -1
- package/dist/app/assets/{go-module-BPPYgWaf.js → go-module-Ck8j-Kcm.js} +1 -1
- package/dist/app/assets/{graph-jtjuwIYJ.js → graph-pBSG-4mT.js} +1 -1
- package/dist/app/assets/{graphql-B8Ir2w1r.js → graphql-C-10AxQD.js} +1 -1
- package/dist/app/assets/{groovy-CmNBOym9.js → groovy-SpWCEWzX.js} +1 -1
- package/dist/app/assets/{haml-Bj89_11G.js → haml-C2aM6_El.js} +1 -1
- package/dist/app/assets/{handlebars-bpf-b1uX.js → handlebars-ChMYyLZl.js} +1 -1
- package/dist/app/assets/{haskell-BmbX5r9j.js → haskell-DagwvSeE.js} +1 -1
- package/dist/app/assets/{haxe-KC1m6Yfs.js → haxe-BG5B6d9K.js} +1 -1
- package/dist/app/assets/{hcl-CauJ5syT.js → hcl-B8Gd__02.js} +1 -1
- package/dist/app/assets/{hlsl-E3IzTavQ.js → hlsl-CSu8CgjO.js} +1 -1
- package/dist/app/assets/{hoon-DYduWlDF.js → hoon-BUjyY25K.js} +1 -1
- package/dist/app/assets/{hpkp-CPZobS10.js → hpkp-C5yMlUDS.js} +1 -1
- package/dist/app/assets/{hsts-CdUv0r9h.js → hsts-DzNiiTKI.js} +1 -1
- package/dist/app/assets/{http-UkfqLxHn.js → http-DYWI6rav.js} +1 -1
- package/dist/app/assets/{ichigojam-BXaYi-NN.js → ichigojam-DrBDAbYO.js} +1 -1
- package/dist/app/assets/{icon-DVY6xV3b.js → icon-BezsFCDL.js} +1 -1
- package/dist/app/assets/{icu-message-format-CvZ8c2Q6.js → icu-message-format-BCSOltos.js} +1 -1
- package/dist/app/assets/{idris-BzuUwcAy.js → idris-B8Tj6LSh.js} +1 -1
- package/dist/app/assets/{iecst-CIwIsrrB.js → iecst-CfA7HSP8.js} +1 -1
- package/dist/app/assets/{ignore-CE_RoV3v.js → ignore-E_v5CiMN.js} +1 -1
- package/dist/app/assets/index-BojjVNpv.css +1 -0
- package/dist/app/assets/{index-K4ACjQ4z.js → index-CAv2vOlh.js} +183 -183
- package/dist/app/assets/{infoDiagram-42DDH7IO-jLRXuR7y.js → infoDiagram-42DDH7IO-eZsn31yB.js} +1 -1
- package/dist/app/assets/{inform7-2Ky29vPV.js → inform7-Dj75C-lM.js} +1 -1
- package/dist/app/assets/{ini-pzovWlWw.js → ini-DnYgp5_G.js} +1 -1
- package/dist/app/assets/{io-DbXj-2n3.js → io-D59cMlU5.js} +1 -1
- package/dist/app/assets/{ishikawaDiagram-UXIWVN3A-CqnaMA1B.js → ishikawaDiagram-UXIWVN3A-Cb8G56a8.js} +1 -1
- package/dist/app/assets/{j-BTi0-Ndk.js → j-CuOplqKY.js} +1 -1
- package/dist/app/assets/{java-D3h3eulz.js → java-DiKpa4Y3.js} +1 -1
- package/dist/app/assets/{javadoc-BcY94P5A.js → javadoc-DshvkFVS.js} +1 -1
- package/dist/app/assets/{javadoclike-B-oibrTg.js → javadoclike-Dl0yZMbR.js} +1 -1
- package/dist/app/assets/{javascript-BO58mIYT.js → javascript-C3lRkH0T.js} +1 -1
- package/dist/app/assets/{javastacktrace-D4LNuQQI.js → javastacktrace-BAZDNyis.js} +1 -1
- package/dist/app/assets/{jexl-BYTP-082.js → jexl-BvqPLTYh.js} +1 -1
- package/dist/app/assets/{jolie-DT19e3xU.js → jolie-DXjsE0XX.js} +1 -1
- package/dist/app/assets/{journeyDiagram-VCZTEJTY-CcMgjqdN.js → journeyDiagram-VCZTEJTY-9aLWSRay.js} +1 -1
- package/dist/app/assets/{jq-BKWCQVpC.js → jq-CLFx4HBH.js} +1 -1
- package/dist/app/assets/{js-extras-DpgaBeGa.js → js-extras-D33J2WNl.js} +1 -1
- package/dist/app/assets/{js-templates-xh0zMX88.js → js-templates-DlMN6fgo.js} +1 -1
- package/dist/app/assets/{jsdoc-C-GvvPlU.js → jsdoc-CGVgLZ2j.js} +1 -1
- package/dist/app/assets/{json-B-VU32ZP.js → json-BTnVvJgU.js} +1 -1
- package/dist/app/assets/{json5-ghPj_aB9.js → json5-BW8yCajk.js} +1 -1
- package/dist/app/assets/{jsonp-CA6i5De0.js → jsonp-iQTQx19C.js} +1 -1
- package/dist/app/assets/{jsstacktrace-C7QFMHEB.js → jsstacktrace-DXxcFNfy.js} +1 -1
- package/dist/app/assets/{jsx-nL-WQ214.js → jsx-D1npDekI.js} +1 -1
- package/dist/app/assets/{julia-Be5ZIobg.js → julia-E711iN6A.js} +1 -1
- package/dist/app/assets/{kanban-definition-6JOO6SKY-Cq35Qt7t.js → kanban-definition-6JOO6SKY-COnahS5T.js} +1 -1
- package/dist/app/assets/{keepalived-D6qmVKo9.js → keepalived-Da5-tKqr.js} +1 -1
- package/dist/app/assets/{keyman-DnTqkRT5.js → keyman-CR_is7Lf.js} +1 -1
- package/dist/app/assets/{kotlin-DB6tjcPY.js → kotlin-6F8UihuI.js} +1 -1
- package/dist/app/assets/{kumir-BjeRoKMR.js → kumir-BGVXhhZU.js} +1 -1
- package/dist/app/assets/{kusto-kCMj8FOy.js → kusto-xzJ5QDBT.js} +1 -1
- package/dist/app/assets/{latex-BISFNoUQ.js → latex-jsq1GqdL.js} +1 -1
- package/dist/app/assets/{latte-B_3smOZu.js → latte-CqObxNvY.js} +1 -1
- package/dist/app/assets/{layout-UzqCfMri.js → layout-Od8azvI5.js} +1 -1
- package/dist/app/assets/{less-qcoyfYC_.js → less-vdQIwlhr.js} +1 -1
- package/dist/app/assets/{lilypond-BGKf1i8c.js → lilypond-CYhZp9Do.js} +1 -1
- package/dist/app/assets/{linear-C8-0wxbN.js → linear-BVmuh868.js} +1 -1
- package/dist/app/assets/{liquid-VrWadSAy.js → liquid-CF_8y_W1.js} +1 -1
- package/dist/app/assets/{lisp-BTjWqNUW.js → lisp-DqmYhGox.js} +1 -1
- package/dist/app/assets/{livescript-vNFWwp4N.js → livescript-DEuoDOv7.js} +1 -1
- package/dist/app/assets/{llvm-WK7Im8Mx.js → llvm-DlajzOZN.js} +1 -1
- package/dist/app/assets/{log-DMYT40mt.js → log-CU2WH4Lm.js} +1 -1
- package/dist/app/assets/{lolcode-CXH2FuUZ.js → lolcode-CDbraZlO.js} +1 -1
- package/dist/app/assets/{lua-DTO5WHxq.js → lua-C7PRrDvP.js} +1 -1
- package/dist/app/assets/{magma-C6sMADdo.js → magma-CEu2U_uQ.js} +1 -1
- package/dist/app/assets/{makefile-MHxAMV3D.js → makefile-BpvnX-Nx.js} +1 -1
- package/dist/app/assets/{markdown-DdIbK-8L.js → markdown-BTkzQyNu.js} +1 -1
- package/dist/app/assets/{markup-BpeZ9wWy.js → markup-Dje0J_2C.js} +1 -1
- package/dist/app/assets/{markup-templating-XqCbme63.js → markup-templating-cYyMwZ4b.js} +1 -1
- package/dist/app/assets/{matlab-CHbXjcdv.js → matlab-RV1EEhcL.js} +1 -1
- package/dist/app/assets/{maxscript-BRuyQF1I.js → maxscript-Bo7lyT0p.js} +1 -1
- package/dist/app/assets/{mel-BcIjgiPy.js → mel-kP-zTDHf.js} +1 -1
- package/dist/app/assets/{mermaid-BwSr1PTU.js → mermaid-D1yX-Bwv.js} +1 -1
- package/dist/app/assets/{min-0Lnqk-bR.js → min-z4SxYbt2.js} +1 -1
- package/dist/app/assets/{mindmap-definition-QFDTVHPH-Czt6NaQN.js → mindmap-definition-QFDTVHPH-Dm1nn9t1.js} +1 -1
- package/dist/app/assets/{mizar-CJjkeZOv.js → mizar-DD-lNTs3.js} +1 -1
- package/dist/app/assets/{mongodb-Bvun4Ap6.js → mongodb-By_x69ne.js} +1 -1
- package/dist/app/assets/{monkey-DM3r0SVF.js → monkey-CQneMnOq.js} +1 -1
- package/dist/app/assets/{moonscript-D3eFbTEw.js → moonscript-Cv1IiKWR.js} +1 -1
- package/dist/app/assets/{n1ql-BZE9FAr-.js → n1ql-BZ-dWxn_.js} +1 -1
- package/dist/app/assets/{n4js-CCsMwPzQ.js → n4js-aHhU-EQW.js} +1 -1
- package/dist/app/assets/{nand2tetris-hdl-CLHhLnG9.js → nand2tetris-hdl-Ct9NqibY.js} +1 -1
- package/dist/app/assets/{naniscript-FORkZo6J.js → naniscript-jrYYiXE3.js} +1 -1
- package/dist/app/assets/{nasm-BVjxa0dX.js → nasm-CR4fygO0.js} +1 -1
- package/dist/app/assets/{neon-BerzZa9H.js → neon-Bn9xaC-T.js} +1 -1
- package/dist/app/assets/{nevod-C36hu5IO.js → nevod-DwwkUQZl.js} +1 -1
- package/dist/app/assets/{nginx-DLJurC-F.js → nginx-CxzxW55o.js} +1 -1
- package/dist/app/assets/{nim-NwqzdBl9.js → nim-_ziHrYai.js} +1 -1
- package/dist/app/assets/{nix-BMYba5OL.js → nix-CnfynVyh.js} +1 -1
- package/dist/app/assets/{nsis-Ujsj5qWO.js → nsis-CTa60cBQ.js} +1 -1
- package/dist/app/assets/{objectivec-D9Q7nqP2.js → objectivec-CxzV-EqQ.js} +1 -1
- package/dist/app/assets/{ocaml-0Gb9yc-E.js → ocaml-CXQfo6wC.js} +1 -1
- package/dist/app/assets/{opencl-d0g4CU-6.js → opencl-CdW2Jum5.js} +1 -1
- package/dist/app/assets/{openqasm-DNBbFf10.js → openqasm-99txnqqb.js} +1 -1
- package/dist/app/assets/{oz-DeAjfWVk.js → oz-CIEq0aNc.js} +1 -1
- package/dist/app/assets/{parigp-Cw6GMagO.js → parigp-D9vfJxo4.js} +1 -1
- package/dist/app/assets/{parser-Ba1N4m09.js → parser-DndpAxSG.js} +1 -1
- package/dist/app/assets/{pascal-BljwjmQz.js → pascal-RZKxz-_c.js} +1 -1
- package/dist/app/assets/{pascaligo-VB7Esces.js → pascaligo-B7sniYrp.js} +1 -1
- package/dist/app/assets/{pcaxis-DHF2QJXb.js → pcaxis-B5p4fAPz.js} +1 -1
- package/dist/app/assets/{peoplecode-BQEEpmUe.js → peoplecode-fCeRfJQ5.js} +1 -1
- package/dist/app/assets/{perl-DrBS0LCy.js → perl-CYh0437K.js} +1 -1
- package/dist/app/assets/{php-extras-CwDe0jZp.js → php-extras-DCzP567Q.js} +1 -1
- package/dist/app/assets/{php-D370JUMP.js → php-rTdvXKxw.js} +1 -1
- package/dist/app/assets/{phpdoc-CiOrW7MP.js → phpdoc-BLbjAEWJ.js} +1 -1
- package/dist/app/assets/{pieDiagram-DEJITSTG-BRjK7KVl.js → pieDiagram-DEJITSTG-BuH3UT8S.js} +1 -1
- package/dist/app/assets/{plsql-xdpA00BW.js → plsql-B9JKIw1T.js} +1 -1
- package/dist/app/assets/{powerquery-jWWzzeeK.js → powerquery-Beeqnhtp.js} +1 -1
- package/dist/app/assets/{powershell-8uimM5sM.js → powershell-DofDkeyl.js} +1 -1
- package/dist/app/assets/{processing-QSbqrBCn.js → processing-C-Nru_27.js} +1 -1
- package/dist/app/assets/{prolog-DL94VsoQ.js → prolog-Blc4S8Hs.js} +1 -1
- package/dist/app/assets/{promql-CzzP70Zz.js → promql-BsC9xRrD.js} +1 -1
- package/dist/app/assets/{properties-qQG5igrW.js → properties-BNFVcgDb.js} +1 -1
- package/dist/app/assets/{protobuf-BMTN4S9X.js → protobuf-BlpX_T1K.js} +1 -1
- package/dist/app/assets/{psl-D-6m76lq.js → psl-D2Hoa7_4.js} +1 -1
- package/dist/app/assets/{pug-DuQ38-Bu.js → pug-DBlY2nRe.js} +1 -1
- package/dist/app/assets/{puppet-C9WbrmQV.js → puppet-BfKwQiWD.js} +1 -1
- package/dist/app/assets/{pure-4TCyYwSK.js → pure-CgWRG2Cz.js} +1 -1
- package/dist/app/assets/{purebasic-CFKj-9Sf.js → purebasic-C4IB7b6g.js} +1 -1
- package/dist/app/assets/{purescript-C9U7bAYn.js → purescript-DpbOv2_5.js} +1 -1
- package/dist/app/assets/{q-CvrKcy9d.js → q-Bhw7S_Ff.js} +1 -1
- package/dist/app/assets/{qml-BW7AUG_7.js → qml-BCy5slwb.js} +1 -1
- package/dist/app/assets/{qore-DRUD9M-d.js → qore-C00kyzGf.js} +1 -1
- package/dist/app/assets/{qsharp-D39YPxDq.js → qsharp-CN2CDpkI.js} +1 -1
- package/dist/app/assets/{quadrantDiagram-34T5L4WZ-DS1LrnIG.js → quadrantDiagram-34T5L4WZ-DF36QwGT.js} +1 -1
- package/dist/app/assets/{r-CEg2k6Yb.js → r-B_BK6AZu.js} +1 -1
- package/dist/app/assets/{racket-DRPtpMsj.js → racket-ByLawBwM.js} +1 -1
- package/dist/app/assets/{reason-B-qXU4Et.js → reason-BDBRcGMx.js} +1 -1
- package/dist/app/assets/{regex-CsSf1Cfz.js → regex-ChgfKyvR.js} +1 -1
- package/dist/app/assets/{rego-VXXsVyGE.js → rego-D_XvU-HX.js} +1 -1
- package/dist/app/assets/{renpy-DWC5VEN0.js → renpy-5nIbfjm_.js} +1 -1
- package/dist/app/assets/{requirementDiagram-MS252O5E-D1yFOIdt.js → requirementDiagram-MS252O5E-DoM__lrz.js} +1 -1
- package/dist/app/assets/{rest-pDe65Ctt.js → rest-D0kyBqSB.js} +1 -1
- package/dist/app/assets/{rip-CorRnEGq.js → rip-CYiR9G3s.js} +1 -1
- package/dist/app/assets/{roboconf-X3eSl5BY.js → roboconf-NbRqT12s.js} +1 -1
- package/dist/app/assets/{robotframework-CLWOblVK.js → robotframework-DVLdugea.js} +1 -1
- package/dist/app/assets/{ruby-BhHizLUq.js → ruby-CXYqjyLr.js} +1 -1
- package/dist/app/assets/{rust-KwCeAwDB.js → rust-DtiosDKR.js} +1 -1
- package/dist/app/assets/{sankeyDiagram-XADWPNL6-CS4A3riG.js → sankeyDiagram-XADWPNL6-DAGXEQXz.js} +1 -1
- package/dist/app/assets/{sas-BmKpi8uz.js → sas-CBuO0A4r.js} +1 -1
- package/dist/app/assets/{sass-CLAJxgWV.js → sass-DAOC_JY6.js} +1 -1
- package/dist/app/assets/{scala-4qkXqdFC.js → scala-DrjxfsaL.js} +1 -1
- package/dist/app/assets/{scheme-CTDiZrIF.js → scheme-Dqq_pAgd.js} +1 -1
- package/dist/app/assets/{scss-DsALC5OO.js → scss-Cs8enbPf.js} +1 -1
- package/dist/app/assets/{sequenceDiagram-FGHM5R23-DSBN2T81.js → sequenceDiagram-FGHM5R23-D_580_d2.js} +1 -1
- package/dist/app/assets/{shell-session-CqKsOgW8.js → shell-session-jQLXH-IX.js} +1 -1
- package/dist/app/assets/{smali-CYK2pUFw.js → smali-BjlQ2Fb8.js} +1 -1
- package/dist/app/assets/{smalltalk-DISzpnYr.js → smalltalk-CvvaQ-vE.js} +1 -1
- package/dist/app/assets/{smarty-B918-r7L.js → smarty-CuW15FKs.js} +1 -1
- package/dist/app/assets/{sml-Bw6IzkGv.js → sml-C2rZNwaS.js} +1 -1
- package/dist/app/assets/{solidity-DEB3Gm9H.js → solidity-Bz0UCY5q.js} +1 -1
- package/dist/app/assets/{solution-file-D2zyqypa.js → solution-file-DY6Szhc0.js} +1 -1
- package/dist/app/assets/{soy-CpF2ALZg.js → soy-DupXqVr6.js} +1 -1
- package/dist/app/assets/{sparql-Dqur228Z.js → sparql-CKXEGfsk.js} +1 -1
- package/dist/app/assets/{splunk-spl-BO5UN_pw.js → splunk-spl-ylrNAn0q.js} +1 -1
- package/dist/app/assets/{sqf-sPq7XmN4.js → sqf-lJvrZCtE.js} +1 -1
- package/dist/app/assets/{sql-BBIgkG9I.js → sql-B7hLAkUR.js} +1 -1
- package/dist/app/assets/{squirrel-C3Y2wlu3.js → squirrel-BH1Y674s.js} +1 -1
- package/dist/app/assets/{stan-CkTG-keH.js → stan-fR7Qg8Ut.js} +1 -1
- package/dist/app/assets/{stateDiagram-FHFEXIEX-BYk7Q44w.js → stateDiagram-FHFEXIEX-B8jUR8FD.js} +1 -1
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-ByxORwfu.js +1 -0
- package/dist/app/assets/{stylus-DP6fiucU.js → stylus-s7kCNuJK.js} +1 -1
- package/dist/app/assets/{swift-BcIJhU7i.js → swift-CCtYkHCf.js} +1 -1
- package/dist/app/assets/{systemd-Bj9qapvn.js → systemd-BCElHahC.js} +1 -1
- package/dist/app/assets/{t4-cs-BTnkg25r.js → t4-cs-H1_QKrKm.js} +1 -1
- package/dist/app/assets/{t4-templating-DiW6oGqQ.js → t4-templating-6bPJc-Uq.js} +1 -1
- package/dist/app/assets/{t4-vb-UTyjg4tp.js → t4-vb-DJucVBb5.js} +1 -1
- package/dist/app/assets/{tap-Ed_xTklo.js → tap-B_SCHNXn.js} +1 -1
- package/dist/app/assets/{tcl-Bk-ZoOG4.js → tcl-BNEpqSgM.js} +1 -1
- package/dist/app/assets/{textile-CZj_khpd.js → textile-uWVZjI0f.js} +1 -1
- package/dist/app/assets/{timeline-definition-GMOUNBTQ-CeAunyIF.js → timeline-definition-GMOUNBTQ-pCO1IuTh.js} +1 -1
- package/dist/app/assets/{toml-DYW5oVzI.js → toml-IfqaxX6C.js} +1 -1
- package/dist/app/assets/{tremor-DqPTkwAU.js → tremor-CXc27b0y.js} +1 -1
- package/dist/app/assets/{tt2-BD6llK6C.js → tt2-CSiBMY4w.js} +1 -1
- package/dist/app/assets/{turtle-D_VxYd_W.js → turtle-BG1NGns7.js} +1 -1
- package/dist/app/assets/{twig-Dp8VfvZl.js → twig-BApA7lBN.js} +1 -1
- package/dist/app/assets/{typescript-BflqNmQF.js → typescript-CRhq3lVo.js} +1 -1
- package/dist/app/assets/{typoscript-DtJO34ZB.js → typoscript-CbCyspbX.js} +1 -1
- package/dist/app/assets/{unrealscript-C8jPXtsj.js → unrealscript-C0oIJrK_.js} +1 -1
- package/dist/app/assets/{uorazor-CFPzPUXg.js → uorazor-CCeC8ukV.js} +1 -1
- package/dist/app/assets/{uri-DkdlxU1G.js → uri-BbJq2oKI.js} +1 -1
- package/dist/app/assets/{v-DTkby2kG.js → v-DWbZTbl1.js} +1 -1
- package/dist/app/assets/{vala-CMDYTOwJ.js → vala-cNE5mkqv.js} +1 -1
- package/dist/app/assets/{vbnet-C_hZunWX.js → vbnet-C4ps1ulT.js} +1 -1
- package/dist/app/assets/{velocity-CnCTb2IA.js → velocity-BqiV4VvP.js} +1 -1
- package/dist/app/assets/{vennDiagram-DHZGUBPP-RtCFamqG.js → vennDiagram-DHZGUBPP-DsozMeQe.js} +1 -1
- package/dist/app/assets/{verilog-Czz1q-oU.js → verilog-uM22GI8M.js} +1 -1
- package/dist/app/assets/{vhdl-BdvfiRn7.js → vhdl-CjipXQit.js} +1 -1
- package/dist/app/assets/{vim-BAHRwEe_.js → vim-DAu-IiFJ.js} +1 -1
- package/dist/app/assets/{visual-basic-ncSLJSP6.js → visual-basic-CdGIHeQV.js} +1 -1
- package/dist/app/assets/{wardley-RL74JXVD-CHg_zFkP.js → wardley-RL74JXVD-oEncjGLp.js} +1 -1
- package/dist/app/assets/{wardleyDiagram-NUSXRM2D-Dqzg24WO.js → wardleyDiagram-NUSXRM2D-DNMPqgtw.js} +1 -1
- package/dist/app/assets/{warpscript-DCQ764w0.js → warpscript-ijeKRGom.js} +1 -1
- package/dist/app/assets/{wasm-DljWD0od.js → wasm-CyK5pI_Y.js} +1 -1
- package/dist/app/assets/{web-idl-CThAM-QS.js → web-idl-3RbxQwXD.js} +1 -1
- package/dist/app/assets/{wiki-C3uvDTr2.js → wiki-Vqqp-2xX.js} +1 -1
- package/dist/app/assets/{wolfram-WsMOhYXr.js → wolfram-Bsi7joP0.js} +1 -1
- package/dist/app/assets/{wren-DZHglD0d.js → wren-WQYmqFb4.js} +1 -1
- package/dist/app/assets/{xeora-CAu8qySL.js → xeora-D38FYsRy.js} +1 -1
- package/dist/app/assets/{xml-doc-hgEvDErD.js → xml-doc-wUzx0i81.js} +1 -1
- package/dist/app/assets/{xojo-DaKqUssi.js → xojo-CGKogxG9.js} +1 -1
- package/dist/app/assets/{xquery-BHjeD6a0.js → xquery-Dv5QvWSQ.js} +1 -1
- package/dist/app/assets/{xychartDiagram-5P7HB3ND-DT88cvNy.js → xychartDiagram-5P7HB3ND-BsbjEvIN.js} +1 -1
- package/dist/app/assets/{yaml-BIt0fEmx.js → yaml-BGAxdcfl.js} +1 -1
- package/dist/app/assets/{yang-DXnDsOeM.js → yang-DbR14Qhe.js} +1 -1
- package/dist/app/assets/{zig-DcqFuGKI.js → zig-BZnMCGLn.js} +1 -1
- package/dist/app/index.html +2 -2
- package/dist/index.cjs +1748 -732
- package/dist/index.js +1728 -697
- package/package.json +3 -3
- package/dist/app/assets/channel-B4rIZFfB.js +0 -1
- package/dist/app/assets/classDiagram-6PBFFD2Q-BOgbMClZ.js +0 -1
- package/dist/app/assets/classDiagram-v2-HSJHXN6E-BOgbMClZ.js +0 -1
- package/dist/app/assets/clone-Bdj7TN-g.js +0 -1
- package/dist/app/assets/index-Cbwlowa6.css +0 -1
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-Dr657chO.js +0 -1
package/dist/index.cjs
CHANGED
|
@@ -67,8 +67,8 @@ __export(index_exports, {
|
|
|
67
67
|
module.exports = __toCommonJS(index_exports);
|
|
68
68
|
|
|
69
69
|
// src/components/chat.tsx
|
|
70
|
-
var
|
|
71
|
-
var
|
|
70
|
+
var React44 = __toESM(require("react"), 1);
|
|
71
|
+
var import_lucide_react24 = require("lucide-react");
|
|
72
72
|
|
|
73
73
|
// src/lib/utils.ts
|
|
74
74
|
var import_clsx = require("clsx");
|
|
@@ -88,6 +88,12 @@ var THEME_PANEL_RADIUS_PRESET_CLASS = {
|
|
|
88
88
|
soft: "rounded-lg",
|
|
89
89
|
sharp: "rounded-none"
|
|
90
90
|
};
|
|
91
|
+
var THEME_COMPOSER_INPUT_RADIUS_PRESET_CLASS = {
|
|
92
|
+
pill: "rounded-3xl",
|
|
93
|
+
round: "rounded-xl",
|
|
94
|
+
soft: "rounded-lg",
|
|
95
|
+
sharp: "rounded-none"
|
|
96
|
+
};
|
|
91
97
|
var THEME_MENU_ITEM_RADIUS_PRESET_CLASS = {
|
|
92
98
|
pill: "rounded-xl",
|
|
93
99
|
round: "rounded-lg",
|
|
@@ -100,6 +106,13 @@ function getRoundedClass(themeRadius, fallback = "rounded-full") {
|
|
|
100
106
|
function getPanelRoundedClass(themeRadius, fallback = "soft") {
|
|
101
107
|
return THEME_PANEL_RADIUS_PRESET_CLASS[themeRadius ?? fallback];
|
|
102
108
|
}
|
|
109
|
+
function getComposerInputRoundedClass(themeRadius, options = {}) {
|
|
110
|
+
const radius = themeRadius ?? options.fallback ?? "round";
|
|
111
|
+
if (radius === "pill" && options.isEmpty && !options.isStacked) {
|
|
112
|
+
return "rounded-full";
|
|
113
|
+
}
|
|
114
|
+
return THEME_COMPOSER_INPUT_RADIUS_PRESET_CLASS[radius];
|
|
115
|
+
}
|
|
103
116
|
function getMenuItemRoundedClass(themeRadius, fallback = "soft") {
|
|
104
117
|
return THEME_MENU_ITEM_RADIUS_PRESET_CLASS[themeRadius ?? fallback];
|
|
105
118
|
}
|
|
@@ -179,7 +192,25 @@ var import_react3 = require("react");
|
|
|
179
192
|
var import_nuqs = require("nuqs");
|
|
180
193
|
var import_xpert_sdk = require("@xpert-ai/xpert-sdk");
|
|
181
194
|
var import_tool = require("@langchain/core/messages/tool");
|
|
182
|
-
var
|
|
195
|
+
var import_chatkit_types5 = require("@xpert-ai/chatkit-types");
|
|
196
|
+
|
|
197
|
+
// src/lib/agent-runs.ts
|
|
198
|
+
var import_chatkit_types = require("@xpert-ai/chatkit-types");
|
|
199
|
+
function isAgentEventContent(content) {
|
|
200
|
+
return content.type === "agent_event";
|
|
201
|
+
}
|
|
202
|
+
function readContentExecutionId(content) {
|
|
203
|
+
if (!content || typeof content === "string") return void 0;
|
|
204
|
+
return typeof content.executionId === "string" && content.executionId.trim() ? content.executionId.trim() : void 0;
|
|
205
|
+
}
|
|
206
|
+
function readContentParentExecutionId(content) {
|
|
207
|
+
if (!content || typeof content === "string") return void 0;
|
|
208
|
+
return typeof content.parentExecutionId === "string" && content.parentExecutionId.trim() ? content.parentExecutionId.trim() : void 0;
|
|
209
|
+
}
|
|
210
|
+
function readContentAgentKey(content) {
|
|
211
|
+
if (!content || typeof content === "string") return void 0;
|
|
212
|
+
return typeof content.agentKey === "string" && content.agentKey.trim() ? content.agentKey.trim() : void 0;
|
|
213
|
+
}
|
|
183
214
|
|
|
184
215
|
// src/lib/api-config.ts
|
|
185
216
|
function hasConfiguredValue(value) {
|
|
@@ -201,12 +232,12 @@ function getMissingApiConfigurationKind({
|
|
|
201
232
|
}
|
|
202
233
|
|
|
203
234
|
// src/lib/request-options.ts
|
|
204
|
-
var
|
|
235
|
+
var import_chatkit_types2 = require("@xpert-ai/chatkit-types");
|
|
205
236
|
function isRecord(value) {
|
|
206
237
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
207
238
|
}
|
|
208
239
|
function resolveHumanStateValue(value) {
|
|
209
|
-
const human = value?.[
|
|
240
|
+
const human = value?.[import_chatkit_types2.STATE_VARIABLE_HUMAN];
|
|
210
241
|
return isRecord(human) ? human : {};
|
|
211
242
|
}
|
|
212
243
|
function splitEnvCarrier(value) {
|
|
@@ -266,7 +297,7 @@ function buildInjectedRequestOptions(input) {
|
|
|
266
297
|
...input.humanInput ?? {}
|
|
267
298
|
};
|
|
268
299
|
if (Object.keys(mergedHumanState).length > 0) {
|
|
269
|
-
mergedState[
|
|
300
|
+
mergedState[import_chatkit_types2.STATE_VARIABLE_HUMAN] = mergedHumanState;
|
|
270
301
|
}
|
|
271
302
|
const hasState = Object.keys(mergedState).length > 0;
|
|
272
303
|
return {
|
|
@@ -281,7 +312,7 @@ var import_react2 = require("react");
|
|
|
281
312
|
|
|
282
313
|
// src/providers/ParentMessenger.tsx
|
|
283
314
|
var import_react = require("react");
|
|
284
|
-
var
|
|
315
|
+
var import_chatkit_types4 = require("@xpert-ai/chatkit-types");
|
|
285
316
|
|
|
286
317
|
// src/hooks/useStream.ts
|
|
287
318
|
var streamRef = { current: null };
|
|
@@ -295,6 +326,9 @@ function useStreamManager() {
|
|
|
295
326
|
};
|
|
296
327
|
}
|
|
297
328
|
|
|
329
|
+
// src/lib/message-metadata.ts
|
|
330
|
+
var import_chatkit_types3 = require("@xpert-ai/chatkit-types");
|
|
331
|
+
|
|
298
332
|
// src/lib/references.ts
|
|
299
333
|
function isObjectLike(value) {
|
|
300
334
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -591,6 +625,33 @@ function buildHumanMessageInputPayload(source) {
|
|
|
591
625
|
};
|
|
592
626
|
}
|
|
593
627
|
|
|
628
|
+
// src/lib/message-metadata.ts
|
|
629
|
+
function isObjectRecord(value) {
|
|
630
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
631
|
+
}
|
|
632
|
+
function isStringArray(value) {
|
|
633
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
634
|
+
}
|
|
635
|
+
function isSkillSelection(value) {
|
|
636
|
+
if (!isObjectRecord(value)) {
|
|
637
|
+
return false;
|
|
638
|
+
}
|
|
639
|
+
return isStringArray(value.ids) && (value.workspaceId === void 0 || typeof value.workspaceId === "string");
|
|
640
|
+
}
|
|
641
|
+
function isNodeKeySelection(value) {
|
|
642
|
+
return isObjectRecord(value) && isStringArray(value.nodeKeys);
|
|
643
|
+
}
|
|
644
|
+
function isRuntimeCapabilitiesSelectionSet(value) {
|
|
645
|
+
return isObjectRecord(value) && isSkillSelection(value.skills) && isNodeKeySelection(value.plugins) && (value.subAgents === void 0 || isNodeKeySelection(value.subAgents));
|
|
646
|
+
}
|
|
647
|
+
function isRuntimeCapabilitiesSelection(value) {
|
|
648
|
+
if (!isObjectRecord(value)) {
|
|
649
|
+
return false;
|
|
650
|
+
}
|
|
651
|
+
const selection = value;
|
|
652
|
+
return selection.mode === "allowlist" && isRuntimeCapabilitiesSelectionSet(selection) && (selection.recommended === void 0 || isRuntimeCapabilitiesSelectionSet(selection.recommended));
|
|
653
|
+
}
|
|
654
|
+
|
|
594
655
|
// src/providers/ParentMessenger.tsx
|
|
595
656
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
596
657
|
var handledSendUserMessageNonces = /* @__PURE__ */ new Set();
|
|
@@ -694,11 +755,11 @@ function ParentMessengerProvider({
|
|
|
694
755
|
handledSendUserMessageEvents.add(event);
|
|
695
756
|
}
|
|
696
757
|
const params = payload.data;
|
|
697
|
-
const prompt = typeof params.text === "string" ? params.text.trim() : typeof params.state?.[
|
|
758
|
+
const prompt = typeof params.text === "string" ? params.text.trim() : typeof params.state?.[import_chatkit_types4.STATE_VARIABLE_HUMAN]?.input === "string" ? params.state[import_chatkit_types4.STATE_VARIABLE_HUMAN].input.trim() : "";
|
|
698
759
|
const references = normalizeReferences(
|
|
699
|
-
params.references ?? params.state?.[
|
|
760
|
+
params.references ?? params.state?.[import_chatkit_types4.STATE_VARIABLE_HUMAN]?.references
|
|
700
761
|
);
|
|
701
|
-
const referenceComposition = params.referenceComposition ?? params.state?.[
|
|
762
|
+
const referenceComposition = params.referenceComposition ?? params.state?.[import_chatkit_types4.STATE_VARIABLE_HUMAN]?.referenceComposition;
|
|
702
763
|
const humanInput = buildHumanMessageInputPayload({
|
|
703
764
|
content: prompt,
|
|
704
765
|
references,
|
|
@@ -710,12 +771,14 @@ function ParentMessengerProvider({
|
|
|
710
771
|
}
|
|
711
772
|
return;
|
|
712
773
|
}
|
|
713
|
-
const
|
|
774
|
+
const runtimeCapabilitiesCandidate = params.runtimeCapabilities ?? params.state?.[import_chatkit_types4.STATE_VARIABLE_HUMAN]?.runtimeCapabilities;
|
|
775
|
+
const runtimeCapabilities = isRuntimeCapabilitiesSelection(
|
|
776
|
+
runtimeCapabilitiesCandidate
|
|
777
|
+
) ? runtimeCapabilitiesCandidate : void 0;
|
|
778
|
+
const requestHumanInput = params.planMode === true || params.state?.[import_chatkit_types4.STATE_VARIABLE_HUMAN]?.planMode === true || runtimeCapabilities ? {
|
|
714
779
|
...humanInput,
|
|
715
|
-
...params.planMode === true || params.state?.[
|
|
716
|
-
...
|
|
717
|
-
runtimeCapabilities: params.state[import_chatkit_types2.STATE_VARIABLE_HUMAN].runtimeCapabilities
|
|
718
|
-
} : {}
|
|
780
|
+
...params.planMode === true || params.state?.[import_chatkit_types4.STATE_VARIABLE_HUMAN]?.planMode === true ? { planMode: true } : {},
|
|
781
|
+
...runtimeCapabilities ? { runtimeCapabilities } : {}
|
|
719
782
|
} : humanInput;
|
|
720
783
|
const newMessage = {
|
|
721
784
|
id: createMessageId(),
|
|
@@ -723,7 +786,8 @@ function ParentMessengerProvider({
|
|
|
723
786
|
content: prompt,
|
|
724
787
|
submittedInput: humanInput.input,
|
|
725
788
|
...humanInput.referenceComposition ? { referenceComposition: humanInput.referenceComposition } : {},
|
|
726
|
-
...references.length > 0 ? { references } : {}
|
|
789
|
+
...references.length > 0 ? { references } : {},
|
|
790
|
+
...runtimeCapabilities ? { runtimeCapabilities } : {}
|
|
727
791
|
};
|
|
728
792
|
const stream = streamRef2.current;
|
|
729
793
|
const activeFollowUpMode = stream?.isLoading ? params.followUpMode && params.followUpMode !== "default" ? params.followUpMode : stream.followUpBehavior ?? "queue" : void 0;
|
|
@@ -1013,30 +1077,6 @@ function resolveUsedContextSize(options) {
|
|
|
1013
1077
|
return normalizeContextUsageNumber(options.fallbackUsedTokens) ?? 0;
|
|
1014
1078
|
}
|
|
1015
1079
|
|
|
1016
|
-
// src/lib/message-metadata.ts
|
|
1017
|
-
var import_chatkit_types3 = require("@xpert-ai/chatkit-types");
|
|
1018
|
-
function isObjectRecord(value) {
|
|
1019
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1020
|
-
}
|
|
1021
|
-
function isStringArray(value) {
|
|
1022
|
-
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
1023
|
-
}
|
|
1024
|
-
function isSkillSelection(value) {
|
|
1025
|
-
if (!isObjectRecord(value)) {
|
|
1026
|
-
return false;
|
|
1027
|
-
}
|
|
1028
|
-
return isStringArray(value.ids) && (value.workspaceId === void 0 || typeof value.workspaceId === "string");
|
|
1029
|
-
}
|
|
1030
|
-
function isNodeKeySelection(value) {
|
|
1031
|
-
return isObjectRecord(value) && isStringArray(value.nodeKeys);
|
|
1032
|
-
}
|
|
1033
|
-
function isRuntimeCapabilitiesSelection(value) {
|
|
1034
|
-
if (!isObjectRecord(value)) {
|
|
1035
|
-
return false;
|
|
1036
|
-
}
|
|
1037
|
-
return value.mode === "allowlist" && isSkillSelection(value.skills) && isNodeKeySelection(value.plugins) && (value.subAgents === void 0 || isNodeKeySelection(value.subAgents));
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
1080
|
// src/lib/follow-ups.ts
|
|
1041
1081
|
function getComposerFollowUpShortcutLabels(queueShortcutLabel) {
|
|
1042
1082
|
return {
|
|
@@ -1478,6 +1518,38 @@ var en_US_default = {
|
|
|
1478
1518
|
option: "Option",
|
|
1479
1519
|
other: "Other"
|
|
1480
1520
|
},
|
|
1521
|
+
agentRun: {
|
|
1522
|
+
defaultTitle: "Sub-agent",
|
|
1523
|
+
inputLabel: "Input",
|
|
1524
|
+
errorLabel: "Error",
|
|
1525
|
+
status: {
|
|
1526
|
+
running: "Running",
|
|
1527
|
+
success: "Done",
|
|
1528
|
+
error: "Error",
|
|
1529
|
+
replied: "Replied",
|
|
1530
|
+
pending: "Pending",
|
|
1531
|
+
interrupted: "Interrupted",
|
|
1532
|
+
timeout: "Timed out"
|
|
1533
|
+
},
|
|
1534
|
+
counts: {
|
|
1535
|
+
messages: {
|
|
1536
|
+
one: "{{count}} message",
|
|
1537
|
+
other: "{{count}} messages"
|
|
1538
|
+
},
|
|
1539
|
+
tools: {
|
|
1540
|
+
one: "{{count}} tool",
|
|
1541
|
+
other: "{{count}} tools"
|
|
1542
|
+
},
|
|
1543
|
+
events: {
|
|
1544
|
+
one: "{{count}} event",
|
|
1545
|
+
other: "{{count}} events"
|
|
1546
|
+
},
|
|
1547
|
+
children: {
|
|
1548
|
+
one: "{{count}} child agent",
|
|
1549
|
+
other: "{{count}} child agents"
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
},
|
|
1481
1553
|
toolGroup: {
|
|
1482
1554
|
status: {
|
|
1483
1555
|
running: "Processing",
|
|
@@ -1490,6 +1562,7 @@ var en_US_default = {
|
|
|
1490
1562
|
jsonTitle: "JSON",
|
|
1491
1563
|
jsonTree: "Tree",
|
|
1492
1564
|
jsonRaw: "Raw",
|
|
1565
|
+
sourcesTitle: "Sources",
|
|
1493
1566
|
copy: "Copy",
|
|
1494
1567
|
copied: "Copied",
|
|
1495
1568
|
separator: ", ",
|
|
@@ -1770,6 +1843,38 @@ var zh_CN_default = {
|
|
|
1770
1843
|
option: "\u9009\u9879",
|
|
1771
1844
|
other: "\u5176\u4ED6"
|
|
1772
1845
|
},
|
|
1846
|
+
agentRun: {
|
|
1847
|
+
defaultTitle: "\u5B50\u667A\u80FD\u4F53",
|
|
1848
|
+
inputLabel: "\u8F93\u5165",
|
|
1849
|
+
errorLabel: "\u9519\u8BEF",
|
|
1850
|
+
status: {
|
|
1851
|
+
running: "\u8FD0\u884C\u4E2D",
|
|
1852
|
+
success: "\u5DF2\u5B8C\u6210",
|
|
1853
|
+
error: "\u9519\u8BEF",
|
|
1854
|
+
replied: "\u5DF2\u56DE\u590D",
|
|
1855
|
+
pending: "\u7B49\u5F85\u4E2D",
|
|
1856
|
+
interrupted: "\u5DF2\u4E2D\u65AD",
|
|
1857
|
+
timeout: "\u5DF2\u8D85\u65F6"
|
|
1858
|
+
},
|
|
1859
|
+
counts: {
|
|
1860
|
+
messages: {
|
|
1861
|
+
one: "{{count}} \u6761\u6D88\u606F",
|
|
1862
|
+
other: "{{count}} \u6761\u6D88\u606F"
|
|
1863
|
+
},
|
|
1864
|
+
tools: {
|
|
1865
|
+
one: "{{count}} \u4E2A\u5DE5\u5177",
|
|
1866
|
+
other: "{{count}} \u4E2A\u5DE5\u5177"
|
|
1867
|
+
},
|
|
1868
|
+
events: {
|
|
1869
|
+
one: "{{count}} \u4E2A\u4E8B\u4EF6",
|
|
1870
|
+
other: "{{count}} \u4E2A\u4E8B\u4EF6"
|
|
1871
|
+
},
|
|
1872
|
+
children: {
|
|
1873
|
+
one: "{{count}} \u4E2A\u5B50\u667A\u80FD\u4F53",
|
|
1874
|
+
other: "{{count}} \u4E2A\u5B50\u667A\u80FD\u4F53"
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
},
|
|
1773
1878
|
toolGroup: {
|
|
1774
1879
|
status: {
|
|
1775
1880
|
running: "\u6B63\u5728\u5904\u7406",
|
|
@@ -1782,6 +1887,7 @@ var zh_CN_default = {
|
|
|
1782
1887
|
jsonTitle: "JSON",
|
|
1783
1888
|
jsonTree: "\u6811\u5F62",
|
|
1784
1889
|
jsonRaw: "\u539F\u59CB",
|
|
1890
|
+
sourcesTitle: "\u4FE1\u606F\u6E90",
|
|
1785
1891
|
copy: "\u590D\u5236",
|
|
1786
1892
|
copied: "\u5DF2\u590D\u5236",
|
|
1787
1893
|
separator: "\uFF0C",
|
|
@@ -2220,6 +2326,39 @@ function uniqueStrings(values) {
|
|
|
2220
2326
|
new Set(values.map((value) => value.trim()).filter(Boolean))
|
|
2221
2327
|
);
|
|
2222
2328
|
}
|
|
2329
|
+
function getRuntimeCapabilitiesSelectionSet(selection) {
|
|
2330
|
+
return {
|
|
2331
|
+
skills: {
|
|
2332
|
+
...selection?.skills.workspaceId ? { workspaceId: selection.skills.workspaceId } : {},
|
|
2333
|
+
ids: uniqueStrings(selection?.skills.ids ?? [])
|
|
2334
|
+
},
|
|
2335
|
+
plugins: {
|
|
2336
|
+
nodeKeys: uniqueStrings(selection?.plugins.nodeKeys ?? [])
|
|
2337
|
+
},
|
|
2338
|
+
subAgents: {
|
|
2339
|
+
nodeKeys: uniqueStrings(selection?.subAgents?.nodeKeys ?? [])
|
|
2340
|
+
}
|
|
2341
|
+
};
|
|
2342
|
+
}
|
|
2343
|
+
function mergeRuntimeCapabilitiesSelectionSets(capabilities, ...sets) {
|
|
2344
|
+
const workspaceId = sets.find((set) => set?.skills.workspaceId)?.skills.workspaceId ?? capabilities.skills[0]?.workspaceId;
|
|
2345
|
+
return {
|
|
2346
|
+
skills: {
|
|
2347
|
+
...workspaceId ? { workspaceId } : {},
|
|
2348
|
+
ids: uniqueStrings(sets.flatMap((set) => set?.skills.ids ?? []))
|
|
2349
|
+
},
|
|
2350
|
+
plugins: {
|
|
2351
|
+
nodeKeys: uniqueStrings(
|
|
2352
|
+
sets.flatMap((set) => set?.plugins.nodeKeys ?? [])
|
|
2353
|
+
)
|
|
2354
|
+
},
|
|
2355
|
+
subAgents: {
|
|
2356
|
+
nodeKeys: uniqueStrings(
|
|
2357
|
+
sets.flatMap((set) => set?.subAgents?.nodeKeys ?? [])
|
|
2358
|
+
)
|
|
2359
|
+
}
|
|
2360
|
+
};
|
|
2361
|
+
}
|
|
2223
2362
|
function createEmptyRuntimeCapabilitiesSelection(capabilities) {
|
|
2224
2363
|
const workspaceId = capabilities?.skills[0]?.workspaceId;
|
|
2225
2364
|
return {
|
|
@@ -2255,25 +2394,56 @@ function createDefaultRuntimeCapabilitiesSelection(capabilities) {
|
|
|
2255
2394
|
};
|
|
2256
2395
|
}
|
|
2257
2396
|
function mergeRuntimeCapabilitiesSelections(capabilities, ...selections) {
|
|
2258
|
-
const
|
|
2397
|
+
const merged = mergeRuntimeCapabilitiesSelectionSets(
|
|
2398
|
+
capabilities,
|
|
2399
|
+
...selections.map(
|
|
2400
|
+
(selection) => selection ? getRuntimeCapabilitiesSelectionSet(selection) : null
|
|
2401
|
+
)
|
|
2402
|
+
);
|
|
2403
|
+
const recommended = mergeRuntimeCapabilitiesSelectionSets(
|
|
2404
|
+
capabilities,
|
|
2405
|
+
...selections.map((selection) => selection?.recommended)
|
|
2406
|
+
);
|
|
2259
2407
|
return {
|
|
2260
2408
|
mode: "allowlist",
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2409
|
+
...merged,
|
|
2410
|
+
...hasRuntimeCapabilitySelectionSet(recommended) ? { recommended } : {}
|
|
2411
|
+
};
|
|
2412
|
+
}
|
|
2413
|
+
function createRuntimeCapabilitiesForSubmit({
|
|
2414
|
+
capabilities,
|
|
2415
|
+
available,
|
|
2416
|
+
recommended
|
|
2417
|
+
}) {
|
|
2418
|
+
const recommendedSet = mergeRuntimeCapabilitiesSelectionSets(
|
|
2419
|
+
capabilities,
|
|
2420
|
+
recommended,
|
|
2421
|
+
recommended?.recommended
|
|
2422
|
+
);
|
|
2423
|
+
const merged = mergeRuntimeCapabilitiesSelectionSets(
|
|
2424
|
+
capabilities,
|
|
2425
|
+
available,
|
|
2426
|
+
recommendedSet
|
|
2427
|
+
);
|
|
2428
|
+
return {
|
|
2429
|
+
mode: "allowlist",
|
|
2430
|
+
...merged,
|
|
2431
|
+
...hasRuntimeCapabilitySelectionSet(recommendedSet) ? { recommended: recommendedSet } : {}
|
|
2432
|
+
};
|
|
2433
|
+
}
|
|
2434
|
+
function getRecommendedRuntimeCapabilitiesSelection(selection) {
|
|
2435
|
+
if (!selection?.recommended) {
|
|
2436
|
+
return null;
|
|
2437
|
+
}
|
|
2438
|
+
return {
|
|
2439
|
+
mode: "allowlist",
|
|
2440
|
+
...getRuntimeCapabilitiesSelectionSet(selection.recommended)
|
|
2441
|
+
};
|
|
2442
|
+
}
|
|
2443
|
+
function getAvailableRuntimeCapabilitiesSelection(selection) {
|
|
2444
|
+
return {
|
|
2445
|
+
mode: "allowlist",
|
|
2446
|
+
...getRuntimeCapabilitiesSelectionSet(selection)
|
|
2277
2447
|
};
|
|
2278
2448
|
}
|
|
2279
2449
|
function toggleRuntimeCapabilitySelection(selection, type, id, selected) {
|
|
@@ -2332,6 +2502,12 @@ function getRuntimeCapabilityOptions(capabilities) {
|
|
|
2332
2502
|
}))
|
|
2333
2503
|
];
|
|
2334
2504
|
}
|
|
2505
|
+
function hasRuntimeCapabilitySelectionSet(selection) {
|
|
2506
|
+
if (!selection) {
|
|
2507
|
+
return false;
|
|
2508
|
+
}
|
|
2509
|
+
return selection.skills.ids.length > 0 || selection.plugins.nodeKeys.length > 0 || (selection.subAgents?.nodeKeys.length ?? 0) > 0;
|
|
2510
|
+
}
|
|
2335
2511
|
function isRuntimeCapabilitySelected(selection, type, id) {
|
|
2336
2512
|
if (type === "skill") {
|
|
2337
2513
|
return selection.skills.ids.includes(id);
|
|
@@ -3344,7 +3520,17 @@ function SlashPalette({
|
|
|
3344
3520
|
}
|
|
3345
3521
|
),
|
|
3346
3522
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "flex min-w-0 flex-1 items-baseline gap-2", children: [
|
|
3347
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.
|
|
3523
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "flex min-w-0 shrink-0 items-baseline gap-1.5", children: [
|
|
3524
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "truncate font-medium", children: option.label }),
|
|
3525
|
+
option.kind === "command" && option.capabilityType && typeof option.childCount === "number" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3526
|
+
"span",
|
|
3527
|
+
{
|
|
3528
|
+
"data-slot": "slash-palette-child-count",
|
|
3529
|
+
className: "inline-flex h-4 min-w-4 shrink-0 items-center justify-center rounded-full bg-muted px-1 text-[10px] font-medium leading-none text-muted-foreground",
|
|
3530
|
+
children: option.childCount
|
|
3531
|
+
}
|
|
3532
|
+
) : null
|
|
3533
|
+
] }),
|
|
3348
3534
|
option.description && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "min-w-0 flex-1 truncate text-muted-foreground", children: option.description })
|
|
3349
3535
|
] }),
|
|
3350
3536
|
option.kind === "command" && option.capabilityType ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-muted-foreground", children: option.expanded ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react5.ChevronDown, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react5.ChevronRight, { size: 14 }) }) : null
|
|
@@ -5980,19 +6166,22 @@ function resolveRuntimeCapabilityPalette(value, selectionStart) {
|
|
|
5980
6166
|
return null;
|
|
5981
6167
|
}
|
|
5982
6168
|
const beforeCaret = value.slice(0, selectionStart);
|
|
5983
|
-
const match = /(^|\s)
|
|
6169
|
+
const match = /(^|\s)([/$])([^\s/]*)$/.exec(beforeCaret);
|
|
5984
6170
|
if (!match) {
|
|
5985
6171
|
return null;
|
|
5986
6172
|
}
|
|
5987
|
-
const
|
|
6173
|
+
const trigger = match[2];
|
|
6174
|
+
const query = match[3] ?? "";
|
|
5988
6175
|
const start = beforeCaret.length - query.length - 1;
|
|
5989
6176
|
const beforeTrigger = beforeCaret.slice(0, start);
|
|
5990
6177
|
return {
|
|
6178
|
+
trigger,
|
|
5991
6179
|
query,
|
|
5992
6180
|
start,
|
|
5993
6181
|
end: selectionStart,
|
|
5994
6182
|
activeIndex: 0,
|
|
5995
|
-
atMessageStart: beforeTrigger.trim().length === 0
|
|
6183
|
+
atMessageStart: beforeTrigger.trim().length === 0,
|
|
6184
|
+
...trigger === "$" ? { capabilityTypes: ["skill"] } : {}
|
|
5996
6185
|
};
|
|
5997
6186
|
}
|
|
5998
6187
|
function matchesQuery(values, query) {
|
|
@@ -6029,7 +6218,11 @@ function matchesCapability(option, query, capabilityTypes) {
|
|
|
6029
6218
|
if (capabilityTypes?.length && !capabilityTypes.includes(option.type)) {
|
|
6030
6219
|
return false;
|
|
6031
6220
|
}
|
|
6032
|
-
|
|
6221
|
+
const skillAliases = option.type === "skill" ? [`$${option.id}`, `$${option.label}`] : [];
|
|
6222
|
+
return matchesQuery(
|
|
6223
|
+
[option.id, option.label, option.description, option.type, ...skillAliases],
|
|
6224
|
+
query
|
|
6225
|
+
);
|
|
6033
6226
|
}
|
|
6034
6227
|
function getCommandPaletteOption(command) {
|
|
6035
6228
|
const capabilityType = CAPABILITY_GROUP_COMMANDS[command.name];
|
|
@@ -6048,7 +6241,7 @@ function createSlashPaletteOptions({
|
|
|
6048
6241
|
runtimeCapabilitiesReady,
|
|
6049
6242
|
runtimeCapabilityOptions,
|
|
6050
6243
|
runtimeCapabilities,
|
|
6051
|
-
|
|
6244
|
+
recommendedRuntimeCapabilities
|
|
6052
6245
|
}) {
|
|
6053
6246
|
if (!palette) {
|
|
6054
6247
|
return [];
|
|
@@ -6058,7 +6251,7 @@ function createSlashPaletteOptions({
|
|
|
6058
6251
|
const expandedCapabilityTypes = new Set(
|
|
6059
6252
|
palette.expandedCapabilityTypes ?? []
|
|
6060
6253
|
);
|
|
6061
|
-
const selection =
|
|
6254
|
+
const selection = recommendedRuntimeCapabilities ?? createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities);
|
|
6062
6255
|
const getCapabilityOptions = (capabilityTypes, capabilityQuery = query) => runtimeCapabilitiesReady ? runtimeCapabilityOptions.filter(
|
|
6063
6256
|
(option) => matchesCapability(option, capabilityQuery, capabilityTypes) && !isRuntimeCapabilitySelected(selection, option.type, option.id)
|
|
6064
6257
|
) : [];
|
|
@@ -6294,7 +6487,7 @@ function useSlashCommands({
|
|
|
6294
6487
|
runtimeCapabilities,
|
|
6295
6488
|
runtimeCapabilitiesReady,
|
|
6296
6489
|
runtimeCapabilityOptions,
|
|
6297
|
-
|
|
6490
|
+
recommendedRuntimeCapabilities,
|
|
6298
6491
|
draft,
|
|
6299
6492
|
palette,
|
|
6300
6493
|
setPalette,
|
|
@@ -6339,12 +6532,12 @@ function useSlashCommands({
|
|
|
6339
6532
|
runtimeCapabilitiesReady,
|
|
6340
6533
|
runtimeCapabilityOptions,
|
|
6341
6534
|
runtimeCapabilities,
|
|
6342
|
-
|
|
6535
|
+
recommendedRuntimeCapabilities
|
|
6343
6536
|
}),
|
|
6344
6537
|
[
|
|
6345
|
-
effectiveRuntimeCapabilitiesForSubmit,
|
|
6346
6538
|
localizedResolvedCommands,
|
|
6347
6539
|
palette,
|
|
6540
|
+
recommendedRuntimeCapabilities,
|
|
6348
6541
|
runtimeCapabilities,
|
|
6349
6542
|
runtimeCapabilitiesReady,
|
|
6350
6543
|
runtimeCapabilityOptions
|
|
@@ -6576,8 +6769,279 @@ function useSlashCommands({
|
|
|
6576
6769
|
}
|
|
6577
6770
|
|
|
6578
6771
|
// src/components/thread/messages/ai.tsx
|
|
6579
|
-
var
|
|
6580
|
-
var
|
|
6772
|
+
var React31 = __toESM(require("react"), 1);
|
|
6773
|
+
var import_lucide_react19 = require("lucide-react");
|
|
6774
|
+
|
|
6775
|
+
// src/lib/agent-run-render-tree.ts
|
|
6776
|
+
function isTextContent(content) {
|
|
6777
|
+
return content.type === "text";
|
|
6778
|
+
}
|
|
6779
|
+
function isReasoningContent(content) {
|
|
6780
|
+
return content.type === "reasoning";
|
|
6781
|
+
}
|
|
6782
|
+
function isComponentContent(content) {
|
|
6783
|
+
return content.type === "component";
|
|
6784
|
+
}
|
|
6785
|
+
function parseDateValue(value) {
|
|
6786
|
+
if (value instanceof Date) {
|
|
6787
|
+
const timestamp2 = value.getTime();
|
|
6788
|
+
return Number.isNaN(timestamp2) ? null : timestamp2;
|
|
6789
|
+
}
|
|
6790
|
+
if (typeof value !== "string") {
|
|
6791
|
+
return null;
|
|
6792
|
+
}
|
|
6793
|
+
const timestamp = Date.parse(value);
|
|
6794
|
+
return Number.isNaN(timestamp) ? null : timestamp;
|
|
6795
|
+
}
|
|
6796
|
+
function readContentTitle(content) {
|
|
6797
|
+
if (typeof content === "string") return void 0;
|
|
6798
|
+
if (typeof content.xpertName === "string" && content.xpertName.trim()) {
|
|
6799
|
+
return content.xpertName.trim();
|
|
6800
|
+
}
|
|
6801
|
+
return void 0;
|
|
6802
|
+
}
|
|
6803
|
+
function readContentStringField(content, field) {
|
|
6804
|
+
if (typeof content === "string") return void 0;
|
|
6805
|
+
const value = content[field];
|
|
6806
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
6807
|
+
}
|
|
6808
|
+
function normalizeRunStatus(status) {
|
|
6809
|
+
return typeof status === "string" && status.trim() ? status.trim().toLowerCase() : "pending";
|
|
6810
|
+
}
|
|
6811
|
+
function isRunningRunStatus(status) {
|
|
6812
|
+
return normalizeRunStatus(status) === "running";
|
|
6813
|
+
}
|
|
6814
|
+
function isFailedRunStatus(status) {
|
|
6815
|
+
const normalized = normalizeRunStatus(status);
|
|
6816
|
+
return normalized === "error" || normalized === "fail" || normalized === "failed";
|
|
6817
|
+
}
|
|
6818
|
+
function hasVisibleAgentRunDetails(info) {
|
|
6819
|
+
return info.error !== void 0;
|
|
6820
|
+
}
|
|
6821
|
+
function getAgentRunTitle(info, fallback) {
|
|
6822
|
+
return info.title?.trim() || info.xpertName?.trim() || info.agentKey?.trim() || fallback || null;
|
|
6823
|
+
}
|
|
6824
|
+
function getAgentRunDuration(info) {
|
|
6825
|
+
if (typeof info.elapsedTime === "number" && Number.isFinite(info.elapsedTime)) {
|
|
6826
|
+
return info.elapsedTime;
|
|
6827
|
+
}
|
|
6828
|
+
const startedAt = parseDateValue(info.startedAt) ?? parseDateValue(info.createdAt);
|
|
6829
|
+
const endedAt = parseDateValue(info.endedAt) ?? parseDateValue(info.updatedAt);
|
|
6830
|
+
if (startedAt === null || endedAt === null) return null;
|
|
6831
|
+
return Math.max(0, endedAt - startedAt);
|
|
6832
|
+
}
|
|
6833
|
+
function getAgentRunCounts(node) {
|
|
6834
|
+
let text = 0;
|
|
6835
|
+
let tools = 0;
|
|
6836
|
+
let events = 0;
|
|
6837
|
+
for (const entry of node.entries) {
|
|
6838
|
+
const item = entry.item;
|
|
6839
|
+
if (typeof item === "string") {
|
|
6840
|
+
if (item.trim()) text += 1;
|
|
6841
|
+
continue;
|
|
6842
|
+
}
|
|
6843
|
+
if (isTextContent(item) || isReasoningContent(item)) {
|
|
6844
|
+
if (item.text?.trim()) text += 1;
|
|
6845
|
+
continue;
|
|
6846
|
+
}
|
|
6847
|
+
if (isComponentContent(item)) {
|
|
6848
|
+
tools += 1;
|
|
6849
|
+
continue;
|
|
6850
|
+
}
|
|
6851
|
+
if (isAgentEventContent(item)) {
|
|
6852
|
+
events += 1;
|
|
6853
|
+
}
|
|
6854
|
+
}
|
|
6855
|
+
return {
|
|
6856
|
+
text,
|
|
6857
|
+
tools,
|
|
6858
|
+
events,
|
|
6859
|
+
children: node.children.length
|
|
6860
|
+
};
|
|
6861
|
+
}
|
|
6862
|
+
function createAgentRunNode(nodes, id, info, order) {
|
|
6863
|
+
const existing = nodes.get(id);
|
|
6864
|
+
if (existing) {
|
|
6865
|
+
existing.info = {
|
|
6866
|
+
...existing.info,
|
|
6867
|
+
...info,
|
|
6868
|
+
id,
|
|
6869
|
+
parentId: info.parentId ?? existing.info.parentId,
|
|
6870
|
+
parentExecutionId: info.parentExecutionId ?? existing.info.parentExecutionId,
|
|
6871
|
+
agentKey: info.agentKey ?? existing.info.agentKey,
|
|
6872
|
+
xpertName: info.xpertName ?? existing.info.xpertName,
|
|
6873
|
+
title: info.title ?? existing.info.title,
|
|
6874
|
+
status: info.status ?? existing.info.status,
|
|
6875
|
+
elapsedTime: info.elapsedTime ?? existing.info.elapsedTime,
|
|
6876
|
+
error: info.error ?? existing.info.error,
|
|
6877
|
+
inputs: info.inputs ?? existing.info.inputs
|
|
6878
|
+
};
|
|
6879
|
+
existing.firstOrder = Math.min(existing.firstOrder, order);
|
|
6880
|
+
return existing;
|
|
6881
|
+
}
|
|
6882
|
+
const node = {
|
|
6883
|
+
id,
|
|
6884
|
+
info: { ...info, id },
|
|
6885
|
+
entries: [],
|
|
6886
|
+
children: [],
|
|
6887
|
+
firstOrder: order
|
|
6888
|
+
};
|
|
6889
|
+
nodes.set(id, node);
|
|
6890
|
+
return node;
|
|
6891
|
+
}
|
|
6892
|
+
function findFallbackRunByAgentKey(runs, agentKey, rootExecutionId) {
|
|
6893
|
+
if (!agentKey) return null;
|
|
6894
|
+
const candidates = runs.filter(
|
|
6895
|
+
(run) => run.agentKey === agentKey && run.id !== rootExecutionId
|
|
6896
|
+
);
|
|
6897
|
+
if (candidates.length === 0) return null;
|
|
6898
|
+
for (let index = candidates.length - 1; index >= 0; index -= 1) {
|
|
6899
|
+
if (isRunningRunStatus(candidates[index].status)) {
|
|
6900
|
+
return candidates[index];
|
|
6901
|
+
}
|
|
6902
|
+
}
|
|
6903
|
+
return candidates[candidates.length - 1];
|
|
6904
|
+
}
|
|
6905
|
+
function getEntryRunTarget(entry, runs, rootExecutionId) {
|
|
6906
|
+
const item = entry.item;
|
|
6907
|
+
const executionId = readContentExecutionId(item);
|
|
6908
|
+
const parentExecutionId = readContentParentExecutionId(item);
|
|
6909
|
+
const agentKey = readContentAgentKey(item);
|
|
6910
|
+
if (executionId) {
|
|
6911
|
+
return {
|
|
6912
|
+
executionId,
|
|
6913
|
+
parentExecutionId,
|
|
6914
|
+
agentKey
|
|
6915
|
+
};
|
|
6916
|
+
}
|
|
6917
|
+
const fallbackRun = findFallbackRunByAgentKey(
|
|
6918
|
+
runs,
|
|
6919
|
+
agentKey,
|
|
6920
|
+
rootExecutionId
|
|
6921
|
+
);
|
|
6922
|
+
if (!fallbackRun) return null;
|
|
6923
|
+
return {
|
|
6924
|
+
executionId: fallbackRun.id,
|
|
6925
|
+
parentExecutionId: fallbackRun.parentId ?? fallbackRun.parentExecutionId,
|
|
6926
|
+
agentKey
|
|
6927
|
+
};
|
|
6928
|
+
}
|
|
6929
|
+
function createInfoFromEntry(id, entry, parentExecutionId) {
|
|
6930
|
+
return {
|
|
6931
|
+
id,
|
|
6932
|
+
...parentExecutionId ? { parentId: parentExecutionId, parentExecutionId } : {},
|
|
6933
|
+
...readContentAgentKey(entry.item) ? { agentKey: readContentAgentKey(entry.item) } : {},
|
|
6934
|
+
...readContentTitle(entry.item) ? { xpertName: readContentTitle(entry.item) } : {},
|
|
6935
|
+
...readContentStringField(entry.item, "runId") ? { runId: readContentStringField(entry.item, "runId") } : {}
|
|
6936
|
+
};
|
|
6937
|
+
}
|
|
6938
|
+
function normalizeAssistantEntries(message) {
|
|
6939
|
+
const entries = [];
|
|
6940
|
+
if (typeof message.content === "string") {
|
|
6941
|
+
if (message.content.trim()) {
|
|
6942
|
+
entries.push({
|
|
6943
|
+
item: message.content,
|
|
6944
|
+
index: 0,
|
|
6945
|
+
source: "content",
|
|
6946
|
+
order: 0
|
|
6947
|
+
});
|
|
6948
|
+
}
|
|
6949
|
+
} else if (Array.isArray(message.content)) {
|
|
6950
|
+
message.content.forEach((item, index) => {
|
|
6951
|
+
entries.push({
|
|
6952
|
+
item,
|
|
6953
|
+
index,
|
|
6954
|
+
source: "content",
|
|
6955
|
+
order: index
|
|
6956
|
+
});
|
|
6957
|
+
});
|
|
6958
|
+
}
|
|
6959
|
+
const contentCount = entries.length;
|
|
6960
|
+
(message.reasoning ?? []).forEach((item, index) => {
|
|
6961
|
+
entries.push({
|
|
6962
|
+
item,
|
|
6963
|
+
index,
|
|
6964
|
+
source: "reasoning",
|
|
6965
|
+
order: contentCount + index
|
|
6966
|
+
});
|
|
6967
|
+
});
|
|
6968
|
+
return entries;
|
|
6969
|
+
}
|
|
6970
|
+
function refreshAgentNodeOrder(node) {
|
|
6971
|
+
let order = node.firstOrder;
|
|
6972
|
+
for (const child of node.children) {
|
|
6973
|
+
order = Math.min(order, refreshAgentNodeOrder(child));
|
|
6974
|
+
}
|
|
6975
|
+
node.firstOrder = order;
|
|
6976
|
+
node.children.sort((a, b) => a.firstOrder - b.firstOrder);
|
|
6977
|
+
return order;
|
|
6978
|
+
}
|
|
6979
|
+
function buildAssistantRenderTree(message) {
|
|
6980
|
+
const rootExecutionId = message.executionId;
|
|
6981
|
+
const runs = message.agentRuns ?? [];
|
|
6982
|
+
const entries = normalizeAssistantEntries(message);
|
|
6983
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
6984
|
+
const rootEntries = [];
|
|
6985
|
+
const rootReasoning = [];
|
|
6986
|
+
const baseOrder = entries.length + 1;
|
|
6987
|
+
runs.forEach((run, index) => {
|
|
6988
|
+
createAgentRunNode(nodes, run.id, run, baseOrder + index / 1e3);
|
|
6989
|
+
});
|
|
6990
|
+
for (const entry of entries) {
|
|
6991
|
+
const target = getEntryRunTarget(entry, runs, rootExecutionId);
|
|
6992
|
+
const shouldGroup = Boolean(target?.executionId) && (target?.executionId !== rootExecutionId || Boolean(target?.parentExecutionId));
|
|
6993
|
+
if (!target || !shouldGroup) {
|
|
6994
|
+
if (entry.source === "reasoning" && typeof entry.item !== "string") {
|
|
6995
|
+
rootReasoning.push(entry.item);
|
|
6996
|
+
} else {
|
|
6997
|
+
rootEntries.push(entry);
|
|
6998
|
+
}
|
|
6999
|
+
continue;
|
|
7000
|
+
}
|
|
7001
|
+
const node = createAgentRunNode(
|
|
7002
|
+
nodes,
|
|
7003
|
+
target.executionId,
|
|
7004
|
+
createInfoFromEntry(target.executionId, entry, target.parentExecutionId),
|
|
7005
|
+
entry.order
|
|
7006
|
+
);
|
|
7007
|
+
node.entries.push(entry);
|
|
7008
|
+
node.firstOrder = Math.min(node.firstOrder, entry.order);
|
|
7009
|
+
}
|
|
7010
|
+
const roots = [];
|
|
7011
|
+
for (const node of nodes.values()) {
|
|
7012
|
+
if (node.id === rootExecutionId && !node.info.parentId) {
|
|
7013
|
+
continue;
|
|
7014
|
+
}
|
|
7015
|
+
const parentId = node.info.parentId ?? node.info.parentExecutionId;
|
|
7016
|
+
if (parentId && parentId !== rootExecutionId && parentId !== node.id) {
|
|
7017
|
+
const parent = nodes.get(parentId);
|
|
7018
|
+
if (parent) {
|
|
7019
|
+
parent.children.push(node);
|
|
7020
|
+
continue;
|
|
7021
|
+
}
|
|
7022
|
+
}
|
|
7023
|
+
roots.push(node);
|
|
7024
|
+
}
|
|
7025
|
+
roots.forEach(refreshAgentNodeOrder);
|
|
7026
|
+
roots.sort((a, b) => a.firstOrder - b.firstOrder);
|
|
7027
|
+
const units = [
|
|
7028
|
+
...rootEntries.map((entry) => ({
|
|
7029
|
+
type: "entry",
|
|
7030
|
+
entry,
|
|
7031
|
+
order: entry.order
|
|
7032
|
+
})),
|
|
7033
|
+
...roots.map((node) => ({
|
|
7034
|
+
type: "agent",
|
|
7035
|
+
node,
|
|
7036
|
+
order: node.firstOrder
|
|
7037
|
+
}))
|
|
7038
|
+
].sort((a, b) => a.order - b.order);
|
|
7039
|
+
return {
|
|
7040
|
+
units,
|
|
7041
|
+
rootReasoning,
|
|
7042
|
+
hasAgentRuns: roots.length > 0
|
|
7043
|
+
};
|
|
7044
|
+
}
|
|
6581
7045
|
|
|
6582
7046
|
// src/components/ui/badge.tsx
|
|
6583
7047
|
var React24 = __toESM(require("react"), 1);
|
|
@@ -7778,10 +8242,407 @@ var MarkdownTextImpl = ({ children }) => {
|
|
|
7778
8242
|
};
|
|
7779
8243
|
var MarkdownText = (0, import_react6.memo)(MarkdownTextImpl);
|
|
7780
8244
|
|
|
7781
|
-
// src/components/thread/messages/
|
|
8245
|
+
// src/components/thread/messages/agent-run-group.tsx
|
|
7782
8246
|
var React28 = __toESM(require("react"), 1);
|
|
7783
8247
|
var import_lucide_react16 = require("lucide-react");
|
|
7784
|
-
|
|
8248
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
8249
|
+
function safeJson2(value) {
|
|
8250
|
+
try {
|
|
8251
|
+
return JSON.stringify(value, null, 2);
|
|
8252
|
+
} catch {
|
|
8253
|
+
return String(value);
|
|
8254
|
+
}
|
|
8255
|
+
}
|
|
8256
|
+
function formatDisplayValue2(value) {
|
|
8257
|
+
return typeof value === "string" ? value : safeJson2(value);
|
|
8258
|
+
}
|
|
8259
|
+
function formatStepDuration(durationMs) {
|
|
8260
|
+
if (durationMs < 1e3) {
|
|
8261
|
+
return `${durationMs}ms`;
|
|
8262
|
+
}
|
|
8263
|
+
if (durationMs < 1e4) {
|
|
8264
|
+
return `${(durationMs / 1e3).toFixed(1)}s`;
|
|
8265
|
+
}
|
|
8266
|
+
if (durationMs < 6e4) {
|
|
8267
|
+
return `${Math.round(durationMs / 1e3)}s`;
|
|
8268
|
+
}
|
|
8269
|
+
const hours = Math.floor(durationMs / 36e5);
|
|
8270
|
+
const minutes = Math.floor(durationMs % 36e5 / 6e4);
|
|
8271
|
+
const seconds = Math.floor(durationMs % 6e4 / 1e3);
|
|
8272
|
+
if (hours > 0) {
|
|
8273
|
+
return `${hours}h ${minutes}m ${seconds}s`;
|
|
8274
|
+
}
|
|
8275
|
+
return `${minutes}m ${seconds}s`;
|
|
8276
|
+
}
|
|
8277
|
+
function getAgentRunStatusConfig(status, hasReply = false) {
|
|
8278
|
+
const normalized = normalizeRunStatus(status);
|
|
8279
|
+
if (normalized === "running") {
|
|
8280
|
+
return {
|
|
8281
|
+
icon: import_lucide_react16.Loader2,
|
|
8282
|
+
iconClass: "text-blue-700",
|
|
8283
|
+
labelKey: "running",
|
|
8284
|
+
spin: true
|
|
8285
|
+
};
|
|
8286
|
+
}
|
|
8287
|
+
if (normalized === "success" || normalized === "succeeded") {
|
|
8288
|
+
return {
|
|
8289
|
+
icon: import_lucide_react16.CheckCircle2,
|
|
8290
|
+
iconClass: "text-green-700",
|
|
8291
|
+
labelKey: "success",
|
|
8292
|
+
spin: false
|
|
8293
|
+
};
|
|
8294
|
+
}
|
|
8295
|
+
if (isFailedRunStatus(normalized)) {
|
|
8296
|
+
return {
|
|
8297
|
+
icon: import_lucide_react16.XCircle,
|
|
8298
|
+
iconClass: "text-red-700",
|
|
8299
|
+
labelKey: "error",
|
|
8300
|
+
spin: false
|
|
8301
|
+
};
|
|
8302
|
+
}
|
|
8303
|
+
if (normalized === "pending" && hasReply) {
|
|
8304
|
+
return {
|
|
8305
|
+
icon: import_lucide_react16.CheckCircle2,
|
|
8306
|
+
iconClass: "text-green-700",
|
|
8307
|
+
labelKey: "replied",
|
|
8308
|
+
spin: false
|
|
8309
|
+
};
|
|
8310
|
+
}
|
|
8311
|
+
return {
|
|
8312
|
+
icon: import_lucide_react16.Clock3,
|
|
8313
|
+
iconClass: "text-muted-foreground",
|
|
8314
|
+
labelKey: normalized,
|
|
8315
|
+
spin: false
|
|
8316
|
+
};
|
|
8317
|
+
}
|
|
8318
|
+
function AgentRunHeaderMetric({
|
|
8319
|
+
icon: Icon,
|
|
8320
|
+
label,
|
|
8321
|
+
value,
|
|
8322
|
+
children
|
|
8323
|
+
}) {
|
|
8324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Tooltip, { children: [
|
|
8325
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
8326
|
+
"span",
|
|
8327
|
+
{
|
|
8328
|
+
"aria-label": label,
|
|
8329
|
+
className: "inline-flex shrink-0 items-center gap-1 rounded-sm text-[11px] text-muted-foreground/60 transition-colors group-hover/agent:text-muted-foreground",
|
|
8330
|
+
children: [
|
|
8331
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Icon, { className: "h-3.5 w-3.5" }),
|
|
8332
|
+
value !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: value }) : null
|
|
8333
|
+
]
|
|
8334
|
+
}
|
|
8335
|
+
) }),
|
|
8336
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipContent, { side: "top", sideOffset: 6, className: "max-w-80 text-left", children })
|
|
8337
|
+
] });
|
|
8338
|
+
}
|
|
8339
|
+
function getAgentNodeUnits(node) {
|
|
8340
|
+
return [
|
|
8341
|
+
...node.entries.map((entry) => ({
|
|
8342
|
+
type: "entry",
|
|
8343
|
+
entry,
|
|
8344
|
+
order: entry.order
|
|
8345
|
+
})),
|
|
8346
|
+
...node.children.map((child) => ({
|
|
8347
|
+
type: "agent",
|
|
8348
|
+
node: child,
|
|
8349
|
+
order: child.firstOrder
|
|
8350
|
+
}))
|
|
8351
|
+
].sort((a, b) => a.order - b.order);
|
|
8352
|
+
}
|
|
8353
|
+
function AgentEventRow({ content }) {
|
|
8354
|
+
const label = content.title?.trim() || content.message?.trim() || content.event?.trim() || "Event";
|
|
8355
|
+
const detail = content.title?.trim() && content.message?.trim() ? content.message.trim() : null;
|
|
8356
|
+
const isError = content.error !== void 0 || isFailedRunStatus(content.status);
|
|
8357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
8358
|
+
"div",
|
|
8359
|
+
{
|
|
8360
|
+
className: cn(
|
|
8361
|
+
"flex items-start gap-2 rounded-md px-2 py-1.5 text-xs leading-5",
|
|
8362
|
+
isError ? "bg-destructive/10 text-destructive" : "bg-muted/40 text-muted-foreground"
|
|
8363
|
+
),
|
|
8364
|
+
children: [
|
|
8365
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.Info, { className: "mt-0.5 h-3.5 w-3.5 shrink-0" }),
|
|
8366
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
8367
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "truncate font-medium", children: label }),
|
|
8368
|
+
detail ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "wrap-break-word", children: detail }) : null,
|
|
8369
|
+
content.error !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("pre", { className: "mt-1 whitespace-pre-wrap wrap-break-word", children: formatDisplayValue2(content.error) }) : null
|
|
8370
|
+
] })
|
|
8371
|
+
]
|
|
8372
|
+
}
|
|
8373
|
+
);
|
|
8374
|
+
}
|
|
8375
|
+
function AgentRunGroup({
|
|
8376
|
+
node,
|
|
8377
|
+
hasFollowingItem,
|
|
8378
|
+
depth,
|
|
8379
|
+
renderUnits
|
|
8380
|
+
}) {
|
|
8381
|
+
const { t } = useChatkitTranslation();
|
|
8382
|
+
const counts = getAgentRunCounts(node);
|
|
8383
|
+
const statusConfig = getAgentRunStatusConfig(
|
|
8384
|
+
node.info.status,
|
|
8385
|
+
counts.text > 0
|
|
8386
|
+
);
|
|
8387
|
+
const StatusIcon = statusConfig.icon;
|
|
8388
|
+
const isRunning = isRunningRunStatus(node.info.status);
|
|
8389
|
+
const [isExpanded, setIsExpanded] = React28.useState(
|
|
8390
|
+
() => isRunning || !hasFollowingItem
|
|
8391
|
+
);
|
|
8392
|
+
const title = getAgentRunTitle(node.info, t("message.agentRun.defaultTitle"));
|
|
8393
|
+
const duration = getAgentRunDuration(node.info);
|
|
8394
|
+
const statusLabel = t(`message.agentRun.status.${statusConfig.labelKey}`, {
|
|
8395
|
+
defaultValue: node.info.status ?? statusConfig.labelKey
|
|
8396
|
+
});
|
|
8397
|
+
const detailsId = React28.useId();
|
|
8398
|
+
React28.useEffect(() => {
|
|
8399
|
+
if (isRunning) {
|
|
8400
|
+
setIsExpanded(true);
|
|
8401
|
+
return;
|
|
8402
|
+
}
|
|
8403
|
+
setIsExpanded(!hasFollowingItem);
|
|
8404
|
+
}, [hasFollowingItem, isRunning]);
|
|
8405
|
+
const countItems = [
|
|
8406
|
+
counts.text > 0 ? {
|
|
8407
|
+
icon: import_lucide_react16.MessageSquareText,
|
|
8408
|
+
count: counts.text,
|
|
8409
|
+
label: t(
|
|
8410
|
+
`message.agentRun.counts.messages.${counts.text === 1 ? "one" : "other"}`,
|
|
8411
|
+
{ count: counts.text }
|
|
8412
|
+
)
|
|
8413
|
+
} : null,
|
|
8414
|
+
counts.tools > 0 ? {
|
|
8415
|
+
icon: import_lucide_react16.Wrench,
|
|
8416
|
+
count: counts.tools,
|
|
8417
|
+
label: t(
|
|
8418
|
+
`message.agentRun.counts.tools.${counts.tools === 1 ? "one" : "other"}`,
|
|
8419
|
+
{ count: counts.tools }
|
|
8420
|
+
)
|
|
8421
|
+
} : null,
|
|
8422
|
+
counts.events > 0 ? {
|
|
8423
|
+
icon: import_lucide_react16.Info,
|
|
8424
|
+
count: counts.events,
|
|
8425
|
+
label: t(
|
|
8426
|
+
`message.agentRun.counts.events.${counts.events === 1 ? "one" : "other"}`,
|
|
8427
|
+
{ count: counts.events }
|
|
8428
|
+
)
|
|
8429
|
+
} : null,
|
|
8430
|
+
counts.children > 0 ? {
|
|
8431
|
+
icon: import_lucide_react16.GitBranch,
|
|
8432
|
+
count: counts.children,
|
|
8433
|
+
label: t(
|
|
8434
|
+
`message.agentRun.counts.children.${counts.children === 1 ? "one" : "other"}`,
|
|
8435
|
+
{ count: counts.children }
|
|
8436
|
+
)
|
|
8437
|
+
} : null
|
|
8438
|
+
].filter(
|
|
8439
|
+
(item) => Boolean(item)
|
|
8440
|
+
);
|
|
8441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: cn("border-l border-border/70 pl-2", depth > 0 ? "ml-1" : "-mx-2.5"), children: [
|
|
8442
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
8443
|
+
"button",
|
|
8444
|
+
{
|
|
8445
|
+
type: "button",
|
|
8446
|
+
className: "group/agent group-agent flex w-full items-start justify-between gap-2 rounded-md px-0 py-1.5 text-left",
|
|
8447
|
+
"aria-expanded": isExpanded,
|
|
8448
|
+
"aria-controls": detailsId,
|
|
8449
|
+
onClick: () => setIsExpanded((prev) => !prev),
|
|
8450
|
+
children: [
|
|
8451
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1", children: [
|
|
8452
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.Bot, { className: "h-4 w-4 shrink-0 text-muted-foreground/55 transition-colors group-hover/agent:text-muted-foreground" }),
|
|
8453
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "min-w-0 max-w-[16rem] truncate text-sm font-medium text-foreground/65 transition-colors group-hover/agent:text-foreground", children: title }),
|
|
8454
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "inline-flex shrink-0 items-center gap-1 text-[11px] text-muted-foreground/65 transition-colors group-hover/agent:text-muted-foreground", children: [
|
|
8455
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
8456
|
+
StatusIcon,
|
|
8457
|
+
{
|
|
8458
|
+
className: cn(
|
|
8459
|
+
"h-3.5 w-3.5",
|
|
8460
|
+
statusConfig.iconClass,
|
|
8461
|
+
statusConfig.spin && "animate-spin"
|
|
8462
|
+
)
|
|
8463
|
+
}
|
|
8464
|
+
),
|
|
8465
|
+
statusLabel
|
|
8466
|
+
] }),
|
|
8467
|
+
duration !== null ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "inline-flex shrink-0 items-center gap-1 text-[11px] text-muted-foreground/60 tabular-nums transition-colors group-hover/agent:text-muted-foreground", children: [
|
|
8468
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.Clock3, { className: "h-3 w-3" }),
|
|
8469
|
+
formatStepDuration(duration)
|
|
8470
|
+
] }) : null,
|
|
8471
|
+
node.info.inputs !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
8472
|
+
AgentRunHeaderMetric,
|
|
8473
|
+
{
|
|
8474
|
+
icon: import_lucide_react16.Braces,
|
|
8475
|
+
label: t("message.agentRun.inputLabel"),
|
|
8476
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "space-y-1", children: [
|
|
8477
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "font-medium", children: t("message.agentRun.inputLabel") }),
|
|
8478
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("pre", { className: "max-h-64 overflow-auto whitespace-pre-wrap wrap-break-word text-xs", children: formatDisplayValue2(node.info.inputs) })
|
|
8479
|
+
] })
|
|
8480
|
+
}
|
|
8481
|
+
) : null,
|
|
8482
|
+
countItems.map((item) => {
|
|
8483
|
+
const CountIcon = item.icon;
|
|
8484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
8485
|
+
AgentRunHeaderMetric,
|
|
8486
|
+
{
|
|
8487
|
+
icon: CountIcon,
|
|
8488
|
+
label: item.label,
|
|
8489
|
+
value: item.count,
|
|
8490
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: item.label })
|
|
8491
|
+
},
|
|
8492
|
+
item.label
|
|
8493
|
+
);
|
|
8494
|
+
})
|
|
8495
|
+
] }) }),
|
|
8496
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
8497
|
+
import_lucide_react16.ChevronRight,
|
|
8498
|
+
{
|
|
8499
|
+
"aria-hidden": "true",
|
|
8500
|
+
className: cn(
|
|
8501
|
+
"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground/55 opacity-0 transition-[color,transform] group-hover/agent:text-muted-foreground group-hover/agent:opacity-100",
|
|
8502
|
+
isExpanded && "rotate-90"
|
|
8503
|
+
)
|
|
8504
|
+
}
|
|
8505
|
+
)
|
|
8506
|
+
]
|
|
8507
|
+
}
|
|
8508
|
+
),
|
|
8509
|
+
isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { id: detailsId, className: "mt-2 space-y-3", children: [
|
|
8510
|
+
hasVisibleAgentRunDetails(node.info) ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "space-y-2 rounded-md bg-muted/30 px-2 py-2 text-xs text-muted-foreground", children: node.info.error !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { children: [
|
|
8511
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "mb-1 font-medium text-destructive", children: t("message.agentRun.errorLabel") }),
|
|
8512
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word text-destructive", children: formatDisplayValue2(node.info.error) })
|
|
8513
|
+
] }) : null }) : null,
|
|
8514
|
+
renderUnits(getAgentNodeUnits(node), depth + 1)
|
|
8515
|
+
] }) : null
|
|
8516
|
+
] });
|
|
8517
|
+
}
|
|
8518
|
+
|
|
8519
|
+
// src/components/thread/messages/web-search-component-renderer.tsx
|
|
8520
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
8521
|
+
var webSearchComponentRenderer = {
|
|
8522
|
+
id: "computer-web-search-sources",
|
|
8523
|
+
presentation: "grouped-step",
|
|
8524
|
+
match: isComputerWebSearchComponent,
|
|
8525
|
+
hasDetails: hasWebSearchSources,
|
|
8526
|
+
renderDetails: WebSearchToolCallOutput
|
|
8527
|
+
};
|
|
8528
|
+
function normalizeToolToken(value) {
|
|
8529
|
+
if (typeof value !== "string") return null;
|
|
8530
|
+
const normalized = value.trim().toLowerCase().replace(/[\s-]+/g, "_");
|
|
8531
|
+
return normalized || null;
|
|
8532
|
+
}
|
|
8533
|
+
function readOptionalString(value) {
|
|
8534
|
+
if (typeof value !== "string") return void 0;
|
|
8535
|
+
const trimmed = value.trim();
|
|
8536
|
+
return trimmed || void 0;
|
|
8537
|
+
}
|
|
8538
|
+
function normalizeWebSearchSource(value) {
|
|
8539
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
8540
|
+
return null;
|
|
8541
|
+
}
|
|
8542
|
+
const candidate = value;
|
|
8543
|
+
const title = readOptionalString(candidate.title);
|
|
8544
|
+
const url = readOptionalString(candidate.url);
|
|
8545
|
+
if (!title || !url) return null;
|
|
8546
|
+
const content = readOptionalString(candidate.content);
|
|
8547
|
+
const description = readOptionalString(candidate.description);
|
|
8548
|
+
const publishedDate = readOptionalString(
|
|
8549
|
+
candidate.publishedDate ?? candidate.published_date ?? candidate.publishedAt
|
|
8550
|
+
);
|
|
8551
|
+
const author = readOptionalString(candidate.author);
|
|
8552
|
+
return {
|
|
8553
|
+
title,
|
|
8554
|
+
url,
|
|
8555
|
+
...content ? { content } : {},
|
|
8556
|
+
...description ? { description } : {},
|
|
8557
|
+
...publishedDate ? { publishedDate } : {},
|
|
8558
|
+
...author ? { author } : {}
|
|
8559
|
+
};
|
|
8560
|
+
}
|
|
8561
|
+
function getWebSearchSources(data) {
|
|
8562
|
+
if (!Array.isArray(data.data)) return [];
|
|
8563
|
+
return data.data.flatMap((item) => {
|
|
8564
|
+
const source = normalizeWebSearchSource(item);
|
|
8565
|
+
return source ? [source] : [];
|
|
8566
|
+
});
|
|
8567
|
+
}
|
|
8568
|
+
function hasWebSearchSources(_content, data) {
|
|
8569
|
+
return getWebSearchSources(data).length > 0;
|
|
8570
|
+
}
|
|
8571
|
+
function isComputerWebSearchComponent(_content, data) {
|
|
8572
|
+
const isComputer = data.category === "Computer";
|
|
8573
|
+
const isWebSearch = normalizeToolToken(data.type) === "web_search";
|
|
8574
|
+
if (!isComputer || !isWebSearch) return false;
|
|
8575
|
+
return normalizeToolToken(data.tool) === "web_search" || getWebSearchSources(data).length > 0;
|
|
8576
|
+
}
|
|
8577
|
+
function getSourceHost(url) {
|
|
8578
|
+
try {
|
|
8579
|
+
return new URL(url).hostname.replace(/^www\./, "") || null;
|
|
8580
|
+
} catch {
|
|
8581
|
+
return null;
|
|
8582
|
+
}
|
|
8583
|
+
}
|
|
8584
|
+
function WebSearchToolCallOutput({
|
|
8585
|
+
data
|
|
8586
|
+
}) {
|
|
8587
|
+
const { t } = useChatkitTranslation();
|
|
8588
|
+
const sources = getWebSearchSources(data);
|
|
8589
|
+
if (sources.length === 0 || data.error !== void 0) return null;
|
|
8590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "space-y-2", children: [
|
|
8591
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "text-[11px] font-medium text-muted-foreground", children: t("message.toolGroup.sourcesTitle") }),
|
|
8592
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "space-y-2", children: sources.map((source, index) => {
|
|
8593
|
+
const sourceHost = getSourceHost(source.url);
|
|
8594
|
+
const snippet = source.content ?? source.description;
|
|
8595
|
+
const metaParts = [
|
|
8596
|
+
sourceHost,
|
|
8597
|
+
source.publishedDate,
|
|
8598
|
+
source.author
|
|
8599
|
+
].filter((item) => Boolean(item));
|
|
8600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
8601
|
+
"div",
|
|
8602
|
+
{
|
|
8603
|
+
className: "min-w-0 rounded-md border border-border/60 bg-background/80 px-3 py-2",
|
|
8604
|
+
children: [
|
|
8605
|
+
metaParts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "mb-1 truncate text-[11px] text-muted-foreground", children: metaParts.join(" / ") }) : null,
|
|
8606
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
8607
|
+
"a",
|
|
8608
|
+
{
|
|
8609
|
+
href: source.url,
|
|
8610
|
+
target: "_blank",
|
|
8611
|
+
rel: "noreferrer",
|
|
8612
|
+
className: "block min-w-0 line-clamp-2 text-sm font-medium leading-5 text-foreground hover:underline",
|
|
8613
|
+
children: source.title
|
|
8614
|
+
}
|
|
8615
|
+
),
|
|
8616
|
+
snippet ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "mt-1 line-clamp-3 text-xs leading-5 text-muted-foreground", children: snippet }) : null
|
|
8617
|
+
]
|
|
8618
|
+
},
|
|
8619
|
+
`${source.url}-${index}`
|
|
8620
|
+
);
|
|
8621
|
+
}) })
|
|
8622
|
+
] });
|
|
8623
|
+
}
|
|
8624
|
+
|
|
8625
|
+
// src/components/thread/messages/component-message-renderers.tsx
|
|
8626
|
+
var COMPONENT_MESSAGE_RENDERERS = [
|
|
8627
|
+
webSearchComponentRenderer
|
|
8628
|
+
];
|
|
8629
|
+
function getComponentMessageRenderer(content, data) {
|
|
8630
|
+
return COMPONENT_MESSAGE_RENDERERS.find(
|
|
8631
|
+
(renderer) => renderer.match(content, data)
|
|
8632
|
+
) ?? null;
|
|
8633
|
+
}
|
|
8634
|
+
function getComponentMessagePresentation(content, data) {
|
|
8635
|
+
return getComponentMessageRenderer(content, data)?.presentation ?? null;
|
|
8636
|
+
}
|
|
8637
|
+
function hasComponentMessageRendererDetails(renderer, content, data) {
|
|
8638
|
+
if (!renderer?.renderDetails) return false;
|
|
8639
|
+
return renderer.hasDetails?.(content, data) ?? true;
|
|
8640
|
+
}
|
|
8641
|
+
|
|
8642
|
+
// src/components/thread/messages/tool-component-group.tsx
|
|
8643
|
+
var React29 = __toESM(require("react"), 1);
|
|
8644
|
+
var import_lucide_react17 = require("lucide-react");
|
|
8645
|
+
|
|
7785
8646
|
// src/i18n/localized-text.ts
|
|
7786
8647
|
function resolveLocalizedText(value, language) {
|
|
7787
8648
|
if (typeof value === "string") {
|
|
@@ -7832,19 +8693,19 @@ function resolveLocalizedText(value, language) {
|
|
|
7832
8693
|
}
|
|
7833
8694
|
|
|
7834
8695
|
// src/components/thread/messages/tool-component-group.tsx
|
|
7835
|
-
var
|
|
8696
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
7836
8697
|
var toolStatusConfig = {
|
|
7837
8698
|
success: {
|
|
7838
8699
|
iconClass: "border-green-500 text-green-700",
|
|
7839
|
-
icon:
|
|
8700
|
+
icon: import_lucide_react17.CheckCircle2
|
|
7840
8701
|
},
|
|
7841
8702
|
fail: {
|
|
7842
8703
|
iconClass: "border-red-500 text-red-700",
|
|
7843
|
-
icon:
|
|
8704
|
+
icon: import_lucide_react17.XCircle
|
|
7844
8705
|
},
|
|
7845
8706
|
running: {
|
|
7846
8707
|
iconClass: "border-blue-500 text-blue-700",
|
|
7847
|
-
icon:
|
|
8708
|
+
icon: import_lucide_react17.Loader2
|
|
7848
8709
|
}
|
|
7849
8710
|
};
|
|
7850
8711
|
var TOOL_GROUP_CATEGORY_ORDER = [
|
|
@@ -7880,6 +8741,7 @@ var TOOL_GROUP_TOKEN_CATEGORY = {
|
|
|
7880
8741
|
tool: "tools",
|
|
7881
8742
|
tools: "tools"
|
|
7882
8743
|
};
|
|
8744
|
+
var TOOL_CALL_ROW_TEXT_CLASS = "text-xs leading-5 in-data-[density=compact]:text-[11px] in-data-[density=compact]:leading-4 in-data-[density=spacious]:text-[13px] in-data-[density=spacious]:leading-5";
|
|
7883
8745
|
var TOOL_CALL_OUTPUT_RENDERERS = {};
|
|
7884
8746
|
function normalizeStepCategory(category) {
|
|
7885
8747
|
if (typeof category !== "string" || category.trim() === "") {
|
|
@@ -7918,7 +8780,7 @@ function getEffectiveToolStepStatus(data, isThreadRunning) {
|
|
|
7918
8780
|
}
|
|
7919
8781
|
return data.status;
|
|
7920
8782
|
}
|
|
7921
|
-
function
|
|
8783
|
+
function formatStepDuration2(durationMs) {
|
|
7922
8784
|
if (durationMs < 1e3) {
|
|
7923
8785
|
return `${durationMs}ms`;
|
|
7924
8786
|
}
|
|
@@ -7937,10 +8799,10 @@ function formatStepDuration(durationMs) {
|
|
|
7937
8799
|
return `${minutes}m ${seconds}s`;
|
|
7938
8800
|
}
|
|
7939
8801
|
function useFrozenTimestamp(shouldFreeze) {
|
|
7940
|
-
const [frozenAt, setFrozenAt] =
|
|
8802
|
+
const [frozenAt, setFrozenAt] = React29.useState(
|
|
7941
8803
|
() => shouldFreeze ? Date.now() : null
|
|
7942
8804
|
);
|
|
7943
|
-
|
|
8805
|
+
React29.useEffect(() => {
|
|
7944
8806
|
if (shouldFreeze) {
|
|
7945
8807
|
setFrozenAt((current) => current ?? Date.now());
|
|
7946
8808
|
return;
|
|
@@ -7950,12 +8812,12 @@ function useFrozenTimestamp(shouldFreeze) {
|
|
|
7950
8812
|
return frozenAt;
|
|
7951
8813
|
}
|
|
7952
8814
|
function useToolStepDurationLabel(data, options) {
|
|
7953
|
-
const [durationNow, setDurationNow] =
|
|
8815
|
+
const [durationNow, setDurationNow] = React29.useState(() => Date.now());
|
|
7954
8816
|
const createdAt = parseStepDate(data.created_date);
|
|
7955
8817
|
const explicitEndedAt = parseStepDate(data.end_date);
|
|
7956
8818
|
const status = options?.status ?? data.status;
|
|
7957
8819
|
const endedAt = explicitEndedAt ?? (status !== "running" ? options?.fallbackEndedAt ?? null : null);
|
|
7958
|
-
|
|
8820
|
+
React29.useEffect(() => {
|
|
7959
8821
|
if (status !== "running" || createdAt === null || endedAt !== null) {
|
|
7960
8822
|
return;
|
|
7961
8823
|
}
|
|
@@ -7969,43 +8831,47 @@ function useToolStepDurationLabel(data, options) {
|
|
|
7969
8831
|
}, [createdAt, endedAt, status]);
|
|
7970
8832
|
if (createdAt === null) return null;
|
|
7971
8833
|
const durationMs = Math.max(0, (endedAt ?? durationNow) - createdAt);
|
|
7972
|
-
return
|
|
8834
|
+
return formatStepDuration2(durationMs);
|
|
7973
8835
|
}
|
|
7974
|
-
function
|
|
8836
|
+
function isComponentContent2(content) {
|
|
7975
8837
|
return content.type === "component";
|
|
7976
8838
|
}
|
|
7977
|
-
function
|
|
8839
|
+
function isTextContent2(content) {
|
|
7978
8840
|
return content.type === "text";
|
|
7979
8841
|
}
|
|
7980
|
-
function
|
|
8842
|
+
function isReasoningContent2(content) {
|
|
7981
8843
|
return content.type === "reasoning";
|
|
7982
8844
|
}
|
|
7983
8845
|
function isWidgetComponent(content) {
|
|
7984
8846
|
const data = content.data;
|
|
7985
8847
|
return data?.type === "Widget" && Array.isArray(data.widgets);
|
|
7986
8848
|
}
|
|
7987
|
-
function
|
|
8849
|
+
function isGroupableStepComponent(content) {
|
|
7988
8850
|
if (!content || typeof content === "string") return false;
|
|
7989
|
-
|
|
8851
|
+
if (!isComponentContent2(content) || isWidgetComponent(content)) return false;
|
|
8852
|
+
const data = getToolStepData(content);
|
|
8853
|
+
const renderer = getComponentMessageRenderer(content, data);
|
|
8854
|
+
if (renderer) return renderer.presentation === "grouped-step";
|
|
8855
|
+
return data.category === "Tool";
|
|
7990
8856
|
}
|
|
7991
8857
|
function isSkippableToolGroupSeparator(content) {
|
|
7992
8858
|
if (typeof content === "string") return !content.trim();
|
|
7993
8859
|
if (!content) return true;
|
|
7994
|
-
if (
|
|
8860
|
+
if (isTextContent2(content)) {
|
|
7995
8861
|
return !content.text?.trim();
|
|
7996
8862
|
}
|
|
7997
|
-
if (
|
|
8863
|
+
if (isReasoningContent2(content)) {
|
|
7998
8864
|
return !content.text?.trim();
|
|
7999
8865
|
}
|
|
8000
8866
|
return false;
|
|
8001
8867
|
}
|
|
8002
|
-
function
|
|
8868
|
+
function normalizeToolToken2(value) {
|
|
8003
8869
|
if (typeof value !== "string") return null;
|
|
8004
8870
|
const normalized = value.trim().toLowerCase().replace(/[\s-]+/g, "_");
|
|
8005
8871
|
return normalized || null;
|
|
8006
8872
|
}
|
|
8007
8873
|
function classifyToolToken(value) {
|
|
8008
|
-
const normalized =
|
|
8874
|
+
const normalized = normalizeToolToken2(
|
|
8009
8875
|
typeof value === "string" ? value : resolveLocalizedText(value, "en-US")
|
|
8010
8876
|
);
|
|
8011
8877
|
if (!normalized) return null;
|
|
@@ -8034,15 +8900,6 @@ function getToolGroupCategoryCounts(items) {
|
|
|
8034
8900
|
return counts;
|
|
8035
8901
|
}, {});
|
|
8036
8902
|
}
|
|
8037
|
-
function getEffectiveToolGroupDisplayStatus(items, isThreadRunning) {
|
|
8038
|
-
if (items.some((item) => {
|
|
8039
|
-
const data = getToolStepData(item);
|
|
8040
|
-
return getEffectiveToolStepStatus(data, isThreadRunning) === "fail" || Boolean(data.error);
|
|
8041
|
-
})) {
|
|
8042
|
-
return "fail";
|
|
8043
|
-
}
|
|
8044
|
-
return "success";
|
|
8045
|
-
}
|
|
8046
8903
|
function getToolActivityLabel(content, language, statusOverride) {
|
|
8047
8904
|
const data = getToolStepData(content);
|
|
8048
8905
|
const status = statusOverride ?? data.status;
|
|
@@ -8053,8 +8910,8 @@ function getToolActivityLabel(content, language, statusOverride) {
|
|
|
8053
8910
|
if (status === "running") {
|
|
8054
8911
|
return message ?? title ?? tool ?? type ?? "Tool";
|
|
8055
8912
|
}
|
|
8056
|
-
const titleToken =
|
|
8057
|
-
const genericTitle = titleToken !== null && [tool, type].map((candidate) =>
|
|
8913
|
+
const titleToken = normalizeToolToken2(title);
|
|
8914
|
+
const genericTitle = titleToken !== null && [tool, type].map((candidate) => normalizeToolToken2(candidate)).some((candidate) => candidate === titleToken);
|
|
8058
8915
|
if (message && (!title || genericTitle)) {
|
|
8059
8916
|
return message;
|
|
8060
8917
|
}
|
|
@@ -8073,7 +8930,7 @@ function buildToolComponentRenderUnits(content, options) {
|
|
|
8073
8930
|
const units = [];
|
|
8074
8931
|
const pendingTools = [];
|
|
8075
8932
|
content.forEach((item, index) => {
|
|
8076
|
-
if (
|
|
8933
|
+
if (isGroupableStepComponent(item) && options?.shouldGroupComponent?.(item) !== false) {
|
|
8077
8934
|
pendingTools.push({ item, index });
|
|
8078
8935
|
return;
|
|
8079
8936
|
}
|
|
@@ -8138,13 +8995,13 @@ function createToolsetAvatarUrl(toolsetId, apiUrl) {
|
|
|
8138
8995
|
}
|
|
8139
8996
|
}
|
|
8140
8997
|
function shouldUseToolsetAvatar(toolset) {
|
|
8141
|
-
const normalized =
|
|
8998
|
+
const normalized = normalizeToolToken2(toolset);
|
|
8142
8999
|
return normalized === "mcp" || normalized === "openapi";
|
|
8143
9000
|
}
|
|
8144
9001
|
function useToolsetAvatar(toolsetId, enabled, apiUrl) {
|
|
8145
9002
|
const avatarUrl = enabled ? createToolsetAvatarUrl(toolsetId, apiUrl) : null;
|
|
8146
|
-
const [avatar, setAvatar] =
|
|
8147
|
-
|
|
9003
|
+
const [avatar, setAvatar] = React29.useState(null);
|
|
9004
|
+
React29.useEffect(() => {
|
|
8148
9005
|
if (!avatarUrl) {
|
|
8149
9006
|
setAvatar(null);
|
|
8150
9007
|
return;
|
|
@@ -8176,7 +9033,7 @@ function ToolAvatarIcon({
|
|
|
8176
9033
|
className
|
|
8177
9034
|
}) {
|
|
8178
9035
|
if (avatar.url) {
|
|
8179
|
-
return /* @__PURE__ */ (0,
|
|
9036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8180
9037
|
"img",
|
|
8181
9038
|
{
|
|
8182
9039
|
alt: "",
|
|
@@ -8189,7 +9046,7 @@ function ToolAvatarIcon({
|
|
|
8189
9046
|
}
|
|
8190
9047
|
const emoji = unicodeFromUnified2(avatar.emoji?.unified);
|
|
8191
9048
|
if (emoji) {
|
|
8192
|
-
return /* @__PURE__ */ (0,
|
|
9049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8193
9050
|
"span",
|
|
8194
9051
|
{
|
|
8195
9052
|
"aria-hidden": "true",
|
|
@@ -8204,8 +9061,8 @@ function ToolAvatarIcon({
|
|
|
8204
9061
|
}
|
|
8205
9062
|
);
|
|
8206
9063
|
}
|
|
8207
|
-
return /* @__PURE__ */ (0,
|
|
8208
|
-
|
|
9064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
9065
|
+
import_lucide_react17.CircleHelp,
|
|
8209
9066
|
{
|
|
8210
9067
|
className,
|
|
8211
9068
|
"aria-hidden": "true",
|
|
@@ -8214,40 +9071,42 @@ function ToolAvatarIcon({
|
|
|
8214
9071
|
);
|
|
8215
9072
|
}
|
|
8216
9073
|
function getKnownToolsetIcon(toolset) {
|
|
8217
|
-
const normalized =
|
|
9074
|
+
const normalized = normalizeToolToken2(toolset);
|
|
8218
9075
|
if (!normalized) return null;
|
|
8219
9076
|
switch (normalized) {
|
|
8220
9077
|
case "project":
|
|
8221
|
-
return
|
|
9078
|
+
return import_lucide_react17.Building2;
|
|
8222
9079
|
case "transfer_to":
|
|
8223
|
-
return
|
|
9080
|
+
return import_lucide_react17.Repeat2;
|
|
8224
9081
|
case "knowledge":
|
|
8225
9082
|
case "knowledgebase":
|
|
8226
|
-
return
|
|
9083
|
+
return import_lucide_react17.BookOpen;
|
|
8227
9084
|
case "project_tasks":
|
|
8228
|
-
return
|
|
9085
|
+
return import_lucide_react17.ListTodo;
|
|
8229
9086
|
case "memories":
|
|
8230
|
-
return
|
|
9087
|
+
return import_lucide_react17.Brain;
|
|
8231
9088
|
case "workflow_agent_tool":
|
|
8232
|
-
return
|
|
9089
|
+
return import_lucide_react17.Wrench;
|
|
8233
9090
|
case "workflow_task":
|
|
8234
|
-
return
|
|
9091
|
+
return import_lucide_react17.Network;
|
|
8235
9092
|
default:
|
|
8236
9093
|
return null;
|
|
8237
9094
|
}
|
|
8238
9095
|
}
|
|
8239
9096
|
function getStepTypeIcon(type) {
|
|
8240
|
-
const normalized =
|
|
9097
|
+
const normalized = normalizeToolToken2(type);
|
|
8241
9098
|
if (!normalized) return null;
|
|
8242
9099
|
switch (normalized) {
|
|
8243
9100
|
case "file":
|
|
8244
|
-
return
|
|
9101
|
+
return import_lucide_react17.FileText;
|
|
8245
9102
|
case "files":
|
|
8246
|
-
return
|
|
9103
|
+
return import_lucide_react17.Files;
|
|
8247
9104
|
case "program":
|
|
8248
|
-
return
|
|
9105
|
+
return import_lucide_react17.SquareTerminal;
|
|
9106
|
+
case "web_search":
|
|
9107
|
+
return import_lucide_react17.Search;
|
|
8249
9108
|
case "knowledges":
|
|
8250
|
-
return
|
|
9109
|
+
return import_lucide_react17.BookOpen;
|
|
8251
9110
|
default:
|
|
8252
9111
|
return null;
|
|
8253
9112
|
}
|
|
@@ -8265,12 +9124,12 @@ function ToolStepIcon({
|
|
|
8265
9124
|
apiUrl
|
|
8266
9125
|
);
|
|
8267
9126
|
const iconUrl = createToolsetIconUrl(data.toolset, organizationId, apiUrl);
|
|
8268
|
-
const [failedIconUrl, setFailedIconUrl] =
|
|
8269
|
-
|
|
9127
|
+
const [failedIconUrl, setFailedIconUrl] = React29.useState(null);
|
|
9128
|
+
React29.useEffect(() => {
|
|
8270
9129
|
setFailedIconUrl(null);
|
|
8271
9130
|
}, [iconUrl]);
|
|
8272
9131
|
if (avatar) {
|
|
8273
|
-
return /* @__PURE__ */ (0,
|
|
9132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8274
9133
|
ToolAvatarIcon,
|
|
8275
9134
|
{
|
|
8276
9135
|
avatar,
|
|
@@ -8280,7 +9139,7 @@ function ToolStepIcon({
|
|
|
8280
9139
|
);
|
|
8281
9140
|
}
|
|
8282
9141
|
if (iconUrl && failedIconUrl !== iconUrl) {
|
|
8283
|
-
return /* @__PURE__ */ (0,
|
|
9142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8284
9143
|
"img",
|
|
8285
9144
|
{
|
|
8286
9145
|
alt: "",
|
|
@@ -8294,7 +9153,7 @@ function ToolStepIcon({
|
|
|
8294
9153
|
}
|
|
8295
9154
|
const TypeIcon = getStepTypeIcon(data.type);
|
|
8296
9155
|
if (TypeIcon) {
|
|
8297
|
-
return /* @__PURE__ */ (0,
|
|
9156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8298
9157
|
TypeIcon,
|
|
8299
9158
|
{
|
|
8300
9159
|
className,
|
|
@@ -8305,7 +9164,7 @@ function ToolStepIcon({
|
|
|
8305
9164
|
}
|
|
8306
9165
|
const ToolsetIcon = getKnownToolsetIcon(data.toolset);
|
|
8307
9166
|
if (ToolsetIcon) {
|
|
8308
|
-
return /* @__PURE__ */ (0,
|
|
9167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8309
9168
|
ToolsetIcon,
|
|
8310
9169
|
{
|
|
8311
9170
|
className,
|
|
@@ -8315,8 +9174,8 @@ function ToolStepIcon({
|
|
|
8315
9174
|
);
|
|
8316
9175
|
}
|
|
8317
9176
|
if (usesToolsetAvatar) {
|
|
8318
|
-
return /* @__PURE__ */ (0,
|
|
8319
|
-
|
|
9177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
9178
|
+
import_lucide_react17.CircleHelp,
|
|
8320
9179
|
{
|
|
8321
9180
|
className,
|
|
8322
9181
|
"aria-hidden": "true",
|
|
@@ -8324,8 +9183,8 @@ function ToolStepIcon({
|
|
|
8324
9183
|
}
|
|
8325
9184
|
);
|
|
8326
9185
|
}
|
|
8327
|
-
return /* @__PURE__ */ (0,
|
|
8328
|
-
|
|
9186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
9187
|
+
import_lucide_react17.CircleHelp,
|
|
8329
9188
|
{
|
|
8330
9189
|
className,
|
|
8331
9190
|
"aria-hidden": "true",
|
|
@@ -8335,15 +9194,15 @@ function ToolStepIcon({
|
|
|
8335
9194
|
}
|
|
8336
9195
|
function ToolCallCopyButton({ value }) {
|
|
8337
9196
|
const { t } = useChatkitTranslation();
|
|
8338
|
-
const [isCopied, setIsCopied] =
|
|
8339
|
-
const resetTimeoutRef =
|
|
8340
|
-
const clearResetTimeout =
|
|
9197
|
+
const [isCopied, setIsCopied] = React29.useState(false);
|
|
9198
|
+
const resetTimeoutRef = React29.useRef(null);
|
|
9199
|
+
const clearResetTimeout = React29.useCallback(() => {
|
|
8341
9200
|
if (resetTimeoutRef.current === null) return;
|
|
8342
9201
|
window.clearTimeout(resetTimeoutRef.current);
|
|
8343
9202
|
resetTimeoutRef.current = null;
|
|
8344
9203
|
}, []);
|
|
8345
|
-
|
|
8346
|
-
const handleCopy =
|
|
9204
|
+
React29.useEffect(() => clearResetTimeout, [clearResetTimeout]);
|
|
9205
|
+
const handleCopy = React29.useCallback(() => {
|
|
8347
9206
|
if (typeof navigator === "undefined" || !navigator.clipboard) return;
|
|
8348
9207
|
void navigator.clipboard.writeText(value).then(() => {
|
|
8349
9208
|
setIsCopied(true);
|
|
@@ -8355,7 +9214,7 @@ function ToolCallCopyButton({ value }) {
|
|
|
8355
9214
|
}).catch(() => void 0);
|
|
8356
9215
|
}, [clearResetTimeout, value]);
|
|
8357
9216
|
const label = isCopied ? t("message.toolGroup.copied") : t("message.toolGroup.copy");
|
|
8358
|
-
return /* @__PURE__ */ (0,
|
|
9217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8359
9218
|
"button",
|
|
8360
9219
|
{
|
|
8361
9220
|
type: "button",
|
|
@@ -8363,7 +9222,7 @@ function ToolCallCopyButton({ value }) {
|
|
|
8363
9222
|
"aria-label": label,
|
|
8364
9223
|
title: label,
|
|
8365
9224
|
onClick: handleCopy,
|
|
8366
|
-
children: isCopied ? /* @__PURE__ */ (0,
|
|
9225
|
+
children: isCopied ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react17.Check, { className: "h-3.5 w-3.5", "aria-hidden": "true" }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react17.Copy, { className: "h-3.5 w-3.5", "aria-hidden": "true" })
|
|
8367
9226
|
}
|
|
8368
9227
|
);
|
|
8369
9228
|
}
|
|
@@ -8374,28 +9233,28 @@ function ToolCallValueBlock({
|
|
|
8374
9233
|
const { t } = useChatkitTranslation();
|
|
8375
9234
|
const detected = detectJsonValue(value);
|
|
8376
9235
|
if (detected.kind === "text") {
|
|
8377
|
-
return /* @__PURE__ */ (0,
|
|
8378
|
-
/* @__PURE__ */ (0,
|
|
8379
|
-
/* @__PURE__ */ (0,
|
|
9236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "min-w-0 space-y-1", children: [
|
|
9237
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ToolCallCopyButton, { value: detected.text }) }),
|
|
9238
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PlainTextBlock, { value: detected.text, destructive })
|
|
8380
9239
|
] });
|
|
8381
9240
|
}
|
|
8382
|
-
return /* @__PURE__ */ (0,
|
|
8383
|
-
/* @__PURE__ */ (0,
|
|
8384
|
-
/* @__PURE__ */ (0,
|
|
9241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Tabs, { defaultValue: "tree", className: "min-w-0", children: [
|
|
9242
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "mb-2 flex min-w-0 items-center justify-between gap-2", children: [
|
|
9243
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "min-w-0 truncate text-[11px] text-muted-foreground", children: [
|
|
8385
9244
|
t("message.toolGroup.jsonTitle"),
|
|
8386
9245
|
" \xB7 ",
|
|
8387
9246
|
getJsonValueSummary(detected.value)
|
|
8388
9247
|
] }),
|
|
8389
|
-
/* @__PURE__ */ (0,
|
|
8390
|
-
/* @__PURE__ */ (0,
|
|
8391
|
-
/* @__PURE__ */ (0,
|
|
8392
|
-
/* @__PURE__ */ (0,
|
|
8393
|
-
/* @__PURE__ */ (0,
|
|
9248
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
9249
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ToolCallCopyButton, { value: detected.raw }),
|
|
9250
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(TabsList, { className: "rounded-md p-0.5", children: [
|
|
9251
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TabsTrigger, { className: "px-2 py-0.5 text-[11px]", value: "tree", children: t("message.toolGroup.jsonTree") }),
|
|
9252
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TabsTrigger, { className: "px-2 py-0.5 text-[11px]", value: "raw", children: t("message.toolGroup.jsonRaw") })
|
|
8394
9253
|
] })
|
|
8395
9254
|
] })
|
|
8396
9255
|
] }),
|
|
8397
|
-
/* @__PURE__ */ (0,
|
|
8398
|
-
/* @__PURE__ */ (0,
|
|
9256
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TabsContent, { value: "tree", className: "mt-0", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(JsonTreeView, { value: detected.value }) }),
|
|
9257
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TabsContent, { value: "raw", className: "mt-0", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(RawJsonBlock, { raw: detected.raw }) })
|
|
8399
9258
|
] });
|
|
8400
9259
|
}
|
|
8401
9260
|
function DefaultToolCallOutput({ data }) {
|
|
@@ -8403,31 +9262,37 @@ function DefaultToolCallOutput({ data }) {
|
|
|
8403
9262
|
const output = data.output ?? null;
|
|
8404
9263
|
const error = data.error ?? null;
|
|
8405
9264
|
if (error) {
|
|
8406
|
-
return /* @__PURE__ */ (0,
|
|
8407
|
-
/* @__PURE__ */ (0,
|
|
8408
|
-
/* @__PURE__ */ (0,
|
|
9265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "space-y-1", children: [
|
|
9266
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "text-[11px] font-medium text-destructive", children: t("message.toolGroup.errorTitle") }),
|
|
9267
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ToolCallValueBlock, { value: error, destructive: true })
|
|
8409
9268
|
] });
|
|
8410
9269
|
}
|
|
8411
9270
|
if (output === null) return null;
|
|
8412
|
-
return /* @__PURE__ */ (0,
|
|
8413
|
-
/* @__PURE__ */ (0,
|
|
8414
|
-
/* @__PURE__ */ (0,
|
|
9271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "space-y-1", children: [
|
|
9272
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "text-[11px] font-medium text-muted-foreground", children: t("message.toolGroup.outputTitle") }),
|
|
9273
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ToolCallValueBlock, { value: output })
|
|
8415
9274
|
] });
|
|
8416
9275
|
}
|
|
8417
9276
|
function ToolCallDetails({ content }) {
|
|
8418
9277
|
const { t } = useChatkitTranslation();
|
|
8419
9278
|
const data = getToolStepData(content);
|
|
9279
|
+
const renderer = getComponentMessageRenderer(content, data);
|
|
9280
|
+
const hasCustomDetails = data.error === void 0 && hasComponentMessageRendererDetails(renderer, content, data);
|
|
9281
|
+
const CustomDetailsRenderer = hasCustomDetails ? renderer?.renderDetails : void 0;
|
|
9282
|
+
if (CustomDetailsRenderer) {
|
|
9283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "ml-6 mt-1 max-h-60 overflow-auto rounded-md bg-muted/30 text-xs text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CustomDetailsRenderer, { content, data }) });
|
|
9284
|
+
}
|
|
8420
9285
|
const OutputRenderer = getToolCallOutputRenderer(data);
|
|
8421
9286
|
const hasInput = data.input !== void 0 && data.input !== null;
|
|
8422
9287
|
const hasOutput = data.error !== void 0 || data.output !== void 0;
|
|
8423
9288
|
if (!hasInput && !hasOutput) return null;
|
|
8424
|
-
return /* @__PURE__ */ (0,
|
|
8425
|
-
hasInput && /* @__PURE__ */ (0,
|
|
8426
|
-
/* @__PURE__ */ (0,
|
|
8427
|
-
/* @__PURE__ */ (0,
|
|
9289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("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: [
|
|
9290
|
+
hasInput && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "space-y-1", children: [
|
|
9291
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "text-[11px] font-medium text-muted-foreground", children: t("message.toolGroup.inputTitle") }),
|
|
9292
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ToolCallValueBlock, { value: data.input })
|
|
8428
9293
|
] }),
|
|
8429
|
-
hasInput && hasOutput ? /* @__PURE__ */ (0,
|
|
8430
|
-
hasOutput ? /* @__PURE__ */ (0,
|
|
9294
|
+
hasInput && hasOutput ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "h-2" }) : null,
|
|
9295
|
+
hasOutput ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(OutputRenderer, { content, data }) : null
|
|
8431
9296
|
] });
|
|
8432
9297
|
}
|
|
8433
9298
|
function areToolCallRowPropsEqual(previous, next) {
|
|
@@ -8442,12 +9307,12 @@ function ToolCallRowContent({
|
|
|
8442
9307
|
const { i18n: i18n2 } = useChatkitTranslation();
|
|
8443
9308
|
const data = getToolStepData(content);
|
|
8444
9309
|
const status = getEffectiveToolStepStatus(data, isThreadRunning);
|
|
8445
|
-
const itemConfig = status ? toolStatusConfig[status] : null;
|
|
8446
|
-
const ItemStatusIcon = itemConfig?.icon;
|
|
8447
9310
|
const hasError = status === "fail" || Boolean(data.error);
|
|
8448
9311
|
const label = getToolActivityLabel(content, i18n2.language, status);
|
|
8449
|
-
const detailsId =
|
|
8450
|
-
const
|
|
9312
|
+
const detailsId = React29.useId();
|
|
9313
|
+
const renderer = getComponentMessageRenderer(content, data);
|
|
9314
|
+
const hasCustomDetails = data.error === void 0 && hasComponentMessageRendererDetails(renderer, content, data);
|
|
9315
|
+
const hasDetails = data.input !== void 0 || data.error !== void 0 || data.output !== void 0 || hasCustomDetails;
|
|
8451
9316
|
const fallbackEndedAt = useFrozenTimestamp(
|
|
8452
9317
|
data.status === "running" && status === "fail"
|
|
8453
9318
|
);
|
|
@@ -8455,19 +9320,20 @@ function ToolCallRowContent({
|
|
|
8455
9320
|
status,
|
|
8456
9321
|
fallbackEndedAt
|
|
8457
9322
|
});
|
|
8458
|
-
const [isExpanded, setIsExpanded] =
|
|
8459
|
-
|
|
9323
|
+
const [isExpanded, setIsExpanded] = React29.useState(false);
|
|
9324
|
+
React29.useEffect(() => {
|
|
8460
9325
|
if (status === "running" && data.output !== void 0) {
|
|
8461
9326
|
setIsExpanded(true);
|
|
8462
9327
|
}
|
|
8463
9328
|
}, [data.output, status]);
|
|
8464
|
-
return /* @__PURE__ */ (0,
|
|
8465
|
-
/* @__PURE__ */ (0,
|
|
9329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("li", { className: "min-w-0", children: [
|
|
9330
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
8466
9331
|
"button",
|
|
8467
9332
|
{
|
|
8468
9333
|
type: "button",
|
|
8469
9334
|
className: cn(
|
|
8470
|
-
"group/tool-call flex w-full min-w-0 items-center gap-2 text-left text-
|
|
9335
|
+
"group/tool-call flex w-full min-w-0 items-center gap-2 text-left text-muted-foreground",
|
|
9336
|
+
TOOL_CALL_ROW_TEXT_CLASS,
|
|
8471
9337
|
hasDetails && "cursor-pointer hover:text-foreground",
|
|
8472
9338
|
hasError && "text-destructive hover:text-destructive"
|
|
8473
9339
|
),
|
|
@@ -8478,16 +9344,7 @@ function ToolCallRowContent({
|
|
|
8478
9344
|
if (hasDetails) setIsExpanded((prev) => !prev);
|
|
8479
9345
|
},
|
|
8480
9346
|
children: [
|
|
8481
|
-
status
|
|
8482
|
-
ItemStatusIcon,
|
|
8483
|
-
{
|
|
8484
|
-
className: cn(
|
|
8485
|
-
"h-3.5 w-3.5 shrink-0",
|
|
8486
|
-
itemConfig?.iconClass,
|
|
8487
|
-
"animate-spin"
|
|
8488
|
-
)
|
|
8489
|
-
}
|
|
8490
|
-
) : status ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
9347
|
+
status ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8491
9348
|
ToolStepIcon,
|
|
8492
9349
|
{
|
|
8493
9350
|
data,
|
|
@@ -8498,11 +9355,21 @@ function ToolCallRowContent({
|
|
|
8498
9355
|
hasError ? "text-destructive" : "text-muted-foreground"
|
|
8499
9356
|
)
|
|
8500
9357
|
}
|
|
8501
|
-
) : /* @__PURE__ */ (0,
|
|
8502
|
-
/* @__PURE__ */ (0,
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
9358
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": "true" }),
|
|
9359
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
9360
|
+
"span",
|
|
9361
|
+
{
|
|
9362
|
+
className: cn(
|
|
9363
|
+
"min-w-0 truncate",
|
|
9364
|
+
status === "running" && "ck-tool-call-running-text"
|
|
9365
|
+
),
|
|
9366
|
+
title: label,
|
|
9367
|
+
children: label
|
|
9368
|
+
}
|
|
9369
|
+
),
|
|
9370
|
+
durationLabel ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "shrink-0 text-[11px] tabular-nums text-muted-foreground/80", children: durationLabel }) : null,
|
|
9371
|
+
hasDetails ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
9372
|
+
import_lucide_react17.ChevronRight,
|
|
8506
9373
|
{
|
|
8507
9374
|
"aria-hidden": "true",
|
|
8508
9375
|
className: cn(
|
|
@@ -8514,10 +9381,10 @@ function ToolCallRowContent({
|
|
|
8514
9381
|
]
|
|
8515
9382
|
}
|
|
8516
9383
|
),
|
|
8517
|
-
hasDetails && isExpanded ? /* @__PURE__ */ (0,
|
|
9384
|
+
hasDetails && isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { id: detailsId, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ToolCallDetails, { content }) }) : null
|
|
8518
9385
|
] });
|
|
8519
9386
|
}
|
|
8520
|
-
var ToolCallRow =
|
|
9387
|
+
var ToolCallRow = React29.memo(ToolCallRowContent, areToolCallRowPropsEqual);
|
|
8521
9388
|
ToolCallRow.displayName = "ToolCallRow";
|
|
8522
9389
|
function ToolComponentGroup({
|
|
8523
9390
|
items,
|
|
@@ -8527,9 +9394,8 @@ function ToolComponentGroup({
|
|
|
8527
9394
|
apiUrl
|
|
8528
9395
|
}) {
|
|
8529
9396
|
const { t } = useChatkitTranslation();
|
|
8530
|
-
const contentId =
|
|
8531
|
-
const
|
|
8532
|
-
const [isExpanded, setIsExpanded] = React28.useState(!hasFollowingItem);
|
|
9397
|
+
const contentId = React29.useId();
|
|
9398
|
+
const [isExpanded, setIsExpanded] = React29.useState(!hasFollowingItem);
|
|
8533
9399
|
const categoryCounts = getToolGroupCategoryCounts(items);
|
|
8534
9400
|
const categorySummary = TOOL_GROUP_CATEGORY_ORDER.flatMap((category) => {
|
|
8535
9401
|
const count = categoryCounts[category] ?? 0;
|
|
@@ -8541,14 +9407,14 @@ function ToolComponentGroup({
|
|
|
8541
9407
|
)
|
|
8542
9408
|
];
|
|
8543
9409
|
}).join(t("message.toolGroup.separator"));
|
|
8544
|
-
const summary = `${t(
|
|
8545
|
-
const config = toolStatusConfig
|
|
9410
|
+
const summary = `${t("message.toolGroup.status.success")} ${categorySummary}`;
|
|
9411
|
+
const config = toolStatusConfig.success;
|
|
8546
9412
|
const StatusIcon = config.icon;
|
|
8547
|
-
|
|
9413
|
+
React29.useEffect(() => {
|
|
8548
9414
|
setIsExpanded(!hasFollowingItem);
|
|
8549
9415
|
}, [hasFollowingItem, items.length]);
|
|
8550
|
-
return /* @__PURE__ */ (0,
|
|
8551
|
-
/* @__PURE__ */ (0,
|
|
9416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "px-1 py-1", children: [
|
|
9417
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
8552
9418
|
"button",
|
|
8553
9419
|
{
|
|
8554
9420
|
type: "button",
|
|
@@ -8557,8 +9423,8 @@ function ToolComponentGroup({
|
|
|
8557
9423
|
"aria-controls": contentId,
|
|
8558
9424
|
onClick: () => setIsExpanded((prev) => !prev),
|
|
8559
9425
|
children: [
|
|
8560
|
-
/* @__PURE__ */ (0,
|
|
8561
|
-
/* @__PURE__ */ (0,
|
|
9426
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex min-w-0 items-center gap-2 text-sm font-medium text-muted-foreground", children: [
|
|
9427
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8562
9428
|
StatusIcon,
|
|
8563
9429
|
{
|
|
8564
9430
|
className: cn(
|
|
@@ -8567,10 +9433,10 @@ function ToolComponentGroup({
|
|
|
8567
9433
|
)
|
|
8568
9434
|
}
|
|
8569
9435
|
),
|
|
8570
|
-
/* @__PURE__ */ (0,
|
|
9436
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "truncate", children: summary })
|
|
8571
9437
|
] }),
|
|
8572
|
-
/* @__PURE__ */ (0,
|
|
8573
|
-
|
|
9438
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
9439
|
+
import_lucide_react17.ChevronRight,
|
|
8574
9440
|
{
|
|
8575
9441
|
"aria-hidden": "true",
|
|
8576
9442
|
className: cn(
|
|
@@ -8582,7 +9448,7 @@ function ToolComponentGroup({
|
|
|
8582
9448
|
]
|
|
8583
9449
|
}
|
|
8584
9450
|
),
|
|
8585
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
9451
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("ul", { id: contentId, className: "mt-2 space-y-1.5 overflow-y-auto pr-1", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8586
9452
|
ToolCallRow,
|
|
8587
9453
|
{
|
|
8588
9454
|
content: item,
|
|
@@ -8596,10 +9462,10 @@ function ToolComponentGroup({
|
|
|
8596
9462
|
}
|
|
8597
9463
|
|
|
8598
9464
|
// src/components/thread/messages/request-user-input-result-card.tsx
|
|
8599
|
-
var
|
|
8600
|
-
var
|
|
8601
|
-
var
|
|
8602
|
-
var
|
|
9465
|
+
var React30 = require("react");
|
|
9466
|
+
var import_chatkit_types6 = require("@xpert-ai/chatkit-types");
|
|
9467
|
+
var import_lucide_react18 = require("lucide-react");
|
|
9468
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
8603
9469
|
function isRecord2(value) {
|
|
8604
9470
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
8605
9471
|
}
|
|
@@ -8638,7 +9504,7 @@ function collectPotentialToolCalls(messages) {
|
|
|
8638
9504
|
function findRequestUserInputClientToolCallById(messages, id) {
|
|
8639
9505
|
if (!id) return null;
|
|
8640
9506
|
return collectPotentialToolCalls(messages).find(
|
|
8641
|
-
(call) => getToolCallId(call) === id && getToolCallName(call) ===
|
|
9507
|
+
(call) => getToolCallId(call) === id && getToolCallName(call) === import_chatkit_types6.REQUEST_USER_INPUT_TOOL_NAME
|
|
8642
9508
|
) ?? null;
|
|
8643
9509
|
}
|
|
8644
9510
|
function normalizeAnswer(value) {
|
|
@@ -8673,7 +9539,7 @@ function parseResultOutput(output) {
|
|
|
8673
9539
|
if (!isRecord2(result) || !Array.isArray(result.answers)) {
|
|
8674
9540
|
return null;
|
|
8675
9541
|
}
|
|
8676
|
-
const hasExplicitType = result.type ===
|
|
9542
|
+
const hasExplicitType = result.type === import_chatkit_types6.REQUEST_USER_INPUT_RESULT_TYPE;
|
|
8677
9543
|
const answers = result.answers.map(normalizeAnswer);
|
|
8678
9544
|
if (answers.some((answer) => answer === null)) {
|
|
8679
9545
|
return null;
|
|
@@ -8711,7 +9577,7 @@ function RequestUserInputResultCard({
|
|
|
8711
9577
|
className
|
|
8712
9578
|
}) {
|
|
8713
9579
|
const { t } = useChatkitTranslation();
|
|
8714
|
-
return /* @__PURE__ */ (0,
|
|
9580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
8715
9581
|
"section",
|
|
8716
9582
|
{
|
|
8717
9583
|
"aria-label": t("message.requestUserInputResult.title"),
|
|
@@ -8720,23 +9586,23 @@ function RequestUserInputResultCard({
|
|
|
8720
9586
|
className
|
|
8721
9587
|
),
|
|
8722
9588
|
children: [
|
|
8723
|
-
/* @__PURE__ */ (0,
|
|
8724
|
-
/* @__PURE__ */ (0,
|
|
8725
|
-
/* @__PURE__ */ (0,
|
|
9589
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "mb-2 flex items-center gap-2 text-sm font-semibold text-foreground", children: [
|
|
9590
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react18.CheckCircle2, { className: "h-4 w-4 text-primary" }),
|
|
9591
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: t("message.requestUserInputResult.title") })
|
|
8726
9592
|
] }),
|
|
8727
|
-
/* @__PURE__ */ (0,
|
|
9593
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "space-y-2", children: result.answers.map((answer, index) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
8728
9594
|
"div",
|
|
8729
9595
|
{
|
|
8730
9596
|
className: "rounded-md bg-background/70 px-2.5 py-2",
|
|
8731
9597
|
children: [
|
|
8732
|
-
/* @__PURE__ */ (0,
|
|
8733
|
-
/* @__PURE__ */ (0,
|
|
8734
|
-
/* @__PURE__ */ (0,
|
|
8735
|
-
/* @__PURE__ */ (0,
|
|
9598
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "text-xs font-medium leading-5 text-muted-foreground", children: answer.question }),
|
|
9599
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "mt-0.5 flex min-w-0 flex-wrap items-center gap-1.5", children: [
|
|
9600
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "min-w-0 wrap-break-word text-sm font-semibold text-foreground", children: answer.label ?? answer.value }),
|
|
9601
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "rounded-full bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground", children: t(
|
|
8736
9602
|
answer.type === "other" ? "message.requestUserInputResult.other" : "message.requestUserInputResult.option"
|
|
8737
9603
|
) })
|
|
8738
9604
|
] }),
|
|
8739
|
-
answer.description ? /* @__PURE__ */ (0,
|
|
9605
|
+
answer.description ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "mt-1 text-xs leading-5 text-muted-foreground", children: answer.description }) : null
|
|
8740
9606
|
]
|
|
8741
9607
|
},
|
|
8742
9608
|
`${answer.id}-${index}`
|
|
@@ -8748,18 +9614,18 @@ function RequestUserInputResultCard({
|
|
|
8748
9614
|
|
|
8749
9615
|
// src/components/thread/messages/widget.tsx
|
|
8750
9616
|
var import_a2ui_react = require("@xpert-ai/a2ui-react");
|
|
8751
|
-
var
|
|
9617
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
8752
9618
|
function WidgetMessage({ messageId, data }) {
|
|
8753
9619
|
const widgets = Array.isArray(data.widgets) ? data.widgets : [];
|
|
8754
9620
|
if (widgets.length === 0) return null;
|
|
8755
9621
|
const baseSurfaceId = `widget-${messageId}`;
|
|
8756
|
-
return /* @__PURE__ */ (0,
|
|
9622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "space-y-3", children: widgets.map((widget, index) => {
|
|
8757
9623
|
const config = widget?.config;
|
|
8758
9624
|
if (!config || typeof config !== "object") {
|
|
8759
9625
|
return null;
|
|
8760
9626
|
}
|
|
8761
9627
|
const surfaceId = widgets.length > 1 ? `${baseSurfaceId}-${index}` : baseSurfaceId;
|
|
8762
|
-
return /* @__PURE__ */ (0,
|
|
9628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8763
9629
|
import_a2ui_react.SurfaceRenderer,
|
|
8764
9630
|
{
|
|
8765
9631
|
surfaceId,
|
|
@@ -8771,17 +9637,18 @@ function WidgetMessage({ messageId, data }) {
|
|
|
8771
9637
|
}
|
|
8772
9638
|
|
|
8773
9639
|
// src/components/thread/messages/ai.tsx
|
|
8774
|
-
var
|
|
8775
|
-
|
|
9640
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
9641
|
+
var assistantMessageStackClassName = "space-y-3 in-data-[density=compact]:space-y-2 in-data-[density=spacious]:space-y-4";
|
|
9642
|
+
function isTextContent3(content) {
|
|
8776
9643
|
return content.type === "text";
|
|
8777
9644
|
}
|
|
8778
|
-
function
|
|
9645
|
+
function isReasoningContent3(content) {
|
|
8779
9646
|
return content.type === "reasoning";
|
|
8780
9647
|
}
|
|
8781
9648
|
function isImageContent(content) {
|
|
8782
9649
|
return content.type === "image_url";
|
|
8783
9650
|
}
|
|
8784
|
-
function
|
|
9651
|
+
function isComponentContent3(content) {
|
|
8785
9652
|
return content.type === "component";
|
|
8786
9653
|
}
|
|
8787
9654
|
function isWidgetComponent2(content) {
|
|
@@ -8791,24 +9658,24 @@ function isWidgetComponent2(content) {
|
|
|
8791
9658
|
function isMemoryContent(content) {
|
|
8792
9659
|
return content.type === "memory";
|
|
8793
9660
|
}
|
|
8794
|
-
function
|
|
9661
|
+
function safeJson3(value) {
|
|
8795
9662
|
try {
|
|
8796
9663
|
return JSON.stringify(value, null, 2);
|
|
8797
9664
|
} catch {
|
|
8798
9665
|
return String(value);
|
|
8799
9666
|
}
|
|
8800
9667
|
}
|
|
8801
|
-
function
|
|
8802
|
-
return typeof value === "string" ? value :
|
|
9668
|
+
function formatDisplayValue3(value) {
|
|
9669
|
+
return typeof value === "string" ? value : safeJson3(value);
|
|
8803
9670
|
}
|
|
8804
9671
|
function ReasoningBlock({ reasoning }) {
|
|
8805
9672
|
const blocks = reasoning.filter((item) => item.text?.trim());
|
|
8806
9673
|
if (blocks.length === 0) return null;
|
|
8807
|
-
return /* @__PURE__ */ (0,
|
|
9674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "space-y-2", children: blocks.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
8808
9675
|
"div",
|
|
8809
9676
|
{
|
|
8810
9677
|
className: "rounded-lg border bg-muted/40 p-3 text-xs text-muted-foreground",
|
|
8811
|
-
children: /* @__PURE__ */ (0,
|
|
9678
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "whitespace-pre-wrap wrap-break-word leading-relaxed", children: item.text })
|
|
8812
9679
|
},
|
|
8813
9680
|
item.id ?? `reasoning-${index}`
|
|
8814
9681
|
)) });
|
|
@@ -8816,20 +9683,20 @@ function ReasoningBlock({ reasoning }) {
|
|
|
8816
9683
|
function ImageBlock({ content }) {
|
|
8817
9684
|
const imageUrl = typeof content.image_url === "string" ? content.image_url : typeof content.image_url?.url === "string" ? content.image_url.url : null;
|
|
8818
9685
|
if (!imageUrl) {
|
|
8819
|
-
return /* @__PURE__ */ (0,
|
|
8820
|
-
/* @__PURE__ */ (0,
|
|
8821
|
-
/* @__PURE__ */ (0,
|
|
9686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Card, { children: [
|
|
9687
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CardHeader, { className: "space-y-1", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CardTitle, { className: "text-sm", children: "Image" }) }),
|
|
9688
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: safeJson3(content) })
|
|
8822
9689
|
] });
|
|
8823
9690
|
}
|
|
8824
|
-
return /* @__PURE__ */ (0,
|
|
9691
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("figure", { className: "overflow-hidden rounded-lg border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("img", { src: imageUrl, alt: "Assistant output", className: "h-auto w-full object-cover" }) });
|
|
8825
9692
|
}
|
|
8826
9693
|
function MemoryBlock({ content }) {
|
|
8827
|
-
return /* @__PURE__ */ (0,
|
|
8828
|
-
/* @__PURE__ */ (0,
|
|
8829
|
-
/* @__PURE__ */ (0,
|
|
8830
|
-
/* @__PURE__ */ (0,
|
|
9694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Card, { children: [
|
|
9695
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
9696
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CardTitle, { className: "text-sm", children: "Memory" }),
|
|
9697
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Badge, { variant: "secondary", children: "Memory" })
|
|
8831
9698
|
] }),
|
|
8832
|
-
/* @__PURE__ */ (0,
|
|
9699
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: safeJson3(content.data ?? []) }) })
|
|
8833
9700
|
] });
|
|
8834
9701
|
}
|
|
8835
9702
|
function parseStepDate2(value) {
|
|
@@ -8843,7 +9710,7 @@ function parseStepDate2(value) {
|
|
|
8843
9710
|
const timestamp = Date.parse(value);
|
|
8844
9711
|
return Number.isNaN(timestamp) ? null : timestamp;
|
|
8845
9712
|
}
|
|
8846
|
-
function
|
|
9713
|
+
function formatStepDuration3(durationMs) {
|
|
8847
9714
|
if (durationMs < 1e3) {
|
|
8848
9715
|
return `${durationMs}ms`;
|
|
8849
9716
|
}
|
|
@@ -8863,11 +9730,11 @@ function formatStepDuration2(durationMs) {
|
|
|
8863
9730
|
}
|
|
8864
9731
|
function ComponentBlock({ content }) {
|
|
8865
9732
|
const { i18n: i18n2 } = useChatkitTranslation();
|
|
8866
|
-
const [isExpanded, setIsExpanded] =
|
|
8867
|
-
const contentRef =
|
|
8868
|
-
const shouldAutoScrollRef =
|
|
8869
|
-
const previousScrollTopRef =
|
|
8870
|
-
const [durationNow, setDurationNow] =
|
|
9733
|
+
const [isExpanded, setIsExpanded] = React31.useState(false);
|
|
9734
|
+
const contentRef = React31.useRef(null);
|
|
9735
|
+
const shouldAutoScrollRef = React31.useRef(true);
|
|
9736
|
+
const previousScrollTopRef = React31.useRef(0);
|
|
9737
|
+
const [durationNow, setDurationNow] = React31.useState(() => Date.now());
|
|
8871
9738
|
const data = getToolStepData(content);
|
|
8872
9739
|
const category = data.category ?? "Component";
|
|
8873
9740
|
const title = getToolActivityLabel(content, i18n2.language);
|
|
@@ -8880,11 +9747,11 @@ function ComponentBlock({ content }) {
|
|
|
8880
9747
|
const createdAt = parseStepDate2(data.created_date);
|
|
8881
9748
|
const endedAt = parseStepDate2(data.end_date);
|
|
8882
9749
|
const durationMs = createdAt === null ? null : Math.max(0, (endedAt ?? durationNow) - createdAt);
|
|
8883
|
-
const durationLabel = durationMs === null ? null :
|
|
8884
|
-
|
|
9750
|
+
const durationLabel = durationMs === null ? null : formatStepDuration3(durationMs);
|
|
9751
|
+
React31.useEffect(() => {
|
|
8885
9752
|
if (status === "running" && output !== null) setIsExpanded(true);
|
|
8886
9753
|
}, [status, output]);
|
|
8887
|
-
|
|
9754
|
+
React31.useEffect(() => {
|
|
8888
9755
|
if (status !== "running" || createdAt === null || endedAt !== null) {
|
|
8889
9756
|
return;
|
|
8890
9757
|
}
|
|
@@ -8896,7 +9763,7 @@ function ComponentBlock({ content }) {
|
|
|
8896
9763
|
window.clearInterval(timer);
|
|
8897
9764
|
};
|
|
8898
9765
|
}, [createdAt, endedAt, status]);
|
|
8899
|
-
|
|
9766
|
+
React31.useEffect(() => {
|
|
8900
9767
|
const element = contentRef.current;
|
|
8901
9768
|
if (!element) return;
|
|
8902
9769
|
previousScrollTopRef.current = element.scrollTop;
|
|
@@ -8916,7 +9783,7 @@ function ComponentBlock({ content }) {
|
|
|
8916
9783
|
element.removeEventListener("scroll", updateAutoScrollState);
|
|
8917
9784
|
};
|
|
8918
9785
|
}, [isExpanded]);
|
|
8919
|
-
|
|
9786
|
+
React31.useEffect(() => {
|
|
8920
9787
|
if (status !== "running") {
|
|
8921
9788
|
shouldAutoScrollRef.current = true;
|
|
8922
9789
|
return;
|
|
@@ -8929,25 +9796,25 @@ function ComponentBlock({ content }) {
|
|
|
8929
9796
|
}, [isExpanded, output, status]);
|
|
8930
9797
|
const config = status ? toolStatusConfig[status] : null;
|
|
8931
9798
|
const StatusIcon = config?.icon;
|
|
8932
|
-
return /* @__PURE__ */ (0,
|
|
8933
|
-
/* @__PURE__ */ (0,
|
|
8934
|
-
/* @__PURE__ */ (0,
|
|
8935
|
-
status && StatusIcon && /* @__PURE__ */ (0,
|
|
8936
|
-
/* @__PURE__ */ (0,
|
|
9799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Card, { children: [
|
|
9800
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(CardHeader, { className: "flex flex-row items-center justify-between gap-2 px-2 py-1 cursor-pointer", onClick: () => setIsExpanded(!isExpanded), children: [
|
|
9801
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center space-x-1 flex-1 min-w-0", children: [
|
|
9802
|
+
status && StatusIcon && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(StatusIcon, { className: cn("h-4 w-4", config?.iconClass, status === "running" && "animate-spin") }),
|
|
9803
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CardTitle, { className: "text-sm truncate", children: title })
|
|
8937
9804
|
] }),
|
|
8938
|
-
/* @__PURE__ */ (0,
|
|
8939
|
-
durationLabel && /* @__PURE__ */ (0,
|
|
8940
|
-
/* @__PURE__ */ (0,
|
|
8941
|
-
/* @__PURE__ */ (0,
|
|
9805
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap items-center gap-2 shrink-0", children: [
|
|
9806
|
+
durationLabel && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "inline-flex items-center gap-1 text-[11px] text-muted-foreground tabular-nums", children: [
|
|
9807
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react19.Clock3, { className: "h-3 w-3" }),
|
|
9808
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: durationLabel })
|
|
8942
9809
|
] }),
|
|
8943
|
-
/* @__PURE__ */ (0,
|
|
8944
|
-
/* @__PURE__ */ (0,
|
|
9810
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Badge, { variant: "secondary", className: "rounded-lg px-1.5", children: category }),
|
|
9811
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
8945
9812
|
"button",
|
|
8946
9813
|
{
|
|
8947
9814
|
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
8948
9815
|
"aria-label": isExpanded ? "Collapse" : "Expand",
|
|
8949
|
-
children: /* @__PURE__ */ (0,
|
|
8950
|
-
|
|
9816
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
9817
|
+
import_lucide_react19.ChevronDown,
|
|
8951
9818
|
{
|
|
8952
9819
|
className: cn("h-4 w-4 transition-transform", isExpanded && "rotate-180")
|
|
8953
9820
|
}
|
|
@@ -8956,61 +9823,82 @@ function ComponentBlock({ content }) {
|
|
|
8956
9823
|
)
|
|
8957
9824
|
] })
|
|
8958
9825
|
] }),
|
|
8959
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
8960
|
-
data.input && /* @__PURE__ */ (0,
|
|
8961
|
-
error ? /* @__PURE__ */ (0,
|
|
9826
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(CardContent, { ref: contentRef, className: "text-xs text-muted-foreground max-h-60 overflow-auto", children: [
|
|
9827
|
+
data.input && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue3(data.input) }),
|
|
9828
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word text-destructive", children: formatDisplayValue3(error) }) : hasOutput && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue3(fallback) })
|
|
8962
9829
|
] })
|
|
8963
9830
|
] });
|
|
8964
9831
|
}
|
|
8965
9832
|
function UnknownBlock({ content }) {
|
|
8966
|
-
return /* @__PURE__ */ (0,
|
|
8967
|
-
/* @__PURE__ */ (0,
|
|
8968
|
-
/* @__PURE__ */ (0,
|
|
8969
|
-
/* @__PURE__ */ (0,
|
|
9833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Card, { children: [
|
|
9834
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
9835
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CardTitle, { className: "text-sm", children: "Assistant Content" }),
|
|
9836
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Badge, { variant: "outline", children: content.type ?? "unknown" })
|
|
8970
9837
|
] }),
|
|
8971
|
-
/* @__PURE__ */ (0,
|
|
9838
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("pre", { className: "whitespace-pre-wrap break-words", children: safeJson3(content) }) })
|
|
8972
9839
|
] });
|
|
8973
9840
|
}
|
|
8974
|
-
function renderContentItem(content, index, message, lookupMessages) {
|
|
9841
|
+
function renderContentItem(content, index, message, lookupMessages, options) {
|
|
8975
9842
|
const messageId = message.id;
|
|
9843
|
+
const textClassName = options?.isAgentOutput ? "text-sm [&_.markdown-content_p]:!leading-6" : void 0;
|
|
8976
9844
|
if (typeof content === "string") {
|
|
8977
|
-
return /* @__PURE__ */ (0,
|
|
9845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: textClassName, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(MarkdownText, { children: content }) }, `text-${index}`);
|
|
8978
9846
|
}
|
|
8979
|
-
if (
|
|
8980
|
-
return /* @__PURE__ */ (0,
|
|
9847
|
+
if (isTextContent3(content)) {
|
|
9848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: textClassName, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(MarkdownText, { children: content.text }) }, content.id ?? `text-${index}`);
|
|
8981
9849
|
}
|
|
8982
|
-
if (
|
|
8983
|
-
return /* @__PURE__ */ (0,
|
|
9850
|
+
if (isReasoningContent3(content)) {
|
|
9851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ReasoningBlock, { reasoning: [content] }) }, content.id ?? `reasoning-${index}`);
|
|
8984
9852
|
}
|
|
8985
9853
|
if (isImageContent(content)) {
|
|
8986
|
-
return /* @__PURE__ */ (0,
|
|
9854
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageBlock, { content }) }, content.id ?? `image-${index}`);
|
|
8987
9855
|
}
|
|
8988
|
-
if (
|
|
9856
|
+
if (isComponentContent3(content)) {
|
|
8989
9857
|
const requestUserInputResult = getRequestUserInputResultCardData(
|
|
8990
9858
|
content,
|
|
8991
9859
|
lookupMessages
|
|
8992
9860
|
);
|
|
8993
9861
|
if (requestUserInputResult) {
|
|
8994
|
-
return /* @__PURE__ */ (0,
|
|
9862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RequestUserInputResultCard, { result: requestUserInputResult }) }, content.id ?? `request-user-input-result-${index}`);
|
|
8995
9863
|
}
|
|
8996
9864
|
if (isWidgetComponent2(content)) {
|
|
8997
|
-
return /* @__PURE__ */ (0,
|
|
9865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(WidgetMessage, { messageId, data: content.data }) }, content.id ?? `widget-${index}`);
|
|
8998
9866
|
}
|
|
8999
|
-
|
|
9867
|
+
if (getComponentMessagePresentation(content, getToolStepData(content)) === "grouped-step") {
|
|
9868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
9869
|
+
ToolComponentGroup,
|
|
9870
|
+
{
|
|
9871
|
+
items: [content],
|
|
9872
|
+
hasFollowingItem: false,
|
|
9873
|
+
isThreadRunning: options?.isThreadRunning,
|
|
9874
|
+
organizationId: options?.organizationId,
|
|
9875
|
+
apiUrl: options?.apiUrl
|
|
9876
|
+
}
|
|
9877
|
+
) }, content.id ?? `component-group-${index}`);
|
|
9878
|
+
}
|
|
9879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ComponentBlock, { content }) }, content.id ?? `component-${index}`);
|
|
9000
9880
|
}
|
|
9001
9881
|
if (isMemoryContent(content)) {
|
|
9002
|
-
return /* @__PURE__ */ (0,
|
|
9882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(MemoryBlock, { content }) }, content.id ?? `memory-${index}`);
|
|
9883
|
+
}
|
|
9884
|
+
if (isAgentEventContent(content)) {
|
|
9885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AgentEventRow, { content }) }, content.id ?? `agent-event-${index}`);
|
|
9003
9886
|
}
|
|
9004
|
-
return /* @__PURE__ */ (0,
|
|
9887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(UnknownBlock, { content }) }, content.id ?? `unknown-${index}`);
|
|
9005
9888
|
}
|
|
9006
9889
|
function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, options) {
|
|
9007
9890
|
if (unit.type === "item") {
|
|
9008
|
-
return renderContentItem(unit.item, unit.index, message, lookupMessages
|
|
9891
|
+
return renderContentItem(unit.item, unit.index, message, lookupMessages, {
|
|
9892
|
+
isThreadRunning: options?.isThreadRunning,
|
|
9893
|
+
organizationId: options?.organizationId,
|
|
9894
|
+
apiUrl: options?.apiUrl,
|
|
9895
|
+
isAgentOutput: options?.isAgentOutput
|
|
9896
|
+
});
|
|
9009
9897
|
}
|
|
9010
|
-
return /* @__PURE__ */ (0,
|
|
9898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
9011
9899
|
"div",
|
|
9012
9900
|
{
|
|
9013
|
-
children: /* @__PURE__ */ (0,
|
|
9901
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
9014
9902
|
ToolComponentGroup,
|
|
9015
9903
|
{
|
|
9016
9904
|
items: unit.items,
|
|
@@ -9024,17 +9912,91 @@ function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, opti
|
|
|
9024
9912
|
`tool-group-${unit.startIndex}-${unit.items[0]?.id ?? "tool"}-${unit.items.length}`
|
|
9025
9913
|
);
|
|
9026
9914
|
}
|
|
9915
|
+
function renderEntryBatch(entries, message, lookupMessages, hasFollowingItem, options) {
|
|
9916
|
+
if (entries.length === 0) return null;
|
|
9917
|
+
const renderUnits = buildToolComponentRenderUnits(
|
|
9918
|
+
entries.map((entry) => entry.item),
|
|
9919
|
+
{
|
|
9920
|
+
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null
|
|
9921
|
+
}
|
|
9922
|
+
);
|
|
9923
|
+
return renderUnits.map(
|
|
9924
|
+
(unit, index) => renderContentUnit(
|
|
9925
|
+
unit,
|
|
9926
|
+
message,
|
|
9927
|
+
lookupMessages,
|
|
9928
|
+
index < renderUnits.length - 1 || hasFollowingItem,
|
|
9929
|
+
options
|
|
9930
|
+
)
|
|
9931
|
+
);
|
|
9932
|
+
}
|
|
9933
|
+
function renderAssistantRenderUnits(units, message, lookupMessages, options, depth = 0) {
|
|
9934
|
+
const rendered = [];
|
|
9935
|
+
let entryBatch = [];
|
|
9936
|
+
const flushEntries = (hasFollowingItem) => {
|
|
9937
|
+
if (entryBatch.length === 0) return;
|
|
9938
|
+
const batch = entryBatch;
|
|
9939
|
+
entryBatch = [];
|
|
9940
|
+
rendered.push(
|
|
9941
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(React31.Fragment, { children: renderEntryBatch(batch, message, lookupMessages, hasFollowingItem, {
|
|
9942
|
+
...options,
|
|
9943
|
+
isAgentOutput: depth > 0
|
|
9944
|
+
}) }, `entries-${batch[0]?.order ?? rendered.length}`)
|
|
9945
|
+
);
|
|
9946
|
+
};
|
|
9947
|
+
units.forEach((unit, index) => {
|
|
9948
|
+
const hasFollowingItem = index < units.length - 1;
|
|
9949
|
+
if (unit.type === "entry") {
|
|
9950
|
+
entryBatch.push(unit.entry);
|
|
9951
|
+
if (!hasFollowingItem) {
|
|
9952
|
+
flushEntries(false);
|
|
9953
|
+
}
|
|
9954
|
+
return;
|
|
9955
|
+
}
|
|
9956
|
+
flushEntries(true);
|
|
9957
|
+
rendered.push(
|
|
9958
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
9959
|
+
AgentRunGroup,
|
|
9960
|
+
{
|
|
9961
|
+
node: unit.node,
|
|
9962
|
+
hasFollowingItem,
|
|
9963
|
+
depth,
|
|
9964
|
+
renderUnits: (childUnits, nextDepth) => renderAssistantRenderUnits(
|
|
9965
|
+
childUnits,
|
|
9966
|
+
message,
|
|
9967
|
+
lookupMessages,
|
|
9968
|
+
options,
|
|
9969
|
+
nextDepth
|
|
9970
|
+
)
|
|
9971
|
+
},
|
|
9972
|
+
unit.node.id
|
|
9973
|
+
)
|
|
9974
|
+
);
|
|
9975
|
+
});
|
|
9976
|
+
return rendered;
|
|
9977
|
+
}
|
|
9027
9978
|
function renderContent(message, lookupMessages, options) {
|
|
9979
|
+
const renderTree = buildAssistantRenderTree(
|
|
9980
|
+
message
|
|
9981
|
+
);
|
|
9982
|
+
if (renderTree.hasAgentRuns) {
|
|
9983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: assistantMessageStackClassName, children: renderAssistantRenderUnits(
|
|
9984
|
+
renderTree.units,
|
|
9985
|
+
message,
|
|
9986
|
+
lookupMessages,
|
|
9987
|
+
options
|
|
9988
|
+
) });
|
|
9989
|
+
}
|
|
9028
9990
|
const content = message.content;
|
|
9029
9991
|
if (typeof content === "string") {
|
|
9030
9992
|
if (!content.trim()) return null;
|
|
9031
|
-
return /* @__PURE__ */ (0,
|
|
9993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(MarkdownText, { children: content });
|
|
9032
9994
|
}
|
|
9033
9995
|
if (!Array.isArray(content) || content.length === 0) return null;
|
|
9034
9996
|
const renderUnits = buildToolComponentRenderUnits(content, {
|
|
9035
9997
|
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null
|
|
9036
9998
|
});
|
|
9037
|
-
return /* @__PURE__ */ (0,
|
|
9999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "space-y-3", children: renderUnits.map(
|
|
9038
10000
|
(unit, index) => renderContentUnit(
|
|
9039
10001
|
unit,
|
|
9040
10002
|
message,
|
|
@@ -9054,20 +10016,29 @@ function AssistantStreamingIndicator({
|
|
|
9054
10016
|
thinking: t("message.thinking"),
|
|
9055
10017
|
answering: t("message.answering")
|
|
9056
10018
|
};
|
|
9057
|
-
return /* @__PURE__ */ (0,
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
|
|
9066
|
-
|
|
9067
|
-
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
|
|
10019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
10020
|
+
"div",
|
|
10021
|
+
{
|
|
10022
|
+
className: cn(
|
|
10023
|
+
"flex items-center gap-2 text-xs text-muted-foreground",
|
|
10024
|
+
className
|
|
10025
|
+
),
|
|
10026
|
+
children: [
|
|
10027
|
+
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react19.Loader2, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
10028
|
+
status === "thinking" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
10029
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.3s]" }),
|
|
10030
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.15s]" }),
|
|
10031
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce" })
|
|
10032
|
+
] }),
|
|
10033
|
+
status === "answering" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
10034
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "h-2 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.25s]" }),
|
|
10035
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "h-3 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.1s]" }),
|
|
10036
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "h-2.5 w-0.5 rounded-full bg-current animate-pulse" })
|
|
10037
|
+
] }),
|
|
10038
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: labelMap[status] })
|
|
10039
|
+
]
|
|
10040
|
+
}
|
|
10041
|
+
);
|
|
9071
10042
|
}
|
|
9072
10043
|
function AssistantMessage({
|
|
9073
10044
|
message,
|
|
@@ -9080,8 +10051,12 @@ function AssistantMessage({
|
|
|
9080
10051
|
apiUrl
|
|
9081
10052
|
}) {
|
|
9082
10053
|
const { t } = useChatkitTranslation();
|
|
9083
|
-
const
|
|
9084
|
-
|
|
10054
|
+
const renderTree = buildAssistantRenderTree(
|
|
10055
|
+
message
|
|
10056
|
+
);
|
|
10057
|
+
const rootReasoning = renderTree.hasAgentRuns ? renderTree.rootReasoning : message.reasoning;
|
|
10058
|
+
const hasContent = hasRenderableMessageContent(message.content) || renderTree.hasAgentRuns;
|
|
10059
|
+
const hasReasoning = hasRenderableReasoning(rootReasoning);
|
|
9085
10060
|
const resolvedStreamingStatus = streamingStatus ?? getAssistantStreamingStatus(message, isStreaming);
|
|
9086
10061
|
const lookupMessages = messages?.length ? messages : [message];
|
|
9087
10062
|
const answerNode = renderContent(message, lookupMessages, {
|
|
@@ -9089,42 +10064,42 @@ function AssistantMessage({
|
|
|
9089
10064
|
organizationId,
|
|
9090
10065
|
apiUrl
|
|
9091
10066
|
});
|
|
9092
|
-
const reasoningNode = hasReasoning ? /* @__PURE__ */ (0,
|
|
9093
|
-
if (!
|
|
10067
|
+
const reasoningNode = hasReasoning ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ReasoningBlock, { reasoning: rootReasoning ?? [] }) : null;
|
|
10068
|
+
if (!hasContent && !hasReasoning && !resolvedStreamingStatus) return null;
|
|
9094
10069
|
const streamingClass = isStreaming ? "streaming-active" : "";
|
|
9095
|
-
if (!
|
|
9096
|
-
return /* @__PURE__ */ (0,
|
|
10070
|
+
if (!hasContent && !hasReasoning && resolvedStreamingStatus) {
|
|
10071
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: cn("space-y-3", streamingClass, className), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) });
|
|
9097
10072
|
}
|
|
9098
10073
|
if (hasContent && hasReasoning) {
|
|
9099
|
-
return /* @__PURE__ */ (0,
|
|
9100
|
-
/* @__PURE__ */ (0,
|
|
10074
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
10075
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
9101
10076
|
Tabs,
|
|
9102
10077
|
{
|
|
9103
10078
|
defaultValue: message.status === "reasoning" ? "reasoning" : "answer",
|
|
9104
10079
|
className: "w-full",
|
|
9105
10080
|
children: [
|
|
9106
|
-
/* @__PURE__ */ (0,
|
|
9107
|
-
/* @__PURE__ */ (0,
|
|
9108
|
-
/* @__PURE__ */ (0,
|
|
10081
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(TabsList, { className: "", children: [
|
|
10082
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TabsTrigger, { value: "answer", children: t("message.answer") }),
|
|
10083
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TabsTrigger, { value: "reasoning", children: t("message.reasoning") })
|
|
9109
10084
|
] }),
|
|
9110
|
-
/* @__PURE__ */ (0,
|
|
9111
|
-
/* @__PURE__ */ (0,
|
|
10085
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TabsContent, { value: "answer", className: "space-y-3", children: answerNode }),
|
|
10086
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TabsContent, { value: "reasoning", className: "space-y-3", children: reasoningNode })
|
|
9112
10087
|
]
|
|
9113
10088
|
}
|
|
9114
10089
|
),
|
|
9115
|
-
resolvedStreamingStatus ? /* @__PURE__ */ (0,
|
|
10090
|
+
resolvedStreamingStatus ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
9116
10091
|
] });
|
|
9117
10092
|
}
|
|
9118
|
-
return /* @__PURE__ */ (0,
|
|
10093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
9119
10094
|
hasReasoning ? reasoningNode : answerNode,
|
|
9120
|
-
resolvedStreamingStatus ? /* @__PURE__ */ (0,
|
|
10095
|
+
resolvedStreamingStatus ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
9121
10096
|
] });
|
|
9122
10097
|
}
|
|
9123
10098
|
|
|
9124
10099
|
// src/components/thread/MessageActions.tsx
|
|
9125
|
-
var
|
|
9126
|
-
var
|
|
9127
|
-
var
|
|
10100
|
+
var React32 = __toESM(require("react"), 1);
|
|
10101
|
+
var import_lucide_react20 = require("lucide-react");
|
|
10102
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
9128
10103
|
function MessageActions({
|
|
9129
10104
|
content,
|
|
9130
10105
|
isAssistant = false,
|
|
@@ -9133,7 +10108,7 @@ function MessageActions({
|
|
|
9133
10108
|
className
|
|
9134
10109
|
}) {
|
|
9135
10110
|
const { t } = useChatkitTranslation();
|
|
9136
|
-
const [copied, setCopied] =
|
|
10111
|
+
const [copied, setCopied] = React32.useState(false);
|
|
9137
10112
|
const handleCopy = async () => {
|
|
9138
10113
|
try {
|
|
9139
10114
|
await navigator.clipboard.writeText(content);
|
|
@@ -9146,7 +10121,7 @@ function MessageActions({
|
|
|
9146
10121
|
if (isStreaming) {
|
|
9147
10122
|
return null;
|
|
9148
10123
|
}
|
|
9149
|
-
return /* @__PURE__ */ (0,
|
|
10124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
9150
10125
|
"div",
|
|
9151
10126
|
{
|
|
9152
10127
|
className: cn(
|
|
@@ -9154,7 +10129,7 @@ function MessageActions({
|
|
|
9154
10129
|
className
|
|
9155
10130
|
),
|
|
9156
10131
|
children: [
|
|
9157
|
-
/* @__PURE__ */ (0,
|
|
10132
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
9158
10133
|
"button",
|
|
9159
10134
|
{
|
|
9160
10135
|
type: "button",
|
|
@@ -9164,17 +10139,17 @@ function MessageActions({
|
|
|
9164
10139
|
copied && "text-green-500"
|
|
9165
10140
|
),
|
|
9166
10141
|
title: copied ? t("messageActions.copied") : t("messageActions.copy"),
|
|
9167
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
10142
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react20.Check, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react20.Copy, { size: 14 })
|
|
9168
10143
|
}
|
|
9169
10144
|
),
|
|
9170
|
-
isAssistant && onRetry && /* @__PURE__ */ (0,
|
|
10145
|
+
isAssistant && onRetry && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
9171
10146
|
"button",
|
|
9172
10147
|
{
|
|
9173
10148
|
type: "button",
|
|
9174
10149
|
onClick: onRetry,
|
|
9175
10150
|
className: "p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",
|
|
9176
10151
|
title: t("messageActions.regenerate"),
|
|
9177
|
-
children: /* @__PURE__ */ (0,
|
|
10152
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react20.RefreshCw, { size: 14 })
|
|
9178
10153
|
}
|
|
9179
10154
|
)
|
|
9180
10155
|
]
|
|
@@ -9183,20 +10158,20 @@ function MessageActions({
|
|
|
9183
10158
|
}
|
|
9184
10159
|
|
|
9185
10160
|
// src/components/thread/StartScreen.tsx
|
|
9186
|
-
var
|
|
9187
|
-
var
|
|
9188
|
-
var
|
|
10161
|
+
var React33 = require("react");
|
|
10162
|
+
var import_lucide_react21 = require("lucide-react");
|
|
10163
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
9189
10164
|
function getIconComponent2(icon) {
|
|
9190
10165
|
const iconMap = {
|
|
9191
|
-
"circle-question": /* @__PURE__ */ (0,
|
|
9192
|
-
"lightbulb": /* @__PURE__ */ (0,
|
|
9193
|
-
"sparkle": /* @__PURE__ */ (0,
|
|
9194
|
-
"write": /* @__PURE__ */ (0,
|
|
9195
|
-
"search": /* @__PURE__ */ (0,
|
|
9196
|
-
"globe": /* @__PURE__ */ (0,
|
|
9197
|
-
"book-open": /* @__PURE__ */ (0,
|
|
9198
|
-
"compass": /* @__PURE__ */ (0,
|
|
9199
|
-
"bolt": /* @__PURE__ */ (0,
|
|
10166
|
+
"circle-question": /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react21.HelpCircle, { size: 20 }),
|
|
10167
|
+
"lightbulb": /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react21.Lightbulb, { size: 20 }),
|
|
10168
|
+
"sparkle": /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react21.Sparkles, { size: 20 }),
|
|
10169
|
+
"write": /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react21.Pencil, { size: 20 }),
|
|
10170
|
+
"search": /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react21.Search, { size: 20 }),
|
|
10171
|
+
"globe": /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react21.Globe, { size: 20 }),
|
|
10172
|
+
"book-open": /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react21.BookOpen, { size: 20 }),
|
|
10173
|
+
"compass": /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react21.Compass, { size: 20 }),
|
|
10174
|
+
"bolt": /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react21.Zap, { size: 20 })
|
|
9200
10175
|
};
|
|
9201
10176
|
return icon ? iconMap[icon] || iconMap["sparkle"] : iconMap["sparkle"];
|
|
9202
10177
|
}
|
|
@@ -9204,9 +10179,9 @@ function StartScreen({ startScreen, onPromptClick, className }) {
|
|
|
9204
10179
|
const { t } = useChatkitTranslation();
|
|
9205
10180
|
const greeting = startScreen?.greeting ?? t("startScreen.greeting");
|
|
9206
10181
|
const prompts = startScreen?.prompts ?? [];
|
|
9207
|
-
return /* @__PURE__ */ (0,
|
|
9208
|
-
/* @__PURE__ */ (0,
|
|
9209
|
-
prompts.length > 0 && /* @__PURE__ */ (0,
|
|
10182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: cn("flex flex-col items-center justify-center py-12 px-4", className), children: [
|
|
10183
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "mb-8 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-2", children: greeting }) }),
|
|
10184
|
+
prompts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "w-full max-w-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: prompts.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
9210
10185
|
"button",
|
|
9211
10186
|
{
|
|
9212
10187
|
type: "button",
|
|
@@ -9217,8 +10192,8 @@ function StartScreen({ startScreen, onPromptClick, className }) {
|
|
|
9217
10192
|
"focus:outline-none focus:ring-2 focus:ring-primary/20"
|
|
9218
10193
|
),
|
|
9219
10194
|
children: [
|
|
9220
|
-
/* @__PURE__ */ (0,
|
|
9221
|
-
/* @__PURE__ */ (0,
|
|
10195
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: getIconComponent2(item.icon) }),
|
|
10196
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "text-sm font-medium text-foreground", children: item.label })
|
|
9222
10197
|
]
|
|
9223
10198
|
},
|
|
9224
10199
|
`prompt-${index}`
|
|
@@ -9227,7 +10202,7 @@ function StartScreen({ startScreen, onPromptClick, className }) {
|
|
|
9227
10202
|
}
|
|
9228
10203
|
|
|
9229
10204
|
// src/hooks/useThreads.ts
|
|
9230
|
-
var
|
|
10205
|
+
var React34 = __toESM(require("react"), 1);
|
|
9231
10206
|
var DEFAULT_LIMIT = 50;
|
|
9232
10207
|
var getThreadTitle = (threadRecord) => {
|
|
9233
10208
|
const title = threadRecord.title?.trim();
|
|
@@ -9280,16 +10255,16 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9280
10255
|
isLoading: isStreamLoading,
|
|
9281
10256
|
error: streamError
|
|
9282
10257
|
} = useStreamContext();
|
|
9283
|
-
const [threadRecords, setThreadRecords] =
|
|
9284
|
-
const [isLoading, setIsLoading] =
|
|
9285
|
-
const [error, setError] =
|
|
9286
|
-
const upsertThreadRecord =
|
|
10258
|
+
const [threadRecords, setThreadRecords] = React34.useState([]);
|
|
10259
|
+
const [isLoading, setIsLoading] = React34.useState(false);
|
|
10260
|
+
const [error, setError] = React34.useState(null);
|
|
10261
|
+
const upsertThreadRecord = React34.useCallback((threadRecord) => {
|
|
9287
10262
|
setThreadRecords((prev) => {
|
|
9288
10263
|
const next = prev.filter((item) => item.id !== threadRecord.id);
|
|
9289
10264
|
return sortThreadRecords([threadRecord, ...next]);
|
|
9290
10265
|
});
|
|
9291
10266
|
}, []);
|
|
9292
|
-
const refreshThreads =
|
|
10267
|
+
const refreshThreads = React34.useCallback(async () => {
|
|
9293
10268
|
setIsLoading(true);
|
|
9294
10269
|
setError(null);
|
|
9295
10270
|
try {
|
|
@@ -9305,7 +10280,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9305
10280
|
setIsLoading(false);
|
|
9306
10281
|
}
|
|
9307
10282
|
}, [client, limit, assistantId]);
|
|
9308
|
-
const createThread =
|
|
10283
|
+
const createThread = React34.useCallback(
|
|
9309
10284
|
async (input) => {
|
|
9310
10285
|
setError(null);
|
|
9311
10286
|
const payload = {};
|
|
@@ -9319,7 +10294,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9319
10294
|
},
|
|
9320
10295
|
[client, upsertThreadRecord]
|
|
9321
10296
|
);
|
|
9322
|
-
const updateThread =
|
|
10297
|
+
const updateThread = React34.useCallback(
|
|
9323
10298
|
async (recordId, payload) => {
|
|
9324
10299
|
setError(null);
|
|
9325
10300
|
const updated = await client.conversations.update(recordId, payload);
|
|
@@ -9328,7 +10303,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9328
10303
|
},
|
|
9329
10304
|
[client, upsertThreadRecord]
|
|
9330
10305
|
);
|
|
9331
|
-
const deleteThread =
|
|
10306
|
+
const deleteThread = React34.useCallback(
|
|
9332
10307
|
async (recordId) => {
|
|
9333
10308
|
setError(null);
|
|
9334
10309
|
await client.conversations.delete(recordId);
|
|
@@ -9336,11 +10311,11 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9336
10311
|
},
|
|
9337
10312
|
[client]
|
|
9338
10313
|
);
|
|
9339
|
-
|
|
10314
|
+
React34.useEffect(() => {
|
|
9340
10315
|
if (!isReady) return;
|
|
9341
10316
|
void refreshThreads();
|
|
9342
10317
|
}, [refreshThreads, isReady]);
|
|
9343
|
-
|
|
10318
|
+
React34.useEffect(() => {
|
|
9344
10319
|
if (!threadId || !isStreamLoading) return;
|
|
9345
10320
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
9346
10321
|
const busyStatus = "busy";
|
|
@@ -9361,7 +10336,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9361
10336
|
return changed ? sortThreadRecords(next) : prev;
|
|
9362
10337
|
});
|
|
9363
10338
|
}, [threadId, isStreamLoading]);
|
|
9364
|
-
|
|
10339
|
+
React34.useEffect(() => {
|
|
9365
10340
|
const message = getErrorMessage(streamError)?.trim();
|
|
9366
10341
|
if (!threadId || !message) return;
|
|
9367
10342
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -9383,7 +10358,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9383
10358
|
return changed ? sortThreadRecords(next) : prev;
|
|
9384
10359
|
});
|
|
9385
10360
|
}, [threadId, streamError]);
|
|
9386
|
-
|
|
10361
|
+
React34.useEffect(() => {
|
|
9387
10362
|
if (!isReady || !threadId || isStreamLoading) return;
|
|
9388
10363
|
let cancelled = false;
|
|
9389
10364
|
void client.conversations.search({ where: { threadId }, limit: 1 }).then((result) => {
|
|
@@ -9397,7 +10372,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9397
10372
|
cancelled = true;
|
|
9398
10373
|
};
|
|
9399
10374
|
}, [client, threadId, upsertThreadRecord, isReady, isStreamLoading]);
|
|
9400
|
-
const threads =
|
|
10375
|
+
const threads = React34.useMemo(
|
|
9401
10376
|
() => threadRecords.map((threadRecord) => toThreadItem(threadRecord)),
|
|
9402
10377
|
[threadRecords]
|
|
9403
10378
|
);
|
|
@@ -9414,10 +10389,10 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9414
10389
|
}
|
|
9415
10390
|
|
|
9416
10391
|
// src/components/thread/context-usage-indicator.tsx
|
|
9417
|
-
var
|
|
10392
|
+
var React35 = __toESM(require("react"), 1);
|
|
9418
10393
|
|
|
9419
10394
|
// src/components/ui/progress-circle.tsx
|
|
9420
|
-
var
|
|
10395
|
+
var import_jsx_runtime39 = (
|
|
9421
10396
|
// biome-ignore lint/a11y/useFocusableInteractive: false positive (progress + progressbar are not focusable interactives)
|
|
9422
10397
|
// biome-ignore lint/nursery/useAriaPropsSupportedByRole: biome rule at odds with mdn docs (presumed nursary bug with rule)
|
|
9423
10398
|
require("react/jsx-runtime")
|
|
@@ -9441,7 +10416,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
9441
10416
|
fill: "none",
|
|
9442
10417
|
strokeWidth
|
|
9443
10418
|
};
|
|
9444
|
-
return /* @__PURE__ */ (0,
|
|
10419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
9445
10420
|
"svg",
|
|
9446
10421
|
{
|
|
9447
10422
|
role: "progressbar",
|
|
@@ -9452,8 +10427,8 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
9452
10427
|
"aria-valuemax": 100,
|
|
9453
10428
|
...restSvgProps,
|
|
9454
10429
|
children: [
|
|
9455
|
-
/* @__PURE__ */ (0,
|
|
9456
|
-
/* @__PURE__ */ (0,
|
|
10430
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("circle", { ...commonParams, className: "stroke-current/25" }),
|
|
10431
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
9457
10432
|
"circle",
|
|
9458
10433
|
{
|
|
9459
10434
|
...commonParams,
|
|
@@ -9471,7 +10446,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
9471
10446
|
};
|
|
9472
10447
|
|
|
9473
10448
|
// src/components/thread/context-usage-indicator.tsx
|
|
9474
|
-
var
|
|
10449
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
9475
10450
|
var kNumberFormatter = new Intl.NumberFormat("en-US", {
|
|
9476
10451
|
minimumFractionDigits: 0,
|
|
9477
10452
|
maximumFractionDigits: 1
|
|
@@ -9504,20 +10479,20 @@ function ContextUsageIndicator({
|
|
|
9504
10479
|
}) {
|
|
9505
10480
|
const { t } = useChatkitTranslation();
|
|
9506
10481
|
const stream = useStreamContext();
|
|
9507
|
-
const [maxContextSize, setMaxContextSize] =
|
|
9508
|
-
const [usedContextSize, setUsedContextSize] =
|
|
9509
|
-
const [assistantAgentKey, setAssistantAgentKey] =
|
|
9510
|
-
const latestRealtimeUsageRef =
|
|
10482
|
+
const [maxContextSize, setMaxContextSize] = React35.useState(null);
|
|
10483
|
+
const [usedContextSize, setUsedContextSize] = React35.useState(null);
|
|
10484
|
+
const [assistantAgentKey, setAssistantAgentKey] = React35.useState(null);
|
|
10485
|
+
const latestRealtimeUsageRef = React35.useRef({
|
|
9511
10486
|
threadId: null,
|
|
9512
10487
|
agentKey: null,
|
|
9513
10488
|
usedTokens: null
|
|
9514
10489
|
});
|
|
9515
|
-
const realtimeUsage =
|
|
10490
|
+
const realtimeUsage = React35.useMemo(
|
|
9516
10491
|
() => getThreadContextUsage(stream.contextUsageByAgentKey, assistantAgentKey),
|
|
9517
10492
|
[assistantAgentKey, stream.contextUsageByAgentKey]
|
|
9518
10493
|
);
|
|
9519
10494
|
const realtimeUsedContextSize = getThreadContextUsageTotalTokens(realtimeUsage);
|
|
9520
|
-
|
|
10495
|
+
React35.useEffect(() => {
|
|
9521
10496
|
if (!stream.client || !stream.assistantId) {
|
|
9522
10497
|
setMaxContextSize(null);
|
|
9523
10498
|
setAssistantAgentKey(null);
|
|
@@ -9537,18 +10512,18 @@ function ContextUsageIndicator({
|
|
|
9537
10512
|
cancelled = true;
|
|
9538
10513
|
};
|
|
9539
10514
|
}, [stream.client, stream.assistantId]);
|
|
9540
|
-
|
|
10515
|
+
React35.useEffect(() => {
|
|
9541
10516
|
latestRealtimeUsageRef.current = {
|
|
9542
10517
|
threadId: stream.threadId ?? null,
|
|
9543
10518
|
agentKey: assistantAgentKey,
|
|
9544
10519
|
usedTokens: realtimeUsedContextSize
|
|
9545
10520
|
};
|
|
9546
10521
|
}, [assistantAgentKey, realtimeUsedContextSize, stream.threadId]);
|
|
9547
|
-
|
|
10522
|
+
React35.useEffect(() => {
|
|
9548
10523
|
if (realtimeUsedContextSize == null) return;
|
|
9549
10524
|
setUsedContextSize(realtimeUsedContextSize);
|
|
9550
10525
|
}, [realtimeUsedContextSize]);
|
|
9551
|
-
|
|
10526
|
+
React35.useEffect(() => {
|
|
9552
10527
|
if (!stream.client) {
|
|
9553
10528
|
setUsedContextSize(null);
|
|
9554
10529
|
return;
|
|
@@ -9613,8 +10588,8 @@ function ContextUsageIndicator({
|
|
|
9613
10588
|
});
|
|
9614
10589
|
const usageLabelWithSuffix = usageLabel.endsWith(":") ? usageLabel : `${usageLabel}:`;
|
|
9615
10590
|
const progressClassName = percent >= 90 ? "text-destructive" : percent >= 75 ? "text-amber-500" : "text-primary dark:text-zinc-300";
|
|
9616
|
-
return /* @__PURE__ */ (0,
|
|
9617
|
-
/* @__PURE__ */ (0,
|
|
10591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Tooltip, { children: [
|
|
10592
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
9618
10593
|
"button",
|
|
9619
10594
|
{
|
|
9620
10595
|
type: "button",
|
|
@@ -9623,31 +10598,31 @@ function ContextUsageIndicator({
|
|
|
9623
10598
|
className
|
|
9624
10599
|
),
|
|
9625
10600
|
"aria-label": `${usageLabelWithSuffix} ${usageFullLabel}. ${usageTokensLabel}`,
|
|
9626
|
-
children: /* @__PURE__ */ (0,
|
|
10601
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ProgressCircle, { value: percent, className: cn("size-3.5", progressClassName) })
|
|
9627
10602
|
}
|
|
9628
10603
|
) }),
|
|
9629
|
-
/* @__PURE__ */ (0,
|
|
9630
|
-
/* @__PURE__ */ (0,
|
|
9631
|
-
/* @__PURE__ */ (0,
|
|
9632
|
-
/* @__PURE__ */ (0,
|
|
10604
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(TooltipContent, { side: "top", sideOffset: 6, className: "space-y-0.5 px-3 py-2 text-center", children: [
|
|
10605
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "text-primary-foreground/70", children: usageLabelWithSuffix }),
|
|
10606
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "font-medium text-primary-foreground/80", children: usageFullLabel }),
|
|
10607
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "text-sm font-semibold", children: usageTokensLabel })
|
|
9633
10608
|
] })
|
|
9634
10609
|
] });
|
|
9635
10610
|
}
|
|
9636
10611
|
|
|
9637
10612
|
// src/components/pet/PetBridge.tsx
|
|
9638
|
-
var
|
|
9639
|
-
var
|
|
10613
|
+
var React36 = __toESM(require("react"), 1);
|
|
10614
|
+
var import_chatkit_types7 = require("@xpert-ai/chatkit-types");
|
|
9640
10615
|
function PetBridge({ pet, state }) {
|
|
9641
10616
|
const parentMessenger = useParentMessenger();
|
|
9642
10617
|
const sendEvent = parentMessenger?.sendEvent;
|
|
9643
|
-
const options =
|
|
9644
|
-
|
|
10618
|
+
const options = React36.useMemo(() => (0, import_chatkit_types7.normalizePetOptions)(pet), [pet]);
|
|
10619
|
+
React36.useEffect(() => {
|
|
9645
10620
|
if (!sendEvent) {
|
|
9646
10621
|
return;
|
|
9647
10622
|
}
|
|
9648
10623
|
sendEvent("pet_options_change", { pet: pet ?? null });
|
|
9649
10624
|
}, [sendEvent, pet]);
|
|
9650
|
-
|
|
10625
|
+
React36.useEffect(() => {
|
|
9651
10626
|
if (!sendEvent || !options) {
|
|
9652
10627
|
return;
|
|
9653
10628
|
}
|
|
@@ -9657,15 +10632,15 @@ function PetBridge({ pet, state }) {
|
|
|
9657
10632
|
}
|
|
9658
10633
|
|
|
9659
10634
|
// src/components/settings/SettingsSheet.tsx
|
|
9660
|
-
var
|
|
9661
|
-
var
|
|
10635
|
+
var React43 = __toESM(require("react"), 1);
|
|
10636
|
+
var import_lucide_react23 = require("lucide-react");
|
|
9662
10637
|
|
|
9663
10638
|
// src/components/ui/input.tsx
|
|
9664
|
-
var
|
|
9665
|
-
var
|
|
9666
|
-
var Input =
|
|
10639
|
+
var React37 = __toESM(require("react"), 1);
|
|
10640
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
10641
|
+
var Input = React37.forwardRef(
|
|
9667
10642
|
({ className, type, ...props }, ref) => {
|
|
9668
|
-
return /* @__PURE__ */ (0,
|
|
10643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
9669
10644
|
"input",
|
|
9670
10645
|
{
|
|
9671
10646
|
ref,
|
|
@@ -9682,20 +10657,20 @@ var Input = React36.forwardRef(
|
|
|
9682
10657
|
Input.displayName = "Input";
|
|
9683
10658
|
|
|
9684
10659
|
// src/components/ui/select.tsx
|
|
9685
|
-
var
|
|
10660
|
+
var React38 = require("react");
|
|
9686
10661
|
var import_radix_ui2 = require("radix-ui");
|
|
9687
|
-
var
|
|
9688
|
-
var
|
|
10662
|
+
var import_lucide_react22 = require("lucide-react");
|
|
10663
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
9689
10664
|
function Select({
|
|
9690
10665
|
...props
|
|
9691
10666
|
}) {
|
|
9692
|
-
return /* @__PURE__ */ (0,
|
|
10667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_radix_ui2.Select.Root, { "data-slot": "select", ...props });
|
|
9693
10668
|
}
|
|
9694
10669
|
function SelectGroup({
|
|
9695
10670
|
className,
|
|
9696
10671
|
...props
|
|
9697
10672
|
}) {
|
|
9698
|
-
return /* @__PURE__ */ (0,
|
|
10673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
9699
10674
|
import_radix_ui2.Select.Group,
|
|
9700
10675
|
{
|
|
9701
10676
|
"data-slot": "select-group",
|
|
@@ -9707,7 +10682,7 @@ function SelectGroup({
|
|
|
9707
10682
|
function SelectValue({
|
|
9708
10683
|
...props
|
|
9709
10684
|
}) {
|
|
9710
|
-
return /* @__PURE__ */ (0,
|
|
10685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_radix_ui2.Select.Value, { "data-slot": "select-value", ...props });
|
|
9711
10686
|
}
|
|
9712
10687
|
function SelectTrigger({
|
|
9713
10688
|
className,
|
|
@@ -9715,7 +10690,7 @@ function SelectTrigger({
|
|
|
9715
10690
|
children,
|
|
9716
10691
|
...props
|
|
9717
10692
|
}) {
|
|
9718
|
-
return /* @__PURE__ */ (0,
|
|
10693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
9719
10694
|
import_radix_ui2.Select.Trigger,
|
|
9720
10695
|
{
|
|
9721
10696
|
"data-slot": "select-trigger",
|
|
@@ -9727,7 +10702,7 @@ function SelectTrigger({
|
|
|
9727
10702
|
...props,
|
|
9728
10703
|
children: [
|
|
9729
10704
|
children,
|
|
9730
|
-
/* @__PURE__ */ (0,
|
|
10705
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_radix_ui2.Select.Icon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_lucide_react22.ChevronDownIcon, { className: "pointer-events-none size-4 text-muted-foreground" }) })
|
|
9731
10706
|
]
|
|
9732
10707
|
}
|
|
9733
10708
|
);
|
|
@@ -9739,7 +10714,7 @@ function SelectContent({
|
|
|
9739
10714
|
align = "center",
|
|
9740
10715
|
...props
|
|
9741
10716
|
}) {
|
|
9742
|
-
return /* @__PURE__ */ (0,
|
|
10717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_radix_ui2.Select.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
9743
10718
|
import_radix_ui2.Select.Content,
|
|
9744
10719
|
{
|
|
9745
10720
|
"data-slot": "select-content",
|
|
@@ -9749,8 +10724,8 @@ function SelectContent({
|
|
|
9749
10724
|
align,
|
|
9750
10725
|
...props,
|
|
9751
10726
|
children: [
|
|
9752
|
-
/* @__PURE__ */ (0,
|
|
9753
|
-
/* @__PURE__ */ (0,
|
|
10727
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SelectScrollUpButton, {}),
|
|
10728
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
9754
10729
|
import_radix_ui2.Select.Viewport,
|
|
9755
10730
|
{
|
|
9756
10731
|
"data-position": position,
|
|
@@ -9761,7 +10736,7 @@ function SelectContent({
|
|
|
9761
10736
|
children
|
|
9762
10737
|
}
|
|
9763
10738
|
),
|
|
9764
|
-
/* @__PURE__ */ (0,
|
|
10739
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SelectScrollDownButton, {})
|
|
9765
10740
|
]
|
|
9766
10741
|
}
|
|
9767
10742
|
) });
|
|
@@ -9771,7 +10746,7 @@ function SelectItem({
|
|
|
9771
10746
|
children,
|
|
9772
10747
|
...props
|
|
9773
10748
|
}) {
|
|
9774
|
-
return /* @__PURE__ */ (0,
|
|
10749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
9775
10750
|
import_radix_ui2.Select.Item,
|
|
9776
10751
|
{
|
|
9777
10752
|
"data-slot": "select-item",
|
|
@@ -9781,8 +10756,8 @@ function SelectItem({
|
|
|
9781
10756
|
),
|
|
9782
10757
|
...props,
|
|
9783
10758
|
children: [
|
|
9784
|
-
/* @__PURE__ */ (0,
|
|
9785
|
-
/* @__PURE__ */ (0,
|
|
10759
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_radix_ui2.Select.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_lucide_react22.CheckIcon, { className: "pointer-events-none" }) }) }),
|
|
10760
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_radix_ui2.Select.ItemText, { children })
|
|
9786
10761
|
]
|
|
9787
10762
|
}
|
|
9788
10763
|
);
|
|
@@ -9791,7 +10766,7 @@ function SelectScrollUpButton({
|
|
|
9791
10766
|
className,
|
|
9792
10767
|
...props
|
|
9793
10768
|
}) {
|
|
9794
|
-
return /* @__PURE__ */ (0,
|
|
10769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
9795
10770
|
import_radix_ui2.Select.ScrollUpButton,
|
|
9796
10771
|
{
|
|
9797
10772
|
"data-slot": "select-scroll-up-button",
|
|
@@ -9800,8 +10775,8 @@ function SelectScrollUpButton({
|
|
|
9800
10775
|
className
|
|
9801
10776
|
),
|
|
9802
10777
|
...props,
|
|
9803
|
-
children: /* @__PURE__ */ (0,
|
|
9804
|
-
|
|
10778
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10779
|
+
import_lucide_react22.ChevronUpIcon,
|
|
9805
10780
|
{}
|
|
9806
10781
|
)
|
|
9807
10782
|
}
|
|
@@ -9811,7 +10786,7 @@ function SelectScrollDownButton({
|
|
|
9811
10786
|
className,
|
|
9812
10787
|
...props
|
|
9813
10788
|
}) {
|
|
9814
|
-
return /* @__PURE__ */ (0,
|
|
10789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
9815
10790
|
import_radix_ui2.Select.ScrollDownButton,
|
|
9816
10791
|
{
|
|
9817
10792
|
"data-slot": "select-scroll-down-button",
|
|
@@ -9820,8 +10795,8 @@ function SelectScrollDownButton({
|
|
|
9820
10795
|
className
|
|
9821
10796
|
),
|
|
9822
10797
|
...props,
|
|
9823
|
-
children: /* @__PURE__ */ (0,
|
|
9824
|
-
|
|
10798
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10799
|
+
import_lucide_react22.ChevronDownIcon,
|
|
9825
10800
|
{}
|
|
9826
10801
|
)
|
|
9827
10802
|
}
|
|
@@ -9829,9 +10804,9 @@ function SelectScrollDownButton({
|
|
|
9829
10804
|
}
|
|
9830
10805
|
|
|
9831
10806
|
// src/components/ui/slider.tsx
|
|
9832
|
-
var
|
|
10807
|
+
var React39 = __toESM(require("react"), 1);
|
|
9833
10808
|
var import_radix_ui3 = require("radix-ui");
|
|
9834
|
-
var
|
|
10809
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
9835
10810
|
function Slider({
|
|
9836
10811
|
className,
|
|
9837
10812
|
defaultValue,
|
|
@@ -9840,11 +10815,11 @@ function Slider({
|
|
|
9840
10815
|
max = 100,
|
|
9841
10816
|
...props
|
|
9842
10817
|
}) {
|
|
9843
|
-
const _values =
|
|
10818
|
+
const _values = React39.useMemo(
|
|
9844
10819
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
9845
10820
|
[value, defaultValue, min, max]
|
|
9846
10821
|
);
|
|
9847
|
-
return /* @__PURE__ */ (0,
|
|
10822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
9848
10823
|
import_radix_ui3.Slider.Root,
|
|
9849
10824
|
{
|
|
9850
10825
|
"data-slot": "slider",
|
|
@@ -9858,12 +10833,12 @@ function Slider({
|
|
|
9858
10833
|
),
|
|
9859
10834
|
...props,
|
|
9860
10835
|
children: [
|
|
9861
|
-
/* @__PURE__ */ (0,
|
|
10836
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9862
10837
|
import_radix_ui3.Slider.Track,
|
|
9863
10838
|
{
|
|
9864
10839
|
"data-slot": "slider-track",
|
|
9865
10840
|
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",
|
|
9866
|
-
children: /* @__PURE__ */ (0,
|
|
10841
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9867
10842
|
import_radix_ui3.Slider.Range,
|
|
9868
10843
|
{
|
|
9869
10844
|
"data-slot": "slider-range",
|
|
@@ -9872,7 +10847,7 @@ function Slider({
|
|
|
9872
10847
|
)
|
|
9873
10848
|
}
|
|
9874
10849
|
),
|
|
9875
|
-
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ (0,
|
|
10850
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9876
10851
|
import_radix_ui3.Slider.Thumb,
|
|
9877
10852
|
{
|
|
9878
10853
|
"data-slot": "slider-thumb",
|
|
@@ -9886,15 +10861,15 @@ function Slider({
|
|
|
9886
10861
|
}
|
|
9887
10862
|
|
|
9888
10863
|
// src/components/ui/toggle-group.tsx
|
|
9889
|
-
var
|
|
10864
|
+
var React41 = __toESM(require("react"), 1);
|
|
9890
10865
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
9891
10866
|
var import_radix_ui5 = require("radix-ui");
|
|
9892
10867
|
|
|
9893
10868
|
// src/components/ui/toggle.tsx
|
|
9894
|
-
var
|
|
10869
|
+
var React40 = require("react");
|
|
9895
10870
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
9896
10871
|
var import_radix_ui4 = require("radix-ui");
|
|
9897
|
-
var
|
|
10872
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
9898
10873
|
var toggleVariants = (0, import_class_variance_authority2.cva)(
|
|
9899
10874
|
"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",
|
|
9900
10875
|
{
|
|
@@ -9917,8 +10892,8 @@ var toggleVariants = (0, import_class_variance_authority2.cva)(
|
|
|
9917
10892
|
);
|
|
9918
10893
|
|
|
9919
10894
|
// src/components/ui/toggle-group.tsx
|
|
9920
|
-
var
|
|
9921
|
-
var ToggleGroupContext =
|
|
10895
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
10896
|
+
var ToggleGroupContext = React41.createContext({
|
|
9922
10897
|
size: "default",
|
|
9923
10898
|
variant: "default",
|
|
9924
10899
|
spacing: 0,
|
|
@@ -9933,7 +10908,7 @@ function ToggleGroup({
|
|
|
9933
10908
|
children,
|
|
9934
10909
|
...props
|
|
9935
10910
|
}) {
|
|
9936
|
-
return /* @__PURE__ */ (0,
|
|
10911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
9937
10912
|
import_radix_ui5.ToggleGroup.Root,
|
|
9938
10913
|
{
|
|
9939
10914
|
"data-slot": "toggle-group",
|
|
@@ -9947,7 +10922,7 @@ function ToggleGroup({
|
|
|
9947
10922
|
className
|
|
9948
10923
|
),
|
|
9949
10924
|
...props,
|
|
9950
|
-
children: /* @__PURE__ */ (0,
|
|
10925
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
9951
10926
|
ToggleGroupContext.Provider,
|
|
9952
10927
|
{
|
|
9953
10928
|
value: { variant, size: size2, spacing, orientation },
|
|
@@ -9964,8 +10939,8 @@ function ToggleGroupItem({
|
|
|
9964
10939
|
size: size2 = "default",
|
|
9965
10940
|
...props
|
|
9966
10941
|
}) {
|
|
9967
|
-
const context =
|
|
9968
|
-
return /* @__PURE__ */ (0,
|
|
10942
|
+
const context = React41.useContext(ToggleGroupContext);
|
|
10943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
9969
10944
|
import_radix_ui5.ToggleGroup.Item,
|
|
9970
10945
|
{
|
|
9971
10946
|
"data-slot": "toggle-group-item",
|
|
@@ -9987,7 +10962,7 @@ function ToggleGroupItem({
|
|
|
9987
10962
|
}
|
|
9988
10963
|
|
|
9989
10964
|
// src/components/pet/pet-local-settings.ts
|
|
9990
|
-
var
|
|
10965
|
+
var import_chatkit_types8 = require("@xpert-ai/chatkit-types");
|
|
9991
10966
|
|
|
9992
10967
|
// src/components/pet/builtinPets.ts
|
|
9993
10968
|
var PUBLIC_PETS = [
|
|
@@ -10161,7 +11136,7 @@ function derivePetLocalSettings(pet) {
|
|
|
10161
11136
|
if (!pet) {
|
|
10162
11137
|
return { ...DEFAULT_PET_LOCAL_SETTINGS };
|
|
10163
11138
|
}
|
|
10164
|
-
const normalized = (0,
|
|
11139
|
+
const normalized = (0, import_chatkit_types8.normalizePetOptions)(pet ?? null);
|
|
10165
11140
|
if (!normalized) {
|
|
10166
11141
|
return { ...DEFAULT_PET_LOCAL_SETTINGS };
|
|
10167
11142
|
}
|
|
@@ -10191,25 +11166,25 @@ function derivePetLocalSettings(pet) {
|
|
|
10191
11166
|
return base2;
|
|
10192
11167
|
}
|
|
10193
11168
|
function isPetEnabled(pet) {
|
|
10194
|
-
return Boolean((0,
|
|
11169
|
+
return Boolean((0, import_chatkit_types8.normalizePetOptions)(pet ?? null));
|
|
10195
11170
|
}
|
|
10196
11171
|
|
|
10197
11172
|
// src/components/pet/PetPreview.tsx
|
|
10198
|
-
var
|
|
11173
|
+
var React42 = require("react");
|
|
10199
11174
|
|
|
10200
11175
|
// src/components/pet/petSpriteAtlas.ts
|
|
10201
|
-
var
|
|
11176
|
+
var import_chatkit_types9 = require("@xpert-ai/chatkit-types");
|
|
10202
11177
|
|
|
10203
11178
|
// src/components/pet/PetPreview.tsx
|
|
10204
|
-
var
|
|
11179
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
10205
11180
|
function escapeCssUrl(value) {
|
|
10206
11181
|
return value.replace(/["\\]/g, "\\$&");
|
|
10207
11182
|
}
|
|
10208
11183
|
function PetPreview({ src, label, className }) {
|
|
10209
11184
|
const scale = 0.13;
|
|
10210
|
-
const width =
|
|
10211
|
-
const height =
|
|
10212
|
-
return /* @__PURE__ */ (0,
|
|
11185
|
+
const width = import_chatkit_types9.petSpriteAtlas.cellWidth;
|
|
11186
|
+
const height = import_chatkit_types9.petSpriteAtlas.cellHeight;
|
|
11187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
10213
11188
|
"span",
|
|
10214
11189
|
{
|
|
10215
11190
|
className: cn(
|
|
@@ -10218,7 +11193,7 @@ function PetPreview({ src, label, className }) {
|
|
|
10218
11193
|
),
|
|
10219
11194
|
"aria-hidden": "true",
|
|
10220
11195
|
title: label,
|
|
10221
|
-
children: /* @__PURE__ */ (0,
|
|
11196
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
10222
11197
|
"span",
|
|
10223
11198
|
{
|
|
10224
11199
|
className: "absolute left-1/2 top-1/2 block",
|
|
@@ -10229,7 +11204,7 @@ function PetPreview({ src, label, className }) {
|
|
|
10229
11204
|
transformOrigin: "center",
|
|
10230
11205
|
backgroundImage: `url("${escapeCssUrl(src)}")`,
|
|
10231
11206
|
backgroundRepeat: "no-repeat",
|
|
10232
|
-
backgroundSize: `${
|
|
11207
|
+
backgroundSize: `${import_chatkit_types9.petSpriteAtlas.columns * width}px ${import_chatkit_types9.petSpriteAtlas.rows * height}px`,
|
|
10233
11208
|
backgroundPosition: "0px 0px",
|
|
10234
11209
|
imageRendering: "auto"
|
|
10235
11210
|
}
|
|
@@ -10240,7 +11215,7 @@ function PetPreview({ src, label, className }) {
|
|
|
10240
11215
|
}
|
|
10241
11216
|
|
|
10242
11217
|
// src/components/settings/SettingsSheet.tsx
|
|
10243
|
-
var
|
|
11218
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
10244
11219
|
var CHARACTER_TYPES2 = [
|
|
10245
11220
|
"builtin",
|
|
10246
11221
|
"atlas"
|
|
@@ -10256,13 +11231,13 @@ function SettingsSheet({
|
|
|
10256
11231
|
onSave
|
|
10257
11232
|
}) {
|
|
10258
11233
|
const { t } = useChatkitTranslation();
|
|
10259
|
-
const [draft, setDraft] =
|
|
10260
|
-
|
|
11234
|
+
const [draft, setDraft] = React43.useState(settings);
|
|
11235
|
+
React43.useEffect(() => {
|
|
10261
11236
|
if (open) {
|
|
10262
11237
|
setDraft(petRequired ? { ...settings, enabled: true } : settings);
|
|
10263
11238
|
}
|
|
10264
11239
|
}, [open, petRequired, settings]);
|
|
10265
|
-
const updateDraft =
|
|
11240
|
+
const updateDraft = React43.useCallback(
|
|
10266
11241
|
(patch) => {
|
|
10267
11242
|
setDraft((previous) => ({ ...previous, ...patch }));
|
|
10268
11243
|
},
|
|
@@ -10280,23 +11255,23 @@ function SettingsSheet({
|
|
|
10280
11255
|
defaultValue: selectedBuiltinPet.label
|
|
10281
11256
|
}
|
|
10282
11257
|
);
|
|
10283
|
-
return /* @__PURE__ */ (0,
|
|
10284
|
-
/* @__PURE__ */ (0,
|
|
10285
|
-
/* @__PURE__ */ (0,
|
|
10286
|
-
/* @__PURE__ */ (0,
|
|
11258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Sheet, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(SheetContent, { side: "right", className: "w-[min(92vw,26rem)] overflow-y-auto", children: [
|
|
11259
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SheetHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
11260
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "flex h-8 w-8 items-center justify-center rounded-md bg-primary/10 text-primary", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react23.Settings, { size: 16 }) }),
|
|
11261
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SheetTitle, { children: t("settings.title") })
|
|
10287
11262
|
] }) }),
|
|
10288
|
-
/* @__PURE__ */ (0,
|
|
10289
|
-
/* @__PURE__ */ (0,
|
|
10290
|
-
/* @__PURE__ */ (0,
|
|
10291
|
-
/* @__PURE__ */ (0,
|
|
10292
|
-
/* @__PURE__ */ (0,
|
|
11263
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("form", { className: "mt-6 space-y-5", onSubmit: handleSubmit, children: [
|
|
11264
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("section", { className: "space-y-5", children: [
|
|
11265
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
11266
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "flex h-7 w-7 items-center justify-center rounded-md bg-muted text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react23.PawPrint, { size: 15 }) }),
|
|
11267
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("h3", { className: "text-sm font-semibold", children: t("pet.settings.title") })
|
|
10293
11268
|
] }),
|
|
10294
|
-
/* @__PURE__ */ (0,
|
|
10295
|
-
/* @__PURE__ */ (0,
|
|
10296
|
-
/* @__PURE__ */ (0,
|
|
10297
|
-
petRequired && /* @__PURE__ */ (0,
|
|
11269
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2", children: [
|
|
11270
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "min-w-0", children: [
|
|
11271
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "block text-sm font-medium", children: t("pet.settings.enabled") }),
|
|
11272
|
+
petRequired && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: t("pet.settings.requiredHint") })
|
|
10298
11273
|
] }),
|
|
10299
|
-
/* @__PURE__ */ (0,
|
|
11274
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10300
11275
|
"button",
|
|
10301
11276
|
{
|
|
10302
11277
|
type: "button",
|
|
@@ -10309,7 +11284,7 @@ function SettingsSheet({
|
|
|
10309
11284
|
draft.enabled ? "bg-primary" : "bg-muted-foreground/20",
|
|
10310
11285
|
petRequired ? "cursor-not-allowed opacity-70" : ""
|
|
10311
11286
|
].join(" "),
|
|
10312
|
-
children: /* @__PURE__ */ (0,
|
|
11287
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10313
11288
|
"span",
|
|
10314
11289
|
{
|
|
10315
11290
|
className: [
|
|
@@ -10322,9 +11297,9 @@ function SettingsSheet({
|
|
|
10322
11297
|
)
|
|
10323
11298
|
] })
|
|
10324
11299
|
] }),
|
|
10325
|
-
/* @__PURE__ */ (0,
|
|
10326
|
-
/* @__PURE__ */ (0,
|
|
10327
|
-
/* @__PURE__ */ (0,
|
|
11300
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "space-y-2", children: [
|
|
11301
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { id: "chatkit-pet-type-label", className: "text-sm font-medium", children: t("pet.settings.characterType") }),
|
|
11302
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10328
11303
|
ToggleGroup,
|
|
10329
11304
|
{
|
|
10330
11305
|
id: "chatkit-pet-type",
|
|
@@ -10339,7 +11314,7 @@ function SettingsSheet({
|
|
|
10339
11314
|
variant: "outline",
|
|
10340
11315
|
spacing: 2,
|
|
10341
11316
|
className: "!w-full",
|
|
10342
|
-
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ (0,
|
|
11317
|
+
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10343
11318
|
ToggleGroupItem,
|
|
10344
11319
|
{
|
|
10345
11320
|
value: type,
|
|
@@ -10351,8 +11326,8 @@ function SettingsSheet({
|
|
|
10351
11326
|
}
|
|
10352
11327
|
)
|
|
10353
11328
|
] }),
|
|
10354
|
-
draft.characterType === "builtin" && /* @__PURE__ */ (0,
|
|
10355
|
-
/* @__PURE__ */ (0,
|
|
11329
|
+
draft.characterType === "builtin" && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "space-y-2", children: [
|
|
11330
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10356
11331
|
"label",
|
|
10357
11332
|
{
|
|
10358
11333
|
htmlFor: "chatkit-pet-builtin",
|
|
@@ -10360,7 +11335,7 @@ function SettingsSheet({
|
|
|
10360
11335
|
children: t("pet.settings.builtin")
|
|
10361
11336
|
}
|
|
10362
11337
|
),
|
|
10363
|
-
/* @__PURE__ */ (0,
|
|
11338
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
10364
11339
|
Select,
|
|
10365
11340
|
{
|
|
10366
11341
|
value: selectedBuiltinPet.id,
|
|
@@ -10371,26 +11346,26 @@ function SettingsSheet({
|
|
|
10371
11346
|
}
|
|
10372
11347
|
},
|
|
10373
11348
|
children: [
|
|
10374
|
-
/* @__PURE__ */ (0,
|
|
11349
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10375
11350
|
SelectTrigger,
|
|
10376
11351
|
{
|
|
10377
11352
|
id: "chatkit-pet-builtin",
|
|
10378
11353
|
className: "min-h-12 w-full px-3 py-2",
|
|
10379
|
-
children: /* @__PURE__ */ (0,
|
|
11354
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SelectValue, { placeholder: selectedBuiltinPetLabel })
|
|
10380
11355
|
}
|
|
10381
11356
|
),
|
|
10382
|
-
/* @__PURE__ */ (0,
|
|
11357
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SelectContent, { className: "w-[var(--radix-select-trigger-width)]", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SelectGroup, { children: INCLUDED_PET_OPTIONS.map((pet) => {
|
|
10383
11358
|
const label = t(`pet.settings.builtins.${pet.id}`, {
|
|
10384
11359
|
defaultValue: pet.label
|
|
10385
11360
|
});
|
|
10386
|
-
return /* @__PURE__ */ (0,
|
|
11361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10387
11362
|
SelectItem,
|
|
10388
11363
|
{
|
|
10389
11364
|
value: pet.id,
|
|
10390
11365
|
className: "min-h-10 py-1.5 pl-2 pr-8",
|
|
10391
|
-
children: /* @__PURE__ */ (0,
|
|
10392
|
-
/* @__PURE__ */ (0,
|
|
10393
|
-
/* @__PURE__ */ (0,
|
|
11366
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
11367
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PetPreview, { src: pet.previewSrc, label }),
|
|
11368
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "min-w-0 truncate", children: label })
|
|
10394
11369
|
] })
|
|
10395
11370
|
},
|
|
10396
11371
|
pet.id
|
|
@@ -10400,8 +11375,8 @@ function SettingsSheet({
|
|
|
10400
11375
|
}
|
|
10401
11376
|
)
|
|
10402
11377
|
] }),
|
|
10403
|
-
draft.characterType === "atlas" && /* @__PURE__ */ (0,
|
|
10404
|
-
/* @__PURE__ */ (0,
|
|
11378
|
+
draft.characterType === "atlas" && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "space-y-2", children: [
|
|
11379
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10405
11380
|
"label",
|
|
10406
11381
|
{
|
|
10407
11382
|
className: "text-sm font-medium",
|
|
@@ -10409,7 +11384,7 @@ function SettingsSheet({
|
|
|
10409
11384
|
children: t("pet.settings.atlasUrl")
|
|
10410
11385
|
}
|
|
10411
11386
|
),
|
|
10412
|
-
/* @__PURE__ */ (0,
|
|
11387
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10413
11388
|
Input,
|
|
10414
11389
|
{
|
|
10415
11390
|
id: "chatkit-pet-atlas",
|
|
@@ -10419,15 +11394,15 @@ function SettingsSheet({
|
|
|
10419
11394
|
}
|
|
10420
11395
|
)
|
|
10421
11396
|
] }),
|
|
10422
|
-
/* @__PURE__ */ (0,
|
|
10423
|
-
/* @__PURE__ */ (0,
|
|
10424
|
-
/* @__PURE__ */ (0,
|
|
10425
|
-
/* @__PURE__ */ (0,
|
|
11397
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "space-y-2", children: [
|
|
11398
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
11399
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("label", { className: "text-sm font-medium", htmlFor: "chatkit-pet-scale", children: t("pet.settings.scale") }),
|
|
11400
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "text-xs tabular-nums text-muted-foreground", children: [
|
|
10426
11401
|
draft.scale.toFixed(2),
|
|
10427
11402
|
"x"
|
|
10428
11403
|
] })
|
|
10429
11404
|
] }),
|
|
10430
|
-
/* @__PURE__ */ (0,
|
|
11405
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10431
11406
|
Slider,
|
|
10432
11407
|
{
|
|
10433
11408
|
id: "chatkit-pet-scale",
|
|
@@ -10441,8 +11416,8 @@ function SettingsSheet({
|
|
|
10441
11416
|
}
|
|
10442
11417
|
)
|
|
10443
11418
|
] }),
|
|
10444
|
-
/* @__PURE__ */ (0,
|
|
10445
|
-
/* @__PURE__ */ (0,
|
|
11419
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
11420
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10446
11421
|
"input",
|
|
10447
11422
|
{
|
|
10448
11423
|
type: "checkbox",
|
|
@@ -10453,8 +11428,8 @@ function SettingsSheet({
|
|
|
10453
11428
|
),
|
|
10454
11429
|
t("pet.settings.draggable")
|
|
10455
11430
|
] }),
|
|
10456
|
-
/* @__PURE__ */ (0,
|
|
10457
|
-
/* @__PURE__ */ (0,
|
|
11431
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
11432
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10458
11433
|
"input",
|
|
10459
11434
|
{
|
|
10460
11435
|
type: "checkbox",
|
|
@@ -10465,8 +11440,8 @@ function SettingsSheet({
|
|
|
10465
11440
|
),
|
|
10466
11441
|
t("pet.settings.persistPosition")
|
|
10467
11442
|
] }),
|
|
10468
|
-
/* @__PURE__ */ (0,
|
|
10469
|
-
/* @__PURE__ */ (0,
|
|
11443
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex justify-end gap-2 pt-2", children: [
|
|
11444
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10470
11445
|
Button,
|
|
10471
11446
|
{
|
|
10472
11447
|
type: "button",
|
|
@@ -10475,7 +11450,7 @@ function SettingsSheet({
|
|
|
10475
11450
|
children: t("pet.settings.cancel")
|
|
10476
11451
|
}
|
|
10477
11452
|
),
|
|
10478
|
-
/* @__PURE__ */ (0,
|
|
11453
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Button, { type: "submit", children: t("pet.settings.save") })
|
|
10479
11454
|
] })
|
|
10480
11455
|
] })
|
|
10481
11456
|
] }) });
|
|
@@ -10506,10 +11481,12 @@ function splitByAvailability(values, availableValues) {
|
|
|
10506
11481
|
}
|
|
10507
11482
|
return { found, missing };
|
|
10508
11483
|
}
|
|
10509
|
-
function
|
|
10510
|
-
return
|
|
11484
|
+
function uniqueStrings2(values) {
|
|
11485
|
+
return Array.from(
|
|
11486
|
+
new Set(values.map((value) => value.trim()).filter(Boolean))
|
|
11487
|
+
);
|
|
10511
11488
|
}
|
|
10512
|
-
function
|
|
11489
|
+
function getAvailableSelectionSet(selection, capabilities) {
|
|
10513
11490
|
const skillIds = splitByAvailability(
|
|
10514
11491
|
selection.skills.ids,
|
|
10515
11492
|
capabilities.skills.map((skill) => skill.id)
|
|
@@ -10543,6 +11520,42 @@ function getRuntimeCapabilitiesSelectionAvailability(selection, capabilities) {
|
|
|
10543
11520
|
}
|
|
10544
11521
|
};
|
|
10545
11522
|
}
|
|
11523
|
+
function hasMissingRuntimeCapabilityReferences(missing) {
|
|
11524
|
+
return missing.skillIds.length > 0 || missing.pluginNodeKeys.length > 0 || missing.subAgentNodeKeys.length > 0;
|
|
11525
|
+
}
|
|
11526
|
+
function getRuntimeCapabilitiesSelectionAvailability(selection, capabilities) {
|
|
11527
|
+
const available = getAvailableSelectionSet(selection, capabilities);
|
|
11528
|
+
const recommended = selection.recommended ? getAvailableSelectionSet(selection.recommended, capabilities) : null;
|
|
11529
|
+
return {
|
|
11530
|
+
selection: {
|
|
11531
|
+
mode: "allowlist",
|
|
11532
|
+
skills: available.selection.skills,
|
|
11533
|
+
plugins: available.selection.plugins,
|
|
11534
|
+
subAgents: available.selection.subAgents,
|
|
11535
|
+
...recommended && hasRuntimeCapabilitySelectionSet(recommended.selection) ? {
|
|
11536
|
+
recommended: {
|
|
11537
|
+
skills: recommended.selection.skills,
|
|
11538
|
+
plugins: recommended.selection.plugins,
|
|
11539
|
+
subAgents: recommended.selection.subAgents
|
|
11540
|
+
}
|
|
11541
|
+
} : {}
|
|
11542
|
+
},
|
|
11543
|
+
missing: {
|
|
11544
|
+
skillIds: uniqueStrings2([
|
|
11545
|
+
...available.missing.skillIds,
|
|
11546
|
+
...recommended?.missing.skillIds ?? []
|
|
11547
|
+
]),
|
|
11548
|
+
pluginNodeKeys: uniqueStrings2([
|
|
11549
|
+
...available.missing.pluginNodeKeys,
|
|
11550
|
+
...recommended?.missing.pluginNodeKeys ?? []
|
|
11551
|
+
]),
|
|
11552
|
+
subAgentNodeKeys: uniqueStrings2([
|
|
11553
|
+
...available.missing.subAgentNodeKeys,
|
|
11554
|
+
...recommended?.missing.subAgentNodeKeys ?? []
|
|
11555
|
+
])
|
|
11556
|
+
}
|
|
11557
|
+
};
|
|
11558
|
+
}
|
|
10546
11559
|
async function findConversationByThreadId(client, threadId) {
|
|
10547
11560
|
const normalizedThreadId = threadId.trim();
|
|
10548
11561
|
if (!normalizedThreadId) {
|
|
@@ -10613,7 +11626,9 @@ async function persistConversationRuntimeCapabilities({
|
|
|
10613
11626
|
await client.conversations.update(conversation.id, {
|
|
10614
11627
|
options: {
|
|
10615
11628
|
...conversation.options ?? {},
|
|
10616
|
-
runtimeCapabilities:
|
|
11629
|
+
runtimeCapabilities: getAvailableRuntimeCapabilitiesSelection(
|
|
11630
|
+
availability.selection
|
|
11631
|
+
)
|
|
10617
11632
|
}
|
|
10618
11633
|
});
|
|
10619
11634
|
return {
|
|
@@ -10941,7 +11956,7 @@ function findDomPointForComposerOffset(root, offset) {
|
|
|
10941
11956
|
}
|
|
10942
11957
|
|
|
10943
11958
|
// src/components/chat.tsx
|
|
10944
|
-
var
|
|
11959
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
10945
11960
|
var import_meta2 = {};
|
|
10946
11961
|
var defaultApiUrl2 = import_meta2.env.VITE_XPERTAI_API_URL;
|
|
10947
11962
|
var COMPOSER_INPUT_MAX_HEIGHT = 128;
|
|
@@ -11074,8 +12089,8 @@ function ReferenceChip({
|
|
|
11074
12089
|
}) {
|
|
11075
12090
|
const metaLine = getReferenceMetaLine(reference);
|
|
11076
12091
|
const isComposer = variant === "composer";
|
|
11077
|
-
const Icon = reference.type === "quote" ?
|
|
11078
|
-
return /* @__PURE__ */ (0,
|
|
12092
|
+
const Icon = reference.type === "quote" ? import_lucide_react24.Quote : reference.type === "image" ? import_lucide_react24.ImageIcon : import_lucide_react24.FileText;
|
|
12093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
11079
12094
|
"div",
|
|
11080
12095
|
{
|
|
11081
12096
|
className: cn(
|
|
@@ -11084,7 +12099,7 @@ function ReferenceChip({
|
|
|
11084
12099
|
),
|
|
11085
12100
|
title: getReferenceTitle(reference),
|
|
11086
12101
|
children: [
|
|
11087
|
-
/* @__PURE__ */ (0,
|
|
12102
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
11088
12103
|
Icon,
|
|
11089
12104
|
{
|
|
11090
12105
|
size: isComposer ? 14 : 12,
|
|
@@ -11094,8 +12109,8 @@ function ReferenceChip({
|
|
|
11094
12109
|
)
|
|
11095
12110
|
}
|
|
11096
12111
|
),
|
|
11097
|
-
/* @__PURE__ */ (0,
|
|
11098
|
-
/* @__PURE__ */ (0,
|
|
12112
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
12113
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
11099
12114
|
"div",
|
|
11100
12115
|
{
|
|
11101
12116
|
className: cn(
|
|
@@ -11105,7 +12120,7 @@ function ReferenceChip({
|
|
|
11105
12120
|
children: getReferenceLabel(reference)
|
|
11106
12121
|
}
|
|
11107
12122
|
),
|
|
11108
|
-
metaLine && /* @__PURE__ */ (0,
|
|
12123
|
+
metaLine && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
11109
12124
|
"div",
|
|
11110
12125
|
{
|
|
11111
12126
|
className: cn(
|
|
@@ -11116,7 +12131,7 @@ function ReferenceChip({
|
|
|
11116
12131
|
}
|
|
11117
12132
|
)
|
|
11118
12133
|
] }),
|
|
11119
|
-
onRemove && removeLabel && /* @__PURE__ */ (0,
|
|
12134
|
+
onRemove && removeLabel && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
11120
12135
|
"button",
|
|
11121
12136
|
{
|
|
11122
12137
|
type: "button",
|
|
@@ -11127,7 +12142,7 @@ function ReferenceChip({
|
|
|
11127
12142
|
),
|
|
11128
12143
|
title: removeLabel,
|
|
11129
12144
|
"aria-label": removeLabel,
|
|
11130
|
-
children: /* @__PURE__ */ (0,
|
|
12145
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.X, { size: 12 })
|
|
11131
12146
|
}
|
|
11132
12147
|
)
|
|
11133
12148
|
]
|
|
@@ -11151,20 +12166,20 @@ function Chat({
|
|
|
11151
12166
|
const { setStream } = useStreamManager();
|
|
11152
12167
|
const stream = useStreamContext();
|
|
11153
12168
|
const { theme } = useTheme();
|
|
11154
|
-
const [isHistoryLoading, setIsHistoryLoading] =
|
|
11155
|
-
const [historyError, setHistoryError] =
|
|
11156
|
-
const [assistantName, setAssistantName] =
|
|
11157
|
-
const [assistantAvatar, setAssistantAvatar] =
|
|
12169
|
+
const [isHistoryLoading, setIsHistoryLoading] = React44.useState(false);
|
|
12170
|
+
const [historyError, setHistoryError] = React44.useState(null);
|
|
12171
|
+
const [assistantName, setAssistantName] = React44.useState(null);
|
|
12172
|
+
const [assistantAvatar, setAssistantAvatar] = React44.useState(null);
|
|
11158
12173
|
const LOADING_DOTS_MIN_DURATION = 800;
|
|
11159
12174
|
const STREAMING_STATUS_REFRESH_MS = 250;
|
|
11160
|
-
const [showLoadingDots, setShowLoadingDots] =
|
|
11161
|
-
const [streamingNow, setStreamingNow] =
|
|
11162
|
-
const loadingStartTimeRef =
|
|
11163
|
-
const lastStreamOutputAtRef =
|
|
11164
|
-
|
|
12175
|
+
const [showLoadingDots, setShowLoadingDots] = React44.useState(false);
|
|
12176
|
+
const [streamingNow, setStreamingNow] = React44.useState(() => Date.now());
|
|
12177
|
+
const loadingStartTimeRef = React44.useRef(null);
|
|
12178
|
+
const lastStreamOutputAtRef = React44.useRef(null);
|
|
12179
|
+
React44.useEffect(() => {
|
|
11165
12180
|
setStream(stream);
|
|
11166
12181
|
}, [setStream, stream]);
|
|
11167
|
-
|
|
12182
|
+
React44.useEffect(() => {
|
|
11168
12183
|
if (stream.isLoading) {
|
|
11169
12184
|
if (!loadingStartTimeRef.current) {
|
|
11170
12185
|
loadingStartTimeRef.current = Date.now();
|
|
@@ -11187,7 +12202,7 @@ function Chat({
|
|
|
11187
12202
|
}
|
|
11188
12203
|
}
|
|
11189
12204
|
}, [stream.isLoading]);
|
|
11190
|
-
|
|
12205
|
+
React44.useEffect(() => {
|
|
11191
12206
|
if (!stream.isLoading) {
|
|
11192
12207
|
lastStreamOutputAtRef.current = null;
|
|
11193
12208
|
setStreamingNow(Date.now());
|
|
@@ -11197,7 +12212,7 @@ function Chat({
|
|
|
11197
12212
|
lastStreamOutputAtRef.current = now;
|
|
11198
12213
|
setStreamingNow(now);
|
|
11199
12214
|
}, [stream.messages, stream.isLoading]);
|
|
11200
|
-
|
|
12215
|
+
React44.useEffect(() => {
|
|
11201
12216
|
if (!stream.isLoading) {
|
|
11202
12217
|
return;
|
|
11203
12218
|
}
|
|
@@ -11206,74 +12221,74 @@ function Chat({
|
|
|
11206
12221
|
}, STREAMING_STATUS_REFRESH_MS);
|
|
11207
12222
|
return () => window.clearInterval(timer);
|
|
11208
12223
|
}, [stream.isLoading]);
|
|
11209
|
-
const [composerParts, setComposerParts] =
|
|
11210
|
-
const [renderedComposerParts, setRenderedComposerParts] =
|
|
11211
|
-
const [composerDomVersion, setComposerDomVersion] =
|
|
11212
|
-
const [selectedTool, setSelectedTool] =
|
|
12224
|
+
const [composerParts, setComposerParts] = React44.useState([]);
|
|
12225
|
+
const [renderedComposerParts, setRenderedComposerParts] = React44.useState([]);
|
|
12226
|
+
const [composerDomVersion, setComposerDomVersion] = React44.useState(0);
|
|
12227
|
+
const [selectedTool, setSelectedTool] = React44.useState(
|
|
11213
12228
|
null
|
|
11214
12229
|
);
|
|
11215
|
-
const [planModeEnabled, setPlanModeEnabled] =
|
|
11216
|
-
const [petSettingsOpen, setPetSettingsOpen] =
|
|
11217
|
-
const [petLocalSettings, setPetLocalSettings] =
|
|
11218
|
-
const [runtimeCapabilities, setRuntimeCapabilities] =
|
|
11219
|
-
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] =
|
|
11220
|
-
const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] =
|
|
12230
|
+
const [planModeEnabled, setPlanModeEnabled] = React44.useState(false);
|
|
12231
|
+
const [petSettingsOpen, setPetSettingsOpen] = React44.useState(false);
|
|
12232
|
+
const [petLocalSettings, setPetLocalSettings] = React44.useState(() => readPetLocalSettings());
|
|
12233
|
+
const [runtimeCapabilities, setRuntimeCapabilities] = React44.useState(null);
|
|
12234
|
+
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] = React44.useState(false);
|
|
12235
|
+
const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] = React44.useState(
|
|
11221
12236
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
11222
12237
|
);
|
|
11223
|
-
const [runRuntimeCapabilities, setRunRuntimeCapabilities] =
|
|
12238
|
+
const [runRuntimeCapabilities, setRunRuntimeCapabilities] = React44.useState(
|
|
11224
12239
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
11225
12240
|
);
|
|
11226
|
-
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] =
|
|
11227
|
-
const [attachments, setAttachments] =
|
|
11228
|
-
const [references, setReferences] =
|
|
11229
|
-
const [isUploadingReferenceImages, setIsUploadingReferenceImages] =
|
|
11230
|
-
const [quoteSelection, setQuoteSelection] =
|
|
11231
|
-
const [isAtBottom, setIsAtBottom] =
|
|
11232
|
-
const [hasUpdatesBelow, setHasUpdatesBelow] =
|
|
12241
|
+
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] = React44.useState(null);
|
|
12242
|
+
const [attachments, setAttachments] = React44.useState([]);
|
|
12243
|
+
const [references, setReferences] = React44.useState([]);
|
|
12244
|
+
const [isUploadingReferenceImages, setIsUploadingReferenceImages] = React44.useState(false);
|
|
12245
|
+
const [quoteSelection, setQuoteSelection] = React44.useState(null);
|
|
12246
|
+
const [isAtBottom, setIsAtBottom] = React44.useState(true);
|
|
12247
|
+
const [hasUpdatesBelow, setHasUpdatesBelow] = React44.useState(false);
|
|
11233
12248
|
const {
|
|
11234
12249
|
threads,
|
|
11235
12250
|
deleteThread,
|
|
11236
12251
|
refreshThreads,
|
|
11237
12252
|
isLoading: isThreadsLoading
|
|
11238
12253
|
} = useThreads();
|
|
11239
|
-
const viewportRef =
|
|
11240
|
-
const fileInputRef =
|
|
11241
|
-
const composerInputRef =
|
|
11242
|
-
const slashPaletteRef =
|
|
11243
|
-
const slashPaletteOptionRefs =
|
|
12254
|
+
const viewportRef = React44.useRef(null);
|
|
12255
|
+
const fileInputRef = React44.useRef(null);
|
|
12256
|
+
const composerInputRef = React44.useRef(null);
|
|
12257
|
+
const slashPaletteRef = React44.useRef(null);
|
|
12258
|
+
const slashPaletteOptionRefs = React44.useRef(
|
|
11244
12259
|
[]
|
|
11245
12260
|
);
|
|
11246
|
-
const composerPartsRef =
|
|
11247
|
-
const pendingComposerCaretOffsetRef =
|
|
11248
|
-
const shouldAutoScrollRef =
|
|
11249
|
-
const forceFollowRef =
|
|
11250
|
-
const previousMessageCountRef =
|
|
11251
|
-
const previousScrollTopRef =
|
|
11252
|
-
const autoScrollFrameRef =
|
|
11253
|
-
const isPointerDownRef =
|
|
11254
|
-
const lastTouchYRef =
|
|
11255
|
-
const runtimeCapabilityPreferenceLoadRef =
|
|
12261
|
+
const composerPartsRef = React44.useRef([]);
|
|
12262
|
+
const pendingComposerCaretOffsetRef = React44.useRef(null);
|
|
12263
|
+
const shouldAutoScrollRef = React44.useRef(true);
|
|
12264
|
+
const forceFollowRef = React44.useRef(false);
|
|
12265
|
+
const previousMessageCountRef = React44.useRef(0);
|
|
12266
|
+
const previousScrollTopRef = React44.useRef(0);
|
|
12267
|
+
const autoScrollFrameRef = React44.useRef(null);
|
|
12268
|
+
const isPointerDownRef = React44.useRef(false);
|
|
12269
|
+
const lastTouchYRef = React44.useRef(null);
|
|
12270
|
+
const runtimeCapabilityPreferenceLoadRef = React44.useRef(0);
|
|
11256
12271
|
const resolvedTitle = title ?? t("chat.title");
|
|
11257
12272
|
const resolvedPlaceholder = placeholder ?? t("chat.placeholder");
|
|
11258
12273
|
const petRequired = options?.displayMode === "pet";
|
|
11259
|
-
const basePetSettings =
|
|
12274
|
+
const basePetSettings = React44.useMemo(
|
|
11260
12275
|
() => derivePetLocalSettings(options?.pet),
|
|
11261
12276
|
[options?.pet]
|
|
11262
12277
|
);
|
|
11263
|
-
const displayedPetSettings =
|
|
12278
|
+
const displayedPetSettings = React44.useMemo(
|
|
11264
12279
|
() => ({
|
|
11265
12280
|
...petLocalSettings ?? basePetSettings,
|
|
11266
12281
|
...petRequired ? { enabled: true } : {}
|
|
11267
12282
|
}),
|
|
11268
12283
|
[basePetSettings, petLocalSettings, petRequired]
|
|
11269
12284
|
);
|
|
11270
|
-
const effectivePet =
|
|
12285
|
+
const effectivePet = React44.useMemo(() => {
|
|
11271
12286
|
if (petRequired || petLocalSettings) {
|
|
11272
12287
|
return buildPetOptionsFromLocalSettings(displayedPetSettings);
|
|
11273
12288
|
}
|
|
11274
12289
|
return options?.pet ?? null;
|
|
11275
12290
|
}, [displayedPetSettings, options?.pet, petLocalSettings, petRequired]);
|
|
11276
|
-
const savePetLocalSettings =
|
|
12291
|
+
const savePetLocalSettings = React44.useCallback(
|
|
11277
12292
|
(settings) => {
|
|
11278
12293
|
const nextSettings = petRequired ? { ...settings, enabled: true } : settings;
|
|
11279
12294
|
setPetLocalSettings(nextSettings);
|
|
@@ -11281,7 +12296,7 @@ function Chat({
|
|
|
11281
12296
|
},
|
|
11282
12297
|
[petRequired]
|
|
11283
12298
|
);
|
|
11284
|
-
const handlePetCommand =
|
|
12299
|
+
const handlePetCommand = React44.useCallback(
|
|
11285
12300
|
(mode) => {
|
|
11286
12301
|
if (mode === "settings") {
|
|
11287
12302
|
setPetSettingsOpen(true);
|
|
@@ -11303,18 +12318,23 @@ function Chat({
|
|
|
11303
12318
|
[displayedPetSettings, effectivePet, petRequired, savePetLocalSettings]
|
|
11304
12319
|
);
|
|
11305
12320
|
const inputPlaceholder = selectedTool?.placeholderOverride ?? composer?.placeholder ?? resolvedPlaceholder;
|
|
11306
|
-
const messages =
|
|
12321
|
+
const messages = React44.useMemo(
|
|
11307
12322
|
() => stream.messages ?? [],
|
|
11308
12323
|
[stream.messages]
|
|
11309
12324
|
);
|
|
11310
|
-
const draft =
|
|
12325
|
+
const draft = React44.useMemo(
|
|
11311
12326
|
() => getComposerPlainText(composerParts),
|
|
11312
12327
|
[composerParts]
|
|
11313
12328
|
);
|
|
11314
12329
|
const trimmedDraft = draft.trim();
|
|
11315
12330
|
const hasReferences = references.length > 0;
|
|
11316
12331
|
const isComposerStacked = planModeEnabled || Boolean(selectedTool);
|
|
11317
|
-
const
|
|
12332
|
+
const isComposerInputEmpty = getComposerEditingLength(composerParts) === 0;
|
|
12333
|
+
const composerInputRoundedClass = getComposerInputRoundedClass(theme.radius, {
|
|
12334
|
+
isEmpty: isComposerInputEmpty,
|
|
12335
|
+
isStacked: isComposerStacked
|
|
12336
|
+
});
|
|
12337
|
+
const pendingFollowUps = React44.useMemo(
|
|
11318
12338
|
() => [...stream.pendingFollowUps ?? []].sort(
|
|
11319
12339
|
(a, b) => a.createdAt - b.createdAt
|
|
11320
12340
|
),
|
|
@@ -11325,31 +12345,18 @@ function Chat({
|
|
|
11325
12345
|
const hasPendingHITLRequest = Boolean(stream.pendingHITLRequest);
|
|
11326
12346
|
const hasPendingInteractiveRequest = hasPendingRequestUserInput || hasPendingHITLRequest;
|
|
11327
12347
|
const hasPendingTodos = Boolean(stream.todos?.items.length);
|
|
11328
|
-
const runtimeCapabilityOptions =
|
|
12348
|
+
const runtimeCapabilityOptions = React44.useMemo(
|
|
11329
12349
|
() => getRuntimeCapabilityOptions(runtimeCapabilities),
|
|
11330
12350
|
[runtimeCapabilities]
|
|
11331
12351
|
);
|
|
11332
|
-
const effectiveSessionRuntimeCapabilities =
|
|
12352
|
+
const effectiveSessionRuntimeCapabilities = React44.useMemo(
|
|
11333
12353
|
() => runtimeCapabilitiesReady && runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
11334
12354
|
runtimeCapabilities,
|
|
11335
12355
|
sessionRuntimeCapabilities
|
|
11336
12356
|
) : null,
|
|
11337
12357
|
[runtimeCapabilities, runtimeCapabilitiesReady, sessionRuntimeCapabilities]
|
|
11338
12358
|
);
|
|
11339
|
-
const
|
|
11340
|
-
() => runtimeCapabilitiesReady && runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
11341
|
-
runtimeCapabilities,
|
|
11342
|
-
sessionRuntimeCapabilities,
|
|
11343
|
-
runRuntimeCapabilities
|
|
11344
|
-
) : null,
|
|
11345
|
-
[
|
|
11346
|
-
runtimeCapabilities,
|
|
11347
|
-
runtimeCapabilitiesReady,
|
|
11348
|
-
runRuntimeCapabilities,
|
|
11349
|
-
sessionRuntimeCapabilities
|
|
11350
|
-
]
|
|
11351
|
-
);
|
|
11352
|
-
const runRuntimeCapabilityOptions = React43.useMemo(
|
|
12359
|
+
const runRuntimeCapabilityOptions = React44.useMemo(
|
|
11353
12360
|
() => runtimeCapabilityOptions.filter(
|
|
11354
12361
|
(option) => isRuntimeCapabilitySelected(
|
|
11355
12362
|
runRuntimeCapabilities,
|
|
@@ -11359,11 +12366,11 @@ function Chat({
|
|
|
11359
12366
|
),
|
|
11360
12367
|
[runRuntimeCapabilities, runtimeCapabilityOptions]
|
|
11361
12368
|
);
|
|
11362
|
-
const composerRuntimeCapabilitySelectionKeys =
|
|
12369
|
+
const composerRuntimeCapabilitySelectionKeys = React44.useMemo(
|
|
11363
12370
|
() => getComposerCapabilitySelectionKeys(composerParts),
|
|
11364
12371
|
[composerParts]
|
|
11365
12372
|
);
|
|
11366
|
-
const detachedRunRuntimeCapabilityOptions =
|
|
12373
|
+
const detachedRunRuntimeCapabilityOptions = React44.useMemo(
|
|
11367
12374
|
() => runRuntimeCapabilityOptions.filter(
|
|
11368
12375
|
(option) => !composerRuntimeCapabilitySelectionKeys.has(
|
|
11369
12376
|
getRuntimeCapabilityOptionKey(option)
|
|
@@ -11371,7 +12378,7 @@ function Chat({
|
|
|
11371
12378
|
),
|
|
11372
12379
|
[composerRuntimeCapabilitySelectionKeys, runRuntimeCapabilityOptions]
|
|
11373
12380
|
);
|
|
11374
|
-
const persistSessionRuntimeCapabilities =
|
|
12381
|
+
const persistSessionRuntimeCapabilities = React44.useCallback(
|
|
11375
12382
|
async (threadId, selection) => {
|
|
11376
12383
|
if (!runtimeCapabilities || !selection) {
|
|
11377
12384
|
return;
|
|
@@ -11396,10 +12403,10 @@ function Chat({
|
|
|
11396
12403
|
},
|
|
11397
12404
|
[runtimeCapabilities, stream.client]
|
|
11398
12405
|
);
|
|
11399
|
-
const clearQuoteSelection =
|
|
12406
|
+
const clearQuoteSelection = React44.useCallback(() => {
|
|
11400
12407
|
setQuoteSelection(null);
|
|
11401
12408
|
}, []);
|
|
11402
|
-
const commitComposerParts =
|
|
12409
|
+
const commitComposerParts = React44.useCallback(
|
|
11403
12410
|
(nextParts, options2) => {
|
|
11404
12411
|
const normalized = normalizeComposerParts(nextParts);
|
|
11405
12412
|
const previous = composerPartsRef.current;
|
|
@@ -11435,7 +12442,7 @@ function Chat({
|
|
|
11435
12442
|
},
|
|
11436
12443
|
[]
|
|
11437
12444
|
);
|
|
11438
|
-
const setComposerText =
|
|
12445
|
+
const setComposerText = React44.useCallback(
|
|
11439
12446
|
(text, caretOffset = text.length) => {
|
|
11440
12447
|
commitComposerParts(createComposerTextParts(text), {
|
|
11441
12448
|
caretOffset,
|
|
@@ -11445,7 +12452,7 @@ function Chat({
|
|
|
11445
12452
|
},
|
|
11446
12453
|
[commitComposerParts]
|
|
11447
12454
|
);
|
|
11448
|
-
const focusComposerAt =
|
|
12455
|
+
const focusComposerAt = React44.useCallback((position) => {
|
|
11449
12456
|
const nextPosition = position ?? getComposerEditingLength(composerPartsRef.current);
|
|
11450
12457
|
pendingComposerCaretOffsetRef.current = nextPosition;
|
|
11451
12458
|
requestAnimationFrame(() => {
|
|
@@ -11457,7 +12464,7 @@ function Chat({
|
|
|
11457
12464
|
});
|
|
11458
12465
|
}, []);
|
|
11459
12466
|
const parentMessenger = useParentMessenger({
|
|
11460
|
-
onSetComposerValue:
|
|
12467
|
+
onSetComposerValue: React44.useCallback(
|
|
11461
12468
|
(payload) => {
|
|
11462
12469
|
if (!payload) {
|
|
11463
12470
|
return;
|
|
@@ -11480,10 +12487,10 @@ function Chat({
|
|
|
11480
12487
|
},
|
|
11481
12488
|
[composer?.tools, setComposerText]
|
|
11482
12489
|
),
|
|
11483
|
-
onFocusComposer:
|
|
12490
|
+
onFocusComposer: React44.useCallback(() => {
|
|
11484
12491
|
composerInputRef.current?.focus();
|
|
11485
12492
|
}, []),
|
|
11486
|
-
onSetPetEnabled:
|
|
12493
|
+
onSetPetEnabled: React44.useCallback(
|
|
11487
12494
|
(enabled) => {
|
|
11488
12495
|
if (petRequired) {
|
|
11489
12496
|
return;
|
|
@@ -11496,7 +12503,7 @@ function Chat({
|
|
|
11496
12503
|
[displayedPetSettings, petRequired, savePetLocalSettings]
|
|
11497
12504
|
)
|
|
11498
12505
|
});
|
|
11499
|
-
const syncQuoteSelection =
|
|
12506
|
+
const syncQuoteSelection = React44.useCallback(() => {
|
|
11500
12507
|
if (typeof window === "undefined") {
|
|
11501
12508
|
clearQuoteSelection();
|
|
11502
12509
|
return;
|
|
@@ -11541,23 +12548,23 @@ function Chat({
|
|
|
11541
12548
|
left
|
|
11542
12549
|
});
|
|
11543
12550
|
}, [clearQuoteSelection]);
|
|
11544
|
-
const cancelPendingAutoScroll =
|
|
12551
|
+
const cancelPendingAutoScroll = React44.useCallback(() => {
|
|
11545
12552
|
if (autoScrollFrameRef.current !== null) {
|
|
11546
12553
|
cancelAnimationFrame(autoScrollFrameRef.current);
|
|
11547
12554
|
autoScrollFrameRef.current = null;
|
|
11548
12555
|
}
|
|
11549
12556
|
}, []);
|
|
11550
|
-
const disableAutoFollow =
|
|
12557
|
+
const disableAutoFollow = React44.useCallback(() => {
|
|
11551
12558
|
forceFollowRef.current = false;
|
|
11552
12559
|
shouldAutoScrollRef.current = false;
|
|
11553
12560
|
cancelPendingAutoScroll();
|
|
11554
12561
|
}, [cancelPendingAutoScroll]);
|
|
11555
|
-
const enableAutoFollow =
|
|
12562
|
+
const enableAutoFollow = React44.useCallback(() => {
|
|
11556
12563
|
forceFollowRef.current = true;
|
|
11557
12564
|
shouldAutoScrollRef.current = true;
|
|
11558
12565
|
setHasUpdatesBelow(false);
|
|
11559
12566
|
}, []);
|
|
11560
|
-
const scrollToBottom =
|
|
12567
|
+
const scrollToBottom = React44.useCallback(
|
|
11561
12568
|
(smooth = false, force = false) => {
|
|
11562
12569
|
if (force) {
|
|
11563
12570
|
enableAutoFollow();
|
|
@@ -11584,7 +12591,7 @@ function Chat({
|
|
|
11584
12591
|
},
|
|
11585
12592
|
[cancelPendingAutoScroll, enableAutoFollow]
|
|
11586
12593
|
);
|
|
11587
|
-
|
|
12594
|
+
React44.useEffect(() => {
|
|
11588
12595
|
const viewport = viewportRef.current;
|
|
11589
12596
|
if (!viewport) return;
|
|
11590
12597
|
previousScrollTopRef.current = viewport.scrollTop;
|
|
@@ -11665,14 +12672,14 @@ function Chat({
|
|
|
11665
12672
|
window.removeEventListener("pointercancel", stopPointerTracking);
|
|
11666
12673
|
};
|
|
11667
12674
|
}, [cancelPendingAutoScroll, disableAutoFollow]);
|
|
11668
|
-
|
|
12675
|
+
React44.useEffect(() => {
|
|
11669
12676
|
shouldAutoScrollRef.current = true;
|
|
11670
12677
|
forceFollowRef.current = false;
|
|
11671
12678
|
previousScrollTopRef.current = 0;
|
|
11672
12679
|
setIsAtBottom(true);
|
|
11673
12680
|
setHasUpdatesBelow(false);
|
|
11674
12681
|
}, [stream.threadId]);
|
|
11675
|
-
|
|
12682
|
+
React44.useEffect(() => {
|
|
11676
12683
|
const messageCountChanged = messages.length !== previousMessageCountRef.current;
|
|
11677
12684
|
previousMessageCountRef.current = messages.length;
|
|
11678
12685
|
if (!shouldAutoScrollRef.current) {
|
|
@@ -11691,7 +12698,7 @@ function Chat({
|
|
|
11691
12698
|
clientSecret: effectiveClientSecret
|
|
11692
12699
|
});
|
|
11693
12700
|
const missingConfig = Boolean(missingConfigKind);
|
|
11694
|
-
const missingConfigShortMessage =
|
|
12701
|
+
const missingConfigShortMessage = React44.useMemo(() => {
|
|
11695
12702
|
switch (missingConfigKind) {
|
|
11696
12703
|
case "apiUrl":
|
|
11697
12704
|
return t("chat.missingApiUrlShort");
|
|
@@ -11703,7 +12710,7 @@ function Chat({
|
|
|
11703
12710
|
return t("chat.missingConfigShort");
|
|
11704
12711
|
}
|
|
11705
12712
|
}, [missingConfigKind, t]);
|
|
11706
|
-
const missingConfigDetailMessage =
|
|
12713
|
+
const missingConfigDetailMessage = React44.useMemo(() => {
|
|
11707
12714
|
switch (missingConfigKind) {
|
|
11708
12715
|
case "apiUrl":
|
|
11709
12716
|
return t("chat.missingApiUrlDetail");
|
|
@@ -11718,7 +12725,7 @@ function Chat({
|
|
|
11718
12725
|
const showMissingConfig = !isClientSecretInitializing && missingConfig;
|
|
11719
12726
|
const hasUploadingFiles = attachments.some((a) => a.status === "uploading");
|
|
11720
12727
|
const isSendDisabled = !trimmedDraft && !hasReferences || hasPendingInteractiveRequest || missingConfig || isHistoryLoading || hasUploadingFiles || isUploadingReferenceImages;
|
|
11721
|
-
const resizeComposerInput =
|
|
12728
|
+
const resizeComposerInput = React44.useCallback(() => {
|
|
11722
12729
|
const input = composerInputRef.current;
|
|
11723
12730
|
if (!input) {
|
|
11724
12731
|
return;
|
|
@@ -11726,7 +12733,7 @@ function Chat({
|
|
|
11726
12733
|
input.style.maxHeight = `${COMPOSER_INPUT_MAX_HEIGHT}px`;
|
|
11727
12734
|
input.style.overflowY = input.scrollHeight > COMPOSER_INPUT_MAX_HEIGHT ? "auto" : "hidden";
|
|
11728
12735
|
}, []);
|
|
11729
|
-
|
|
12736
|
+
React44.useLayoutEffect(() => {
|
|
11730
12737
|
composerPartsRef.current = composerParts;
|
|
11731
12738
|
resizeComposerInput();
|
|
11732
12739
|
const caretOffset = pendingComposerCaretOffsetRef.current;
|
|
@@ -11738,13 +12745,13 @@ function Chat({
|
|
|
11738
12745
|
}
|
|
11739
12746
|
}
|
|
11740
12747
|
}, [composerDomVersion, composerParts, resizeComposerInput]);
|
|
11741
|
-
|
|
12748
|
+
React44.useEffect(() => {
|
|
11742
12749
|
document.addEventListener("selectionchange", syncQuoteSelection);
|
|
11743
12750
|
return () => {
|
|
11744
12751
|
document.removeEventListener("selectionchange", syncQuoteSelection);
|
|
11745
12752
|
};
|
|
11746
12753
|
}, [syncQuoteSelection]);
|
|
11747
|
-
|
|
12754
|
+
React44.useEffect(() => {
|
|
11748
12755
|
const viewport = viewportRef.current;
|
|
11749
12756
|
if (!viewport) {
|
|
11750
12757
|
return;
|
|
@@ -11761,14 +12768,14 @@ function Chat({
|
|
|
11761
12768
|
window.removeEventListener("resize", handleViewportScroll);
|
|
11762
12769
|
};
|
|
11763
12770
|
}, [clearQuoteSelection]);
|
|
11764
|
-
|
|
12771
|
+
React44.useEffect(() => {
|
|
11765
12772
|
clearQuoteSelection();
|
|
11766
12773
|
}, [messages.length, stream.threadId, clearQuoteSelection]);
|
|
11767
|
-
|
|
12774
|
+
React44.useEffect(() => {
|
|
11768
12775
|
if (missingConfig) return;
|
|
11769
12776
|
void refreshThreads();
|
|
11770
12777
|
}, [missingConfig, refreshThreads]);
|
|
11771
|
-
|
|
12778
|
+
React44.useEffect(() => {
|
|
11772
12779
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
11773
12780
|
setAssistantName(null);
|
|
11774
12781
|
setAssistantAvatar(null);
|
|
@@ -11791,7 +12798,7 @@ function Chat({
|
|
|
11791
12798
|
cancelled = true;
|
|
11792
12799
|
};
|
|
11793
12800
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
11794
|
-
|
|
12801
|
+
React44.useEffect(() => {
|
|
11795
12802
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
11796
12803
|
setRuntimeCapabilities(null);
|
|
11797
12804
|
setRuntimeCapabilitiesReady(false);
|
|
@@ -11838,7 +12845,7 @@ function Chat({
|
|
|
11838
12845
|
});
|
|
11839
12846
|
return () => controller.abort();
|
|
11840
12847
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
11841
|
-
|
|
12848
|
+
React44.useEffect(() => {
|
|
11842
12849
|
setRunRuntimeCapabilities(
|
|
11843
12850
|
createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
|
|
11844
12851
|
);
|
|
@@ -11895,7 +12902,7 @@ function Chat({
|
|
|
11895
12902
|
mimetype: a.storageFile?.mimetype ?? a.file.type,
|
|
11896
12903
|
size: a.storageFile?.size ?? a.file.size
|
|
11897
12904
|
}));
|
|
11898
|
-
const handleSessionRuntimeCapabilityToggle =
|
|
12905
|
+
const handleSessionRuntimeCapabilityToggle = React44.useCallback(
|
|
11899
12906
|
(type, id, selected) => {
|
|
11900
12907
|
setSessionRuntimeCapabilities((previous) => {
|
|
11901
12908
|
const nextSelection = toggleRuntimeCapabilitySelection(
|
|
@@ -11913,7 +12920,7 @@ function Chat({
|
|
|
11913
12920
|
},
|
|
11914
12921
|
[persistSessionRuntimeCapabilities, stream.threadId]
|
|
11915
12922
|
);
|
|
11916
|
-
const updateRuntimeCapabilityPalette =
|
|
12923
|
+
const updateRuntimeCapabilityPalette = React44.useCallback(
|
|
11917
12924
|
(parts, selectionStart) => {
|
|
11918
12925
|
const input = composerInputRef.current;
|
|
11919
12926
|
const editingText = getComposerEditingText(parts);
|
|
@@ -11925,7 +12932,7 @@ function Chat({
|
|
|
11925
12932
|
},
|
|
11926
12933
|
[]
|
|
11927
12934
|
);
|
|
11928
|
-
const syncComposerInputFromElement =
|
|
12935
|
+
const syncComposerInputFromElement = React44.useCallback(
|
|
11929
12936
|
(input) => {
|
|
11930
12937
|
const previousCapabilities = getComposerCapabilityPartMap(
|
|
11931
12938
|
composerPartsRef.current
|
|
@@ -11943,25 +12950,25 @@ function Chat({
|
|
|
11943
12950
|
},
|
|
11944
12951
|
[commitComposerParts, updateRuntimeCapabilityPalette]
|
|
11945
12952
|
);
|
|
11946
|
-
const handleComposerInput =
|
|
12953
|
+
const handleComposerInput = React44.useCallback(
|
|
11947
12954
|
(event) => {
|
|
11948
12955
|
syncComposerInputFromElement(event.currentTarget);
|
|
11949
12956
|
},
|
|
11950
12957
|
[syncComposerInputFromElement]
|
|
11951
12958
|
);
|
|
11952
|
-
const handleComposerCompositionEnd =
|
|
12959
|
+
const handleComposerCompositionEnd = React44.useCallback(
|
|
11953
12960
|
(event) => {
|
|
11954
12961
|
syncComposerInputFromElement(event.currentTarget);
|
|
11955
12962
|
},
|
|
11956
12963
|
[syncComposerInputFromElement]
|
|
11957
12964
|
);
|
|
11958
|
-
const handleComposerSelect =
|
|
12965
|
+
const handleComposerSelect = React44.useCallback(() => {
|
|
11959
12966
|
updateRuntimeCapabilityPalette(
|
|
11960
12967
|
composerPartsRef.current,
|
|
11961
12968
|
composerInputRef.current ? getComposerSelectionOffset(composerInputRef.current) : void 0
|
|
11962
12969
|
);
|
|
11963
12970
|
}, [updateRuntimeCapabilityPalette]);
|
|
11964
|
-
const removeRunRuntimeCapability =
|
|
12971
|
+
const removeRunRuntimeCapability = React44.useCallback(
|
|
11965
12972
|
(option) => {
|
|
11966
12973
|
setRunRuntimeCapabilities(
|
|
11967
12974
|
(previous) => toggleRuntimeCapabilitySelection(
|
|
@@ -11981,7 +12988,7 @@ function Chat({
|
|
|
11981
12988
|
},
|
|
11982
12989
|
[commitComposerParts]
|
|
11983
12990
|
);
|
|
11984
|
-
const submitDraft =
|
|
12991
|
+
const submitDraft = React44.useCallback(
|
|
11985
12992
|
(optionsOrFollowUp) => {
|
|
11986
12993
|
if (isSendDisabled) return;
|
|
11987
12994
|
const submitOptions = typeof optionsOrFollowUp === "string" ? { followUpOverride: optionsOrFollowUp } : optionsOrFollowUp ?? {};
|
|
@@ -11997,13 +13004,20 @@ function Chat({
|
|
|
11997
13004
|
if (!humanInput) {
|
|
11998
13005
|
return;
|
|
11999
13006
|
}
|
|
12000
|
-
const
|
|
13007
|
+
const recommendedRuntimeCapabilitiesForSubmit = submitOptions.runtimeCapabilities && runtimeCapabilities && runtimeCapabilitiesReady ? mergeRuntimeCapabilitiesSelections(
|
|
12001
13008
|
runtimeCapabilities,
|
|
12002
|
-
|
|
13009
|
+
runRuntimeCapabilities,
|
|
12003
13010
|
submitOptions.runtimeCapabilities
|
|
12004
|
-
) :
|
|
13011
|
+
) : runRuntimeCapabilities;
|
|
13012
|
+
const runtimeCapabilitiesForSubmit = runtimeCapabilities && runtimeCapabilitiesReady ? createRuntimeCapabilitiesForSubmit({
|
|
13013
|
+
capabilities: runtimeCapabilities,
|
|
13014
|
+
available: effectiveSessionRuntimeCapabilities,
|
|
13015
|
+
recommended: recommendedRuntimeCapabilitiesForSubmit
|
|
13016
|
+
}) : null;
|
|
12005
13017
|
const runtimeCapabilityOptionsForMessage = getSelectedRuntimeCapabilityOptions(
|
|
12006
|
-
|
|
13018
|
+
getRecommendedRuntimeCapabilitiesSelection(
|
|
13019
|
+
runtimeCapabilitiesForSubmit
|
|
13020
|
+
),
|
|
12007
13021
|
runtimeCapabilityOptions
|
|
12008
13022
|
);
|
|
12009
13023
|
const displayContent = submitOptions.displayText || contentToSubmit || (referencesToSend ? t("chat.referencedContentOnly") : "");
|
|
@@ -12079,7 +13093,6 @@ function Chat({
|
|
|
12079
13093
|
setRuntimeCapabilityPalette(null);
|
|
12080
13094
|
},
|
|
12081
13095
|
[
|
|
12082
|
-
effectiveRuntimeCapabilitiesForSubmit,
|
|
12083
13096
|
effectiveSessionRuntimeCapabilities,
|
|
12084
13097
|
isSendDisabled,
|
|
12085
13098
|
options?.request,
|
|
@@ -12088,6 +13101,7 @@ function Chat({
|
|
|
12088
13101
|
runtimeCapabilities,
|
|
12089
13102
|
runtimeCapabilitiesReady,
|
|
12090
13103
|
runtimeCapabilityOptions,
|
|
13104
|
+
runRuntimeCapabilities,
|
|
12091
13105
|
scrollToBottom,
|
|
12092
13106
|
selectedTool,
|
|
12093
13107
|
commitComposerParts,
|
|
@@ -12098,7 +13112,7 @@ function Chat({
|
|
|
12098
13112
|
t
|
|
12099
13113
|
]
|
|
12100
13114
|
);
|
|
12101
|
-
const addRunRuntimeCapabilities =
|
|
13115
|
+
const addRunRuntimeCapabilities = React44.useCallback(
|
|
12102
13116
|
(selection) => {
|
|
12103
13117
|
setRunRuntimeCapabilities(
|
|
12104
13118
|
(previous) => runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
@@ -12110,7 +13124,7 @@ function Chat({
|
|
|
12110
13124
|
},
|
|
12111
13125
|
[runtimeCapabilities]
|
|
12112
13126
|
);
|
|
12113
|
-
const insertComposerCapabilityToken =
|
|
13127
|
+
const insertComposerCapabilityToken = React44.useCallback(
|
|
12114
13128
|
(capability, range) => {
|
|
12115
13129
|
const token = createComposerCapabilityPart(capability, createMessageId());
|
|
12116
13130
|
const currentParts = composerPartsRef.current;
|
|
@@ -12151,7 +13165,7 @@ function Chat({
|
|
|
12151
13165
|
runtimeCapabilities,
|
|
12152
13166
|
runtimeCapabilitiesReady,
|
|
12153
13167
|
runtimeCapabilityOptions,
|
|
12154
|
-
|
|
13168
|
+
recommendedRuntimeCapabilities: runRuntimeCapabilities,
|
|
12155
13169
|
draft,
|
|
12156
13170
|
palette: runtimeCapabilityPalette,
|
|
12157
13171
|
setPalette: setRuntimeCapabilityPalette,
|
|
@@ -12181,7 +13195,7 @@ function Chat({
|
|
|
12181
13195
|
plugin: t("composer.slashCommands.empty.loadingCapabilities"),
|
|
12182
13196
|
subAgent: t("composer.slashCommands.empty.loadingCapabilities")
|
|
12183
13197
|
};
|
|
12184
|
-
|
|
13198
|
+
React44.useEffect(() => {
|
|
12185
13199
|
if (!runtimeCapabilityPalette) {
|
|
12186
13200
|
return;
|
|
12187
13201
|
}
|
|
@@ -12200,7 +13214,7 @@ function Chat({
|
|
|
12200
13214
|
);
|
|
12201
13215
|
}
|
|
12202
13216
|
}, [slashPaletteOptions.length, runtimeCapabilityPalette]);
|
|
12203
|
-
|
|
13217
|
+
React44.useLayoutEffect(() => {
|
|
12204
13218
|
if (!runtimeCapabilityPalette) {
|
|
12205
13219
|
return;
|
|
12206
13220
|
}
|
|
@@ -12224,7 +13238,7 @@ function Chat({
|
|
|
12224
13238
|
}
|
|
12225
13239
|
submitDraft();
|
|
12226
13240
|
};
|
|
12227
|
-
const handleEditPendingFollowUp =
|
|
13241
|
+
const handleEditPendingFollowUp = React44.useCallback(
|
|
12228
13242
|
(id) => {
|
|
12229
13243
|
const item = pendingFollowUps.find(
|
|
12230
13244
|
(entry) => entry.id === id && entry.mode === "queue"
|
|
@@ -12251,7 +13265,7 @@ function Chat({
|
|
|
12251
13265
|
},
|
|
12252
13266
|
[pendingFollowUps, setComposerText, stream]
|
|
12253
13267
|
);
|
|
12254
|
-
const handleQuoteSelection =
|
|
13268
|
+
const handleQuoteSelection = React44.useCallback(() => {
|
|
12255
13269
|
if (!quoteSelection) {
|
|
12256
13270
|
return;
|
|
12257
13271
|
}
|
|
@@ -12267,7 +13281,7 @@ function Chat({
|
|
|
12267
13281
|
const handleAttachmentClick = () => {
|
|
12268
13282
|
fileInputRef.current?.click();
|
|
12269
13283
|
};
|
|
12270
|
-
const uploadContextFile =
|
|
13284
|
+
const uploadContextFile = React44.useCallback(
|
|
12271
13285
|
(file) => stream.client.contexts.uploadFile(file),
|
|
12272
13286
|
[stream.client]
|
|
12273
13287
|
);
|
|
@@ -12371,7 +13385,7 @@ function Chat({
|
|
|
12371
13385
|
}
|
|
12372
13386
|
submitDraft();
|
|
12373
13387
|
};
|
|
12374
|
-
const handleComposerPaste =
|
|
13388
|
+
const handleComposerPaste = React44.useCallback(
|
|
12375
13389
|
(event) => {
|
|
12376
13390
|
const clipboardData = event.clipboardData;
|
|
12377
13391
|
if (!clipboardData) {
|
|
@@ -12470,18 +13484,18 @@ function Chat({
|
|
|
12470
13484
|
uploadContextFile
|
|
12471
13485
|
]
|
|
12472
13486
|
);
|
|
12473
|
-
const alternateFollowUpShortcutLabel =
|
|
13487
|
+
const alternateFollowUpShortcutLabel = React44.useMemo(() => {
|
|
12474
13488
|
if (typeof navigator === "undefined") {
|
|
12475
13489
|
return "\u2318Enter";
|
|
12476
13490
|
}
|
|
12477
13491
|
const platform = navigator.platform || navigator.userAgent;
|
|
12478
13492
|
return /Mac|iPhone|iPad|iPod/i.test(platform) ? "\u2318Enter" : "Ctrl+Enter";
|
|
12479
13493
|
}, []);
|
|
12480
|
-
const followUpShortcutLabels =
|
|
13494
|
+
const followUpShortcutLabels = React44.useMemo(
|
|
12481
13495
|
() => getComposerFollowUpShortcutLabels(alternateFollowUpShortcutLabel),
|
|
12482
13496
|
[alternateFollowUpShortcutLabel]
|
|
12483
13497
|
);
|
|
12484
|
-
const uploadFile =
|
|
13498
|
+
const uploadFile = React44.useCallback(
|
|
12485
13499
|
async (localId, file) => {
|
|
12486
13500
|
try {
|
|
12487
13501
|
const result = await uploadContextFile(file);
|
|
@@ -12504,7 +13518,7 @@ function Chat({
|
|
|
12504
13518
|
},
|
|
12505
13519
|
[uploadContextFile]
|
|
12506
13520
|
);
|
|
12507
|
-
const handleRetryUpload =
|
|
13521
|
+
const handleRetryUpload = React44.useCallback(
|
|
12508
13522
|
(localId) => {
|
|
12509
13523
|
const attachment = attachments.find((a) => a.localId === localId);
|
|
12510
13524
|
if (!attachment || attachment.status !== "error") return;
|
|
@@ -12603,7 +13617,7 @@ function Chat({
|
|
|
12603
13617
|
);
|
|
12604
13618
|
scrollToBottom(true, true);
|
|
12605
13619
|
};
|
|
12606
|
-
const loadConversationMessages =
|
|
13620
|
+
const loadConversationMessages = React44.useCallback(
|
|
12607
13621
|
async (recordId) => {
|
|
12608
13622
|
if (missingConfig) {
|
|
12609
13623
|
setHistoryError(missingConfigShortMessage);
|
|
@@ -12698,12 +13712,12 @@ function Chat({
|
|
|
12698
13712
|
}
|
|
12699
13713
|
};
|
|
12700
13714
|
const acceptMimes = composer?.attachments?.accept ? Object.entries(composer.attachments.accept).map(([mime, exts]) => [mime, ...exts.map((e) => `.${e}`)].join(",")).join(",") : void 0;
|
|
12701
|
-
const currentThread =
|
|
13715
|
+
const currentThread = React44.useMemo(
|
|
12702
13716
|
() => threads.find((item) => item.id === stream.threadId),
|
|
12703
13717
|
[threads, stream.threadId]
|
|
12704
13718
|
);
|
|
12705
13719
|
const streamErrorMessage = stream.error instanceof Error ? stream.error.message : void 0;
|
|
12706
|
-
const threadErrorMessage =
|
|
13720
|
+
const threadErrorMessage = React44.useMemo(() => {
|
|
12707
13721
|
if (streamErrorMessage?.trim()) return streamErrorMessage.trim();
|
|
12708
13722
|
if (currentThread?.status !== "error") return void 0;
|
|
12709
13723
|
const message = currentThread.error?.trim();
|
|
@@ -12734,7 +13748,7 @@ function Chat({
|
|
|
12734
13748
|
fallbackTitle: t("history.threadFallback")
|
|
12735
13749
|
});
|
|
12736
13750
|
const assistantTitle = assistantName || resolvedTitle;
|
|
12737
|
-
return /* @__PURE__ */ (0,
|
|
13751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
12738
13752
|
"div",
|
|
12739
13753
|
{
|
|
12740
13754
|
ref: viewportRef,
|
|
@@ -12744,10 +13758,10 @@ function Chat({
|
|
|
12744
13758
|
className
|
|
12745
13759
|
),
|
|
12746
13760
|
children: [
|
|
12747
|
-
/* @__PURE__ */ (0,
|
|
12748
|
-
/* @__PURE__ */ (0,
|
|
12749
|
-
/* @__PURE__ */ (0,
|
|
12750
|
-
/* @__PURE__ */ (0,
|
|
13761
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-center justify-between border-b p-2 sticky top-0 z-10 bg-background", children: [
|
|
13762
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-center gap-3 overflow-hidden", children: [
|
|
13763
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "relative shrink-0", children: [
|
|
13764
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12751
13765
|
ChatkitAvatar,
|
|
12752
13766
|
{
|
|
12753
13767
|
avatar: assistantAvatar,
|
|
@@ -12755,10 +13769,10 @@ function Chat({
|
|
|
12755
13769
|
label: assistantTitle
|
|
12756
13770
|
}
|
|
12757
13771
|
),
|
|
12758
|
-
/* @__PURE__ */ (0,
|
|
13772
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-green-500" })
|
|
12759
13773
|
] }),
|
|
12760
|
-
/* @__PURE__ */ (0,
|
|
12761
|
-
/* @__PURE__ */ (0,
|
|
13774
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "truncate", children: [
|
|
13775
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12762
13776
|
"h2",
|
|
12763
13777
|
{
|
|
12764
13778
|
className: "text-lg font-semibold truncate",
|
|
@@ -12766,12 +13780,12 @@ function Chat({
|
|
|
12766
13780
|
children: assistantTitle
|
|
12767
13781
|
}
|
|
12768
13782
|
),
|
|
12769
|
-
/* @__PURE__ */ (0,
|
|
13783
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-xs text-muted-foreground", children: t("chat.statusOnline") })
|
|
12770
13784
|
] })
|
|
12771
13785
|
] }),
|
|
12772
|
-
/* @__PURE__ */ (0,
|
|
12773
|
-
/* @__PURE__ */ (0,
|
|
12774
|
-
/* @__PURE__ */ (0,
|
|
13786
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
13787
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(Tooltip, { children: [
|
|
13788
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12775
13789
|
"button",
|
|
12776
13790
|
{
|
|
12777
13791
|
type: "button",
|
|
@@ -12782,14 +13796,14 @@ function Chat({
|
|
|
12782
13796
|
"transition-colors duration-150"
|
|
12783
13797
|
),
|
|
12784
13798
|
"aria-label": t("settings.open"),
|
|
12785
|
-
children: /* @__PURE__ */ (0,
|
|
13799
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.Settings, { size: 16 })
|
|
12786
13800
|
}
|
|
12787
13801
|
) }) }),
|
|
12788
|
-
/* @__PURE__ */ (0,
|
|
13802
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TooltipContent, { side: "bottom", children: t("settings.open") })
|
|
12789
13803
|
] }),
|
|
12790
|
-
history?.enabled !== false && /* @__PURE__ */ (0,
|
|
12791
|
-
/* @__PURE__ */ (0,
|
|
12792
|
-
/* @__PURE__ */ (0,
|
|
13804
|
+
history?.enabled !== false && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
13805
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(Tooltip, { children: [
|
|
13806
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12793
13807
|
"button",
|
|
12794
13808
|
{
|
|
12795
13809
|
type: "button",
|
|
@@ -12802,12 +13816,12 @@ function Chat({
|
|
|
12802
13816
|
"disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed"
|
|
12803
13817
|
),
|
|
12804
13818
|
"aria-label": t("history.newThread"),
|
|
12805
|
-
children: /* @__PURE__ */ (0,
|
|
13819
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.Pencil, { size: 16 })
|
|
12806
13820
|
}
|
|
12807
13821
|
) }) }),
|
|
12808
|
-
/* @__PURE__ */ (0,
|
|
13822
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TooltipContent, { side: "bottom", children: t("history.newThread") })
|
|
12809
13823
|
] }),
|
|
12810
|
-
/* @__PURE__ */ (0,
|
|
13824
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12811
13825
|
HistorySidebar,
|
|
12812
13826
|
{
|
|
12813
13827
|
threads,
|
|
@@ -12822,18 +13836,18 @@ function Chat({
|
|
|
12822
13836
|
] })
|
|
12823
13837
|
] })
|
|
12824
13838
|
] }),
|
|
12825
|
-
/* @__PURE__ */ (0,
|
|
12826
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
12827
|
-
historyError && /* @__PURE__ */ (0,
|
|
12828
|
-
showMissingConfig && /* @__PURE__ */ (0,
|
|
12829
|
-
isHistoryLoading && /* @__PURE__ */ (0,
|
|
12830
|
-
messages.length === 0 ? /* @__PURE__ */ (0,
|
|
13839
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex-1 p-4", children: [
|
|
13840
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: errorMessage }),
|
|
13841
|
+
historyError && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: historyError }),
|
|
13842
|
+
showMissingConfig && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: missingConfigDetailMessage }),
|
|
13843
|
+
isHistoryLoading && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "mb-4 rounded-lg border border-muted px-3 py-2 text-sm text-muted-foreground", children: t("chat.loadingThread") }),
|
|
13844
|
+
messages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12831
13845
|
StartScreen,
|
|
12832
13846
|
{
|
|
12833
13847
|
startScreen,
|
|
12834
13848
|
onPromptClick: handlePromptClick
|
|
12835
13849
|
}
|
|
12836
|
-
) : /* @__PURE__ */ (0,
|
|
13850
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "space-y-4", children: [
|
|
12837
13851
|
messages.map((message, index) => {
|
|
12838
13852
|
const messageType = String(message.type);
|
|
12839
13853
|
const isAssistantMessage = messageType === "assistant" || messageType === "ai";
|
|
@@ -12855,7 +13869,9 @@ function Chat({
|
|
|
12855
13869
|
const humanReferences = humanMessage.references ?? [];
|
|
12856
13870
|
const humanAttachments = humanMessage.attachments ?? [];
|
|
12857
13871
|
const humanRuntimeCapabilityOptions = message.type === "human" ? humanMessage.runtimeCapabilityOptions ?? getSelectedRuntimeCapabilityOptions(
|
|
12858
|
-
|
|
13872
|
+
getRecommendedRuntimeCapabilitiesSelection(
|
|
13873
|
+
humanMessage.runtimeCapabilities
|
|
13874
|
+
),
|
|
12859
13875
|
runtimeCapabilityOptions
|
|
12860
13876
|
) : [];
|
|
12861
13877
|
const hasHumanAttachments = message.type === "human" && humanAttachments.length > 0;
|
|
@@ -12864,7 +13880,7 @@ function Chat({
|
|
|
12864
13880
|
if (!isAssistantMessage && !hasPlainRenderableContent && !hasHumanAttachments && humanRuntimeCapabilityOptions.length === 0 && humanReferences.length === 0) {
|
|
12865
13881
|
return null;
|
|
12866
13882
|
}
|
|
12867
|
-
return /* @__PURE__ */ (0,
|
|
13883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12868
13884
|
"div",
|
|
12869
13885
|
{
|
|
12870
13886
|
className: cn(
|
|
@@ -12872,8 +13888,8 @@ function Chat({
|
|
|
12872
13888
|
message.type === "human" ? "justify-end" : "justify-start -ml-1"
|
|
12873
13889
|
// AI messages: slightly closer to left
|
|
12874
13890
|
),
|
|
12875
|
-
children: /* @__PURE__ */ (0,
|
|
12876
|
-
/* @__PURE__ */ (0,
|
|
13891
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col px-3 overflow-hidden", children: [
|
|
13892
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12877
13893
|
"div",
|
|
12878
13894
|
{
|
|
12879
13895
|
...canQuoteMessage ? {
|
|
@@ -12885,7 +13901,7 @@ function Chat({
|
|
|
12885
13901
|
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"
|
|
12886
13902
|
// AI messages: use chat-specific foreground color
|
|
12887
13903
|
),
|
|
12888
|
-
children: isAssistantMessage ? /* @__PURE__ */ (0,
|
|
13904
|
+
children: isAssistantMessage ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12889
13905
|
AssistantMessage,
|
|
12890
13906
|
{
|
|
12891
13907
|
message: {
|
|
@@ -12904,25 +13920,25 @@ function Chat({
|
|
|
12904
13920
|
organizationId: stream.organizationId,
|
|
12905
13921
|
apiUrl: stream.apiUrl
|
|
12906
13922
|
}
|
|
12907
|
-
) : /* @__PURE__ */ (0,
|
|
12908
|
-
message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0,
|
|
13923
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
13924
|
+
message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
12909
13925
|
"span",
|
|
12910
13926
|
{
|
|
12911
13927
|
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",
|
|
12912
13928
|
children: [
|
|
12913
|
-
/* @__PURE__ */ (0,
|
|
13929
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12914
13930
|
RuntimeCapabilityIcon,
|
|
12915
13931
|
{
|
|
12916
13932
|
option,
|
|
12917
13933
|
variant: "chip"
|
|
12918
13934
|
}
|
|
12919
13935
|
),
|
|
12920
|
-
/* @__PURE__ */ (0,
|
|
13936
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "max-w-[9rem] truncate", children: option.label })
|
|
12921
13937
|
]
|
|
12922
13938
|
},
|
|
12923
13939
|
`${option.type}:${option.id}`
|
|
12924
13940
|
)) }),
|
|
12925
|
-
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ (0,
|
|
13941
|
+
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanReferences.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12926
13942
|
ReferenceChip,
|
|
12927
13943
|
{
|
|
12928
13944
|
reference,
|
|
@@ -12930,29 +13946,29 @@ function Chat({
|
|
|
12930
13946
|
},
|
|
12931
13947
|
getReferenceKey(reference)
|
|
12932
13948
|
)) }),
|
|
12933
|
-
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ (0,
|
|
13949
|
+
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "flex flex-wrap gap-1.5 mb-2", children: humanAttachments.map((file, fileIndex) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
12934
13950
|
"div",
|
|
12935
13951
|
{
|
|
12936
13952
|
className: "flex items-center gap-1.5 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs",
|
|
12937
13953
|
children: [
|
|
12938
|
-
/* @__PURE__ */ (0,
|
|
12939
|
-
/* @__PURE__ */ (0,
|
|
13954
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.FileText, { size: 12 }),
|
|
13955
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "max-w-[100px] truncate", children: file.originalName })
|
|
12940
13956
|
]
|
|
12941
13957
|
},
|
|
12942
13958
|
fileIndex
|
|
12943
13959
|
)) }),
|
|
12944
|
-
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ (0,
|
|
13960
|
+
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12945
13961
|
"p",
|
|
12946
13962
|
{
|
|
12947
13963
|
className: "wrap-break-word text-sm leading-relaxed",
|
|
12948
13964
|
children: formatMessageContent(part)
|
|
12949
13965
|
},
|
|
12950
13966
|
`${part.type}-${partIndex}`
|
|
12951
|
-
)) : /* @__PURE__ */ (0,
|
|
13967
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "wrap-break-word text-sm leading-relaxed", children: formatMessageContent(message.content) })
|
|
12952
13968
|
] })
|
|
12953
13969
|
}
|
|
12954
13970
|
),
|
|
12955
|
-
/* @__PURE__ */ (0,
|
|
13971
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12956
13972
|
MessageActions,
|
|
12957
13973
|
{
|
|
12958
13974
|
content: messageContent,
|
|
@@ -12988,7 +14004,7 @@ function Chat({
|
|
|
12988
14004
|
stream.isLoading,
|
|
12989
14005
|
{ now: streamingNow }
|
|
12990
14006
|
);
|
|
12991
|
-
return /* @__PURE__ */ (0,
|
|
14007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "flex justify-start gap-3 -ml-2", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "max-w-full rounded-2xl py-2.5", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12992
14008
|
AssistantStreamingIndicator,
|
|
12993
14009
|
{
|
|
12994
14010
|
status: fallbackStreamingStatus ?? "loading"
|
|
@@ -12997,7 +14013,7 @@ function Chat({
|
|
|
12997
14013
|
})()
|
|
12998
14014
|
] })
|
|
12999
14015
|
] }),
|
|
13000
|
-
!isAtBottom && messages.length > 0 && /* @__PURE__ */ (0,
|
|
14016
|
+
!isAtBottom && messages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "sticky bottom-20 z-20 flex justify-center px-4 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13001
14017
|
Button,
|
|
13002
14018
|
{
|
|
13003
14019
|
type: "button",
|
|
@@ -13010,10 +14026,10 @@ function Chat({
|
|
|
13010
14026
|
onClick: () => scrollToBottom(true, true),
|
|
13011
14027
|
"aria-label": t("chat.scrollToBottom"),
|
|
13012
14028
|
title: t("chat.scrollToBottom"),
|
|
13013
|
-
children: /* @__PURE__ */ (0,
|
|
14029
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.ArrowDown, { size: 16 })
|
|
13014
14030
|
}
|
|
13015
14031
|
) }),
|
|
13016
|
-
quoteSelection && /* @__PURE__ */ (0,
|
|
14032
|
+
quoteSelection && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13017
14033
|
"div",
|
|
13018
14034
|
{
|
|
13019
14035
|
className: "pointer-events-none fixed z-50",
|
|
@@ -13022,7 +14038,7 @@ function Chat({
|
|
|
13022
14038
|
left: `${quoteSelection.left}px`,
|
|
13023
14039
|
transform: "translateX(-50%)"
|
|
13024
14040
|
},
|
|
13025
|
-
children: /* @__PURE__ */ (0,
|
|
14041
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
13026
14042
|
Button,
|
|
13027
14043
|
{
|
|
13028
14044
|
type: "button",
|
|
@@ -13034,16 +14050,16 @@ function Chat({
|
|
|
13034
14050
|
"aria-label": t("composer.quoteSelection"),
|
|
13035
14051
|
title: t("composer.quoteSelection"),
|
|
13036
14052
|
children: [
|
|
13037
|
-
/* @__PURE__ */ (0,
|
|
14053
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.Quote, { size: 14 }),
|
|
13038
14054
|
t("composer.quoteSelection")
|
|
13039
14055
|
]
|
|
13040
14056
|
}
|
|
13041
14057
|
)
|
|
13042
14058
|
}
|
|
13043
14059
|
),
|
|
13044
|
-
/* @__PURE__ */ (0,
|
|
13045
|
-
threadErrorMessage && /* @__PURE__ */ (0,
|
|
13046
|
-
/* @__PURE__ */ (0,
|
|
14060
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "p-2 sticky bottom-0 z-10 bg-background", children: [
|
|
14061
|
+
threadErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("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 }),
|
|
14062
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13047
14063
|
"input",
|
|
13048
14064
|
{
|
|
13049
14065
|
ref: fileInputRef,
|
|
@@ -13054,7 +14070,7 @@ function Chat({
|
|
|
13054
14070
|
className: "hidden"
|
|
13055
14071
|
}
|
|
13056
14072
|
),
|
|
13057
|
-
attachments.length > 0 && /* @__PURE__ */ (0,
|
|
14073
|
+
attachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "mb-3 flex flex-wrap gap-2", children: attachments.map((item) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
13058
14074
|
"div",
|
|
13059
14075
|
{
|
|
13060
14076
|
className: cn(
|
|
@@ -13062,16 +14078,16 @@ function Chat({
|
|
|
13062
14078
|
item.status === "error" ? "bg-destructive/10 border border-destructive/30" : "bg-muted"
|
|
13063
14079
|
),
|
|
13064
14080
|
children: [
|
|
13065
|
-
item.status === "uploading" && /* @__PURE__ */ (0,
|
|
13066
|
-
|
|
14081
|
+
item.status === "uploading" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
14082
|
+
import_lucide_react24.Loader2,
|
|
13067
14083
|
{
|
|
13068
14084
|
size: 14,
|
|
13069
14085
|
className: "animate-spin text-muted-foreground"
|
|
13070
14086
|
}
|
|
13071
14087
|
),
|
|
13072
|
-
item.status === "success" && /* @__PURE__ */ (0,
|
|
13073
|
-
item.status === "error" && /* @__PURE__ */ (0,
|
|
13074
|
-
/* @__PURE__ */ (0,
|
|
14088
|
+
item.status === "success" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.FileText, { size: 14, className: "text-muted-foreground" }),
|
|
14089
|
+
item.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.FileText, { size: 14, className: "text-destructive" }),
|
|
14090
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13075
14091
|
"span",
|
|
13076
14092
|
{
|
|
13077
14093
|
className: cn(
|
|
@@ -13081,17 +14097,17 @@ function Chat({
|
|
|
13081
14097
|
children: item.file.name
|
|
13082
14098
|
}
|
|
13083
14099
|
),
|
|
13084
|
-
item.status === "error" && /* @__PURE__ */ (0,
|
|
14100
|
+
item.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13085
14101
|
"button",
|
|
13086
14102
|
{
|
|
13087
14103
|
type: "button",
|
|
13088
14104
|
onClick: () => handleRetryUpload(item.localId),
|
|
13089
14105
|
className: "ml-1 rounded-full p-0.5 text-destructive hover:bg-destructive/20",
|
|
13090
14106
|
title: t("chat.retryUpload"),
|
|
13091
|
-
children: /* @__PURE__ */ (0,
|
|
14107
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.RefreshCw, { size: 12 })
|
|
13092
14108
|
}
|
|
13093
14109
|
),
|
|
13094
|
-
/* @__PURE__ */ (0,
|
|
14110
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13095
14111
|
"button",
|
|
13096
14112
|
{
|
|
13097
14113
|
type: "button",
|
|
@@ -13100,14 +14116,14 @@ function Chat({
|
|
|
13100
14116
|
"ml-1 rounded-full p-0.5",
|
|
13101
14117
|
item.status === "error" ? "text-destructive hover:bg-destructive/20" : "hover:bg-muted-foreground/20"
|
|
13102
14118
|
),
|
|
13103
|
-
children: /* @__PURE__ */ (0,
|
|
14119
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.X, { size: 12 })
|
|
13104
14120
|
}
|
|
13105
14121
|
)
|
|
13106
14122
|
]
|
|
13107
14123
|
},
|
|
13108
14124
|
item.localId
|
|
13109
14125
|
)) }),
|
|
13110
|
-
references.length > 0 && /* @__PURE__ */ (0,
|
|
14126
|
+
references.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "mb-3 flex flex-wrap gap-2", children: references.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13111
14127
|
ReferenceChip,
|
|
13112
14128
|
{
|
|
13113
14129
|
reference,
|
|
@@ -13121,16 +14137,16 @@ function Chat({
|
|
|
13121
14137
|
},
|
|
13122
14138
|
getReferenceKey(reference)
|
|
13123
14139
|
)) }),
|
|
13124
|
-
detachedRunRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0,
|
|
13125
|
-
/* @__PURE__ */ (0,
|
|
13126
|
-
detachedRunRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ (0,
|
|
14140
|
+
detachedRunRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "mb-2 flex flex-wrap items-center gap-2", children: [
|
|
14141
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-xs text-muted-foreground", children: t("composer.capabilities.runOnly") }),
|
|
14142
|
+
detachedRunRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
13127
14143
|
"span",
|
|
13128
14144
|
{
|
|
13129
14145
|
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",
|
|
13130
14146
|
children: [
|
|
13131
|
-
/* @__PURE__ */ (0,
|
|
13132
|
-
/* @__PURE__ */ (0,
|
|
13133
|
-
/* @__PURE__ */ (0,
|
|
14147
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(RuntimeCapabilityIcon, { option, variant: "chip" }),
|
|
14148
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "max-w-40 truncate", children: option.label }),
|
|
14149
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13134
14150
|
"button",
|
|
13135
14151
|
{
|
|
13136
14152
|
type: "button",
|
|
@@ -13138,7 +14154,7 @@ function Chat({
|
|
|
13138
14154
|
className: "rounded-full p-0.5 hover:bg-primary/15",
|
|
13139
14155
|
title: t("composer.capabilities.removeRunCapability"),
|
|
13140
14156
|
"aria-label": t("composer.capabilities.removeRunCapability"),
|
|
13141
|
-
children: /* @__PURE__ */ (0,
|
|
14157
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.X, { size: 11 })
|
|
13142
14158
|
}
|
|
13143
14159
|
)
|
|
13144
14160
|
]
|
|
@@ -13146,7 +14162,7 @@ function Chat({
|
|
|
13146
14162
|
`${option.type}:${option.id}`
|
|
13147
14163
|
))
|
|
13148
14164
|
] }),
|
|
13149
|
-
/* @__PURE__ */ (0,
|
|
14165
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13150
14166
|
PendingRuntimeServices,
|
|
13151
14167
|
{
|
|
13152
14168
|
state: stream.runtimeActivities.sandboxServices,
|
|
@@ -13155,7 +14171,7 @@ function Chat({
|
|
|
13155
14171
|
className: hasPendingTodos || hasPendingFollowUps ? "mb-2" : void 0
|
|
13156
14172
|
}
|
|
13157
14173
|
),
|
|
13158
|
-
/* @__PURE__ */ (0,
|
|
14174
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13159
14175
|
PendingTodos,
|
|
13160
14176
|
{
|
|
13161
14177
|
snapshot: stream.todos,
|
|
@@ -13163,7 +14179,7 @@ function Chat({
|
|
|
13163
14179
|
className: hasPendingFollowUps ? "mb-2" : void 0
|
|
13164
14180
|
}
|
|
13165
14181
|
),
|
|
13166
|
-
/* @__PURE__ */ (0,
|
|
14182
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13167
14183
|
PendingFollowUps,
|
|
13168
14184
|
{
|
|
13169
14185
|
items: pendingFollowUps,
|
|
@@ -13178,7 +14194,7 @@ function Chat({
|
|
|
13178
14194
|
attachToComposer: true
|
|
13179
14195
|
}
|
|
13180
14196
|
),
|
|
13181
|
-
/* @__PURE__ */ (0,
|
|
14197
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13182
14198
|
RequestUserInputPanel,
|
|
13183
14199
|
{
|
|
13184
14200
|
request: stream.pendingRequestUserInput,
|
|
@@ -13187,7 +14203,7 @@ function Chat({
|
|
|
13187
14203
|
attachToComposer: true
|
|
13188
14204
|
}
|
|
13189
14205
|
),
|
|
13190
|
-
/* @__PURE__ */ (0,
|
|
14206
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13191
14207
|
HITLApprovalPanel,
|
|
13192
14208
|
{
|
|
13193
14209
|
request: stream.pendingHITLRequest,
|
|
@@ -13196,7 +14212,7 @@ function Chat({
|
|
|
13196
14212
|
attachToComposer: true
|
|
13197
14213
|
}
|
|
13198
14214
|
),
|
|
13199
|
-
runtimeCapabilityPalette && /* @__PURE__ */ (0,
|
|
14215
|
+
runtimeCapabilityPalette && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13200
14216
|
SlashPalette,
|
|
13201
14217
|
{
|
|
13202
14218
|
palette: runtimeCapabilityPalette,
|
|
@@ -13210,21 +14226,21 @@ function Chat({
|
|
|
13210
14226
|
onSelect: selectSlashPaletteOption
|
|
13211
14227
|
}
|
|
13212
14228
|
),
|
|
13213
|
-
/* @__PURE__ */ (0,
|
|
14229
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("form", { className: "flex items-end", onSubmit: handleSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
13214
14230
|
"div",
|
|
13215
14231
|
{
|
|
13216
14232
|
"data-slot": "composer-input-shell",
|
|
13217
14233
|
"data-layout": isComposerStacked ? "stacked" : "inline",
|
|
13218
14234
|
className: cn(
|
|
13219
|
-
"relative flex flex-1 overflow-hidden
|
|
14235
|
+
"relative flex flex-1 overflow-hidden",
|
|
13220
14236
|
"bg-background border border-border shadow-sm",
|
|
13221
14237
|
isComposerStacked ? "min-h-[5.5rem] px-1.5 pt-1.5 pb-12" : "min-h-12 px-1.5 py-1",
|
|
13222
14238
|
"focus-within:border-muted-foreground/30 focus-within:shadow-md",
|
|
13223
|
-
"transition-[min-height,padding,box-shadow,border-color] duration-300 ease-[cubic-bezier(0.2,0.8,0.2,1)]",
|
|
13224
|
-
|
|
14239
|
+
"transition-[min-height,padding,border-radius,box-shadow,border-color] duration-300 ease-[cubic-bezier(0.2,0.8,0.2,1)]",
|
|
14240
|
+
composerInputRoundedClass
|
|
13225
14241
|
),
|
|
13226
14242
|
children: [
|
|
13227
|
-
/* @__PURE__ */ (0,
|
|
14243
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13228
14244
|
"div",
|
|
13229
14245
|
{
|
|
13230
14246
|
ref: composerInputRef,
|
|
@@ -13246,7 +14262,7 @@ function Chat({
|
|
|
13246
14262
|
(missingConfig || isHistoryLoading || hasPendingInteractiveRequest) && "cursor-not-allowed opacity-50"
|
|
13247
14263
|
),
|
|
13248
14264
|
children: renderedComposerParts.map(
|
|
13249
|
-
(part, index) => part.type === "text" ? /* @__PURE__ */ (0,
|
|
14265
|
+
(part, index) => part.type === "text" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(React44.Fragment, { children: part.text }, `text-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
13250
14266
|
"span",
|
|
13251
14267
|
{
|
|
13252
14268
|
"data-composer-capability-key": part.key,
|
|
@@ -13255,14 +14271,14 @@ function Chat({
|
|
|
13255
14271
|
contentEditable: false,
|
|
13256
14272
|
className: "mx-0.5 inline-flex max-w-[14rem] select-none items-center gap-1 text-sm font-semibold text-primary align-baseline",
|
|
13257
14273
|
children: [
|
|
13258
|
-
/* @__PURE__ */ (0,
|
|
14274
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13259
14275
|
RuntimeCapabilityIcon,
|
|
13260
14276
|
{
|
|
13261
14277
|
option: part.capability,
|
|
13262
14278
|
variant: "chip"
|
|
13263
14279
|
}
|
|
13264
14280
|
),
|
|
13265
|
-
/* @__PURE__ */ (0,
|
|
14281
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "truncate", children: part.capability.label })
|
|
13266
14282
|
]
|
|
13267
14283
|
},
|
|
13268
14284
|
part.key
|
|
@@ -13271,14 +14287,14 @@ function Chat({
|
|
|
13271
14287
|
},
|
|
13272
14288
|
composerDomVersion
|
|
13273
14289
|
),
|
|
13274
|
-
/* @__PURE__ */ (0,
|
|
14290
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
13275
14291
|
"div",
|
|
13276
14292
|
{
|
|
13277
14293
|
"data-slot": "composer-action-bar",
|
|
13278
14294
|
className: "pointer-events-none absolute inset-x-1.5 bottom-1 flex min-h-10 items-center justify-between gap-2",
|
|
13279
14295
|
children: [
|
|
13280
|
-
/* @__PURE__ */ (0,
|
|
13281
|
-
/* @__PURE__ */ (0,
|
|
14296
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "pointer-events-none flex min-w-0 flex-1 items-center gap-1.5", children: [
|
|
14297
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "pointer-events-auto flex shrink-0 items-center gap-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13282
14298
|
ComposerMenu,
|
|
13283
14299
|
{
|
|
13284
14300
|
composer,
|
|
@@ -13293,20 +14309,20 @@ function Chat({
|
|
|
13293
14309
|
disabled: missingConfig || isHistoryLoading || hasPendingInteractiveRequest
|
|
13294
14310
|
}
|
|
13295
14311
|
) }),
|
|
13296
|
-
selectedTool && /* @__PURE__ */ (0,
|
|
13297
|
-
/* @__PURE__ */ (0,
|
|
13298
|
-
/* @__PURE__ */ (0,
|
|
14312
|
+
selectedTool && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("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: [
|
|
14313
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "truncate", children: selectedTool.shortLabel ?? selectedTool.label }),
|
|
14314
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13299
14315
|
"button",
|
|
13300
14316
|
{
|
|
13301
14317
|
type: "button",
|
|
13302
14318
|
onClick: () => setSelectedTool(null),
|
|
13303
14319
|
className: "shrink-0 rounded-full p-0.5 text-primary/70 hover:bg-primary/10 hover:text-primary",
|
|
13304
|
-
children: /* @__PURE__ */ (0,
|
|
14320
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.X, { size: 12 })
|
|
13305
14321
|
}
|
|
13306
14322
|
)
|
|
13307
14323
|
] })
|
|
13308
14324
|
] }),
|
|
13309
|
-
/* @__PURE__ */ (0,
|
|
14325
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "pointer-events-auto shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13310
14326
|
SendButton,
|
|
13311
14327
|
{
|
|
13312
14328
|
disabled: isSendDisabled,
|
|
@@ -13333,7 +14349,7 @@ function Chat({
|
|
|
13333
14349
|
]
|
|
13334
14350
|
}
|
|
13335
14351
|
) }),
|
|
13336
|
-
disclaimer?.text && /* @__PURE__ */ (0,
|
|
14352
|
+
disclaimer?.text && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13337
14353
|
"p",
|
|
13338
14354
|
{
|
|
13339
14355
|
className: cn(
|
|
@@ -13343,12 +14359,12 @@ function Chat({
|
|
|
13343
14359
|
children: disclaimer.text
|
|
13344
14360
|
}
|
|
13345
14361
|
),
|
|
13346
|
-
/* @__PURE__ */ (0,
|
|
13347
|
-
/* @__PURE__ */ (0,
|
|
13348
|
-
/* @__PURE__ */ (0,
|
|
14362
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "mt-2 flex items-center justify-center gap-2 text-xs text-muted-foreground", children: [
|
|
14363
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: t("chat.poweredBy") }),
|
|
14364
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ContextUsageIndicator, { className: "absolute right-4" })
|
|
13349
14365
|
] })
|
|
13350
14366
|
] }),
|
|
13351
|
-
/* @__PURE__ */ (0,
|
|
14367
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13352
14368
|
SettingsSheet,
|
|
13353
14369
|
{
|
|
13354
14370
|
open: petSettingsOpen,
|
|
@@ -13358,17 +14374,17 @@ function Chat({
|
|
|
13358
14374
|
onSave: savePetLocalSettings
|
|
13359
14375
|
}
|
|
13360
14376
|
),
|
|
13361
|
-
/* @__PURE__ */ (0,
|
|
14377
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PetBridge, { pet: effectivePet, state: petAutoState })
|
|
13362
14378
|
]
|
|
13363
14379
|
}
|
|
13364
14380
|
);
|
|
13365
14381
|
}
|
|
13366
14382
|
|
|
13367
14383
|
// src/components/ui/separator.tsx
|
|
13368
|
-
var
|
|
13369
|
-
var
|
|
13370
|
-
var Separator =
|
|
13371
|
-
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ (0,
|
|
14384
|
+
var React45 = __toESM(require("react"), 1);
|
|
14385
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
14386
|
+
var Separator = React45.forwardRef(
|
|
14387
|
+
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13372
14388
|
"div",
|
|
13373
14389
|
{
|
|
13374
14390
|
ref,
|