@xpert-ai/chatkit-ui 0.3.4 → 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-DOSftAYs.js → _baseUniq-CAxobs9N.js} +1 -1
- package/dist/app/assets/{abap-D8t_liei.js → abap-wdK8JaHa.js} +1 -1
- package/dist/app/assets/{abnf-jhem6Fdp.js → abnf-B4QVrCDX.js} +1 -1
- package/dist/app/assets/{actionscript-AgAqywOC.js → actionscript-BbKSvJrq.js} +1 -1
- package/dist/app/assets/{ada-BR3Q6K2R.js → ada-BkwiItKH.js} +1 -1
- package/dist/app/assets/{agda-s2LPXGxr.js → agda-BHGf_Fgl.js} +1 -1
- package/dist/app/assets/{al-DbvPGDsA.js → al-CpdhQzD9.js} +1 -1
- package/dist/app/assets/{antlr4-Dde8A9o-.js → antlr4-CLQ7xEno.js} +1 -1
- package/dist/app/assets/{apacheconf-XU1nZV0U.js → apacheconf-6iBdrfFM.js} +1 -1
- package/dist/app/assets/{apex-dwhJyh_8.js → apex-DBXBvaz5.js} +1 -1
- package/dist/app/assets/{apl-6TVT9aj4.js → apl-D8vc149P.js} +1 -1
- package/dist/app/assets/{applescript-CK6TQ3Fp.js → applescript-BTZUYWS_.js} +1 -1
- package/dist/app/assets/{aql-CAitgyBw.js → aql-BxB6KDJQ.js} +1 -1
- package/dist/app/assets/{arc-y7BBKPBC.js → arc-CNi1G9DJ.js} +1 -1
- package/dist/app/assets/{architectureDiagram-Q4EWVU46-CKPXDiCw.js → architectureDiagram-Q4EWVU46-BL0mPAR9.js} +1 -1
- package/dist/app/assets/{arduino-BX92l-fC.js → arduino-Cx04QCrp.js} +1 -1
- package/dist/app/assets/{arff-TZ2mzCjA.js → arff-MqnrnEC8.js} +1 -1
- package/dist/app/assets/{asciidoc-CbdSoDU0.js → asciidoc-sz7M5yXr.js} +1 -1
- package/dist/app/assets/{asm6502-DB6lK7kM.js → asm6502-BZ8xfWko.js} +1 -1
- package/dist/app/assets/{asmatmel-DUbAVWcI.js → asmatmel-D-cI_as7.js} +1 -1
- package/dist/app/assets/{aspnet-BJclsNGz.js → aspnet-wNdsZF1M.js} +1 -1
- package/dist/app/assets/{autohotkey-BAHo4mzJ.js → autohotkey-CERdGivs.js} +1 -1
- package/dist/app/assets/{autoit-CpXn4Gjh.js → autoit-CQsoUza0.js} +1 -1
- package/dist/app/assets/{avisynth-CB7WaK_0.js → avisynth-DMTk2nsi.js} +1 -1
- package/dist/app/assets/{avro-idl-C-DAHRE1.js → avro-idl-VdXZfwVL.js} +1 -1
- package/dist/app/assets/{bash-De_5PB_T.js → bash-BKoQnhB6.js} +1 -1
- package/dist/app/assets/{basic-TAOzT46e.js → basic-BvRsQ9vo.js} +1 -1
- package/dist/app/assets/{batch-yBjeCG2_.js → batch-DkZb4POU.js} +1 -1
- package/dist/app/assets/{bbcode-zhuhkwPV.js → bbcode-BkkYngk6.js} +1 -1
- package/dist/app/assets/{bicep-3sditE87.js → bicep-DY62eX6n.js} +1 -1
- package/dist/app/assets/{birb-B91lhwFM.js → birb-Cf3Wn8DP.js} +1 -1
- package/dist/app/assets/{bison-Zl9yhw_8.js → bison-CMVsgR8E.js} +1 -1
- package/dist/app/assets/{blockDiagram-DXYQGD6D-CbzYvF40.js → blockDiagram-DXYQGD6D-DdgOXTCq.js} +1 -1
- package/dist/app/assets/{bnf-BTyJWL2-.js → bnf-C53AC5ba.js} +1 -1
- package/dist/app/assets/{brainfuck-D-gtcLd6.js → brainfuck-DBcYtGip.js} +1 -1
- package/dist/app/assets/{brightscript-CtoapRkx.js → brightscript-uWYyj7Le.js} +1 -1
- package/dist/app/assets/{bro-MqwpLO_C.js → bro-Bnqn5jLn.js} +1 -1
- package/dist/app/assets/{bsl-B51ARJIQ.js → bsl-eeHcx6I3.js} +1 -1
- package/dist/app/assets/{c-Dd7OPCIn.js → c-Y_E2ZZ8h.js} +1 -1
- package/dist/app/assets/{c4Diagram-AHTNJAMY-Cl2FGnEB.js → c4Diagram-AHTNJAMY-BAZeiIaA.js} +1 -1
- package/dist/app/assets/{cfscript-BEyB5tLd.js → cfscript-swSriW5q.js} +1 -1
- package/dist/app/assets/{chaiscript-BEE5daDb.js → chaiscript-BHR5pIfl.js} +1 -1
- package/dist/app/assets/channel-C4IK_RZn.js +1 -0
- package/dist/app/assets/{chunk-4BX2VUAB-CdWO6X3v.js → chunk-4BX2VUAB-Deyo77pg.js} +1 -1
- package/dist/app/assets/{chunk-4TB4RGXK-B99XSc_o.js → chunk-4TB4RGXK-BSgPz1Fn.js} +1 -1
- package/dist/app/assets/{chunk-55IACEB6-Bf8lWYm0.js → chunk-55IACEB6-DekOqO8-.js} +1 -1
- package/dist/app/assets/{chunk-EDXVE4YY-D0jGhBDV.js → chunk-EDXVE4YY-VI2aoR3H.js} +1 -1
- package/dist/app/assets/{chunk-FMBD7UC4-CPVhZRqV.js → chunk-FMBD7UC4-DVPMFZIh.js} +1 -1
- package/dist/app/assets/{chunk-OYMX7WX6-B3B3qd2F.js → chunk-OYMX7WX6-C_5OySCp.js} +1 -1
- package/dist/app/assets/{chunk-QZHKN3VN-C9zZSGTB.js → chunk-QZHKN3VN-CQ4PJ94U.js} +1 -1
- package/dist/app/assets/{chunk-YZCP3GAM-BX0g-UOY.js → chunk-YZCP3GAM-40VMFur6.js} +1 -1
- package/dist/app/assets/{cil-DfLzhPVn.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-Dd07rx25.js → clike-cGW_OpAz.js} +1 -1
- package/dist/app/assets/{clojure-Du6gb2Do.js → clojure-BwM8_y2w.js} +1 -1
- package/dist/app/assets/clone-BC1Apkgy.js +1 -0
- package/dist/app/assets/{cmake-DpKAfrpv.js → cmake-B_tPIs0N.js} +1 -1
- package/dist/app/assets/{cobol-CMhyCAN0.js → cobol-awMTn3SL.js} +1 -1
- package/dist/app/assets/{coffeescript-C_hK5LrH.js → coffeescript-BdPUATdq.js} +1 -1
- package/dist/app/assets/{concurnas-BzzuO0wJ.js → concurnas-DD4NroNG.js} +1 -1
- package/dist/app/assets/{coq-D28Kf8H7.js → coq-WP9t6Mya.js} +1 -1
- package/dist/app/assets/{core-CkMLmhj1.js → core-Dl1d1z_B.js} +1 -1
- package/dist/app/assets/{cose-bilkent-S5V4N54A-Bnbhbxn8.js → cose-bilkent-S5V4N54A-CIsQWWLS.js} +1 -1
- package/dist/app/assets/{cpp-DMtEaL9D.js → cpp-DRq2558J.js} +1 -1
- package/dist/app/assets/{crystal-BPv3cq00.js → crystal-CmMEvlYk.js} +1 -1
- package/dist/app/assets/{csharp-CogydNTP.js → csharp-CmdWJQ_7.js} +1 -1
- package/dist/app/assets/{cshtml-DwKZdXN4.js → cshtml-D-PG0yKy.js} +1 -1
- package/dist/app/assets/{csp-EdkmOQr2.js → csp-CoYEQK4_.js} +1 -1
- package/dist/app/assets/{css-extras-_xrLQVK9.js → css-extras-CvcfPwL5.js} +1 -1
- package/dist/app/assets/{css-GGj7gjJp.js → css-qzCJaYzE.js} +1 -1
- package/dist/app/assets/{csv-DQnF4IQS.js → csv-BOSHHM-P.js} +1 -1
- package/dist/app/assets/{cypher-mlTzP2DC.js → cypher-DF-LRYf2.js} +1 -1
- package/dist/app/assets/{d-CA6ua4gG.js → d-DT7HGItG.js} +1 -1
- package/dist/app/assets/{dagre-KV5264BT-2pUvoHnZ.js → dagre-KV5264BT-BXDHR3FY.js} +1 -1
- package/dist/app/assets/{dart-BSRdjoJD.js → dart-C53tv9tc.js} +1 -1
- package/dist/app/assets/{dataweave-CTK9G89H.js → dataweave-DfVl-B8U.js} +1 -1
- package/dist/app/assets/{dax-CLAaspXf.js → dax-CtLDIvLu.js} +1 -1
- package/dist/app/assets/{dhall-DvmFF2lw.js → dhall-B4vfpjKK.js} +1 -1
- package/dist/app/assets/{diagram-5BDNPKRD--2m-CBif.js → diagram-5BDNPKRD-C2jQZSnh.js} +1 -1
- package/dist/app/assets/{diagram-G4DWMVQ6-xfTAcTBK.js → diagram-G4DWMVQ6-DkBF8pst.js} +1 -1
- package/dist/app/assets/{diagram-MMDJMWI5-DJ9-7Sko.js → diagram-MMDJMWI5-DkBy1EJI.js} +1 -1
- package/dist/app/assets/{diagram-TYMM5635-Dbu04dwS.js → diagram-TYMM5635-BG7IFHFj.js} +1 -1
- package/dist/app/assets/{diff-DexI-NjF.js → diff-CAGXr455.js} +1 -1
- package/dist/app/assets/{django-BJtz28yd.js → django-Bt-Xandi.js} +1 -1
- package/dist/app/assets/{dns-zone-file-C-rZlLjq.js → dns-zone-file-CUQqHN_u.js} +1 -1
- package/dist/app/assets/{docker-D3zkJQBB.js → docker-Cmx-jfGB.js} +1 -1
- package/dist/app/assets/{dot-CYyhO0AU.js → dot-CtNw9lX4.js} +1 -1
- package/dist/app/assets/{ebnf-DRQkwE29.js → ebnf-Dl_Q5Or1.js} +1 -1
- package/dist/app/assets/{editorconfig-BqLWNpRj.js → editorconfig-DZYXnV_C.js} +1 -1
- package/dist/app/assets/{eiffel-C9PIq1yy.js → eiffel-CgccC4xz.js} +1 -1
- package/dist/app/assets/{ejs-B6_5mrfN.js → ejs-Cj1dQzfI.js} +1 -1
- package/dist/app/assets/{elixir-jtsDOmKm.js → elixir-B3SWPivz.js} +1 -1
- package/dist/app/assets/{elm-DRbXA7ir.js → elm-Bp_TQfaA.js} +1 -1
- package/dist/app/assets/{erDiagram-SMLLAGMA-CrI2ZkzN.js → erDiagram-SMLLAGMA-Cby23XmU.js} +1 -1
- package/dist/app/assets/{erb-G2oGuDtf.js → erb-Cb-K6pZE.js} +1 -1
- package/dist/app/assets/{erlang-CT-pjUEp.js → erlang-F72Fjwv2.js} +1 -1
- package/dist/app/assets/{etlua-qmLyJp4f.js → etlua-DFUJG9GZ.js} +1 -1
- package/dist/app/assets/{excel-formula-3pfMQM_6.js → excel-formula-B8hn4WlO.js} +1 -1
- package/dist/app/assets/{factor-Bo9zUudA.js → factor-BlEqbeI0.js} +1 -1
- package/dist/app/assets/{false-oN6u3jCd.js → false-DMURsqlU.js} +1 -1
- package/dist/app/assets/{firestore-security-rules-CtzUeAWq.js → firestore-security-rules-DswDVNNa.js} +1 -1
- package/dist/app/assets/{flow-nzq0GfkM.js → flow-C4reo-gu.js} +1 -1
- package/dist/app/assets/{flowDiagram-DWJPFMVM-CGpnDmCG.js → flowDiagram-DWJPFMVM-BxNNsar9.js} +1 -1
- package/dist/app/assets/{fortran-DVeArHMZ.js → fortran-BAmD5KHF.js} +1 -1
- package/dist/app/assets/{fsharp--fFnup68.js → fsharp-CPq2O12L.js} +1 -1
- package/dist/app/assets/{ftl-BMxP4X-x.js → ftl-Cgbeq2-z.js} +1 -1
- package/dist/app/assets/{ganttDiagram-T4ZO3ILL-CCTn88VZ.js → ganttDiagram-T4ZO3ILL-BLd3DH-5.js} +1 -1
- package/dist/app/assets/{gap-B7zirCOJ.js → gap-Bge3tvcZ.js} +1 -1
- package/dist/app/assets/{gcode-CQFJN_Te.js → gcode-CAVcsFdN.js} +1 -1
- package/dist/app/assets/{gdscript-BTRKMIlE.js → gdscript-nkDP0xMM.js} +1 -1
- package/dist/app/assets/{gedcom-4Y3UUWcB.js → gedcom-BA8GnDnW.js} +1 -1
- package/dist/app/assets/{gherkin-DK5Y4NpK.js → gherkin-DvBWzm8E.js} +1 -1
- package/dist/app/assets/{git-DD3NDd7U.js → git-LJ9ums7L.js} +1 -1
- package/dist/app/assets/{gitGraphDiagram-UUTBAWPF-nEeDINSI.js → gitGraphDiagram-UUTBAWPF-JZEE6gBT.js} +1 -1
- package/dist/app/assets/{glsl-BCT9m8QS.js → glsl-D4U4_9LH.js} +1 -1
- package/dist/app/assets/{gml-CCB73B6Z.js → gml-CQtoiCZT.js} +1 -1
- package/dist/app/assets/{gn-BIFCrkIE.js → gn-DxTb0Jqi.js} +1 -1
- package/dist/app/assets/{go-dyQD8YyU.js → go-D7ELL60F.js} +1 -1
- package/dist/app/assets/{go-module-BXpIFu8x.js → go-module-Ck8j-Kcm.js} +1 -1
- package/dist/app/assets/{graph-wLpqxdfC.js → graph-pBSG-4mT.js} +1 -1
- package/dist/app/assets/{graphql-D-ZoQblr.js → graphql-C-10AxQD.js} +1 -1
- package/dist/app/assets/{groovy-CHjkA2bW.js → groovy-SpWCEWzX.js} +1 -1
- package/dist/app/assets/{haml-ghcX4l2W.js → haml-C2aM6_El.js} +1 -1
- package/dist/app/assets/{handlebars-x0LtkeUm.js → handlebars-ChMYyLZl.js} +1 -1
- package/dist/app/assets/{haskell-B-bDSuV-.js → haskell-DagwvSeE.js} +1 -1
- package/dist/app/assets/{haxe-Vm5mZw57.js → haxe-BG5B6d9K.js} +1 -1
- package/dist/app/assets/{hcl-CGN3jDav.js → hcl-B8Gd__02.js} +1 -1
- package/dist/app/assets/{hlsl-DMKySN6W.js → hlsl-CSu8CgjO.js} +1 -1
- package/dist/app/assets/{hoon-3jplpPAg.js → hoon-BUjyY25K.js} +1 -1
- package/dist/app/assets/{hpkp-DMJ5jXpf.js → hpkp-C5yMlUDS.js} +1 -1
- package/dist/app/assets/{hsts-CKBkWb38.js → hsts-DzNiiTKI.js} +1 -1
- package/dist/app/assets/{http-97sq51fE.js → http-DYWI6rav.js} +1 -1
- package/dist/app/assets/{ichigojam-CZ6nOPE1.js → ichigojam-DrBDAbYO.js} +1 -1
- package/dist/app/assets/{icon-CDqvp1g4.js → icon-BezsFCDL.js} +1 -1
- package/dist/app/assets/{icu-message-format-BjYuZ-Om.js → icu-message-format-BCSOltos.js} +1 -1
- package/dist/app/assets/{idris-pEOqm1H_.js → idris-B8Tj6LSh.js} +1 -1
- package/dist/app/assets/{iecst-CRrTHf_1.js → iecst-CfA7HSP8.js} +1 -1
- package/dist/app/assets/{ignore-CxkUxQmB.js → ignore-E_v5CiMN.js} +1 -1
- package/dist/app/assets/index-BojjVNpv.css +1 -0
- package/dist/app/assets/{index-n0Xlprbh.js → index-CAv2vOlh.js} +184 -184
- package/dist/app/assets/{infoDiagram-42DDH7IO-C8jVtFvE.js → infoDiagram-42DDH7IO-eZsn31yB.js} +1 -1
- package/dist/app/assets/{inform7-CJDC1PVH.js → inform7-Dj75C-lM.js} +1 -1
- package/dist/app/assets/{ini-BP8l3Q_m.js → ini-DnYgp5_G.js} +1 -1
- package/dist/app/assets/{io-L3Lj4xsH.js → io-D59cMlU5.js} +1 -1
- package/dist/app/assets/{ishikawaDiagram-UXIWVN3A-BCChdzZf.js → ishikawaDiagram-UXIWVN3A-Cb8G56a8.js} +1 -1
- package/dist/app/assets/{j-BkUK2Ldb.js → j-CuOplqKY.js} +1 -1
- package/dist/app/assets/{java-lKbQcHmi.js → java-DiKpa4Y3.js} +1 -1
- package/dist/app/assets/{javadoc-CkX_P5bm.js → javadoc-DshvkFVS.js} +1 -1
- package/dist/app/assets/{javadoclike-DKo0tRDk.js → javadoclike-Dl0yZMbR.js} +1 -1
- package/dist/app/assets/{javascript-JBI-h3GD.js → javascript-C3lRkH0T.js} +1 -1
- package/dist/app/assets/{javastacktrace-DuXSjAnS.js → javastacktrace-BAZDNyis.js} +1 -1
- package/dist/app/assets/{jexl-txJd9uA8.js → jexl-BvqPLTYh.js} +1 -1
- package/dist/app/assets/{jolie-BHXVY7fU.js → jolie-DXjsE0XX.js} +1 -1
- package/dist/app/assets/{journeyDiagram-VCZTEJTY-DgqozfYW.js → journeyDiagram-VCZTEJTY-9aLWSRay.js} +1 -1
- package/dist/app/assets/{jq-Csyhu6Mu.js → jq-CLFx4HBH.js} +1 -1
- package/dist/app/assets/{js-extras-hN_zFrKs.js → js-extras-D33J2WNl.js} +1 -1
- package/dist/app/assets/{js-templates-CKV7gOwt.js → js-templates-DlMN6fgo.js} +1 -1
- package/dist/app/assets/{jsdoc-DvQtkqGY.js → jsdoc-CGVgLZ2j.js} +1 -1
- package/dist/app/assets/{json-BWJc5nIm.js → json-BTnVvJgU.js} +1 -1
- package/dist/app/assets/{json5-SIZfmxdY.js → json5-BW8yCajk.js} +1 -1
- package/dist/app/assets/{jsonp-BCZTSaV5.js → jsonp-iQTQx19C.js} +1 -1
- package/dist/app/assets/{jsstacktrace-gzJEwbAz.js → jsstacktrace-DXxcFNfy.js} +1 -1
- package/dist/app/assets/{jsx-CjDjGsx0.js → jsx-D1npDekI.js} +1 -1
- package/dist/app/assets/{julia-D7oaevR9.js → julia-E711iN6A.js} +1 -1
- package/dist/app/assets/{kanban-definition-6JOO6SKY-IxcIrcgX.js → kanban-definition-6JOO6SKY-COnahS5T.js} +1 -1
- package/dist/app/assets/{keepalived-Cd4E72kG.js → keepalived-Da5-tKqr.js} +1 -1
- package/dist/app/assets/{keyman-CnnhX5FN.js → keyman-CR_is7Lf.js} +1 -1
- package/dist/app/assets/{kotlin-Bb9joIt9.js → kotlin-6F8UihuI.js} +1 -1
- package/dist/app/assets/{kumir-2AUUqPdZ.js → kumir-BGVXhhZU.js} +1 -1
- package/dist/app/assets/{kusto-BYT2Y4Ec.js → kusto-xzJ5QDBT.js} +1 -1
- package/dist/app/assets/{latex-C7vJjHLG.js → latex-jsq1GqdL.js} +1 -1
- package/dist/app/assets/{latte-B40IhbBN.js → latte-CqObxNvY.js} +1 -1
- package/dist/app/assets/{layout-JYzSZ2a2.js → layout-Od8azvI5.js} +1 -1
- package/dist/app/assets/{less-CfVevww_.js → less-vdQIwlhr.js} +1 -1
- package/dist/app/assets/{lilypond-Car5OZdt.js → lilypond-CYhZp9Do.js} +1 -1
- package/dist/app/assets/{linear-C52-vlD3.js → linear-BVmuh868.js} +1 -1
- package/dist/app/assets/{liquid-B5H1JE3W.js → liquid-CF_8y_W1.js} +1 -1
- package/dist/app/assets/{lisp-CzR77rD6.js → lisp-DqmYhGox.js} +1 -1
- package/dist/app/assets/{livescript-DaurQsHd.js → livescript-DEuoDOv7.js} +1 -1
- package/dist/app/assets/{llvm-HQsMJlhb.js → llvm-DlajzOZN.js} +1 -1
- package/dist/app/assets/{log-p-v4zt5b.js → log-CU2WH4Lm.js} +1 -1
- package/dist/app/assets/{lolcode-BUEwX00W.js → lolcode-CDbraZlO.js} +1 -1
- package/dist/app/assets/{lua-BMmOVEjM.js → lua-C7PRrDvP.js} +1 -1
- package/dist/app/assets/{magma-B8nyW6y4.js → magma-CEu2U_uQ.js} +1 -1
- package/dist/app/assets/{makefile-DcXOWSLr.js → makefile-BpvnX-Nx.js} +1 -1
- package/dist/app/assets/{markdown-DLWYEU3e.js → markdown-BTkzQyNu.js} +1 -1
- package/dist/app/assets/{markup-jsuSUme0.js → markup-Dje0J_2C.js} +1 -1
- package/dist/app/assets/{markup-templating-Dm7qXJKw.js → markup-templating-cYyMwZ4b.js} +1 -1
- package/dist/app/assets/{matlab-C0-FOdqd.js → matlab-RV1EEhcL.js} +1 -1
- package/dist/app/assets/{maxscript-Cfo0XQkR.js → maxscript-Bo7lyT0p.js} +1 -1
- package/dist/app/assets/{mel-DOCIJjQg.js → mel-kP-zTDHf.js} +1 -1
- package/dist/app/assets/{mermaid-BflTtQG8.js → mermaid-D1yX-Bwv.js} +1 -1
- package/dist/app/assets/{min-C1ji-XBz.js → min-z4SxYbt2.js} +1 -1
- package/dist/app/assets/{mindmap-definition-QFDTVHPH-B5ikGBES.js → mindmap-definition-QFDTVHPH-Dm1nn9t1.js} +1 -1
- package/dist/app/assets/{mizar-Bts2s8Hn.js → mizar-DD-lNTs3.js} +1 -1
- package/dist/app/assets/{mongodb-DQXudfKX.js → mongodb-By_x69ne.js} +1 -1
- package/dist/app/assets/{monkey-DrRHqOn1.js → monkey-CQneMnOq.js} +1 -1
- package/dist/app/assets/{moonscript-C7Xd-yhU.js → moonscript-Cv1IiKWR.js} +1 -1
- package/dist/app/assets/{n1ql-B_wltsIt.js → n1ql-BZ-dWxn_.js} +1 -1
- package/dist/app/assets/{n4js-BzoEPRsS.js → n4js-aHhU-EQW.js} +1 -1
- package/dist/app/assets/{nand2tetris-hdl-DC6szN4I.js → nand2tetris-hdl-Ct9NqibY.js} +1 -1
- package/dist/app/assets/{naniscript-Dtp-YV0U.js → naniscript-jrYYiXE3.js} +1 -1
- package/dist/app/assets/{nasm-0VzUWfWE.js → nasm-CR4fygO0.js} +1 -1
- package/dist/app/assets/{neon-7L9mJ622.js → neon-Bn9xaC-T.js} +1 -1
- package/dist/app/assets/{nevod-_UYv_FLm.js → nevod-DwwkUQZl.js} +1 -1
- package/dist/app/assets/{nginx-DjVc7ZO-.js → nginx-CxzxW55o.js} +1 -1
- package/dist/app/assets/{nim-DLWLAJSB.js → nim-_ziHrYai.js} +1 -1
- package/dist/app/assets/{nix-Biu8zxbr.js → nix-CnfynVyh.js} +1 -1
- package/dist/app/assets/{nsis-dCQyknmT.js → nsis-CTa60cBQ.js} +1 -1
- package/dist/app/assets/{objectivec-CSM9DCwb.js → objectivec-CxzV-EqQ.js} +1 -1
- package/dist/app/assets/{ocaml-CH0AuJ_r.js → ocaml-CXQfo6wC.js} +1 -1
- package/dist/app/assets/{opencl-JabGmje3.js → opencl-CdW2Jum5.js} +1 -1
- package/dist/app/assets/{openqasm-BGt4V7bR.js → openqasm-99txnqqb.js} +1 -1
- package/dist/app/assets/{oz-DbIu1th5.js → oz-CIEq0aNc.js} +1 -1
- package/dist/app/assets/{parigp-xeAu0pqa.js → parigp-D9vfJxo4.js} +1 -1
- package/dist/app/assets/{parser-BWTLDUYa.js → parser-DndpAxSG.js} +1 -1
- package/dist/app/assets/{pascal-D17KeDTg.js → pascal-RZKxz-_c.js} +1 -1
- package/dist/app/assets/{pascaligo-D2OO9Rgu.js → pascaligo-B7sniYrp.js} +1 -1
- package/dist/app/assets/{pcaxis-BcB430lz.js → pcaxis-B5p4fAPz.js} +1 -1
- package/dist/app/assets/{peoplecode-Y2S6Vb55.js → peoplecode-fCeRfJQ5.js} +1 -1
- package/dist/app/assets/{perl-DS-n0m7F.js → perl-CYh0437K.js} +1 -1
- package/dist/app/assets/{php-extras-CaqAl_Dh.js → php-extras-DCzP567Q.js} +1 -1
- package/dist/app/assets/{php--G5fMCND.js → php-rTdvXKxw.js} +1 -1
- package/dist/app/assets/{phpdoc-DLIcyuW1.js → phpdoc-BLbjAEWJ.js} +1 -1
- package/dist/app/assets/{pieDiagram-DEJITSTG-BhkQtnMG.js → pieDiagram-DEJITSTG-BuH3UT8S.js} +1 -1
- package/dist/app/assets/{plsql-Fq8oOWwI.js → plsql-B9JKIw1T.js} +1 -1
- package/dist/app/assets/{powerquery-CeNFj3PH.js → powerquery-Beeqnhtp.js} +1 -1
- package/dist/app/assets/{powershell-DX9U9N7r.js → powershell-DofDkeyl.js} +1 -1
- package/dist/app/assets/{processing-DkdV2LdA.js → processing-C-Nru_27.js} +1 -1
- package/dist/app/assets/{prolog-BQyE7F2m.js → prolog-Blc4S8Hs.js} +1 -1
- package/dist/app/assets/{promql-CO35w8Xd.js → promql-BsC9xRrD.js} +1 -1
- package/dist/app/assets/{properties-CD226fdu.js → properties-BNFVcgDb.js} +1 -1
- package/dist/app/assets/{protobuf-D44q9Zcx.js → protobuf-BlpX_T1K.js} +1 -1
- package/dist/app/assets/{psl-BKaJpoBk.js → psl-D2Hoa7_4.js} +1 -1
- package/dist/app/assets/{pug-DXId-Es4.js → pug-DBlY2nRe.js} +1 -1
- package/dist/app/assets/{puppet-B6U3R2i1.js → puppet-BfKwQiWD.js} +1 -1
- package/dist/app/assets/{pure-C6n52fSg.js → pure-CgWRG2Cz.js} +1 -1
- package/dist/app/assets/{purebasic-BSRzkysO.js → purebasic-C4IB7b6g.js} +1 -1
- package/dist/app/assets/{purescript-ac4_QHhP.js → purescript-DpbOv2_5.js} +1 -1
- package/dist/app/assets/{q-n7P06m3R.js → q-Bhw7S_Ff.js} +1 -1
- package/dist/app/assets/{qml-Bsb9t-6f.js → qml-BCy5slwb.js} +1 -1
- package/dist/app/assets/{qore-BY0sM7Wa.js → qore-C00kyzGf.js} +1 -1
- package/dist/app/assets/{qsharp-DwMCUEEj.js → qsharp-CN2CDpkI.js} +1 -1
- package/dist/app/assets/{quadrantDiagram-34T5L4WZ-BciQCjKx.js → quadrantDiagram-34T5L4WZ-DF36QwGT.js} +1 -1
- package/dist/app/assets/{r-wuXzKN8w.js → r-B_BK6AZu.js} +1 -1
- package/dist/app/assets/{racket-EWJYOBhv.js → racket-ByLawBwM.js} +1 -1
- package/dist/app/assets/{reason-b1aTIbDw.js → reason-BDBRcGMx.js} +1 -1
- package/dist/app/assets/{regex-BT-NVms-.js → regex-ChgfKyvR.js} +1 -1
- package/dist/app/assets/{rego-BkXfmH_T.js → rego-D_XvU-HX.js} +1 -1
- package/dist/app/assets/{renpy-CWSfrITs.js → renpy-5nIbfjm_.js} +1 -1
- package/dist/app/assets/{requirementDiagram-MS252O5E-Bw_GMi8G.js → requirementDiagram-MS252O5E-DoM__lrz.js} +1 -1
- package/dist/app/assets/{rest-CSIS2oaI.js → rest-D0kyBqSB.js} +1 -1
- package/dist/app/assets/{rip-DA5e5rbA.js → rip-CYiR9G3s.js} +1 -1
- package/dist/app/assets/{roboconf-CGLShPJZ.js → roboconf-NbRqT12s.js} +1 -1
- package/dist/app/assets/{robotframework-AuJ8NHH8.js → robotframework-DVLdugea.js} +1 -1
- package/dist/app/assets/{ruby-Dmo3oqYL.js → ruby-CXYqjyLr.js} +1 -1
- package/dist/app/assets/{rust-Yh4xDsPl.js → rust-DtiosDKR.js} +1 -1
- package/dist/app/assets/{sankeyDiagram-XADWPNL6-CwpL5Ag9.js → sankeyDiagram-XADWPNL6-DAGXEQXz.js} +1 -1
- package/dist/app/assets/{sas-BajPfouh.js → sas-CBuO0A4r.js} +1 -1
- package/dist/app/assets/{sass-BZ3IyTf0.js → sass-DAOC_JY6.js} +1 -1
- package/dist/app/assets/{scala-BJGdd8vd.js → scala-DrjxfsaL.js} +1 -1
- package/dist/app/assets/{scheme-tmXEra4U.js → scheme-Dqq_pAgd.js} +1 -1
- package/dist/app/assets/{scss-Dz5CBs5F.js → scss-Cs8enbPf.js} +1 -1
- package/dist/app/assets/{sequenceDiagram-FGHM5R23-Zb9ONvzy.js → sequenceDiagram-FGHM5R23-D_580_d2.js} +1 -1
- package/dist/app/assets/{shell-session-U_ooQzX-.js → shell-session-jQLXH-IX.js} +1 -1
- package/dist/app/assets/{smali-DMhdPO_F.js → smali-BjlQ2Fb8.js} +1 -1
- package/dist/app/assets/{smalltalk-CtwqxdOy.js → smalltalk-CvvaQ-vE.js} +1 -1
- package/dist/app/assets/{smarty-B-_Ggfpm.js → smarty-CuW15FKs.js} +1 -1
- package/dist/app/assets/{sml-Bvj3KzUv.js → sml-C2rZNwaS.js} +1 -1
- package/dist/app/assets/{solidity-CRfpXCnL.js → solidity-Bz0UCY5q.js} +1 -1
- package/dist/app/assets/{solution-file-CYfvOj9X.js → solution-file-DY6Szhc0.js} +1 -1
- package/dist/app/assets/{soy-DoUU5YOQ.js → soy-DupXqVr6.js} +1 -1
- package/dist/app/assets/{sparql-BRk34Rn9.js → sparql-CKXEGfsk.js} +1 -1
- package/dist/app/assets/{splunk-spl-C5FnseSI.js → splunk-spl-ylrNAn0q.js} +1 -1
- package/dist/app/assets/{sqf-BeyFDkm3.js → sqf-lJvrZCtE.js} +1 -1
- package/dist/app/assets/{sql-D-HqwAd-.js → sql-B7hLAkUR.js} +1 -1
- package/dist/app/assets/{squirrel-cZQ0YNSS.js → squirrel-BH1Y674s.js} +1 -1
- package/dist/app/assets/{stan-zqHKC64S.js → stan-fR7Qg8Ut.js} +1 -1
- package/dist/app/assets/{stateDiagram-FHFEXIEX-CyoWPE1S.js → stateDiagram-FHFEXIEX-B8jUR8FD.js} +1 -1
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-ByxORwfu.js +1 -0
- package/dist/app/assets/{stylus-jeXHFpb6.js → stylus-s7kCNuJK.js} +1 -1
- package/dist/app/assets/{swift-DD5qP3LK.js → swift-CCtYkHCf.js} +1 -1
- package/dist/app/assets/{systemd-dyYpUoVh.js → systemd-BCElHahC.js} +1 -1
- package/dist/app/assets/{t4-cs-DdzwIItd.js → t4-cs-H1_QKrKm.js} +1 -1
- package/dist/app/assets/{t4-templating-7MUBL1iq.js → t4-templating-6bPJc-Uq.js} +1 -1
- package/dist/app/assets/{t4-vb-WExQNH7h.js → t4-vb-DJucVBb5.js} +1 -1
- package/dist/app/assets/{tap-BK66GXcT.js → tap-B_SCHNXn.js} +1 -1
- package/dist/app/assets/{tcl-CX-Ne5lF.js → tcl-BNEpqSgM.js} +1 -1
- package/dist/app/assets/{textile-ByimrlEC.js → textile-uWVZjI0f.js} +1 -1
- package/dist/app/assets/{timeline-definition-GMOUNBTQ-uUI7-tyD.js → timeline-definition-GMOUNBTQ-pCO1IuTh.js} +1 -1
- package/dist/app/assets/{toml-BLYx3Nck.js → toml-IfqaxX6C.js} +1 -1
- package/dist/app/assets/{tremor-18nu0iOH.js → tremor-CXc27b0y.js} +1 -1
- package/dist/app/assets/{tt2-bzqhHd_O.js → tt2-CSiBMY4w.js} +1 -1
- package/dist/app/assets/{turtle-Cjm_9khs.js → turtle-BG1NGns7.js} +1 -1
- package/dist/app/assets/{twig-D0iQcF_6.js → twig-BApA7lBN.js} +1 -1
- package/dist/app/assets/{typescript-2OfP3mlH.js → typescript-CRhq3lVo.js} +1 -1
- package/dist/app/assets/{typoscript-BsOytkAv.js → typoscript-CbCyspbX.js} +1 -1
- package/dist/app/assets/{unrealscript-BWxPoPCn.js → unrealscript-C0oIJrK_.js} +1 -1
- package/dist/app/assets/{uorazor-CscffpjI.js → uorazor-CCeC8ukV.js} +1 -1
- package/dist/app/assets/{uri-DoCyUAH6.js → uri-BbJq2oKI.js} +1 -1
- package/dist/app/assets/{v-BTNlJKoZ.js → v-DWbZTbl1.js} +1 -1
- package/dist/app/assets/{vala-DiIqhFLn.js → vala-cNE5mkqv.js} +1 -1
- package/dist/app/assets/{vbnet-CBoOr9B0.js → vbnet-C4ps1ulT.js} +1 -1
- package/dist/app/assets/{velocity-X1I_pFrR.js → velocity-BqiV4VvP.js} +1 -1
- package/dist/app/assets/{vennDiagram-DHZGUBPP-B-52fvBA.js → vennDiagram-DHZGUBPP-DsozMeQe.js} +1 -1
- package/dist/app/assets/{verilog-LAXVYlck.js → verilog-uM22GI8M.js} +1 -1
- package/dist/app/assets/{vhdl-CXjkeBYt.js → vhdl-CjipXQit.js} +1 -1
- package/dist/app/assets/{vim-prtu90pQ.js → vim-DAu-IiFJ.js} +1 -1
- package/dist/app/assets/{visual-basic-B3Hd0Gdb.js → visual-basic-CdGIHeQV.js} +1 -1
- package/dist/app/assets/{wardley-RL74JXVD-BZVhJWb7.js → wardley-RL74JXVD-oEncjGLp.js} +1 -1
- package/dist/app/assets/{wardleyDiagram-NUSXRM2D-Cm0ghnek.js → wardleyDiagram-NUSXRM2D-DNMPqgtw.js} +1 -1
- package/dist/app/assets/{warpscript-0VPXBfCe.js → warpscript-ijeKRGom.js} +1 -1
- package/dist/app/assets/{wasm-6RzyTp2Y.js → wasm-CyK5pI_Y.js} +1 -1
- package/dist/app/assets/{web-idl-rCsaK0nr.js → web-idl-3RbxQwXD.js} +1 -1
- package/dist/app/assets/{wiki-FlEbAGMc.js → wiki-Vqqp-2xX.js} +1 -1
- package/dist/app/assets/{wolfram-DFlSzi0Z.js → wolfram-Bsi7joP0.js} +1 -1
- package/dist/app/assets/{wren-CRHW6GG3.js → wren-WQYmqFb4.js} +1 -1
- package/dist/app/assets/{xeora-BcvzW0pz.js → xeora-D38FYsRy.js} +1 -1
- package/dist/app/assets/{xml-doc-DzJzyzOc.js → xml-doc-wUzx0i81.js} +1 -1
- package/dist/app/assets/{xojo-CX4Uo-V_.js → xojo-CGKogxG9.js} +1 -1
- package/dist/app/assets/{xquery-Cm_nyuyl.js → xquery-Dv5QvWSQ.js} +1 -1
- package/dist/app/assets/{xychartDiagram-5P7HB3ND-CeOBdBC2.js → xychartDiagram-5P7HB3ND-BsbjEvIN.js} +1 -1
- package/dist/app/assets/{yaml-zn_2tPBx.js → yaml-BGAxdcfl.js} +1 -1
- package/dist/app/assets/{yang-9OrfznQV.js → yang-DbR14Qhe.js} +1 -1
- package/dist/app/assets/{zig-DwTTGKoo.js → zig-BZnMCGLn.js} +1 -1
- package/dist/app/index.html +2 -2
- package/dist/index.cjs +1524 -632
- package/dist/index.js +1498 -591
- package/package.json +2 -2
- package/dist/app/assets/channel-Ocy9uBDH.js +0 -1
- package/dist/app/assets/classDiagram-6PBFFD2Q-DPVg45WL.js +0 -1
- package/dist/app/assets/classDiagram-v2-HSJHXN6E-DPVg45WL.js +0 -1
- package/dist/app/assets/clone-AdHtfCx4.js +0 -1
- package/dist/app/assets/index-Cb5pIUJX.css +0 -1
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-3eYSeZ9d.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");
|
|
@@ -192,7 +192,25 @@ var import_react3 = require("react");
|
|
|
192
192
|
var import_nuqs = require("nuqs");
|
|
193
193
|
var import_xpert_sdk = require("@xpert-ai/xpert-sdk");
|
|
194
194
|
var import_tool = require("@langchain/core/messages/tool");
|
|
195
|
-
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
|
+
}
|
|
196
214
|
|
|
197
215
|
// src/lib/api-config.ts
|
|
198
216
|
function hasConfiguredValue(value) {
|
|
@@ -214,12 +232,12 @@ function getMissingApiConfigurationKind({
|
|
|
214
232
|
}
|
|
215
233
|
|
|
216
234
|
// src/lib/request-options.ts
|
|
217
|
-
var
|
|
235
|
+
var import_chatkit_types2 = require("@xpert-ai/chatkit-types");
|
|
218
236
|
function isRecord(value) {
|
|
219
237
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
220
238
|
}
|
|
221
239
|
function resolveHumanStateValue(value) {
|
|
222
|
-
const human = value?.[
|
|
240
|
+
const human = value?.[import_chatkit_types2.STATE_VARIABLE_HUMAN];
|
|
223
241
|
return isRecord(human) ? human : {};
|
|
224
242
|
}
|
|
225
243
|
function splitEnvCarrier(value) {
|
|
@@ -279,7 +297,7 @@ function buildInjectedRequestOptions(input) {
|
|
|
279
297
|
...input.humanInput ?? {}
|
|
280
298
|
};
|
|
281
299
|
if (Object.keys(mergedHumanState).length > 0) {
|
|
282
|
-
mergedState[
|
|
300
|
+
mergedState[import_chatkit_types2.STATE_VARIABLE_HUMAN] = mergedHumanState;
|
|
283
301
|
}
|
|
284
302
|
const hasState = Object.keys(mergedState).length > 0;
|
|
285
303
|
return {
|
|
@@ -294,7 +312,7 @@ var import_react2 = require("react");
|
|
|
294
312
|
|
|
295
313
|
// src/providers/ParentMessenger.tsx
|
|
296
314
|
var import_react = require("react");
|
|
297
|
-
var
|
|
315
|
+
var import_chatkit_types4 = require("@xpert-ai/chatkit-types");
|
|
298
316
|
|
|
299
317
|
// src/hooks/useStream.ts
|
|
300
318
|
var streamRef = { current: null };
|
|
@@ -309,7 +327,7 @@ function useStreamManager() {
|
|
|
309
327
|
}
|
|
310
328
|
|
|
311
329
|
// src/lib/message-metadata.ts
|
|
312
|
-
var
|
|
330
|
+
var import_chatkit_types3 = require("@xpert-ai/chatkit-types");
|
|
313
331
|
|
|
314
332
|
// src/lib/references.ts
|
|
315
333
|
function isObjectLike(value) {
|
|
@@ -737,11 +755,11 @@ function ParentMessengerProvider({
|
|
|
737
755
|
handledSendUserMessageEvents.add(event);
|
|
738
756
|
}
|
|
739
757
|
const params = payload.data;
|
|
740
|
-
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() : "";
|
|
741
759
|
const references = normalizeReferences(
|
|
742
|
-
params.references ?? params.state?.[
|
|
760
|
+
params.references ?? params.state?.[import_chatkit_types4.STATE_VARIABLE_HUMAN]?.references
|
|
743
761
|
);
|
|
744
|
-
const referenceComposition = params.referenceComposition ?? params.state?.[
|
|
762
|
+
const referenceComposition = params.referenceComposition ?? params.state?.[import_chatkit_types4.STATE_VARIABLE_HUMAN]?.referenceComposition;
|
|
745
763
|
const humanInput = buildHumanMessageInputPayload({
|
|
746
764
|
content: prompt,
|
|
747
765
|
references,
|
|
@@ -753,13 +771,13 @@ function ParentMessengerProvider({
|
|
|
753
771
|
}
|
|
754
772
|
return;
|
|
755
773
|
}
|
|
756
|
-
const runtimeCapabilitiesCandidate = params.runtimeCapabilities ?? params.state?.[
|
|
774
|
+
const runtimeCapabilitiesCandidate = params.runtimeCapabilities ?? params.state?.[import_chatkit_types4.STATE_VARIABLE_HUMAN]?.runtimeCapabilities;
|
|
757
775
|
const runtimeCapabilities = isRuntimeCapabilitiesSelection(
|
|
758
776
|
runtimeCapabilitiesCandidate
|
|
759
777
|
) ? runtimeCapabilitiesCandidate : void 0;
|
|
760
|
-
const requestHumanInput = params.planMode === true || params.state?.[
|
|
778
|
+
const requestHumanInput = params.planMode === true || params.state?.[import_chatkit_types4.STATE_VARIABLE_HUMAN]?.planMode === true || runtimeCapabilities ? {
|
|
761
779
|
...humanInput,
|
|
762
|
-
...params.planMode === true || params.state?.[
|
|
780
|
+
...params.planMode === true || params.state?.[import_chatkit_types4.STATE_VARIABLE_HUMAN]?.planMode === true ? { planMode: true } : {},
|
|
763
781
|
...runtimeCapabilities ? { runtimeCapabilities } : {}
|
|
764
782
|
} : humanInput;
|
|
765
783
|
const newMessage = {
|
|
@@ -1500,6 +1518,38 @@ var en_US_default = {
|
|
|
1500
1518
|
option: "Option",
|
|
1501
1519
|
other: "Other"
|
|
1502
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
|
+
},
|
|
1503
1553
|
toolGroup: {
|
|
1504
1554
|
status: {
|
|
1505
1555
|
running: "Processing",
|
|
@@ -1512,6 +1562,7 @@ var en_US_default = {
|
|
|
1512
1562
|
jsonTitle: "JSON",
|
|
1513
1563
|
jsonTree: "Tree",
|
|
1514
1564
|
jsonRaw: "Raw",
|
|
1565
|
+
sourcesTitle: "Sources",
|
|
1515
1566
|
copy: "Copy",
|
|
1516
1567
|
copied: "Copied",
|
|
1517
1568
|
separator: ", ",
|
|
@@ -1792,6 +1843,38 @@ var zh_CN_default = {
|
|
|
1792
1843
|
option: "\u9009\u9879",
|
|
1793
1844
|
other: "\u5176\u4ED6"
|
|
1794
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
|
+
},
|
|
1795
1878
|
toolGroup: {
|
|
1796
1879
|
status: {
|
|
1797
1880
|
running: "\u6B63\u5728\u5904\u7406",
|
|
@@ -1804,6 +1887,7 @@ var zh_CN_default = {
|
|
|
1804
1887
|
jsonTitle: "JSON",
|
|
1805
1888
|
jsonTree: "\u6811\u5F62",
|
|
1806
1889
|
jsonRaw: "\u539F\u59CB",
|
|
1890
|
+
sourcesTitle: "\u4FE1\u606F\u6E90",
|
|
1807
1891
|
copy: "\u590D\u5236",
|
|
1808
1892
|
copied: "\u5DF2\u590D\u5236",
|
|
1809
1893
|
separator: "\uFF0C",
|
|
@@ -3436,7 +3520,17 @@ function SlashPalette({
|
|
|
3436
3520
|
}
|
|
3437
3521
|
),
|
|
3438
3522
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "flex min-w-0 flex-1 items-baseline gap-2", children: [
|
|
3439
|
-
/* @__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
|
+
] }),
|
|
3440
3534
|
option.description && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "min-w-0 flex-1 truncate text-muted-foreground", children: option.description })
|
|
3441
3535
|
] }),
|
|
3442
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
|
|
@@ -6072,19 +6166,22 @@ function resolveRuntimeCapabilityPalette(value, selectionStart) {
|
|
|
6072
6166
|
return null;
|
|
6073
6167
|
}
|
|
6074
6168
|
const beforeCaret = value.slice(0, selectionStart);
|
|
6075
|
-
const match = /(^|\s)
|
|
6169
|
+
const match = /(^|\s)([/$])([^\s/]*)$/.exec(beforeCaret);
|
|
6076
6170
|
if (!match) {
|
|
6077
6171
|
return null;
|
|
6078
6172
|
}
|
|
6079
|
-
const
|
|
6173
|
+
const trigger = match[2];
|
|
6174
|
+
const query = match[3] ?? "";
|
|
6080
6175
|
const start = beforeCaret.length - query.length - 1;
|
|
6081
6176
|
const beforeTrigger = beforeCaret.slice(0, start);
|
|
6082
6177
|
return {
|
|
6178
|
+
trigger,
|
|
6083
6179
|
query,
|
|
6084
6180
|
start,
|
|
6085
6181
|
end: selectionStart,
|
|
6086
6182
|
activeIndex: 0,
|
|
6087
|
-
atMessageStart: beforeTrigger.trim().length === 0
|
|
6183
|
+
atMessageStart: beforeTrigger.trim().length === 0,
|
|
6184
|
+
...trigger === "$" ? { capabilityTypes: ["skill"] } : {}
|
|
6088
6185
|
};
|
|
6089
6186
|
}
|
|
6090
6187
|
function matchesQuery(values, query) {
|
|
@@ -6121,7 +6218,11 @@ function matchesCapability(option, query, capabilityTypes) {
|
|
|
6121
6218
|
if (capabilityTypes?.length && !capabilityTypes.includes(option.type)) {
|
|
6122
6219
|
return false;
|
|
6123
6220
|
}
|
|
6124
|
-
|
|
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
|
+
);
|
|
6125
6226
|
}
|
|
6126
6227
|
function getCommandPaletteOption(command) {
|
|
6127
6228
|
const capabilityType = CAPABILITY_GROUP_COMMANDS[command.name];
|
|
@@ -6668,8 +6769,279 @@ function useSlashCommands({
|
|
|
6668
6769
|
}
|
|
6669
6770
|
|
|
6670
6771
|
// src/components/thread/messages/ai.tsx
|
|
6671
|
-
var
|
|
6672
|
-
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
|
+
}
|
|
6673
7045
|
|
|
6674
7046
|
// src/components/ui/badge.tsx
|
|
6675
7047
|
var React24 = __toESM(require("react"), 1);
|
|
@@ -7870,9 +8242,406 @@ var MarkdownTextImpl = ({ children }) => {
|
|
|
7870
8242
|
};
|
|
7871
8243
|
var MarkdownText = (0, import_react6.memo)(MarkdownTextImpl);
|
|
7872
8244
|
|
|
7873
|
-
// src/components/thread/messages/
|
|
8245
|
+
// src/components/thread/messages/agent-run-group.tsx
|
|
7874
8246
|
var React28 = __toESM(require("react"), 1);
|
|
7875
8247
|
var import_lucide_react16 = require("lucide-react");
|
|
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");
|
|
7876
8645
|
|
|
7877
8646
|
// src/i18n/localized-text.ts
|
|
7878
8647
|
function resolveLocalizedText(value, language) {
|
|
@@ -7924,19 +8693,19 @@ function resolveLocalizedText(value, language) {
|
|
|
7924
8693
|
}
|
|
7925
8694
|
|
|
7926
8695
|
// src/components/thread/messages/tool-component-group.tsx
|
|
7927
|
-
var
|
|
8696
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
7928
8697
|
var toolStatusConfig = {
|
|
7929
8698
|
success: {
|
|
7930
8699
|
iconClass: "border-green-500 text-green-700",
|
|
7931
|
-
icon:
|
|
8700
|
+
icon: import_lucide_react17.CheckCircle2
|
|
7932
8701
|
},
|
|
7933
8702
|
fail: {
|
|
7934
8703
|
iconClass: "border-red-500 text-red-700",
|
|
7935
|
-
icon:
|
|
8704
|
+
icon: import_lucide_react17.XCircle
|
|
7936
8705
|
},
|
|
7937
8706
|
running: {
|
|
7938
8707
|
iconClass: "border-blue-500 text-blue-700",
|
|
7939
|
-
icon:
|
|
8708
|
+
icon: import_lucide_react17.Loader2
|
|
7940
8709
|
}
|
|
7941
8710
|
};
|
|
7942
8711
|
var TOOL_GROUP_CATEGORY_ORDER = [
|
|
@@ -8011,7 +8780,7 @@ function getEffectiveToolStepStatus(data, isThreadRunning) {
|
|
|
8011
8780
|
}
|
|
8012
8781
|
return data.status;
|
|
8013
8782
|
}
|
|
8014
|
-
function
|
|
8783
|
+
function formatStepDuration2(durationMs) {
|
|
8015
8784
|
if (durationMs < 1e3) {
|
|
8016
8785
|
return `${durationMs}ms`;
|
|
8017
8786
|
}
|
|
@@ -8030,10 +8799,10 @@ function formatStepDuration(durationMs) {
|
|
|
8030
8799
|
return `${minutes}m ${seconds}s`;
|
|
8031
8800
|
}
|
|
8032
8801
|
function useFrozenTimestamp(shouldFreeze) {
|
|
8033
|
-
const [frozenAt, setFrozenAt] =
|
|
8802
|
+
const [frozenAt, setFrozenAt] = React29.useState(
|
|
8034
8803
|
() => shouldFreeze ? Date.now() : null
|
|
8035
8804
|
);
|
|
8036
|
-
|
|
8805
|
+
React29.useEffect(() => {
|
|
8037
8806
|
if (shouldFreeze) {
|
|
8038
8807
|
setFrozenAt((current) => current ?? Date.now());
|
|
8039
8808
|
return;
|
|
@@ -8043,12 +8812,12 @@ function useFrozenTimestamp(shouldFreeze) {
|
|
|
8043
8812
|
return frozenAt;
|
|
8044
8813
|
}
|
|
8045
8814
|
function useToolStepDurationLabel(data, options) {
|
|
8046
|
-
const [durationNow, setDurationNow] =
|
|
8815
|
+
const [durationNow, setDurationNow] = React29.useState(() => Date.now());
|
|
8047
8816
|
const createdAt = parseStepDate(data.created_date);
|
|
8048
8817
|
const explicitEndedAt = parseStepDate(data.end_date);
|
|
8049
8818
|
const status = options?.status ?? data.status;
|
|
8050
8819
|
const endedAt = explicitEndedAt ?? (status !== "running" ? options?.fallbackEndedAt ?? null : null);
|
|
8051
|
-
|
|
8820
|
+
React29.useEffect(() => {
|
|
8052
8821
|
if (status !== "running" || createdAt === null || endedAt !== null) {
|
|
8053
8822
|
return;
|
|
8054
8823
|
}
|
|
@@ -8062,43 +8831,47 @@ function useToolStepDurationLabel(data, options) {
|
|
|
8062
8831
|
}, [createdAt, endedAt, status]);
|
|
8063
8832
|
if (createdAt === null) return null;
|
|
8064
8833
|
const durationMs = Math.max(0, (endedAt ?? durationNow) - createdAt);
|
|
8065
|
-
return
|
|
8834
|
+
return formatStepDuration2(durationMs);
|
|
8066
8835
|
}
|
|
8067
|
-
function
|
|
8836
|
+
function isComponentContent2(content) {
|
|
8068
8837
|
return content.type === "component";
|
|
8069
8838
|
}
|
|
8070
|
-
function
|
|
8839
|
+
function isTextContent2(content) {
|
|
8071
8840
|
return content.type === "text";
|
|
8072
8841
|
}
|
|
8073
|
-
function
|
|
8842
|
+
function isReasoningContent2(content) {
|
|
8074
8843
|
return content.type === "reasoning";
|
|
8075
8844
|
}
|
|
8076
8845
|
function isWidgetComponent(content) {
|
|
8077
8846
|
const data = content.data;
|
|
8078
8847
|
return data?.type === "Widget" && Array.isArray(data.widgets);
|
|
8079
8848
|
}
|
|
8080
|
-
function
|
|
8849
|
+
function isGroupableStepComponent(content) {
|
|
8081
8850
|
if (!content || typeof content === "string") return false;
|
|
8082
|
-
|
|
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";
|
|
8083
8856
|
}
|
|
8084
8857
|
function isSkippableToolGroupSeparator(content) {
|
|
8085
8858
|
if (typeof content === "string") return !content.trim();
|
|
8086
8859
|
if (!content) return true;
|
|
8087
|
-
if (
|
|
8860
|
+
if (isTextContent2(content)) {
|
|
8088
8861
|
return !content.text?.trim();
|
|
8089
8862
|
}
|
|
8090
|
-
if (
|
|
8863
|
+
if (isReasoningContent2(content)) {
|
|
8091
8864
|
return !content.text?.trim();
|
|
8092
8865
|
}
|
|
8093
8866
|
return false;
|
|
8094
8867
|
}
|
|
8095
|
-
function
|
|
8868
|
+
function normalizeToolToken2(value) {
|
|
8096
8869
|
if (typeof value !== "string") return null;
|
|
8097
8870
|
const normalized = value.trim().toLowerCase().replace(/[\s-]+/g, "_");
|
|
8098
8871
|
return normalized || null;
|
|
8099
8872
|
}
|
|
8100
8873
|
function classifyToolToken(value) {
|
|
8101
|
-
const normalized =
|
|
8874
|
+
const normalized = normalizeToolToken2(
|
|
8102
8875
|
typeof value === "string" ? value : resolveLocalizedText(value, "en-US")
|
|
8103
8876
|
);
|
|
8104
8877
|
if (!normalized) return null;
|
|
@@ -8137,8 +8910,8 @@ function getToolActivityLabel(content, language, statusOverride) {
|
|
|
8137
8910
|
if (status === "running") {
|
|
8138
8911
|
return message ?? title ?? tool ?? type ?? "Tool";
|
|
8139
8912
|
}
|
|
8140
|
-
const titleToken =
|
|
8141
|
-
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);
|
|
8142
8915
|
if (message && (!title || genericTitle)) {
|
|
8143
8916
|
return message;
|
|
8144
8917
|
}
|
|
@@ -8157,7 +8930,7 @@ function buildToolComponentRenderUnits(content, options) {
|
|
|
8157
8930
|
const units = [];
|
|
8158
8931
|
const pendingTools = [];
|
|
8159
8932
|
content.forEach((item, index) => {
|
|
8160
|
-
if (
|
|
8933
|
+
if (isGroupableStepComponent(item) && options?.shouldGroupComponent?.(item) !== false) {
|
|
8161
8934
|
pendingTools.push({ item, index });
|
|
8162
8935
|
return;
|
|
8163
8936
|
}
|
|
@@ -8222,13 +8995,13 @@ function createToolsetAvatarUrl(toolsetId, apiUrl) {
|
|
|
8222
8995
|
}
|
|
8223
8996
|
}
|
|
8224
8997
|
function shouldUseToolsetAvatar(toolset) {
|
|
8225
|
-
const normalized =
|
|
8998
|
+
const normalized = normalizeToolToken2(toolset);
|
|
8226
8999
|
return normalized === "mcp" || normalized === "openapi";
|
|
8227
9000
|
}
|
|
8228
9001
|
function useToolsetAvatar(toolsetId, enabled, apiUrl) {
|
|
8229
9002
|
const avatarUrl = enabled ? createToolsetAvatarUrl(toolsetId, apiUrl) : null;
|
|
8230
|
-
const [avatar, setAvatar] =
|
|
8231
|
-
|
|
9003
|
+
const [avatar, setAvatar] = React29.useState(null);
|
|
9004
|
+
React29.useEffect(() => {
|
|
8232
9005
|
if (!avatarUrl) {
|
|
8233
9006
|
setAvatar(null);
|
|
8234
9007
|
return;
|
|
@@ -8260,7 +9033,7 @@ function ToolAvatarIcon({
|
|
|
8260
9033
|
className
|
|
8261
9034
|
}) {
|
|
8262
9035
|
if (avatar.url) {
|
|
8263
|
-
return /* @__PURE__ */ (0,
|
|
9036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8264
9037
|
"img",
|
|
8265
9038
|
{
|
|
8266
9039
|
alt: "",
|
|
@@ -8273,7 +9046,7 @@ function ToolAvatarIcon({
|
|
|
8273
9046
|
}
|
|
8274
9047
|
const emoji = unicodeFromUnified2(avatar.emoji?.unified);
|
|
8275
9048
|
if (emoji) {
|
|
8276
|
-
return /* @__PURE__ */ (0,
|
|
9049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8277
9050
|
"span",
|
|
8278
9051
|
{
|
|
8279
9052
|
"aria-hidden": "true",
|
|
@@ -8288,8 +9061,8 @@ function ToolAvatarIcon({
|
|
|
8288
9061
|
}
|
|
8289
9062
|
);
|
|
8290
9063
|
}
|
|
8291
|
-
return /* @__PURE__ */ (0,
|
|
8292
|
-
|
|
9064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
9065
|
+
import_lucide_react17.CircleHelp,
|
|
8293
9066
|
{
|
|
8294
9067
|
className,
|
|
8295
9068
|
"aria-hidden": "true",
|
|
@@ -8298,40 +9071,42 @@ function ToolAvatarIcon({
|
|
|
8298
9071
|
);
|
|
8299
9072
|
}
|
|
8300
9073
|
function getKnownToolsetIcon(toolset) {
|
|
8301
|
-
const normalized =
|
|
9074
|
+
const normalized = normalizeToolToken2(toolset);
|
|
8302
9075
|
if (!normalized) return null;
|
|
8303
9076
|
switch (normalized) {
|
|
8304
9077
|
case "project":
|
|
8305
|
-
return
|
|
9078
|
+
return import_lucide_react17.Building2;
|
|
8306
9079
|
case "transfer_to":
|
|
8307
|
-
return
|
|
9080
|
+
return import_lucide_react17.Repeat2;
|
|
8308
9081
|
case "knowledge":
|
|
8309
9082
|
case "knowledgebase":
|
|
8310
|
-
return
|
|
9083
|
+
return import_lucide_react17.BookOpen;
|
|
8311
9084
|
case "project_tasks":
|
|
8312
|
-
return
|
|
9085
|
+
return import_lucide_react17.ListTodo;
|
|
8313
9086
|
case "memories":
|
|
8314
|
-
return
|
|
9087
|
+
return import_lucide_react17.Brain;
|
|
8315
9088
|
case "workflow_agent_tool":
|
|
8316
|
-
return
|
|
9089
|
+
return import_lucide_react17.Wrench;
|
|
8317
9090
|
case "workflow_task":
|
|
8318
|
-
return
|
|
9091
|
+
return import_lucide_react17.Network;
|
|
8319
9092
|
default:
|
|
8320
9093
|
return null;
|
|
8321
9094
|
}
|
|
8322
9095
|
}
|
|
8323
9096
|
function getStepTypeIcon(type) {
|
|
8324
|
-
const normalized =
|
|
9097
|
+
const normalized = normalizeToolToken2(type);
|
|
8325
9098
|
if (!normalized) return null;
|
|
8326
9099
|
switch (normalized) {
|
|
8327
9100
|
case "file":
|
|
8328
|
-
return
|
|
9101
|
+
return import_lucide_react17.FileText;
|
|
8329
9102
|
case "files":
|
|
8330
|
-
return
|
|
9103
|
+
return import_lucide_react17.Files;
|
|
8331
9104
|
case "program":
|
|
8332
|
-
return
|
|
9105
|
+
return import_lucide_react17.SquareTerminal;
|
|
9106
|
+
case "web_search":
|
|
9107
|
+
return import_lucide_react17.Search;
|
|
8333
9108
|
case "knowledges":
|
|
8334
|
-
return
|
|
9109
|
+
return import_lucide_react17.BookOpen;
|
|
8335
9110
|
default:
|
|
8336
9111
|
return null;
|
|
8337
9112
|
}
|
|
@@ -8349,12 +9124,12 @@ function ToolStepIcon({
|
|
|
8349
9124
|
apiUrl
|
|
8350
9125
|
);
|
|
8351
9126
|
const iconUrl = createToolsetIconUrl(data.toolset, organizationId, apiUrl);
|
|
8352
|
-
const [failedIconUrl, setFailedIconUrl] =
|
|
8353
|
-
|
|
9127
|
+
const [failedIconUrl, setFailedIconUrl] = React29.useState(null);
|
|
9128
|
+
React29.useEffect(() => {
|
|
8354
9129
|
setFailedIconUrl(null);
|
|
8355
9130
|
}, [iconUrl]);
|
|
8356
9131
|
if (avatar) {
|
|
8357
|
-
return /* @__PURE__ */ (0,
|
|
9132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8358
9133
|
ToolAvatarIcon,
|
|
8359
9134
|
{
|
|
8360
9135
|
avatar,
|
|
@@ -8364,7 +9139,7 @@ function ToolStepIcon({
|
|
|
8364
9139
|
);
|
|
8365
9140
|
}
|
|
8366
9141
|
if (iconUrl && failedIconUrl !== iconUrl) {
|
|
8367
|
-
return /* @__PURE__ */ (0,
|
|
9142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8368
9143
|
"img",
|
|
8369
9144
|
{
|
|
8370
9145
|
alt: "",
|
|
@@ -8378,7 +9153,7 @@ function ToolStepIcon({
|
|
|
8378
9153
|
}
|
|
8379
9154
|
const TypeIcon = getStepTypeIcon(data.type);
|
|
8380
9155
|
if (TypeIcon) {
|
|
8381
|
-
return /* @__PURE__ */ (0,
|
|
9156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8382
9157
|
TypeIcon,
|
|
8383
9158
|
{
|
|
8384
9159
|
className,
|
|
@@ -8389,7 +9164,7 @@ function ToolStepIcon({
|
|
|
8389
9164
|
}
|
|
8390
9165
|
const ToolsetIcon = getKnownToolsetIcon(data.toolset);
|
|
8391
9166
|
if (ToolsetIcon) {
|
|
8392
|
-
return /* @__PURE__ */ (0,
|
|
9167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8393
9168
|
ToolsetIcon,
|
|
8394
9169
|
{
|
|
8395
9170
|
className,
|
|
@@ -8399,8 +9174,8 @@ function ToolStepIcon({
|
|
|
8399
9174
|
);
|
|
8400
9175
|
}
|
|
8401
9176
|
if (usesToolsetAvatar) {
|
|
8402
|
-
return /* @__PURE__ */ (0,
|
|
8403
|
-
|
|
9177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
9178
|
+
import_lucide_react17.CircleHelp,
|
|
8404
9179
|
{
|
|
8405
9180
|
className,
|
|
8406
9181
|
"aria-hidden": "true",
|
|
@@ -8408,8 +9183,8 @@ function ToolStepIcon({
|
|
|
8408
9183
|
}
|
|
8409
9184
|
);
|
|
8410
9185
|
}
|
|
8411
|
-
return /* @__PURE__ */ (0,
|
|
8412
|
-
|
|
9186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
9187
|
+
import_lucide_react17.CircleHelp,
|
|
8413
9188
|
{
|
|
8414
9189
|
className,
|
|
8415
9190
|
"aria-hidden": "true",
|
|
@@ -8419,15 +9194,15 @@ function ToolStepIcon({
|
|
|
8419
9194
|
}
|
|
8420
9195
|
function ToolCallCopyButton({ value }) {
|
|
8421
9196
|
const { t } = useChatkitTranslation();
|
|
8422
|
-
const [isCopied, setIsCopied] =
|
|
8423
|
-
const resetTimeoutRef =
|
|
8424
|
-
const clearResetTimeout =
|
|
9197
|
+
const [isCopied, setIsCopied] = React29.useState(false);
|
|
9198
|
+
const resetTimeoutRef = React29.useRef(null);
|
|
9199
|
+
const clearResetTimeout = React29.useCallback(() => {
|
|
8425
9200
|
if (resetTimeoutRef.current === null) return;
|
|
8426
9201
|
window.clearTimeout(resetTimeoutRef.current);
|
|
8427
9202
|
resetTimeoutRef.current = null;
|
|
8428
9203
|
}, []);
|
|
8429
|
-
|
|
8430
|
-
const handleCopy =
|
|
9204
|
+
React29.useEffect(() => clearResetTimeout, [clearResetTimeout]);
|
|
9205
|
+
const handleCopy = React29.useCallback(() => {
|
|
8431
9206
|
if (typeof navigator === "undefined" || !navigator.clipboard) return;
|
|
8432
9207
|
void navigator.clipboard.writeText(value).then(() => {
|
|
8433
9208
|
setIsCopied(true);
|
|
@@ -8439,7 +9214,7 @@ function ToolCallCopyButton({ value }) {
|
|
|
8439
9214
|
}).catch(() => void 0);
|
|
8440
9215
|
}, [clearResetTimeout, value]);
|
|
8441
9216
|
const label = isCopied ? t("message.toolGroup.copied") : t("message.toolGroup.copy");
|
|
8442
|
-
return /* @__PURE__ */ (0,
|
|
9217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8443
9218
|
"button",
|
|
8444
9219
|
{
|
|
8445
9220
|
type: "button",
|
|
@@ -8447,7 +9222,7 @@ function ToolCallCopyButton({ value }) {
|
|
|
8447
9222
|
"aria-label": label,
|
|
8448
9223
|
title: label,
|
|
8449
9224
|
onClick: handleCopy,
|
|
8450
|
-
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" })
|
|
8451
9226
|
}
|
|
8452
9227
|
);
|
|
8453
9228
|
}
|
|
@@ -8458,28 +9233,28 @@ function ToolCallValueBlock({
|
|
|
8458
9233
|
const { t } = useChatkitTranslation();
|
|
8459
9234
|
const detected = detectJsonValue(value);
|
|
8460
9235
|
if (detected.kind === "text") {
|
|
8461
|
-
return /* @__PURE__ */ (0,
|
|
8462
|
-
/* @__PURE__ */ (0,
|
|
8463
|
-
/* @__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 })
|
|
8464
9239
|
] });
|
|
8465
9240
|
}
|
|
8466
|
-
return /* @__PURE__ */ (0,
|
|
8467
|
-
/* @__PURE__ */ (0,
|
|
8468
|
-
/* @__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: [
|
|
8469
9244
|
t("message.toolGroup.jsonTitle"),
|
|
8470
9245
|
" \xB7 ",
|
|
8471
9246
|
getJsonValueSummary(detected.value)
|
|
8472
9247
|
] }),
|
|
8473
|
-
/* @__PURE__ */ (0,
|
|
8474
|
-
/* @__PURE__ */ (0,
|
|
8475
|
-
/* @__PURE__ */ (0,
|
|
8476
|
-
/* @__PURE__ */ (0,
|
|
8477
|
-
/* @__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") })
|
|
8478
9253
|
] })
|
|
8479
9254
|
] })
|
|
8480
9255
|
] }),
|
|
8481
|
-
/* @__PURE__ */ (0,
|
|
8482
|
-
/* @__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 }) })
|
|
8483
9258
|
] });
|
|
8484
9259
|
}
|
|
8485
9260
|
function DefaultToolCallOutput({ data }) {
|
|
@@ -8487,31 +9262,37 @@ function DefaultToolCallOutput({ data }) {
|
|
|
8487
9262
|
const output = data.output ?? null;
|
|
8488
9263
|
const error = data.error ?? null;
|
|
8489
9264
|
if (error) {
|
|
8490
|
-
return /* @__PURE__ */ (0,
|
|
8491
|
-
/* @__PURE__ */ (0,
|
|
8492
|
-
/* @__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 })
|
|
8493
9268
|
] });
|
|
8494
9269
|
}
|
|
8495
9270
|
if (output === null) return null;
|
|
8496
|
-
return /* @__PURE__ */ (0,
|
|
8497
|
-
/* @__PURE__ */ (0,
|
|
8498
|
-
/* @__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 })
|
|
8499
9274
|
] });
|
|
8500
9275
|
}
|
|
8501
9276
|
function ToolCallDetails({ content }) {
|
|
8502
9277
|
const { t } = useChatkitTranslation();
|
|
8503
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
|
+
}
|
|
8504
9285
|
const OutputRenderer = getToolCallOutputRenderer(data);
|
|
8505
9286
|
const hasInput = data.input !== void 0 && data.input !== null;
|
|
8506
9287
|
const hasOutput = data.error !== void 0 || data.output !== void 0;
|
|
8507
9288
|
if (!hasInput && !hasOutput) return null;
|
|
8508
|
-
return /* @__PURE__ */ (0,
|
|
8509
|
-
hasInput && /* @__PURE__ */ (0,
|
|
8510
|
-
/* @__PURE__ */ (0,
|
|
8511
|
-
/* @__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 })
|
|
8512
9293
|
] }),
|
|
8513
|
-
hasInput && hasOutput ? /* @__PURE__ */ (0,
|
|
8514
|
-
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
|
|
8515
9296
|
] });
|
|
8516
9297
|
}
|
|
8517
9298
|
function areToolCallRowPropsEqual(previous, next) {
|
|
@@ -8528,8 +9309,10 @@ function ToolCallRowContent({
|
|
|
8528
9309
|
const status = getEffectiveToolStepStatus(data, isThreadRunning);
|
|
8529
9310
|
const hasError = status === "fail" || Boolean(data.error);
|
|
8530
9311
|
const label = getToolActivityLabel(content, i18n2.language, status);
|
|
8531
|
-
const detailsId =
|
|
8532
|
-
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;
|
|
8533
9316
|
const fallbackEndedAt = useFrozenTimestamp(
|
|
8534
9317
|
data.status === "running" && status === "fail"
|
|
8535
9318
|
);
|
|
@@ -8537,14 +9320,14 @@ function ToolCallRowContent({
|
|
|
8537
9320
|
status,
|
|
8538
9321
|
fallbackEndedAt
|
|
8539
9322
|
});
|
|
8540
|
-
const [isExpanded, setIsExpanded] =
|
|
8541
|
-
|
|
9323
|
+
const [isExpanded, setIsExpanded] = React29.useState(false);
|
|
9324
|
+
React29.useEffect(() => {
|
|
8542
9325
|
if (status === "running" && data.output !== void 0) {
|
|
8543
9326
|
setIsExpanded(true);
|
|
8544
9327
|
}
|
|
8545
9328
|
}, [data.output, status]);
|
|
8546
|
-
return /* @__PURE__ */ (0,
|
|
8547
|
-
/* @__PURE__ */ (0,
|
|
9329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("li", { className: "min-w-0", children: [
|
|
9330
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
8548
9331
|
"button",
|
|
8549
9332
|
{
|
|
8550
9333
|
type: "button",
|
|
@@ -8561,7 +9344,7 @@ function ToolCallRowContent({
|
|
|
8561
9344
|
if (hasDetails) setIsExpanded((prev) => !prev);
|
|
8562
9345
|
},
|
|
8563
9346
|
children: [
|
|
8564
|
-
status ? /* @__PURE__ */ (0,
|
|
9347
|
+
status ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8565
9348
|
ToolStepIcon,
|
|
8566
9349
|
{
|
|
8567
9350
|
data,
|
|
@@ -8572,8 +9355,8 @@ function ToolCallRowContent({
|
|
|
8572
9355
|
hasError ? "text-destructive" : "text-muted-foreground"
|
|
8573
9356
|
)
|
|
8574
9357
|
}
|
|
8575
|
-
) : /* @__PURE__ */ (0,
|
|
8576
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
8577
9360
|
"span",
|
|
8578
9361
|
{
|
|
8579
9362
|
className: cn(
|
|
@@ -8584,9 +9367,9 @@ function ToolCallRowContent({
|
|
|
8584
9367
|
children: label
|
|
8585
9368
|
}
|
|
8586
9369
|
),
|
|
8587
|
-
durationLabel ? /* @__PURE__ */ (0,
|
|
8588
|
-
hasDetails ? /* @__PURE__ */ (0,
|
|
8589
|
-
|
|
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,
|
|
8590
9373
|
{
|
|
8591
9374
|
"aria-hidden": "true",
|
|
8592
9375
|
className: cn(
|
|
@@ -8598,10 +9381,10 @@ function ToolCallRowContent({
|
|
|
8598
9381
|
]
|
|
8599
9382
|
}
|
|
8600
9383
|
),
|
|
8601
|
-
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
|
|
8602
9385
|
] });
|
|
8603
9386
|
}
|
|
8604
|
-
var ToolCallRow =
|
|
9387
|
+
var ToolCallRow = React29.memo(ToolCallRowContent, areToolCallRowPropsEqual);
|
|
8605
9388
|
ToolCallRow.displayName = "ToolCallRow";
|
|
8606
9389
|
function ToolComponentGroup({
|
|
8607
9390
|
items,
|
|
@@ -8611,8 +9394,8 @@ function ToolComponentGroup({
|
|
|
8611
9394
|
apiUrl
|
|
8612
9395
|
}) {
|
|
8613
9396
|
const { t } = useChatkitTranslation();
|
|
8614
|
-
const contentId =
|
|
8615
|
-
const [isExpanded, setIsExpanded] =
|
|
9397
|
+
const contentId = React29.useId();
|
|
9398
|
+
const [isExpanded, setIsExpanded] = React29.useState(!hasFollowingItem);
|
|
8616
9399
|
const categoryCounts = getToolGroupCategoryCounts(items);
|
|
8617
9400
|
const categorySummary = TOOL_GROUP_CATEGORY_ORDER.flatMap((category) => {
|
|
8618
9401
|
const count = categoryCounts[category] ?? 0;
|
|
@@ -8627,11 +9410,11 @@ function ToolComponentGroup({
|
|
|
8627
9410
|
const summary = `${t("message.toolGroup.status.success")} ${categorySummary}`;
|
|
8628
9411
|
const config = toolStatusConfig.success;
|
|
8629
9412
|
const StatusIcon = config.icon;
|
|
8630
|
-
|
|
9413
|
+
React29.useEffect(() => {
|
|
8631
9414
|
setIsExpanded(!hasFollowingItem);
|
|
8632
9415
|
}, [hasFollowingItem, items.length]);
|
|
8633
|
-
return /* @__PURE__ */ (0,
|
|
8634
|
-
/* @__PURE__ */ (0,
|
|
9416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "px-1 py-1", children: [
|
|
9417
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
8635
9418
|
"button",
|
|
8636
9419
|
{
|
|
8637
9420
|
type: "button",
|
|
@@ -8640,8 +9423,8 @@ function ToolComponentGroup({
|
|
|
8640
9423
|
"aria-controls": contentId,
|
|
8641
9424
|
onClick: () => setIsExpanded((prev) => !prev),
|
|
8642
9425
|
children: [
|
|
8643
|
-
/* @__PURE__ */ (0,
|
|
8644
|
-
/* @__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)(
|
|
8645
9428
|
StatusIcon,
|
|
8646
9429
|
{
|
|
8647
9430
|
className: cn(
|
|
@@ -8650,10 +9433,10 @@ function ToolComponentGroup({
|
|
|
8650
9433
|
)
|
|
8651
9434
|
}
|
|
8652
9435
|
),
|
|
8653
|
-
/* @__PURE__ */ (0,
|
|
9436
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "truncate", children: summary })
|
|
8654
9437
|
] }),
|
|
8655
|
-
/* @__PURE__ */ (0,
|
|
8656
|
-
|
|
9438
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
9439
|
+
import_lucide_react17.ChevronRight,
|
|
8657
9440
|
{
|
|
8658
9441
|
"aria-hidden": "true",
|
|
8659
9442
|
className: cn(
|
|
@@ -8665,7 +9448,7 @@ function ToolComponentGroup({
|
|
|
8665
9448
|
]
|
|
8666
9449
|
}
|
|
8667
9450
|
),
|
|
8668
|
-
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)(
|
|
8669
9452
|
ToolCallRow,
|
|
8670
9453
|
{
|
|
8671
9454
|
content: item,
|
|
@@ -8679,10 +9462,10 @@ function ToolComponentGroup({
|
|
|
8679
9462
|
}
|
|
8680
9463
|
|
|
8681
9464
|
// src/components/thread/messages/request-user-input-result-card.tsx
|
|
8682
|
-
var
|
|
8683
|
-
var
|
|
8684
|
-
var
|
|
8685
|
-
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");
|
|
8686
9469
|
function isRecord2(value) {
|
|
8687
9470
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
8688
9471
|
}
|
|
@@ -8721,7 +9504,7 @@ function collectPotentialToolCalls(messages) {
|
|
|
8721
9504
|
function findRequestUserInputClientToolCallById(messages, id) {
|
|
8722
9505
|
if (!id) return null;
|
|
8723
9506
|
return collectPotentialToolCalls(messages).find(
|
|
8724
|
-
(call) => getToolCallId(call) === id && getToolCallName(call) ===
|
|
9507
|
+
(call) => getToolCallId(call) === id && getToolCallName(call) === import_chatkit_types6.REQUEST_USER_INPUT_TOOL_NAME
|
|
8725
9508
|
) ?? null;
|
|
8726
9509
|
}
|
|
8727
9510
|
function normalizeAnswer(value) {
|
|
@@ -8756,7 +9539,7 @@ function parseResultOutput(output) {
|
|
|
8756
9539
|
if (!isRecord2(result) || !Array.isArray(result.answers)) {
|
|
8757
9540
|
return null;
|
|
8758
9541
|
}
|
|
8759
|
-
const hasExplicitType = result.type ===
|
|
9542
|
+
const hasExplicitType = result.type === import_chatkit_types6.REQUEST_USER_INPUT_RESULT_TYPE;
|
|
8760
9543
|
const answers = result.answers.map(normalizeAnswer);
|
|
8761
9544
|
if (answers.some((answer) => answer === null)) {
|
|
8762
9545
|
return null;
|
|
@@ -8794,7 +9577,7 @@ function RequestUserInputResultCard({
|
|
|
8794
9577
|
className
|
|
8795
9578
|
}) {
|
|
8796
9579
|
const { t } = useChatkitTranslation();
|
|
8797
|
-
return /* @__PURE__ */ (0,
|
|
9580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
8798
9581
|
"section",
|
|
8799
9582
|
{
|
|
8800
9583
|
"aria-label": t("message.requestUserInputResult.title"),
|
|
@@ -8803,23 +9586,23 @@ function RequestUserInputResultCard({
|
|
|
8803
9586
|
className
|
|
8804
9587
|
),
|
|
8805
9588
|
children: [
|
|
8806
|
-
/* @__PURE__ */ (0,
|
|
8807
|
-
/* @__PURE__ */ (0,
|
|
8808
|
-
/* @__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") })
|
|
8809
9592
|
] }),
|
|
8810
|
-
/* @__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)(
|
|
8811
9594
|
"div",
|
|
8812
9595
|
{
|
|
8813
9596
|
className: "rounded-md bg-background/70 px-2.5 py-2",
|
|
8814
9597
|
children: [
|
|
8815
|
-
/* @__PURE__ */ (0,
|
|
8816
|
-
/* @__PURE__ */ (0,
|
|
8817
|
-
/* @__PURE__ */ (0,
|
|
8818
|
-
/* @__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(
|
|
8819
9602
|
answer.type === "other" ? "message.requestUserInputResult.other" : "message.requestUserInputResult.option"
|
|
8820
9603
|
) })
|
|
8821
9604
|
] }),
|
|
8822
|
-
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
|
|
8823
9606
|
]
|
|
8824
9607
|
},
|
|
8825
9608
|
`${answer.id}-${index}`
|
|
@@ -8831,18 +9614,18 @@ function RequestUserInputResultCard({
|
|
|
8831
9614
|
|
|
8832
9615
|
// src/components/thread/messages/widget.tsx
|
|
8833
9616
|
var import_a2ui_react = require("@xpert-ai/a2ui-react");
|
|
8834
|
-
var
|
|
9617
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
8835
9618
|
function WidgetMessage({ messageId, data }) {
|
|
8836
9619
|
const widgets = Array.isArray(data.widgets) ? data.widgets : [];
|
|
8837
9620
|
if (widgets.length === 0) return null;
|
|
8838
9621
|
const baseSurfaceId = `widget-${messageId}`;
|
|
8839
|
-
return /* @__PURE__ */ (0,
|
|
9622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "space-y-3", children: widgets.map((widget, index) => {
|
|
8840
9623
|
const config = widget?.config;
|
|
8841
9624
|
if (!config || typeof config !== "object") {
|
|
8842
9625
|
return null;
|
|
8843
9626
|
}
|
|
8844
9627
|
const surfaceId = widgets.length > 1 ? `${baseSurfaceId}-${index}` : baseSurfaceId;
|
|
8845
|
-
return /* @__PURE__ */ (0,
|
|
9628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8846
9629
|
import_a2ui_react.SurfaceRenderer,
|
|
8847
9630
|
{
|
|
8848
9631
|
surfaceId,
|
|
@@ -8854,17 +9637,18 @@ function WidgetMessage({ messageId, data }) {
|
|
|
8854
9637
|
}
|
|
8855
9638
|
|
|
8856
9639
|
// src/components/thread/messages/ai.tsx
|
|
8857
|
-
var
|
|
8858
|
-
|
|
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) {
|
|
8859
9643
|
return content.type === "text";
|
|
8860
9644
|
}
|
|
8861
|
-
function
|
|
9645
|
+
function isReasoningContent3(content) {
|
|
8862
9646
|
return content.type === "reasoning";
|
|
8863
9647
|
}
|
|
8864
9648
|
function isImageContent(content) {
|
|
8865
9649
|
return content.type === "image_url";
|
|
8866
9650
|
}
|
|
8867
|
-
function
|
|
9651
|
+
function isComponentContent3(content) {
|
|
8868
9652
|
return content.type === "component";
|
|
8869
9653
|
}
|
|
8870
9654
|
function isWidgetComponent2(content) {
|
|
@@ -8874,24 +9658,24 @@ function isWidgetComponent2(content) {
|
|
|
8874
9658
|
function isMemoryContent(content) {
|
|
8875
9659
|
return content.type === "memory";
|
|
8876
9660
|
}
|
|
8877
|
-
function
|
|
9661
|
+
function safeJson3(value) {
|
|
8878
9662
|
try {
|
|
8879
9663
|
return JSON.stringify(value, null, 2);
|
|
8880
9664
|
} catch {
|
|
8881
9665
|
return String(value);
|
|
8882
9666
|
}
|
|
8883
9667
|
}
|
|
8884
|
-
function
|
|
8885
|
-
return typeof value === "string" ? value :
|
|
9668
|
+
function formatDisplayValue3(value) {
|
|
9669
|
+
return typeof value === "string" ? value : safeJson3(value);
|
|
8886
9670
|
}
|
|
8887
9671
|
function ReasoningBlock({ reasoning }) {
|
|
8888
9672
|
const blocks = reasoning.filter((item) => item.text?.trim());
|
|
8889
9673
|
if (blocks.length === 0) return null;
|
|
8890
|
-
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)(
|
|
8891
9675
|
"div",
|
|
8892
9676
|
{
|
|
8893
9677
|
className: "rounded-lg border bg-muted/40 p-3 text-xs text-muted-foreground",
|
|
8894
|
-
children: /* @__PURE__ */ (0,
|
|
9678
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "whitespace-pre-wrap wrap-break-word leading-relaxed", children: item.text })
|
|
8895
9679
|
},
|
|
8896
9680
|
item.id ?? `reasoning-${index}`
|
|
8897
9681
|
)) });
|
|
@@ -8899,20 +9683,20 @@ function ReasoningBlock({ reasoning }) {
|
|
|
8899
9683
|
function ImageBlock({ content }) {
|
|
8900
9684
|
const imageUrl = typeof content.image_url === "string" ? content.image_url : typeof content.image_url?.url === "string" ? content.image_url.url : null;
|
|
8901
9685
|
if (!imageUrl) {
|
|
8902
|
-
return /* @__PURE__ */ (0,
|
|
8903
|
-
/* @__PURE__ */ (0,
|
|
8904
|
-
/* @__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) })
|
|
8905
9689
|
] });
|
|
8906
9690
|
}
|
|
8907
|
-
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" }) });
|
|
8908
9692
|
}
|
|
8909
9693
|
function MemoryBlock({ content }) {
|
|
8910
|
-
return /* @__PURE__ */ (0,
|
|
8911
|
-
/* @__PURE__ */ (0,
|
|
8912
|
-
/* @__PURE__ */ (0,
|
|
8913
|
-
/* @__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" })
|
|
8914
9698
|
] }),
|
|
8915
|
-
/* @__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 ?? []) }) })
|
|
8916
9700
|
] });
|
|
8917
9701
|
}
|
|
8918
9702
|
function parseStepDate2(value) {
|
|
@@ -8926,7 +9710,7 @@ function parseStepDate2(value) {
|
|
|
8926
9710
|
const timestamp = Date.parse(value);
|
|
8927
9711
|
return Number.isNaN(timestamp) ? null : timestamp;
|
|
8928
9712
|
}
|
|
8929
|
-
function
|
|
9713
|
+
function formatStepDuration3(durationMs) {
|
|
8930
9714
|
if (durationMs < 1e3) {
|
|
8931
9715
|
return `${durationMs}ms`;
|
|
8932
9716
|
}
|
|
@@ -8946,11 +9730,11 @@ function formatStepDuration2(durationMs) {
|
|
|
8946
9730
|
}
|
|
8947
9731
|
function ComponentBlock({ content }) {
|
|
8948
9732
|
const { i18n: i18n2 } = useChatkitTranslation();
|
|
8949
|
-
const [isExpanded, setIsExpanded] =
|
|
8950
|
-
const contentRef =
|
|
8951
|
-
const shouldAutoScrollRef =
|
|
8952
|
-
const previousScrollTopRef =
|
|
8953
|
-
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());
|
|
8954
9738
|
const data = getToolStepData(content);
|
|
8955
9739
|
const category = data.category ?? "Component";
|
|
8956
9740
|
const title = getToolActivityLabel(content, i18n2.language);
|
|
@@ -8963,11 +9747,11 @@ function ComponentBlock({ content }) {
|
|
|
8963
9747
|
const createdAt = parseStepDate2(data.created_date);
|
|
8964
9748
|
const endedAt = parseStepDate2(data.end_date);
|
|
8965
9749
|
const durationMs = createdAt === null ? null : Math.max(0, (endedAt ?? durationNow) - createdAt);
|
|
8966
|
-
const durationLabel = durationMs === null ? null :
|
|
8967
|
-
|
|
9750
|
+
const durationLabel = durationMs === null ? null : formatStepDuration3(durationMs);
|
|
9751
|
+
React31.useEffect(() => {
|
|
8968
9752
|
if (status === "running" && output !== null) setIsExpanded(true);
|
|
8969
9753
|
}, [status, output]);
|
|
8970
|
-
|
|
9754
|
+
React31.useEffect(() => {
|
|
8971
9755
|
if (status !== "running" || createdAt === null || endedAt !== null) {
|
|
8972
9756
|
return;
|
|
8973
9757
|
}
|
|
@@ -8979,7 +9763,7 @@ function ComponentBlock({ content }) {
|
|
|
8979
9763
|
window.clearInterval(timer);
|
|
8980
9764
|
};
|
|
8981
9765
|
}, [createdAt, endedAt, status]);
|
|
8982
|
-
|
|
9766
|
+
React31.useEffect(() => {
|
|
8983
9767
|
const element = contentRef.current;
|
|
8984
9768
|
if (!element) return;
|
|
8985
9769
|
previousScrollTopRef.current = element.scrollTop;
|
|
@@ -8999,7 +9783,7 @@ function ComponentBlock({ content }) {
|
|
|
8999
9783
|
element.removeEventListener("scroll", updateAutoScrollState);
|
|
9000
9784
|
};
|
|
9001
9785
|
}, [isExpanded]);
|
|
9002
|
-
|
|
9786
|
+
React31.useEffect(() => {
|
|
9003
9787
|
if (status !== "running") {
|
|
9004
9788
|
shouldAutoScrollRef.current = true;
|
|
9005
9789
|
return;
|
|
@@ -9012,25 +9796,25 @@ function ComponentBlock({ content }) {
|
|
|
9012
9796
|
}, [isExpanded, output, status]);
|
|
9013
9797
|
const config = status ? toolStatusConfig[status] : null;
|
|
9014
9798
|
const StatusIcon = config?.icon;
|
|
9015
|
-
return /* @__PURE__ */ (0,
|
|
9016
|
-
/* @__PURE__ */ (0,
|
|
9017
|
-
/* @__PURE__ */ (0,
|
|
9018
|
-
status && StatusIcon && /* @__PURE__ */ (0,
|
|
9019
|
-
/* @__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 })
|
|
9020
9804
|
] }),
|
|
9021
|
-
/* @__PURE__ */ (0,
|
|
9022
|
-
durationLabel && /* @__PURE__ */ (0,
|
|
9023
|
-
/* @__PURE__ */ (0,
|
|
9024
|
-
/* @__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 })
|
|
9025
9809
|
] }),
|
|
9026
|
-
/* @__PURE__ */ (0,
|
|
9027
|
-
/* @__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)(
|
|
9028
9812
|
"button",
|
|
9029
9813
|
{
|
|
9030
9814
|
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
9031
9815
|
"aria-label": isExpanded ? "Collapse" : "Expand",
|
|
9032
|
-
children: /* @__PURE__ */ (0,
|
|
9033
|
-
|
|
9816
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
9817
|
+
import_lucide_react19.ChevronDown,
|
|
9034
9818
|
{
|
|
9035
9819
|
className: cn("h-4 w-4 transition-transform", isExpanded && "rotate-180")
|
|
9036
9820
|
}
|
|
@@ -9039,61 +9823,82 @@ function ComponentBlock({ content }) {
|
|
|
9039
9823
|
)
|
|
9040
9824
|
] })
|
|
9041
9825
|
] }),
|
|
9042
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
9043
|
-
data.input && /* @__PURE__ */ (0,
|
|
9044
|
-
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) })
|
|
9045
9829
|
] })
|
|
9046
9830
|
] });
|
|
9047
9831
|
}
|
|
9048
9832
|
function UnknownBlock({ content }) {
|
|
9049
|
-
return /* @__PURE__ */ (0,
|
|
9050
|
-
/* @__PURE__ */ (0,
|
|
9051
|
-
/* @__PURE__ */ (0,
|
|
9052
|
-
/* @__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" })
|
|
9053
9837
|
] }),
|
|
9054
|
-
/* @__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) }) })
|
|
9055
9839
|
] });
|
|
9056
9840
|
}
|
|
9057
|
-
function renderContentItem(content, index, message, lookupMessages) {
|
|
9841
|
+
function renderContentItem(content, index, message, lookupMessages, options) {
|
|
9058
9842
|
const messageId = message.id;
|
|
9843
|
+
const textClassName = options?.isAgentOutput ? "text-sm [&_.markdown-content_p]:!leading-6" : void 0;
|
|
9059
9844
|
if (typeof content === "string") {
|
|
9060
|
-
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}`);
|
|
9061
9846
|
}
|
|
9062
|
-
if (
|
|
9063
|
-
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}`);
|
|
9064
9849
|
}
|
|
9065
|
-
if (
|
|
9066
|
-
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}`);
|
|
9067
9852
|
}
|
|
9068
9853
|
if (isImageContent(content)) {
|
|
9069
|
-
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}`);
|
|
9070
9855
|
}
|
|
9071
|
-
if (
|
|
9856
|
+
if (isComponentContent3(content)) {
|
|
9072
9857
|
const requestUserInputResult = getRequestUserInputResultCardData(
|
|
9073
9858
|
content,
|
|
9074
9859
|
lookupMessages
|
|
9075
9860
|
);
|
|
9076
9861
|
if (requestUserInputResult) {
|
|
9077
|
-
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}`);
|
|
9078
9863
|
}
|
|
9079
9864
|
if (isWidgetComponent2(content)) {
|
|
9080
|
-
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}`);
|
|
9866
|
+
}
|
|
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}`);
|
|
9081
9878
|
}
|
|
9082
|
-
return /* @__PURE__ */ (0,
|
|
9879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ComponentBlock, { content }) }, content.id ?? `component-${index}`);
|
|
9083
9880
|
}
|
|
9084
9881
|
if (isMemoryContent(content)) {
|
|
9085
|
-
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}`);
|
|
9086
9886
|
}
|
|
9087
|
-
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}`);
|
|
9088
9888
|
}
|
|
9089
9889
|
function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, options) {
|
|
9090
9890
|
if (unit.type === "item") {
|
|
9091
|
-
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
|
+
});
|
|
9092
9897
|
}
|
|
9093
|
-
return /* @__PURE__ */ (0,
|
|
9898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
9094
9899
|
"div",
|
|
9095
9900
|
{
|
|
9096
|
-
children: /* @__PURE__ */ (0,
|
|
9901
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
9097
9902
|
ToolComponentGroup,
|
|
9098
9903
|
{
|
|
9099
9904
|
items: unit.items,
|
|
@@ -9107,17 +9912,91 @@ function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, opti
|
|
|
9107
9912
|
`tool-group-${unit.startIndex}-${unit.items[0]?.id ?? "tool"}-${unit.items.length}`
|
|
9108
9913
|
);
|
|
9109
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
|
+
}
|
|
9110
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
|
+
}
|
|
9111
9990
|
const content = message.content;
|
|
9112
9991
|
if (typeof content === "string") {
|
|
9113
9992
|
if (!content.trim()) return null;
|
|
9114
|
-
return /* @__PURE__ */ (0,
|
|
9993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(MarkdownText, { children: content });
|
|
9115
9994
|
}
|
|
9116
9995
|
if (!Array.isArray(content) || content.length === 0) return null;
|
|
9117
9996
|
const renderUnits = buildToolComponentRenderUnits(content, {
|
|
9118
9997
|
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null
|
|
9119
9998
|
});
|
|
9120
|
-
return /* @__PURE__ */ (0,
|
|
9999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "space-y-3", children: renderUnits.map(
|
|
9121
10000
|
(unit, index) => renderContentUnit(
|
|
9122
10001
|
unit,
|
|
9123
10002
|
message,
|
|
@@ -9137,20 +10016,29 @@ function AssistantStreamingIndicator({
|
|
|
9137
10016
|
thinking: t("message.thinking"),
|
|
9138
10017
|
answering: t("message.answering")
|
|
9139
10018
|
};
|
|
9140
|
-
return /* @__PURE__ */ (0,
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9147
|
-
|
|
9148
|
-
|
|
9149
|
-
|
|
9150
|
-
|
|
9151
|
-
|
|
9152
|
-
|
|
9153
|
-
|
|
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
|
+
);
|
|
9154
10042
|
}
|
|
9155
10043
|
function AssistantMessage({
|
|
9156
10044
|
message,
|
|
@@ -9163,8 +10051,12 @@ function AssistantMessage({
|
|
|
9163
10051
|
apiUrl
|
|
9164
10052
|
}) {
|
|
9165
10053
|
const { t } = useChatkitTranslation();
|
|
9166
|
-
const
|
|
9167
|
-
|
|
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);
|
|
9168
10060
|
const resolvedStreamingStatus = streamingStatus ?? getAssistantStreamingStatus(message, isStreaming);
|
|
9169
10061
|
const lookupMessages = messages?.length ? messages : [message];
|
|
9170
10062
|
const answerNode = renderContent(message, lookupMessages, {
|
|
@@ -9172,42 +10064,42 @@ function AssistantMessage({
|
|
|
9172
10064
|
organizationId,
|
|
9173
10065
|
apiUrl
|
|
9174
10066
|
});
|
|
9175
|
-
const reasoningNode = hasReasoning ? /* @__PURE__ */ (0,
|
|
9176
|
-
if (!
|
|
10067
|
+
const reasoningNode = hasReasoning ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ReasoningBlock, { reasoning: rootReasoning ?? [] }) : null;
|
|
10068
|
+
if (!hasContent && !hasReasoning && !resolvedStreamingStatus) return null;
|
|
9177
10069
|
const streamingClass = isStreaming ? "streaming-active" : "";
|
|
9178
|
-
if (!
|
|
9179
|
-
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 }) });
|
|
9180
10072
|
}
|
|
9181
10073
|
if (hasContent && hasReasoning) {
|
|
9182
|
-
return /* @__PURE__ */ (0,
|
|
9183
|
-
/* @__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)(
|
|
9184
10076
|
Tabs,
|
|
9185
10077
|
{
|
|
9186
10078
|
defaultValue: message.status === "reasoning" ? "reasoning" : "answer",
|
|
9187
10079
|
className: "w-full",
|
|
9188
10080
|
children: [
|
|
9189
|
-
/* @__PURE__ */ (0,
|
|
9190
|
-
/* @__PURE__ */ (0,
|
|
9191
|
-
/* @__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") })
|
|
9192
10084
|
] }),
|
|
9193
|
-
/* @__PURE__ */ (0,
|
|
9194
|
-
/* @__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 })
|
|
9195
10087
|
]
|
|
9196
10088
|
}
|
|
9197
10089
|
),
|
|
9198
|
-
resolvedStreamingStatus ? /* @__PURE__ */ (0,
|
|
10090
|
+
resolvedStreamingStatus ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
9199
10091
|
] });
|
|
9200
10092
|
}
|
|
9201
|
-
return /* @__PURE__ */ (0,
|
|
10093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
9202
10094
|
hasReasoning ? reasoningNode : answerNode,
|
|
9203
|
-
resolvedStreamingStatus ? /* @__PURE__ */ (0,
|
|
10095
|
+
resolvedStreamingStatus ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
9204
10096
|
] });
|
|
9205
10097
|
}
|
|
9206
10098
|
|
|
9207
10099
|
// src/components/thread/MessageActions.tsx
|
|
9208
|
-
var
|
|
9209
|
-
var
|
|
9210
|
-
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");
|
|
9211
10103
|
function MessageActions({
|
|
9212
10104
|
content,
|
|
9213
10105
|
isAssistant = false,
|
|
@@ -9216,7 +10108,7 @@ function MessageActions({
|
|
|
9216
10108
|
className
|
|
9217
10109
|
}) {
|
|
9218
10110
|
const { t } = useChatkitTranslation();
|
|
9219
|
-
const [copied, setCopied] =
|
|
10111
|
+
const [copied, setCopied] = React32.useState(false);
|
|
9220
10112
|
const handleCopy = async () => {
|
|
9221
10113
|
try {
|
|
9222
10114
|
await navigator.clipboard.writeText(content);
|
|
@@ -9229,7 +10121,7 @@ function MessageActions({
|
|
|
9229
10121
|
if (isStreaming) {
|
|
9230
10122
|
return null;
|
|
9231
10123
|
}
|
|
9232
|
-
return /* @__PURE__ */ (0,
|
|
10124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
9233
10125
|
"div",
|
|
9234
10126
|
{
|
|
9235
10127
|
className: cn(
|
|
@@ -9237,7 +10129,7 @@ function MessageActions({
|
|
|
9237
10129
|
className
|
|
9238
10130
|
),
|
|
9239
10131
|
children: [
|
|
9240
|
-
/* @__PURE__ */ (0,
|
|
10132
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
9241
10133
|
"button",
|
|
9242
10134
|
{
|
|
9243
10135
|
type: "button",
|
|
@@ -9247,17 +10139,17 @@ function MessageActions({
|
|
|
9247
10139
|
copied && "text-green-500"
|
|
9248
10140
|
),
|
|
9249
10141
|
title: copied ? t("messageActions.copied") : t("messageActions.copy"),
|
|
9250
|
-
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 })
|
|
9251
10143
|
}
|
|
9252
10144
|
),
|
|
9253
|
-
isAssistant && onRetry && /* @__PURE__ */ (0,
|
|
10145
|
+
isAssistant && onRetry && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
9254
10146
|
"button",
|
|
9255
10147
|
{
|
|
9256
10148
|
type: "button",
|
|
9257
10149
|
onClick: onRetry,
|
|
9258
10150
|
className: "p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",
|
|
9259
10151
|
title: t("messageActions.regenerate"),
|
|
9260
|
-
children: /* @__PURE__ */ (0,
|
|
10152
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react20.RefreshCw, { size: 14 })
|
|
9261
10153
|
}
|
|
9262
10154
|
)
|
|
9263
10155
|
]
|
|
@@ -9266,20 +10158,20 @@ function MessageActions({
|
|
|
9266
10158
|
}
|
|
9267
10159
|
|
|
9268
10160
|
// src/components/thread/StartScreen.tsx
|
|
9269
|
-
var
|
|
9270
|
-
var
|
|
9271
|
-
var
|
|
10161
|
+
var React33 = require("react");
|
|
10162
|
+
var import_lucide_react21 = require("lucide-react");
|
|
10163
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
9272
10164
|
function getIconComponent2(icon) {
|
|
9273
10165
|
const iconMap = {
|
|
9274
|
-
"circle-question": /* @__PURE__ */ (0,
|
|
9275
|
-
"lightbulb": /* @__PURE__ */ (0,
|
|
9276
|
-
"sparkle": /* @__PURE__ */ (0,
|
|
9277
|
-
"write": /* @__PURE__ */ (0,
|
|
9278
|
-
"search": /* @__PURE__ */ (0,
|
|
9279
|
-
"globe": /* @__PURE__ */ (0,
|
|
9280
|
-
"book-open": /* @__PURE__ */ (0,
|
|
9281
|
-
"compass": /* @__PURE__ */ (0,
|
|
9282
|
-
"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 })
|
|
9283
10175
|
};
|
|
9284
10176
|
return icon ? iconMap[icon] || iconMap["sparkle"] : iconMap["sparkle"];
|
|
9285
10177
|
}
|
|
@@ -9287,9 +10179,9 @@ function StartScreen({ startScreen, onPromptClick, className }) {
|
|
|
9287
10179
|
const { t } = useChatkitTranslation();
|
|
9288
10180
|
const greeting = startScreen?.greeting ?? t("startScreen.greeting");
|
|
9289
10181
|
const prompts = startScreen?.prompts ?? [];
|
|
9290
|
-
return /* @__PURE__ */ (0,
|
|
9291
|
-
/* @__PURE__ */ (0,
|
|
9292
|
-
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)(
|
|
9293
10185
|
"button",
|
|
9294
10186
|
{
|
|
9295
10187
|
type: "button",
|
|
@@ -9300,8 +10192,8 @@ function StartScreen({ startScreen, onPromptClick, className }) {
|
|
|
9300
10192
|
"focus:outline-none focus:ring-2 focus:ring-primary/20"
|
|
9301
10193
|
),
|
|
9302
10194
|
children: [
|
|
9303
|
-
/* @__PURE__ */ (0,
|
|
9304
|
-
/* @__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 })
|
|
9305
10197
|
]
|
|
9306
10198
|
},
|
|
9307
10199
|
`prompt-${index}`
|
|
@@ -9310,7 +10202,7 @@ function StartScreen({ startScreen, onPromptClick, className }) {
|
|
|
9310
10202
|
}
|
|
9311
10203
|
|
|
9312
10204
|
// src/hooks/useThreads.ts
|
|
9313
|
-
var
|
|
10205
|
+
var React34 = __toESM(require("react"), 1);
|
|
9314
10206
|
var DEFAULT_LIMIT = 50;
|
|
9315
10207
|
var getThreadTitle = (threadRecord) => {
|
|
9316
10208
|
const title = threadRecord.title?.trim();
|
|
@@ -9363,16 +10255,16 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9363
10255
|
isLoading: isStreamLoading,
|
|
9364
10256
|
error: streamError
|
|
9365
10257
|
} = useStreamContext();
|
|
9366
|
-
const [threadRecords, setThreadRecords] =
|
|
9367
|
-
const [isLoading, setIsLoading] =
|
|
9368
|
-
const [error, setError] =
|
|
9369
|
-
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) => {
|
|
9370
10262
|
setThreadRecords((prev) => {
|
|
9371
10263
|
const next = prev.filter((item) => item.id !== threadRecord.id);
|
|
9372
10264
|
return sortThreadRecords([threadRecord, ...next]);
|
|
9373
10265
|
});
|
|
9374
10266
|
}, []);
|
|
9375
|
-
const refreshThreads =
|
|
10267
|
+
const refreshThreads = React34.useCallback(async () => {
|
|
9376
10268
|
setIsLoading(true);
|
|
9377
10269
|
setError(null);
|
|
9378
10270
|
try {
|
|
@@ -9388,7 +10280,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9388
10280
|
setIsLoading(false);
|
|
9389
10281
|
}
|
|
9390
10282
|
}, [client, limit, assistantId]);
|
|
9391
|
-
const createThread =
|
|
10283
|
+
const createThread = React34.useCallback(
|
|
9392
10284
|
async (input) => {
|
|
9393
10285
|
setError(null);
|
|
9394
10286
|
const payload = {};
|
|
@@ -9402,7 +10294,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9402
10294
|
},
|
|
9403
10295
|
[client, upsertThreadRecord]
|
|
9404
10296
|
);
|
|
9405
|
-
const updateThread =
|
|
10297
|
+
const updateThread = React34.useCallback(
|
|
9406
10298
|
async (recordId, payload) => {
|
|
9407
10299
|
setError(null);
|
|
9408
10300
|
const updated = await client.conversations.update(recordId, payload);
|
|
@@ -9411,7 +10303,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9411
10303
|
},
|
|
9412
10304
|
[client, upsertThreadRecord]
|
|
9413
10305
|
);
|
|
9414
|
-
const deleteThread =
|
|
10306
|
+
const deleteThread = React34.useCallback(
|
|
9415
10307
|
async (recordId) => {
|
|
9416
10308
|
setError(null);
|
|
9417
10309
|
await client.conversations.delete(recordId);
|
|
@@ -9419,11 +10311,11 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9419
10311
|
},
|
|
9420
10312
|
[client]
|
|
9421
10313
|
);
|
|
9422
|
-
|
|
10314
|
+
React34.useEffect(() => {
|
|
9423
10315
|
if (!isReady) return;
|
|
9424
10316
|
void refreshThreads();
|
|
9425
10317
|
}, [refreshThreads, isReady]);
|
|
9426
|
-
|
|
10318
|
+
React34.useEffect(() => {
|
|
9427
10319
|
if (!threadId || !isStreamLoading) return;
|
|
9428
10320
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
9429
10321
|
const busyStatus = "busy";
|
|
@@ -9444,7 +10336,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9444
10336
|
return changed ? sortThreadRecords(next) : prev;
|
|
9445
10337
|
});
|
|
9446
10338
|
}, [threadId, isStreamLoading]);
|
|
9447
|
-
|
|
10339
|
+
React34.useEffect(() => {
|
|
9448
10340
|
const message = getErrorMessage(streamError)?.trim();
|
|
9449
10341
|
if (!threadId || !message) return;
|
|
9450
10342
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -9466,7 +10358,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9466
10358
|
return changed ? sortThreadRecords(next) : prev;
|
|
9467
10359
|
});
|
|
9468
10360
|
}, [threadId, streamError]);
|
|
9469
|
-
|
|
10361
|
+
React34.useEffect(() => {
|
|
9470
10362
|
if (!isReady || !threadId || isStreamLoading) return;
|
|
9471
10363
|
let cancelled = false;
|
|
9472
10364
|
void client.conversations.search({ where: { threadId }, limit: 1 }).then((result) => {
|
|
@@ -9480,7 +10372,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9480
10372
|
cancelled = true;
|
|
9481
10373
|
};
|
|
9482
10374
|
}, [client, threadId, upsertThreadRecord, isReady, isStreamLoading]);
|
|
9483
|
-
const threads =
|
|
10375
|
+
const threads = React34.useMemo(
|
|
9484
10376
|
() => threadRecords.map((threadRecord) => toThreadItem(threadRecord)),
|
|
9485
10377
|
[threadRecords]
|
|
9486
10378
|
);
|
|
@@ -9497,10 +10389,10 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9497
10389
|
}
|
|
9498
10390
|
|
|
9499
10391
|
// src/components/thread/context-usage-indicator.tsx
|
|
9500
|
-
var
|
|
10392
|
+
var React35 = __toESM(require("react"), 1);
|
|
9501
10393
|
|
|
9502
10394
|
// src/components/ui/progress-circle.tsx
|
|
9503
|
-
var
|
|
10395
|
+
var import_jsx_runtime39 = (
|
|
9504
10396
|
// biome-ignore lint/a11y/useFocusableInteractive: false positive (progress + progressbar are not focusable interactives)
|
|
9505
10397
|
// biome-ignore lint/nursery/useAriaPropsSupportedByRole: biome rule at odds with mdn docs (presumed nursary bug with rule)
|
|
9506
10398
|
require("react/jsx-runtime")
|
|
@@ -9524,7 +10416,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
9524
10416
|
fill: "none",
|
|
9525
10417
|
strokeWidth
|
|
9526
10418
|
};
|
|
9527
|
-
return /* @__PURE__ */ (0,
|
|
10419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
9528
10420
|
"svg",
|
|
9529
10421
|
{
|
|
9530
10422
|
role: "progressbar",
|
|
@@ -9535,8 +10427,8 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
9535
10427
|
"aria-valuemax": 100,
|
|
9536
10428
|
...restSvgProps,
|
|
9537
10429
|
children: [
|
|
9538
|
-
/* @__PURE__ */ (0,
|
|
9539
|
-
/* @__PURE__ */ (0,
|
|
10430
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("circle", { ...commonParams, className: "stroke-current/25" }),
|
|
10431
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
9540
10432
|
"circle",
|
|
9541
10433
|
{
|
|
9542
10434
|
...commonParams,
|
|
@@ -9554,7 +10446,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
9554
10446
|
};
|
|
9555
10447
|
|
|
9556
10448
|
// src/components/thread/context-usage-indicator.tsx
|
|
9557
|
-
var
|
|
10449
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
9558
10450
|
var kNumberFormatter = new Intl.NumberFormat("en-US", {
|
|
9559
10451
|
minimumFractionDigits: 0,
|
|
9560
10452
|
maximumFractionDigits: 1
|
|
@@ -9587,20 +10479,20 @@ function ContextUsageIndicator({
|
|
|
9587
10479
|
}) {
|
|
9588
10480
|
const { t } = useChatkitTranslation();
|
|
9589
10481
|
const stream = useStreamContext();
|
|
9590
|
-
const [maxContextSize, setMaxContextSize] =
|
|
9591
|
-
const [usedContextSize, setUsedContextSize] =
|
|
9592
|
-
const [assistantAgentKey, setAssistantAgentKey] =
|
|
9593
|
-
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({
|
|
9594
10486
|
threadId: null,
|
|
9595
10487
|
agentKey: null,
|
|
9596
10488
|
usedTokens: null
|
|
9597
10489
|
});
|
|
9598
|
-
const realtimeUsage =
|
|
10490
|
+
const realtimeUsage = React35.useMemo(
|
|
9599
10491
|
() => getThreadContextUsage(stream.contextUsageByAgentKey, assistantAgentKey),
|
|
9600
10492
|
[assistantAgentKey, stream.contextUsageByAgentKey]
|
|
9601
10493
|
);
|
|
9602
10494
|
const realtimeUsedContextSize = getThreadContextUsageTotalTokens(realtimeUsage);
|
|
9603
|
-
|
|
10495
|
+
React35.useEffect(() => {
|
|
9604
10496
|
if (!stream.client || !stream.assistantId) {
|
|
9605
10497
|
setMaxContextSize(null);
|
|
9606
10498
|
setAssistantAgentKey(null);
|
|
@@ -9620,18 +10512,18 @@ function ContextUsageIndicator({
|
|
|
9620
10512
|
cancelled = true;
|
|
9621
10513
|
};
|
|
9622
10514
|
}, [stream.client, stream.assistantId]);
|
|
9623
|
-
|
|
10515
|
+
React35.useEffect(() => {
|
|
9624
10516
|
latestRealtimeUsageRef.current = {
|
|
9625
10517
|
threadId: stream.threadId ?? null,
|
|
9626
10518
|
agentKey: assistantAgentKey,
|
|
9627
10519
|
usedTokens: realtimeUsedContextSize
|
|
9628
10520
|
};
|
|
9629
10521
|
}, [assistantAgentKey, realtimeUsedContextSize, stream.threadId]);
|
|
9630
|
-
|
|
10522
|
+
React35.useEffect(() => {
|
|
9631
10523
|
if (realtimeUsedContextSize == null) return;
|
|
9632
10524
|
setUsedContextSize(realtimeUsedContextSize);
|
|
9633
10525
|
}, [realtimeUsedContextSize]);
|
|
9634
|
-
|
|
10526
|
+
React35.useEffect(() => {
|
|
9635
10527
|
if (!stream.client) {
|
|
9636
10528
|
setUsedContextSize(null);
|
|
9637
10529
|
return;
|
|
@@ -9696,8 +10588,8 @@ function ContextUsageIndicator({
|
|
|
9696
10588
|
});
|
|
9697
10589
|
const usageLabelWithSuffix = usageLabel.endsWith(":") ? usageLabel : `${usageLabel}:`;
|
|
9698
10590
|
const progressClassName = percent >= 90 ? "text-destructive" : percent >= 75 ? "text-amber-500" : "text-primary dark:text-zinc-300";
|
|
9699
|
-
return /* @__PURE__ */ (0,
|
|
9700
|
-
/* @__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)(
|
|
9701
10593
|
"button",
|
|
9702
10594
|
{
|
|
9703
10595
|
type: "button",
|
|
@@ -9706,31 +10598,31 @@ function ContextUsageIndicator({
|
|
|
9706
10598
|
className
|
|
9707
10599
|
),
|
|
9708
10600
|
"aria-label": `${usageLabelWithSuffix} ${usageFullLabel}. ${usageTokensLabel}`,
|
|
9709
|
-
children: /* @__PURE__ */ (0,
|
|
10601
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ProgressCircle, { value: percent, className: cn("size-3.5", progressClassName) })
|
|
9710
10602
|
}
|
|
9711
10603
|
) }),
|
|
9712
|
-
/* @__PURE__ */ (0,
|
|
9713
|
-
/* @__PURE__ */ (0,
|
|
9714
|
-
/* @__PURE__ */ (0,
|
|
9715
|
-
/* @__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 })
|
|
9716
10608
|
] })
|
|
9717
10609
|
] });
|
|
9718
10610
|
}
|
|
9719
10611
|
|
|
9720
10612
|
// src/components/pet/PetBridge.tsx
|
|
9721
|
-
var
|
|
9722
|
-
var
|
|
10613
|
+
var React36 = __toESM(require("react"), 1);
|
|
10614
|
+
var import_chatkit_types7 = require("@xpert-ai/chatkit-types");
|
|
9723
10615
|
function PetBridge({ pet, state }) {
|
|
9724
10616
|
const parentMessenger = useParentMessenger();
|
|
9725
10617
|
const sendEvent = parentMessenger?.sendEvent;
|
|
9726
|
-
const options =
|
|
9727
|
-
|
|
10618
|
+
const options = React36.useMemo(() => (0, import_chatkit_types7.normalizePetOptions)(pet), [pet]);
|
|
10619
|
+
React36.useEffect(() => {
|
|
9728
10620
|
if (!sendEvent) {
|
|
9729
10621
|
return;
|
|
9730
10622
|
}
|
|
9731
10623
|
sendEvent("pet_options_change", { pet: pet ?? null });
|
|
9732
10624
|
}, [sendEvent, pet]);
|
|
9733
|
-
|
|
10625
|
+
React36.useEffect(() => {
|
|
9734
10626
|
if (!sendEvent || !options) {
|
|
9735
10627
|
return;
|
|
9736
10628
|
}
|
|
@@ -9740,15 +10632,15 @@ function PetBridge({ pet, state }) {
|
|
|
9740
10632
|
}
|
|
9741
10633
|
|
|
9742
10634
|
// src/components/settings/SettingsSheet.tsx
|
|
9743
|
-
var
|
|
9744
|
-
var
|
|
10635
|
+
var React43 = __toESM(require("react"), 1);
|
|
10636
|
+
var import_lucide_react23 = require("lucide-react");
|
|
9745
10637
|
|
|
9746
10638
|
// src/components/ui/input.tsx
|
|
9747
|
-
var
|
|
9748
|
-
var
|
|
9749
|
-
var Input =
|
|
10639
|
+
var React37 = __toESM(require("react"), 1);
|
|
10640
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
10641
|
+
var Input = React37.forwardRef(
|
|
9750
10642
|
({ className, type, ...props }, ref) => {
|
|
9751
|
-
return /* @__PURE__ */ (0,
|
|
10643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
9752
10644
|
"input",
|
|
9753
10645
|
{
|
|
9754
10646
|
ref,
|
|
@@ -9765,20 +10657,20 @@ var Input = React36.forwardRef(
|
|
|
9765
10657
|
Input.displayName = "Input";
|
|
9766
10658
|
|
|
9767
10659
|
// src/components/ui/select.tsx
|
|
9768
|
-
var
|
|
10660
|
+
var React38 = require("react");
|
|
9769
10661
|
var import_radix_ui2 = require("radix-ui");
|
|
9770
|
-
var
|
|
9771
|
-
var
|
|
10662
|
+
var import_lucide_react22 = require("lucide-react");
|
|
10663
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
9772
10664
|
function Select({
|
|
9773
10665
|
...props
|
|
9774
10666
|
}) {
|
|
9775
|
-
return /* @__PURE__ */ (0,
|
|
10667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_radix_ui2.Select.Root, { "data-slot": "select", ...props });
|
|
9776
10668
|
}
|
|
9777
10669
|
function SelectGroup({
|
|
9778
10670
|
className,
|
|
9779
10671
|
...props
|
|
9780
10672
|
}) {
|
|
9781
|
-
return /* @__PURE__ */ (0,
|
|
10673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
9782
10674
|
import_radix_ui2.Select.Group,
|
|
9783
10675
|
{
|
|
9784
10676
|
"data-slot": "select-group",
|
|
@@ -9790,7 +10682,7 @@ function SelectGroup({
|
|
|
9790
10682
|
function SelectValue({
|
|
9791
10683
|
...props
|
|
9792
10684
|
}) {
|
|
9793
|
-
return /* @__PURE__ */ (0,
|
|
10685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_radix_ui2.Select.Value, { "data-slot": "select-value", ...props });
|
|
9794
10686
|
}
|
|
9795
10687
|
function SelectTrigger({
|
|
9796
10688
|
className,
|
|
@@ -9798,7 +10690,7 @@ function SelectTrigger({
|
|
|
9798
10690
|
children,
|
|
9799
10691
|
...props
|
|
9800
10692
|
}) {
|
|
9801
|
-
return /* @__PURE__ */ (0,
|
|
10693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
9802
10694
|
import_radix_ui2.Select.Trigger,
|
|
9803
10695
|
{
|
|
9804
10696
|
"data-slot": "select-trigger",
|
|
@@ -9810,7 +10702,7 @@ function SelectTrigger({
|
|
|
9810
10702
|
...props,
|
|
9811
10703
|
children: [
|
|
9812
10704
|
children,
|
|
9813
|
-
/* @__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" }) })
|
|
9814
10706
|
]
|
|
9815
10707
|
}
|
|
9816
10708
|
);
|
|
@@ -9822,7 +10714,7 @@ function SelectContent({
|
|
|
9822
10714
|
align = "center",
|
|
9823
10715
|
...props
|
|
9824
10716
|
}) {
|
|
9825
|
-
return /* @__PURE__ */ (0,
|
|
10717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_radix_ui2.Select.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
9826
10718
|
import_radix_ui2.Select.Content,
|
|
9827
10719
|
{
|
|
9828
10720
|
"data-slot": "select-content",
|
|
@@ -9832,8 +10724,8 @@ function SelectContent({
|
|
|
9832
10724
|
align,
|
|
9833
10725
|
...props,
|
|
9834
10726
|
children: [
|
|
9835
|
-
/* @__PURE__ */ (0,
|
|
9836
|
-
/* @__PURE__ */ (0,
|
|
10727
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SelectScrollUpButton, {}),
|
|
10728
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
9837
10729
|
import_radix_ui2.Select.Viewport,
|
|
9838
10730
|
{
|
|
9839
10731
|
"data-position": position,
|
|
@@ -9844,7 +10736,7 @@ function SelectContent({
|
|
|
9844
10736
|
children
|
|
9845
10737
|
}
|
|
9846
10738
|
),
|
|
9847
|
-
/* @__PURE__ */ (0,
|
|
10739
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SelectScrollDownButton, {})
|
|
9848
10740
|
]
|
|
9849
10741
|
}
|
|
9850
10742
|
) });
|
|
@@ -9854,7 +10746,7 @@ function SelectItem({
|
|
|
9854
10746
|
children,
|
|
9855
10747
|
...props
|
|
9856
10748
|
}) {
|
|
9857
|
-
return /* @__PURE__ */ (0,
|
|
10749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
9858
10750
|
import_radix_ui2.Select.Item,
|
|
9859
10751
|
{
|
|
9860
10752
|
"data-slot": "select-item",
|
|
@@ -9864,8 +10756,8 @@ function SelectItem({
|
|
|
9864
10756
|
),
|
|
9865
10757
|
...props,
|
|
9866
10758
|
children: [
|
|
9867
|
-
/* @__PURE__ */ (0,
|
|
9868
|
-
/* @__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 })
|
|
9869
10761
|
]
|
|
9870
10762
|
}
|
|
9871
10763
|
);
|
|
@@ -9874,7 +10766,7 @@ function SelectScrollUpButton({
|
|
|
9874
10766
|
className,
|
|
9875
10767
|
...props
|
|
9876
10768
|
}) {
|
|
9877
|
-
return /* @__PURE__ */ (0,
|
|
10769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
9878
10770
|
import_radix_ui2.Select.ScrollUpButton,
|
|
9879
10771
|
{
|
|
9880
10772
|
"data-slot": "select-scroll-up-button",
|
|
@@ -9883,8 +10775,8 @@ function SelectScrollUpButton({
|
|
|
9883
10775
|
className
|
|
9884
10776
|
),
|
|
9885
10777
|
...props,
|
|
9886
|
-
children: /* @__PURE__ */ (0,
|
|
9887
|
-
|
|
10778
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10779
|
+
import_lucide_react22.ChevronUpIcon,
|
|
9888
10780
|
{}
|
|
9889
10781
|
)
|
|
9890
10782
|
}
|
|
@@ -9894,7 +10786,7 @@ function SelectScrollDownButton({
|
|
|
9894
10786
|
className,
|
|
9895
10787
|
...props
|
|
9896
10788
|
}) {
|
|
9897
|
-
return /* @__PURE__ */ (0,
|
|
10789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
9898
10790
|
import_radix_ui2.Select.ScrollDownButton,
|
|
9899
10791
|
{
|
|
9900
10792
|
"data-slot": "select-scroll-down-button",
|
|
@@ -9903,8 +10795,8 @@ function SelectScrollDownButton({
|
|
|
9903
10795
|
className
|
|
9904
10796
|
),
|
|
9905
10797
|
...props,
|
|
9906
|
-
children: /* @__PURE__ */ (0,
|
|
9907
|
-
|
|
10798
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10799
|
+
import_lucide_react22.ChevronDownIcon,
|
|
9908
10800
|
{}
|
|
9909
10801
|
)
|
|
9910
10802
|
}
|
|
@@ -9912,9 +10804,9 @@ function SelectScrollDownButton({
|
|
|
9912
10804
|
}
|
|
9913
10805
|
|
|
9914
10806
|
// src/components/ui/slider.tsx
|
|
9915
|
-
var
|
|
10807
|
+
var React39 = __toESM(require("react"), 1);
|
|
9916
10808
|
var import_radix_ui3 = require("radix-ui");
|
|
9917
|
-
var
|
|
10809
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
9918
10810
|
function Slider({
|
|
9919
10811
|
className,
|
|
9920
10812
|
defaultValue,
|
|
@@ -9923,11 +10815,11 @@ function Slider({
|
|
|
9923
10815
|
max = 100,
|
|
9924
10816
|
...props
|
|
9925
10817
|
}) {
|
|
9926
|
-
const _values =
|
|
10818
|
+
const _values = React39.useMemo(
|
|
9927
10819
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
9928
10820
|
[value, defaultValue, min, max]
|
|
9929
10821
|
);
|
|
9930
|
-
return /* @__PURE__ */ (0,
|
|
10822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
9931
10823
|
import_radix_ui3.Slider.Root,
|
|
9932
10824
|
{
|
|
9933
10825
|
"data-slot": "slider",
|
|
@@ -9941,12 +10833,12 @@ function Slider({
|
|
|
9941
10833
|
),
|
|
9942
10834
|
...props,
|
|
9943
10835
|
children: [
|
|
9944
|
-
/* @__PURE__ */ (0,
|
|
10836
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9945
10837
|
import_radix_ui3.Slider.Track,
|
|
9946
10838
|
{
|
|
9947
10839
|
"data-slot": "slider-track",
|
|
9948
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",
|
|
9949
|
-
children: /* @__PURE__ */ (0,
|
|
10841
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9950
10842
|
import_radix_ui3.Slider.Range,
|
|
9951
10843
|
{
|
|
9952
10844
|
"data-slot": "slider-range",
|
|
@@ -9955,7 +10847,7 @@ function Slider({
|
|
|
9955
10847
|
)
|
|
9956
10848
|
}
|
|
9957
10849
|
),
|
|
9958
|
-
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ (0,
|
|
10850
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9959
10851
|
import_radix_ui3.Slider.Thumb,
|
|
9960
10852
|
{
|
|
9961
10853
|
"data-slot": "slider-thumb",
|
|
@@ -9969,15 +10861,15 @@ function Slider({
|
|
|
9969
10861
|
}
|
|
9970
10862
|
|
|
9971
10863
|
// src/components/ui/toggle-group.tsx
|
|
9972
|
-
var
|
|
10864
|
+
var React41 = __toESM(require("react"), 1);
|
|
9973
10865
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
9974
10866
|
var import_radix_ui5 = require("radix-ui");
|
|
9975
10867
|
|
|
9976
10868
|
// src/components/ui/toggle.tsx
|
|
9977
|
-
var
|
|
10869
|
+
var React40 = require("react");
|
|
9978
10870
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
9979
10871
|
var import_radix_ui4 = require("radix-ui");
|
|
9980
|
-
var
|
|
10872
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
9981
10873
|
var toggleVariants = (0, import_class_variance_authority2.cva)(
|
|
9982
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",
|
|
9983
10875
|
{
|
|
@@ -10000,8 +10892,8 @@ var toggleVariants = (0, import_class_variance_authority2.cva)(
|
|
|
10000
10892
|
);
|
|
10001
10893
|
|
|
10002
10894
|
// src/components/ui/toggle-group.tsx
|
|
10003
|
-
var
|
|
10004
|
-
var ToggleGroupContext =
|
|
10895
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
10896
|
+
var ToggleGroupContext = React41.createContext({
|
|
10005
10897
|
size: "default",
|
|
10006
10898
|
variant: "default",
|
|
10007
10899
|
spacing: 0,
|
|
@@ -10016,7 +10908,7 @@ function ToggleGroup({
|
|
|
10016
10908
|
children,
|
|
10017
10909
|
...props
|
|
10018
10910
|
}) {
|
|
10019
|
-
return /* @__PURE__ */ (0,
|
|
10911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
10020
10912
|
import_radix_ui5.ToggleGroup.Root,
|
|
10021
10913
|
{
|
|
10022
10914
|
"data-slot": "toggle-group",
|
|
@@ -10030,7 +10922,7 @@ function ToggleGroup({
|
|
|
10030
10922
|
className
|
|
10031
10923
|
),
|
|
10032
10924
|
...props,
|
|
10033
|
-
children: /* @__PURE__ */ (0,
|
|
10925
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
10034
10926
|
ToggleGroupContext.Provider,
|
|
10035
10927
|
{
|
|
10036
10928
|
value: { variant, size: size2, spacing, orientation },
|
|
@@ -10047,8 +10939,8 @@ function ToggleGroupItem({
|
|
|
10047
10939
|
size: size2 = "default",
|
|
10048
10940
|
...props
|
|
10049
10941
|
}) {
|
|
10050
|
-
const context =
|
|
10051
|
-
return /* @__PURE__ */ (0,
|
|
10942
|
+
const context = React41.useContext(ToggleGroupContext);
|
|
10943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
10052
10944
|
import_radix_ui5.ToggleGroup.Item,
|
|
10053
10945
|
{
|
|
10054
10946
|
"data-slot": "toggle-group-item",
|
|
@@ -10070,7 +10962,7 @@ function ToggleGroupItem({
|
|
|
10070
10962
|
}
|
|
10071
10963
|
|
|
10072
10964
|
// src/components/pet/pet-local-settings.ts
|
|
10073
|
-
var
|
|
10965
|
+
var import_chatkit_types8 = require("@xpert-ai/chatkit-types");
|
|
10074
10966
|
|
|
10075
10967
|
// src/components/pet/builtinPets.ts
|
|
10076
10968
|
var PUBLIC_PETS = [
|
|
@@ -10244,7 +11136,7 @@ function derivePetLocalSettings(pet) {
|
|
|
10244
11136
|
if (!pet) {
|
|
10245
11137
|
return { ...DEFAULT_PET_LOCAL_SETTINGS };
|
|
10246
11138
|
}
|
|
10247
|
-
const normalized = (0,
|
|
11139
|
+
const normalized = (0, import_chatkit_types8.normalizePetOptions)(pet ?? null);
|
|
10248
11140
|
if (!normalized) {
|
|
10249
11141
|
return { ...DEFAULT_PET_LOCAL_SETTINGS };
|
|
10250
11142
|
}
|
|
@@ -10274,25 +11166,25 @@ function derivePetLocalSettings(pet) {
|
|
|
10274
11166
|
return base2;
|
|
10275
11167
|
}
|
|
10276
11168
|
function isPetEnabled(pet) {
|
|
10277
|
-
return Boolean((0,
|
|
11169
|
+
return Boolean((0, import_chatkit_types8.normalizePetOptions)(pet ?? null));
|
|
10278
11170
|
}
|
|
10279
11171
|
|
|
10280
11172
|
// src/components/pet/PetPreview.tsx
|
|
10281
|
-
var
|
|
11173
|
+
var React42 = require("react");
|
|
10282
11174
|
|
|
10283
11175
|
// src/components/pet/petSpriteAtlas.ts
|
|
10284
|
-
var
|
|
11176
|
+
var import_chatkit_types9 = require("@xpert-ai/chatkit-types");
|
|
10285
11177
|
|
|
10286
11178
|
// src/components/pet/PetPreview.tsx
|
|
10287
|
-
var
|
|
11179
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
10288
11180
|
function escapeCssUrl(value) {
|
|
10289
11181
|
return value.replace(/["\\]/g, "\\$&");
|
|
10290
11182
|
}
|
|
10291
11183
|
function PetPreview({ src, label, className }) {
|
|
10292
11184
|
const scale = 0.13;
|
|
10293
|
-
const width =
|
|
10294
|
-
const height =
|
|
10295
|
-
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)(
|
|
10296
11188
|
"span",
|
|
10297
11189
|
{
|
|
10298
11190
|
className: cn(
|
|
@@ -10301,7 +11193,7 @@ function PetPreview({ src, label, className }) {
|
|
|
10301
11193
|
),
|
|
10302
11194
|
"aria-hidden": "true",
|
|
10303
11195
|
title: label,
|
|
10304
|
-
children: /* @__PURE__ */ (0,
|
|
11196
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
10305
11197
|
"span",
|
|
10306
11198
|
{
|
|
10307
11199
|
className: "absolute left-1/2 top-1/2 block",
|
|
@@ -10312,7 +11204,7 @@ function PetPreview({ src, label, className }) {
|
|
|
10312
11204
|
transformOrigin: "center",
|
|
10313
11205
|
backgroundImage: `url("${escapeCssUrl(src)}")`,
|
|
10314
11206
|
backgroundRepeat: "no-repeat",
|
|
10315
|
-
backgroundSize: `${
|
|
11207
|
+
backgroundSize: `${import_chatkit_types9.petSpriteAtlas.columns * width}px ${import_chatkit_types9.petSpriteAtlas.rows * height}px`,
|
|
10316
11208
|
backgroundPosition: "0px 0px",
|
|
10317
11209
|
imageRendering: "auto"
|
|
10318
11210
|
}
|
|
@@ -10323,7 +11215,7 @@ function PetPreview({ src, label, className }) {
|
|
|
10323
11215
|
}
|
|
10324
11216
|
|
|
10325
11217
|
// src/components/settings/SettingsSheet.tsx
|
|
10326
|
-
var
|
|
11218
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
10327
11219
|
var CHARACTER_TYPES2 = [
|
|
10328
11220
|
"builtin",
|
|
10329
11221
|
"atlas"
|
|
@@ -10339,13 +11231,13 @@ function SettingsSheet({
|
|
|
10339
11231
|
onSave
|
|
10340
11232
|
}) {
|
|
10341
11233
|
const { t } = useChatkitTranslation();
|
|
10342
|
-
const [draft, setDraft] =
|
|
10343
|
-
|
|
11234
|
+
const [draft, setDraft] = React43.useState(settings);
|
|
11235
|
+
React43.useEffect(() => {
|
|
10344
11236
|
if (open) {
|
|
10345
11237
|
setDraft(petRequired ? { ...settings, enabled: true } : settings);
|
|
10346
11238
|
}
|
|
10347
11239
|
}, [open, petRequired, settings]);
|
|
10348
|
-
const updateDraft =
|
|
11240
|
+
const updateDraft = React43.useCallback(
|
|
10349
11241
|
(patch) => {
|
|
10350
11242
|
setDraft((previous) => ({ ...previous, ...patch }));
|
|
10351
11243
|
},
|
|
@@ -10363,23 +11255,23 @@ function SettingsSheet({
|
|
|
10363
11255
|
defaultValue: selectedBuiltinPet.label
|
|
10364
11256
|
}
|
|
10365
11257
|
);
|
|
10366
|
-
return /* @__PURE__ */ (0,
|
|
10367
|
-
/* @__PURE__ */ (0,
|
|
10368
|
-
/* @__PURE__ */ (0,
|
|
10369
|
-
/* @__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") })
|
|
10370
11262
|
] }) }),
|
|
10371
|
-
/* @__PURE__ */ (0,
|
|
10372
|
-
/* @__PURE__ */ (0,
|
|
10373
|
-
/* @__PURE__ */ (0,
|
|
10374
|
-
/* @__PURE__ */ (0,
|
|
10375
|
-
/* @__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") })
|
|
10376
11268
|
] }),
|
|
10377
|
-
/* @__PURE__ */ (0,
|
|
10378
|
-
/* @__PURE__ */ (0,
|
|
10379
|
-
/* @__PURE__ */ (0,
|
|
10380
|
-
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") })
|
|
10381
11273
|
] }),
|
|
10382
|
-
/* @__PURE__ */ (0,
|
|
11274
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10383
11275
|
"button",
|
|
10384
11276
|
{
|
|
10385
11277
|
type: "button",
|
|
@@ -10392,7 +11284,7 @@ function SettingsSheet({
|
|
|
10392
11284
|
draft.enabled ? "bg-primary" : "bg-muted-foreground/20",
|
|
10393
11285
|
petRequired ? "cursor-not-allowed opacity-70" : ""
|
|
10394
11286
|
].join(" "),
|
|
10395
|
-
children: /* @__PURE__ */ (0,
|
|
11287
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10396
11288
|
"span",
|
|
10397
11289
|
{
|
|
10398
11290
|
className: [
|
|
@@ -10405,9 +11297,9 @@ function SettingsSheet({
|
|
|
10405
11297
|
)
|
|
10406
11298
|
] })
|
|
10407
11299
|
] }),
|
|
10408
|
-
/* @__PURE__ */ (0,
|
|
10409
|
-
/* @__PURE__ */ (0,
|
|
10410
|
-
/* @__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)(
|
|
10411
11303
|
ToggleGroup,
|
|
10412
11304
|
{
|
|
10413
11305
|
id: "chatkit-pet-type",
|
|
@@ -10422,7 +11314,7 @@ function SettingsSheet({
|
|
|
10422
11314
|
variant: "outline",
|
|
10423
11315
|
spacing: 2,
|
|
10424
11316
|
className: "!w-full",
|
|
10425
|
-
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ (0,
|
|
11317
|
+
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10426
11318
|
ToggleGroupItem,
|
|
10427
11319
|
{
|
|
10428
11320
|
value: type,
|
|
@@ -10434,8 +11326,8 @@ function SettingsSheet({
|
|
|
10434
11326
|
}
|
|
10435
11327
|
)
|
|
10436
11328
|
] }),
|
|
10437
|
-
draft.characterType === "builtin" && /* @__PURE__ */ (0,
|
|
10438
|
-
/* @__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)(
|
|
10439
11331
|
"label",
|
|
10440
11332
|
{
|
|
10441
11333
|
htmlFor: "chatkit-pet-builtin",
|
|
@@ -10443,7 +11335,7 @@ function SettingsSheet({
|
|
|
10443
11335
|
children: t("pet.settings.builtin")
|
|
10444
11336
|
}
|
|
10445
11337
|
),
|
|
10446
|
-
/* @__PURE__ */ (0,
|
|
11338
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
10447
11339
|
Select,
|
|
10448
11340
|
{
|
|
10449
11341
|
value: selectedBuiltinPet.id,
|
|
@@ -10454,26 +11346,26 @@ function SettingsSheet({
|
|
|
10454
11346
|
}
|
|
10455
11347
|
},
|
|
10456
11348
|
children: [
|
|
10457
|
-
/* @__PURE__ */ (0,
|
|
11349
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10458
11350
|
SelectTrigger,
|
|
10459
11351
|
{
|
|
10460
11352
|
id: "chatkit-pet-builtin",
|
|
10461
11353
|
className: "min-h-12 w-full px-3 py-2",
|
|
10462
|
-
children: /* @__PURE__ */ (0,
|
|
11354
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SelectValue, { placeholder: selectedBuiltinPetLabel })
|
|
10463
11355
|
}
|
|
10464
11356
|
),
|
|
10465
|
-
/* @__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) => {
|
|
10466
11358
|
const label = t(`pet.settings.builtins.${pet.id}`, {
|
|
10467
11359
|
defaultValue: pet.label
|
|
10468
11360
|
});
|
|
10469
|
-
return /* @__PURE__ */ (0,
|
|
11361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10470
11362
|
SelectItem,
|
|
10471
11363
|
{
|
|
10472
11364
|
value: pet.id,
|
|
10473
11365
|
className: "min-h-10 py-1.5 pl-2 pr-8",
|
|
10474
|
-
children: /* @__PURE__ */ (0,
|
|
10475
|
-
/* @__PURE__ */ (0,
|
|
10476
|
-
/* @__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 })
|
|
10477
11369
|
] })
|
|
10478
11370
|
},
|
|
10479
11371
|
pet.id
|
|
@@ -10483,8 +11375,8 @@ function SettingsSheet({
|
|
|
10483
11375
|
}
|
|
10484
11376
|
)
|
|
10485
11377
|
] }),
|
|
10486
|
-
draft.characterType === "atlas" && /* @__PURE__ */ (0,
|
|
10487
|
-
/* @__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)(
|
|
10488
11380
|
"label",
|
|
10489
11381
|
{
|
|
10490
11382
|
className: "text-sm font-medium",
|
|
@@ -10492,7 +11384,7 @@ function SettingsSheet({
|
|
|
10492
11384
|
children: t("pet.settings.atlasUrl")
|
|
10493
11385
|
}
|
|
10494
11386
|
),
|
|
10495
|
-
/* @__PURE__ */ (0,
|
|
11387
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10496
11388
|
Input,
|
|
10497
11389
|
{
|
|
10498
11390
|
id: "chatkit-pet-atlas",
|
|
@@ -10502,15 +11394,15 @@ function SettingsSheet({
|
|
|
10502
11394
|
}
|
|
10503
11395
|
)
|
|
10504
11396
|
] }),
|
|
10505
|
-
/* @__PURE__ */ (0,
|
|
10506
|
-
/* @__PURE__ */ (0,
|
|
10507
|
-
/* @__PURE__ */ (0,
|
|
10508
|
-
/* @__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: [
|
|
10509
11401
|
draft.scale.toFixed(2),
|
|
10510
11402
|
"x"
|
|
10511
11403
|
] })
|
|
10512
11404
|
] }),
|
|
10513
|
-
/* @__PURE__ */ (0,
|
|
11405
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10514
11406
|
Slider,
|
|
10515
11407
|
{
|
|
10516
11408
|
id: "chatkit-pet-scale",
|
|
@@ -10524,8 +11416,8 @@ function SettingsSheet({
|
|
|
10524
11416
|
}
|
|
10525
11417
|
)
|
|
10526
11418
|
] }),
|
|
10527
|
-
/* @__PURE__ */ (0,
|
|
10528
|
-
/* @__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)(
|
|
10529
11421
|
"input",
|
|
10530
11422
|
{
|
|
10531
11423
|
type: "checkbox",
|
|
@@ -10536,8 +11428,8 @@ function SettingsSheet({
|
|
|
10536
11428
|
),
|
|
10537
11429
|
t("pet.settings.draggable")
|
|
10538
11430
|
] }),
|
|
10539
|
-
/* @__PURE__ */ (0,
|
|
10540
|
-
/* @__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)(
|
|
10541
11433
|
"input",
|
|
10542
11434
|
{
|
|
10543
11435
|
type: "checkbox",
|
|
@@ -10548,8 +11440,8 @@ function SettingsSheet({
|
|
|
10548
11440
|
),
|
|
10549
11441
|
t("pet.settings.persistPosition")
|
|
10550
11442
|
] }),
|
|
10551
|
-
/* @__PURE__ */ (0,
|
|
10552
|
-
/* @__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)(
|
|
10553
11445
|
Button,
|
|
10554
11446
|
{
|
|
10555
11447
|
type: "button",
|
|
@@ -10558,7 +11450,7 @@ function SettingsSheet({
|
|
|
10558
11450
|
children: t("pet.settings.cancel")
|
|
10559
11451
|
}
|
|
10560
11452
|
),
|
|
10561
|
-
/* @__PURE__ */ (0,
|
|
11453
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Button, { type: "submit", children: t("pet.settings.save") })
|
|
10562
11454
|
] })
|
|
10563
11455
|
] })
|
|
10564
11456
|
] }) });
|
|
@@ -11064,7 +11956,7 @@ function findDomPointForComposerOffset(root, offset) {
|
|
|
11064
11956
|
}
|
|
11065
11957
|
|
|
11066
11958
|
// src/components/chat.tsx
|
|
11067
|
-
var
|
|
11959
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
11068
11960
|
var import_meta2 = {};
|
|
11069
11961
|
var defaultApiUrl2 = import_meta2.env.VITE_XPERTAI_API_URL;
|
|
11070
11962
|
var COMPOSER_INPUT_MAX_HEIGHT = 128;
|
|
@@ -11197,8 +12089,8 @@ function ReferenceChip({
|
|
|
11197
12089
|
}) {
|
|
11198
12090
|
const metaLine = getReferenceMetaLine(reference);
|
|
11199
12091
|
const isComposer = variant === "composer";
|
|
11200
|
-
const Icon = reference.type === "quote" ?
|
|
11201
|
-
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)(
|
|
11202
12094
|
"div",
|
|
11203
12095
|
{
|
|
11204
12096
|
className: cn(
|
|
@@ -11207,7 +12099,7 @@ function ReferenceChip({
|
|
|
11207
12099
|
),
|
|
11208
12100
|
title: getReferenceTitle(reference),
|
|
11209
12101
|
children: [
|
|
11210
|
-
/* @__PURE__ */ (0,
|
|
12102
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
11211
12103
|
Icon,
|
|
11212
12104
|
{
|
|
11213
12105
|
size: isComposer ? 14 : 12,
|
|
@@ -11217,8 +12109,8 @@ function ReferenceChip({
|
|
|
11217
12109
|
)
|
|
11218
12110
|
}
|
|
11219
12111
|
),
|
|
11220
|
-
/* @__PURE__ */ (0,
|
|
11221
|
-
/* @__PURE__ */ (0,
|
|
12112
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
12113
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
11222
12114
|
"div",
|
|
11223
12115
|
{
|
|
11224
12116
|
className: cn(
|
|
@@ -11228,7 +12120,7 @@ function ReferenceChip({
|
|
|
11228
12120
|
children: getReferenceLabel(reference)
|
|
11229
12121
|
}
|
|
11230
12122
|
),
|
|
11231
|
-
metaLine && /* @__PURE__ */ (0,
|
|
12123
|
+
metaLine && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
11232
12124
|
"div",
|
|
11233
12125
|
{
|
|
11234
12126
|
className: cn(
|
|
@@ -11239,7 +12131,7 @@ function ReferenceChip({
|
|
|
11239
12131
|
}
|
|
11240
12132
|
)
|
|
11241
12133
|
] }),
|
|
11242
|
-
onRemove && removeLabel && /* @__PURE__ */ (0,
|
|
12134
|
+
onRemove && removeLabel && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
11243
12135
|
"button",
|
|
11244
12136
|
{
|
|
11245
12137
|
type: "button",
|
|
@@ -11250,7 +12142,7 @@ function ReferenceChip({
|
|
|
11250
12142
|
),
|
|
11251
12143
|
title: removeLabel,
|
|
11252
12144
|
"aria-label": removeLabel,
|
|
11253
|
-
children: /* @__PURE__ */ (0,
|
|
12145
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.X, { size: 12 })
|
|
11254
12146
|
}
|
|
11255
12147
|
)
|
|
11256
12148
|
]
|
|
@@ -11274,20 +12166,20 @@ function Chat({
|
|
|
11274
12166
|
const { setStream } = useStreamManager();
|
|
11275
12167
|
const stream = useStreamContext();
|
|
11276
12168
|
const { theme } = useTheme();
|
|
11277
|
-
const [isHistoryLoading, setIsHistoryLoading] =
|
|
11278
|
-
const [historyError, setHistoryError] =
|
|
11279
|
-
const [assistantName, setAssistantName] =
|
|
11280
|
-
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);
|
|
11281
12173
|
const LOADING_DOTS_MIN_DURATION = 800;
|
|
11282
12174
|
const STREAMING_STATUS_REFRESH_MS = 250;
|
|
11283
|
-
const [showLoadingDots, setShowLoadingDots] =
|
|
11284
|
-
const [streamingNow, setStreamingNow] =
|
|
11285
|
-
const loadingStartTimeRef =
|
|
11286
|
-
const lastStreamOutputAtRef =
|
|
11287
|
-
|
|
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(() => {
|
|
11288
12180
|
setStream(stream);
|
|
11289
12181
|
}, [setStream, stream]);
|
|
11290
|
-
|
|
12182
|
+
React44.useEffect(() => {
|
|
11291
12183
|
if (stream.isLoading) {
|
|
11292
12184
|
if (!loadingStartTimeRef.current) {
|
|
11293
12185
|
loadingStartTimeRef.current = Date.now();
|
|
@@ -11310,7 +12202,7 @@ function Chat({
|
|
|
11310
12202
|
}
|
|
11311
12203
|
}
|
|
11312
12204
|
}, [stream.isLoading]);
|
|
11313
|
-
|
|
12205
|
+
React44.useEffect(() => {
|
|
11314
12206
|
if (!stream.isLoading) {
|
|
11315
12207
|
lastStreamOutputAtRef.current = null;
|
|
11316
12208
|
setStreamingNow(Date.now());
|
|
@@ -11320,7 +12212,7 @@ function Chat({
|
|
|
11320
12212
|
lastStreamOutputAtRef.current = now;
|
|
11321
12213
|
setStreamingNow(now);
|
|
11322
12214
|
}, [stream.messages, stream.isLoading]);
|
|
11323
|
-
|
|
12215
|
+
React44.useEffect(() => {
|
|
11324
12216
|
if (!stream.isLoading) {
|
|
11325
12217
|
return;
|
|
11326
12218
|
}
|
|
@@ -11329,74 +12221,74 @@ function Chat({
|
|
|
11329
12221
|
}, STREAMING_STATUS_REFRESH_MS);
|
|
11330
12222
|
return () => window.clearInterval(timer);
|
|
11331
12223
|
}, [stream.isLoading]);
|
|
11332
|
-
const [composerParts, setComposerParts] =
|
|
11333
|
-
const [renderedComposerParts, setRenderedComposerParts] =
|
|
11334
|
-
const [composerDomVersion, setComposerDomVersion] =
|
|
11335
|
-
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(
|
|
11336
12228
|
null
|
|
11337
12229
|
);
|
|
11338
|
-
const [planModeEnabled, setPlanModeEnabled] =
|
|
11339
|
-
const [petSettingsOpen, setPetSettingsOpen] =
|
|
11340
|
-
const [petLocalSettings, setPetLocalSettings] =
|
|
11341
|
-
const [runtimeCapabilities, setRuntimeCapabilities] =
|
|
11342
|
-
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] =
|
|
11343
|
-
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(
|
|
11344
12236
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
11345
12237
|
);
|
|
11346
|
-
const [runRuntimeCapabilities, setRunRuntimeCapabilities] =
|
|
12238
|
+
const [runRuntimeCapabilities, setRunRuntimeCapabilities] = React44.useState(
|
|
11347
12239
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
11348
12240
|
);
|
|
11349
|
-
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] =
|
|
11350
|
-
const [attachments, setAttachments] =
|
|
11351
|
-
const [references, setReferences] =
|
|
11352
|
-
const [isUploadingReferenceImages, setIsUploadingReferenceImages] =
|
|
11353
|
-
const [quoteSelection, setQuoteSelection] =
|
|
11354
|
-
const [isAtBottom, setIsAtBottom] =
|
|
11355
|
-
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);
|
|
11356
12248
|
const {
|
|
11357
12249
|
threads,
|
|
11358
12250
|
deleteThread,
|
|
11359
12251
|
refreshThreads,
|
|
11360
12252
|
isLoading: isThreadsLoading
|
|
11361
12253
|
} = useThreads();
|
|
11362
|
-
const viewportRef =
|
|
11363
|
-
const fileInputRef =
|
|
11364
|
-
const composerInputRef =
|
|
11365
|
-
const slashPaletteRef =
|
|
11366
|
-
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(
|
|
11367
12259
|
[]
|
|
11368
12260
|
);
|
|
11369
|
-
const composerPartsRef =
|
|
11370
|
-
const pendingComposerCaretOffsetRef =
|
|
11371
|
-
const shouldAutoScrollRef =
|
|
11372
|
-
const forceFollowRef =
|
|
11373
|
-
const previousMessageCountRef =
|
|
11374
|
-
const previousScrollTopRef =
|
|
11375
|
-
const autoScrollFrameRef =
|
|
11376
|
-
const isPointerDownRef =
|
|
11377
|
-
const lastTouchYRef =
|
|
11378
|
-
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);
|
|
11379
12271
|
const resolvedTitle = title ?? t("chat.title");
|
|
11380
12272
|
const resolvedPlaceholder = placeholder ?? t("chat.placeholder");
|
|
11381
12273
|
const petRequired = options?.displayMode === "pet";
|
|
11382
|
-
const basePetSettings =
|
|
12274
|
+
const basePetSettings = React44.useMemo(
|
|
11383
12275
|
() => derivePetLocalSettings(options?.pet),
|
|
11384
12276
|
[options?.pet]
|
|
11385
12277
|
);
|
|
11386
|
-
const displayedPetSettings =
|
|
12278
|
+
const displayedPetSettings = React44.useMemo(
|
|
11387
12279
|
() => ({
|
|
11388
12280
|
...petLocalSettings ?? basePetSettings,
|
|
11389
12281
|
...petRequired ? { enabled: true } : {}
|
|
11390
12282
|
}),
|
|
11391
12283
|
[basePetSettings, petLocalSettings, petRequired]
|
|
11392
12284
|
);
|
|
11393
|
-
const effectivePet =
|
|
12285
|
+
const effectivePet = React44.useMemo(() => {
|
|
11394
12286
|
if (petRequired || petLocalSettings) {
|
|
11395
12287
|
return buildPetOptionsFromLocalSettings(displayedPetSettings);
|
|
11396
12288
|
}
|
|
11397
12289
|
return options?.pet ?? null;
|
|
11398
12290
|
}, [displayedPetSettings, options?.pet, petLocalSettings, petRequired]);
|
|
11399
|
-
const savePetLocalSettings =
|
|
12291
|
+
const savePetLocalSettings = React44.useCallback(
|
|
11400
12292
|
(settings) => {
|
|
11401
12293
|
const nextSettings = petRequired ? { ...settings, enabled: true } : settings;
|
|
11402
12294
|
setPetLocalSettings(nextSettings);
|
|
@@ -11404,7 +12296,7 @@ function Chat({
|
|
|
11404
12296
|
},
|
|
11405
12297
|
[petRequired]
|
|
11406
12298
|
);
|
|
11407
|
-
const handlePetCommand =
|
|
12299
|
+
const handlePetCommand = React44.useCallback(
|
|
11408
12300
|
(mode) => {
|
|
11409
12301
|
if (mode === "settings") {
|
|
11410
12302
|
setPetSettingsOpen(true);
|
|
@@ -11426,11 +12318,11 @@ function Chat({
|
|
|
11426
12318
|
[displayedPetSettings, effectivePet, petRequired, savePetLocalSettings]
|
|
11427
12319
|
);
|
|
11428
12320
|
const inputPlaceholder = selectedTool?.placeholderOverride ?? composer?.placeholder ?? resolvedPlaceholder;
|
|
11429
|
-
const messages =
|
|
12321
|
+
const messages = React44.useMemo(
|
|
11430
12322
|
() => stream.messages ?? [],
|
|
11431
12323
|
[stream.messages]
|
|
11432
12324
|
);
|
|
11433
|
-
const draft =
|
|
12325
|
+
const draft = React44.useMemo(
|
|
11434
12326
|
() => getComposerPlainText(composerParts),
|
|
11435
12327
|
[composerParts]
|
|
11436
12328
|
);
|
|
@@ -11442,7 +12334,7 @@ function Chat({
|
|
|
11442
12334
|
isEmpty: isComposerInputEmpty,
|
|
11443
12335
|
isStacked: isComposerStacked
|
|
11444
12336
|
});
|
|
11445
|
-
const pendingFollowUps =
|
|
12337
|
+
const pendingFollowUps = React44.useMemo(
|
|
11446
12338
|
() => [...stream.pendingFollowUps ?? []].sort(
|
|
11447
12339
|
(a, b) => a.createdAt - b.createdAt
|
|
11448
12340
|
),
|
|
@@ -11453,18 +12345,18 @@ function Chat({
|
|
|
11453
12345
|
const hasPendingHITLRequest = Boolean(stream.pendingHITLRequest);
|
|
11454
12346
|
const hasPendingInteractiveRequest = hasPendingRequestUserInput || hasPendingHITLRequest;
|
|
11455
12347
|
const hasPendingTodos = Boolean(stream.todos?.items.length);
|
|
11456
|
-
const runtimeCapabilityOptions =
|
|
12348
|
+
const runtimeCapabilityOptions = React44.useMemo(
|
|
11457
12349
|
() => getRuntimeCapabilityOptions(runtimeCapabilities),
|
|
11458
12350
|
[runtimeCapabilities]
|
|
11459
12351
|
);
|
|
11460
|
-
const effectiveSessionRuntimeCapabilities =
|
|
12352
|
+
const effectiveSessionRuntimeCapabilities = React44.useMemo(
|
|
11461
12353
|
() => runtimeCapabilitiesReady && runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
11462
12354
|
runtimeCapabilities,
|
|
11463
12355
|
sessionRuntimeCapabilities
|
|
11464
12356
|
) : null,
|
|
11465
12357
|
[runtimeCapabilities, runtimeCapabilitiesReady, sessionRuntimeCapabilities]
|
|
11466
12358
|
);
|
|
11467
|
-
const runRuntimeCapabilityOptions =
|
|
12359
|
+
const runRuntimeCapabilityOptions = React44.useMemo(
|
|
11468
12360
|
() => runtimeCapabilityOptions.filter(
|
|
11469
12361
|
(option) => isRuntimeCapabilitySelected(
|
|
11470
12362
|
runRuntimeCapabilities,
|
|
@@ -11474,11 +12366,11 @@ function Chat({
|
|
|
11474
12366
|
),
|
|
11475
12367
|
[runRuntimeCapabilities, runtimeCapabilityOptions]
|
|
11476
12368
|
);
|
|
11477
|
-
const composerRuntimeCapabilitySelectionKeys =
|
|
12369
|
+
const composerRuntimeCapabilitySelectionKeys = React44.useMemo(
|
|
11478
12370
|
() => getComposerCapabilitySelectionKeys(composerParts),
|
|
11479
12371
|
[composerParts]
|
|
11480
12372
|
);
|
|
11481
|
-
const detachedRunRuntimeCapabilityOptions =
|
|
12373
|
+
const detachedRunRuntimeCapabilityOptions = React44.useMemo(
|
|
11482
12374
|
() => runRuntimeCapabilityOptions.filter(
|
|
11483
12375
|
(option) => !composerRuntimeCapabilitySelectionKeys.has(
|
|
11484
12376
|
getRuntimeCapabilityOptionKey(option)
|
|
@@ -11486,7 +12378,7 @@ function Chat({
|
|
|
11486
12378
|
),
|
|
11487
12379
|
[composerRuntimeCapabilitySelectionKeys, runRuntimeCapabilityOptions]
|
|
11488
12380
|
);
|
|
11489
|
-
const persistSessionRuntimeCapabilities =
|
|
12381
|
+
const persistSessionRuntimeCapabilities = React44.useCallback(
|
|
11490
12382
|
async (threadId, selection) => {
|
|
11491
12383
|
if (!runtimeCapabilities || !selection) {
|
|
11492
12384
|
return;
|
|
@@ -11511,10 +12403,10 @@ function Chat({
|
|
|
11511
12403
|
},
|
|
11512
12404
|
[runtimeCapabilities, stream.client]
|
|
11513
12405
|
);
|
|
11514
|
-
const clearQuoteSelection =
|
|
12406
|
+
const clearQuoteSelection = React44.useCallback(() => {
|
|
11515
12407
|
setQuoteSelection(null);
|
|
11516
12408
|
}, []);
|
|
11517
|
-
const commitComposerParts =
|
|
12409
|
+
const commitComposerParts = React44.useCallback(
|
|
11518
12410
|
(nextParts, options2) => {
|
|
11519
12411
|
const normalized = normalizeComposerParts(nextParts);
|
|
11520
12412
|
const previous = composerPartsRef.current;
|
|
@@ -11550,7 +12442,7 @@ function Chat({
|
|
|
11550
12442
|
},
|
|
11551
12443
|
[]
|
|
11552
12444
|
);
|
|
11553
|
-
const setComposerText =
|
|
12445
|
+
const setComposerText = React44.useCallback(
|
|
11554
12446
|
(text, caretOffset = text.length) => {
|
|
11555
12447
|
commitComposerParts(createComposerTextParts(text), {
|
|
11556
12448
|
caretOffset,
|
|
@@ -11560,7 +12452,7 @@ function Chat({
|
|
|
11560
12452
|
},
|
|
11561
12453
|
[commitComposerParts]
|
|
11562
12454
|
);
|
|
11563
|
-
const focusComposerAt =
|
|
12455
|
+
const focusComposerAt = React44.useCallback((position) => {
|
|
11564
12456
|
const nextPosition = position ?? getComposerEditingLength(composerPartsRef.current);
|
|
11565
12457
|
pendingComposerCaretOffsetRef.current = nextPosition;
|
|
11566
12458
|
requestAnimationFrame(() => {
|
|
@@ -11572,7 +12464,7 @@ function Chat({
|
|
|
11572
12464
|
});
|
|
11573
12465
|
}, []);
|
|
11574
12466
|
const parentMessenger = useParentMessenger({
|
|
11575
|
-
onSetComposerValue:
|
|
12467
|
+
onSetComposerValue: React44.useCallback(
|
|
11576
12468
|
(payload) => {
|
|
11577
12469
|
if (!payload) {
|
|
11578
12470
|
return;
|
|
@@ -11595,10 +12487,10 @@ function Chat({
|
|
|
11595
12487
|
},
|
|
11596
12488
|
[composer?.tools, setComposerText]
|
|
11597
12489
|
),
|
|
11598
|
-
onFocusComposer:
|
|
12490
|
+
onFocusComposer: React44.useCallback(() => {
|
|
11599
12491
|
composerInputRef.current?.focus();
|
|
11600
12492
|
}, []),
|
|
11601
|
-
onSetPetEnabled:
|
|
12493
|
+
onSetPetEnabled: React44.useCallback(
|
|
11602
12494
|
(enabled) => {
|
|
11603
12495
|
if (petRequired) {
|
|
11604
12496
|
return;
|
|
@@ -11611,7 +12503,7 @@ function Chat({
|
|
|
11611
12503
|
[displayedPetSettings, petRequired, savePetLocalSettings]
|
|
11612
12504
|
)
|
|
11613
12505
|
});
|
|
11614
|
-
const syncQuoteSelection =
|
|
12506
|
+
const syncQuoteSelection = React44.useCallback(() => {
|
|
11615
12507
|
if (typeof window === "undefined") {
|
|
11616
12508
|
clearQuoteSelection();
|
|
11617
12509
|
return;
|
|
@@ -11656,23 +12548,23 @@ function Chat({
|
|
|
11656
12548
|
left
|
|
11657
12549
|
});
|
|
11658
12550
|
}, [clearQuoteSelection]);
|
|
11659
|
-
const cancelPendingAutoScroll =
|
|
12551
|
+
const cancelPendingAutoScroll = React44.useCallback(() => {
|
|
11660
12552
|
if (autoScrollFrameRef.current !== null) {
|
|
11661
12553
|
cancelAnimationFrame(autoScrollFrameRef.current);
|
|
11662
12554
|
autoScrollFrameRef.current = null;
|
|
11663
12555
|
}
|
|
11664
12556
|
}, []);
|
|
11665
|
-
const disableAutoFollow =
|
|
12557
|
+
const disableAutoFollow = React44.useCallback(() => {
|
|
11666
12558
|
forceFollowRef.current = false;
|
|
11667
12559
|
shouldAutoScrollRef.current = false;
|
|
11668
12560
|
cancelPendingAutoScroll();
|
|
11669
12561
|
}, [cancelPendingAutoScroll]);
|
|
11670
|
-
const enableAutoFollow =
|
|
12562
|
+
const enableAutoFollow = React44.useCallback(() => {
|
|
11671
12563
|
forceFollowRef.current = true;
|
|
11672
12564
|
shouldAutoScrollRef.current = true;
|
|
11673
12565
|
setHasUpdatesBelow(false);
|
|
11674
12566
|
}, []);
|
|
11675
|
-
const scrollToBottom =
|
|
12567
|
+
const scrollToBottom = React44.useCallback(
|
|
11676
12568
|
(smooth = false, force = false) => {
|
|
11677
12569
|
if (force) {
|
|
11678
12570
|
enableAutoFollow();
|
|
@@ -11699,7 +12591,7 @@ function Chat({
|
|
|
11699
12591
|
},
|
|
11700
12592
|
[cancelPendingAutoScroll, enableAutoFollow]
|
|
11701
12593
|
);
|
|
11702
|
-
|
|
12594
|
+
React44.useEffect(() => {
|
|
11703
12595
|
const viewport = viewportRef.current;
|
|
11704
12596
|
if (!viewport) return;
|
|
11705
12597
|
previousScrollTopRef.current = viewport.scrollTop;
|
|
@@ -11780,14 +12672,14 @@ function Chat({
|
|
|
11780
12672
|
window.removeEventListener("pointercancel", stopPointerTracking);
|
|
11781
12673
|
};
|
|
11782
12674
|
}, [cancelPendingAutoScroll, disableAutoFollow]);
|
|
11783
|
-
|
|
12675
|
+
React44.useEffect(() => {
|
|
11784
12676
|
shouldAutoScrollRef.current = true;
|
|
11785
12677
|
forceFollowRef.current = false;
|
|
11786
12678
|
previousScrollTopRef.current = 0;
|
|
11787
12679
|
setIsAtBottom(true);
|
|
11788
12680
|
setHasUpdatesBelow(false);
|
|
11789
12681
|
}, [stream.threadId]);
|
|
11790
|
-
|
|
12682
|
+
React44.useEffect(() => {
|
|
11791
12683
|
const messageCountChanged = messages.length !== previousMessageCountRef.current;
|
|
11792
12684
|
previousMessageCountRef.current = messages.length;
|
|
11793
12685
|
if (!shouldAutoScrollRef.current) {
|
|
@@ -11806,7 +12698,7 @@ function Chat({
|
|
|
11806
12698
|
clientSecret: effectiveClientSecret
|
|
11807
12699
|
});
|
|
11808
12700
|
const missingConfig = Boolean(missingConfigKind);
|
|
11809
|
-
const missingConfigShortMessage =
|
|
12701
|
+
const missingConfigShortMessage = React44.useMemo(() => {
|
|
11810
12702
|
switch (missingConfigKind) {
|
|
11811
12703
|
case "apiUrl":
|
|
11812
12704
|
return t("chat.missingApiUrlShort");
|
|
@@ -11818,7 +12710,7 @@ function Chat({
|
|
|
11818
12710
|
return t("chat.missingConfigShort");
|
|
11819
12711
|
}
|
|
11820
12712
|
}, [missingConfigKind, t]);
|
|
11821
|
-
const missingConfigDetailMessage =
|
|
12713
|
+
const missingConfigDetailMessage = React44.useMemo(() => {
|
|
11822
12714
|
switch (missingConfigKind) {
|
|
11823
12715
|
case "apiUrl":
|
|
11824
12716
|
return t("chat.missingApiUrlDetail");
|
|
@@ -11833,7 +12725,7 @@ function Chat({
|
|
|
11833
12725
|
const showMissingConfig = !isClientSecretInitializing && missingConfig;
|
|
11834
12726
|
const hasUploadingFiles = attachments.some((a) => a.status === "uploading");
|
|
11835
12727
|
const isSendDisabled = !trimmedDraft && !hasReferences || hasPendingInteractiveRequest || missingConfig || isHistoryLoading || hasUploadingFiles || isUploadingReferenceImages;
|
|
11836
|
-
const resizeComposerInput =
|
|
12728
|
+
const resizeComposerInput = React44.useCallback(() => {
|
|
11837
12729
|
const input = composerInputRef.current;
|
|
11838
12730
|
if (!input) {
|
|
11839
12731
|
return;
|
|
@@ -11841,7 +12733,7 @@ function Chat({
|
|
|
11841
12733
|
input.style.maxHeight = `${COMPOSER_INPUT_MAX_HEIGHT}px`;
|
|
11842
12734
|
input.style.overflowY = input.scrollHeight > COMPOSER_INPUT_MAX_HEIGHT ? "auto" : "hidden";
|
|
11843
12735
|
}, []);
|
|
11844
|
-
|
|
12736
|
+
React44.useLayoutEffect(() => {
|
|
11845
12737
|
composerPartsRef.current = composerParts;
|
|
11846
12738
|
resizeComposerInput();
|
|
11847
12739
|
const caretOffset = pendingComposerCaretOffsetRef.current;
|
|
@@ -11853,13 +12745,13 @@ function Chat({
|
|
|
11853
12745
|
}
|
|
11854
12746
|
}
|
|
11855
12747
|
}, [composerDomVersion, composerParts, resizeComposerInput]);
|
|
11856
|
-
|
|
12748
|
+
React44.useEffect(() => {
|
|
11857
12749
|
document.addEventListener("selectionchange", syncQuoteSelection);
|
|
11858
12750
|
return () => {
|
|
11859
12751
|
document.removeEventListener("selectionchange", syncQuoteSelection);
|
|
11860
12752
|
};
|
|
11861
12753
|
}, [syncQuoteSelection]);
|
|
11862
|
-
|
|
12754
|
+
React44.useEffect(() => {
|
|
11863
12755
|
const viewport = viewportRef.current;
|
|
11864
12756
|
if (!viewport) {
|
|
11865
12757
|
return;
|
|
@@ -11876,14 +12768,14 @@ function Chat({
|
|
|
11876
12768
|
window.removeEventListener("resize", handleViewportScroll);
|
|
11877
12769
|
};
|
|
11878
12770
|
}, [clearQuoteSelection]);
|
|
11879
|
-
|
|
12771
|
+
React44.useEffect(() => {
|
|
11880
12772
|
clearQuoteSelection();
|
|
11881
12773
|
}, [messages.length, stream.threadId, clearQuoteSelection]);
|
|
11882
|
-
|
|
12774
|
+
React44.useEffect(() => {
|
|
11883
12775
|
if (missingConfig) return;
|
|
11884
12776
|
void refreshThreads();
|
|
11885
12777
|
}, [missingConfig, refreshThreads]);
|
|
11886
|
-
|
|
12778
|
+
React44.useEffect(() => {
|
|
11887
12779
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
11888
12780
|
setAssistantName(null);
|
|
11889
12781
|
setAssistantAvatar(null);
|
|
@@ -11906,7 +12798,7 @@ function Chat({
|
|
|
11906
12798
|
cancelled = true;
|
|
11907
12799
|
};
|
|
11908
12800
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
11909
|
-
|
|
12801
|
+
React44.useEffect(() => {
|
|
11910
12802
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
11911
12803
|
setRuntimeCapabilities(null);
|
|
11912
12804
|
setRuntimeCapabilitiesReady(false);
|
|
@@ -11953,7 +12845,7 @@ function Chat({
|
|
|
11953
12845
|
});
|
|
11954
12846
|
return () => controller.abort();
|
|
11955
12847
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
11956
|
-
|
|
12848
|
+
React44.useEffect(() => {
|
|
11957
12849
|
setRunRuntimeCapabilities(
|
|
11958
12850
|
createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
|
|
11959
12851
|
);
|
|
@@ -12010,7 +12902,7 @@ function Chat({
|
|
|
12010
12902
|
mimetype: a.storageFile?.mimetype ?? a.file.type,
|
|
12011
12903
|
size: a.storageFile?.size ?? a.file.size
|
|
12012
12904
|
}));
|
|
12013
|
-
const handleSessionRuntimeCapabilityToggle =
|
|
12905
|
+
const handleSessionRuntimeCapabilityToggle = React44.useCallback(
|
|
12014
12906
|
(type, id, selected) => {
|
|
12015
12907
|
setSessionRuntimeCapabilities((previous) => {
|
|
12016
12908
|
const nextSelection = toggleRuntimeCapabilitySelection(
|
|
@@ -12028,7 +12920,7 @@ function Chat({
|
|
|
12028
12920
|
},
|
|
12029
12921
|
[persistSessionRuntimeCapabilities, stream.threadId]
|
|
12030
12922
|
);
|
|
12031
|
-
const updateRuntimeCapabilityPalette =
|
|
12923
|
+
const updateRuntimeCapabilityPalette = React44.useCallback(
|
|
12032
12924
|
(parts, selectionStart) => {
|
|
12033
12925
|
const input = composerInputRef.current;
|
|
12034
12926
|
const editingText = getComposerEditingText(parts);
|
|
@@ -12040,7 +12932,7 @@ function Chat({
|
|
|
12040
12932
|
},
|
|
12041
12933
|
[]
|
|
12042
12934
|
);
|
|
12043
|
-
const syncComposerInputFromElement =
|
|
12935
|
+
const syncComposerInputFromElement = React44.useCallback(
|
|
12044
12936
|
(input) => {
|
|
12045
12937
|
const previousCapabilities = getComposerCapabilityPartMap(
|
|
12046
12938
|
composerPartsRef.current
|
|
@@ -12058,25 +12950,25 @@ function Chat({
|
|
|
12058
12950
|
},
|
|
12059
12951
|
[commitComposerParts, updateRuntimeCapabilityPalette]
|
|
12060
12952
|
);
|
|
12061
|
-
const handleComposerInput =
|
|
12953
|
+
const handleComposerInput = React44.useCallback(
|
|
12062
12954
|
(event) => {
|
|
12063
12955
|
syncComposerInputFromElement(event.currentTarget);
|
|
12064
12956
|
},
|
|
12065
12957
|
[syncComposerInputFromElement]
|
|
12066
12958
|
);
|
|
12067
|
-
const handleComposerCompositionEnd =
|
|
12959
|
+
const handleComposerCompositionEnd = React44.useCallback(
|
|
12068
12960
|
(event) => {
|
|
12069
12961
|
syncComposerInputFromElement(event.currentTarget);
|
|
12070
12962
|
},
|
|
12071
12963
|
[syncComposerInputFromElement]
|
|
12072
12964
|
);
|
|
12073
|
-
const handleComposerSelect =
|
|
12965
|
+
const handleComposerSelect = React44.useCallback(() => {
|
|
12074
12966
|
updateRuntimeCapabilityPalette(
|
|
12075
12967
|
composerPartsRef.current,
|
|
12076
12968
|
composerInputRef.current ? getComposerSelectionOffset(composerInputRef.current) : void 0
|
|
12077
12969
|
);
|
|
12078
12970
|
}, [updateRuntimeCapabilityPalette]);
|
|
12079
|
-
const removeRunRuntimeCapability =
|
|
12971
|
+
const removeRunRuntimeCapability = React44.useCallback(
|
|
12080
12972
|
(option) => {
|
|
12081
12973
|
setRunRuntimeCapabilities(
|
|
12082
12974
|
(previous) => toggleRuntimeCapabilitySelection(
|
|
@@ -12096,7 +12988,7 @@ function Chat({
|
|
|
12096
12988
|
},
|
|
12097
12989
|
[commitComposerParts]
|
|
12098
12990
|
);
|
|
12099
|
-
const submitDraft =
|
|
12991
|
+
const submitDraft = React44.useCallback(
|
|
12100
12992
|
(optionsOrFollowUp) => {
|
|
12101
12993
|
if (isSendDisabled) return;
|
|
12102
12994
|
const submitOptions = typeof optionsOrFollowUp === "string" ? { followUpOverride: optionsOrFollowUp } : optionsOrFollowUp ?? {};
|
|
@@ -12220,7 +13112,7 @@ function Chat({
|
|
|
12220
13112
|
t
|
|
12221
13113
|
]
|
|
12222
13114
|
);
|
|
12223
|
-
const addRunRuntimeCapabilities =
|
|
13115
|
+
const addRunRuntimeCapabilities = React44.useCallback(
|
|
12224
13116
|
(selection) => {
|
|
12225
13117
|
setRunRuntimeCapabilities(
|
|
12226
13118
|
(previous) => runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
@@ -12232,7 +13124,7 @@ function Chat({
|
|
|
12232
13124
|
},
|
|
12233
13125
|
[runtimeCapabilities]
|
|
12234
13126
|
);
|
|
12235
|
-
const insertComposerCapabilityToken =
|
|
13127
|
+
const insertComposerCapabilityToken = React44.useCallback(
|
|
12236
13128
|
(capability, range) => {
|
|
12237
13129
|
const token = createComposerCapabilityPart(capability, createMessageId());
|
|
12238
13130
|
const currentParts = composerPartsRef.current;
|
|
@@ -12303,7 +13195,7 @@ function Chat({
|
|
|
12303
13195
|
plugin: t("composer.slashCommands.empty.loadingCapabilities"),
|
|
12304
13196
|
subAgent: t("composer.slashCommands.empty.loadingCapabilities")
|
|
12305
13197
|
};
|
|
12306
|
-
|
|
13198
|
+
React44.useEffect(() => {
|
|
12307
13199
|
if (!runtimeCapabilityPalette) {
|
|
12308
13200
|
return;
|
|
12309
13201
|
}
|
|
@@ -12322,7 +13214,7 @@ function Chat({
|
|
|
12322
13214
|
);
|
|
12323
13215
|
}
|
|
12324
13216
|
}, [slashPaletteOptions.length, runtimeCapabilityPalette]);
|
|
12325
|
-
|
|
13217
|
+
React44.useLayoutEffect(() => {
|
|
12326
13218
|
if (!runtimeCapabilityPalette) {
|
|
12327
13219
|
return;
|
|
12328
13220
|
}
|
|
@@ -12346,7 +13238,7 @@ function Chat({
|
|
|
12346
13238
|
}
|
|
12347
13239
|
submitDraft();
|
|
12348
13240
|
};
|
|
12349
|
-
const handleEditPendingFollowUp =
|
|
13241
|
+
const handleEditPendingFollowUp = React44.useCallback(
|
|
12350
13242
|
(id) => {
|
|
12351
13243
|
const item = pendingFollowUps.find(
|
|
12352
13244
|
(entry) => entry.id === id && entry.mode === "queue"
|
|
@@ -12373,7 +13265,7 @@ function Chat({
|
|
|
12373
13265
|
},
|
|
12374
13266
|
[pendingFollowUps, setComposerText, stream]
|
|
12375
13267
|
);
|
|
12376
|
-
const handleQuoteSelection =
|
|
13268
|
+
const handleQuoteSelection = React44.useCallback(() => {
|
|
12377
13269
|
if (!quoteSelection) {
|
|
12378
13270
|
return;
|
|
12379
13271
|
}
|
|
@@ -12389,7 +13281,7 @@ function Chat({
|
|
|
12389
13281
|
const handleAttachmentClick = () => {
|
|
12390
13282
|
fileInputRef.current?.click();
|
|
12391
13283
|
};
|
|
12392
|
-
const uploadContextFile =
|
|
13284
|
+
const uploadContextFile = React44.useCallback(
|
|
12393
13285
|
(file) => stream.client.contexts.uploadFile(file),
|
|
12394
13286
|
[stream.client]
|
|
12395
13287
|
);
|
|
@@ -12493,7 +13385,7 @@ function Chat({
|
|
|
12493
13385
|
}
|
|
12494
13386
|
submitDraft();
|
|
12495
13387
|
};
|
|
12496
|
-
const handleComposerPaste =
|
|
13388
|
+
const handleComposerPaste = React44.useCallback(
|
|
12497
13389
|
(event) => {
|
|
12498
13390
|
const clipboardData = event.clipboardData;
|
|
12499
13391
|
if (!clipboardData) {
|
|
@@ -12592,18 +13484,18 @@ function Chat({
|
|
|
12592
13484
|
uploadContextFile
|
|
12593
13485
|
]
|
|
12594
13486
|
);
|
|
12595
|
-
const alternateFollowUpShortcutLabel =
|
|
13487
|
+
const alternateFollowUpShortcutLabel = React44.useMemo(() => {
|
|
12596
13488
|
if (typeof navigator === "undefined") {
|
|
12597
13489
|
return "\u2318Enter";
|
|
12598
13490
|
}
|
|
12599
13491
|
const platform = navigator.platform || navigator.userAgent;
|
|
12600
13492
|
return /Mac|iPhone|iPad|iPod/i.test(platform) ? "\u2318Enter" : "Ctrl+Enter";
|
|
12601
13493
|
}, []);
|
|
12602
|
-
const followUpShortcutLabels =
|
|
13494
|
+
const followUpShortcutLabels = React44.useMemo(
|
|
12603
13495
|
() => getComposerFollowUpShortcutLabels(alternateFollowUpShortcutLabel),
|
|
12604
13496
|
[alternateFollowUpShortcutLabel]
|
|
12605
13497
|
);
|
|
12606
|
-
const uploadFile =
|
|
13498
|
+
const uploadFile = React44.useCallback(
|
|
12607
13499
|
async (localId, file) => {
|
|
12608
13500
|
try {
|
|
12609
13501
|
const result = await uploadContextFile(file);
|
|
@@ -12626,7 +13518,7 @@ function Chat({
|
|
|
12626
13518
|
},
|
|
12627
13519
|
[uploadContextFile]
|
|
12628
13520
|
);
|
|
12629
|
-
const handleRetryUpload =
|
|
13521
|
+
const handleRetryUpload = React44.useCallback(
|
|
12630
13522
|
(localId) => {
|
|
12631
13523
|
const attachment = attachments.find((a) => a.localId === localId);
|
|
12632
13524
|
if (!attachment || attachment.status !== "error") return;
|
|
@@ -12725,7 +13617,7 @@ function Chat({
|
|
|
12725
13617
|
);
|
|
12726
13618
|
scrollToBottom(true, true);
|
|
12727
13619
|
};
|
|
12728
|
-
const loadConversationMessages =
|
|
13620
|
+
const loadConversationMessages = React44.useCallback(
|
|
12729
13621
|
async (recordId) => {
|
|
12730
13622
|
if (missingConfig) {
|
|
12731
13623
|
setHistoryError(missingConfigShortMessage);
|
|
@@ -12820,12 +13712,12 @@ function Chat({
|
|
|
12820
13712
|
}
|
|
12821
13713
|
};
|
|
12822
13714
|
const acceptMimes = composer?.attachments?.accept ? Object.entries(composer.attachments.accept).map(([mime, exts]) => [mime, ...exts.map((e) => `.${e}`)].join(",")).join(",") : void 0;
|
|
12823
|
-
const currentThread =
|
|
13715
|
+
const currentThread = React44.useMemo(
|
|
12824
13716
|
() => threads.find((item) => item.id === stream.threadId),
|
|
12825
13717
|
[threads, stream.threadId]
|
|
12826
13718
|
);
|
|
12827
13719
|
const streamErrorMessage = stream.error instanceof Error ? stream.error.message : void 0;
|
|
12828
|
-
const threadErrorMessage =
|
|
13720
|
+
const threadErrorMessage = React44.useMemo(() => {
|
|
12829
13721
|
if (streamErrorMessage?.trim()) return streamErrorMessage.trim();
|
|
12830
13722
|
if (currentThread?.status !== "error") return void 0;
|
|
12831
13723
|
const message = currentThread.error?.trim();
|
|
@@ -12856,7 +13748,7 @@ function Chat({
|
|
|
12856
13748
|
fallbackTitle: t("history.threadFallback")
|
|
12857
13749
|
});
|
|
12858
13750
|
const assistantTitle = assistantName || resolvedTitle;
|
|
12859
|
-
return /* @__PURE__ */ (0,
|
|
13751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
12860
13752
|
"div",
|
|
12861
13753
|
{
|
|
12862
13754
|
ref: viewportRef,
|
|
@@ -12866,10 +13758,10 @@ function Chat({
|
|
|
12866
13758
|
className
|
|
12867
13759
|
),
|
|
12868
13760
|
children: [
|
|
12869
|
-
/* @__PURE__ */ (0,
|
|
12870
|
-
/* @__PURE__ */ (0,
|
|
12871
|
-
/* @__PURE__ */ (0,
|
|
12872
|
-
/* @__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)(
|
|
12873
13765
|
ChatkitAvatar,
|
|
12874
13766
|
{
|
|
12875
13767
|
avatar: assistantAvatar,
|
|
@@ -12877,10 +13769,10 @@ function Chat({
|
|
|
12877
13769
|
label: assistantTitle
|
|
12878
13770
|
}
|
|
12879
13771
|
),
|
|
12880
|
-
/* @__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" })
|
|
12881
13773
|
] }),
|
|
12882
|
-
/* @__PURE__ */ (0,
|
|
12883
|
-
/* @__PURE__ */ (0,
|
|
13774
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "truncate", children: [
|
|
13775
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12884
13776
|
"h2",
|
|
12885
13777
|
{
|
|
12886
13778
|
className: "text-lg font-semibold truncate",
|
|
@@ -12888,12 +13780,12 @@ function Chat({
|
|
|
12888
13780
|
children: assistantTitle
|
|
12889
13781
|
}
|
|
12890
13782
|
),
|
|
12891
|
-
/* @__PURE__ */ (0,
|
|
13783
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-xs text-muted-foreground", children: t("chat.statusOnline") })
|
|
12892
13784
|
] })
|
|
12893
13785
|
] }),
|
|
12894
|
-
/* @__PURE__ */ (0,
|
|
12895
|
-
/* @__PURE__ */ (0,
|
|
12896
|
-
/* @__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)(
|
|
12897
13789
|
"button",
|
|
12898
13790
|
{
|
|
12899
13791
|
type: "button",
|
|
@@ -12904,14 +13796,14 @@ function Chat({
|
|
|
12904
13796
|
"transition-colors duration-150"
|
|
12905
13797
|
),
|
|
12906
13798
|
"aria-label": t("settings.open"),
|
|
12907
|
-
children: /* @__PURE__ */ (0,
|
|
13799
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.Settings, { size: 16 })
|
|
12908
13800
|
}
|
|
12909
13801
|
) }) }),
|
|
12910
|
-
/* @__PURE__ */ (0,
|
|
13802
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TooltipContent, { side: "bottom", children: t("settings.open") })
|
|
12911
13803
|
] }),
|
|
12912
|
-
history?.enabled !== false && /* @__PURE__ */ (0,
|
|
12913
|
-
/* @__PURE__ */ (0,
|
|
12914
|
-
/* @__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)(
|
|
12915
13807
|
"button",
|
|
12916
13808
|
{
|
|
12917
13809
|
type: "button",
|
|
@@ -12924,12 +13816,12 @@ function Chat({
|
|
|
12924
13816
|
"disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed"
|
|
12925
13817
|
),
|
|
12926
13818
|
"aria-label": t("history.newThread"),
|
|
12927
|
-
children: /* @__PURE__ */ (0,
|
|
13819
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.Pencil, { size: 16 })
|
|
12928
13820
|
}
|
|
12929
13821
|
) }) }),
|
|
12930
|
-
/* @__PURE__ */ (0,
|
|
13822
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TooltipContent, { side: "bottom", children: t("history.newThread") })
|
|
12931
13823
|
] }),
|
|
12932
|
-
/* @__PURE__ */ (0,
|
|
13824
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12933
13825
|
HistorySidebar,
|
|
12934
13826
|
{
|
|
12935
13827
|
threads,
|
|
@@ -12944,18 +13836,18 @@ function Chat({
|
|
|
12944
13836
|
] })
|
|
12945
13837
|
] })
|
|
12946
13838
|
] }),
|
|
12947
|
-
/* @__PURE__ */ (0,
|
|
12948
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
12949
|
-
historyError && /* @__PURE__ */ (0,
|
|
12950
|
-
showMissingConfig && /* @__PURE__ */ (0,
|
|
12951
|
-
isHistoryLoading && /* @__PURE__ */ (0,
|
|
12952
|
-
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)(
|
|
12953
13845
|
StartScreen,
|
|
12954
13846
|
{
|
|
12955
13847
|
startScreen,
|
|
12956
13848
|
onPromptClick: handlePromptClick
|
|
12957
13849
|
}
|
|
12958
|
-
) : /* @__PURE__ */ (0,
|
|
13850
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "space-y-4", children: [
|
|
12959
13851
|
messages.map((message, index) => {
|
|
12960
13852
|
const messageType = String(message.type);
|
|
12961
13853
|
const isAssistantMessage = messageType === "assistant" || messageType === "ai";
|
|
@@ -12988,7 +13880,7 @@ function Chat({
|
|
|
12988
13880
|
if (!isAssistantMessage && !hasPlainRenderableContent && !hasHumanAttachments && humanRuntimeCapabilityOptions.length === 0 && humanReferences.length === 0) {
|
|
12989
13881
|
return null;
|
|
12990
13882
|
}
|
|
12991
|
-
return /* @__PURE__ */ (0,
|
|
13883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12992
13884
|
"div",
|
|
12993
13885
|
{
|
|
12994
13886
|
className: cn(
|
|
@@ -12996,8 +13888,8 @@ function Chat({
|
|
|
12996
13888
|
message.type === "human" ? "justify-end" : "justify-start -ml-1"
|
|
12997
13889
|
// AI messages: slightly closer to left
|
|
12998
13890
|
),
|
|
12999
|
-
children: /* @__PURE__ */ (0,
|
|
13000
|
-
/* @__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)(
|
|
13001
13893
|
"div",
|
|
13002
13894
|
{
|
|
13003
13895
|
...canQuoteMessage ? {
|
|
@@ -13009,7 +13901,7 @@ function Chat({
|
|
|
13009
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"
|
|
13010
13902
|
// AI messages: use chat-specific foreground color
|
|
13011
13903
|
),
|
|
13012
|
-
children: isAssistantMessage ? /* @__PURE__ */ (0,
|
|
13904
|
+
children: isAssistantMessage ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13013
13905
|
AssistantMessage,
|
|
13014
13906
|
{
|
|
13015
13907
|
message: {
|
|
@@ -13028,25 +13920,25 @@ function Chat({
|
|
|
13028
13920
|
organizationId: stream.organizationId,
|
|
13029
13921
|
apiUrl: stream.apiUrl
|
|
13030
13922
|
}
|
|
13031
|
-
) : /* @__PURE__ */ (0,
|
|
13032
|
-
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)(
|
|
13033
13925
|
"span",
|
|
13034
13926
|
{
|
|
13035
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",
|
|
13036
13928
|
children: [
|
|
13037
|
-
/* @__PURE__ */ (0,
|
|
13929
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13038
13930
|
RuntimeCapabilityIcon,
|
|
13039
13931
|
{
|
|
13040
13932
|
option,
|
|
13041
13933
|
variant: "chip"
|
|
13042
13934
|
}
|
|
13043
13935
|
),
|
|
13044
|
-
/* @__PURE__ */ (0,
|
|
13936
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "max-w-[9rem] truncate", children: option.label })
|
|
13045
13937
|
]
|
|
13046
13938
|
},
|
|
13047
13939
|
`${option.type}:${option.id}`
|
|
13048
13940
|
)) }),
|
|
13049
|
-
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)(
|
|
13050
13942
|
ReferenceChip,
|
|
13051
13943
|
{
|
|
13052
13944
|
reference,
|
|
@@ -13054,29 +13946,29 @@ function Chat({
|
|
|
13054
13946
|
},
|
|
13055
13947
|
getReferenceKey(reference)
|
|
13056
13948
|
)) }),
|
|
13057
|
-
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)(
|
|
13058
13950
|
"div",
|
|
13059
13951
|
{
|
|
13060
13952
|
className: "flex items-center gap-1.5 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs",
|
|
13061
13953
|
children: [
|
|
13062
|
-
/* @__PURE__ */ (0,
|
|
13063
|
-
/* @__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 })
|
|
13064
13956
|
]
|
|
13065
13957
|
},
|
|
13066
13958
|
fileIndex
|
|
13067
13959
|
)) }),
|
|
13068
|
-
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)(
|
|
13069
13961
|
"p",
|
|
13070
13962
|
{
|
|
13071
13963
|
className: "wrap-break-word text-sm leading-relaxed",
|
|
13072
13964
|
children: formatMessageContent(part)
|
|
13073
13965
|
},
|
|
13074
13966
|
`${part.type}-${partIndex}`
|
|
13075
|
-
)) : /* @__PURE__ */ (0,
|
|
13967
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "wrap-break-word text-sm leading-relaxed", children: formatMessageContent(message.content) })
|
|
13076
13968
|
] })
|
|
13077
13969
|
}
|
|
13078
13970
|
),
|
|
13079
|
-
/* @__PURE__ */ (0,
|
|
13971
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13080
13972
|
MessageActions,
|
|
13081
13973
|
{
|
|
13082
13974
|
content: messageContent,
|
|
@@ -13112,7 +14004,7 @@ function Chat({
|
|
|
13112
14004
|
stream.isLoading,
|
|
13113
14005
|
{ now: streamingNow }
|
|
13114
14006
|
);
|
|
13115
|
-
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)(
|
|
13116
14008
|
AssistantStreamingIndicator,
|
|
13117
14009
|
{
|
|
13118
14010
|
status: fallbackStreamingStatus ?? "loading"
|
|
@@ -13121,7 +14013,7 @@ function Chat({
|
|
|
13121
14013
|
})()
|
|
13122
14014
|
] })
|
|
13123
14015
|
] }),
|
|
13124
|
-
!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)(
|
|
13125
14017
|
Button,
|
|
13126
14018
|
{
|
|
13127
14019
|
type: "button",
|
|
@@ -13134,10 +14026,10 @@ function Chat({
|
|
|
13134
14026
|
onClick: () => scrollToBottom(true, true),
|
|
13135
14027
|
"aria-label": t("chat.scrollToBottom"),
|
|
13136
14028
|
title: t("chat.scrollToBottom"),
|
|
13137
|
-
children: /* @__PURE__ */ (0,
|
|
14029
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.ArrowDown, { size: 16 })
|
|
13138
14030
|
}
|
|
13139
14031
|
) }),
|
|
13140
|
-
quoteSelection && /* @__PURE__ */ (0,
|
|
14032
|
+
quoteSelection && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13141
14033
|
"div",
|
|
13142
14034
|
{
|
|
13143
14035
|
className: "pointer-events-none fixed z-50",
|
|
@@ -13146,7 +14038,7 @@ function Chat({
|
|
|
13146
14038
|
left: `${quoteSelection.left}px`,
|
|
13147
14039
|
transform: "translateX(-50%)"
|
|
13148
14040
|
},
|
|
13149
|
-
children: /* @__PURE__ */ (0,
|
|
14041
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
13150
14042
|
Button,
|
|
13151
14043
|
{
|
|
13152
14044
|
type: "button",
|
|
@@ -13158,16 +14050,16 @@ function Chat({
|
|
|
13158
14050
|
"aria-label": t("composer.quoteSelection"),
|
|
13159
14051
|
title: t("composer.quoteSelection"),
|
|
13160
14052
|
children: [
|
|
13161
|
-
/* @__PURE__ */ (0,
|
|
14053
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.Quote, { size: 14 }),
|
|
13162
14054
|
t("composer.quoteSelection")
|
|
13163
14055
|
]
|
|
13164
14056
|
}
|
|
13165
14057
|
)
|
|
13166
14058
|
}
|
|
13167
14059
|
),
|
|
13168
|
-
/* @__PURE__ */ (0,
|
|
13169
|
-
threadErrorMessage && /* @__PURE__ */ (0,
|
|
13170
|
-
/* @__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)(
|
|
13171
14063
|
"input",
|
|
13172
14064
|
{
|
|
13173
14065
|
ref: fileInputRef,
|
|
@@ -13178,7 +14070,7 @@ function Chat({
|
|
|
13178
14070
|
className: "hidden"
|
|
13179
14071
|
}
|
|
13180
14072
|
),
|
|
13181
|
-
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)(
|
|
13182
14074
|
"div",
|
|
13183
14075
|
{
|
|
13184
14076
|
className: cn(
|
|
@@ -13186,16 +14078,16 @@ function Chat({
|
|
|
13186
14078
|
item.status === "error" ? "bg-destructive/10 border border-destructive/30" : "bg-muted"
|
|
13187
14079
|
),
|
|
13188
14080
|
children: [
|
|
13189
|
-
item.status === "uploading" && /* @__PURE__ */ (0,
|
|
13190
|
-
|
|
14081
|
+
item.status === "uploading" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
14082
|
+
import_lucide_react24.Loader2,
|
|
13191
14083
|
{
|
|
13192
14084
|
size: 14,
|
|
13193
14085
|
className: "animate-spin text-muted-foreground"
|
|
13194
14086
|
}
|
|
13195
14087
|
),
|
|
13196
|
-
item.status === "success" && /* @__PURE__ */ (0,
|
|
13197
|
-
item.status === "error" && /* @__PURE__ */ (0,
|
|
13198
|
-
/* @__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)(
|
|
13199
14091
|
"span",
|
|
13200
14092
|
{
|
|
13201
14093
|
className: cn(
|
|
@@ -13205,17 +14097,17 @@ function Chat({
|
|
|
13205
14097
|
children: item.file.name
|
|
13206
14098
|
}
|
|
13207
14099
|
),
|
|
13208
|
-
item.status === "error" && /* @__PURE__ */ (0,
|
|
14100
|
+
item.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13209
14101
|
"button",
|
|
13210
14102
|
{
|
|
13211
14103
|
type: "button",
|
|
13212
14104
|
onClick: () => handleRetryUpload(item.localId),
|
|
13213
14105
|
className: "ml-1 rounded-full p-0.5 text-destructive hover:bg-destructive/20",
|
|
13214
14106
|
title: t("chat.retryUpload"),
|
|
13215
|
-
children: /* @__PURE__ */ (0,
|
|
14107
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.RefreshCw, { size: 12 })
|
|
13216
14108
|
}
|
|
13217
14109
|
),
|
|
13218
|
-
/* @__PURE__ */ (0,
|
|
14110
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13219
14111
|
"button",
|
|
13220
14112
|
{
|
|
13221
14113
|
type: "button",
|
|
@@ -13224,14 +14116,14 @@ function Chat({
|
|
|
13224
14116
|
"ml-1 rounded-full p-0.5",
|
|
13225
14117
|
item.status === "error" ? "text-destructive hover:bg-destructive/20" : "hover:bg-muted-foreground/20"
|
|
13226
14118
|
),
|
|
13227
|
-
children: /* @__PURE__ */ (0,
|
|
14119
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.X, { size: 12 })
|
|
13228
14120
|
}
|
|
13229
14121
|
)
|
|
13230
14122
|
]
|
|
13231
14123
|
},
|
|
13232
14124
|
item.localId
|
|
13233
14125
|
)) }),
|
|
13234
|
-
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)(
|
|
13235
14127
|
ReferenceChip,
|
|
13236
14128
|
{
|
|
13237
14129
|
reference,
|
|
@@ -13245,16 +14137,16 @@ function Chat({
|
|
|
13245
14137
|
},
|
|
13246
14138
|
getReferenceKey(reference)
|
|
13247
14139
|
)) }),
|
|
13248
|
-
detachedRunRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0,
|
|
13249
|
-
/* @__PURE__ */ (0,
|
|
13250
|
-
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)(
|
|
13251
14143
|
"span",
|
|
13252
14144
|
{
|
|
13253
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",
|
|
13254
14146
|
children: [
|
|
13255
|
-
/* @__PURE__ */ (0,
|
|
13256
|
-
/* @__PURE__ */ (0,
|
|
13257
|
-
/* @__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)(
|
|
13258
14150
|
"button",
|
|
13259
14151
|
{
|
|
13260
14152
|
type: "button",
|
|
@@ -13262,7 +14154,7 @@ function Chat({
|
|
|
13262
14154
|
className: "rounded-full p-0.5 hover:bg-primary/15",
|
|
13263
14155
|
title: t("composer.capabilities.removeRunCapability"),
|
|
13264
14156
|
"aria-label": t("composer.capabilities.removeRunCapability"),
|
|
13265
|
-
children: /* @__PURE__ */ (0,
|
|
14157
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.X, { size: 11 })
|
|
13266
14158
|
}
|
|
13267
14159
|
)
|
|
13268
14160
|
]
|
|
@@ -13270,7 +14162,7 @@ function Chat({
|
|
|
13270
14162
|
`${option.type}:${option.id}`
|
|
13271
14163
|
))
|
|
13272
14164
|
] }),
|
|
13273
|
-
/* @__PURE__ */ (0,
|
|
14165
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13274
14166
|
PendingRuntimeServices,
|
|
13275
14167
|
{
|
|
13276
14168
|
state: stream.runtimeActivities.sandboxServices,
|
|
@@ -13279,7 +14171,7 @@ function Chat({
|
|
|
13279
14171
|
className: hasPendingTodos || hasPendingFollowUps ? "mb-2" : void 0
|
|
13280
14172
|
}
|
|
13281
14173
|
),
|
|
13282
|
-
/* @__PURE__ */ (0,
|
|
14174
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13283
14175
|
PendingTodos,
|
|
13284
14176
|
{
|
|
13285
14177
|
snapshot: stream.todos,
|
|
@@ -13287,7 +14179,7 @@ function Chat({
|
|
|
13287
14179
|
className: hasPendingFollowUps ? "mb-2" : void 0
|
|
13288
14180
|
}
|
|
13289
14181
|
),
|
|
13290
|
-
/* @__PURE__ */ (0,
|
|
14182
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13291
14183
|
PendingFollowUps,
|
|
13292
14184
|
{
|
|
13293
14185
|
items: pendingFollowUps,
|
|
@@ -13302,7 +14194,7 @@ function Chat({
|
|
|
13302
14194
|
attachToComposer: true
|
|
13303
14195
|
}
|
|
13304
14196
|
),
|
|
13305
|
-
/* @__PURE__ */ (0,
|
|
14197
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13306
14198
|
RequestUserInputPanel,
|
|
13307
14199
|
{
|
|
13308
14200
|
request: stream.pendingRequestUserInput,
|
|
@@ -13311,7 +14203,7 @@ function Chat({
|
|
|
13311
14203
|
attachToComposer: true
|
|
13312
14204
|
}
|
|
13313
14205
|
),
|
|
13314
|
-
/* @__PURE__ */ (0,
|
|
14206
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13315
14207
|
HITLApprovalPanel,
|
|
13316
14208
|
{
|
|
13317
14209
|
request: stream.pendingHITLRequest,
|
|
@@ -13320,7 +14212,7 @@ function Chat({
|
|
|
13320
14212
|
attachToComposer: true
|
|
13321
14213
|
}
|
|
13322
14214
|
),
|
|
13323
|
-
runtimeCapabilityPalette && /* @__PURE__ */ (0,
|
|
14215
|
+
runtimeCapabilityPalette && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13324
14216
|
SlashPalette,
|
|
13325
14217
|
{
|
|
13326
14218
|
palette: runtimeCapabilityPalette,
|
|
@@ -13334,7 +14226,7 @@ function Chat({
|
|
|
13334
14226
|
onSelect: selectSlashPaletteOption
|
|
13335
14227
|
}
|
|
13336
14228
|
),
|
|
13337
|
-
/* @__PURE__ */ (0,
|
|
14229
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("form", { className: "flex items-end", onSubmit: handleSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
13338
14230
|
"div",
|
|
13339
14231
|
{
|
|
13340
14232
|
"data-slot": "composer-input-shell",
|
|
@@ -13348,7 +14240,7 @@ function Chat({
|
|
|
13348
14240
|
composerInputRoundedClass
|
|
13349
14241
|
),
|
|
13350
14242
|
children: [
|
|
13351
|
-
/* @__PURE__ */ (0,
|
|
14243
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13352
14244
|
"div",
|
|
13353
14245
|
{
|
|
13354
14246
|
ref: composerInputRef,
|
|
@@ -13370,7 +14262,7 @@ function Chat({
|
|
|
13370
14262
|
(missingConfig || isHistoryLoading || hasPendingInteractiveRequest) && "cursor-not-allowed opacity-50"
|
|
13371
14263
|
),
|
|
13372
14264
|
children: renderedComposerParts.map(
|
|
13373
|
-
(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)(
|
|
13374
14266
|
"span",
|
|
13375
14267
|
{
|
|
13376
14268
|
"data-composer-capability-key": part.key,
|
|
@@ -13379,14 +14271,14 @@ function Chat({
|
|
|
13379
14271
|
contentEditable: false,
|
|
13380
14272
|
className: "mx-0.5 inline-flex max-w-[14rem] select-none items-center gap-1 text-sm font-semibold text-primary align-baseline",
|
|
13381
14273
|
children: [
|
|
13382
|
-
/* @__PURE__ */ (0,
|
|
14274
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13383
14275
|
RuntimeCapabilityIcon,
|
|
13384
14276
|
{
|
|
13385
14277
|
option: part.capability,
|
|
13386
14278
|
variant: "chip"
|
|
13387
14279
|
}
|
|
13388
14280
|
),
|
|
13389
|
-
/* @__PURE__ */ (0,
|
|
14281
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "truncate", children: part.capability.label })
|
|
13390
14282
|
]
|
|
13391
14283
|
},
|
|
13392
14284
|
part.key
|
|
@@ -13395,14 +14287,14 @@ function Chat({
|
|
|
13395
14287
|
},
|
|
13396
14288
|
composerDomVersion
|
|
13397
14289
|
),
|
|
13398
|
-
/* @__PURE__ */ (0,
|
|
14290
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
13399
14291
|
"div",
|
|
13400
14292
|
{
|
|
13401
14293
|
"data-slot": "composer-action-bar",
|
|
13402
14294
|
className: "pointer-events-none absolute inset-x-1.5 bottom-1 flex min-h-10 items-center justify-between gap-2",
|
|
13403
14295
|
children: [
|
|
13404
|
-
/* @__PURE__ */ (0,
|
|
13405
|
-
/* @__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)(
|
|
13406
14298
|
ComposerMenu,
|
|
13407
14299
|
{
|
|
13408
14300
|
composer,
|
|
@@ -13417,20 +14309,20 @@ function Chat({
|
|
|
13417
14309
|
disabled: missingConfig || isHistoryLoading || hasPendingInteractiveRequest
|
|
13418
14310
|
}
|
|
13419
14311
|
) }),
|
|
13420
|
-
selectedTool && /* @__PURE__ */ (0,
|
|
13421
|
-
/* @__PURE__ */ (0,
|
|
13422
|
-
/* @__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)(
|
|
13423
14315
|
"button",
|
|
13424
14316
|
{
|
|
13425
14317
|
type: "button",
|
|
13426
14318
|
onClick: () => setSelectedTool(null),
|
|
13427
14319
|
className: "shrink-0 rounded-full p-0.5 text-primary/70 hover:bg-primary/10 hover:text-primary",
|
|
13428
|
-
children: /* @__PURE__ */ (0,
|
|
14320
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react24.X, { size: 12 })
|
|
13429
14321
|
}
|
|
13430
14322
|
)
|
|
13431
14323
|
] })
|
|
13432
14324
|
] }),
|
|
13433
|
-
/* @__PURE__ */ (0,
|
|
14325
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "pointer-events-auto shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13434
14326
|
SendButton,
|
|
13435
14327
|
{
|
|
13436
14328
|
disabled: isSendDisabled,
|
|
@@ -13457,7 +14349,7 @@ function Chat({
|
|
|
13457
14349
|
]
|
|
13458
14350
|
}
|
|
13459
14351
|
) }),
|
|
13460
|
-
disclaimer?.text && /* @__PURE__ */ (0,
|
|
14352
|
+
disclaimer?.text && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13461
14353
|
"p",
|
|
13462
14354
|
{
|
|
13463
14355
|
className: cn(
|
|
@@ -13467,12 +14359,12 @@ function Chat({
|
|
|
13467
14359
|
children: disclaimer.text
|
|
13468
14360
|
}
|
|
13469
14361
|
),
|
|
13470
|
-
/* @__PURE__ */ (0,
|
|
13471
|
-
/* @__PURE__ */ (0,
|
|
13472
|
-
/* @__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" })
|
|
13473
14365
|
] })
|
|
13474
14366
|
] }),
|
|
13475
|
-
/* @__PURE__ */ (0,
|
|
14367
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13476
14368
|
SettingsSheet,
|
|
13477
14369
|
{
|
|
13478
14370
|
open: petSettingsOpen,
|
|
@@ -13482,17 +14374,17 @@ function Chat({
|
|
|
13482
14374
|
onSave: savePetLocalSettings
|
|
13483
14375
|
}
|
|
13484
14376
|
),
|
|
13485
|
-
/* @__PURE__ */ (0,
|
|
14377
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PetBridge, { pet: effectivePet, state: petAutoState })
|
|
13486
14378
|
]
|
|
13487
14379
|
}
|
|
13488
14380
|
);
|
|
13489
14381
|
}
|
|
13490
14382
|
|
|
13491
14383
|
// src/components/ui/separator.tsx
|
|
13492
|
-
var
|
|
13493
|
-
var
|
|
13494
|
-
var Separator =
|
|
13495
|
-
({ 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)(
|
|
13496
14388
|
"div",
|
|
13497
14389
|
{
|
|
13498
14390
|
ref,
|