@xpert-ai/chatkit-ui 0.3.20 → 0.4.0
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-dO9u_ouJ.js → _baseUniq-DgIHlkQm.js} +1 -1
- package/dist/app/assets/{abap-0mUJM--r.js → abap-lB8VLppN.js} +1 -1
- package/dist/app/assets/{abnf-DKGxGp8Z.js → abnf-CMm-FA7V.js} +1 -1
- package/dist/app/assets/{actionscript-DtO_0ylO.js → actionscript-C44LZKx4.js} +1 -1
- package/dist/app/assets/{ada-DCuTzTIT.js → ada-BL4d2yHl.js} +1 -1
- package/dist/app/assets/{agda-CqhS82in.js → agda-DUeBOfao.js} +1 -1
- package/dist/app/assets/{al-DGtNqkyL.js → al-r379MYUc.js} +1 -1
- package/dist/app/assets/{antlr4-BGE2dxa_.js → antlr4-BhepIW3H.js} +1 -1
- package/dist/app/assets/{apacheconf-Dd1EMcOJ.js → apacheconf-ZblTvauv.js} +1 -1
- package/dist/app/assets/{apex-Dp2zfXlN.js → apex-DXCjRfej.js} +1 -1
- package/dist/app/assets/{apl-Cxj8FQdm.js → apl-0mvw9LXG.js} +1 -1
- package/dist/app/assets/{applescript-D1uoFy80.js → applescript-s8Oxmrfz.js} +1 -1
- package/dist/app/assets/{aql-DGOYHZfO.js → aql-BMN4x1O3.js} +1 -1
- package/dist/app/assets/{arc-CSSgPkN1.js → arc-xNYJT0Sf.js} +1 -1
- package/dist/app/assets/{architectureDiagram-Q4EWVU46-BN7Ayh3h.js → architectureDiagram-Q4EWVU46-B3lvRgUo.js} +1 -1
- package/dist/app/assets/{arduino-BorrL9gm.js → arduino-daTjF253.js} +1 -1
- package/dist/app/assets/{arff-DxHxsjkc.js → arff-DxxxOwyy.js} +1 -1
- package/dist/app/assets/{asciidoc-CxU0US1U.js → asciidoc-B0aClqCc.js} +1 -1
- package/dist/app/assets/{asm6502-Dyy6pjI8.js → asm6502-BsfejLyD.js} +1 -1
- package/dist/app/assets/{asmatmel-Dr8p_P1f.js → asmatmel-BQPOdk6m.js} +1 -1
- package/dist/app/assets/{aspnet-B4z81enL.js → aspnet-CI7Ah4u1.js} +1 -1
- package/dist/app/assets/{autohotkey-BGyfWN1i.js → autohotkey-IQAyKsEZ.js} +1 -1
- package/dist/app/assets/{autoit-Xligx8s2.js → autoit-Cc50euDJ.js} +1 -1
- package/dist/app/assets/{avisynth-CUaqko0w.js → avisynth-D_3k61Mh.js} +1 -1
- package/dist/app/assets/{avro-idl-CrBvsyQE.js → avro-idl-Dakyv0EK.js} +1 -1
- package/dist/app/assets/{bash-CpEeAKNU.js → bash-CK4ls-uk.js} +1 -1
- package/dist/app/assets/{basic-DyvwR5ul.js → basic-sAy-3U_-.js} +1 -1
- package/dist/app/assets/{batch-CAnM992n.js → batch-BULEa0VP.js} +1 -1
- package/dist/app/assets/{bbcode-Bds1cYRC.js → bbcode-mxGKgZDu.js} +1 -1
- package/dist/app/assets/{bicep-Ch2CQn9H.js → bicep-DxUd9L5w.js} +1 -1
- package/dist/app/assets/{birb-D9ZtmdxE.js → birb-CT9d0Hfg.js} +1 -1
- package/dist/app/assets/{bison-CS7U9ElI.js → bison-CJWctWOI.js} +1 -1
- package/dist/app/assets/{blockDiagram-DXYQGD6D-WguPOWUb.js → blockDiagram-DXYQGD6D-D-AjcpQ4.js} +1 -1
- package/dist/app/assets/{bnf-DGZM-tVS.js → bnf-BfiH5qUl.js} +1 -1
- package/dist/app/assets/{brainfuck-DyAfQENG.js → brainfuck-BXCfmtpc.js} +1 -1
- package/dist/app/assets/{brightscript-C1LlTbYI.js → brightscript-B8Se3L7d.js} +1 -1
- package/dist/app/assets/{bro-DBtyBs7j.js → bro-BYNaGskD.js} +1 -1
- package/dist/app/assets/{bsl-CIws9jBl.js → bsl-rAkCQZce.js} +1 -1
- package/dist/app/assets/{c-CFDrZLe4.js → c-BLwhDOSO.js} +1 -1
- package/dist/app/assets/{c4Diagram-AHTNJAMY-RtYhntJz.js → c4Diagram-AHTNJAMY-CqDIUKeo.js} +1 -1
- package/dist/app/assets/{cfscript-CtivxrTV.js → cfscript-BEVtIJMz.js} +1 -1
- package/dist/app/assets/{chaiscript-CZzVXweq.js → chaiscript-DcH2srx5.js} +1 -1
- package/dist/app/assets/channel-CI-ehimI.js +1 -0
- package/dist/app/assets/{chunk-4BX2VUAB-CXkxcnLB.js → chunk-4BX2VUAB-m_kyuUbe.js} +1 -1
- package/dist/app/assets/{chunk-4TB4RGXK-DiI3vXpV.js → chunk-4TB4RGXK-BjqYS6Yy.js} +1 -1
- package/dist/app/assets/{chunk-55IACEB6-BbmFk-DA.js → chunk-55IACEB6-oWAL2kJR.js} +1 -1
- package/dist/app/assets/{chunk-EDXVE4YY-MjXpiNnM.js → chunk-EDXVE4YY-BR40heM4.js} +1 -1
- package/dist/app/assets/{chunk-FMBD7UC4-DYgOt2vm.js → chunk-FMBD7UC4-Bv7-5Ls-.js} +1 -1
- package/dist/app/assets/{chunk-OYMX7WX6-kKZSMF0R.js → chunk-OYMX7WX6-CIKeB20i.js} +1 -1
- package/dist/app/assets/{chunk-QZHKN3VN-CiXg8Cbu.js → chunk-QZHKN3VN-CBk_nqgS.js} +1 -1
- package/dist/app/assets/{chunk-YZCP3GAM-pPNMK4mQ.js → chunk-YZCP3GAM-DbrAyIeM.js} +1 -1
- package/dist/app/assets/{cil-DoAmknqy.js → cil-HIWN64iA.js} +1 -1
- package/dist/app/assets/classDiagram-6PBFFD2Q-kNq98FtJ.js +1 -0
- package/dist/app/assets/classDiagram-v2-HSJHXN6E-kNq98FtJ.js +1 -0
- package/dist/app/assets/{clike-DwlmdH1o.js → clike-DWwvlcID.js} +1 -1
- package/dist/app/assets/{clojure-CFznyY-8.js → clojure-m5aYwMVY.js} +1 -1
- package/dist/app/assets/clone-70-rkKhs.js +1 -0
- package/dist/app/assets/{cmake-CcUYbAkX.js → cmake-D1AphalP.js} +1 -1
- package/dist/app/assets/{cobol-DRgBRGN9.js → cobol-DfRj-gRZ.js} +1 -1
- package/dist/app/assets/{coffeescript-Bo7rHazJ.js → coffeescript-DBVw6hft.js} +1 -1
- package/dist/app/assets/{concurnas-B4Cy2ldU.js → concurnas-p-HBsubn.js} +1 -1
- package/dist/app/assets/{coq-CMgtMpjq.js → coq-DpEsabSd.js} +1 -1
- package/dist/app/assets/{core-BYh6RTIo.js → core-Bu1sMhBI.js} +1 -1
- package/dist/app/assets/{cose-bilkent-S5V4N54A-C46_8K97.js → cose-bilkent-S5V4N54A-Bu1oc34k.js} +1 -1
- package/dist/app/assets/{cpp-ggzE8h3n.js → cpp-DWOjniRs.js} +1 -1
- package/dist/app/assets/{crystal-JYb0cXRo.js → crystal-CQJ7kmd6.js} +1 -1
- package/dist/app/assets/{csharp-Dfy28CKx.js → csharp-D7MPpOcK.js} +1 -1
- package/dist/app/assets/{cshtml-D9iKfsWo.js → cshtml-DKqAFWTy.js} +1 -1
- package/dist/app/assets/{csp-Cv5xhFMf.js → csp-CdccqHH0.js} +1 -1
- package/dist/app/assets/{css-BlnX_aMm.js → css-CF8Mhm8t.js} +1 -1
- package/dist/app/assets/{css-extras-EAMuHsg4.js → css-extras-BzYoJo_2.js} +1 -1
- package/dist/app/assets/{csv-ETLeI9yB.js → csv-BkNUxNGN.js} +1 -1
- package/dist/app/assets/{cypher-CbiYD0C6.js → cypher-B6Ago4_f.js} +1 -1
- package/dist/app/assets/{d-BLr7DSZ_.js → d-0OD8he-p.js} +1 -1
- package/dist/app/assets/{dagre-KV5264BT-DVX0nAWn.js → dagre-KV5264BT-CtnwN-Dh.js} +1 -1
- package/dist/app/assets/{dart-BUsQiEKs.js → dart-CRBezsEJ.js} +1 -1
- package/dist/app/assets/{dataweave-BYiDcYrB.js → dataweave-C5NSsb9T.js} +1 -1
- package/dist/app/assets/{dax-iosgVacE.js → dax-DA_08-S-.js} +1 -1
- package/dist/app/assets/{dhall-DIQ8EFrC.js → dhall-B5eyKfIX.js} +1 -1
- package/dist/app/assets/{diagram-5BDNPKRD-CbKYwcnw.js → diagram-5BDNPKRD-BWMmYkfv.js} +1 -1
- package/dist/app/assets/{diagram-G4DWMVQ6-4-JjCu5t.js → diagram-G4DWMVQ6-BZqIfTTc.js} +1 -1
- package/dist/app/assets/{diagram-MMDJMWI5-BzKnlGDI.js → diagram-MMDJMWI5--lVSAtvL.js} +1 -1
- package/dist/app/assets/{diagram-TYMM5635-DuwasHtC.js → diagram-TYMM5635-CAdX-pMH.js} +1 -1
- package/dist/app/assets/{diff-DHBSHNgP.js → diff-BcQ3lgLg.js} +1 -1
- package/dist/app/assets/{django-CfRtrcZO.js → django-C_tw_AYj.js} +1 -1
- package/dist/app/assets/{dns-zone-file-BIlXUWGI.js → dns-zone-file-CyqP1EvD.js} +1 -1
- package/dist/app/assets/{docker-DRXwbY0w.js → docker-wz3Lj9Db.js} +1 -1
- package/dist/app/assets/{dot-CqKYiXSR.js → dot-B-DDY2H8.js} +1 -1
- package/dist/app/assets/{ebnf-eSA59aZE.js → ebnf-X2ewhLUy.js} +1 -1
- package/dist/app/assets/{editorconfig-DArWTZiN.js → editorconfig-qcUVBPkT.js} +1 -1
- package/dist/app/assets/{eiffel-BMDMvmAa.js → eiffel-BAqW7pbE.js} +1 -1
- package/dist/app/assets/{ejs-D82JChud.js → ejs-61WKLTYk.js} +1 -1
- package/dist/app/assets/{elixir-C9Jq5FWr.js → elixir-EzFqXZk2.js} +1 -1
- package/dist/app/assets/{elm-VfWYgR_0.js → elm-DmnpDBDa.js} +1 -1
- package/dist/app/assets/{erDiagram-SMLLAGMA-Di9Kvn6n.js → erDiagram-SMLLAGMA-D-t806Qt.js} +1 -1
- package/dist/app/assets/{erb-CEuJHL9b.js → erb-CcQKm2oQ.js} +1 -1
- package/dist/app/assets/{erlang-zlZ7-qY9.js → erlang-DW-WXopd.js} +1 -1
- package/dist/app/assets/{etlua-C1g7aW5E.js → etlua-BJxhJpxy.js} +1 -1
- package/dist/app/assets/{excel-formula-CAYwHvAw.js → excel-formula-7oXshpg3.js} +1 -1
- package/dist/app/assets/{factor-DN7MW_2U.js → factor-BC8WW8Od.js} +1 -1
- package/dist/app/assets/{false-09xZ6VlZ.js → false-C6lXY4VC.js} +1 -1
- package/dist/app/assets/{firestore-security-rules-zq1uGQbY.js → firestore-security-rules-B4dcnH7G.js} +1 -1
- package/dist/app/assets/{flow-CK25t_lW.js → flow-CFpX3faq.js} +1 -1
- package/dist/app/assets/{flowDiagram-DWJPFMVM-BCmFDjmk.js → flowDiagram-DWJPFMVM-BjTXVIWo.js} +1 -1
- package/dist/app/assets/{fortran-CZFYKfOS.js → fortran-RwIGxqZ9.js} +1 -1
- package/dist/app/assets/{fsharp-BbarO2cP.js → fsharp-C5S6wt_8.js} +1 -1
- package/dist/app/assets/{ftl-Ca9Ss-f6.js → ftl-DXTedmzK.js} +1 -1
- package/dist/app/assets/{ganttDiagram-T4ZO3ILL-b_SWQw-B.js → ganttDiagram-T4ZO3ILL-DPqZs20S.js} +1 -1
- package/dist/app/assets/{gap-BDUwxdTV.js → gap-C0KFM8Sn.js} +1 -1
- package/dist/app/assets/{gcode-FzmJqrxN.js → gcode-Ck54RmDV.js} +1 -1
- package/dist/app/assets/{gdscript-X7m3fyWi.js → gdscript-DX_Bezt8.js} +1 -1
- package/dist/app/assets/{gedcom-BIzK9DAz.js → gedcom-54x_GC3_.js} +1 -1
- package/dist/app/assets/{gherkin-BzV1WJ3C.js → gherkin-DpY70MhW.js} +1 -1
- package/dist/app/assets/{git-CWX33q2q.js → git-Bg40h27U.js} +1 -1
- package/dist/app/assets/{gitGraphDiagram-UUTBAWPF-ByifHh7n.js → gitGraphDiagram-UUTBAWPF-CMuB9NDh.js} +1 -1
- package/dist/app/assets/{glsl-DfrDIiov.js → glsl-BcqYx_6I.js} +1 -1
- package/dist/app/assets/{gml-DAbaYzvk.js → gml-DJePf9E6.js} +1 -1
- package/dist/app/assets/{gn-Bl3zMQJx.js → gn-hOkcYKt5.js} +1 -1
- package/dist/app/assets/{go-oQ0wGTRg.js → go-CBdX4RKq.js} +1 -1
- package/dist/app/assets/{go-module-BEwJOHqW.js → go-module-8CqpJAjn.js} +1 -1
- package/dist/app/assets/{graph-RZk9H4ri.js → graph-DiXdxCpd.js} +1 -1
- package/dist/app/assets/{graphql-Cgq8uWTM.js → graphql-DzkHa_Lt.js} +1 -1
- package/dist/app/assets/{groovy-C0gTg-aZ.js → groovy-CuKAytl9.js} +1 -1
- package/dist/app/assets/{haml-Bzk6EfVk.js → haml-BHlOO4D-.js} +1 -1
- package/dist/app/assets/{handlebars-ChszlW4e.js → handlebars-DgTuPlRj.js} +1 -1
- package/dist/app/assets/{haskell-1kh-_Mkx.js → haskell-BYOS6zzQ.js} +1 -1
- package/dist/app/assets/{haxe-Btd4WdA3.js → haxe-QCi0Miq5.js} +1 -1
- package/dist/app/assets/{hcl-Cqh76IbY.js → hcl-DCUWHECM.js} +1 -1
- package/dist/app/assets/{hlsl-ChvI2E6p.js → hlsl-Bp2hwiJd.js} +1 -1
- package/dist/app/assets/{hoon-B9IgXQj0.js → hoon-BzW-9-xp.js} +1 -1
- package/dist/app/assets/{hpkp-DTGGzNzf.js → hpkp-BWPv-cBm.js} +1 -1
- package/dist/app/assets/{hsts-2EGrct05.js → hsts-CJiK6uQM.js} +1 -1
- package/dist/app/assets/{http-1KqK1qH8.js → http-DQlaEk07.js} +1 -1
- package/dist/app/assets/{ichigojam-gVysk7Nt.js → ichigojam-K2-54W_i.js} +1 -1
- package/dist/app/assets/{icon-CarlP8Nz.js → icon-DtDq4nwU.js} +1 -1
- package/dist/app/assets/{icu-message-format-D7lgOAji.js → icu-message-format-CzUzfEvD.js} +1 -1
- package/dist/app/assets/{idris-CJJs2Fpr.js → idris-CZStDvUu.js} +1 -1
- package/dist/app/assets/{iecst-C5LUC-nz.js → iecst-BJn6mRZC.js} +1 -1
- package/dist/app/assets/{ignore-1e8QpoH9.js → ignore-BZ9E9rMx.js} +1 -1
- package/dist/app/assets/index-BCZfU1mO.js +756 -0
- package/dist/app/assets/index-ByruneYs.css +1 -0
- package/dist/app/assets/{infoDiagram-42DDH7IO-DXx3uupu.js → infoDiagram-42DDH7IO-BVqN5Cf-.js} +1 -1
- package/dist/app/assets/{inform7-DeZriFCi.js → inform7-C64PxE5P.js} +1 -1
- package/dist/app/assets/{ini-BhOLfejd.js → ini-D6uyClxM.js} +1 -1
- package/dist/app/assets/{io-9zPt8gSg.js → io-BEddoOXw.js} +1 -1
- package/dist/app/assets/{ishikawaDiagram-UXIWVN3A-R4damDdy.js → ishikawaDiagram-UXIWVN3A-DMCnYQDL.js} +1 -1
- package/dist/app/assets/{j-7GReLLGn.js → j-BZjnLaoD.js} +1 -1
- package/dist/app/assets/{java-lSyPzlvl.js → java-C16BQXmJ.js} +1 -1
- package/dist/app/assets/{javadoc-Vsvu72YU.js → javadoc-Bp_K_1w9.js} +1 -1
- package/dist/app/assets/{javadoclike-Bt2IQS3j.js → javadoclike-CCL57XT3.js} +1 -1
- package/dist/app/assets/{javascript-Bsf_qcep.js → javascript-UKmanPpI.js} +1 -1
- package/dist/app/assets/{javastacktrace-C6eP2Aus.js → javastacktrace-Bt6MmvHK.js} +1 -1
- package/dist/app/assets/{jexl-DUrnRUQQ.js → jexl-BSIE3NAS.js} +1 -1
- package/dist/app/assets/{jolie-CDUYu14B.js → jolie-DwAozljt.js} +1 -1
- package/dist/app/assets/{journeyDiagram-VCZTEJTY-Bv9hwBpp.js → journeyDiagram-VCZTEJTY-hfkm8x7F.js} +1 -1
- package/dist/app/assets/{jq-DJJOyxBz.js → jq-B6HQblEc.js} +1 -1
- package/dist/app/assets/{js-extras-C88FKFNA.js → js-extras-C4kJ0q_P.js} +1 -1
- package/dist/app/assets/{js-templates-sBJ73gs2.js → js-templates-BF0RGSgj.js} +1 -1
- package/dist/app/assets/{jsdoc-CjYZRLbN.js → jsdoc-BaH_CjIP.js} +1 -1
- package/dist/app/assets/{json-DVP15SY5.js → json-JpTWEtLR.js} +1 -1
- package/dist/app/assets/{json5-Bjn67lk5.js → json5-DJHj-rXR.js} +1 -1
- package/dist/app/assets/{jsonp-DHGagYL7.js → jsonp-DpjTc_na.js} +1 -1
- package/dist/app/assets/{jsstacktrace-BOuYaiIh.js → jsstacktrace-DnLa9vhb.js} +1 -1
- package/dist/app/assets/{jsx-Dmo6JTYK.js → jsx-BRHrY2BL.js} +1 -1
- package/dist/app/assets/{julia-_w8lzZbt.js → julia-9zZ-iwP_.js} +1 -1
- package/dist/app/assets/{kanban-definition-6JOO6SKY-Cb_7yCx_.js → kanban-definition-6JOO6SKY-DE3YihJJ.js} +1 -1
- package/dist/app/assets/{keepalived-4LhOS9un.js → keepalived-Uu89aoXa.js} +1 -1
- package/dist/app/assets/{keyman-CUSnTu69.js → keyman-DFGcwqDK.js} +1 -1
- package/dist/app/assets/{kotlin-Bj06xeFi.js → kotlin-LTPAm-Va.js} +1 -1
- package/dist/app/assets/{kumir-DEv-obaC.js → kumir-BcPP82e-.js} +1 -1
- package/dist/app/assets/{kusto-TgM2Lwnw.js → kusto-CxK7uEBf.js} +1 -1
- package/dist/app/assets/{latex-k1SkdLd8.js → latex-CJOru6Xl.js} +1 -1
- package/dist/app/assets/{latte-Cw3lTIBr.js → latte-yocJ797x.js} +1 -1
- package/dist/app/assets/{layout-BXbEHoki.js → layout-CXEXCcrp.js} +1 -1
- package/dist/app/assets/{less-B6n9jGED.js → less-BmacGfdt.js} +1 -1
- package/dist/app/assets/{lilypond-DikIigko.js → lilypond-XADZqv26.js} +1 -1
- package/dist/app/assets/{linear-CUHq8GYQ.js → linear-BoHhQExU.js} +1 -1
- package/dist/app/assets/{liquid-B05mXBd-.js → liquid-DrXu3I4o.js} +1 -1
- package/dist/app/assets/{lisp-BNA9GUrJ.js → lisp-D7GBOEAq.js} +1 -1
- package/dist/app/assets/{livescript-DDl5Qm6x.js → livescript-CYEGDtxo.js} +1 -1
- package/dist/app/assets/{llvm-CcfX96cD.js → llvm-Cg59OFV5.js} +1 -1
- package/dist/app/assets/{log-Dz8L9EqF.js → log-Dgz6RJ76.js} +1 -1
- package/dist/app/assets/{lolcode-BELXPVX3.js → lolcode-BiaQuLMI.js} +1 -1
- package/dist/app/assets/{lua-B78FPW4A.js → lua-A_5_hnzN.js} +1 -1
- package/dist/app/assets/{magma-xNHzxoFq.js → magma-vL3dHSsW.js} +1 -1
- package/dist/app/assets/{makefile-5NEtuhzy.js → makefile-C1iS0HiM.js} +1 -1
- package/dist/app/assets/{markdown-B9k9uhzd.js → markdown-B2oYsnLL.js} +1 -1
- package/dist/app/assets/{markup-BZ34BXR_.js → markup-DfTA_BVw.js} +1 -1
- package/dist/app/assets/{markup-templating-BUyWAFJR.js → markup-templating-Cuy4LPLx.js} +1 -1
- package/dist/app/assets/{matlab-XKcpa9B8.js → matlab-D6BnQC4u.js} +1 -1
- package/dist/app/assets/{maxscript-D4JiPJuC.js → maxscript-C6TABA1u.js} +1 -1
- package/dist/app/assets/{mel-CyK7Q1TM.js → mel-4rfx7Bfv.js} +1 -1
- package/dist/app/assets/{mermaid-Tm2sV_0O.js → mermaid-C9zerIka.js} +1 -1
- package/dist/app/assets/{min-BGC2d4iH.js → min-CYeWfD_S.js} +1 -1
- package/dist/app/assets/{mindmap-definition-QFDTVHPH-C1IURfNU.js → mindmap-definition-QFDTVHPH-DEJyZ1TS.js} +1 -1
- package/dist/app/assets/{mizar-yGz-_EIV.js → mizar-DRgDOhTN.js} +1 -1
- package/dist/app/assets/{mongodb-DAN68-YI.js → mongodb-Bz5t1Kri.js} +1 -1
- package/dist/app/assets/{monkey-Cb6rRr17.js → monkey-DmpKIE8A.js} +1 -1
- package/dist/app/assets/{moonscript-D0FzuIC0.js → moonscript-Detay_Aq.js} +1 -1
- package/dist/app/assets/{n1ql-VtzttBJz.js → n1ql-BmgXbS-M.js} +1 -1
- package/dist/app/assets/{n4js-DdrCzTNg.js → n4js-DmTPdCqi.js} +1 -1
- package/dist/app/assets/{nand2tetris-hdl-CiuFr3Z6.js → nand2tetris-hdl-DXraXq65.js} +1 -1
- package/dist/app/assets/{naniscript-CZmsm3Qe.js → naniscript-B261gwHF.js} +1 -1
- package/dist/app/assets/{nasm-Cz1JvPh7.js → nasm-DjgP63mx.js} +1 -1
- package/dist/app/assets/{neon-CVb_1MMJ.js → neon-BkyLss_j.js} +1 -1
- package/dist/app/assets/{nevod-CgOKEeZN.js → nevod-D3AIDy_-.js} +1 -1
- package/dist/app/assets/{nginx-CMgTpa3W.js → nginx-x6qaHbn6.js} +1 -1
- package/dist/app/assets/{nim-4vicXzfG.js → nim-DEkLs6r2.js} +1 -1
- package/dist/app/assets/{nix-cWZZM13i.js → nix-DKfH6GYJ.js} +1 -1
- package/dist/app/assets/{nsis-IRFq8enS.js → nsis-DdaElZTp.js} +1 -1
- package/dist/app/assets/{objectivec-DCJ0g-mt.js → objectivec-D-GvlelH.js} +1 -1
- package/dist/app/assets/{ocaml-Bq1gHzib.js → ocaml-Bh8mdwPO.js} +1 -1
- package/dist/app/assets/{opencl-D9_IlJyv.js → opencl-DqbqQpJ8.js} +1 -1
- package/dist/app/assets/{openqasm-BX53feNx.js → openqasm-BzHZ1geL.js} +1 -1
- package/dist/app/assets/{oz-BvB8VT8D.js → oz-CAffbl5h.js} +1 -1
- package/dist/app/assets/{parigp-Dbn0ydWU.js → parigp-CKqiqq8G.js} +1 -1
- package/dist/app/assets/{parser-BILFvSNt.js → parser-Cg00t7Mb.js} +1 -1
- package/dist/app/assets/{pascal-C_2x3UBR.js → pascal--toS4iGX.js} +1 -1
- package/dist/app/assets/{pascaligo-C-uFinpv.js → pascaligo-DkkGDPuY.js} +1 -1
- package/dist/app/assets/{pcaxis-CQ2eXcFv.js → pcaxis-YW2drt9P.js} +1 -1
- package/dist/app/assets/{peoplecode-C6SRpjR3.js → peoplecode-DcSxF5p-.js} +1 -1
- package/dist/app/assets/{perl-DWfpmx5P.js → perl-YKp_XolM.js} +1 -1
- package/dist/app/assets/{php-D-7-JbKw.js → php-IihSyd58.js} +1 -1
- package/dist/app/assets/{php-extras-ByoNTDno.js → php-extras-CiYXDTjg.js} +1 -1
- package/dist/app/assets/{phpdoc-De_A0ai1.js → phpdoc-CTwGmVuh.js} +1 -1
- package/dist/app/assets/{pieDiagram-DEJITSTG-uJYQjeIi.js → pieDiagram-DEJITSTG-CYgrtYQD.js} +1 -1
- package/dist/app/assets/{plsql-BJES8Peg.js → plsql-BLbbnpCf.js} +1 -1
- package/dist/app/assets/{powerquery-BuZUrom0.js → powerquery-CW3t8EHf.js} +1 -1
- package/dist/app/assets/{powershell-Ch3rXXK5.js → powershell-Dy-20mWQ.js} +1 -1
- package/dist/app/assets/{processing-ZfE7oiNf.js → processing-DfOUJsGU.js} +1 -1
- package/dist/app/assets/{prolog-BMqE2LJL.js → prolog-Bt7umQZ_.js} +1 -1
- package/dist/app/assets/{promql-BtvdQ5KU.js → promql-BsbEgNrg.js} +1 -1
- package/dist/app/assets/{properties-DyupgQuS.js → properties-0VtNy_J8.js} +1 -1
- package/dist/app/assets/{protobuf-C_n_QYlc.js → protobuf-CnepKVtX.js} +1 -1
- package/dist/app/assets/{psl-VG_i5NJ0.js → psl-OGz4CFKI.js} +1 -1
- package/dist/app/assets/{pug-wG-KUzbN.js → pug-BUMiCGsa.js} +1 -1
- package/dist/app/assets/{puppet-Cygb5ibB.js → puppet-BpwvYCrA.js} +1 -1
- package/dist/app/assets/{pure-f9Y66cTQ.js → pure-u9lIjKsQ.js} +1 -1
- package/dist/app/assets/{purebasic-DE2tn6ax.js → purebasic-BsE8kKSG.js} +1 -1
- package/dist/app/assets/{purescript-DBfL-1W4.js → purescript-D4DGIRwN.js} +1 -1
- package/dist/app/assets/{q-C4FrUHun.js → q-Dd4Y9jTu.js} +1 -1
- package/dist/app/assets/{qml-lg8bHtYT.js → qml-IZqRvexj.js} +1 -1
- package/dist/app/assets/{qore-Dm_t34lE.js → qore-CVgOeY5j.js} +1 -1
- package/dist/app/assets/{qsharp-CdP2k5Ge.js → qsharp-C1ibrSjI.js} +1 -1
- package/dist/app/assets/{quadrantDiagram-34T5L4WZ-C_oB5-WY.js → quadrantDiagram-34T5L4WZ-Hy_efLgq.js} +1 -1
- package/dist/app/assets/{r-d1eAOwoy.js → r-CO3iHGES.js} +1 -1
- package/dist/app/assets/{racket-D-wzkPsR.js → racket-CDsoIwWb.js} +1 -1
- package/dist/app/assets/{reason-Dd4fsFdV.js → reason-BXp7TkTV.js} +1 -1
- package/dist/app/assets/{regex-CYNIq2D2.js → regex-C8d4nMD-.js} +1 -1
- package/dist/app/assets/{rego-Dnu4gFWt.js → rego-CnCdTWPv.js} +1 -1
- package/dist/app/assets/{renpy-CR1Z5gVo.js → renpy-BCpztAT2.js} +1 -1
- package/dist/app/assets/{requirementDiagram-MS252O5E-BDjIBMP9.js → requirementDiagram-MS252O5E-BI0Kue_K.js} +1 -1
- package/dist/app/assets/{rest-eklLtD63.js → rest-DRU6Mo0N.js} +1 -1
- package/dist/app/assets/{rip-MOqQRQUS.js → rip-DGcSsuJR.js} +1 -1
- package/dist/app/assets/{roboconf-DdgXe0cH.js → roboconf-D84u_D2h.js} +1 -1
- package/dist/app/assets/{robotframework-5umczlju.js → robotframework-B55NHCrN.js} +1 -1
- package/dist/app/assets/{ruby-DXk_ALBc.js → ruby-byKCK-dY.js} +1 -1
- package/dist/app/assets/{rust-doHVhnFl.js → rust-DafX95DJ.js} +1 -1
- package/dist/app/assets/{sankeyDiagram-XADWPNL6-DdzGMZhR.js → sankeyDiagram-XADWPNL6-D6MJ50Pq.js} +1 -1
- package/dist/app/assets/{sas-BobJk3Hp.js → sas-DTVLhrey.js} +1 -1
- package/dist/app/assets/{sass-6se6msf0.js → sass-rDhfj9yl.js} +1 -1
- package/dist/app/assets/{scala-BfMmg2GN.js → scala-BrKTyUsE.js} +1 -1
- package/dist/app/assets/{scheme-DPZwWy4g.js → scheme-B_eu29xA.js} +1 -1
- package/dist/app/assets/{scss-nscMYHq7.js → scss-kgRahDzu.js} +1 -1
- package/dist/app/assets/{sequenceDiagram-FGHM5R23-DloNcfwf.js → sequenceDiagram-FGHM5R23-BtFJlKLA.js} +1 -1
- package/dist/app/assets/{shell-session-CXhfVmEP.js → shell-session-CF0mJgux.js} +1 -1
- package/dist/app/assets/{smali-DovRTy6y.js → smali-cYYyD8tY.js} +1 -1
- package/dist/app/assets/{smalltalk-DvYEu6hN.js → smalltalk-C0P2MRK9.js} +1 -1
- package/dist/app/assets/{smarty-bepA2LFV.js → smarty-bSAEKlze.js} +1 -1
- package/dist/app/assets/{sml-CHAt1iCr.js → sml-CVkWiohq.js} +1 -1
- package/dist/app/assets/{solidity-AzC8UVTD.js → solidity-DBmi5l50.js} +1 -1
- package/dist/app/assets/{solution-file-CuIcDmO5.js → solution-file-CnTT-bB0.js} +1 -1
- package/dist/app/assets/{soy-BqhfLUlA.js → soy-D6Pv-4-M.js} +1 -1
- package/dist/app/assets/{sparql-BxMY2jr9.js → sparql-C_FSzEBv.js} +1 -1
- package/dist/app/assets/{splunk-spl-DPMmo4nN.js → splunk-spl-BY7Iqglg.js} +1 -1
- package/dist/app/assets/{sqf-D-9uf3KY.js → sqf-CPktPAhH.js} +1 -1
- package/dist/app/assets/{sql-B8R0FHwG.js → sql-o4K_-hAR.js} +1 -1
- package/dist/app/assets/{squirrel-Bza7MU1Z.js → squirrel-C7nc0I9a.js} +1 -1
- package/dist/app/assets/{stan-BcarQztx.js → stan-BaHsDAPv.js} +1 -1
- package/dist/app/assets/{stateDiagram-FHFEXIEX-Cdho2yx_.js → stateDiagram-FHFEXIEX-Jt84X8Km.js} +1 -1
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-2fuYX60f.js +1 -0
- package/dist/app/assets/{stylus-BdwnU_Je.js → stylus-LrKOfqx1.js} +1 -1
- package/dist/app/assets/{swift-GardvYRU.js → swift-Du5HvL9Z.js} +1 -1
- package/dist/app/assets/{systemd-BoEN0I28.js → systemd-B9G8EDGS.js} +1 -1
- package/dist/app/assets/{t4-cs-DUsOTeNI.js → t4-cs-Cx16HVWP.js} +1 -1
- package/dist/app/assets/{t4-templating-D2600IbH.js → t4-templating-8EFI9hGP.js} +1 -1
- package/dist/app/assets/{t4-vb-D1Q0eOQa.js → t4-vb-DY4dRQ0Y.js} +1 -1
- package/dist/app/assets/{tap-Bx92xV60.js → tap-CnPjcybx.js} +1 -1
- package/dist/app/assets/{tcl-BXRtWK0m.js → tcl-CyN53FjG.js} +1 -1
- package/dist/app/assets/{textile-5TDjaphc.js → textile-CcaFbMIR.js} +1 -1
- package/dist/app/assets/{timeline-definition-GMOUNBTQ-BDqwqFsf.js → timeline-definition-GMOUNBTQ-BIX9PrwR.js} +1 -1
- package/dist/app/assets/{toml-2OJRuBjR.js → toml-Dsv-Gf-x.js} +1 -1
- package/dist/app/assets/{tremor-AXCzTiPp.js → tremor-CFgQf23a.js} +1 -1
- package/dist/app/assets/{tt2-CVHTmv1T.js → tt2-C35x8-ln.js} +1 -1
- package/dist/app/assets/{turtle-CEbdA-5Y.js → turtle-mi4wNaqz.js} +1 -1
- package/dist/app/assets/{twig-CyJqSctJ.js → twig--0LWYrgK.js} +1 -1
- package/dist/app/assets/{typescript-BgZtngSj.js → typescript-TITb6K2H.js} +1 -1
- package/dist/app/assets/{typoscript-DHfRoJFl.js → typoscript-D9-RVwIo.js} +1 -1
- package/dist/app/assets/{unrealscript-D0jLY_Tm.js → unrealscript-CEl7HM5o.js} +1 -1
- package/dist/app/assets/{uorazor-B-UCiHn2.js → uorazor-D_Rffmzi.js} +1 -1
- package/dist/app/assets/{uri-BVY3aqDB.js → uri-BrG_tFHQ.js} +1 -1
- package/dist/app/assets/{v-BQL7Jc1c.js → v-CSrNrMZT.js} +1 -1
- package/dist/app/assets/{vala-BAK1DdPV.js → vala-lXeoxFEf.js} +1 -1
- package/dist/app/assets/{vbnet-DcCYNaHo.js → vbnet-CDvW0IYg.js} +1 -1
- package/dist/app/assets/{velocity-XnhHLUFX.js → velocity-CsuMf7zZ.js} +1 -1
- package/dist/app/assets/{vennDiagram-DHZGUBPP-CX64m0DJ.js → vennDiagram-DHZGUBPP-Bd1_DGNK.js} +1 -1
- package/dist/app/assets/{verilog-Dzt9jIMc.js → verilog-Ba1kXwcH.js} +1 -1
- package/dist/app/assets/{vhdl-DDBB3YGF.js → vhdl-DC7iDUsg.js} +1 -1
- package/dist/app/assets/{vim-DECEaMbi.js → vim-m5sIDmbL.js} +1 -1
- package/dist/app/assets/{visual-basic-DneMYd1t.js → visual-basic-CZAxZhXd.js} +1 -1
- package/dist/app/assets/{wardley-RL74JXVD-D5xiqeaK.js → wardley-RL74JXVD-Bi7eSfh4.js} +1 -1
- package/dist/app/assets/{wardleyDiagram-NUSXRM2D-LbamXo90.js → wardleyDiagram-NUSXRM2D-C5W1iA0y.js} +1 -1
- package/dist/app/assets/{warpscript-8iin9jnq.js → warpscript-YqE12jpR.js} +1 -1
- package/dist/app/assets/{wasm-B0juytjb.js → wasm-Cqk0NwrL.js} +1 -1
- package/dist/app/assets/{web-idl-BjnZSr8j.js → web-idl-BBz8nwvE.js} +1 -1
- package/dist/app/assets/{wiki-BDydxMmb.js → wiki-DTaDNr2a.js} +1 -1
- package/dist/app/assets/{wolfram-CxjIcLma.js → wolfram-D_dyKsVO.js} +1 -1
- package/dist/app/assets/{wren-DBqoey6C.js → wren-VhlSRnur.js} +1 -1
- package/dist/app/assets/{xeora-DHnKIwPt.js → xeora-C3d3uHWl.js} +1 -1
- package/dist/app/assets/{xml-doc-DHuvjsXL.js → xml-doc-Dn8dXLkg.js} +1 -1
- package/dist/app/assets/{xojo-BWvXjR5v.js → xojo-D7cO_F-x.js} +1 -1
- package/dist/app/assets/{xquery-Bfh3oq_u.js → xquery-C1brqcan.js} +1 -1
- package/dist/app/assets/{xychartDiagram-5P7HB3ND-ZoHhPQCM.js → xychartDiagram-5P7HB3ND-CPn62Rvn.js} +1 -1
- package/dist/app/assets/{yaml-BwzzB-wQ.js → yaml-CucHvpnq.js} +1 -1
- package/dist/app/assets/{yang--lhggci0.js → yang-BwF0d5Qn.js} +1 -1
- package/dist/app/assets/{zig-B-HUmzlq.js → zig-Bi_ZcakP.js} +1 -1
- package/dist/app/index.html +2 -2
- package/dist/index.cjs +1437 -587
- package/dist/index.js +1417 -565
- package/package.json +3 -3
- package/dist/app/assets/channel-D2P4ANqW.js +0 -1
- package/dist/app/assets/classDiagram-6PBFFD2Q-BMjJP3qv.js +0 -1
- package/dist/app/assets/classDiagram-v2-HSJHXN6E-BMjJP3qv.js +0 -1
- package/dist/app/assets/clone-DoQzxKYE.js +0 -1
- package/dist/app/assets/index-DKNbfCqG.js +0 -754
- package/dist/app/assets/index-DpEwCIj4.css +0 -1
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-DesWGtpp.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 React49 = __toESM(require("react"), 1);
|
|
71
|
+
var import_lucide_react29 = require("lucide-react");
|
|
72
72
|
|
|
73
73
|
// src/lib/utils.ts
|
|
74
74
|
var import_clsx = require("clsx");
|
|
@@ -1515,7 +1515,8 @@ var en_US_default = {
|
|
|
1515
1515
|
regenerate: "Regenerate response"
|
|
1516
1516
|
},
|
|
1517
1517
|
startScreen: {
|
|
1518
|
-
greeting: "What can I help with today?"
|
|
1518
|
+
greeting: "What can I help with today?",
|
|
1519
|
+
editPrompt: "Edit prompt"
|
|
1519
1520
|
},
|
|
1520
1521
|
composer: {
|
|
1521
1522
|
openMenu: "Open menu",
|
|
@@ -1904,7 +1905,8 @@ var zh_CN_default = {
|
|
|
1904
1905
|
regenerate: "\u91CD\u65B0\u751F\u6210\u56DE\u590D"
|
|
1905
1906
|
},
|
|
1906
1907
|
startScreen: {
|
|
1907
|
-
greeting: "\u4ECA\u5929\u6211\u80FD\u5E2E\u4F60\u4EC0\u4E48\uFF1F"
|
|
1908
|
+
greeting: "\u4ECA\u5929\u6211\u80FD\u5E2E\u4F60\u4EC0\u4E48\uFF1F",
|
|
1909
|
+
editPrompt: "\u7F16\u8F91\u5E38\u7528\u95EE\u9898"
|
|
1908
1910
|
},
|
|
1909
1911
|
composer: {
|
|
1910
1912
|
openMenu: "\u6253\u5F00\u83DC\u5355",
|
|
@@ -7693,8 +7695,8 @@ function useSlashCommands({
|
|
|
7693
7695
|
}
|
|
7694
7696
|
|
|
7695
7697
|
// src/components/thread/messages/ai.tsx
|
|
7696
|
-
var
|
|
7697
|
-
var
|
|
7698
|
+
var React36 = __toESM(require("react"), 1);
|
|
7699
|
+
var import_lucide_react24 = require("lucide-react");
|
|
7698
7700
|
|
|
7699
7701
|
// src/lib/agent-run-render-tree.ts
|
|
7700
7702
|
function isTextContent(content) {
|
|
@@ -11561,8 +11563,827 @@ function hasLegacySurface(surface) {
|
|
|
11561
11563
|
return !!surface?.componentTree;
|
|
11562
11564
|
}
|
|
11563
11565
|
|
|
11564
|
-
// src/components/thread/messages/
|
|
11566
|
+
// src/components/thread/messages/mcp-app.tsx
|
|
11567
|
+
var React35 = __toESM(require("react"), 1);
|
|
11568
|
+
var import_chatkit_types9 = require("@xpert-ai/chatkit-types");
|
|
11569
|
+
var import_lucide_react23 = require("lucide-react");
|
|
11565
11570
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
11571
|
+
function isRecord5(value) {
|
|
11572
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
11573
|
+
}
|
|
11574
|
+
function buildXpertApiUrl(apiUrl, path) {
|
|
11575
|
+
const normalizedApiUrl = apiUrl.trim();
|
|
11576
|
+
if (!normalizedApiUrl) return path;
|
|
11577
|
+
try {
|
|
11578
|
+
const url = new URL(normalizedApiUrl);
|
|
11579
|
+
return `${url.origin}${path}`;
|
|
11580
|
+
} catch {
|
|
11581
|
+
return path;
|
|
11582
|
+
}
|
|
11583
|
+
}
|
|
11584
|
+
function appendQuery(path, params) {
|
|
11585
|
+
const query = params.toString();
|
|
11586
|
+
return query ? `${path}?${query}` : path;
|
|
11587
|
+
}
|
|
11588
|
+
function buildMcpAppReviveParams(data) {
|
|
11589
|
+
const params = new URLSearchParams();
|
|
11590
|
+
const add = (key, value) => {
|
|
11591
|
+
if (value) {
|
|
11592
|
+
params.set(key, value);
|
|
11593
|
+
}
|
|
11594
|
+
};
|
|
11595
|
+
add("toolsetId", data.toolsetId);
|
|
11596
|
+
add("serverName", data.serverName);
|
|
11597
|
+
add("toolName", data.toolName);
|
|
11598
|
+
add("toolCallId", data.toolCallId);
|
|
11599
|
+
add("resourceUri", data.resourceUri);
|
|
11600
|
+
add("title", typeof data.title === "string" ? data.title : void 0);
|
|
11601
|
+
add("token", data.appInstanceToken);
|
|
11602
|
+
return params;
|
|
11603
|
+
}
|
|
11604
|
+
function buildMcpAppEndpointPath(data, endpoint) {
|
|
11605
|
+
return appendQuery(
|
|
11606
|
+
`/api/xpert-toolset/mcp-apps/${encodeURIComponent(
|
|
11607
|
+
data.appInstanceId
|
|
11608
|
+
)}/${endpoint}`,
|
|
11609
|
+
buildMcpAppReviveParams(data)
|
|
11610
|
+
);
|
|
11611
|
+
}
|
|
11612
|
+
function escapeHtmlAttribute(value) {
|
|
11613
|
+
return value.replaceAll("&", "&").replaceAll('"', """).replaceAll("<", "<").replaceAll(">", ">");
|
|
11614
|
+
}
|
|
11615
|
+
function domains(values) {
|
|
11616
|
+
return values?.filter((value) => value.trim()).join(" ") ?? "";
|
|
11617
|
+
}
|
|
11618
|
+
function buildCsp(csp) {
|
|
11619
|
+
const resourceDomains = domains(csp?.resourceDomains);
|
|
11620
|
+
const connectDomains = domains(csp?.connectDomains) || "'none'";
|
|
11621
|
+
const frameDomains = domains(csp?.frameDomains) || "'none'";
|
|
11622
|
+
const baseUriDomains = domains(csp?.baseUriDomains) || "'self'";
|
|
11623
|
+
return [
|
|
11624
|
+
"default-src 'none'",
|
|
11625
|
+
`script-src 'unsafe-inline' ${resourceDomains}`.trim(),
|
|
11626
|
+
`style-src 'unsafe-inline' ${resourceDomains}`.trim(),
|
|
11627
|
+
`img-src data: blob: ${resourceDomains}`.trim(),
|
|
11628
|
+
`media-src data: blob: ${resourceDomains}`.trim(),
|
|
11629
|
+
`font-src data: ${resourceDomains}`.trim(),
|
|
11630
|
+
`connect-src ${connectDomains}`,
|
|
11631
|
+
`frame-src ${frameDomains}`,
|
|
11632
|
+
`base-uri ${baseUriDomains}`
|
|
11633
|
+
].join("; ");
|
|
11634
|
+
}
|
|
11635
|
+
function injectHeadContent(html, content) {
|
|
11636
|
+
if (/<head[^>]*>/i.test(html)) {
|
|
11637
|
+
return html.replace(/<head([^>]*)>/i, `<head$1>${content}`);
|
|
11638
|
+
}
|
|
11639
|
+
return `<!doctype html><html><head>${content}</head><body>${html}</body></html>`;
|
|
11640
|
+
}
|
|
11641
|
+
function injectCsp(html, csp) {
|
|
11642
|
+
const meta = `<meta http-equiv="Content-Security-Policy" content="${escapeHtmlAttribute(
|
|
11643
|
+
buildCsp(csp)
|
|
11644
|
+
)}">`;
|
|
11645
|
+
return injectHeadContent(html, meta);
|
|
11646
|
+
}
|
|
11647
|
+
function decodeResourceHtml(resource) {
|
|
11648
|
+
if (typeof resource.text === "string") {
|
|
11649
|
+
return resource.text;
|
|
11650
|
+
}
|
|
11651
|
+
if (typeof resource.blob !== "string") {
|
|
11652
|
+
return null;
|
|
11653
|
+
}
|
|
11654
|
+
try {
|
|
11655
|
+
const decoded = window.atob(resource.blob);
|
|
11656
|
+
const escaped = Array.from(decoded).map((char) => `%${char.charCodeAt(0).toString(16).padStart(2, "0")}`).join("");
|
|
11657
|
+
return decodeURIComponent(escaped);
|
|
11658
|
+
} catch {
|
|
11659
|
+
try {
|
|
11660
|
+
return window.atob(resource.blob);
|
|
11661
|
+
} catch {
|
|
11662
|
+
return null;
|
|
11663
|
+
}
|
|
11664
|
+
}
|
|
11665
|
+
}
|
|
11666
|
+
function normalizeJsonRpcMessage(value) {
|
|
11667
|
+
const data = typeof value === "string" ? (() => {
|
|
11668
|
+
try {
|
|
11669
|
+
return JSON.parse(value);
|
|
11670
|
+
} catch {
|
|
11671
|
+
return null;
|
|
11672
|
+
}
|
|
11673
|
+
})() : value;
|
|
11674
|
+
if (!isRecord5(data) || typeof data.method !== "string") {
|
|
11675
|
+
return null;
|
|
11676
|
+
}
|
|
11677
|
+
return data;
|
|
11678
|
+
}
|
|
11679
|
+
function jsonRpcResult(id, result) {
|
|
11680
|
+
return {
|
|
11681
|
+
jsonrpc: "2.0",
|
|
11682
|
+
id: id ?? null,
|
|
11683
|
+
result
|
|
11684
|
+
};
|
|
11685
|
+
}
|
|
11686
|
+
function jsonRpcError(id, message) {
|
|
11687
|
+
return {
|
|
11688
|
+
jsonrpc: "2.0",
|
|
11689
|
+
id: id ?? null,
|
|
11690
|
+
error: {
|
|
11691
|
+
code: -32e3,
|
|
11692
|
+
message
|
|
11693
|
+
}
|
|
11694
|
+
};
|
|
11695
|
+
}
|
|
11696
|
+
function getErrorMessage(error) {
|
|
11697
|
+
return error instanceof Error ? error.message : String(error);
|
|
11698
|
+
}
|
|
11699
|
+
function getContainerDimensions(element) {
|
|
11700
|
+
if (!element) return null;
|
|
11701
|
+
const rect = element.getBoundingClientRect();
|
|
11702
|
+
return {
|
|
11703
|
+
width: rect.width,
|
|
11704
|
+
height: rect.height
|
|
11705
|
+
};
|
|
11706
|
+
}
|
|
11707
|
+
function normalizeHostLocale(locale) {
|
|
11708
|
+
return locale?.trim() || navigator.language || "en-US";
|
|
11709
|
+
}
|
|
11710
|
+
function getLocaleLanguage(locale) {
|
|
11711
|
+
return locale.split(/[-_]/)[0]?.toLowerCase() || locale.toLowerCase();
|
|
11712
|
+
}
|
|
11713
|
+
function getLocaleDirection(locale) {
|
|
11714
|
+
const language = getLocaleLanguage(locale);
|
|
11715
|
+
return ["ar", "fa", "he", "ur"].includes(language) ? "rtl" : "ltr";
|
|
11716
|
+
}
|
|
11717
|
+
function setHtmlAttribute(attrs, name, value) {
|
|
11718
|
+
const escaped = escapeHtmlAttribute(value);
|
|
11719
|
+
const pattern = new RegExp(`\\s${name}=("[^"]*"|'[^']*'|[^\\s>]*)`, "i");
|
|
11720
|
+
if (pattern.test(attrs)) {
|
|
11721
|
+
return attrs.replace(pattern, ` ${name}="${escaped}"`);
|
|
11722
|
+
}
|
|
11723
|
+
return `${attrs} ${name}="${escaped}"`;
|
|
11724
|
+
}
|
|
11725
|
+
function injectMcpAppLocale(html, locale) {
|
|
11726
|
+
const normalizedLocale = normalizeHostLocale(locale);
|
|
11727
|
+
const direction = getLocaleDirection(normalizedLocale);
|
|
11728
|
+
if (/<html[\s>]/i.test(html)) {
|
|
11729
|
+
return html.replace(/<html([^>]*)>/i, (_match, attrs) => {
|
|
11730
|
+
const withLang = setHtmlAttribute(attrs, "lang", normalizedLocale);
|
|
11731
|
+
const withDirection = setHtmlAttribute(withLang, "dir", direction);
|
|
11732
|
+
return `<html${withDirection}>`;
|
|
11733
|
+
});
|
|
11734
|
+
}
|
|
11735
|
+
return `<!doctype html><html lang="${escapeHtmlAttribute(
|
|
11736
|
+
normalizedLocale
|
|
11737
|
+
)}" dir="${direction}"><head></head><body>${html}</body></html>`;
|
|
11738
|
+
}
|
|
11739
|
+
var MCP_APP_THEME_COLOR_TOKENS = [
|
|
11740
|
+
["--background", "--mcp-app-color-background", "oklch(1 0 0)"],
|
|
11741
|
+
["--foreground", "--mcp-app-color-foreground", "oklch(0.145 0 0)"],
|
|
11742
|
+
["--card", "--mcp-app-color-card", "oklch(1 0 0)"],
|
|
11743
|
+
[
|
|
11744
|
+
"--card-foreground",
|
|
11745
|
+
"--mcp-app-color-card-foreground",
|
|
11746
|
+
"oklch(0.145 0 0)"
|
|
11747
|
+
],
|
|
11748
|
+
["--popover", "--mcp-app-color-popover", "oklch(1 0 0)"],
|
|
11749
|
+
[
|
|
11750
|
+
"--popover-foreground",
|
|
11751
|
+
"--mcp-app-color-popover-foreground",
|
|
11752
|
+
"oklch(0.145 0 0)"
|
|
11753
|
+
],
|
|
11754
|
+
["--primary", "--mcp-app-color-primary", "oklch(0.205 0 0)"],
|
|
11755
|
+
[
|
|
11756
|
+
"--primary-foreground",
|
|
11757
|
+
"--mcp-app-color-primary-foreground",
|
|
11758
|
+
"oklch(0.985 0 0)"
|
|
11759
|
+
],
|
|
11760
|
+
["--secondary", "--mcp-app-color-secondary", "oklch(0.97 0 0)"],
|
|
11761
|
+
[
|
|
11762
|
+
"--secondary-foreground",
|
|
11763
|
+
"--mcp-app-color-secondary-foreground",
|
|
11764
|
+
"oklch(0.205 0 0)"
|
|
11765
|
+
],
|
|
11766
|
+
["--muted", "--mcp-app-color-muted", "oklch(0.97 0 0)"],
|
|
11767
|
+
[
|
|
11768
|
+
"--muted-foreground",
|
|
11769
|
+
"--mcp-app-color-muted-foreground",
|
|
11770
|
+
"oklch(0.556 0 0)"
|
|
11771
|
+
],
|
|
11772
|
+
["--accent", "--mcp-app-color-accent", "oklch(0.97 0 0)"],
|
|
11773
|
+
[
|
|
11774
|
+
"--accent-foreground",
|
|
11775
|
+
"--mcp-app-color-accent-foreground",
|
|
11776
|
+
"oklch(0.205 0 0)"
|
|
11777
|
+
],
|
|
11778
|
+
[
|
|
11779
|
+
"--destructive",
|
|
11780
|
+
"--mcp-app-color-destructive",
|
|
11781
|
+
"oklch(0.577 0.245 27.325)"
|
|
11782
|
+
],
|
|
11783
|
+
[
|
|
11784
|
+
"--destructive-foreground",
|
|
11785
|
+
"--mcp-app-color-destructive-foreground",
|
|
11786
|
+
"oklch(0.985 0 0)"
|
|
11787
|
+
],
|
|
11788
|
+
["--border", "--mcp-app-color-border", "oklch(0.922 0 0)"],
|
|
11789
|
+
["--input", "--mcp-app-color-input", "oklch(0.922 0 0)"],
|
|
11790
|
+
["--ring", "--mcp-app-color-ring", "oklch(0.708 0 0)"],
|
|
11791
|
+
["--chart-1", "--mcp-app-color-chart-1", "oklch(0.87 0 0)"],
|
|
11792
|
+
["--chart-2", "--mcp-app-color-chart-2", "oklch(0.556 0 0)"],
|
|
11793
|
+
["--chart-3", "--mcp-app-color-chart-3", "oklch(0.439 0 0)"],
|
|
11794
|
+
["--chart-4", "--mcp-app-color-chart-4", "oklch(0.371 0 0)"],
|
|
11795
|
+
["--chart-5", "--mcp-app-color-chart-5", "oklch(0.269 0 0)"]
|
|
11796
|
+
];
|
|
11797
|
+
function sanitizeCssValue(value) {
|
|
11798
|
+
return value.replace(/[;{}<>]/g, "").trim();
|
|
11799
|
+
}
|
|
11800
|
+
function normalizeColorCssValue(value) {
|
|
11801
|
+
const trimmed = sanitizeCssValue(value);
|
|
11802
|
+
if (!trimmed) return "";
|
|
11803
|
+
if (/^(#|rgb\(|rgba\(|hsl\(|hsla\(|oklch\(|oklab\(|color\(|var\()/i.test(
|
|
11804
|
+
trimmed
|
|
11805
|
+
)) {
|
|
11806
|
+
return trimmed;
|
|
11807
|
+
}
|
|
11808
|
+
if (/^-?\d/.test(trimmed) && /\s/.test(trimmed)) {
|
|
11809
|
+
return `hsl(${trimmed})`;
|
|
11810
|
+
}
|
|
11811
|
+
return trimmed;
|
|
11812
|
+
}
|
|
11813
|
+
function getHostThemeMode() {
|
|
11814
|
+
return document.documentElement.classList.contains("dark") ? "dark" : "light";
|
|
11815
|
+
}
|
|
11816
|
+
function readHostCssVariable(element, variableName) {
|
|
11817
|
+
const candidates = [
|
|
11818
|
+
element,
|
|
11819
|
+
element === document.documentElement ? null : document.documentElement
|
|
11820
|
+
].filter(Boolean);
|
|
11821
|
+
for (const candidate of candidates) {
|
|
11822
|
+
const value = window.getComputedStyle(candidate).getPropertyValue(variableName).trim();
|
|
11823
|
+
if (value) {
|
|
11824
|
+
return value;
|
|
11825
|
+
}
|
|
11826
|
+
}
|
|
11827
|
+
return "";
|
|
11828
|
+
}
|
|
11829
|
+
function buildMcpAppTheme(element) {
|
|
11830
|
+
const source = element ?? document.documentElement;
|
|
11831
|
+
const sourceStyles = window.getComputedStyle(source);
|
|
11832
|
+
const cssVariables = {
|
|
11833
|
+
"--mcp-app-color-scheme": getHostThemeMode(),
|
|
11834
|
+
"--mcp-app-font-sans": sanitizeCssValue(
|
|
11835
|
+
sourceStyles.fontFamily || "ui-sans-serif, system-ui, sans-serif"
|
|
11836
|
+
),
|
|
11837
|
+
"--mcp-app-font-mono": sanitizeCssValue(
|
|
11838
|
+
readHostCssVariable(source, "--font-mono") || "ui-monospace, SFMono-Regular, Menlo, monospace"
|
|
11839
|
+
),
|
|
11840
|
+
"--mcp-app-radius": sanitizeCssValue(
|
|
11841
|
+
readHostCssVariable(source, "--radius") || "0.5rem"
|
|
11842
|
+
)
|
|
11843
|
+
};
|
|
11844
|
+
for (const [
|
|
11845
|
+
hostVariable,
|
|
11846
|
+
appVariable,
|
|
11847
|
+
fallback
|
|
11848
|
+
] of MCP_APP_THEME_COLOR_TOKENS) {
|
|
11849
|
+
cssVariables[appVariable] = normalizeColorCssValue(readHostCssVariable(source, hostVariable)) || fallback;
|
|
11850
|
+
}
|
|
11851
|
+
return {
|
|
11852
|
+
mode: getHostThemeMode(),
|
|
11853
|
+
cssVariables
|
|
11854
|
+
};
|
|
11855
|
+
}
|
|
11856
|
+
function injectMcpAppTheme(html, theme) {
|
|
11857
|
+
const declarations = Object.entries(theme.cssVariables).map(([name, value]) => `${name}: ${sanitizeCssValue(value)};`).join("");
|
|
11858
|
+
const style = `<style id="mcp-app-host-theme">:root{color-scheme:${theme.mode};${declarations}}</style>`;
|
|
11859
|
+
return injectHeadContent(html, style);
|
|
11860
|
+
}
|
|
11861
|
+
function buildStandardToolInfo(data, resource) {
|
|
11862
|
+
const raw = resource?.toolInfo ?? {};
|
|
11863
|
+
const rawTitle = isRecord5(raw) && (raw.title !== void 0 || raw.name !== void 0) ? raw.title ?? raw.name : void 0;
|
|
11864
|
+
const rawDescription = isRecord5(raw) && raw.description !== void 0 ? raw.description : void 0;
|
|
11865
|
+
const rawIcon = isRecord5(raw) && raw.icon !== void 0 ? raw.icon : void 0;
|
|
11866
|
+
const originalName = isRecord5(raw) && typeof raw.originalName === "string" ? raw.originalName : data.toolName;
|
|
11867
|
+
const title = rawTitle ?? resource?.title ?? data.title ?? data.toolName;
|
|
11868
|
+
const description = rawDescription ?? resource?.description ?? data.description;
|
|
11869
|
+
const icon = rawIcon ?? resource?.icon ?? data.icon;
|
|
11870
|
+
return {
|
|
11871
|
+
...raw,
|
|
11872
|
+
id: data.toolCallId,
|
|
11873
|
+
tool: {
|
|
11874
|
+
name: originalName,
|
|
11875
|
+
title,
|
|
11876
|
+
...description ? { description } : {},
|
|
11877
|
+
...icon ? { icon } : {}
|
|
11878
|
+
}
|
|
11879
|
+
};
|
|
11880
|
+
}
|
|
11881
|
+
function hasPermissionGrant(value) {
|
|
11882
|
+
return value === true || isRecord5(value);
|
|
11883
|
+
}
|
|
11884
|
+
function buildIframeAllow(permissions) {
|
|
11885
|
+
if (!permissions) return void 0;
|
|
11886
|
+
const policies = [];
|
|
11887
|
+
if (hasPermissionGrant(permissions.camera)) {
|
|
11888
|
+
policies.push("camera *");
|
|
11889
|
+
}
|
|
11890
|
+
if (hasPermissionGrant(permissions.microphone)) {
|
|
11891
|
+
policies.push("microphone *");
|
|
11892
|
+
}
|
|
11893
|
+
if (hasPermissionGrant(permissions.geolocation)) {
|
|
11894
|
+
policies.push("geolocation *");
|
|
11895
|
+
}
|
|
11896
|
+
if (hasPermissionGrant(permissions.clipboardWrite)) {
|
|
11897
|
+
policies.push("clipboard-write *");
|
|
11898
|
+
}
|
|
11899
|
+
return policies.length ? policies.join("; ") : void 0;
|
|
11900
|
+
}
|
|
11901
|
+
function buildSandboxAttribute() {
|
|
11902
|
+
return ["allow-downloads", "allow-forms", "allow-modals", "allow-scripts"].join(
|
|
11903
|
+
" "
|
|
11904
|
+
);
|
|
11905
|
+
}
|
|
11906
|
+
function stringifyToolResult(value) {
|
|
11907
|
+
if (typeof value === "string") return value;
|
|
11908
|
+
try {
|
|
11909
|
+
return JSON.stringify(value ?? null);
|
|
11910
|
+
} catch {
|
|
11911
|
+
return String(value);
|
|
11912
|
+
}
|
|
11913
|
+
}
|
|
11914
|
+
function normalizeCallToolResult(value) {
|
|
11915
|
+
if (isRecord5(value) && Array.isArray(value.content)) {
|
|
11916
|
+
return value;
|
|
11917
|
+
}
|
|
11918
|
+
if (Array.isArray(value) && value.length >= 2) {
|
|
11919
|
+
const [content, artifact] = value;
|
|
11920
|
+
const text = typeof content === "string" ? content : stringifyToolResult(content);
|
|
11921
|
+
const normalized = {
|
|
11922
|
+
content: [
|
|
11923
|
+
{
|
|
11924
|
+
type: "text",
|
|
11925
|
+
text
|
|
11926
|
+
}
|
|
11927
|
+
]
|
|
11928
|
+
};
|
|
11929
|
+
if (isRecord5(artifact)) {
|
|
11930
|
+
normalized._meta = artifact;
|
|
11931
|
+
if (isRecord5(artifact.structuredContent)) {
|
|
11932
|
+
normalized.structuredContent = artifact.structuredContent;
|
|
11933
|
+
}
|
|
11934
|
+
} else if (Array.isArray(artifact)) {
|
|
11935
|
+
const structured = artifact.find(
|
|
11936
|
+
(item) => isRecord5(item) && isRecord5(item.structuredContent)
|
|
11937
|
+
);
|
|
11938
|
+
const meta = artifact.find(isRecord5);
|
|
11939
|
+
if (structured?.structuredContent) {
|
|
11940
|
+
normalized.structuredContent = structured.structuredContent;
|
|
11941
|
+
}
|
|
11942
|
+
if (meta) {
|
|
11943
|
+
normalized._meta = meta;
|
|
11944
|
+
}
|
|
11945
|
+
}
|
|
11946
|
+
return normalized;
|
|
11947
|
+
}
|
|
11948
|
+
return {
|
|
11949
|
+
content: [
|
|
11950
|
+
{
|
|
11951
|
+
type: "text",
|
|
11952
|
+
text: stringifyToolResult(value)
|
|
11953
|
+
}
|
|
11954
|
+
]
|
|
11955
|
+
};
|
|
11956
|
+
}
|
|
11957
|
+
function isHttpUrl(value) {
|
|
11958
|
+
try {
|
|
11959
|
+
const url = new URL(value);
|
|
11960
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
11961
|
+
} catch {
|
|
11962
|
+
return false;
|
|
11963
|
+
}
|
|
11964
|
+
}
|
|
11965
|
+
function contentBlocksToText(content) {
|
|
11966
|
+
if (!Array.isArray(content)) return null;
|
|
11967
|
+
const parts = content.map((item) => {
|
|
11968
|
+
if (!isRecord5(item)) return "";
|
|
11969
|
+
if (item.type === "text" && typeof item.text === "string") {
|
|
11970
|
+
return item.text;
|
|
11971
|
+
}
|
|
11972
|
+
if (item.type === "resource_link" && typeof item.uri === "string") {
|
|
11973
|
+
return item.uri;
|
|
11974
|
+
}
|
|
11975
|
+
if (item.type === "image" || item.type === "audio") {
|
|
11976
|
+
return `[${item.type}]`;
|
|
11977
|
+
}
|
|
11978
|
+
return stringifyToolResult(item);
|
|
11979
|
+
}).map((part) => part.trim()).filter(Boolean);
|
|
11980
|
+
return parts.length ? parts.join("\n\n") : null;
|
|
11981
|
+
}
|
|
11982
|
+
function isMcpAppComponentData(data) {
|
|
11983
|
+
return isRecord5(data) && data.type === "McpApp" && typeof data.appInstanceId === "string" && typeof data.resourceUri === "string";
|
|
11984
|
+
}
|
|
11985
|
+
function McpAppMessage({
|
|
11986
|
+
data,
|
|
11987
|
+
className
|
|
11988
|
+
}) {
|
|
11989
|
+
const { i18n: i18n2 } = useChatkitTranslation();
|
|
11990
|
+
const {
|
|
11991
|
+
apiUrl,
|
|
11992
|
+
authenticatedFetch,
|
|
11993
|
+
isLoading: streamIsLoading,
|
|
11994
|
+
submit
|
|
11995
|
+
} = useStreamContext();
|
|
11996
|
+
const iframeRef = React35.useRef(null);
|
|
11997
|
+
const containerRef = React35.useRef(null);
|
|
11998
|
+
const initializedRef = React35.useRef(false);
|
|
11999
|
+
const sentInitialResultRef = React35.useRef(false);
|
|
12000
|
+
const modelContextRef = React35.useRef(null);
|
|
12001
|
+
const [resource, setResource] = React35.useState(
|
|
12002
|
+
null
|
|
12003
|
+
);
|
|
12004
|
+
const [srcDoc, setSrcDoc] = React35.useState(null);
|
|
12005
|
+
const [height, setHeight] = React35.useState(420);
|
|
12006
|
+
const [error, setError] = React35.useState(null);
|
|
12007
|
+
const [isLoading, setIsLoading] = React35.useState(true);
|
|
12008
|
+
const resourceUrl = React35.useMemo(
|
|
12009
|
+
() => buildXpertApiUrl(
|
|
12010
|
+
apiUrl,
|
|
12011
|
+
buildMcpAppEndpointPath(data, "resource")
|
|
12012
|
+
),
|
|
12013
|
+
[apiUrl, data]
|
|
12014
|
+
);
|
|
12015
|
+
const rpcUrl = React35.useMemo(
|
|
12016
|
+
() => buildXpertApiUrl(
|
|
12017
|
+
apiUrl,
|
|
12018
|
+
buildMcpAppEndpointPath(data, "rpc")
|
|
12019
|
+
),
|
|
12020
|
+
[apiUrl, data]
|
|
12021
|
+
);
|
|
12022
|
+
const postToApp = React35.useCallback((message) => {
|
|
12023
|
+
iframeRef.current?.contentWindow?.postMessage(message, "*");
|
|
12024
|
+
}, []);
|
|
12025
|
+
const callHostRpc = React35.useCallback(
|
|
12026
|
+
async (request) => {
|
|
12027
|
+
const response = await authenticatedFetch(rpcUrl, {
|
|
12028
|
+
method: "POST",
|
|
12029
|
+
headers: {
|
|
12030
|
+
"content-type": "application/json"
|
|
12031
|
+
},
|
|
12032
|
+
body: JSON.stringify({
|
|
12033
|
+
jsonrpc: "2.0",
|
|
12034
|
+
id: request.id ?? null,
|
|
12035
|
+
method: request.method,
|
|
12036
|
+
params: request.params
|
|
12037
|
+
})
|
|
12038
|
+
});
|
|
12039
|
+
if (!response.ok) {
|
|
12040
|
+
throw new Error(`MCP App RPC failed with ${response.status}`);
|
|
12041
|
+
}
|
|
12042
|
+
return response.json();
|
|
12043
|
+
},
|
|
12044
|
+
[authenticatedFetch, rpcUrl]
|
|
12045
|
+
);
|
|
12046
|
+
const sendInitialToolNotifications = React35.useCallback(() => {
|
|
12047
|
+
if (!initializedRef.current || sentInitialResultRef.current || !resource) {
|
|
12048
|
+
return;
|
|
12049
|
+
}
|
|
12050
|
+
sentInitialResultRef.current = true;
|
|
12051
|
+
postToApp({
|
|
12052
|
+
jsonrpc: "2.0",
|
|
12053
|
+
method: "ui/notifications/tool-input",
|
|
12054
|
+
params: {
|
|
12055
|
+
arguments: resource.toolInput ?? data.toolInput ?? {}
|
|
12056
|
+
}
|
|
12057
|
+
});
|
|
12058
|
+
postToApp({
|
|
12059
|
+
jsonrpc: "2.0",
|
|
12060
|
+
method: "ui/notifications/tool-result",
|
|
12061
|
+
params: {
|
|
12062
|
+
...normalizeCallToolResult(resource.toolResult),
|
|
12063
|
+
toolCallId: data.toolCallId,
|
|
12064
|
+
toolName: data.toolName,
|
|
12065
|
+
// Legacy compatibility for apps written before the 2026-01-26 notification shape.
|
|
12066
|
+
result: resource.toolResult
|
|
12067
|
+
}
|
|
12068
|
+
});
|
|
12069
|
+
}, [data.toolCallId, data.toolInput, data.toolName, postToApp, resource]);
|
|
12070
|
+
React35.useEffect(() => {
|
|
12071
|
+
const controller = new AbortController();
|
|
12072
|
+
initializedRef.current = false;
|
|
12073
|
+
sentInitialResultRef.current = false;
|
|
12074
|
+
setIsLoading(true);
|
|
12075
|
+
setError(null);
|
|
12076
|
+
setResource(null);
|
|
12077
|
+
setSrcDoc(null);
|
|
12078
|
+
void (async () => {
|
|
12079
|
+
try {
|
|
12080
|
+
const response = await authenticatedFetch(resourceUrl, {
|
|
12081
|
+
signal: controller.signal
|
|
12082
|
+
});
|
|
12083
|
+
if (!response.ok) {
|
|
12084
|
+
throw new Error(`MCP App resource failed with ${response.status}`);
|
|
12085
|
+
}
|
|
12086
|
+
const payload = await response.json();
|
|
12087
|
+
const html = decodeResourceHtml(payload);
|
|
12088
|
+
if (!html) {
|
|
12089
|
+
throw new Error("MCP App resource did not include HTML content");
|
|
12090
|
+
}
|
|
12091
|
+
setResource(payload);
|
|
12092
|
+
const hostLocale = normalizeHostLocale(i18n2.language);
|
|
12093
|
+
setSrcDoc(
|
|
12094
|
+
injectMcpAppTheme(
|
|
12095
|
+
injectCsp(
|
|
12096
|
+
injectMcpAppLocale(html, hostLocale),
|
|
12097
|
+
payload.csp ?? data.csp
|
|
12098
|
+
),
|
|
12099
|
+
buildMcpAppTheme(containerRef.current)
|
|
12100
|
+
)
|
|
12101
|
+
);
|
|
12102
|
+
} catch (loadError) {
|
|
12103
|
+
if (!controller.signal.aborted) {
|
|
12104
|
+
setError(getErrorMessage(loadError));
|
|
12105
|
+
}
|
|
12106
|
+
} finally {
|
|
12107
|
+
if (!controller.signal.aborted) {
|
|
12108
|
+
setIsLoading(false);
|
|
12109
|
+
}
|
|
12110
|
+
}
|
|
12111
|
+
})();
|
|
12112
|
+
return () => {
|
|
12113
|
+
controller.abort();
|
|
12114
|
+
};
|
|
12115
|
+
}, [
|
|
12116
|
+
authenticatedFetch,
|
|
12117
|
+
data.appInstanceId,
|
|
12118
|
+
data.csp,
|
|
12119
|
+
i18n2.language,
|
|
12120
|
+
resourceUrl
|
|
12121
|
+
]);
|
|
12122
|
+
React35.useEffect(() => {
|
|
12123
|
+
sendInitialToolNotifications();
|
|
12124
|
+
}, [sendInitialToolNotifications]);
|
|
12125
|
+
React35.useEffect(() => {
|
|
12126
|
+
const handleMessage = async (event) => {
|
|
12127
|
+
if (event.source !== iframeRef.current?.contentWindow) {
|
|
12128
|
+
return;
|
|
12129
|
+
}
|
|
12130
|
+
const request = normalizeJsonRpcMessage(event.data);
|
|
12131
|
+
if (!request?.method) {
|
|
12132
|
+
return;
|
|
12133
|
+
}
|
|
12134
|
+
if (request.method === "ui/notifications/initialized") {
|
|
12135
|
+
initializedRef.current = true;
|
|
12136
|
+
sendInitialToolNotifications();
|
|
12137
|
+
return;
|
|
12138
|
+
}
|
|
12139
|
+
if (request.method === "ui/notifications/size-changed") {
|
|
12140
|
+
const nextHeight = isRecord5(request.params) && typeof request.params.height === "number" ? request.params.height : null;
|
|
12141
|
+
if (nextHeight !== null) {
|
|
12142
|
+
setHeight(Math.min(900, Math.max(240, Math.round(nextHeight))));
|
|
12143
|
+
}
|
|
12144
|
+
return;
|
|
12145
|
+
}
|
|
12146
|
+
if (request.method === "ui/initialize") {
|
|
12147
|
+
initializedRef.current = true;
|
|
12148
|
+
const permissions = resource?.permissions ?? data.permissions;
|
|
12149
|
+
const csp = resource?.csp ?? data.csp;
|
|
12150
|
+
const toolInfo = buildStandardToolInfo(data, resource);
|
|
12151
|
+
const theme = buildMcpAppTheme(containerRef.current);
|
|
12152
|
+
const hostLocale = normalizeHostLocale(i18n2.language);
|
|
12153
|
+
const hostLanguage = getLocaleLanguage(hostLocale);
|
|
12154
|
+
const hostDirection = getLocaleDirection(hostLocale);
|
|
12155
|
+
postToApp(
|
|
12156
|
+
jsonRpcResult(request.id, {
|
|
12157
|
+
protocolVersion: "2026-01-26",
|
|
12158
|
+
hostInfo: {
|
|
12159
|
+
name: "xpert-chatkit",
|
|
12160
|
+
version: "1.0.0",
|
|
12161
|
+
title: "Xpert ChatKit"
|
|
12162
|
+
},
|
|
12163
|
+
hostCapabilities: {
|
|
12164
|
+
serverTools: {},
|
|
12165
|
+
serverResources: {},
|
|
12166
|
+
openLinks: {},
|
|
12167
|
+
logging: {},
|
|
12168
|
+
message: {
|
|
12169
|
+
text: {}
|
|
12170
|
+
},
|
|
12171
|
+
updateModelContext: {
|
|
12172
|
+
text: {},
|
|
12173
|
+
structuredContent: {}
|
|
12174
|
+
},
|
|
12175
|
+
sandbox: {
|
|
12176
|
+
...permissions ? { permissions } : {},
|
|
12177
|
+
...csp ? { csp } : {}
|
|
12178
|
+
}
|
|
12179
|
+
},
|
|
12180
|
+
hostContext: {
|
|
12181
|
+
toolInfo,
|
|
12182
|
+
theme: theme.mode,
|
|
12183
|
+
themeCssVariables: theme.cssVariables,
|
|
12184
|
+
locale: hostLocale,
|
|
12185
|
+
language: hostLanguage,
|
|
12186
|
+
direction: hostDirection,
|
|
12187
|
+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
12188
|
+
displayMode: "inline",
|
|
12189
|
+
availableDisplayModes: ["inline"],
|
|
12190
|
+
containerDimensions: getContainerDimensions(containerRef.current),
|
|
12191
|
+
userAgent: "xpert-chatkit",
|
|
12192
|
+
platform: "web",
|
|
12193
|
+
deviceCapabilities: {
|
|
12194
|
+
touch: navigator.maxTouchPoints > 0,
|
|
12195
|
+
hover: window.matchMedia("(hover: hover)").matches
|
|
12196
|
+
}
|
|
12197
|
+
},
|
|
12198
|
+
// Legacy compatibility for apps written before the 2026-01-26 result shape.
|
|
12199
|
+
capabilities: {
|
|
12200
|
+
displayModes: ["inline"],
|
|
12201
|
+
serverTools: true,
|
|
12202
|
+
serverResources: true,
|
|
12203
|
+
openLinks: true
|
|
12204
|
+
},
|
|
12205
|
+
context: {
|
|
12206
|
+
toolInfo: resource?.toolInfo ?? {
|
|
12207
|
+
name: data.toolName,
|
|
12208
|
+
toolCallId: data.toolCallId
|
|
12209
|
+
},
|
|
12210
|
+
theme: theme.mode,
|
|
12211
|
+
themeCssVariables: theme.cssVariables,
|
|
12212
|
+
locale: hostLocale,
|
|
12213
|
+
language: hostLanguage,
|
|
12214
|
+
direction: hostDirection,
|
|
12215
|
+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
12216
|
+
displayMode: "inline",
|
|
12217
|
+
availableDisplayModes: ["inline"],
|
|
12218
|
+
containerDimensions: getContainerDimensions(containerRef.current),
|
|
12219
|
+
userAgent: navigator.userAgent,
|
|
12220
|
+
platform: navigator.platform
|
|
12221
|
+
}
|
|
12222
|
+
})
|
|
12223
|
+
);
|
|
12224
|
+
sendInitialToolNotifications();
|
|
12225
|
+
return;
|
|
12226
|
+
}
|
|
12227
|
+
if (request.method === "ui/open-link") {
|
|
12228
|
+
const href = isRecord5(request.params) && typeof request.params.url === "string" ? request.params.url : isRecord5(request.params) && typeof request.params.href === "string" ? request.params.href : null;
|
|
12229
|
+
if (href && isHttpUrl(href)) {
|
|
12230
|
+
window.open(href, "_blank", "noopener,noreferrer");
|
|
12231
|
+
if (request.id !== void 0) {
|
|
12232
|
+
postToApp(jsonRpcResult(request.id, {}));
|
|
12233
|
+
}
|
|
12234
|
+
} else if (request.id !== void 0) {
|
|
12235
|
+
postToApp(jsonRpcResult(request.id, { isError: true }));
|
|
12236
|
+
}
|
|
12237
|
+
return;
|
|
12238
|
+
}
|
|
12239
|
+
if (request.method === "ui/update-model-context") {
|
|
12240
|
+
modelContextRef.current = request.params;
|
|
12241
|
+
try {
|
|
12242
|
+
postToApp(await callHostRpc(request));
|
|
12243
|
+
} catch (rpcError) {
|
|
12244
|
+
postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
|
|
12245
|
+
}
|
|
12246
|
+
return;
|
|
12247
|
+
}
|
|
12248
|
+
if (request.method === "ui/message") {
|
|
12249
|
+
try {
|
|
12250
|
+
if (!isRecord5(request.params) || request.params.role !== "user" || !Array.isArray(request.params.content)) {
|
|
12251
|
+
throw new Error(
|
|
12252
|
+
'ui/message params must include role "user" and content blocks'
|
|
12253
|
+
);
|
|
12254
|
+
}
|
|
12255
|
+
const hostResponse = await callHostRpc(request);
|
|
12256
|
+
if (isRecord5(hostResponse) && hostResponse.error) {
|
|
12257
|
+
postToApp(hostResponse);
|
|
12258
|
+
return;
|
|
12259
|
+
}
|
|
12260
|
+
const inputText = contentBlocksToText(request.params.content);
|
|
12261
|
+
if (!inputText) {
|
|
12262
|
+
throw new Error("ui/message content did not include text");
|
|
12263
|
+
}
|
|
12264
|
+
await submit(
|
|
12265
|
+
{
|
|
12266
|
+
input: {
|
|
12267
|
+
input: inputText
|
|
12268
|
+
}
|
|
12269
|
+
},
|
|
12270
|
+
{
|
|
12271
|
+
...streamIsLoading ? { followUpMode: "queue" } : {},
|
|
12272
|
+
context: {
|
|
12273
|
+
mcpApp: {
|
|
12274
|
+
appInstanceId: data.appInstanceId,
|
|
12275
|
+
resourceUri: data.resourceUri,
|
|
12276
|
+
toolName: data.toolName,
|
|
12277
|
+
toolCallId: data.toolCallId,
|
|
12278
|
+
modelContext: modelContextRef.current
|
|
12279
|
+
}
|
|
12280
|
+
}
|
|
12281
|
+
}
|
|
12282
|
+
);
|
|
12283
|
+
postToApp(hostResponse);
|
|
12284
|
+
} catch (messageError) {
|
|
12285
|
+
postToApp(jsonRpcError(request.id, getErrorMessage(messageError)));
|
|
12286
|
+
}
|
|
12287
|
+
return;
|
|
12288
|
+
}
|
|
12289
|
+
if (request.id === void 0 && request.method.startsWith("ui/")) {
|
|
12290
|
+
return;
|
|
12291
|
+
}
|
|
12292
|
+
try {
|
|
12293
|
+
postToApp(await callHostRpc(request));
|
|
12294
|
+
} catch (rpcError) {
|
|
12295
|
+
postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
|
|
12296
|
+
}
|
|
12297
|
+
};
|
|
12298
|
+
window.addEventListener("message", handleMessage);
|
|
12299
|
+
return () => {
|
|
12300
|
+
window.removeEventListener("message", handleMessage);
|
|
12301
|
+
};
|
|
12302
|
+
}, [
|
|
12303
|
+
callHostRpc,
|
|
12304
|
+
data.appInstanceId,
|
|
12305
|
+
data.csp,
|
|
12306
|
+
data.permissions,
|
|
12307
|
+
data.resourceUri,
|
|
12308
|
+
data.title,
|
|
12309
|
+
data.toolCallId,
|
|
12310
|
+
data.toolName,
|
|
12311
|
+
i18n2.language,
|
|
12312
|
+
postToApp,
|
|
12313
|
+
resource?.csp,
|
|
12314
|
+
resource?.permissions,
|
|
12315
|
+
resource?.toolInfo,
|
|
12316
|
+
sendInitialToolNotifications,
|
|
12317
|
+
streamIsLoading,
|
|
12318
|
+
submit
|
|
12319
|
+
]);
|
|
12320
|
+
const iframePermissions = resource?.permissions ?? data.permissions;
|
|
12321
|
+
const iframeAllow = React35.useMemo(
|
|
12322
|
+
() => buildIframeAllow(iframePermissions),
|
|
12323
|
+
[iframePermissions]
|
|
12324
|
+
);
|
|
12325
|
+
const sandbox = React35.useMemo(() => buildSandboxAttribute(), []);
|
|
12326
|
+
const prefersBorder = resource?.prefersBorder ?? data.prefersBorder ?? true;
|
|
12327
|
+
const displayTitle = (0, import_chatkit_types9.resolveLocalizedText)(resource?.title ?? data.title, i18n2.language) ?? data.toolName;
|
|
12328
|
+
const displayDescription = (0, import_chatkit_types9.resolveLocalizedText)(
|
|
12329
|
+
resource?.description ?? data.description,
|
|
12330
|
+
i18n2.language
|
|
12331
|
+
);
|
|
12332
|
+
const displayIcon = resource?.icon ?? data.icon;
|
|
12333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
12334
|
+
"div",
|
|
12335
|
+
{
|
|
12336
|
+
ref: containerRef,
|
|
12337
|
+
className: cn(
|
|
12338
|
+
"overflow-hidden rounded-lg border bg-background shadow-sm",
|
|
12339
|
+
!prefersBorder && "border-transparent shadow-none",
|
|
12340
|
+
className
|
|
12341
|
+
),
|
|
12342
|
+
children: [
|
|
12343
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex min-h-10 items-center justify-between gap-3 border-b px-3 py-2", children: [
|
|
12344
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
12345
|
+
displayIcon ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
12346
|
+
IconDefinitionRenderer,
|
|
12347
|
+
{
|
|
12348
|
+
icon: displayIcon,
|
|
12349
|
+
size: 18,
|
|
12350
|
+
className: "shrink-0",
|
|
12351
|
+
decorative: true
|
|
12352
|
+
}
|
|
12353
|
+
) : null,
|
|
12354
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "min-w-0", children: [
|
|
12355
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "truncate text-sm font-medium", children: displayTitle }),
|
|
12356
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "truncate text-[11px] text-muted-foreground", children: displayDescription ?? data.resourceUri })
|
|
12357
|
+
] })
|
|
12358
|
+
] }),
|
|
12359
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Badge, { variant: "secondary", className: "shrink-0 rounded-md", children: "MCP App" })
|
|
12360
|
+
] }),
|
|
12361
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex h-40 items-center justify-center gap-2 text-sm text-muted-foreground", children: [
|
|
12362
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_lucide_react23.Loader2, { className: "h-4 w-4 animate-spin" }),
|
|
12363
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "Loading MCP App" })
|
|
12364
|
+
] }) : error ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex h-40 items-center justify-center gap-2 px-4 text-sm text-destructive", children: [
|
|
12365
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_lucide_react23.AlertCircle, { className: "h-4 w-4 shrink-0" }),
|
|
12366
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "min-w-0 break-words", children: error })
|
|
12367
|
+
] }) : srcDoc ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
12368
|
+
"iframe",
|
|
12369
|
+
{
|
|
12370
|
+
ref: iframeRef,
|
|
12371
|
+
title: displayTitle,
|
|
12372
|
+
srcDoc,
|
|
12373
|
+
className: "block w-full bg-background",
|
|
12374
|
+
style: { height },
|
|
12375
|
+
sandbox,
|
|
12376
|
+
allow: iframeAllow,
|
|
12377
|
+
referrerPolicy: "no-referrer"
|
|
12378
|
+
}
|
|
12379
|
+
) : null
|
|
12380
|
+
]
|
|
12381
|
+
}
|
|
12382
|
+
);
|
|
12383
|
+
}
|
|
12384
|
+
|
|
12385
|
+
// src/components/thread/messages/ai.tsx
|
|
12386
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
11566
12387
|
var assistantMessageStackClassName = "space-y-3 in-data-[density=compact]:space-y-2 in-data-[density=spacious]:space-y-4";
|
|
11567
12388
|
function isTextContent3(content) {
|
|
11568
12389
|
return content.type === "text";
|
|
@@ -11580,6 +12401,9 @@ function isWidgetComponent2(content) {
|
|
|
11580
12401
|
const data = content.data;
|
|
11581
12402
|
return data?.type === "Widget" && Array.isArray(data.widgets);
|
|
11582
12403
|
}
|
|
12404
|
+
function isMcpAppComponent(content) {
|
|
12405
|
+
return isMcpAppComponentData(content.data);
|
|
12406
|
+
}
|
|
11583
12407
|
function isMemoryContent(content) {
|
|
11584
12408
|
return content.type === "memory";
|
|
11585
12409
|
}
|
|
@@ -11598,11 +12422,11 @@ function ReasoningBlock({
|
|
|
11598
12422
|
}) {
|
|
11599
12423
|
const blocks = reasoning.filter((item) => item.text?.trim());
|
|
11600
12424
|
if (blocks.length === 0) return null;
|
|
11601
|
-
return /* @__PURE__ */ (0,
|
|
12425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "space-y-2", children: blocks.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11602
12426
|
"div",
|
|
11603
12427
|
{
|
|
11604
12428
|
className: "rounded-lg border bg-muted/40 p-3 text-xs text-muted-foreground",
|
|
11605
|
-
children: /* @__PURE__ */ (0,
|
|
12429
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "whitespace-pre-wrap wrap-break-word leading-relaxed", children: item.text })
|
|
11606
12430
|
},
|
|
11607
12431
|
item.id ?? `reasoning-${index}`
|
|
11608
12432
|
)) });
|
|
@@ -11610,12 +12434,12 @@ function ReasoningBlock({
|
|
|
11610
12434
|
function ImageBlock({ content }) {
|
|
11611
12435
|
const imageUrl = typeof content.image_url === "string" ? content.image_url : typeof content.image_url?.url === "string" ? content.image_url.url : null;
|
|
11612
12436
|
if (!imageUrl) {
|
|
11613
|
-
return /* @__PURE__ */ (0,
|
|
11614
|
-
/* @__PURE__ */ (0,
|
|
11615
|
-
/* @__PURE__ */ (0,
|
|
12437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Card, { children: [
|
|
12438
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardHeader, { className: "space-y-1", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardTitle, { className: "text-sm", children: "Image" }) }),
|
|
12439
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: safeJson3(content) })
|
|
11616
12440
|
] });
|
|
11617
12441
|
}
|
|
11618
|
-
return /* @__PURE__ */ (0,
|
|
12442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("figure", { className: "overflow-hidden rounded-lg border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11619
12443
|
"img",
|
|
11620
12444
|
{
|
|
11621
12445
|
src: imageUrl,
|
|
@@ -11625,12 +12449,12 @@ function ImageBlock({ content }) {
|
|
|
11625
12449
|
) });
|
|
11626
12450
|
}
|
|
11627
12451
|
function MemoryBlock({ content }) {
|
|
11628
|
-
return /* @__PURE__ */ (0,
|
|
11629
|
-
/* @__PURE__ */ (0,
|
|
11630
|
-
/* @__PURE__ */ (0,
|
|
11631
|
-
/* @__PURE__ */ (0,
|
|
12452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Card, { children: [
|
|
12453
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
12454
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardTitle, { className: "text-sm", children: "Memory" }),
|
|
12455
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Badge, { variant: "secondary", children: "Memory" })
|
|
11632
12456
|
] }),
|
|
11633
|
-
/* @__PURE__ */ (0,
|
|
12457
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: safeJson3(content.data ?? []) }) })
|
|
11634
12458
|
] });
|
|
11635
12459
|
}
|
|
11636
12460
|
function parseStepDate2(value) {
|
|
@@ -11664,11 +12488,11 @@ function formatStepDuration3(durationMs) {
|
|
|
11664
12488
|
}
|
|
11665
12489
|
function ComponentBlock({ content }) {
|
|
11666
12490
|
const { i18n: i18n2 } = useChatkitTranslation();
|
|
11667
|
-
const [isExpanded, setIsExpanded] =
|
|
11668
|
-
const contentRef =
|
|
11669
|
-
const shouldAutoScrollRef =
|
|
11670
|
-
const previousScrollTopRef =
|
|
11671
|
-
const [durationNow, setDurationNow] =
|
|
12491
|
+
const [isExpanded, setIsExpanded] = React36.useState(false);
|
|
12492
|
+
const contentRef = React36.useRef(null);
|
|
12493
|
+
const shouldAutoScrollRef = React36.useRef(true);
|
|
12494
|
+
const previousScrollTopRef = React36.useRef(0);
|
|
12495
|
+
const [durationNow, setDurationNow] = React36.useState(() => Date.now());
|
|
11672
12496
|
const data = getToolStepData(content);
|
|
11673
12497
|
const category = data.category ?? "Component";
|
|
11674
12498
|
const title = getToolActivityLabel(content, i18n2.language);
|
|
@@ -11682,10 +12506,10 @@ function ComponentBlock({ content }) {
|
|
|
11682
12506
|
const endedAt = parseStepDate2(data.end_date);
|
|
11683
12507
|
const durationMs = createdAt === null ? null : Math.max(0, (endedAt ?? durationNow) - createdAt);
|
|
11684
12508
|
const durationLabel = durationMs === null ? null : formatStepDuration3(durationMs);
|
|
11685
|
-
|
|
12509
|
+
React36.useEffect(() => {
|
|
11686
12510
|
if (status === "running" && output !== null) setIsExpanded(true);
|
|
11687
12511
|
}, [status, output]);
|
|
11688
|
-
|
|
12512
|
+
React36.useEffect(() => {
|
|
11689
12513
|
if (status !== "running" || createdAt === null || endedAt !== null) {
|
|
11690
12514
|
return;
|
|
11691
12515
|
}
|
|
@@ -11697,7 +12521,7 @@ function ComponentBlock({ content }) {
|
|
|
11697
12521
|
window.clearInterval(timer);
|
|
11698
12522
|
};
|
|
11699
12523
|
}, [createdAt, endedAt, status]);
|
|
11700
|
-
|
|
12524
|
+
React36.useEffect(() => {
|
|
11701
12525
|
const element = contentRef.current;
|
|
11702
12526
|
if (!element) return;
|
|
11703
12527
|
previousScrollTopRef.current = element.scrollTop;
|
|
@@ -11719,7 +12543,7 @@ function ComponentBlock({ content }) {
|
|
|
11719
12543
|
element.removeEventListener("scroll", updateAutoScrollState);
|
|
11720
12544
|
};
|
|
11721
12545
|
}, [isExpanded]);
|
|
11722
|
-
|
|
12546
|
+
React36.useEffect(() => {
|
|
11723
12547
|
if (status !== "running") {
|
|
11724
12548
|
shouldAutoScrollRef.current = true;
|
|
11725
12549
|
return;
|
|
@@ -11732,15 +12556,15 @@ function ComponentBlock({ content }) {
|
|
|
11732
12556
|
}, [isExpanded, output, status]);
|
|
11733
12557
|
const config = status ? toolStatusConfig[status] : null;
|
|
11734
12558
|
const StatusIcon = config?.icon;
|
|
11735
|
-
return /* @__PURE__ */ (0,
|
|
11736
|
-
/* @__PURE__ */ (0,
|
|
12559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Card, { children: [
|
|
12560
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
11737
12561
|
CardHeader,
|
|
11738
12562
|
{
|
|
11739
12563
|
className: "flex flex-row items-center justify-between gap-2 px-2 py-1 cursor-pointer",
|
|
11740
12564
|
onClick: () => setIsExpanded(!isExpanded),
|
|
11741
12565
|
children: [
|
|
11742
|
-
/* @__PURE__ */ (0,
|
|
11743
|
-
status && StatusIcon && /* @__PURE__ */ (0,
|
|
12566
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center space-x-1 flex-1 min-w-0", children: [
|
|
12567
|
+
status && StatusIcon && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11744
12568
|
StatusIcon,
|
|
11745
12569
|
{
|
|
11746
12570
|
className: cn(
|
|
@@ -11750,21 +12574,21 @@ function ComponentBlock({ content }) {
|
|
|
11750
12574
|
)
|
|
11751
12575
|
}
|
|
11752
12576
|
),
|
|
11753
|
-
/* @__PURE__ */ (0,
|
|
12577
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardTitle, { className: "text-sm truncate", children: title })
|
|
11754
12578
|
] }),
|
|
11755
|
-
/* @__PURE__ */ (0,
|
|
11756
|
-
durationLabel && /* @__PURE__ */ (0,
|
|
11757
|
-
/* @__PURE__ */ (0,
|
|
11758
|
-
/* @__PURE__ */ (0,
|
|
12579
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex flex-wrap items-center gap-2 shrink-0", children: [
|
|
12580
|
+
durationLabel && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "inline-flex items-center gap-1 text-[11px] text-muted-foreground tabular-nums", children: [
|
|
12581
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_lucide_react24.Clock3, { className: "h-3 w-3" }),
|
|
12582
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: durationLabel })
|
|
11759
12583
|
] }),
|
|
11760
|
-
/* @__PURE__ */ (0,
|
|
11761
|
-
/* @__PURE__ */ (0,
|
|
12584
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Badge, { variant: "secondary", className: "rounded-lg px-1.5", children: category }),
|
|
12585
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11762
12586
|
"button",
|
|
11763
12587
|
{
|
|
11764
12588
|
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
11765
12589
|
"aria-label": isExpanded ? "Collapse" : "Expand",
|
|
11766
|
-
children: /* @__PURE__ */ (0,
|
|
11767
|
-
|
|
12590
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
12591
|
+
import_lucide_react24.ChevronDown,
|
|
11768
12592
|
{
|
|
11769
12593
|
className: cn(
|
|
11770
12594
|
"h-4 w-4 transition-transform",
|
|
@@ -11778,53 +12602,53 @@ function ComponentBlock({ content }) {
|
|
|
11778
12602
|
]
|
|
11779
12603
|
}
|
|
11780
12604
|
),
|
|
11781
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
12605
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
11782
12606
|
CardContent,
|
|
11783
12607
|
{
|
|
11784
12608
|
ref: contentRef,
|
|
11785
12609
|
className: "text-xs text-muted-foreground max-h-60 overflow-auto",
|
|
11786
12610
|
children: [
|
|
11787
|
-
data.input && /* @__PURE__ */ (0,
|
|
11788
|
-
error ? /* @__PURE__ */ (0,
|
|
12611
|
+
data.input && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue3(data.input) }),
|
|
12612
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word text-destructive", children: formatDisplayValue3(error) }) : hasOutput && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue3(fallback) })
|
|
11789
12613
|
]
|
|
11790
12614
|
}
|
|
11791
12615
|
)
|
|
11792
12616
|
] });
|
|
11793
12617
|
}
|
|
11794
12618
|
function UnknownBlock({ content }) {
|
|
11795
|
-
return /* @__PURE__ */ (0,
|
|
11796
|
-
/* @__PURE__ */ (0,
|
|
11797
|
-
/* @__PURE__ */ (0,
|
|
11798
|
-
/* @__PURE__ */ (0,
|
|
12619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Card, { children: [
|
|
12620
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
12621
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardTitle, { className: "text-sm", children: "Assistant Content" }),
|
|
12622
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Badge, { variant: "outline", children: content.type ?? "unknown" })
|
|
11799
12623
|
] }),
|
|
11800
|
-
/* @__PURE__ */ (0,
|
|
12624
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("pre", { className: "whitespace-pre-wrap break-words", children: safeJson3(content) }) })
|
|
11801
12625
|
] });
|
|
11802
12626
|
}
|
|
11803
12627
|
function renderContentItem(content, index, message, lookupMessages, options) {
|
|
11804
12628
|
const messageId = message.id;
|
|
11805
12629
|
const textClassName = options?.isAgentOutput ? "text-sm [&_.markdown-content_p]:!leading-6" : void 0;
|
|
11806
12630
|
if (typeof content === "string") {
|
|
11807
|
-
return /* @__PURE__ */ (0,
|
|
12631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: textClassName, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MarkdownText, { children: content }) }, `text-${index}`);
|
|
11808
12632
|
}
|
|
11809
12633
|
if (isThreadContextUsageRenderArtifact(content)) {
|
|
11810
12634
|
return null;
|
|
11811
12635
|
}
|
|
11812
12636
|
if (isTextContent3(content)) {
|
|
11813
|
-
return /* @__PURE__ */ (0,
|
|
12637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: textClassName, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MarkdownText, { children: content.text }) }, content.id ?? `text-${index}`);
|
|
11814
12638
|
}
|
|
11815
12639
|
if (isReasoningContent3(content)) {
|
|
11816
|
-
return /* @__PURE__ */ (0,
|
|
12640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ReasoningBlock, { reasoning: [content] }) }, content.id ?? `reasoning-${index}`);
|
|
11817
12641
|
}
|
|
11818
12642
|
if (isImageContent(content)) {
|
|
11819
|
-
return /* @__PURE__ */ (0,
|
|
12643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ImageBlock, { content }) }, content.id ?? `image-${index}`);
|
|
11820
12644
|
}
|
|
11821
12645
|
if (isComponentContent3(content)) {
|
|
11822
12646
|
if (isContextCompressionComponent(content)) {
|
|
11823
|
-
return /* @__PURE__ */ (0,
|
|
12647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11824
12648
|
"div",
|
|
11825
12649
|
{
|
|
11826
12650
|
className: "w-full",
|
|
11827
|
-
children: /* @__PURE__ */ (0,
|
|
12651
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ContextCompressionMessage, { content })
|
|
11828
12652
|
},
|
|
11829
12653
|
content.id ?? `context-compression-${index}`
|
|
11830
12654
|
);
|
|
@@ -11834,13 +12658,16 @@ function renderContentItem(content, index, message, lookupMessages, options) {
|
|
|
11834
12658
|
lookupMessages
|
|
11835
12659
|
);
|
|
11836
12660
|
if (requestUserInputResult) {
|
|
11837
|
-
return /* @__PURE__ */ (0,
|
|
12661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(RequestUserInputResultCard, { result: requestUserInputResult }) }, content.id ?? `request-user-input-result-${index}`);
|
|
11838
12662
|
}
|
|
11839
12663
|
if (isWidgetComponent2(content)) {
|
|
11840
|
-
return /* @__PURE__ */ (0,
|
|
12664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(WidgetMessage, { messageId, data: content.data }) }, content.id ?? `widget-${index}`);
|
|
12665
|
+
}
|
|
12666
|
+
if (isMcpAppComponent(content)) {
|
|
12667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(McpAppMessage, { data: content.data }) }, content.id ?? `mcp-app-${index}`);
|
|
11841
12668
|
}
|
|
11842
12669
|
if (getComponentMessagePresentation(content, getToolStepData(content)) === "grouped-step") {
|
|
11843
|
-
return /* @__PURE__ */ (0,
|
|
12670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11844
12671
|
ToolComponentGroup,
|
|
11845
12672
|
{
|
|
11846
12673
|
items: [content],
|
|
@@ -11851,15 +12678,15 @@ function renderContentItem(content, index, message, lookupMessages, options) {
|
|
|
11851
12678
|
}
|
|
11852
12679
|
) }, content.id ?? `component-group-${index}`);
|
|
11853
12680
|
}
|
|
11854
|
-
return /* @__PURE__ */ (0,
|
|
12681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ComponentBlock, { content }) }, content.id ?? `component-${index}`);
|
|
11855
12682
|
}
|
|
11856
12683
|
if (isMemoryContent(content)) {
|
|
11857
|
-
return /* @__PURE__ */ (0,
|
|
12684
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MemoryBlock, { content }) }, content.id ?? `memory-${index}`);
|
|
11858
12685
|
}
|
|
11859
12686
|
if (isAgentEventContent(content)) {
|
|
11860
|
-
return /* @__PURE__ */ (0,
|
|
12687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AgentEventRow, { content }) }, content.id ?? `agent-event-${index}`);
|
|
11861
12688
|
}
|
|
11862
|
-
return /* @__PURE__ */ (0,
|
|
12689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(UnknownBlock, { content }) }, content.id ?? `unknown-${index}`);
|
|
11863
12690
|
}
|
|
11864
12691
|
function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, options) {
|
|
11865
12692
|
if (unit.type === "item") {
|
|
@@ -11870,7 +12697,7 @@ function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, opti
|
|
|
11870
12697
|
isAgentOutput: options?.isAgentOutput
|
|
11871
12698
|
});
|
|
11872
12699
|
}
|
|
11873
|
-
return /* @__PURE__ */ (0,
|
|
12700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11874
12701
|
ToolComponentGroup,
|
|
11875
12702
|
{
|
|
11876
12703
|
items: unit.items,
|
|
@@ -11886,7 +12713,7 @@ function renderEntryBatch(entries, message, lookupMessages, hasFollowingItem, op
|
|
|
11886
12713
|
const renderUnits = buildToolComponentRenderUnits(
|
|
11887
12714
|
entries.map((entry) => entry.item),
|
|
11888
12715
|
{
|
|
11889
|
-
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null
|
|
12716
|
+
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null && !isMcpAppComponent(item)
|
|
11890
12717
|
}
|
|
11891
12718
|
);
|
|
11892
12719
|
return renderUnits.map(
|
|
@@ -11907,7 +12734,7 @@ function renderAssistantRenderUnits(units, message, lookupMessages, options, dep
|
|
|
11907
12734
|
const batch = entryBatch;
|
|
11908
12735
|
entryBatch = [];
|
|
11909
12736
|
rendered.push(
|
|
11910
|
-
/* @__PURE__ */ (0,
|
|
12737
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(React36.Fragment, { children: renderEntryBatch(batch, message, lookupMessages, hasFollowingItem, {
|
|
11911
12738
|
...options,
|
|
11912
12739
|
isAgentOutput: depth > 0
|
|
11913
12740
|
}) }, `entries-${batch[0]?.order ?? rendered.length}`)
|
|
@@ -11924,7 +12751,7 @@ function renderAssistantRenderUnits(units, message, lookupMessages, options, dep
|
|
|
11924
12751
|
}
|
|
11925
12752
|
flushEntries(true);
|
|
11926
12753
|
rendered.push(
|
|
11927
|
-
/* @__PURE__ */ (0,
|
|
12754
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11928
12755
|
AgentRunGroup,
|
|
11929
12756
|
{
|
|
11930
12757
|
node: unit.node,
|
|
@@ -11949,7 +12776,7 @@ function renderContent(message, lookupMessages, options) {
|
|
|
11949
12776
|
message
|
|
11950
12777
|
);
|
|
11951
12778
|
if (renderTree.hasAgentRuns) {
|
|
11952
|
-
return /* @__PURE__ */ (0,
|
|
12779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: assistantMessageStackClassName, children: renderAssistantRenderUnits(
|
|
11953
12780
|
renderTree.units,
|
|
11954
12781
|
message,
|
|
11955
12782
|
lookupMessages,
|
|
@@ -11959,13 +12786,13 @@ function renderContent(message, lookupMessages, options) {
|
|
|
11959
12786
|
const content = message.content;
|
|
11960
12787
|
if (typeof content === "string") {
|
|
11961
12788
|
if (!content.trim()) return null;
|
|
11962
|
-
return /* @__PURE__ */ (0,
|
|
12789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MarkdownText, { children: content });
|
|
11963
12790
|
}
|
|
11964
12791
|
if (!Array.isArray(content) || content.length === 0) return null;
|
|
11965
12792
|
const renderUnits = buildToolComponentRenderUnits(content, {
|
|
11966
|
-
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null
|
|
12793
|
+
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null && !isMcpAppComponent(item)
|
|
11967
12794
|
});
|
|
11968
|
-
return /* @__PURE__ */ (0,
|
|
12795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "space-y-3", children: renderUnits.map(
|
|
11969
12796
|
(unit, index) => renderContentUnit(
|
|
11970
12797
|
unit,
|
|
11971
12798
|
message,
|
|
@@ -11985,7 +12812,7 @@ function AssistantStreamingIndicator({
|
|
|
11985
12812
|
thinking: t("message.thinking"),
|
|
11986
12813
|
answering: t("message.answering")
|
|
11987
12814
|
};
|
|
11988
|
-
return /* @__PURE__ */ (0,
|
|
12815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
11989
12816
|
"div",
|
|
11990
12817
|
{
|
|
11991
12818
|
className: cn(
|
|
@@ -11993,18 +12820,18 @@ function AssistantStreamingIndicator({
|
|
|
11993
12820
|
className
|
|
11994
12821
|
),
|
|
11995
12822
|
children: [
|
|
11996
|
-
status === "loading" && /* @__PURE__ */ (0,
|
|
11997
|
-
status === "thinking" && /* @__PURE__ */ (0,
|
|
11998
|
-
/* @__PURE__ */ (0,
|
|
11999
|
-
/* @__PURE__ */ (0,
|
|
12000
|
-
/* @__PURE__ */ (0,
|
|
12823
|
+
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_lucide_react24.Loader2, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
12824
|
+
status === "thinking" && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
12825
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.3s]" }),
|
|
12826
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.15s]" }),
|
|
12827
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce" })
|
|
12001
12828
|
] }),
|
|
12002
|
-
status === "answering" && /* @__PURE__ */ (0,
|
|
12003
|
-
/* @__PURE__ */ (0,
|
|
12004
|
-
/* @__PURE__ */ (0,
|
|
12005
|
-
/* @__PURE__ */ (0,
|
|
12829
|
+
status === "answering" && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
12830
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "h-2 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.25s]" }),
|
|
12831
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "h-3 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.1s]" }),
|
|
12832
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "h-2.5 w-0.5 rounded-full bg-current animate-pulse" })
|
|
12006
12833
|
] }),
|
|
12007
|
-
/* @__PURE__ */ (0,
|
|
12834
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: labelMap[status] })
|
|
12008
12835
|
]
|
|
12009
12836
|
}
|
|
12010
12837
|
);
|
|
@@ -12033,42 +12860,42 @@ function AssistantMessage({
|
|
|
12033
12860
|
organizationId,
|
|
12034
12861
|
apiUrl
|
|
12035
12862
|
});
|
|
12036
|
-
const reasoningNode = hasReasoning ? /* @__PURE__ */ (0,
|
|
12863
|
+
const reasoningNode = hasReasoning ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ReasoningBlock, { reasoning: rootReasoning ?? [] }) : null;
|
|
12037
12864
|
if (!hasContent && !hasReasoning && !resolvedStreamingStatus) return null;
|
|
12038
12865
|
const streamingClass = isStreaming ? "streaming-active" : "";
|
|
12039
12866
|
if (!hasContent && !hasReasoning && resolvedStreamingStatus) {
|
|
12040
|
-
return /* @__PURE__ */ (0,
|
|
12867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: cn("space-y-3", streamingClass, className), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) });
|
|
12041
12868
|
}
|
|
12042
12869
|
if (hasContent && hasReasoning) {
|
|
12043
|
-
return /* @__PURE__ */ (0,
|
|
12044
|
-
/* @__PURE__ */ (0,
|
|
12870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
12871
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
12045
12872
|
Tabs,
|
|
12046
12873
|
{
|
|
12047
12874
|
defaultValue: message.status === "reasoning" ? "reasoning" : "answer",
|
|
12048
12875
|
className: "w-full",
|
|
12049
12876
|
children: [
|
|
12050
|
-
/* @__PURE__ */ (0,
|
|
12051
|
-
/* @__PURE__ */ (0,
|
|
12052
|
-
/* @__PURE__ */ (0,
|
|
12877
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(TabsList, { className: "", children: [
|
|
12878
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TabsTrigger, { value: "answer", children: t("message.answer") }),
|
|
12879
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TabsTrigger, { value: "reasoning", children: t("message.reasoning") })
|
|
12053
12880
|
] }),
|
|
12054
|
-
/* @__PURE__ */ (0,
|
|
12055
|
-
/* @__PURE__ */ (0,
|
|
12881
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TabsContent, { value: "answer", className: "space-y-3", children: answerNode }),
|
|
12882
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TabsContent, { value: "reasoning", className: "space-y-3", children: reasoningNode })
|
|
12056
12883
|
]
|
|
12057
12884
|
}
|
|
12058
12885
|
),
|
|
12059
|
-
resolvedStreamingStatus ? /* @__PURE__ */ (0,
|
|
12886
|
+
resolvedStreamingStatus ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
12060
12887
|
] });
|
|
12061
12888
|
}
|
|
12062
|
-
return /* @__PURE__ */ (0,
|
|
12889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
12063
12890
|
hasReasoning ? reasoningNode : answerNode,
|
|
12064
|
-
resolvedStreamingStatus ? /* @__PURE__ */ (0,
|
|
12891
|
+
resolvedStreamingStatus ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
12065
12892
|
] });
|
|
12066
12893
|
}
|
|
12067
12894
|
|
|
12068
12895
|
// src/components/thread/MessageActions.tsx
|
|
12069
|
-
var
|
|
12070
|
-
var
|
|
12071
|
-
var
|
|
12896
|
+
var React37 = __toESM(require("react"), 1);
|
|
12897
|
+
var import_lucide_react25 = require("lucide-react");
|
|
12898
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
12072
12899
|
function MessageActions({
|
|
12073
12900
|
content,
|
|
12074
12901
|
isAssistant = false,
|
|
@@ -12077,7 +12904,7 @@ function MessageActions({
|
|
|
12077
12904
|
className
|
|
12078
12905
|
}) {
|
|
12079
12906
|
const { t } = useChatkitTranslation();
|
|
12080
|
-
const [copied, setCopied] =
|
|
12907
|
+
const [copied, setCopied] = React37.useState(false);
|
|
12081
12908
|
const handleCopy = async () => {
|
|
12082
12909
|
try {
|
|
12083
12910
|
await navigator.clipboard.writeText(content);
|
|
@@ -12090,7 +12917,7 @@ function MessageActions({
|
|
|
12090
12917
|
if (isStreaming) {
|
|
12091
12918
|
return null;
|
|
12092
12919
|
}
|
|
12093
|
-
return /* @__PURE__ */ (0,
|
|
12920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
12094
12921
|
"div",
|
|
12095
12922
|
{
|
|
12096
12923
|
className: cn(
|
|
@@ -12098,7 +12925,7 @@ function MessageActions({
|
|
|
12098
12925
|
className
|
|
12099
12926
|
),
|
|
12100
12927
|
children: [
|
|
12101
|
-
/* @__PURE__ */ (0,
|
|
12928
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
12102
12929
|
"button",
|
|
12103
12930
|
{
|
|
12104
12931
|
type: "button",
|
|
@@ -12108,17 +12935,17 @@ function MessageActions({
|
|
|
12108
12935
|
copied && "text-green-500"
|
|
12109
12936
|
),
|
|
12110
12937
|
title: copied ? t("messageActions.copied") : t("messageActions.copy"),
|
|
12111
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
12938
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react25.Check, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react25.Copy, { size: 14 })
|
|
12112
12939
|
}
|
|
12113
12940
|
),
|
|
12114
|
-
isAssistant && onRetry && /* @__PURE__ */ (0,
|
|
12941
|
+
isAssistant && onRetry && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
12115
12942
|
"button",
|
|
12116
12943
|
{
|
|
12117
12944
|
type: "button",
|
|
12118
12945
|
onClick: onRetry,
|
|
12119
12946
|
className: "p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",
|
|
12120
12947
|
title: t("messageActions.regenerate"),
|
|
12121
|
-
children: /* @__PURE__ */ (0,
|
|
12948
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react25.RefreshCw, { size: 14 })
|
|
12122
12949
|
}
|
|
12123
12950
|
)
|
|
12124
12951
|
]
|
|
@@ -12127,51 +12954,96 @@ function MessageActions({
|
|
|
12127
12954
|
}
|
|
12128
12955
|
|
|
12129
12956
|
// src/components/thread/StartScreen.tsx
|
|
12130
|
-
var
|
|
12131
|
-
var
|
|
12132
|
-
var
|
|
12957
|
+
var React38 = require("react");
|
|
12958
|
+
var import_lucide_react26 = require("lucide-react");
|
|
12959
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
12133
12960
|
function getIconComponent2(icon) {
|
|
12134
12961
|
const iconMap = {
|
|
12135
|
-
"circle-question": /* @__PURE__ */ (0,
|
|
12136
|
-
"lightbulb": /* @__PURE__ */ (0,
|
|
12137
|
-
"sparkle": /* @__PURE__ */ (0,
|
|
12138
|
-
"write": /* @__PURE__ */ (0,
|
|
12139
|
-
"search": /* @__PURE__ */ (0,
|
|
12140
|
-
"globe": /* @__PURE__ */ (0,
|
|
12141
|
-
"book-open": /* @__PURE__ */ (0,
|
|
12142
|
-
"compass": /* @__PURE__ */ (0,
|
|
12143
|
-
"bolt": /* @__PURE__ */ (0,
|
|
12962
|
+
"circle-question": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.HelpCircle, { size: 20 }),
|
|
12963
|
+
"lightbulb": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Lightbulb, { size: 20 }),
|
|
12964
|
+
"sparkle": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Sparkles, { size: 20 }),
|
|
12965
|
+
"write": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Pencil, { size: 20 }),
|
|
12966
|
+
"search": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Search, { size: 20 }),
|
|
12967
|
+
"globe": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Globe, { size: 20 }),
|
|
12968
|
+
"book-open": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.BookOpen, { size: 20 }),
|
|
12969
|
+
"compass": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Compass, { size: 20 }),
|
|
12970
|
+
"bolt": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Zap, { size: 20 })
|
|
12144
12971
|
};
|
|
12145
12972
|
return icon ? iconMap[icon] || iconMap["sparkle"] : iconMap["sparkle"];
|
|
12146
12973
|
}
|
|
12147
|
-
function StartScreen({
|
|
12974
|
+
function StartScreen({
|
|
12975
|
+
startScreen,
|
|
12976
|
+
onPromptClick,
|
|
12977
|
+
onPromptEdit,
|
|
12978
|
+
promptSendDisabled = false,
|
|
12979
|
+
promptEditDisabled = false,
|
|
12980
|
+
className
|
|
12981
|
+
}) {
|
|
12148
12982
|
const { t } = useChatkitTranslation();
|
|
12149
12983
|
const greeting = startScreen?.greeting ?? t("startScreen.greeting");
|
|
12150
12984
|
const prompts = startScreen?.prompts ?? [];
|
|
12151
|
-
|
|
12152
|
-
|
|
12153
|
-
|
|
12154
|
-
|
|
12155
|
-
|
|
12156
|
-
|
|
12157
|
-
|
|
12158
|
-
|
|
12159
|
-
|
|
12160
|
-
|
|
12161
|
-
|
|
12162
|
-
|
|
12163
|
-
|
|
12164
|
-
|
|
12165
|
-
|
|
12166
|
-
|
|
12167
|
-
|
|
12168
|
-
|
|
12169
|
-
|
|
12170
|
-
|
|
12985
|
+
const editPromptLabel = t("startScreen.editPrompt");
|
|
12986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
12987
|
+
"div",
|
|
12988
|
+
{
|
|
12989
|
+
className: cn(
|
|
12990
|
+
"flex flex-col items-center justify-center py-12 px-4",
|
|
12991
|
+
className
|
|
12992
|
+
),
|
|
12993
|
+
children: [
|
|
12994
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "mb-8 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-2", children: greeting }) }),
|
|
12995
|
+
prompts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "w-full max-w-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: prompts.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
12996
|
+
"div",
|
|
12997
|
+
{
|
|
12998
|
+
className: cn(
|
|
12999
|
+
"flex items-stretch rounded-xl border bg-card text-left",
|
|
13000
|
+
"transition-colors hover:border-primary/20 hover:bg-muted/50",
|
|
13001
|
+
"focus-within:ring-2 focus-within:ring-primary/20"
|
|
13002
|
+
),
|
|
13003
|
+
children: [
|
|
13004
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
13005
|
+
"button",
|
|
13006
|
+
{
|
|
13007
|
+
type: "button",
|
|
13008
|
+
disabled: promptSendDisabled,
|
|
13009
|
+
onClick: () => onPromptClick?.(item.prompt),
|
|
13010
|
+
className: cn(
|
|
13011
|
+
"flex min-w-0 flex-1 items-center gap-3 p-4 text-left",
|
|
13012
|
+
"focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
|
|
13013
|
+
),
|
|
13014
|
+
children: [
|
|
13015
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.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) }),
|
|
13016
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-sm font-medium text-foreground", children: item.label })
|
|
13017
|
+
]
|
|
13018
|
+
}
|
|
13019
|
+
),
|
|
13020
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
13021
|
+
"button",
|
|
13022
|
+
{
|
|
13023
|
+
type: "button",
|
|
13024
|
+
disabled: promptEditDisabled,
|
|
13025
|
+
onClick: () => onPromptEdit?.(item.prompt),
|
|
13026
|
+
"aria-label": editPromptLabel,
|
|
13027
|
+
title: editPromptLabel,
|
|
13028
|
+
className: cn(
|
|
13029
|
+
"flex w-12 shrink-0 items-center justify-center border-l text-muted-foreground",
|
|
13030
|
+
"rounded-r-xl transition-colors hover:bg-muted hover:text-foreground",
|
|
13031
|
+
"focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
|
|
13032
|
+
),
|
|
13033
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Pencil, { size: 16 })
|
|
13034
|
+
}
|
|
13035
|
+
)
|
|
13036
|
+
]
|
|
13037
|
+
},
|
|
13038
|
+
`prompt-${index}`
|
|
13039
|
+
)) }) })
|
|
13040
|
+
]
|
|
13041
|
+
}
|
|
13042
|
+
);
|
|
12171
13043
|
}
|
|
12172
13044
|
|
|
12173
13045
|
// src/hooks/useThreads.ts
|
|
12174
|
-
var
|
|
13046
|
+
var React39 = __toESM(require("react"), 1);
|
|
12175
13047
|
var DEFAULT_LIMIT = 50;
|
|
12176
13048
|
var getThreadTitle = (threadRecord) => {
|
|
12177
13049
|
const title = threadRecord.title?.trim();
|
|
@@ -12186,7 +13058,7 @@ var toDate = (value) => {
|
|
|
12186
13058
|
if (Number.isNaN(timestamp)) return void 0;
|
|
12187
13059
|
return new Date(timestamp);
|
|
12188
13060
|
};
|
|
12189
|
-
var
|
|
13061
|
+
var getErrorMessage2 = (error) => {
|
|
12190
13062
|
if (!error) return void 0;
|
|
12191
13063
|
if (error instanceof Error) return error.message;
|
|
12192
13064
|
if (typeof error === "string") return error;
|
|
@@ -12224,16 +13096,16 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12224
13096
|
isLoading: isStreamLoading,
|
|
12225
13097
|
error: streamError
|
|
12226
13098
|
} = useStreamContext();
|
|
12227
|
-
const [threadRecords, setThreadRecords] =
|
|
12228
|
-
const [isLoading, setIsLoading] =
|
|
12229
|
-
const [error, setError] =
|
|
12230
|
-
const upsertThreadRecord =
|
|
13099
|
+
const [threadRecords, setThreadRecords] = React39.useState([]);
|
|
13100
|
+
const [isLoading, setIsLoading] = React39.useState(false);
|
|
13101
|
+
const [error, setError] = React39.useState(null);
|
|
13102
|
+
const upsertThreadRecord = React39.useCallback((threadRecord) => {
|
|
12231
13103
|
setThreadRecords((prev) => {
|
|
12232
13104
|
const next = prev.filter((item) => item.id !== threadRecord.id);
|
|
12233
13105
|
return sortThreadRecords([threadRecord, ...next]);
|
|
12234
13106
|
});
|
|
12235
13107
|
}, []);
|
|
12236
|
-
const refreshThreads =
|
|
13108
|
+
const refreshThreads = React39.useCallback(async () => {
|
|
12237
13109
|
setIsLoading(true);
|
|
12238
13110
|
setError(null);
|
|
12239
13111
|
try {
|
|
@@ -12249,7 +13121,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12249
13121
|
setIsLoading(false);
|
|
12250
13122
|
}
|
|
12251
13123
|
}, [client, limit, assistantId]);
|
|
12252
|
-
const createThread =
|
|
13124
|
+
const createThread = React39.useCallback(
|
|
12253
13125
|
async (input) => {
|
|
12254
13126
|
setError(null);
|
|
12255
13127
|
const payload = {};
|
|
@@ -12263,7 +13135,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12263
13135
|
},
|
|
12264
13136
|
[client, upsertThreadRecord]
|
|
12265
13137
|
);
|
|
12266
|
-
const updateThread =
|
|
13138
|
+
const updateThread = React39.useCallback(
|
|
12267
13139
|
async (recordId, payload) => {
|
|
12268
13140
|
setError(null);
|
|
12269
13141
|
const updated = await client.conversations.update(recordId, payload);
|
|
@@ -12272,7 +13144,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12272
13144
|
},
|
|
12273
13145
|
[client, upsertThreadRecord]
|
|
12274
13146
|
);
|
|
12275
|
-
const deleteThread =
|
|
13147
|
+
const deleteThread = React39.useCallback(
|
|
12276
13148
|
async (recordId) => {
|
|
12277
13149
|
setError(null);
|
|
12278
13150
|
await client.conversations.delete(recordId);
|
|
@@ -12280,11 +13152,11 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12280
13152
|
},
|
|
12281
13153
|
[client]
|
|
12282
13154
|
);
|
|
12283
|
-
|
|
13155
|
+
React39.useEffect(() => {
|
|
12284
13156
|
if (!isReady) return;
|
|
12285
13157
|
void refreshThreads();
|
|
12286
13158
|
}, [refreshThreads, isReady]);
|
|
12287
|
-
|
|
13159
|
+
React39.useEffect(() => {
|
|
12288
13160
|
if (!threadId || !isStreamLoading) return;
|
|
12289
13161
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
12290
13162
|
const busyStatus = "busy";
|
|
@@ -12305,8 +13177,8 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12305
13177
|
return changed ? sortThreadRecords(next) : prev;
|
|
12306
13178
|
});
|
|
12307
13179
|
}, [threadId, isStreamLoading]);
|
|
12308
|
-
|
|
12309
|
-
const message =
|
|
13180
|
+
React39.useEffect(() => {
|
|
13181
|
+
const message = getErrorMessage2(streamError)?.trim();
|
|
12310
13182
|
if (!threadId || !message) return;
|
|
12311
13183
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
12312
13184
|
const errorStatus = "error";
|
|
@@ -12327,7 +13199,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12327
13199
|
return changed ? sortThreadRecords(next) : prev;
|
|
12328
13200
|
});
|
|
12329
13201
|
}, [threadId, streamError]);
|
|
12330
|
-
|
|
13202
|
+
React39.useEffect(() => {
|
|
12331
13203
|
if (!isReady || !threadId || isStreamLoading) return;
|
|
12332
13204
|
let cancelled = false;
|
|
12333
13205
|
void client.conversations.search({ where: { threadId }, limit: 1 }).then((result) => {
|
|
@@ -12341,7 +13213,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12341
13213
|
cancelled = true;
|
|
12342
13214
|
};
|
|
12343
13215
|
}, [client, threadId, upsertThreadRecord, isReady, isStreamLoading]);
|
|
12344
|
-
const threads =
|
|
13216
|
+
const threads = React39.useMemo(
|
|
12345
13217
|
() => threadRecords.map((threadRecord) => toThreadItem(threadRecord)),
|
|
12346
13218
|
[threadRecords]
|
|
12347
13219
|
);
|
|
@@ -12358,10 +13230,10 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12358
13230
|
}
|
|
12359
13231
|
|
|
12360
13232
|
// src/components/thread/context-usage-indicator.tsx
|
|
12361
|
-
var
|
|
13233
|
+
var React40 = __toESM(require("react"), 1);
|
|
12362
13234
|
|
|
12363
13235
|
// src/components/ui/progress-circle.tsx
|
|
12364
|
-
var
|
|
13236
|
+
var import_jsx_runtime45 = (
|
|
12365
13237
|
// biome-ignore lint/a11y/useFocusableInteractive: false positive (progress + progressbar are not focusable interactives)
|
|
12366
13238
|
// biome-ignore lint/nursery/useAriaPropsSupportedByRole: biome rule at odds with mdn docs (presumed nursary bug with rule)
|
|
12367
13239
|
require("react/jsx-runtime")
|
|
@@ -12385,7 +13257,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
12385
13257
|
fill: "none",
|
|
12386
13258
|
strokeWidth
|
|
12387
13259
|
};
|
|
12388
|
-
return /* @__PURE__ */ (0,
|
|
13260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
12389
13261
|
"svg",
|
|
12390
13262
|
{
|
|
12391
13263
|
role: "progressbar",
|
|
@@ -12396,8 +13268,8 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
12396
13268
|
"aria-valuemax": 100,
|
|
12397
13269
|
...restSvgProps,
|
|
12398
13270
|
children: [
|
|
12399
|
-
/* @__PURE__ */ (0,
|
|
12400
|
-
/* @__PURE__ */ (0,
|
|
13271
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("circle", { ...commonParams, className: "stroke-current/25" }),
|
|
13272
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
12401
13273
|
"circle",
|
|
12402
13274
|
{
|
|
12403
13275
|
...commonParams,
|
|
@@ -12415,7 +13287,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
12415
13287
|
};
|
|
12416
13288
|
|
|
12417
13289
|
// src/components/thread/context-usage-indicator.tsx
|
|
12418
|
-
var
|
|
13290
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
12419
13291
|
var kNumberFormatter = new Intl.NumberFormat("en-US", {
|
|
12420
13292
|
minimumFractionDigits: 0,
|
|
12421
13293
|
maximumFractionDigits: 1
|
|
@@ -12448,21 +13320,22 @@ function ContextUsageIndicator({
|
|
|
12448
13320
|
}) {
|
|
12449
13321
|
const { t } = useChatkitTranslation();
|
|
12450
13322
|
const stream = useStreamContext();
|
|
12451
|
-
const [maxContextSize, setMaxContextSize] =
|
|
12452
|
-
const [usedContextSize, setUsedContextSize] =
|
|
12453
|
-
const [assistantAgentKey, setAssistantAgentKey] =
|
|
12454
|
-
const latestRealtimeUsageRef =
|
|
13323
|
+
const [maxContextSize, setMaxContextSize] = React40.useState(null);
|
|
13324
|
+
const [usedContextSize, setUsedContextSize] = React40.useState(null);
|
|
13325
|
+
const [assistantAgentKey, setAssistantAgentKey] = React40.useState(null);
|
|
13326
|
+
const latestRealtimeUsageRef = React40.useRef({
|
|
12455
13327
|
threadId: null,
|
|
12456
13328
|
agentKey: null,
|
|
12457
13329
|
usedTokens: null
|
|
12458
13330
|
});
|
|
12459
|
-
const realtimeUsage =
|
|
13331
|
+
const realtimeUsage = React40.useMemo(
|
|
12460
13332
|
() => getThreadContextUsage(stream.contextUsageByAgentKey, assistantAgentKey),
|
|
12461
13333
|
[assistantAgentKey, stream.contextUsageByAgentKey]
|
|
12462
13334
|
);
|
|
12463
13335
|
const realtimeUsedContextSize = getThreadContextUsageTotalTokens(realtimeUsage);
|
|
12464
|
-
|
|
12465
|
-
|
|
13336
|
+
const hasApiConfiguration = Boolean(stream.apiUrl?.trim() && stream.apiKey?.trim());
|
|
13337
|
+
React40.useEffect(() => {
|
|
13338
|
+
if (!hasApiConfiguration || !stream.client || !stream.assistantId) {
|
|
12466
13339
|
setMaxContextSize(null);
|
|
12467
13340
|
setAssistantAgentKey(null);
|
|
12468
13341
|
return;
|
|
@@ -12480,20 +13353,20 @@ function ContextUsageIndicator({
|
|
|
12480
13353
|
return () => {
|
|
12481
13354
|
cancelled = true;
|
|
12482
13355
|
};
|
|
12483
|
-
}, [stream.client, stream.assistantId]);
|
|
12484
|
-
|
|
13356
|
+
}, [hasApiConfiguration, stream.client, stream.assistantId]);
|
|
13357
|
+
React40.useEffect(() => {
|
|
12485
13358
|
latestRealtimeUsageRef.current = {
|
|
12486
13359
|
threadId: stream.threadId ?? null,
|
|
12487
13360
|
agentKey: assistantAgentKey,
|
|
12488
13361
|
usedTokens: realtimeUsedContextSize
|
|
12489
13362
|
};
|
|
12490
13363
|
}, [assistantAgentKey, realtimeUsedContextSize, stream.threadId]);
|
|
12491
|
-
|
|
13364
|
+
React40.useEffect(() => {
|
|
12492
13365
|
if (realtimeUsedContextSize == null) return;
|
|
12493
13366
|
setUsedContextSize(realtimeUsedContextSize);
|
|
12494
13367
|
}, [realtimeUsedContextSize]);
|
|
12495
|
-
|
|
12496
|
-
if (!stream.client) {
|
|
13368
|
+
React40.useEffect(() => {
|
|
13369
|
+
if (!hasApiConfiguration || !stream.client) {
|
|
12497
13370
|
setUsedContextSize(null);
|
|
12498
13371
|
return;
|
|
12499
13372
|
}
|
|
@@ -12529,6 +13402,7 @@ function ContextUsageIndicator({
|
|
|
12529
13402
|
};
|
|
12530
13403
|
}, [
|
|
12531
13404
|
assistantAgentKey,
|
|
13405
|
+
hasApiConfiguration,
|
|
12532
13406
|
realtimeUsedContextSize,
|
|
12533
13407
|
stream.apiKey,
|
|
12534
13408
|
stream.apiUrl,
|
|
@@ -12557,8 +13431,8 @@ function ContextUsageIndicator({
|
|
|
12557
13431
|
});
|
|
12558
13432
|
const usageLabelWithSuffix = usageLabel.endsWith(":") ? usageLabel : `${usageLabel}:`;
|
|
12559
13433
|
const progressClassName = percent >= 90 ? "text-destructive" : percent >= 75 ? "text-amber-500" : "text-primary dark:text-zinc-300";
|
|
12560
|
-
return /* @__PURE__ */ (0,
|
|
12561
|
-
/* @__PURE__ */ (0,
|
|
13434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Tooltip, { children: [
|
|
13435
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
12562
13436
|
"button",
|
|
12563
13437
|
{
|
|
12564
13438
|
type: "button",
|
|
@@ -12567,31 +13441,31 @@ function ContextUsageIndicator({
|
|
|
12567
13441
|
className
|
|
12568
13442
|
),
|
|
12569
13443
|
"aria-label": `${usageLabelWithSuffix} ${usageFullLabel}. ${usageTokensLabel}`,
|
|
12570
|
-
children: /* @__PURE__ */ (0,
|
|
13444
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ProgressCircle, { value: percent, className: cn("size-3.5", progressClassName) })
|
|
12571
13445
|
}
|
|
12572
13446
|
) }),
|
|
12573
|
-
/* @__PURE__ */ (0,
|
|
12574
|
-
/* @__PURE__ */ (0,
|
|
12575
|
-
/* @__PURE__ */ (0,
|
|
12576
|
-
/* @__PURE__ */ (0,
|
|
13447
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(TooltipContent, { side: "top", sideOffset: 6, className: "space-y-0.5 px-3 py-2 text-center", children: [
|
|
13448
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "text-primary-foreground/70", children: usageLabelWithSuffix }),
|
|
13449
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "font-medium text-primary-foreground/80", children: usageFullLabel }),
|
|
13450
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "text-sm font-semibold", children: usageTokensLabel })
|
|
12577
13451
|
] })
|
|
12578
13452
|
] });
|
|
12579
13453
|
}
|
|
12580
13454
|
|
|
12581
13455
|
// src/components/pet/PetBridge.tsx
|
|
12582
|
-
var
|
|
12583
|
-
var
|
|
13456
|
+
var React41 = __toESM(require("react"), 1);
|
|
13457
|
+
var import_chatkit_types10 = require("@xpert-ai/chatkit-types");
|
|
12584
13458
|
function PetBridge({ pet, state }) {
|
|
12585
13459
|
const parentMessenger = useParentMessenger();
|
|
12586
13460
|
const sendEvent = parentMessenger?.sendEvent;
|
|
12587
|
-
const options =
|
|
12588
|
-
|
|
13461
|
+
const options = React41.useMemo(() => (0, import_chatkit_types10.normalizePetOptions)(pet), [pet]);
|
|
13462
|
+
React41.useEffect(() => {
|
|
12589
13463
|
if (!sendEvent) {
|
|
12590
13464
|
return;
|
|
12591
13465
|
}
|
|
12592
13466
|
sendEvent("pet_options_change", { pet: pet ?? null });
|
|
12593
13467
|
}, [sendEvent, pet]);
|
|
12594
|
-
|
|
13468
|
+
React41.useEffect(() => {
|
|
12595
13469
|
if (!sendEvent || !options) {
|
|
12596
13470
|
return;
|
|
12597
13471
|
}
|
|
@@ -12601,15 +13475,15 @@ function PetBridge({ pet, state }) {
|
|
|
12601
13475
|
}
|
|
12602
13476
|
|
|
12603
13477
|
// src/components/settings/SettingsSheet.tsx
|
|
12604
|
-
var
|
|
12605
|
-
var
|
|
13478
|
+
var React48 = __toESM(require("react"), 1);
|
|
13479
|
+
var import_lucide_react28 = require("lucide-react");
|
|
12606
13480
|
|
|
12607
13481
|
// src/components/ui/input.tsx
|
|
12608
|
-
var
|
|
12609
|
-
var
|
|
12610
|
-
var Input =
|
|
13482
|
+
var React42 = __toESM(require("react"), 1);
|
|
13483
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
13484
|
+
var Input = React42.forwardRef(
|
|
12611
13485
|
({ className, type, ...props }, ref) => {
|
|
12612
|
-
return /* @__PURE__ */ (0,
|
|
13486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12613
13487
|
"input",
|
|
12614
13488
|
{
|
|
12615
13489
|
ref,
|
|
@@ -12626,20 +13500,20 @@ var Input = React41.forwardRef(
|
|
|
12626
13500
|
Input.displayName = "Input";
|
|
12627
13501
|
|
|
12628
13502
|
// src/components/ui/select.tsx
|
|
12629
|
-
var
|
|
13503
|
+
var React43 = require("react");
|
|
12630
13504
|
var import_radix_ui2 = require("radix-ui");
|
|
12631
|
-
var
|
|
12632
|
-
var
|
|
13505
|
+
var import_lucide_react27 = require("lucide-react");
|
|
13506
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
12633
13507
|
function Select({
|
|
12634
13508
|
...props
|
|
12635
13509
|
}) {
|
|
12636
|
-
return /* @__PURE__ */ (0,
|
|
13510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_radix_ui2.Select.Root, { "data-slot": "select", ...props });
|
|
12637
13511
|
}
|
|
12638
13512
|
function SelectGroup({
|
|
12639
13513
|
className,
|
|
12640
13514
|
...props
|
|
12641
13515
|
}) {
|
|
12642
|
-
return /* @__PURE__ */ (0,
|
|
13516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12643
13517
|
import_radix_ui2.Select.Group,
|
|
12644
13518
|
{
|
|
12645
13519
|
"data-slot": "select-group",
|
|
@@ -12651,7 +13525,7 @@ function SelectGroup({
|
|
|
12651
13525
|
function SelectValue({
|
|
12652
13526
|
...props
|
|
12653
13527
|
}) {
|
|
12654
|
-
return /* @__PURE__ */ (0,
|
|
13528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_radix_ui2.Select.Value, { "data-slot": "select-value", ...props });
|
|
12655
13529
|
}
|
|
12656
13530
|
function SelectTrigger({
|
|
12657
13531
|
className,
|
|
@@ -12659,7 +13533,7 @@ function SelectTrigger({
|
|
|
12659
13533
|
children,
|
|
12660
13534
|
...props
|
|
12661
13535
|
}) {
|
|
12662
|
-
return /* @__PURE__ */ (0,
|
|
13536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
12663
13537
|
import_radix_ui2.Select.Trigger,
|
|
12664
13538
|
{
|
|
12665
13539
|
"data-slot": "select-trigger",
|
|
@@ -12671,7 +13545,7 @@ function SelectTrigger({
|
|
|
12671
13545
|
...props,
|
|
12672
13546
|
children: [
|
|
12673
13547
|
children,
|
|
12674
|
-
/* @__PURE__ */ (0,
|
|
13548
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_radix_ui2.Select.Icon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react27.ChevronDownIcon, { className: "pointer-events-none size-4 text-muted-foreground" }) })
|
|
12675
13549
|
]
|
|
12676
13550
|
}
|
|
12677
13551
|
);
|
|
@@ -12683,7 +13557,7 @@ function SelectContent({
|
|
|
12683
13557
|
align = "center",
|
|
12684
13558
|
...props
|
|
12685
13559
|
}) {
|
|
12686
|
-
return /* @__PURE__ */ (0,
|
|
13560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_radix_ui2.Select.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
12687
13561
|
import_radix_ui2.Select.Content,
|
|
12688
13562
|
{
|
|
12689
13563
|
"data-slot": "select-content",
|
|
@@ -12693,8 +13567,8 @@ function SelectContent({
|
|
|
12693
13567
|
align,
|
|
12694
13568
|
...props,
|
|
12695
13569
|
children: [
|
|
12696
|
-
/* @__PURE__ */ (0,
|
|
12697
|
-
/* @__PURE__ */ (0,
|
|
13570
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectScrollUpButton, {}),
|
|
13571
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12698
13572
|
import_radix_ui2.Select.Viewport,
|
|
12699
13573
|
{
|
|
12700
13574
|
"data-position": position,
|
|
@@ -12705,7 +13579,7 @@ function SelectContent({
|
|
|
12705
13579
|
children
|
|
12706
13580
|
}
|
|
12707
13581
|
),
|
|
12708
|
-
/* @__PURE__ */ (0,
|
|
13582
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectScrollDownButton, {})
|
|
12709
13583
|
]
|
|
12710
13584
|
}
|
|
12711
13585
|
) });
|
|
@@ -12715,7 +13589,7 @@ function SelectItem({
|
|
|
12715
13589
|
children,
|
|
12716
13590
|
...props
|
|
12717
13591
|
}) {
|
|
12718
|
-
return /* @__PURE__ */ (0,
|
|
13592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
12719
13593
|
import_radix_ui2.Select.Item,
|
|
12720
13594
|
{
|
|
12721
13595
|
"data-slot": "select-item",
|
|
@@ -12725,8 +13599,8 @@ function SelectItem({
|
|
|
12725
13599
|
),
|
|
12726
13600
|
...props,
|
|
12727
13601
|
children: [
|
|
12728
|
-
/* @__PURE__ */ (0,
|
|
12729
|
-
/* @__PURE__ */ (0,
|
|
13602
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_radix_ui2.Select.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react27.CheckIcon, { className: "pointer-events-none" }) }) }),
|
|
13603
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_radix_ui2.Select.ItemText, { children })
|
|
12730
13604
|
]
|
|
12731
13605
|
}
|
|
12732
13606
|
);
|
|
@@ -12735,7 +13609,7 @@ function SelectScrollUpButton({
|
|
|
12735
13609
|
className,
|
|
12736
13610
|
...props
|
|
12737
13611
|
}) {
|
|
12738
|
-
return /* @__PURE__ */ (0,
|
|
13612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12739
13613
|
import_radix_ui2.Select.ScrollUpButton,
|
|
12740
13614
|
{
|
|
12741
13615
|
"data-slot": "select-scroll-up-button",
|
|
@@ -12744,8 +13618,8 @@ function SelectScrollUpButton({
|
|
|
12744
13618
|
className
|
|
12745
13619
|
),
|
|
12746
13620
|
...props,
|
|
12747
|
-
children: /* @__PURE__ */ (0,
|
|
12748
|
-
|
|
13621
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13622
|
+
import_lucide_react27.ChevronUpIcon,
|
|
12749
13623
|
{}
|
|
12750
13624
|
)
|
|
12751
13625
|
}
|
|
@@ -12755,7 +13629,7 @@ function SelectScrollDownButton({
|
|
|
12755
13629
|
className,
|
|
12756
13630
|
...props
|
|
12757
13631
|
}) {
|
|
12758
|
-
return /* @__PURE__ */ (0,
|
|
13632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12759
13633
|
import_radix_ui2.Select.ScrollDownButton,
|
|
12760
13634
|
{
|
|
12761
13635
|
"data-slot": "select-scroll-down-button",
|
|
@@ -12764,8 +13638,8 @@ function SelectScrollDownButton({
|
|
|
12764
13638
|
className
|
|
12765
13639
|
),
|
|
12766
13640
|
...props,
|
|
12767
|
-
children: /* @__PURE__ */ (0,
|
|
12768
|
-
|
|
13641
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13642
|
+
import_lucide_react27.ChevronDownIcon,
|
|
12769
13643
|
{}
|
|
12770
13644
|
)
|
|
12771
13645
|
}
|
|
@@ -12773,9 +13647,9 @@ function SelectScrollDownButton({
|
|
|
12773
13647
|
}
|
|
12774
13648
|
|
|
12775
13649
|
// src/components/ui/slider.tsx
|
|
12776
|
-
var
|
|
13650
|
+
var React44 = __toESM(require("react"), 1);
|
|
12777
13651
|
var import_radix_ui3 = require("radix-ui");
|
|
12778
|
-
var
|
|
13652
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
12779
13653
|
function Slider({
|
|
12780
13654
|
className,
|
|
12781
13655
|
defaultValue,
|
|
@@ -12784,11 +13658,11 @@ function Slider({
|
|
|
12784
13658
|
max = 100,
|
|
12785
13659
|
...props
|
|
12786
13660
|
}) {
|
|
12787
|
-
const _values =
|
|
13661
|
+
const _values = React44.useMemo(
|
|
12788
13662
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
12789
13663
|
[value, defaultValue, min, max]
|
|
12790
13664
|
);
|
|
12791
|
-
return /* @__PURE__ */ (0,
|
|
13665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
12792
13666
|
import_radix_ui3.Slider.Root,
|
|
12793
13667
|
{
|
|
12794
13668
|
"data-slot": "slider",
|
|
@@ -12802,12 +13676,12 @@ function Slider({
|
|
|
12802
13676
|
),
|
|
12803
13677
|
...props,
|
|
12804
13678
|
children: [
|
|
12805
|
-
/* @__PURE__ */ (0,
|
|
13679
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12806
13680
|
import_radix_ui3.Slider.Track,
|
|
12807
13681
|
{
|
|
12808
13682
|
"data-slot": "slider-track",
|
|
12809
13683
|
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",
|
|
12810
|
-
children: /* @__PURE__ */ (0,
|
|
13684
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12811
13685
|
import_radix_ui3.Slider.Range,
|
|
12812
13686
|
{
|
|
12813
13687
|
"data-slot": "slider-range",
|
|
@@ -12816,7 +13690,7 @@ function Slider({
|
|
|
12816
13690
|
)
|
|
12817
13691
|
}
|
|
12818
13692
|
),
|
|
12819
|
-
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ (0,
|
|
13693
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12820
13694
|
import_radix_ui3.Slider.Thumb,
|
|
12821
13695
|
{
|
|
12822
13696
|
"data-slot": "slider-thumb",
|
|
@@ -12830,15 +13704,15 @@ function Slider({
|
|
|
12830
13704
|
}
|
|
12831
13705
|
|
|
12832
13706
|
// src/components/ui/toggle-group.tsx
|
|
12833
|
-
var
|
|
13707
|
+
var React46 = __toESM(require("react"), 1);
|
|
12834
13708
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
12835
13709
|
var import_radix_ui5 = require("radix-ui");
|
|
12836
13710
|
|
|
12837
13711
|
// src/components/ui/toggle.tsx
|
|
12838
|
-
var
|
|
13712
|
+
var React45 = require("react");
|
|
12839
13713
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
12840
13714
|
var import_radix_ui4 = require("radix-ui");
|
|
12841
|
-
var
|
|
13715
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
12842
13716
|
var toggleVariants = (0, import_class_variance_authority2.cva)(
|
|
12843
13717
|
"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",
|
|
12844
13718
|
{
|
|
@@ -12861,8 +13735,8 @@ var toggleVariants = (0, import_class_variance_authority2.cva)(
|
|
|
12861
13735
|
);
|
|
12862
13736
|
|
|
12863
13737
|
// src/components/ui/toggle-group.tsx
|
|
12864
|
-
var
|
|
12865
|
-
var ToggleGroupContext =
|
|
13738
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
13739
|
+
var ToggleGroupContext = React46.createContext({
|
|
12866
13740
|
size: "default",
|
|
12867
13741
|
variant: "default",
|
|
12868
13742
|
spacing: 0,
|
|
@@ -12877,7 +13751,7 @@ function ToggleGroup({
|
|
|
12877
13751
|
children,
|
|
12878
13752
|
...props
|
|
12879
13753
|
}) {
|
|
12880
|
-
return /* @__PURE__ */ (0,
|
|
13754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
12881
13755
|
import_radix_ui5.ToggleGroup.Root,
|
|
12882
13756
|
{
|
|
12883
13757
|
"data-slot": "toggle-group",
|
|
@@ -12891,7 +13765,7 @@ function ToggleGroup({
|
|
|
12891
13765
|
className
|
|
12892
13766
|
),
|
|
12893
13767
|
...props,
|
|
12894
|
-
children: /* @__PURE__ */ (0,
|
|
13768
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
12895
13769
|
ToggleGroupContext.Provider,
|
|
12896
13770
|
{
|
|
12897
13771
|
value: { variant, size: size2, spacing, orientation },
|
|
@@ -12908,8 +13782,8 @@ function ToggleGroupItem({
|
|
|
12908
13782
|
size: size2 = "default",
|
|
12909
13783
|
...props
|
|
12910
13784
|
}) {
|
|
12911
|
-
const context =
|
|
12912
|
-
return /* @__PURE__ */ (0,
|
|
13785
|
+
const context = React46.useContext(ToggleGroupContext);
|
|
13786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
12913
13787
|
import_radix_ui5.ToggleGroup.Item,
|
|
12914
13788
|
{
|
|
12915
13789
|
"data-slot": "toggle-group-item",
|
|
@@ -12931,7 +13805,7 @@ function ToggleGroupItem({
|
|
|
12931
13805
|
}
|
|
12932
13806
|
|
|
12933
13807
|
// src/components/pet/pet-local-settings.ts
|
|
12934
|
-
var
|
|
13808
|
+
var import_chatkit_types11 = require("@xpert-ai/chatkit-types");
|
|
12935
13809
|
|
|
12936
13810
|
// src/components/pet/builtinPets.ts
|
|
12937
13811
|
var PUBLIC_PETS = [
|
|
@@ -13105,7 +13979,7 @@ function derivePetLocalSettings(pet) {
|
|
|
13105
13979
|
if (!pet) {
|
|
13106
13980
|
return { ...DEFAULT_PET_LOCAL_SETTINGS };
|
|
13107
13981
|
}
|
|
13108
|
-
const normalized = (0,
|
|
13982
|
+
const normalized = (0, import_chatkit_types11.normalizePetOptions)(pet ?? null);
|
|
13109
13983
|
if (!normalized) {
|
|
13110
13984
|
return { ...DEFAULT_PET_LOCAL_SETTINGS };
|
|
13111
13985
|
}
|
|
@@ -13135,25 +14009,25 @@ function derivePetLocalSettings(pet) {
|
|
|
13135
14009
|
return base2;
|
|
13136
14010
|
}
|
|
13137
14011
|
function isPetEnabled(pet) {
|
|
13138
|
-
return Boolean((0,
|
|
14012
|
+
return Boolean((0, import_chatkit_types11.normalizePetOptions)(pet ?? null));
|
|
13139
14013
|
}
|
|
13140
14014
|
|
|
13141
14015
|
// src/components/pet/PetPreview.tsx
|
|
13142
|
-
var
|
|
14016
|
+
var React47 = require("react");
|
|
13143
14017
|
|
|
13144
14018
|
// src/components/pet/petSpriteAtlas.ts
|
|
13145
|
-
var
|
|
14019
|
+
var import_chatkit_types12 = require("@xpert-ai/chatkit-types");
|
|
13146
14020
|
|
|
13147
14021
|
// src/components/pet/PetPreview.tsx
|
|
13148
|
-
var
|
|
14022
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
13149
14023
|
function escapeCssUrl(value) {
|
|
13150
14024
|
return value.replace(/["\\]/g, "\\$&");
|
|
13151
14025
|
}
|
|
13152
14026
|
function PetPreview({ src, label, className }) {
|
|
13153
14027
|
const scale = 0.13;
|
|
13154
|
-
const width =
|
|
13155
|
-
const height =
|
|
13156
|
-
return /* @__PURE__ */ (0,
|
|
14028
|
+
const width = import_chatkit_types12.petSpriteAtlas.cellWidth;
|
|
14029
|
+
const height = import_chatkit_types12.petSpriteAtlas.cellHeight;
|
|
14030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
13157
14031
|
"span",
|
|
13158
14032
|
{
|
|
13159
14033
|
className: cn(
|
|
@@ -13162,7 +14036,7 @@ function PetPreview({ src, label, className }) {
|
|
|
13162
14036
|
),
|
|
13163
14037
|
"aria-hidden": "true",
|
|
13164
14038
|
title: label,
|
|
13165
|
-
children: /* @__PURE__ */ (0,
|
|
14039
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
13166
14040
|
"span",
|
|
13167
14041
|
{
|
|
13168
14042
|
className: "absolute left-1/2 top-1/2 block",
|
|
@@ -13173,7 +14047,7 @@ function PetPreview({ src, label, className }) {
|
|
|
13173
14047
|
transformOrigin: "center",
|
|
13174
14048
|
backgroundImage: `url("${escapeCssUrl(src)}")`,
|
|
13175
14049
|
backgroundRepeat: "no-repeat",
|
|
13176
|
-
backgroundSize: `${
|
|
14050
|
+
backgroundSize: `${import_chatkit_types12.petSpriteAtlas.columns * width}px ${import_chatkit_types12.petSpriteAtlas.rows * height}px`,
|
|
13177
14051
|
backgroundPosition: "0px 0px",
|
|
13178
14052
|
imageRendering: "auto"
|
|
13179
14053
|
}
|
|
@@ -13184,7 +14058,7 @@ function PetPreview({ src, label, className }) {
|
|
|
13184
14058
|
}
|
|
13185
14059
|
|
|
13186
14060
|
// src/components/settings/SettingsSheet.tsx
|
|
13187
|
-
var
|
|
14061
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
13188
14062
|
var CHARACTER_TYPES2 = [
|
|
13189
14063
|
"builtin",
|
|
13190
14064
|
"atlas"
|
|
@@ -13200,13 +14074,13 @@ function SettingsSheet({
|
|
|
13200
14074
|
onSave
|
|
13201
14075
|
}) {
|
|
13202
14076
|
const { t } = useChatkitTranslation();
|
|
13203
|
-
const [draft, setDraft] =
|
|
13204
|
-
|
|
14077
|
+
const [draft, setDraft] = React48.useState(settings);
|
|
14078
|
+
React48.useEffect(() => {
|
|
13205
14079
|
if (open) {
|
|
13206
14080
|
setDraft(petRequired ? { ...settings, enabled: true } : settings);
|
|
13207
14081
|
}
|
|
13208
14082
|
}, [open, petRequired, settings]);
|
|
13209
|
-
const updateDraft =
|
|
14083
|
+
const updateDraft = React48.useCallback(
|
|
13210
14084
|
(patch) => {
|
|
13211
14085
|
setDraft((previous) => ({ ...previous, ...patch }));
|
|
13212
14086
|
},
|
|
@@ -13224,23 +14098,23 @@ function SettingsSheet({
|
|
|
13224
14098
|
defaultValue: selectedBuiltinPet.label
|
|
13225
14099
|
}
|
|
13226
14100
|
);
|
|
13227
|
-
return /* @__PURE__ */ (0,
|
|
13228
|
-
/* @__PURE__ */ (0,
|
|
13229
|
-
/* @__PURE__ */ (0,
|
|
13230
|
-
/* @__PURE__ */ (0,
|
|
14101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Sheet, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(SheetContent, { side: "right", className: "w-[min(92vw,26rem)] overflow-y-auto", children: [
|
|
14102
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SheetHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
14103
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "flex h-8 w-8 items-center justify-center rounded-md bg-primary/10 text-primary", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react28.Settings, { size: 16 }) }),
|
|
14104
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SheetTitle, { children: t("settings.title") })
|
|
13231
14105
|
] }) }),
|
|
13232
|
-
/* @__PURE__ */ (0,
|
|
13233
|
-
/* @__PURE__ */ (0,
|
|
13234
|
-
/* @__PURE__ */ (0,
|
|
13235
|
-
/* @__PURE__ */ (0,
|
|
13236
|
-
/* @__PURE__ */ (0,
|
|
14106
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("form", { className: "mt-6 space-y-5", onSubmit: handleSubmit, children: [
|
|
14107
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("section", { className: "space-y-5", children: [
|
|
14108
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
14109
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "flex h-7 w-7 items-center justify-center rounded-md bg-muted text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react28.PawPrint, { size: 15 }) }),
|
|
14110
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("h3", { className: "text-sm font-semibold", children: t("pet.settings.title") })
|
|
13237
14111
|
] }),
|
|
13238
|
-
/* @__PURE__ */ (0,
|
|
13239
|
-
/* @__PURE__ */ (0,
|
|
13240
|
-
/* @__PURE__ */ (0,
|
|
13241
|
-
petRequired && /* @__PURE__ */ (0,
|
|
14112
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2", children: [
|
|
14113
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "min-w-0", children: [
|
|
14114
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "block text-sm font-medium", children: t("pet.settings.enabled") }),
|
|
14115
|
+
petRequired && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: t("pet.settings.requiredHint") })
|
|
13242
14116
|
] }),
|
|
13243
|
-
/* @__PURE__ */ (0,
|
|
14117
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13244
14118
|
"button",
|
|
13245
14119
|
{
|
|
13246
14120
|
type: "button",
|
|
@@ -13253,7 +14127,7 @@ function SettingsSheet({
|
|
|
13253
14127
|
draft.enabled ? "bg-primary" : "bg-muted-foreground/20",
|
|
13254
14128
|
petRequired ? "cursor-not-allowed opacity-70" : ""
|
|
13255
14129
|
].join(" "),
|
|
13256
|
-
children: /* @__PURE__ */ (0,
|
|
14130
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13257
14131
|
"span",
|
|
13258
14132
|
{
|
|
13259
14133
|
className: [
|
|
@@ -13266,9 +14140,9 @@ function SettingsSheet({
|
|
|
13266
14140
|
)
|
|
13267
14141
|
] })
|
|
13268
14142
|
] }),
|
|
13269
|
-
/* @__PURE__ */ (0,
|
|
13270
|
-
/* @__PURE__ */ (0,
|
|
13271
|
-
/* @__PURE__ */ (0,
|
|
14143
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "space-y-2", children: [
|
|
14144
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { id: "chatkit-pet-type-label", className: "text-sm font-medium", children: t("pet.settings.characterType") }),
|
|
14145
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13272
14146
|
ToggleGroup,
|
|
13273
14147
|
{
|
|
13274
14148
|
id: "chatkit-pet-type",
|
|
@@ -13283,7 +14157,7 @@ function SettingsSheet({
|
|
|
13283
14157
|
variant: "outline",
|
|
13284
14158
|
spacing: 2,
|
|
13285
14159
|
className: "!w-full",
|
|
13286
|
-
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ (0,
|
|
14160
|
+
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13287
14161
|
ToggleGroupItem,
|
|
13288
14162
|
{
|
|
13289
14163
|
value: type,
|
|
@@ -13295,8 +14169,8 @@ function SettingsSheet({
|
|
|
13295
14169
|
}
|
|
13296
14170
|
)
|
|
13297
14171
|
] }),
|
|
13298
|
-
draft.characterType === "builtin" && /* @__PURE__ */ (0,
|
|
13299
|
-
/* @__PURE__ */ (0,
|
|
14172
|
+
draft.characterType === "builtin" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "space-y-2", children: [
|
|
14173
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13300
14174
|
"label",
|
|
13301
14175
|
{
|
|
13302
14176
|
htmlFor: "chatkit-pet-builtin",
|
|
@@ -13304,7 +14178,7 @@ function SettingsSheet({
|
|
|
13304
14178
|
children: t("pet.settings.builtin")
|
|
13305
14179
|
}
|
|
13306
14180
|
),
|
|
13307
|
-
/* @__PURE__ */ (0,
|
|
14181
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
13308
14182
|
Select,
|
|
13309
14183
|
{
|
|
13310
14184
|
value: selectedBuiltinPet.id,
|
|
@@ -13315,26 +14189,26 @@ function SettingsSheet({
|
|
|
13315
14189
|
}
|
|
13316
14190
|
},
|
|
13317
14191
|
children: [
|
|
13318
|
-
/* @__PURE__ */ (0,
|
|
14192
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13319
14193
|
SelectTrigger,
|
|
13320
14194
|
{
|
|
13321
14195
|
id: "chatkit-pet-builtin",
|
|
13322
14196
|
className: "min-h-12 w-full px-3 py-2",
|
|
13323
|
-
children: /* @__PURE__ */ (0,
|
|
14197
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SelectValue, { placeholder: selectedBuiltinPetLabel })
|
|
13324
14198
|
}
|
|
13325
14199
|
),
|
|
13326
|
-
/* @__PURE__ */ (0,
|
|
14200
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SelectContent, { className: "w-[var(--radix-select-trigger-width)]", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SelectGroup, { children: INCLUDED_PET_OPTIONS.map((pet) => {
|
|
13327
14201
|
const label = t(`pet.settings.builtins.${pet.id}`, {
|
|
13328
14202
|
defaultValue: pet.label
|
|
13329
14203
|
});
|
|
13330
|
-
return /* @__PURE__ */ (0,
|
|
14204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13331
14205
|
SelectItem,
|
|
13332
14206
|
{
|
|
13333
14207
|
value: pet.id,
|
|
13334
14208
|
className: "min-h-10 py-1.5 pl-2 pr-8",
|
|
13335
|
-
children: /* @__PURE__ */ (0,
|
|
13336
|
-
/* @__PURE__ */ (0,
|
|
13337
|
-
/* @__PURE__ */ (0,
|
|
14209
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
14210
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(PetPreview, { src: pet.previewSrc, label }),
|
|
14211
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "min-w-0 truncate", children: label })
|
|
13338
14212
|
] })
|
|
13339
14213
|
},
|
|
13340
14214
|
pet.id
|
|
@@ -13344,8 +14218,8 @@ function SettingsSheet({
|
|
|
13344
14218
|
}
|
|
13345
14219
|
)
|
|
13346
14220
|
] }),
|
|
13347
|
-
draft.characterType === "atlas" && /* @__PURE__ */ (0,
|
|
13348
|
-
/* @__PURE__ */ (0,
|
|
14221
|
+
draft.characterType === "atlas" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "space-y-2", children: [
|
|
14222
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13349
14223
|
"label",
|
|
13350
14224
|
{
|
|
13351
14225
|
className: "text-sm font-medium",
|
|
@@ -13353,7 +14227,7 @@ function SettingsSheet({
|
|
|
13353
14227
|
children: t("pet.settings.atlasUrl")
|
|
13354
14228
|
}
|
|
13355
14229
|
),
|
|
13356
|
-
/* @__PURE__ */ (0,
|
|
14230
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13357
14231
|
Input,
|
|
13358
14232
|
{
|
|
13359
14233
|
id: "chatkit-pet-atlas",
|
|
@@ -13363,15 +14237,15 @@ function SettingsSheet({
|
|
|
13363
14237
|
}
|
|
13364
14238
|
)
|
|
13365
14239
|
] }),
|
|
13366
|
-
/* @__PURE__ */ (0,
|
|
13367
|
-
/* @__PURE__ */ (0,
|
|
13368
|
-
/* @__PURE__ */ (0,
|
|
13369
|
-
/* @__PURE__ */ (0,
|
|
14240
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "space-y-2", children: [
|
|
14241
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
14242
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("label", { className: "text-sm font-medium", htmlFor: "chatkit-pet-scale", children: t("pet.settings.scale") }),
|
|
14243
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "text-xs tabular-nums text-muted-foreground", children: [
|
|
13370
14244
|
draft.scale.toFixed(2),
|
|
13371
14245
|
"x"
|
|
13372
14246
|
] })
|
|
13373
14247
|
] }),
|
|
13374
|
-
/* @__PURE__ */ (0,
|
|
14248
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13375
14249
|
Slider,
|
|
13376
14250
|
{
|
|
13377
14251
|
id: "chatkit-pet-scale",
|
|
@@ -13385,8 +14259,8 @@ function SettingsSheet({
|
|
|
13385
14259
|
}
|
|
13386
14260
|
)
|
|
13387
14261
|
] }),
|
|
13388
|
-
/* @__PURE__ */ (0,
|
|
13389
|
-
/* @__PURE__ */ (0,
|
|
14262
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
14263
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13390
14264
|
"input",
|
|
13391
14265
|
{
|
|
13392
14266
|
type: "checkbox",
|
|
@@ -13397,8 +14271,8 @@ function SettingsSheet({
|
|
|
13397
14271
|
),
|
|
13398
14272
|
t("pet.settings.draggable")
|
|
13399
14273
|
] }),
|
|
13400
|
-
/* @__PURE__ */ (0,
|
|
13401
|
-
/* @__PURE__ */ (0,
|
|
14274
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
14275
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13402
14276
|
"input",
|
|
13403
14277
|
{
|
|
13404
14278
|
type: "checkbox",
|
|
@@ -13409,8 +14283,8 @@ function SettingsSheet({
|
|
|
13409
14283
|
),
|
|
13410
14284
|
t("pet.settings.persistPosition")
|
|
13411
14285
|
] }),
|
|
13412
|
-
/* @__PURE__ */ (0,
|
|
13413
|
-
/* @__PURE__ */ (0,
|
|
14286
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex justify-end gap-2 pt-2", children: [
|
|
14287
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13414
14288
|
Button,
|
|
13415
14289
|
{
|
|
13416
14290
|
type: "button",
|
|
@@ -13419,7 +14293,7 @@ function SettingsSheet({
|
|
|
13419
14293
|
children: t("pet.settings.cancel")
|
|
13420
14294
|
}
|
|
13421
14295
|
),
|
|
13422
|
-
/* @__PURE__ */ (0,
|
|
14296
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Button, { type: "submit", children: t("pet.settings.save") })
|
|
13423
14297
|
] })
|
|
13424
14298
|
] })
|
|
13425
14299
|
] }) });
|
|
@@ -14046,7 +14920,7 @@ function findDomPointForComposerOffset(root, offset) {
|
|
|
14046
14920
|
}
|
|
14047
14921
|
|
|
14048
14922
|
// src/components/chat.tsx
|
|
14049
|
-
var
|
|
14923
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
14050
14924
|
var import_meta2 = {};
|
|
14051
14925
|
var defaultApiUrl2 = import_meta2.env.VITE_XPERTAI_API_URL;
|
|
14052
14926
|
var COMPOSER_INPUT_MAX_HEIGHT = 128;
|
|
@@ -14191,8 +15065,8 @@ function ReferenceChip({
|
|
|
14191
15065
|
}) {
|
|
14192
15066
|
const metaLine = getReferenceMetaLine(reference);
|
|
14193
15067
|
const isComposer = variant === "composer";
|
|
14194
|
-
const Icon = reference.type === "quote" ?
|
|
14195
|
-
return /* @__PURE__ */ (0,
|
|
15068
|
+
const Icon = reference.type === "quote" ? import_lucide_react29.Quote : reference.type === "image" ? import_lucide_react29.ImageIcon : import_lucide_react29.FileText;
|
|
15069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
14196
15070
|
"div",
|
|
14197
15071
|
{
|
|
14198
15072
|
className: cn(
|
|
@@ -14201,7 +15075,7 @@ function ReferenceChip({
|
|
|
14201
15075
|
),
|
|
14202
15076
|
title: getReferenceTitle(reference),
|
|
14203
15077
|
children: [
|
|
14204
|
-
/* @__PURE__ */ (0,
|
|
15078
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14205
15079
|
Icon,
|
|
14206
15080
|
{
|
|
14207
15081
|
size: isComposer ? 14 : 12,
|
|
@@ -14211,8 +15085,8 @@ function ReferenceChip({
|
|
|
14211
15085
|
)
|
|
14212
15086
|
}
|
|
14213
15087
|
),
|
|
14214
|
-
/* @__PURE__ */ (0,
|
|
14215
|
-
/* @__PURE__ */ (0,
|
|
15088
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
15089
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14216
15090
|
"div",
|
|
14217
15091
|
{
|
|
14218
15092
|
className: cn(
|
|
@@ -14222,7 +15096,7 @@ function ReferenceChip({
|
|
|
14222
15096
|
children: getReferenceLabel(reference)
|
|
14223
15097
|
}
|
|
14224
15098
|
),
|
|
14225
|
-
metaLine && /* @__PURE__ */ (0,
|
|
15099
|
+
metaLine && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14226
15100
|
"div",
|
|
14227
15101
|
{
|
|
14228
15102
|
className: cn(
|
|
@@ -14233,7 +15107,7 @@ function ReferenceChip({
|
|
|
14233
15107
|
}
|
|
14234
15108
|
)
|
|
14235
15109
|
] }),
|
|
14236
|
-
onRemove && removeLabel && /* @__PURE__ */ (0,
|
|
15110
|
+
onRemove && removeLabel && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14237
15111
|
"button",
|
|
14238
15112
|
{
|
|
14239
15113
|
type: "button",
|
|
@@ -14244,7 +15118,7 @@ function ReferenceChip({
|
|
|
14244
15118
|
),
|
|
14245
15119
|
title: removeLabel,
|
|
14246
15120
|
"aria-label": removeLabel,
|
|
14247
|
-
children: /* @__PURE__ */ (0,
|
|
15121
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.X, { size: 12 })
|
|
14248
15122
|
}
|
|
14249
15123
|
)
|
|
14250
15124
|
]
|
|
@@ -14268,26 +15142,26 @@ function Chat({
|
|
|
14268
15142
|
const { setStream } = useStreamManager();
|
|
14269
15143
|
const stream = useStreamContext();
|
|
14270
15144
|
const { theme } = useTheme();
|
|
14271
|
-
const [isHistoryLoading, setIsHistoryLoading] =
|
|
14272
|
-
const [historyError, setHistoryError] =
|
|
14273
|
-
const [assistantName, setAssistantName] =
|
|
14274
|
-
const [assistantAvatar, setAssistantAvatar] =
|
|
14275
|
-
const [threadGoal, setThreadGoal] =
|
|
14276
|
-
const [goalError, setGoalError] =
|
|
14277
|
-
const [isGoalLoading, setIsGoalLoading] =
|
|
14278
|
-
const [isGoalPanelOpen, setIsGoalPanelOpen] =
|
|
14279
|
-
const [isGoalObjectiveExpanded, setIsGoalObjectiveExpanded] =
|
|
14280
|
-
const [goalElapsedStartedAt, setGoalElapsedStartedAt] =
|
|
15145
|
+
const [isHistoryLoading, setIsHistoryLoading] = React49.useState(false);
|
|
15146
|
+
const [historyError, setHistoryError] = React49.useState(null);
|
|
15147
|
+
const [assistantName, setAssistantName] = React49.useState(null);
|
|
15148
|
+
const [assistantAvatar, setAssistantAvatar] = React49.useState(null);
|
|
15149
|
+
const [threadGoal, setThreadGoal] = React49.useState(null);
|
|
15150
|
+
const [goalError, setGoalError] = React49.useState(null);
|
|
15151
|
+
const [isGoalLoading, setIsGoalLoading] = React49.useState(false);
|
|
15152
|
+
const [isGoalPanelOpen, setIsGoalPanelOpen] = React49.useState(false);
|
|
15153
|
+
const [isGoalObjectiveExpanded, setIsGoalObjectiveExpanded] = React49.useState(false);
|
|
15154
|
+
const [goalElapsedStartedAt, setGoalElapsedStartedAt] = React49.useState(null);
|
|
14281
15155
|
const LOADING_DOTS_MIN_DURATION = 800;
|
|
14282
15156
|
const STREAMING_STATUS_REFRESH_MS = 250;
|
|
14283
|
-
const [showLoadingDots, setShowLoadingDots] =
|
|
14284
|
-
const [streamingNow, setStreamingNow] =
|
|
14285
|
-
const loadingStartTimeRef =
|
|
14286
|
-
const lastStreamOutputAtRef =
|
|
14287
|
-
|
|
15157
|
+
const [showLoadingDots, setShowLoadingDots] = React49.useState(false);
|
|
15158
|
+
const [streamingNow, setStreamingNow] = React49.useState(() => Date.now());
|
|
15159
|
+
const loadingStartTimeRef = React49.useRef(null);
|
|
15160
|
+
const lastStreamOutputAtRef = React49.useRef(null);
|
|
15161
|
+
React49.useEffect(() => {
|
|
14288
15162
|
setStream(stream);
|
|
14289
15163
|
}, [setStream, stream]);
|
|
14290
|
-
|
|
15164
|
+
React49.useEffect(() => {
|
|
14291
15165
|
if (stream.isLoading) {
|
|
14292
15166
|
if (!loadingStartTimeRef.current) {
|
|
14293
15167
|
loadingStartTimeRef.current = Date.now();
|
|
@@ -14310,7 +15184,7 @@ function Chat({
|
|
|
14310
15184
|
}
|
|
14311
15185
|
}
|
|
14312
15186
|
}, [stream.isLoading]);
|
|
14313
|
-
|
|
15187
|
+
React49.useEffect(() => {
|
|
14314
15188
|
if (!stream.isLoading) {
|
|
14315
15189
|
lastStreamOutputAtRef.current = null;
|
|
14316
15190
|
setStreamingNow(Date.now());
|
|
@@ -14320,7 +15194,7 @@ function Chat({
|
|
|
14320
15194
|
lastStreamOutputAtRef.current = now;
|
|
14321
15195
|
setStreamingNow(now);
|
|
14322
15196
|
}, [stream.messages, stream.isLoading]);
|
|
14323
|
-
|
|
15197
|
+
React49.useEffect(() => {
|
|
14324
15198
|
if (!stream.isLoading) {
|
|
14325
15199
|
return;
|
|
14326
15200
|
}
|
|
@@ -14329,7 +15203,7 @@ function Chat({
|
|
|
14329
15203
|
}, STREAMING_STATUS_REFRESH_MS);
|
|
14330
15204
|
return () => window.clearInterval(timer);
|
|
14331
15205
|
}, [stream.isLoading]);
|
|
14332
|
-
|
|
15206
|
+
React49.useEffect(() => {
|
|
14333
15207
|
if (threadGoal?.status === "active" && stream.isLoading) {
|
|
14334
15208
|
setGoalElapsedStartedAt(Date.now());
|
|
14335
15209
|
return;
|
|
@@ -14341,82 +15215,82 @@ function Chat({
|
|
|
14341
15215
|
threadGoal?.id,
|
|
14342
15216
|
threadGoal?.status
|
|
14343
15217
|
]);
|
|
14344
|
-
|
|
15218
|
+
React49.useEffect(() => {
|
|
14345
15219
|
setIsGoalObjectiveExpanded(false);
|
|
14346
15220
|
}, [threadGoal?.id]);
|
|
14347
|
-
const [composerParts, setComposerParts] =
|
|
14348
|
-
const [renderedComposerParts, setRenderedComposerParts] =
|
|
14349
|
-
const [composerDomVersion, setComposerDomVersion] =
|
|
14350
|
-
const [selectedTool, setSelectedTool] =
|
|
15221
|
+
const [composerParts, setComposerParts] = React49.useState([]);
|
|
15222
|
+
const [renderedComposerParts, setRenderedComposerParts] = React49.useState([]);
|
|
15223
|
+
const [composerDomVersion, setComposerDomVersion] = React49.useState(0);
|
|
15224
|
+
const [selectedTool, setSelectedTool] = React49.useState(
|
|
14351
15225
|
null
|
|
14352
15226
|
);
|
|
14353
|
-
const [planModeEnabled, setPlanModeEnabled] =
|
|
14354
|
-
const [petSettingsOpen, setPetSettingsOpen] =
|
|
14355
|
-
const [petLocalSettings, setPetLocalSettings] =
|
|
14356
|
-
const [runtimeCapabilities, setRuntimeCapabilities] =
|
|
14357
|
-
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] =
|
|
14358
|
-
const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] =
|
|
15227
|
+
const [planModeEnabled, setPlanModeEnabled] = React49.useState(false);
|
|
15228
|
+
const [petSettingsOpen, setPetSettingsOpen] = React49.useState(false);
|
|
15229
|
+
const [petLocalSettings, setPetLocalSettings] = React49.useState(() => readPetLocalSettings());
|
|
15230
|
+
const [runtimeCapabilities, setRuntimeCapabilities] = React49.useState(null);
|
|
15231
|
+
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] = React49.useState(false);
|
|
15232
|
+
const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] = React49.useState(
|
|
14359
15233
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
14360
15234
|
);
|
|
14361
|
-
const [runRuntimeCapabilities, setRunRuntimeCapabilities] =
|
|
15235
|
+
const [runRuntimeCapabilities, setRunRuntimeCapabilities] = React49.useState(
|
|
14362
15236
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
14363
15237
|
);
|
|
14364
|
-
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] =
|
|
14365
|
-
const [attachmentState, setAttachmentState] =
|
|
15238
|
+
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] = React49.useState(null);
|
|
15239
|
+
const [attachmentState, setAttachmentState] = React49.useState({
|
|
14366
15240
|
uploadedFiles: [],
|
|
14367
15241
|
hasUploadingFiles: false,
|
|
14368
15242
|
hasParsingFiles: false
|
|
14369
15243
|
});
|
|
14370
|
-
const [references, setReferences] =
|
|
14371
|
-
const [isUploadingReferenceImages, setIsUploadingReferenceImages] =
|
|
14372
|
-
const [quoteSelection, setQuoteSelection] =
|
|
14373
|
-
const [isAtBottom, setIsAtBottom] =
|
|
14374
|
-
const [hasUpdatesBelow, setHasUpdatesBelow] =
|
|
15244
|
+
const [references, setReferences] = React49.useState([]);
|
|
15245
|
+
const [isUploadingReferenceImages, setIsUploadingReferenceImages] = React49.useState(false);
|
|
15246
|
+
const [quoteSelection, setQuoteSelection] = React49.useState(null);
|
|
15247
|
+
const [isAtBottom, setIsAtBottom] = React49.useState(true);
|
|
15248
|
+
const [hasUpdatesBelow, setHasUpdatesBelow] = React49.useState(false);
|
|
14375
15249
|
const {
|
|
14376
15250
|
threads,
|
|
14377
15251
|
deleteThread,
|
|
14378
15252
|
refreshThreads,
|
|
14379
15253
|
isLoading: isThreadsLoading
|
|
14380
15254
|
} = useThreads();
|
|
14381
|
-
const viewportRef =
|
|
14382
|
-
const attachmentsRef =
|
|
14383
|
-
const composerInputRef =
|
|
14384
|
-
const slashPaletteRef =
|
|
14385
|
-
const slashPaletteOptionRefs =
|
|
15255
|
+
const viewportRef = React49.useRef(null);
|
|
15256
|
+
const attachmentsRef = React49.useRef(null);
|
|
15257
|
+
const composerInputRef = React49.useRef(null);
|
|
15258
|
+
const slashPaletteRef = React49.useRef(null);
|
|
15259
|
+
const slashPaletteOptionRefs = React49.useRef(
|
|
14386
15260
|
[]
|
|
14387
15261
|
);
|
|
14388
|
-
const composerPartsRef =
|
|
14389
|
-
const pendingComposerCaretOffsetRef =
|
|
14390
|
-
const shouldAutoScrollRef =
|
|
14391
|
-
const forceFollowRef =
|
|
14392
|
-
const previousMessageCountRef =
|
|
14393
|
-
const previousScrollTopRef =
|
|
14394
|
-
const isPrependingHistoryMessagesRef =
|
|
14395
|
-
const autoScrollFrameRef =
|
|
14396
|
-
const isPointerDownRef =
|
|
14397
|
-
const lastTouchYRef =
|
|
14398
|
-
const runtimeCapabilityPreferenceLoadRef =
|
|
15262
|
+
const composerPartsRef = React49.useRef([]);
|
|
15263
|
+
const pendingComposerCaretOffsetRef = React49.useRef(null);
|
|
15264
|
+
const shouldAutoScrollRef = React49.useRef(true);
|
|
15265
|
+
const forceFollowRef = React49.useRef(false);
|
|
15266
|
+
const previousMessageCountRef = React49.useRef(0);
|
|
15267
|
+
const previousScrollTopRef = React49.useRef(0);
|
|
15268
|
+
const isPrependingHistoryMessagesRef = React49.useRef(false);
|
|
15269
|
+
const autoScrollFrameRef = React49.useRef(null);
|
|
15270
|
+
const isPointerDownRef = React49.useRef(false);
|
|
15271
|
+
const lastTouchYRef = React49.useRef(null);
|
|
15272
|
+
const runtimeCapabilityPreferenceLoadRef = React49.useRef(0);
|
|
14399
15273
|
const resolvedTitle = title ?? t("chat.title");
|
|
14400
15274
|
const resolvedPlaceholder = placeholder ?? t("chat.placeholder");
|
|
14401
15275
|
const petRequired = options?.displayMode === "pet";
|
|
14402
|
-
const basePetSettings =
|
|
15276
|
+
const basePetSettings = React49.useMemo(
|
|
14403
15277
|
() => derivePetLocalSettings(options?.pet),
|
|
14404
15278
|
[options?.pet]
|
|
14405
15279
|
);
|
|
14406
|
-
const displayedPetSettings =
|
|
15280
|
+
const displayedPetSettings = React49.useMemo(
|
|
14407
15281
|
() => ({
|
|
14408
15282
|
...petLocalSettings ?? basePetSettings,
|
|
14409
15283
|
...petRequired ? { enabled: true } : {}
|
|
14410
15284
|
}),
|
|
14411
15285
|
[basePetSettings, petLocalSettings, petRequired]
|
|
14412
15286
|
);
|
|
14413
|
-
const effectivePet =
|
|
15287
|
+
const effectivePet = React49.useMemo(() => {
|
|
14414
15288
|
if (petRequired || petLocalSettings) {
|
|
14415
15289
|
return buildPetOptionsFromLocalSettings(displayedPetSettings);
|
|
14416
15290
|
}
|
|
14417
15291
|
return options?.pet ?? null;
|
|
14418
15292
|
}, [displayedPetSettings, options?.pet, petLocalSettings, petRequired]);
|
|
14419
|
-
const savePetLocalSettings =
|
|
15293
|
+
const savePetLocalSettings = React49.useCallback(
|
|
14420
15294
|
(settings) => {
|
|
14421
15295
|
const nextSettings = petRequired ? { ...settings, enabled: true } : settings;
|
|
14422
15296
|
setPetLocalSettings(nextSettings);
|
|
@@ -14424,7 +15298,7 @@ function Chat({
|
|
|
14424
15298
|
},
|
|
14425
15299
|
[petRequired]
|
|
14426
15300
|
);
|
|
14427
|
-
const handlePetCommand =
|
|
15301
|
+
const handlePetCommand = React49.useCallback(
|
|
14428
15302
|
(mode) => {
|
|
14429
15303
|
if (mode === "settings") {
|
|
14430
15304
|
setPetSettingsOpen(true);
|
|
@@ -14446,7 +15320,7 @@ function Chat({
|
|
|
14446
15320
|
[displayedPetSettings, effectivePet, petRequired, savePetLocalSettings]
|
|
14447
15321
|
);
|
|
14448
15322
|
const inputPlaceholder = selectedTool?.placeholderOverride ?? composer?.placeholder ?? resolvedPlaceholder;
|
|
14449
|
-
const messages =
|
|
15323
|
+
const messages = React49.useMemo(
|
|
14450
15324
|
() => stream.messages ?? [],
|
|
14451
15325
|
[stream.messages]
|
|
14452
15326
|
);
|
|
@@ -14455,7 +15329,7 @@ function Chat({
|
|
|
14455
15329
|
historyMessagePagination?.isLoadingMore
|
|
14456
15330
|
);
|
|
14457
15331
|
const canLoadMoreMessages = Boolean(historyMessagePagination?.hasMore);
|
|
14458
|
-
const draft =
|
|
15332
|
+
const draft = React49.useMemo(
|
|
14459
15333
|
() => getComposerPlainText(composerParts),
|
|
14460
15334
|
[composerParts]
|
|
14461
15335
|
);
|
|
@@ -14469,7 +15343,7 @@ function Chat({
|
|
|
14469
15343
|
isEmpty: isComposerInputEmpty,
|
|
14470
15344
|
isStacked: isComposerStacked
|
|
14471
15345
|
});
|
|
14472
|
-
const pendingFollowUps =
|
|
15346
|
+
const pendingFollowUps = React49.useMemo(
|
|
14473
15347
|
() => sortVisiblePendingFollowUps(stream.pendingFollowUps ?? []),
|
|
14474
15348
|
[stream.pendingFollowUps]
|
|
14475
15349
|
);
|
|
@@ -14478,11 +15352,11 @@ function Chat({
|
|
|
14478
15352
|
const hasPendingHITLRequest = Boolean(stream.pendingHITLRequest);
|
|
14479
15353
|
const hasPendingInteractiveRequest = hasPendingRequestUserInput || hasPendingHITLRequest;
|
|
14480
15354
|
const hasPendingTodos = Boolean(stream.todos?.items.length);
|
|
14481
|
-
const runtimeCapabilityOptions =
|
|
15355
|
+
const runtimeCapabilityOptions = React49.useMemo(
|
|
14482
15356
|
() => getRuntimeCapabilityOptions(runtimeCapabilities),
|
|
14483
15357
|
[runtimeCapabilities]
|
|
14484
15358
|
);
|
|
14485
|
-
const goalAdapter =
|
|
15359
|
+
const goalAdapter = React49.useMemo(
|
|
14486
15360
|
() => {
|
|
14487
15361
|
if (isGoalAdapter(options?.goal)) {
|
|
14488
15362
|
return options.goal;
|
|
@@ -14492,7 +15366,7 @@ function Chat({
|
|
|
14492
15366
|
[options?.goal, stream.client]
|
|
14493
15367
|
);
|
|
14494
15368
|
const displayedGoalElapsedSeconds = threadGoal ? (threadGoal.elapsedSeconds ?? 0) + (goalElapsedStartedAt ? Math.max(0, Math.floor((streamingNow - goalElapsedStartedAt) / 1e3)) : 0) : 0;
|
|
14495
|
-
const effectiveSessionRuntimeCapabilities =
|
|
15369
|
+
const effectiveSessionRuntimeCapabilities = React49.useMemo(
|
|
14496
15370
|
() => runtimeCapabilitiesReady && runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
14497
15371
|
runtimeCapabilities,
|
|
14498
15372
|
sessionRuntimeCapabilities
|
|
@@ -14505,7 +15379,7 @@ function Chat({
|
|
|
14505
15379
|
"goal"
|
|
14506
15380
|
);
|
|
14507
15381
|
const showGoalStatus = goalCommandAvailable && !hasCompletedGoal && (Boolean(goalError) || threadGoal?.status === "active" && stream.isLoading);
|
|
14508
|
-
const runRuntimeCapabilityOptions =
|
|
15382
|
+
const runRuntimeCapabilityOptions = React49.useMemo(
|
|
14509
15383
|
() => runtimeCapabilityOptions.filter(
|
|
14510
15384
|
(option) => isRuntimeCapabilitySelected(
|
|
14511
15385
|
runRuntimeCapabilities,
|
|
@@ -14515,11 +15389,11 @@ function Chat({
|
|
|
14515
15389
|
),
|
|
14516
15390
|
[runRuntimeCapabilities, runtimeCapabilityOptions]
|
|
14517
15391
|
);
|
|
14518
|
-
const composerRuntimeCapabilitySelectionKeys =
|
|
15392
|
+
const composerRuntimeCapabilitySelectionKeys = React49.useMemo(
|
|
14519
15393
|
() => getComposerCapabilitySelectionKeys(composerParts),
|
|
14520
15394
|
[composerParts]
|
|
14521
15395
|
);
|
|
14522
|
-
const detachedRunRuntimeCapabilityOptions =
|
|
15396
|
+
const detachedRunRuntimeCapabilityOptions = React49.useMemo(
|
|
14523
15397
|
() => runRuntimeCapabilityOptions.filter(
|
|
14524
15398
|
(option) => !composerRuntimeCapabilitySelectionKeys.has(
|
|
14525
15399
|
getRuntimeCapabilityOptionKey(option)
|
|
@@ -14527,7 +15401,7 @@ function Chat({
|
|
|
14527
15401
|
),
|
|
14528
15402
|
[composerRuntimeCapabilitySelectionKeys, runRuntimeCapabilityOptions]
|
|
14529
15403
|
);
|
|
14530
|
-
const persistSessionRuntimeCapabilities =
|
|
15404
|
+
const persistSessionRuntimeCapabilities = React49.useCallback(
|
|
14531
15405
|
async (threadId, selection) => {
|
|
14532
15406
|
if (!runtimeCapabilities || !selection) {
|
|
14533
15407
|
return;
|
|
@@ -14552,10 +15426,10 @@ function Chat({
|
|
|
14552
15426
|
},
|
|
14553
15427
|
[runtimeCapabilities, stream.client]
|
|
14554
15428
|
);
|
|
14555
|
-
const clearQuoteSelection =
|
|
15429
|
+
const clearQuoteSelection = React49.useCallback(() => {
|
|
14556
15430
|
setQuoteSelection(null);
|
|
14557
15431
|
}, []);
|
|
14558
|
-
const commitComposerParts =
|
|
15432
|
+
const commitComposerParts = React49.useCallback(
|
|
14559
15433
|
(nextParts, options2) => {
|
|
14560
15434
|
const normalized = normalizeComposerParts(nextParts);
|
|
14561
15435
|
const previous = composerPartsRef.current;
|
|
@@ -14591,7 +15465,7 @@ function Chat({
|
|
|
14591
15465
|
},
|
|
14592
15466
|
[]
|
|
14593
15467
|
);
|
|
14594
|
-
const setComposerText =
|
|
15468
|
+
const setComposerText = React49.useCallback(
|
|
14595
15469
|
(text, caretOffset = text.length) => {
|
|
14596
15470
|
commitComposerParts(createComposerTextParts(text), {
|
|
14597
15471
|
caretOffset,
|
|
@@ -14601,7 +15475,7 @@ function Chat({
|
|
|
14601
15475
|
},
|
|
14602
15476
|
[commitComposerParts]
|
|
14603
15477
|
);
|
|
14604
|
-
const focusComposerAt =
|
|
15478
|
+
const focusComposerAt = React49.useCallback((position) => {
|
|
14605
15479
|
const nextPosition = position ?? getComposerEditingLength(composerPartsRef.current);
|
|
14606
15480
|
pendingComposerCaretOffsetRef.current = nextPosition;
|
|
14607
15481
|
requestAnimationFrame(() => {
|
|
@@ -14613,7 +15487,7 @@ function Chat({
|
|
|
14613
15487
|
});
|
|
14614
15488
|
}, []);
|
|
14615
15489
|
const parentMessenger = useParentMessenger({
|
|
14616
|
-
onSetComposerValue:
|
|
15490
|
+
onSetComposerValue: React49.useCallback(
|
|
14617
15491
|
(payload) => {
|
|
14618
15492
|
if (!payload) {
|
|
14619
15493
|
return;
|
|
@@ -14636,10 +15510,10 @@ function Chat({
|
|
|
14636
15510
|
},
|
|
14637
15511
|
[composer?.tools, setComposerText]
|
|
14638
15512
|
),
|
|
14639
|
-
onFocusComposer:
|
|
15513
|
+
onFocusComposer: React49.useCallback(() => {
|
|
14640
15514
|
composerInputRef.current?.focus();
|
|
14641
15515
|
}, []),
|
|
14642
|
-
onSetPetEnabled:
|
|
15516
|
+
onSetPetEnabled: React49.useCallback(
|
|
14643
15517
|
(enabled) => {
|
|
14644
15518
|
if (petRequired) {
|
|
14645
15519
|
return;
|
|
@@ -14653,10 +15527,10 @@ function Chat({
|
|
|
14653
15527
|
)
|
|
14654
15528
|
});
|
|
14655
15529
|
const canMinimizeToPet = parentMessenger?.isParentAvailable === true && isPetEnabled(effectivePet);
|
|
14656
|
-
const handleMinimizeToPet =
|
|
15530
|
+
const handleMinimizeToPet = React49.useCallback(() => {
|
|
14657
15531
|
parentMessenger?.sendEvent("chat_minimize_change", { minimized: true });
|
|
14658
15532
|
}, [parentMessenger]);
|
|
14659
|
-
const syncQuoteSelection =
|
|
15533
|
+
const syncQuoteSelection = React49.useCallback(() => {
|
|
14660
15534
|
if (typeof window === "undefined") {
|
|
14661
15535
|
clearQuoteSelection();
|
|
14662
15536
|
return;
|
|
@@ -14701,23 +15575,23 @@ function Chat({
|
|
|
14701
15575
|
left
|
|
14702
15576
|
});
|
|
14703
15577
|
}, [clearQuoteSelection]);
|
|
14704
|
-
const cancelPendingAutoScroll =
|
|
15578
|
+
const cancelPendingAutoScroll = React49.useCallback(() => {
|
|
14705
15579
|
if (autoScrollFrameRef.current !== null) {
|
|
14706
15580
|
cancelAnimationFrame(autoScrollFrameRef.current);
|
|
14707
15581
|
autoScrollFrameRef.current = null;
|
|
14708
15582
|
}
|
|
14709
15583
|
}, []);
|
|
14710
|
-
const disableAutoFollow =
|
|
15584
|
+
const disableAutoFollow = React49.useCallback(() => {
|
|
14711
15585
|
forceFollowRef.current = false;
|
|
14712
15586
|
shouldAutoScrollRef.current = false;
|
|
14713
15587
|
cancelPendingAutoScroll();
|
|
14714
15588
|
}, [cancelPendingAutoScroll]);
|
|
14715
|
-
const enableAutoFollow =
|
|
15589
|
+
const enableAutoFollow = React49.useCallback(() => {
|
|
14716
15590
|
forceFollowRef.current = true;
|
|
14717
15591
|
shouldAutoScrollRef.current = true;
|
|
14718
15592
|
setHasUpdatesBelow(false);
|
|
14719
15593
|
}, []);
|
|
14720
|
-
const scrollToBottom =
|
|
15594
|
+
const scrollToBottom = React49.useCallback(
|
|
14721
15595
|
(smooth = false, force = false) => {
|
|
14722
15596
|
if (force) {
|
|
14723
15597
|
enableAutoFollow();
|
|
@@ -14744,7 +15618,7 @@ function Chat({
|
|
|
14744
15618
|
},
|
|
14745
15619
|
[cancelPendingAutoScroll, enableAutoFollow]
|
|
14746
15620
|
);
|
|
14747
|
-
|
|
15621
|
+
React49.useEffect(() => {
|
|
14748
15622
|
const viewport = viewportRef.current;
|
|
14749
15623
|
if (!viewport) return;
|
|
14750
15624
|
previousScrollTopRef.current = viewport.scrollTop;
|
|
@@ -14825,14 +15699,14 @@ function Chat({
|
|
|
14825
15699
|
window.removeEventListener("pointercancel", stopPointerTracking);
|
|
14826
15700
|
};
|
|
14827
15701
|
}, [cancelPendingAutoScroll, disableAutoFollow]);
|
|
14828
|
-
|
|
15702
|
+
React49.useEffect(() => {
|
|
14829
15703
|
shouldAutoScrollRef.current = true;
|
|
14830
15704
|
forceFollowRef.current = false;
|
|
14831
15705
|
previousScrollTopRef.current = 0;
|
|
14832
15706
|
setIsAtBottom(true);
|
|
14833
15707
|
setHasUpdatesBelow(false);
|
|
14834
15708
|
}, [stream.threadId]);
|
|
14835
|
-
|
|
15709
|
+
React49.useEffect(() => {
|
|
14836
15710
|
const messageCountChanged = messages.length !== previousMessageCountRef.current;
|
|
14837
15711
|
previousMessageCountRef.current = messages.length;
|
|
14838
15712
|
if (isPrependingHistoryMessagesRef.current) {
|
|
@@ -14855,7 +15729,7 @@ function Chat({
|
|
|
14855
15729
|
clientSecret: effectiveClientSecret
|
|
14856
15730
|
});
|
|
14857
15731
|
const missingConfig = Boolean(missingConfigKind);
|
|
14858
|
-
const missingConfigShortMessage =
|
|
15732
|
+
const missingConfigShortMessage = React49.useMemo(() => {
|
|
14859
15733
|
switch (missingConfigKind) {
|
|
14860
15734
|
case "apiUrl":
|
|
14861
15735
|
return t("chat.missingApiUrlShort");
|
|
@@ -14867,7 +15741,7 @@ function Chat({
|
|
|
14867
15741
|
return t("chat.missingConfigShort");
|
|
14868
15742
|
}
|
|
14869
15743
|
}, [missingConfigKind, t]);
|
|
14870
|
-
const missingConfigDetailMessage =
|
|
15744
|
+
const missingConfigDetailMessage = React49.useMemo(() => {
|
|
14871
15745
|
switch (missingConfigKind) {
|
|
14872
15746
|
case "apiUrl":
|
|
14873
15747
|
return t("chat.missingApiUrlDetail");
|
|
@@ -14881,8 +15755,10 @@ function Chat({
|
|
|
14881
15755
|
}, [missingConfigKind, t]);
|
|
14882
15756
|
const showMissingConfig = !isClientSecretInitializing && missingConfig;
|
|
14883
15757
|
const hasUploadingFiles = attachmentState.hasUploadingFiles;
|
|
14884
|
-
const
|
|
14885
|
-
const
|
|
15758
|
+
const isSubmissionBlocked = hasPendingInteractiveRequest || missingConfig || isHistoryLoading || hasUploadingFiles || isUploadingReferenceImages;
|
|
15759
|
+
const isSendDisabled = !trimmedDraft && !hasReferences || isSubmissionBlocked;
|
|
15760
|
+
const isPromptEditDisabled = hasPendingInteractiveRequest || missingConfig || isHistoryLoading;
|
|
15761
|
+
const resizeComposerInput = React49.useCallback(() => {
|
|
14886
15762
|
const input = composerInputRef.current;
|
|
14887
15763
|
if (!input) {
|
|
14888
15764
|
return;
|
|
@@ -14890,7 +15766,7 @@ function Chat({
|
|
|
14890
15766
|
input.style.maxHeight = `${COMPOSER_INPUT_MAX_HEIGHT}px`;
|
|
14891
15767
|
input.style.overflowY = input.scrollHeight > COMPOSER_INPUT_MAX_HEIGHT ? "auto" : "hidden";
|
|
14892
15768
|
}, []);
|
|
14893
|
-
|
|
15769
|
+
React49.useLayoutEffect(() => {
|
|
14894
15770
|
composerPartsRef.current = composerParts;
|
|
14895
15771
|
resizeComposerInput();
|
|
14896
15772
|
const caretOffset = pendingComposerCaretOffsetRef.current;
|
|
@@ -14902,13 +15778,13 @@ function Chat({
|
|
|
14902
15778
|
}
|
|
14903
15779
|
}
|
|
14904
15780
|
}, [composerDomVersion, composerParts, resizeComposerInput]);
|
|
14905
|
-
|
|
15781
|
+
React49.useEffect(() => {
|
|
14906
15782
|
document.addEventListener("selectionchange", syncQuoteSelection);
|
|
14907
15783
|
return () => {
|
|
14908
15784
|
document.removeEventListener("selectionchange", syncQuoteSelection);
|
|
14909
15785
|
};
|
|
14910
15786
|
}, [syncQuoteSelection]);
|
|
14911
|
-
|
|
15787
|
+
React49.useEffect(() => {
|
|
14912
15788
|
const viewport = viewportRef.current;
|
|
14913
15789
|
if (!viewport) {
|
|
14914
15790
|
return;
|
|
@@ -14925,14 +15801,14 @@ function Chat({
|
|
|
14925
15801
|
window.removeEventListener("resize", handleViewportScroll);
|
|
14926
15802
|
};
|
|
14927
15803
|
}, [clearQuoteSelection]);
|
|
14928
|
-
|
|
15804
|
+
React49.useEffect(() => {
|
|
14929
15805
|
clearQuoteSelection();
|
|
14930
15806
|
}, [messages.length, stream.threadId, clearQuoteSelection]);
|
|
14931
|
-
|
|
15807
|
+
React49.useEffect(() => {
|
|
14932
15808
|
if (missingConfig) return;
|
|
14933
15809
|
void refreshThreads();
|
|
14934
15810
|
}, [missingConfig, refreshThreads]);
|
|
14935
|
-
|
|
15811
|
+
React49.useEffect(() => {
|
|
14936
15812
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
14937
15813
|
setAssistantName(null);
|
|
14938
15814
|
setAssistantAvatar(null);
|
|
@@ -14955,7 +15831,7 @@ function Chat({
|
|
|
14955
15831
|
cancelled = true;
|
|
14956
15832
|
};
|
|
14957
15833
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
14958
|
-
|
|
15834
|
+
React49.useEffect(() => {
|
|
14959
15835
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
14960
15836
|
setRuntimeCapabilities(null);
|
|
14961
15837
|
setRuntimeCapabilitiesReady(false);
|
|
@@ -15002,7 +15878,7 @@ function Chat({
|
|
|
15002
15878
|
});
|
|
15003
15879
|
return () => controller.abort();
|
|
15004
15880
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
15005
|
-
|
|
15881
|
+
React49.useEffect(() => {
|
|
15006
15882
|
setRunRuntimeCapabilities(
|
|
15007
15883
|
createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
|
|
15008
15884
|
);
|
|
@@ -15051,10 +15927,10 @@ function Chat({
|
|
|
15051
15927
|
stream.client,
|
|
15052
15928
|
stream.threadId
|
|
15053
15929
|
]);
|
|
15054
|
-
|
|
15930
|
+
React49.useEffect(() => {
|
|
15055
15931
|
setThreadGoal(stream.threadGoal);
|
|
15056
15932
|
}, [stream.threadGoal]);
|
|
15057
|
-
|
|
15933
|
+
React49.useEffect(() => {
|
|
15058
15934
|
const threadId = stream.threadId?.trim();
|
|
15059
15935
|
if (!threadId || !goalCommandAvailable) {
|
|
15060
15936
|
setThreadGoal(null);
|
|
@@ -15095,7 +15971,7 @@ function Chat({
|
|
|
15095
15971
|
return () => controller.abort();
|
|
15096
15972
|
}, [goalAdapter, goalCommandAvailable, stream.threadId]);
|
|
15097
15973
|
const uploadedFiles = attachmentState.uploadedFiles;
|
|
15098
|
-
const handleSessionRuntimeCapabilityToggle =
|
|
15974
|
+
const handleSessionRuntimeCapabilityToggle = React49.useCallback(
|
|
15099
15975
|
(type, id, selected) => {
|
|
15100
15976
|
setSessionRuntimeCapabilities((previous) => {
|
|
15101
15977
|
const nextSelection = toggleRuntimeCapabilitySelection(
|
|
@@ -15113,7 +15989,7 @@ function Chat({
|
|
|
15113
15989
|
},
|
|
15114
15990
|
[persistSessionRuntimeCapabilities, stream.threadId]
|
|
15115
15991
|
);
|
|
15116
|
-
const updateRuntimeCapabilityPalette =
|
|
15992
|
+
const updateRuntimeCapabilityPalette = React49.useCallback(
|
|
15117
15993
|
(parts, selectionStart) => {
|
|
15118
15994
|
const input = composerInputRef.current;
|
|
15119
15995
|
const editingText = getComposerEditingText(parts);
|
|
@@ -15125,7 +16001,7 @@ function Chat({
|
|
|
15125
16001
|
},
|
|
15126
16002
|
[]
|
|
15127
16003
|
);
|
|
15128
|
-
const syncComposerInputFromElement =
|
|
16004
|
+
const syncComposerInputFromElement = React49.useCallback(
|
|
15129
16005
|
(input) => {
|
|
15130
16006
|
const previousCapabilities = getComposerCapabilityPartMap(
|
|
15131
16007
|
composerPartsRef.current
|
|
@@ -15143,25 +16019,25 @@ function Chat({
|
|
|
15143
16019
|
},
|
|
15144
16020
|
[commitComposerParts, updateRuntimeCapabilityPalette]
|
|
15145
16021
|
);
|
|
15146
|
-
const handleComposerInput =
|
|
16022
|
+
const handleComposerInput = React49.useCallback(
|
|
15147
16023
|
(event) => {
|
|
15148
16024
|
syncComposerInputFromElement(event.currentTarget);
|
|
15149
16025
|
},
|
|
15150
16026
|
[syncComposerInputFromElement]
|
|
15151
16027
|
);
|
|
15152
|
-
const handleComposerCompositionEnd =
|
|
16028
|
+
const handleComposerCompositionEnd = React49.useCallback(
|
|
15153
16029
|
(event) => {
|
|
15154
16030
|
syncComposerInputFromElement(event.currentTarget);
|
|
15155
16031
|
},
|
|
15156
16032
|
[syncComposerInputFromElement]
|
|
15157
16033
|
);
|
|
15158
|
-
const handleComposerSelect =
|
|
16034
|
+
const handleComposerSelect = React49.useCallback(() => {
|
|
15159
16035
|
updateRuntimeCapabilityPalette(
|
|
15160
16036
|
composerPartsRef.current,
|
|
15161
16037
|
composerInputRef.current ? getComposerSelectionOffset(composerInputRef.current) : void 0
|
|
15162
16038
|
);
|
|
15163
16039
|
}, [updateRuntimeCapabilityPalette]);
|
|
15164
|
-
const removeRunRuntimeCapability =
|
|
16040
|
+
const removeRunRuntimeCapability = React49.useCallback(
|
|
15165
16041
|
(option) => {
|
|
15166
16042
|
setRunRuntimeCapabilities(
|
|
15167
16043
|
(previous) => toggleRuntimeCapabilitySelection(
|
|
@@ -15181,9 +16057,9 @@ function Chat({
|
|
|
15181
16057
|
},
|
|
15182
16058
|
[commitComposerParts]
|
|
15183
16059
|
);
|
|
15184
|
-
const submitDraft =
|
|
16060
|
+
const submitDraft = React49.useCallback(
|
|
15185
16061
|
(submitOptions = {}) => {
|
|
15186
|
-
if (
|
|
16062
|
+
if (isSubmissionBlocked) return;
|
|
15187
16063
|
const contentToSubmit = (submitOptions.inputText ?? trimmedDraft).trim();
|
|
15188
16064
|
const filesToSend = uploadedFiles.length > 0 ? [...uploadedFiles] : void 0;
|
|
15189
16065
|
const referencesToSend = references.length > 0 ? [...references] : void 0;
|
|
@@ -15286,7 +16162,7 @@ function Chat({
|
|
|
15286
16162
|
},
|
|
15287
16163
|
[
|
|
15288
16164
|
effectiveSessionRuntimeCapabilities,
|
|
15289
|
-
|
|
16165
|
+
isSubmissionBlocked,
|
|
15290
16166
|
options?.request,
|
|
15291
16167
|
persistSessionRuntimeCapabilities,
|
|
15292
16168
|
references,
|
|
@@ -15304,7 +16180,7 @@ function Chat({
|
|
|
15304
16180
|
t
|
|
15305
16181
|
]
|
|
15306
16182
|
);
|
|
15307
|
-
const handleGoalCommand =
|
|
16183
|
+
const handleGoalCommand = React49.useCallback(
|
|
15308
16184
|
async ({
|
|
15309
16185
|
args,
|
|
15310
16186
|
commandSource,
|
|
@@ -15416,13 +16292,13 @@ function Chat({
|
|
|
15416
16292
|
t
|
|
15417
16293
|
]
|
|
15418
16294
|
);
|
|
15419
|
-
const handleGoalPanelOpenChange =
|
|
16295
|
+
const handleGoalPanelOpenChange = React49.useCallback(
|
|
15420
16296
|
(open) => {
|
|
15421
16297
|
setIsGoalPanelOpen(open);
|
|
15422
16298
|
},
|
|
15423
16299
|
[]
|
|
15424
16300
|
);
|
|
15425
|
-
const addRunRuntimeCapabilities =
|
|
16301
|
+
const addRunRuntimeCapabilities = React49.useCallback(
|
|
15426
16302
|
(selection) => {
|
|
15427
16303
|
setRunRuntimeCapabilities(
|
|
15428
16304
|
(previous) => runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
@@ -15434,7 +16310,7 @@ function Chat({
|
|
|
15434
16310
|
},
|
|
15435
16311
|
[runtimeCapabilities]
|
|
15436
16312
|
);
|
|
15437
|
-
const insertComposerCapabilityToken =
|
|
16313
|
+
const insertComposerCapabilityToken = React49.useCallback(
|
|
15438
16314
|
(capability, range) => {
|
|
15439
16315
|
const token = createComposerCapabilityPart(capability, createMessageId());
|
|
15440
16316
|
const currentParts = composerPartsRef.current;
|
|
@@ -15507,7 +16383,7 @@ function Chat({
|
|
|
15507
16383
|
plugin: t("composer.slashCommands.empty.loadingCapabilities"),
|
|
15508
16384
|
subAgent: t("composer.slashCommands.empty.loadingCapabilities")
|
|
15509
16385
|
};
|
|
15510
|
-
|
|
16386
|
+
React49.useEffect(() => {
|
|
15511
16387
|
if (!runtimeCapabilityPalette) {
|
|
15512
16388
|
return;
|
|
15513
16389
|
}
|
|
@@ -15526,7 +16402,7 @@ function Chat({
|
|
|
15526
16402
|
);
|
|
15527
16403
|
}
|
|
15528
16404
|
}, [slashPaletteOptions.length, runtimeCapabilityPalette]);
|
|
15529
|
-
|
|
16405
|
+
React49.useLayoutEffect(() => {
|
|
15530
16406
|
if (!runtimeCapabilityPalette) {
|
|
15531
16407
|
return;
|
|
15532
16408
|
}
|
|
@@ -15543,7 +16419,7 @@ function Chat({
|
|
|
15543
16419
|
container.scrollTop += optionRect.bottom - containerRect.bottom;
|
|
15544
16420
|
}
|
|
15545
16421
|
}, [runtimeCapabilityPalette, slashPaletteOptions.length]);
|
|
15546
|
-
const submitGoalModeDraft =
|
|
16422
|
+
const submitGoalModeDraft = React49.useCallback(() => {
|
|
15547
16423
|
const objective = getComposerPlainText(composerPartsRef.current).trim();
|
|
15548
16424
|
if (!isGoalModeOpen || !goalCommandAvailable || !objective) {
|
|
15549
16425
|
return false;
|
|
@@ -15581,7 +16457,7 @@ function Chat({
|
|
|
15581
16457
|
}
|
|
15582
16458
|
submitDraft();
|
|
15583
16459
|
};
|
|
15584
|
-
const handleEditPendingFollowUp =
|
|
16460
|
+
const handleEditPendingFollowUp = React49.useCallback(
|
|
15585
16461
|
(id) => {
|
|
15586
16462
|
const item = pendingFollowUps.find(
|
|
15587
16463
|
(entry) => entry.id === id && entry.mode === "queue"
|
|
@@ -15608,7 +16484,7 @@ function Chat({
|
|
|
15608
16484
|
},
|
|
15609
16485
|
[pendingFollowUps, setComposerText, stream]
|
|
15610
16486
|
);
|
|
15611
|
-
const handleQuoteSelection =
|
|
16487
|
+
const handleQuoteSelection = React49.useCallback(() => {
|
|
15612
16488
|
if (!quoteSelection) {
|
|
15613
16489
|
return;
|
|
15614
16490
|
}
|
|
@@ -15624,7 +16500,7 @@ function Chat({
|
|
|
15624
16500
|
const handleAttachmentClick = () => {
|
|
15625
16501
|
attachmentsRef.current?.openFilePicker();
|
|
15626
16502
|
};
|
|
15627
|
-
const uploadContextFile =
|
|
16503
|
+
const uploadContextFile = React49.useCallback(
|
|
15628
16504
|
(file) => {
|
|
15629
16505
|
const formData = new FormData();
|
|
15630
16506
|
formData.append("file", file, file.name || "upload");
|
|
@@ -15643,13 +16519,13 @@ function Chat({
|
|
|
15643
16519
|
},
|
|
15644
16520
|
[stream.assistantId, stream.client, stream.threadId]
|
|
15645
16521
|
);
|
|
15646
|
-
const getContextFileStatus =
|
|
16522
|
+
const getContextFileStatus = React49.useCallback(
|
|
15647
16523
|
(fileId) => stream.client.contexts.fetch(`/files/${fileId}/status`, {
|
|
15648
16524
|
method: "GET"
|
|
15649
16525
|
}),
|
|
15650
16526
|
[stream.client]
|
|
15651
16527
|
);
|
|
15652
|
-
const deleteContextFile =
|
|
16528
|
+
const deleteContextFile = React49.useCallback(
|
|
15653
16529
|
(storageFileId) => stream.client.contexts.deleteFile(storageFileId),
|
|
15654
16530
|
[stream.client]
|
|
15655
16531
|
);
|
|
@@ -15757,7 +16633,7 @@ function Chat({
|
|
|
15757
16633
|
}
|
|
15758
16634
|
submitDraft();
|
|
15759
16635
|
};
|
|
15760
|
-
const handleComposerPaste =
|
|
16636
|
+
const handleComposerPaste = React49.useCallback(
|
|
15761
16637
|
(event) => {
|
|
15762
16638
|
const clipboardData = event.clipboardData;
|
|
15763
16639
|
if (!clipboardData) {
|
|
@@ -15859,51 +16735,22 @@ function Chat({
|
|
|
15859
16735
|
const handleToolSelect = (tool) => {
|
|
15860
16736
|
setSelectedTool((prev) => prev?.id === tool.id ? null : tool);
|
|
15861
16737
|
};
|
|
15862
|
-
const handlePromptClick = (
|
|
15863
|
-
|
|
15864
|
-
|
|
15865
|
-
|
|
15866
|
-
|
|
15867
|
-
|
|
15868
|
-
|
|
15869
|
-
|
|
15870
|
-
|
|
15871
|
-
|
|
15872
|
-
|
|
15873
|
-
|
|
15874
|
-
}
|
|
15875
|
-
|
|
15876
|
-
|
|
15877
|
-
|
|
15878
|
-
});
|
|
15879
|
-
const sessionRuntimeCapabilitiesForPersistence = effectiveSessionRuntimeCapabilities;
|
|
15880
|
-
const shouldPersistSessionRuntimeCapabilities = !!sessionRuntimeCapabilitiesForPersistence && !stream.threadId && !nextFollowUpMode;
|
|
15881
|
-
stream.submit(
|
|
15882
|
-
{
|
|
15883
|
-
input: inputPayload,
|
|
15884
|
-
...requestOptions.state ? { state: requestOptions.state } : {}
|
|
15885
|
-
},
|
|
15886
|
-
{
|
|
15887
|
-
...nextFollowUpMode ? { followUpMode: nextFollowUpMode } : {},
|
|
15888
|
-
...requestOptions.context ? { context: requestOptions.context } : {},
|
|
15889
|
-
...requestOptions.config ? { config: requestOptions.config } : {},
|
|
15890
|
-
...shouldPersistSessionRuntimeCapabilities ? {
|
|
15891
|
-
onThreadResolved: (threadId) => persistSessionRuntimeCapabilities(
|
|
15892
|
-
threadId,
|
|
15893
|
-
sessionRuntimeCapabilitiesForPersistence
|
|
15894
|
-
)
|
|
15895
|
-
} : {},
|
|
15896
|
-
...!nextFollowUpMode ? {
|
|
15897
|
-
optimisticValues: (prev) => {
|
|
15898
|
-
const prevMessages = prev?.messages ?? [];
|
|
15899
|
-
return { ...prev, messages: [...prevMessages, newMessage] };
|
|
15900
|
-
}
|
|
15901
|
-
} : {}
|
|
15902
|
-
}
|
|
15903
|
-
);
|
|
15904
|
-
scrollToBottom(true, true);
|
|
15905
|
-
};
|
|
15906
|
-
const loadConversationMessages = React48.useCallback(
|
|
16738
|
+
const handlePromptClick = React49.useCallback(
|
|
16739
|
+
(prompt) => {
|
|
16740
|
+
submitDraft({ inputText: prompt, displayText: prompt });
|
|
16741
|
+
},
|
|
16742
|
+
[submitDraft]
|
|
16743
|
+
);
|
|
16744
|
+
const handlePromptEdit = React49.useCallback(
|
|
16745
|
+
(prompt) => {
|
|
16746
|
+
if (isPromptEditDisabled) return;
|
|
16747
|
+
setComposerText(prompt, prompt.length);
|
|
16748
|
+
setRuntimeCapabilityPalette(null);
|
|
16749
|
+
focusComposerAt(prompt.length);
|
|
16750
|
+
},
|
|
16751
|
+
[focusComposerAt, isPromptEditDisabled, setComposerText]
|
|
16752
|
+
);
|
|
16753
|
+
const loadConversationMessages = React49.useCallback(
|
|
15907
16754
|
async (recordId) => {
|
|
15908
16755
|
if (missingConfig) {
|
|
15909
16756
|
setHistoryError(missingConfigShortMessage);
|
|
@@ -15924,7 +16771,7 @@ function Chat({
|
|
|
15924
16771
|
},
|
|
15925
16772
|
[missingConfig, missingConfigShortMessage, stream, t]
|
|
15926
16773
|
);
|
|
15927
|
-
const handleLoadMoreMessages =
|
|
16774
|
+
const handleLoadMoreMessages = React49.useCallback(async () => {
|
|
15928
16775
|
if (!canLoadMoreMessages || isLoadingMoreMessages) {
|
|
15929
16776
|
return;
|
|
15930
16777
|
}
|
|
@@ -16033,15 +16880,15 @@ function Chat({
|
|
|
16033
16880
|
};
|
|
16034
16881
|
const acceptMimes = composer?.attachments?.accept ? Object.entries(composer.attachments.accept).map(([mime, exts]) => [mime, ...exts.map((e) => `.${e}`)].join(",")).join(",") : void 0;
|
|
16035
16882
|
const canUploadDroppedFiles = composer?.attachments?.enabled === true && !missingConfig && !isHistoryLoading && !hasPendingInteractiveRequest;
|
|
16036
|
-
const handleDroppedFiles =
|
|
16883
|
+
const handleDroppedFiles = React49.useCallback((files) => {
|
|
16037
16884
|
return attachmentsRef.current?.queueFiles(files) ?? false;
|
|
16038
16885
|
}, []);
|
|
16039
|
-
const currentThread =
|
|
16886
|
+
const currentThread = React49.useMemo(
|
|
16040
16887
|
() => threads.find((item) => item.id === stream.threadId),
|
|
16041
16888
|
[threads, stream.threadId]
|
|
16042
16889
|
);
|
|
16043
16890
|
const streamErrorMessage = stream.error instanceof Error ? stream.error.message : void 0;
|
|
16044
|
-
const threadErrorMessage =
|
|
16891
|
+
const threadErrorMessage = React49.useMemo(() => {
|
|
16045
16892
|
if (streamErrorMessage?.trim()) return streamErrorMessage.trim();
|
|
16046
16893
|
if (currentThread?.status !== "error") return void 0;
|
|
16047
16894
|
const message = currentThread.error?.trim();
|
|
@@ -16072,7 +16919,7 @@ function Chat({
|
|
|
16072
16919
|
fallbackTitle: t("history.threadFallback")
|
|
16073
16920
|
});
|
|
16074
16921
|
const assistantTitle = assistantName || resolvedTitle;
|
|
16075
|
-
return /* @__PURE__ */ (0,
|
|
16922
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16076
16923
|
UploadDroppedFiles,
|
|
16077
16924
|
{
|
|
16078
16925
|
ref: viewportRef,
|
|
@@ -16087,10 +16934,10 @@ function Chat({
|
|
|
16087
16934
|
className
|
|
16088
16935
|
),
|
|
16089
16936
|
children: [
|
|
16090
|
-
/* @__PURE__ */ (0,
|
|
16091
|
-
/* @__PURE__ */ (0,
|
|
16092
|
-
/* @__PURE__ */ (0,
|
|
16093
|
-
/* @__PURE__ */ (0,
|
|
16937
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between border-b p-2 sticky top-0 z-10 bg-background", children: [
|
|
16938
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-3 overflow-hidden", children: [
|
|
16939
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "relative shrink-0", children: [
|
|
16940
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16094
16941
|
ChatkitAvatar,
|
|
16095
16942
|
{
|
|
16096
16943
|
avatar: assistantAvatar,
|
|
@@ -16098,10 +16945,10 @@ function Chat({
|
|
|
16098
16945
|
label: assistantTitle
|
|
16099
16946
|
}
|
|
16100
16947
|
),
|
|
16101
|
-
/* @__PURE__ */ (0,
|
|
16948
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-green-500" })
|
|
16102
16949
|
] }),
|
|
16103
|
-
/* @__PURE__ */ (0,
|
|
16104
|
-
/* @__PURE__ */ (0,
|
|
16950
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "truncate", children: [
|
|
16951
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16105
16952
|
"h2",
|
|
16106
16953
|
{
|
|
16107
16954
|
className: "text-lg font-semibold truncate",
|
|
@@ -16109,12 +16956,12 @@ function Chat({
|
|
|
16109
16956
|
children: assistantTitle
|
|
16110
16957
|
}
|
|
16111
16958
|
),
|
|
16112
|
-
/* @__PURE__ */ (0,
|
|
16959
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "text-xs text-muted-foreground", children: t("chat.statusOnline") })
|
|
16113
16960
|
] })
|
|
16114
16961
|
] }),
|
|
16115
|
-
/* @__PURE__ */ (0,
|
|
16116
|
-
canMinimizeToPet && /* @__PURE__ */ (0,
|
|
16117
|
-
/* @__PURE__ */ (0,
|
|
16962
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
16963
|
+
canMinimizeToPet && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
16964
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16118
16965
|
"button",
|
|
16119
16966
|
{
|
|
16120
16967
|
type: "button",
|
|
@@ -16125,13 +16972,13 @@ function Chat({
|
|
|
16125
16972
|
"transition-colors duration-150"
|
|
16126
16973
|
),
|
|
16127
16974
|
"aria-label": t("chat.minimizeToPet"),
|
|
16128
|
-
children: /* @__PURE__ */ (0,
|
|
16975
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Minus, { size: 16 })
|
|
16129
16976
|
}
|
|
16130
16977
|
) }) }),
|
|
16131
|
-
/* @__PURE__ */ (0,
|
|
16978
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { side: "bottom", children: t("chat.minimizeToPet") })
|
|
16132
16979
|
] }),
|
|
16133
|
-
/* @__PURE__ */ (0,
|
|
16134
|
-
/* @__PURE__ */ (0,
|
|
16980
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
16981
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16135
16982
|
"button",
|
|
16136
16983
|
{
|
|
16137
16984
|
type: "button",
|
|
@@ -16142,14 +16989,14 @@ function Chat({
|
|
|
16142
16989
|
"transition-colors duration-150"
|
|
16143
16990
|
),
|
|
16144
16991
|
"aria-label": t("settings.open"),
|
|
16145
|
-
children: /* @__PURE__ */ (0,
|
|
16992
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Settings, { size: 16 })
|
|
16146
16993
|
}
|
|
16147
16994
|
) }) }),
|
|
16148
|
-
/* @__PURE__ */ (0,
|
|
16995
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { side: "bottom", children: t("settings.open") })
|
|
16149
16996
|
] }),
|
|
16150
|
-
history?.enabled !== false && /* @__PURE__ */ (0,
|
|
16151
|
-
/* @__PURE__ */ (0,
|
|
16152
|
-
/* @__PURE__ */ (0,
|
|
16997
|
+
history?.enabled !== false && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
16998
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
16999
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16153
17000
|
"button",
|
|
16154
17001
|
{
|
|
16155
17002
|
type: "button",
|
|
@@ -16162,12 +17009,12 @@ function Chat({
|
|
|
16162
17009
|
"disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed"
|
|
16163
17010
|
),
|
|
16164
17011
|
"aria-label": t("history.newThread"),
|
|
16165
|
-
children: /* @__PURE__ */ (0,
|
|
17012
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Pencil, { size: 16 })
|
|
16166
17013
|
}
|
|
16167
17014
|
) }) }),
|
|
16168
|
-
/* @__PURE__ */ (0,
|
|
17015
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { side: "bottom", children: t("history.newThread") })
|
|
16169
17016
|
] }),
|
|
16170
|
-
/* @__PURE__ */ (0,
|
|
17017
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16171
17018
|
HistorySidebar,
|
|
16172
17019
|
{
|
|
16173
17020
|
threads,
|
|
@@ -16182,21 +17029,24 @@ function Chat({
|
|
|
16182
17029
|
] })
|
|
16183
17030
|
] })
|
|
16184
17031
|
] }),
|
|
16185
|
-
/* @__PURE__ */ (0,
|
|
16186
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
16187
|
-
historyError && /* @__PURE__ */ (0,
|
|
16188
|
-
showMissingConfig && /* @__PURE__ */ (0,
|
|
16189
|
-
isHistoryLoading && /* @__PURE__ */ (0,
|
|
16190
|
-
messages.length === 0 && !canLoadMoreMessages ? /* @__PURE__ */ (0,
|
|
17032
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex-1 p-4", children: [
|
|
17033
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: errorMessage }),
|
|
17034
|
+
historyError && /* @__PURE__ */ (0, import_jsx_runtime54.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 }),
|
|
17035
|
+
showMissingConfig && /* @__PURE__ */ (0, import_jsx_runtime54.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 }),
|
|
17036
|
+
isHistoryLoading && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mb-4 rounded-lg border border-muted px-3 py-2 text-sm text-muted-foreground", children: t("chat.loadingThread") }),
|
|
17037
|
+
messages.length === 0 && !canLoadMoreMessages ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16191
17038
|
StartScreen,
|
|
16192
17039
|
{
|
|
16193
17040
|
startScreen,
|
|
16194
|
-
onPromptClick: handlePromptClick
|
|
17041
|
+
onPromptClick: handlePromptClick,
|
|
17042
|
+
onPromptEdit: handlePromptEdit,
|
|
17043
|
+
promptSendDisabled: isSubmissionBlocked,
|
|
17044
|
+
promptEditDisabled: isPromptEditDisabled
|
|
16195
17045
|
}
|
|
16196
|
-
) : /* @__PURE__ */ (0,
|
|
16197
|
-
canLoadMoreMessages && /* @__PURE__ */ (0,
|
|
16198
|
-
/* @__PURE__ */ (0,
|
|
16199
|
-
/* @__PURE__ */ (0,
|
|
17046
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "space-y-4", children: [
|
|
17047
|
+
canLoadMoreMessages && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-3 py-1", children: [
|
|
17048
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "h-px min-w-8 flex-1 bg-border" }),
|
|
17049
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16200
17050
|
Button,
|
|
16201
17051
|
{
|
|
16202
17052
|
type: "button",
|
|
@@ -16208,7 +17058,7 @@ function Chat({
|
|
|
16208
17058
|
children: isLoadingMoreMessages ? t("chat.loadingMoreMessages") : t("chat.loadMoreMessages")
|
|
16209
17059
|
}
|
|
16210
17060
|
),
|
|
16211
|
-
/* @__PURE__ */ (0,
|
|
17061
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "h-px min-w-8 flex-1 bg-border" })
|
|
16212
17062
|
] }),
|
|
16213
17063
|
messages.map((message, index) => {
|
|
16214
17064
|
const messageType = String(message.type);
|
|
@@ -16245,7 +17095,7 @@ function Chat({
|
|
|
16245
17095
|
if (!isAssistantMessage && !hasPlainRenderableContent && !hasHumanAttachments && humanRuntimeCapabilityOptions.length === 0 && humanReferences.length === 0) {
|
|
16246
17096
|
return null;
|
|
16247
17097
|
}
|
|
16248
|
-
return /* @__PURE__ */ (0,
|
|
17098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16249
17099
|
"div",
|
|
16250
17100
|
{
|
|
16251
17101
|
className: cn(
|
|
@@ -16253,7 +17103,7 @@ function Chat({
|
|
|
16253
17103
|
message.type === "human" ? "justify-end" : "justify-start -ml-1"
|
|
16254
17104
|
// AI messages: slightly closer to left
|
|
16255
17105
|
),
|
|
16256
|
-
children: /* @__PURE__ */ (0,
|
|
17106
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16257
17107
|
"div",
|
|
16258
17108
|
{
|
|
16259
17109
|
className: cn(
|
|
@@ -16261,7 +17111,7 @@ function Chat({
|
|
|
16261
17111
|
isAssistantMessage && "min-w-0 flex-1"
|
|
16262
17112
|
),
|
|
16263
17113
|
children: [
|
|
16264
|
-
/* @__PURE__ */ (0,
|
|
17114
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16265
17115
|
"div",
|
|
16266
17116
|
{
|
|
16267
17117
|
...canQuoteMessage ? {
|
|
@@ -16273,7 +17123,7 @@ function Chat({
|
|
|
16273
17123
|
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"
|
|
16274
17124
|
// AI messages: use chat-specific foreground color
|
|
16275
17125
|
),
|
|
16276
|
-
children: isAssistantMessage ? /* @__PURE__ */ (0,
|
|
17126
|
+
children: isAssistantMessage ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16277
17127
|
AssistantMessage,
|
|
16278
17128
|
{
|
|
16279
17129
|
message: {
|
|
@@ -16292,25 +17142,25 @@ function Chat({
|
|
|
16292
17142
|
organizationId: stream.organizationId,
|
|
16293
17143
|
apiUrl: stream.apiUrl
|
|
16294
17144
|
}
|
|
16295
|
-
) : /* @__PURE__ */ (0,
|
|
16296
|
-
message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0,
|
|
17145
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
17146
|
+
message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16297
17147
|
"span",
|
|
16298
17148
|
{
|
|
16299
17149
|
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",
|
|
16300
17150
|
children: [
|
|
16301
|
-
/* @__PURE__ */ (0,
|
|
17151
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16302
17152
|
RuntimeCapabilityIcon,
|
|
16303
17153
|
{
|
|
16304
17154
|
option,
|
|
16305
17155
|
variant: "chip"
|
|
16306
17156
|
}
|
|
16307
17157
|
),
|
|
16308
|
-
/* @__PURE__ */ (0,
|
|
17158
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "max-w-[9rem] truncate", children: option.label })
|
|
16309
17159
|
]
|
|
16310
17160
|
},
|
|
16311
17161
|
`${option.type}:${option.id}`
|
|
16312
17162
|
)) }),
|
|
16313
|
-
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ (0,
|
|
17163
|
+
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanReferences.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16314
17164
|
ReferenceChip,
|
|
16315
17165
|
{
|
|
16316
17166
|
reference,
|
|
@@ -16318,29 +17168,29 @@ function Chat({
|
|
|
16318
17168
|
},
|
|
16319
17169
|
getReferenceKey(reference)
|
|
16320
17170
|
)) }),
|
|
16321
|
-
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ (0,
|
|
17171
|
+
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "flex flex-wrap gap-1.5 mb-2", children: humanAttachments.map((file, fileIndex) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16322
17172
|
"div",
|
|
16323
17173
|
{
|
|
16324
17174
|
className: "flex items-center gap-1.5 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs",
|
|
16325
17175
|
children: [
|
|
16326
|
-
/* @__PURE__ */ (0,
|
|
16327
|
-
/* @__PURE__ */ (0,
|
|
17176
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.FileText, { size: 12 }),
|
|
17177
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "max-w-[100px] truncate", children: file.originalName ?? file.id })
|
|
16328
17178
|
]
|
|
16329
17179
|
},
|
|
16330
17180
|
fileIndex
|
|
16331
17181
|
)) }),
|
|
16332
|
-
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ (0,
|
|
17182
|
+
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16333
17183
|
"p",
|
|
16334
17184
|
{
|
|
16335
17185
|
className: "wrap-break-word text-sm leading-relaxed",
|
|
16336
17186
|
children: formatMessageContent(part)
|
|
16337
17187
|
},
|
|
16338
17188
|
`${part.type}-${partIndex}`
|
|
16339
|
-
)) : /* @__PURE__ */ (0,
|
|
17189
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "wrap-break-word text-sm leading-relaxed", children: formatMessageContent(message.content) })
|
|
16340
17190
|
] })
|
|
16341
17191
|
}
|
|
16342
17192
|
),
|
|
16343
|
-
/* @__PURE__ */ (0,
|
|
17193
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16344
17194
|
MessageActions,
|
|
16345
17195
|
{
|
|
16346
17196
|
content: messageContent,
|
|
@@ -16378,7 +17228,7 @@ function Chat({
|
|
|
16378
17228
|
stream.isLoading,
|
|
16379
17229
|
{ now: streamingNow }
|
|
16380
17230
|
);
|
|
16381
|
-
return /* @__PURE__ */ (0,
|
|
17231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "flex justify-start gap-3 -ml-2", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "max-w-full rounded-2xl py-2.5", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16382
17232
|
AssistantStreamingIndicator,
|
|
16383
17233
|
{
|
|
16384
17234
|
status: fallbackStreamingStatus ?? "loading"
|
|
@@ -16387,7 +17237,7 @@ function Chat({
|
|
|
16387
17237
|
})()
|
|
16388
17238
|
] })
|
|
16389
17239
|
] }),
|
|
16390
|
-
!isAtBottom && messages.length > 0 && /* @__PURE__ */ (0,
|
|
17240
|
+
!isAtBottom && messages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "sticky bottom-20 z-20 flex justify-center px-4 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16391
17241
|
Button,
|
|
16392
17242
|
{
|
|
16393
17243
|
type: "button",
|
|
@@ -16400,10 +17250,10 @@ function Chat({
|
|
|
16400
17250
|
onClick: () => scrollToBottom(true, true),
|
|
16401
17251
|
"aria-label": t("chat.scrollToBottom"),
|
|
16402
17252
|
title: t("chat.scrollToBottom"),
|
|
16403
|
-
children: /* @__PURE__ */ (0,
|
|
17253
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.ArrowDown, { size: 16 })
|
|
16404
17254
|
}
|
|
16405
17255
|
) }),
|
|
16406
|
-
quoteSelection && /* @__PURE__ */ (0,
|
|
17256
|
+
quoteSelection && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16407
17257
|
"div",
|
|
16408
17258
|
{
|
|
16409
17259
|
className: "pointer-events-none fixed z-50",
|
|
@@ -16412,7 +17262,7 @@ function Chat({
|
|
|
16412
17262
|
left: `${quoteSelection.left}px`,
|
|
16413
17263
|
transform: "translateX(-50%)"
|
|
16414
17264
|
},
|
|
16415
|
-
children: /* @__PURE__ */ (0,
|
|
17265
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16416
17266
|
Button,
|
|
16417
17267
|
{
|
|
16418
17268
|
type: "button",
|
|
@@ -16424,16 +17274,16 @@ function Chat({
|
|
|
16424
17274
|
"aria-label": t("composer.quoteSelection"),
|
|
16425
17275
|
title: t("composer.quoteSelection"),
|
|
16426
17276
|
children: [
|
|
16427
|
-
/* @__PURE__ */ (0,
|
|
17277
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Quote, { size: 14 }),
|
|
16428
17278
|
t("composer.quoteSelection")
|
|
16429
17279
|
]
|
|
16430
17280
|
}
|
|
16431
17281
|
)
|
|
16432
17282
|
}
|
|
16433
17283
|
),
|
|
16434
|
-
/* @__PURE__ */ (0,
|
|
16435
|
-
threadErrorMessage && /* @__PURE__ */ (0,
|
|
16436
|
-
/* @__PURE__ */ (0,
|
|
17284
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "p-2 sticky bottom-0 z-10 bg-background", children: [
|
|
17285
|
+
threadErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime54.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 }),
|
|
17286
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16437
17287
|
ChatAttachments,
|
|
16438
17288
|
{
|
|
16439
17289
|
ref: attachmentsRef,
|
|
@@ -16447,7 +17297,7 @@ function Chat({
|
|
|
16447
17297
|
onStateChange: setAttachmentState
|
|
16448
17298
|
}
|
|
16449
17299
|
),
|
|
16450
|
-
references.length > 0 && /* @__PURE__ */ (0,
|
|
17300
|
+
references.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mb-3 flex flex-wrap gap-2", children: references.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16451
17301
|
ReferenceChip,
|
|
16452
17302
|
{
|
|
16453
17303
|
reference,
|
|
@@ -16461,16 +17311,16 @@ function Chat({
|
|
|
16461
17311
|
},
|
|
16462
17312
|
getReferenceKey(reference)
|
|
16463
17313
|
)) }),
|
|
16464
|
-
detachedRunRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0,
|
|
16465
|
-
/* @__PURE__ */ (0,
|
|
16466
|
-
detachedRunRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ (0,
|
|
17314
|
+
detachedRunRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "mb-2 flex flex-wrap items-center gap-2", children: [
|
|
17315
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-xs text-muted-foreground", children: t("composer.capabilities.runOnly") }),
|
|
17316
|
+
detachedRunRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16467
17317
|
"span",
|
|
16468
17318
|
{
|
|
16469
17319
|
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",
|
|
16470
17320
|
children: [
|
|
16471
|
-
/* @__PURE__ */ (0,
|
|
16472
|
-
/* @__PURE__ */ (0,
|
|
16473
|
-
/* @__PURE__ */ (0,
|
|
17321
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RuntimeCapabilityIcon, { option, variant: "chip" }),
|
|
17322
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "max-w-40 truncate", children: option.label }),
|
|
17323
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16474
17324
|
"button",
|
|
16475
17325
|
{
|
|
16476
17326
|
type: "button",
|
|
@@ -16478,7 +17328,7 @@ function Chat({
|
|
|
16478
17328
|
className: "rounded-full p-0.5 hover:bg-primary/15",
|
|
16479
17329
|
title: t("composer.capabilities.removeRunCapability"),
|
|
16480
17330
|
"aria-label": t("composer.capabilities.removeRunCapability"),
|
|
16481
|
-
children: /* @__PURE__ */ (0,
|
|
17331
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.X, { size: 11 })
|
|
16482
17332
|
}
|
|
16483
17333
|
)
|
|
16484
17334
|
]
|
|
@@ -16486,7 +17336,7 @@ function Chat({
|
|
|
16486
17336
|
`${option.type}:${option.id}`
|
|
16487
17337
|
))
|
|
16488
17338
|
] }),
|
|
16489
|
-
showGoalStatus && /* @__PURE__ */ (0,
|
|
17339
|
+
showGoalStatus && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16490
17340
|
"div",
|
|
16491
17341
|
{
|
|
16492
17342
|
className: cn(
|
|
@@ -16494,8 +17344,8 @@ function Chat({
|
|
|
16494
17344
|
isGoalObjectiveExpanded ? "items-start" : "items-center"
|
|
16495
17345
|
),
|
|
16496
17346
|
children: [
|
|
16497
|
-
/* @__PURE__ */ (0,
|
|
16498
|
-
|
|
17347
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
17348
|
+
import_lucide_react29.Target,
|
|
16499
17349
|
{
|
|
16500
17350
|
className: cn(
|
|
16501
17351
|
"size-4 shrink-0 text-muted-foreground",
|
|
@@ -16503,13 +17353,13 @@ function Chat({
|
|
|
16503
17353
|
)
|
|
16504
17354
|
}
|
|
16505
17355
|
),
|
|
16506
|
-
/* @__PURE__ */ (0,
|
|
16507
|
-
/* @__PURE__ */ (0,
|
|
16508
|
-
/* @__PURE__ */ (0,
|
|
16509
|
-
threadGoal && /* @__PURE__ */ (0,
|
|
16510
|
-
isGoalLoading && /* @__PURE__ */ (0,
|
|
17356
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
17357
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
17358
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "font-medium", children: t("chat.goal.label") }),
|
|
17359
|
+
threadGoal && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "shrink-0 rounded-md bg-muted px-1.5 py-0.5 text-[11px] text-muted-foreground", children: t(`chat.goal.status.${threadGoal.status}`) }),
|
|
17360
|
+
isGoalLoading && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Loader2, { className: "size-3 animate-spin text-muted-foreground" })
|
|
16511
17361
|
] }),
|
|
16512
|
-
/* @__PURE__ */ (0,
|
|
17362
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16513
17363
|
"div",
|
|
16514
17364
|
{
|
|
16515
17365
|
className: cn(
|
|
@@ -16519,13 +17369,13 @@ function Chat({
|
|
|
16519
17369
|
children: goalError || threadGoal?.objective
|
|
16520
17370
|
}
|
|
16521
17371
|
),
|
|
16522
|
-
threadGoal && /* @__PURE__ */ (0,
|
|
17372
|
+
threadGoal && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: t("chat.goal.elapsed", {
|
|
16523
17373
|
elapsed: formatGoalElapsed(displayedGoalElapsedSeconds)
|
|
16524
17374
|
}) }) })
|
|
16525
17375
|
] }),
|
|
16526
|
-
threadGoal && /* @__PURE__ */ (0,
|
|
16527
|
-
/* @__PURE__ */ (0,
|
|
16528
|
-
/* @__PURE__ */ (0,
|
|
17376
|
+
threadGoal && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
17377
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
17378
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16529
17379
|
Button,
|
|
16530
17380
|
{
|
|
16531
17381
|
type: "button",
|
|
@@ -16536,13 +17386,13 @@ function Chat({
|
|
|
16536
17386
|
const prefix = "/goal edit ";
|
|
16537
17387
|
setComposerText(`${prefix}${threadGoal.objective}`);
|
|
16538
17388
|
},
|
|
16539
|
-
children: /* @__PURE__ */ (0,
|
|
17389
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Pencil, { className: "size-3" })
|
|
16540
17390
|
}
|
|
16541
17391
|
) }),
|
|
16542
|
-
/* @__PURE__ */ (0,
|
|
17392
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { children: t("chat.goal.edit") })
|
|
16543
17393
|
] }),
|
|
16544
|
-
/* @__PURE__ */ (0,
|
|
16545
|
-
/* @__PURE__ */ (0,
|
|
17394
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
17395
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16546
17396
|
Button,
|
|
16547
17397
|
{
|
|
16548
17398
|
type: "button",
|
|
@@ -16558,13 +17408,13 @@ function Chat({
|
|
|
16558
17408
|
executionType: "insert_invocation"
|
|
16559
17409
|
}
|
|
16560
17410
|
}),
|
|
16561
|
-
children: threadGoal.status === "paused" ? /* @__PURE__ */ (0,
|
|
17411
|
+
children: threadGoal.status === "paused" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Play, { className: "size-3" }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Pause, { className: "size-3" })
|
|
16562
17412
|
}
|
|
16563
17413
|
) }),
|
|
16564
|
-
/* @__PURE__ */ (0,
|
|
17414
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { children: threadGoal.status === "paused" ? t("chat.goal.resume") : t("chat.goal.pause") })
|
|
16565
17415
|
] }),
|
|
16566
|
-
/* @__PURE__ */ (0,
|
|
16567
|
-
/* @__PURE__ */ (0,
|
|
17416
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
17417
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16568
17418
|
Button,
|
|
16569
17419
|
{
|
|
16570
17420
|
type: "button",
|
|
@@ -16580,13 +17430,13 @@ function Chat({
|
|
|
16580
17430
|
executionType: "insert_invocation"
|
|
16581
17431
|
}
|
|
16582
17432
|
}),
|
|
16583
|
-
children: /* @__PURE__ */ (0,
|
|
17433
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Trash2, { className: "size-3" })
|
|
16584
17434
|
}
|
|
16585
17435
|
) }),
|
|
16586
|
-
/* @__PURE__ */ (0,
|
|
17436
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { children: t("chat.goal.clear") })
|
|
16587
17437
|
] }),
|
|
16588
|
-
threadGoal.objective && !goalError && /* @__PURE__ */ (0,
|
|
16589
|
-
/* @__PURE__ */ (0,
|
|
17438
|
+
threadGoal.objective && !goalError && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
17439
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16590
17440
|
Button,
|
|
16591
17441
|
{
|
|
16592
17442
|
type: "button",
|
|
@@ -16595,8 +17445,8 @@ function Chat({
|
|
|
16595
17445
|
"aria-expanded": isGoalObjectiveExpanded,
|
|
16596
17446
|
"aria-label": isGoalObjectiveExpanded ? t("chat.goal.collapseObjective") : t("chat.goal.expandObjective"),
|
|
16597
17447
|
onClick: () => setIsGoalObjectiveExpanded((expanded) => !expanded),
|
|
16598
|
-
children: /* @__PURE__ */ (0,
|
|
16599
|
-
|
|
17448
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
17449
|
+
import_lucide_react29.ChevronDown,
|
|
16600
17450
|
{
|
|
16601
17451
|
className: cn(
|
|
16602
17452
|
"size-3 transition-transform",
|
|
@@ -16606,13 +17456,13 @@ function Chat({
|
|
|
16606
17456
|
)
|
|
16607
17457
|
}
|
|
16608
17458
|
) }),
|
|
16609
|
-
/* @__PURE__ */ (0,
|
|
17459
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { children: isGoalObjectiveExpanded ? t("chat.goal.collapseObjective") : t("chat.goal.expandObjective") })
|
|
16610
17460
|
] })
|
|
16611
17461
|
] })
|
|
16612
17462
|
]
|
|
16613
17463
|
}
|
|
16614
17464
|
),
|
|
16615
|
-
/* @__PURE__ */ (0,
|
|
17465
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16616
17466
|
PendingRuntimeServices,
|
|
16617
17467
|
{
|
|
16618
17468
|
state: stream.runtimeActivities.sandboxServices,
|
|
@@ -16621,7 +17471,7 @@ function Chat({
|
|
|
16621
17471
|
className: hasPendingTodos || hasPendingFollowUps ? "mb-2" : void 0
|
|
16622
17472
|
}
|
|
16623
17473
|
),
|
|
16624
|
-
/* @__PURE__ */ (0,
|
|
17474
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16625
17475
|
PendingTodos,
|
|
16626
17476
|
{
|
|
16627
17477
|
snapshot: stream.todos,
|
|
@@ -16629,7 +17479,7 @@ function Chat({
|
|
|
16629
17479
|
className: hasPendingFollowUps ? "mb-2" : void 0
|
|
16630
17480
|
}
|
|
16631
17481
|
),
|
|
16632
|
-
/* @__PURE__ */ (0,
|
|
17482
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16633
17483
|
PendingFollowUps,
|
|
16634
17484
|
{
|
|
16635
17485
|
items: pendingFollowUps,
|
|
@@ -16642,7 +17492,7 @@ function Chat({
|
|
|
16642
17492
|
attachToComposer: true
|
|
16643
17493
|
}
|
|
16644
17494
|
),
|
|
16645
|
-
/* @__PURE__ */ (0,
|
|
17495
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16646
17496
|
RequestUserInputPanel,
|
|
16647
17497
|
{
|
|
16648
17498
|
request: stream.pendingRequestUserInput,
|
|
@@ -16651,7 +17501,7 @@ function Chat({
|
|
|
16651
17501
|
attachToComposer: true
|
|
16652
17502
|
}
|
|
16653
17503
|
),
|
|
16654
|
-
/* @__PURE__ */ (0,
|
|
17504
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16655
17505
|
HITLApprovalPanel,
|
|
16656
17506
|
{
|
|
16657
17507
|
request: stream.pendingHITLRequest,
|
|
@@ -16660,7 +17510,7 @@ function Chat({
|
|
|
16660
17510
|
attachToComposer: true
|
|
16661
17511
|
}
|
|
16662
17512
|
),
|
|
16663
|
-
runtimeCapabilityPalette && /* @__PURE__ */ (0,
|
|
17513
|
+
runtimeCapabilityPalette && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16664
17514
|
SlashPalette,
|
|
16665
17515
|
{
|
|
16666
17516
|
palette: runtimeCapabilityPalette,
|
|
@@ -16674,7 +17524,7 @@ function Chat({
|
|
|
16674
17524
|
onSelect: selectSlashPaletteOption
|
|
16675
17525
|
}
|
|
16676
17526
|
),
|
|
16677
|
-
/* @__PURE__ */ (0,
|
|
17527
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("form", { className: "flex items-end", onSubmit: handleSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16678
17528
|
"div",
|
|
16679
17529
|
{
|
|
16680
17530
|
"data-slot": "composer-input-shell",
|
|
@@ -16688,7 +17538,7 @@ function Chat({
|
|
|
16688
17538
|
composerInputRoundedClass
|
|
16689
17539
|
),
|
|
16690
17540
|
children: [
|
|
16691
|
-
/* @__PURE__ */ (0,
|
|
17541
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16692
17542
|
"div",
|
|
16693
17543
|
{
|
|
16694
17544
|
ref: composerInputRef,
|
|
@@ -16710,7 +17560,7 @@ function Chat({
|
|
|
16710
17560
|
(missingConfig || isHistoryLoading || hasPendingInteractiveRequest) && "cursor-not-allowed opacity-50"
|
|
16711
17561
|
),
|
|
16712
17562
|
children: renderedComposerParts.map(
|
|
16713
|
-
(part, index) => part.type === "text" ? /* @__PURE__ */ (0,
|
|
17563
|
+
(part, index) => part.type === "text" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(React49.Fragment, { children: part.text }, `text-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16714
17564
|
"span",
|
|
16715
17565
|
{
|
|
16716
17566
|
"data-composer-capability-key": part.key,
|
|
@@ -16719,14 +17569,14 @@ function Chat({
|
|
|
16719
17569
|
contentEditable: false,
|
|
16720
17570
|
className: "mx-0.5 inline-flex max-w-[14rem] select-none items-center gap-1 text-sm font-semibold text-primary align-baseline",
|
|
16721
17571
|
children: [
|
|
16722
|
-
/* @__PURE__ */ (0,
|
|
17572
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16723
17573
|
RuntimeCapabilityIcon,
|
|
16724
17574
|
{
|
|
16725
17575
|
option: part.capability,
|
|
16726
17576
|
variant: "chip"
|
|
16727
17577
|
}
|
|
16728
17578
|
),
|
|
16729
|
-
/* @__PURE__ */ (0,
|
|
17579
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "truncate", children: part.capability.label })
|
|
16730
17580
|
]
|
|
16731
17581
|
},
|
|
16732
17582
|
part.key
|
|
@@ -16735,14 +17585,14 @@ function Chat({
|
|
|
16735
17585
|
},
|
|
16736
17586
|
composerDomVersion
|
|
16737
17587
|
),
|
|
16738
|
-
/* @__PURE__ */ (0,
|
|
17588
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16739
17589
|
"div",
|
|
16740
17590
|
{
|
|
16741
17591
|
"data-slot": "composer-action-bar",
|
|
16742
17592
|
className: "pointer-events-none absolute inset-x-1.5 bottom-1 flex min-h-10 items-center justify-between gap-2",
|
|
16743
17593
|
children: [
|
|
16744
|
-
/* @__PURE__ */ (0,
|
|
16745
|
-
/* @__PURE__ */ (0,
|
|
17594
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "pointer-events-none flex min-w-0 flex-1 items-center gap-1.5", children: [
|
|
17595
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "pointer-events-auto flex shrink-0 items-center gap-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16746
17596
|
ComposerMenu,
|
|
16747
17597
|
{
|
|
16748
17598
|
composer,
|
|
@@ -16760,20 +17610,20 @@ function Chat({
|
|
|
16760
17610
|
disabled: missingConfig || isHistoryLoading || hasPendingInteractiveRequest
|
|
16761
17611
|
}
|
|
16762
17612
|
) }),
|
|
16763
|
-
selectedTool && /* @__PURE__ */ (0,
|
|
16764
|
-
/* @__PURE__ */ (0,
|
|
16765
|
-
/* @__PURE__ */ (0,
|
|
17613
|
+
selectedTool && /* @__PURE__ */ (0, import_jsx_runtime54.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: [
|
|
17614
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "truncate", children: selectedTool.shortLabel ?? selectedTool.label }),
|
|
17615
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16766
17616
|
"button",
|
|
16767
17617
|
{
|
|
16768
17618
|
type: "button",
|
|
16769
17619
|
onClick: () => setSelectedTool(null),
|
|
16770
17620
|
className: "shrink-0 rounded-full p-0.5 text-primary/70 hover:bg-primary/10 hover:text-primary",
|
|
16771
|
-
children: /* @__PURE__ */ (0,
|
|
17621
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.X, { size: 12 })
|
|
16772
17622
|
}
|
|
16773
17623
|
)
|
|
16774
17624
|
] })
|
|
16775
17625
|
] }),
|
|
16776
|
-
/* @__PURE__ */ (0,
|
|
17626
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "pointer-events-auto shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16777
17627
|
SendButton,
|
|
16778
17628
|
{
|
|
16779
17629
|
disabled: isSendDisabled,
|
|
@@ -16796,7 +17646,7 @@ function Chat({
|
|
|
16796
17646
|
]
|
|
16797
17647
|
}
|
|
16798
17648
|
) }),
|
|
16799
|
-
disclaimer?.text && /* @__PURE__ */ (0,
|
|
17649
|
+
disclaimer?.text && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16800
17650
|
"p",
|
|
16801
17651
|
{
|
|
16802
17652
|
className: cn(
|
|
@@ -16806,12 +17656,12 @@ function Chat({
|
|
|
16806
17656
|
children: disclaimer.text
|
|
16807
17657
|
}
|
|
16808
17658
|
),
|
|
16809
|
-
/* @__PURE__ */ (0,
|
|
16810
|
-
/* @__PURE__ */ (0,
|
|
16811
|
-
/* @__PURE__ */ (0,
|
|
17659
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "mt-2 flex items-center justify-center gap-2 text-xs text-muted-foreground", children: [
|
|
17660
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: t("chat.poweredBy") }),
|
|
17661
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ContextUsageIndicator, { className: "absolute right-4" })
|
|
16812
17662
|
] })
|
|
16813
17663
|
] }),
|
|
16814
|
-
/* @__PURE__ */ (0,
|
|
17664
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16815
17665
|
SettingsSheet,
|
|
16816
17666
|
{
|
|
16817
17667
|
open: petSettingsOpen,
|
|
@@ -16821,17 +17671,17 @@ function Chat({
|
|
|
16821
17671
|
onSave: savePetLocalSettings
|
|
16822
17672
|
}
|
|
16823
17673
|
),
|
|
16824
|
-
/* @__PURE__ */ (0,
|
|
17674
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PetBridge, { pet: effectivePet, state: petAutoState })
|
|
16825
17675
|
]
|
|
16826
17676
|
}
|
|
16827
17677
|
);
|
|
16828
17678
|
}
|
|
16829
17679
|
|
|
16830
17680
|
// src/components/ui/separator.tsx
|
|
16831
|
-
var
|
|
16832
|
-
var
|
|
16833
|
-
var Separator =
|
|
16834
|
-
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ (0,
|
|
17681
|
+
var React50 = __toESM(require("react"), 1);
|
|
17682
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
17683
|
+
var Separator = React50.forwardRef(
|
|
17684
|
+
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
16835
17685
|
"div",
|
|
16836
17686
|
{
|
|
16837
17687
|
ref,
|