@xpert-ai/chatkit-ui 0.4.4 → 0.4.6
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-TMxiHmEt.js → _baseUniq-e0n3oxgY.js} +1 -1
- package/dist/app/assets/{abap-Ck-A--kS.js → abap-C2m1gMh_.js} +1 -1
- package/dist/app/assets/{abnf-ETC1zUJ3.js → abnf-DFzlHNVB.js} +1 -1
- package/dist/app/assets/{actionscript-D--OP--K.js → actionscript-Dxmvc3AF.js} +1 -1
- package/dist/app/assets/{ada-CDetVdj6.js → ada-CVO_O52N.js} +1 -1
- package/dist/app/assets/{agda-BMJYMk52.js → agda-CGEI8apm.js} +1 -1
- package/dist/app/assets/{al-Db9ENOd3.js → al-CXBctxHE.js} +1 -1
- package/dist/app/assets/{antlr4-BW8d6D2N.js → antlr4-BzGyc1GG.js} +1 -1
- package/dist/app/assets/{apacheconf-BQPffoZs.js → apacheconf-DhdeJg1U.js} +1 -1
- package/dist/app/assets/{apex-BDhwAKiF.js → apex-Dfprst0f.js} +1 -1
- package/dist/app/assets/{apl-BS9tU3lX.js → apl-D3zvQCsG.js} +1 -1
- package/dist/app/assets/{applescript-CAuteGTO.js → applescript-DWkUa8Ap.js} +1 -1
- package/dist/app/assets/{aql-DlV09MnJ.js → aql-DrfLox7L.js} +1 -1
- package/dist/app/assets/{arc-D3dvEiRa.js → arc-25X_4Lt9.js} +1 -1
- package/dist/app/assets/{architectureDiagram-Q4EWVU46-BJNOb03u.js → architectureDiagram-Q4EWVU46-CyF28k-b.js} +1 -1
- package/dist/app/assets/{arduino-Fwp0Gqjn.js → arduino-Qd3e6Ok1.js} +1 -1
- package/dist/app/assets/{arff-D1ze2M6G.js → arff-CRZ9puZK.js} +1 -1
- package/dist/app/assets/{asciidoc-DuSG0rE-.js → asciidoc-DUiwgtuK.js} +1 -1
- package/dist/app/assets/{asm6502-DiyS793s.js → asm6502-zG1dqL1m.js} +1 -1
- package/dist/app/assets/{asmatmel-BgPjOvKk.js → asmatmel-Cm9zpYMv.js} +1 -1
- package/dist/app/assets/{aspnet-DS6cVlO8.js → aspnet-CX5-L7Ct.js} +1 -1
- package/dist/app/assets/{autohotkey-BhOfSyb7.js → autohotkey-C4JfPrSd.js} +1 -1
- package/dist/app/assets/{autoit-qharvHka.js → autoit-g5o6EGhy.js} +1 -1
- package/dist/app/assets/{avisynth-DuYY8hq9.js → avisynth-BzCOBA3x.js} +1 -1
- package/dist/app/assets/{avro-idl-CVlpaCRn.js → avro-idl-e0tKOc6E.js} +1 -1
- package/dist/app/assets/{bash-CRdlMYvM.js → bash-CHd7M7ii.js} +1 -1
- package/dist/app/assets/{basic-DupsYiAg.js → basic-DvEnfVvI.js} +1 -1
- package/dist/app/assets/{batch-SuJmV6In.js → batch-CT5xgq8J.js} +1 -1
- package/dist/app/assets/{bbcode-BS6lj-GP.js → bbcode-DJ7OKysr.js} +1 -1
- package/dist/app/assets/{bicep-rkAfEJ7t.js → bicep-BXw_45Yz.js} +1 -1
- package/dist/app/assets/{birb-iXd4GkHj.js → birb-XpBgzzS8.js} +1 -1
- package/dist/app/assets/{bison-DXF-YZke.js → bison-D-7QCu9c.js} +1 -1
- package/dist/app/assets/{blockDiagram-DXYQGD6D-FJZrsqQ2.js → blockDiagram-DXYQGD6D-6aWNcctV.js} +1 -1
- package/dist/app/assets/{bnf-H9nHTWOC.js → bnf-98JsAWJD.js} +1 -1
- package/dist/app/assets/{brainfuck-6HhEdVzI.js → brainfuck-DtvgC7Uz.js} +1 -1
- package/dist/app/assets/{brightscript-B00Ory-q.js → brightscript-CiZLD50k.js} +1 -1
- package/dist/app/assets/{bro-BguB8PwR.js → bro-rbJDq64_.js} +1 -1
- package/dist/app/assets/{bsl-CnoKMnh1.js → bsl-BS-cDrod.js} +1 -1
- package/dist/app/assets/{c-BLZaQSul.js → c-DQDTErL9.js} +1 -1
- package/dist/app/assets/{c4Diagram-AHTNJAMY-aFMpHsr7.js → c4Diagram-AHTNJAMY-aTcQy0xE.js} +1 -1
- package/dist/app/assets/{cfscript-Dj3sn5qb.js → cfscript-CkR3O7sU.js} +1 -1
- package/dist/app/assets/{chaiscript-B2Li8_Xi.js → chaiscript-DvxvIu7v.js} +1 -1
- package/dist/app/assets/channel-CVWoJuYf.js +1 -0
- package/dist/app/assets/{chunk-4BX2VUAB-mNkmACgc.js → chunk-4BX2VUAB-qfDhreDf.js} +1 -1
- package/dist/app/assets/{chunk-4TB4RGXK-UImL1Qph.js → chunk-4TB4RGXK-BBVzKpce.js} +1 -1
- package/dist/app/assets/{chunk-55IACEB6-BrbuP7ej.js → chunk-55IACEB6-CcY9LJAj.js} +1 -1
- package/dist/app/assets/{chunk-EDXVE4YY-nIuwelfS.js → chunk-EDXVE4YY-B-Dzr-Dh.js} +1 -1
- package/dist/app/assets/{chunk-FMBD7UC4-BcWvK3ua.js → chunk-FMBD7UC4-8CUKOSAc.js} +1 -1
- package/dist/app/assets/{chunk-OYMX7WX6-NFSrvN2K.js → chunk-OYMX7WX6-D9Cq7hwT.js} +1 -1
- package/dist/app/assets/{chunk-QZHKN3VN-A-S7sUFp.js → chunk-QZHKN3VN-C2tBz9o2.js} +1 -1
- package/dist/app/assets/{chunk-YZCP3GAM-NsOgLJm6.js → chunk-YZCP3GAM-C4jyodPd.js} +1 -1
- package/dist/app/assets/{cil-BSYlNEvs.js → cil-C5ON7F53.js} +1 -1
- package/dist/app/assets/classDiagram-6PBFFD2Q-CgDPDKKT.js +1 -0
- package/dist/app/assets/classDiagram-v2-HSJHXN6E-CgDPDKKT.js +1 -0
- package/dist/app/assets/{clike-DaoHXpYs.js → clike-DLdxAZKH.js} +1 -1
- package/dist/app/assets/{clojure-CtOotL0u.js → clojure-DvSYmO9X.js} +1 -1
- package/dist/app/assets/clone-DyTJ9PSE.js +1 -0
- package/dist/app/assets/{cmake-BSiUfJHf.js → cmake-DO0txDE3.js} +1 -1
- package/dist/app/assets/{cobol-Blq62nOS.js → cobol-BTJpVfTH.js} +1 -1
- package/dist/app/assets/{coffeescript-wfCQi2dy.js → coffeescript-BtIXNHF3.js} +1 -1
- package/dist/app/assets/{concurnas-BptxXLM6.js → concurnas-B531692C.js} +1 -1
- package/dist/app/assets/{coq-m0xx6QVk.js → coq-Cp47Wwsa.js} +1 -1
- package/dist/app/assets/{core-BlK5liku.js → core-BoWyhl5n.js} +1 -1
- package/dist/app/assets/{cose-bilkent-S5V4N54A-BVlJJjjG.js → cose-bilkent-S5V4N54A-BjosQjhT.js} +1 -1
- package/dist/app/assets/{cpp-DrIwjXt4.js → cpp-B6wt8k5c.js} +1 -1
- package/dist/app/assets/{crystal-B2OownN0.js → crystal-B3XldzUm.js} +1 -1
- package/dist/app/assets/{csharp-C8hT9u31.js → csharp-BKQFTidP.js} +1 -1
- package/dist/app/assets/{cshtml-Bqk4UcKH.js → cshtml-BH26d1cx.js} +1 -1
- package/dist/app/assets/{csp-B23dqIVk.js → csp-DSghTOt2.js} +1 -1
- package/dist/app/assets/{css-C7bAsgCD.js → css-B5pRG057.js} +1 -1
- package/dist/app/assets/{css-extras-BxAj6HIM.js → css-extras-DD0ErmT4.js} +1 -1
- package/dist/app/assets/{csv-CITuvdZl.js → csv-C8WNOOiS.js} +1 -1
- package/dist/app/assets/{cypher-BdWaNEPh.js → cypher-C72ppWfI.js} +1 -1
- package/dist/app/assets/{d-DWzNEoy_.js → d-DCkT0MnL.js} +1 -1
- package/dist/app/assets/{dagre-KV5264BT-Cwq32s4A.js → dagre-KV5264BT-Dz0XIZ_d.js} +1 -1
- package/dist/app/assets/{dart-Cct8-2Yi.js → dart-ov_L9JbZ.js} +1 -1
- package/dist/app/assets/{dataweave-sykaGSqb.js → dataweave-ER8iZYvy.js} +1 -1
- package/dist/app/assets/{dax-CZ69LQsy.js → dax-DftfdAbZ.js} +1 -1
- package/dist/app/assets/{dhall-DThgzXZx.js → dhall-B_Ag7Ugu.js} +1 -1
- package/dist/app/assets/{diagram-5BDNPKRD-BfciTHMz.js → diagram-5BDNPKRD-LXVUQ6at.js} +1 -1
- package/dist/app/assets/{diagram-G4DWMVQ6-Q37x31io.js → diagram-G4DWMVQ6-DFJO-kg5.js} +1 -1
- package/dist/app/assets/{diagram-MMDJMWI5-Cyyx6ZUw.js → diagram-MMDJMWI5-BKfZyNwr.js} +1 -1
- package/dist/app/assets/{diagram-TYMM5635-BUh40K6u.js → diagram-TYMM5635-B0QF8FRs.js} +1 -1
- package/dist/app/assets/{diff-UDoi3FBV.js → diff-ByjoU1do.js} +1 -1
- package/dist/app/assets/{django-CUQxRbf9.js → django-D8OuMIol.js} +1 -1
- package/dist/app/assets/{dns-zone-file-9UmAuR-l.js → dns-zone-file-NMG4vugk.js} +1 -1
- package/dist/app/assets/{docker-vhZ6HugE.js → docker-D6vmqJmV.js} +1 -1
- package/dist/app/assets/{dot-Dlao8ZwH.js → dot-QLisXVDc.js} +1 -1
- package/dist/app/assets/{ebnf-BfWJycwn.js → ebnf-BmUuiQBV.js} +1 -1
- package/dist/app/assets/{editorconfig-DsrBDVtJ.js → editorconfig-RZmDBUFH.js} +1 -1
- package/dist/app/assets/{eiffel-ZZ7Z0b2_.js → eiffel-rnFzeEWt.js} +1 -1
- package/dist/app/assets/{ejs-SLmpmzms.js → ejs-DN7eCZMZ.js} +1 -1
- package/dist/app/assets/{elixir-BdkxsFt4.js → elixir-DQP09Ude.js} +1 -1
- package/dist/app/assets/{elm-DSgkBbD-.js → elm-DoxD8V5-.js} +1 -1
- package/dist/app/assets/{erDiagram-SMLLAGMA-CKj18meA.js → erDiagram-SMLLAGMA-PLYN-yt7.js} +1 -1
- package/dist/app/assets/{erb-AX38416h.js → erb-D7QWryDV.js} +1 -1
- package/dist/app/assets/{erlang-DY2BVWMP.js → erlang-6MIAP3z1.js} +1 -1
- package/dist/app/assets/{etlua-BSaUvZH7.js → etlua-CXOpuEX0.js} +1 -1
- package/dist/app/assets/{excel-formula-CGTOeZhB.js → excel-formula-Bvelfqoq.js} +1 -1
- package/dist/app/assets/{factor-CtvOHq60.js → factor-B_LwIu1T.js} +1 -1
- package/dist/app/assets/{false-C4FtFKhi.js → false-DaXIsDj9.js} +1 -1
- package/dist/app/assets/{firestore-security-rules-Z8TPJQpU.js → firestore-security-rules-vhtcxmz8.js} +1 -1
- package/dist/app/assets/{flow-0LSCeVxZ.js → flow-CbnzGhcW.js} +1 -1
- package/dist/app/assets/{flowDiagram-DWJPFMVM-CmW1pCPp.js → flowDiagram-DWJPFMVM-D46jZeCj.js} +1 -1
- package/dist/app/assets/{fortran-DR7--sEx.js → fortran-D21zPhTt.js} +1 -1
- package/dist/app/assets/{fsharp-CoiFf2ek.js → fsharp-CaguYUvm.js} +1 -1
- package/dist/app/assets/{ftl-BsfZdglK.js → ftl-DpFi23p_.js} +1 -1
- package/dist/app/assets/{ganttDiagram-T4ZO3ILL-C1vWI0vT.js → ganttDiagram-T4ZO3ILL-DiFD8eiM.js} +1 -1
- package/dist/app/assets/{gap-D5rs685K.js → gap-DTH0dhv0.js} +1 -1
- package/dist/app/assets/{gcode-ioide_II.js → gcode-Ti0MqAbc.js} +1 -1
- package/dist/app/assets/{gdscript-C1ZWRkkr.js → gdscript-B4c1zB7G.js} +1 -1
- package/dist/app/assets/{gedcom-DS1yKzLz.js → gedcom-Bm-gxba2.js} +1 -1
- package/dist/app/assets/{gherkin-uIhE-MbH.js → gherkin-CRUiP4ua.js} +1 -1
- package/dist/app/assets/{git-B5BRNNT7.js → git-DDSxUgmV.js} +1 -1
- package/dist/app/assets/{gitGraphDiagram-UUTBAWPF-DEg-duQZ.js → gitGraphDiagram-UUTBAWPF-BkD66s-m.js} +1 -1
- package/dist/app/assets/{glsl-B9fhkctz.js → glsl-BWGO0hEu.js} +1 -1
- package/dist/app/assets/{gml-offEglBU.js → gml-OfBxxn4Y.js} +1 -1
- package/dist/app/assets/{gn-FZ0bWEld.js → gn-D1i8XGRO.js} +1 -1
- package/dist/app/assets/{go-BIRlaT1a.js → go-CQxEjXj6.js} +1 -1
- package/dist/app/assets/{go-module-SjD6zijS.js → go-module-DJVIXWOE.js} +1 -1
- package/dist/app/assets/{graph-sBvKxujm.js → graph-xy46XkDv.js} +1 -1
- package/dist/app/assets/{graphql-Be74WDAY.js → graphql-DOWBew5y.js} +1 -1
- package/dist/app/assets/{groovy-ChbEq3v0.js → groovy-D4SOqf4f.js} +1 -1
- package/dist/app/assets/{haml-C6FObrUo.js → haml-Cs-NR_00.js} +1 -1
- package/dist/app/assets/{handlebars-36OFp0YX.js → handlebars-L33c899L.js} +1 -1
- package/dist/app/assets/{haskell-DuohgBoX.js → haskell-jnyZSPIm.js} +1 -1
- package/dist/app/assets/{haxe-CNMh78ZV.js → haxe-CEcS1fRW.js} +1 -1
- package/dist/app/assets/{hcl-BpxVSY5Z.js → hcl-CFVBh1rZ.js} +1 -1
- package/dist/app/assets/{hlsl-DnxGKW3m.js → hlsl-BGDcbOGU.js} +1 -1
- package/dist/app/assets/{hoon-XUklDmVn.js → hoon-DbE0jHD1.js} +1 -1
- package/dist/app/assets/{hpkp-Did6vsrG.js → hpkp-FsJh7gNB.js} +1 -1
- package/dist/app/assets/{hsts-DS9blmxt.js → hsts-q26NxKTf.js} +1 -1
- package/dist/app/assets/{http-DA2WLFiQ.js → http-DG-5h-eO.js} +1 -1
- package/dist/app/assets/{ichigojam-DdOMt5rE.js → ichigojam-CuYDdsGF.js} +1 -1
- package/dist/app/assets/{icon-PVJAVx5C.js → icon-B3Om0MSf.js} +1 -1
- package/dist/app/assets/{icu-message-format-6jii1RVV.js → icu-message-format-DN2g3klg.js} +1 -1
- package/dist/app/assets/{idris-UxX24g1J.js → idris-BOt2MkOk.js} +1 -1
- package/dist/app/assets/{iecst-BynNGYT2.js → iecst-CuBx11EN.js} +1 -1
- package/dist/app/assets/{ignore-4EVq7-cE.js → ignore-cviNNAUS.js} +1 -1
- package/dist/app/assets/{index-CAfb2sup.js → index-B0wzBY_g.js} +210 -210
- package/dist/app/assets/index-CmKBuFcH.css +1 -0
- package/dist/app/assets/{infoDiagram-42DDH7IO-BfATVLk8.js → infoDiagram-42DDH7IO-D20xP3z-.js} +1 -1
- package/dist/app/assets/{inform7-BXb820VQ.js → inform7-Ba3iGRkz.js} +1 -1
- package/dist/app/assets/{ini-Cmr0cBrX.js → ini-D1qPbzhi.js} +1 -1
- package/dist/app/assets/{io-BdLksOc2.js → io-DxDg_PHG.js} +1 -1
- package/dist/app/assets/{ishikawaDiagram-UXIWVN3A-B6I8Yqfq.js → ishikawaDiagram-UXIWVN3A-cYl8p5Z1.js} +1 -1
- package/dist/app/assets/{j-CAftgdTa.js → j-LY0FoFmS.js} +1 -1
- package/dist/app/assets/{java-fwAzePp5.js → java-BqooSNxs.js} +1 -1
- package/dist/app/assets/{javadoc-BcYkNCK0.js → javadoc-BqcBR3v0.js} +1 -1
- package/dist/app/assets/{javadoclike-B57hwpBc.js → javadoclike-C4mjzqku.js} +1 -1
- package/dist/app/assets/{javascript-u1gm812-.js → javascript-N5ua9HdK.js} +1 -1
- package/dist/app/assets/{javastacktrace-cj9BHFXH.js → javastacktrace-v7dElDBR.js} +1 -1
- package/dist/app/assets/{jexl-DrO8YpRi.js → jexl-QnOdFFuN.js} +1 -1
- package/dist/app/assets/{jolie-C5CF-EiA.js → jolie-CJ-3s01g.js} +1 -1
- package/dist/app/assets/{journeyDiagram-VCZTEJTY-62Da_9fB.js → journeyDiagram-VCZTEJTY-BYX8q3Vt.js} +1 -1
- package/dist/app/assets/{jq-BQS35fYF.js → jq-CWSEYqle.js} +1 -1
- package/dist/app/assets/{js-extras-Dc8Ge9lP.js → js-extras-BAnnOfzU.js} +1 -1
- package/dist/app/assets/{js-templates-BChMs7zu.js → js-templates-C4pUn2It.js} +1 -1
- package/dist/app/assets/{jsdoc-Dsh0OaeE.js → jsdoc-KAXMzacX.js} +1 -1
- package/dist/app/assets/{json-DSLB2HLl.js → json-D82-G59c.js} +1 -1
- package/dist/app/assets/{json5-cRfUF1uJ.js → json5-6tkCkwy4.js} +1 -1
- package/dist/app/assets/{jsonp-DXOWbjE0.js → jsonp-CJLh9FtV.js} +1 -1
- package/dist/app/assets/{jsstacktrace-DlgtDbr8.js → jsstacktrace-DtzF790j.js} +1 -1
- package/dist/app/assets/{jsx-CyFeFIQM.js → jsx-HBfJ0kvY.js} +1 -1
- package/dist/app/assets/{julia-vGoL8D9z.js → julia-qgsTf-aE.js} +1 -1
- package/dist/app/assets/{kanban-definition-6JOO6SKY-JAtH1H2c.js → kanban-definition-6JOO6SKY-lNjZrvli.js} +1 -1
- package/dist/app/assets/{keepalived-u6JnaMHj.js → keepalived-CxQ8kQHh.js} +1 -1
- package/dist/app/assets/{keyman-C2x0si7Y.js → keyman-QQ5F7jKU.js} +1 -1
- package/dist/app/assets/{kotlin-l8__XfWl.js → kotlin-CHGD50lP.js} +1 -1
- package/dist/app/assets/{kumir-CaQaIRBf.js → kumir-Bu9SM23C.js} +1 -1
- package/dist/app/assets/{kusto-DYDxqji-.js → kusto-mt_hZCSq.js} +1 -1
- package/dist/app/assets/{latex-D2qjbQmB.js → latex-CICDtHjj.js} +1 -1
- package/dist/app/assets/{latte-CmbmgbPe.js → latte-BAR0mT7a.js} +1 -1
- package/dist/app/assets/{layout-BMTuSUP-.js → layout-DEyJKhDK.js} +1 -1
- package/dist/app/assets/{less-DpljErLD.js → less-CHNPhcod.js} +1 -1
- package/dist/app/assets/{lilypond-DAeqUsI_.js → lilypond-CSUOMwf6.js} +1 -1
- package/dist/app/assets/{linear-CqSIeBnp.js → linear-D9VvUwfa.js} +1 -1
- package/dist/app/assets/{liquid-Bo11FNrj.js → liquid-Cz7TW2oY.js} +1 -1
- package/dist/app/assets/{lisp-BNBGpNSq.js → lisp-Du6y1304.js} +1 -1
- package/dist/app/assets/{livescript-CNBuUGwr.js → livescript-BtG5DGcF.js} +1 -1
- package/dist/app/assets/{llvm-BCQgrmMc.js → llvm-BDPUo2hX.js} +1 -1
- package/dist/app/assets/{log-7C67ffIH.js → log--N5sUe_u.js} +1 -1
- package/dist/app/assets/{lolcode-tyVOf0-i.js → lolcode-ClqwJSko.js} +1 -1
- package/dist/app/assets/{lua-D1tjiZGJ.js → lua-DbeZ1IVc.js} +1 -1
- package/dist/app/assets/{magma-DvpErL5E.js → magma-Whq-4iou.js} +1 -1
- package/dist/app/assets/{makefile-DVopM6_I.js → makefile-pSKDqMc6.js} +1 -1
- package/dist/app/assets/{markdown-zDaJjBqz.js → markdown-B1xgmDWp.js} +1 -1
- package/dist/app/assets/{markup-Dn7T0Xgl.js → markup-DzLXw8Rh.js} +1 -1
- package/dist/app/assets/{markup-templating-jmwD3Mv5.js → markup-templating-DPDS9QM5.js} +1 -1
- package/dist/app/assets/{matlab-Dmd8VzKM.js → matlab-DJRo_vuN.js} +1 -1
- package/dist/app/assets/{maxscript-FjCyY0j5.js → maxscript-BvZXFCmD.js} +1 -1
- package/dist/app/assets/{mel-BDzXY19C.js → mel-CyILQ25B.js} +1 -1
- package/dist/app/assets/{mermaid-lu-_cgAH.js → mermaid-CwNV2n0M.js} +1 -1
- package/dist/app/assets/{min-DYtuudAi.js → min-W152sZHe.js} +1 -1
- package/dist/app/assets/{mindmap-definition-QFDTVHPH-C0LlKYnG.js → mindmap-definition-QFDTVHPH-C-UOvSVV.js} +1 -1
- package/dist/app/assets/{mizar-BDWlOEMd.js → mizar-C0hSTRmd.js} +1 -1
- package/dist/app/assets/{mongodb-BqhqCTUF.js → mongodb-D_b-CoC-.js} +1 -1
- package/dist/app/assets/{monkey-DD_wkxjO.js → monkey-PvQu5Vd6.js} +1 -1
- package/dist/app/assets/{moonscript-5BliHqu8.js → moonscript-CoP1dq0Z.js} +1 -1
- package/dist/app/assets/{n1ql-BI9d8-dk.js → n1ql-3QuCoAIN.js} +1 -1
- package/dist/app/assets/{n4js-CiGP0jcT.js → n4js-DZHeRyua.js} +1 -1
- package/dist/app/assets/{nand2tetris-hdl-h4B9YPVX.js → nand2tetris-hdl-dS8crO2g.js} +1 -1
- package/dist/app/assets/{naniscript-0FP5ZgNv.js → naniscript-DwYGbK5q.js} +1 -1
- package/dist/app/assets/{nasm-CfsxN3sz.js → nasm-CM1zvD-3.js} +1 -1
- package/dist/app/assets/{neon-Ds1qWnTS.js → neon-DFFyEzDC.js} +1 -1
- package/dist/app/assets/{nevod-CpogMq0t.js → nevod-D2FYTpnK.js} +1 -1
- package/dist/app/assets/{nginx-CBAywKyc.js → nginx-CdY-14q6.js} +1 -1
- package/dist/app/assets/{nim-CKndoR7P.js → nim-CG1iSWGV.js} +1 -1
- package/dist/app/assets/{nix-C2aGN04i.js → nix-D0-Pu9rL.js} +1 -1
- package/dist/app/assets/{nsis-BS2FD5Ui.js → nsis-dtDOvjH7.js} +1 -1
- package/dist/app/assets/{objectivec-BV3I8zfq.js → objectivec-CptpH-1d.js} +1 -1
- package/dist/app/assets/{ocaml-CumNTZrg.js → ocaml-Dv1ea-ld.js} +1 -1
- package/dist/app/assets/{opencl-BA7HxeS1.js → opencl-BvMmG6YR.js} +1 -1
- package/dist/app/assets/{openqasm-CVlYcfEb.js → openqasm-CwSFop47.js} +1 -1
- package/dist/app/assets/{oz-BgNzyTQm.js → oz-CEJrdpA7.js} +1 -1
- package/dist/app/assets/{parigp-HAeKHx70.js → parigp-DViKd8pj.js} +1 -1
- package/dist/app/assets/{parser-DBm9W7gH.js → parser-DgiwG_pC.js} +1 -1
- package/dist/app/assets/{pascal-DVVWX7c3.js → pascal-j68rLfD9.js} +1 -1
- package/dist/app/assets/{pascaligo-9sC0JINE.js → pascaligo-DUem4H6l.js} +1 -1
- package/dist/app/assets/{pcaxis-BExTG1b5.js → pcaxis-DvgzQxqD.js} +1 -1
- package/dist/app/assets/{peoplecode-BYMaBssU.js → peoplecode-C3Bxx6ZR.js} +1 -1
- package/dist/app/assets/{perl-BnEaJyRt.js → perl-FujE7XeE.js} +1 -1
- package/dist/app/assets/{php-DTvaAe6L.js → php-CNsXpF9V.js} +1 -1
- package/dist/app/assets/{php-extras-BryvmqOr.js → php-extras-C32YwHEb.js} +1 -1
- package/dist/app/assets/{phpdoc-DNQcJB7n.js → phpdoc-DGWozCi2.js} +1 -1
- package/dist/app/assets/{pieDiagram-DEJITSTG-CNyUzOEA.js → pieDiagram-DEJITSTG-Dqtbtugf.js} +1 -1
- package/dist/app/assets/{plsql-C53Rqwl3.js → plsql-C2VV-t97.js} +1 -1
- package/dist/app/assets/{powerquery-CBDVLr0E.js → powerquery-PRRUJzFT.js} +1 -1
- package/dist/app/assets/{powershell-BTjXHGcn.js → powershell-bb1HIydt.js} +1 -1
- package/dist/app/assets/{processing-LU1Q4Xrp.js → processing-DjcO4gZ4.js} +1 -1
- package/dist/app/assets/{prolog-CAkqp_8e.js → prolog-BYubkdm0.js} +1 -1
- package/dist/app/assets/{promql-qm_oe_qq.js → promql-C1R9989z.js} +1 -1
- package/dist/app/assets/{properties-CkopXTtp.js → properties-6E8geRjW.js} +1 -1
- package/dist/app/assets/{protobuf-Y8NjvM3i.js → protobuf-NbKEUq-0.js} +1 -1
- package/dist/app/assets/{psl-C6tOp1_K.js → psl-CCIboIeA.js} +1 -1
- package/dist/app/assets/{pug-CS_9WzOj.js → pug-B6XaxAxB.js} +1 -1
- package/dist/app/assets/{puppet-CUp_EgdL.js → puppet-sYeWToAm.js} +1 -1
- package/dist/app/assets/{pure-Blo1Mo0B.js → pure-MigBUlto.js} +1 -1
- package/dist/app/assets/{purebasic-Ca8-6hSG.js → purebasic-CbK5sM8J.js} +1 -1
- package/dist/app/assets/{purescript-NTJk_TqU.js → purescript-D4syOBjO.js} +1 -1
- package/dist/app/assets/{q-B6Zcp4zx.js → q-BQLn2JzW.js} +1 -1
- package/dist/app/assets/{qml-BWFD-5NF.js → qml-Be1u_eEw.js} +1 -1
- package/dist/app/assets/{qore-CDatToXb.js → qore-B1z7c7Yg.js} +1 -1
- package/dist/app/assets/{qsharp-D7nj5IOf.js → qsharp-BWsfMLkJ.js} +1 -1
- package/dist/app/assets/{quadrantDiagram-34T5L4WZ-DhG4JpPn.js → quadrantDiagram-34T5L4WZ-DdFjuBtK.js} +1 -1
- package/dist/app/assets/{r-B1QI-AqR.js → r-BER2AggK.js} +1 -1
- package/dist/app/assets/{racket-B4nDtIWF.js → racket-DOZRNhck.js} +1 -1
- package/dist/app/assets/{reason-JWfMNNZ5.js → reason-1KJbYmkA.js} +1 -1
- package/dist/app/assets/{regex-CJNXHeEg.js → regex-SdGLwvq5.js} +1 -1
- package/dist/app/assets/{rego-LQxbhCWr.js → rego-D-mLsW7j.js} +1 -1
- package/dist/app/assets/{renpy-BDFd6l-h.js → renpy-CYj4XzkD.js} +1 -1
- package/dist/app/assets/{requirementDiagram-MS252O5E-VIZnTHe_.js → requirementDiagram-MS252O5E-B5KgDzYF.js} +1 -1
- package/dist/app/assets/{rest-CGwOWaqn.js → rest-Do-kum26.js} +1 -1
- package/dist/app/assets/{rip-BIv3Yp6n.js → rip-CZ7hy7Rc.js} +1 -1
- package/dist/app/assets/{roboconf-DGg8AzxQ.js → roboconf-CrOlOF2e.js} +1 -1
- package/dist/app/assets/{robotframework-Cu4U-LJt.js → robotframework-SFMU6Wwy.js} +1 -1
- package/dist/app/assets/{ruby-jJNeRq1e.js → ruby-DSiktnDP.js} +1 -1
- package/dist/app/assets/{rust-DBMO8o-k.js → rust-BEq861Tj.js} +1 -1
- package/dist/app/assets/{sankeyDiagram-XADWPNL6-D109kLbO.js → sankeyDiagram-XADWPNL6-B_ju-fsT.js} +1 -1
- package/dist/app/assets/{sas-BXMgxJ5D.js → sas-Cxt3LAYG.js} +1 -1
- package/dist/app/assets/{sass-BXkCPsxr.js → sass-C0QOivil.js} +1 -1
- package/dist/app/assets/{scala-A2dbBlRv.js → scala-CBIhwVR7.js} +1 -1
- package/dist/app/assets/{scheme-5YfcUkz6.js → scheme-BQ8vJpEk.js} +1 -1
- package/dist/app/assets/{scss-CKQrod7s.js → scss-9ZztaO09.js} +1 -1
- package/dist/app/assets/{sequenceDiagram-FGHM5R23-BWFRA3S4.js → sequenceDiagram-FGHM5R23-BNRlgM_o.js} +1 -1
- package/dist/app/assets/{shell-session-7xRIeziW.js → shell-session-CEjfbC-4.js} +1 -1
- package/dist/app/assets/{smali-Dp3s5TDa.js → smali-wTZoo5Ck.js} +1 -1
- package/dist/app/assets/{smalltalk-Cn6dJ_DR.js → smalltalk-CtdEepu4.js} +1 -1
- package/dist/app/assets/{smarty-B62Phcz3.js → smarty-DCOaiyVN.js} +1 -1
- package/dist/app/assets/{sml-CRGJcRiK.js → sml-CRIi_5FN.js} +1 -1
- package/dist/app/assets/{solidity-CmijFrY5.js → solidity-C-sunTbM.js} +1 -1
- package/dist/app/assets/{solution-file-CMlGbfWf.js → solution-file-BMcD_yBD.js} +1 -1
- package/dist/app/assets/{soy-DfV0L1AX.js → soy-CrHujpjx.js} +1 -1
- package/dist/app/assets/{sparql-UU0JEsJN.js → sparql-_nkh51Oo.js} +1 -1
- package/dist/app/assets/{splunk-spl-CoMa2odZ.js → splunk-spl-BV0yJuZ3.js} +1 -1
- package/dist/app/assets/{sqf-BK0u4w1w.js → sqf-CTR3G-sn.js} +1 -1
- package/dist/app/assets/{sql-DNyh2fmD.js → sql-CK8LhvZf.js} +1 -1
- package/dist/app/assets/{squirrel-inCt7JHG.js → squirrel-BrWr7Sn4.js} +1 -1
- package/dist/app/assets/{stan-Doi4GinI.js → stan-CEC_j0Vp.js} +1 -1
- package/dist/app/assets/{stateDiagram-FHFEXIEX-BrDgd0rD.js → stateDiagram-FHFEXIEX-CD5PsxTo.js} +1 -1
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-CZ_oJSeJ.js +1 -0
- package/dist/app/assets/{stylus-B--PyNIy.js → stylus-DAsiIRIp.js} +1 -1
- package/dist/app/assets/{swift-CzynVDjb.js → swift-BAaG4GYN.js} +1 -1
- package/dist/app/assets/{systemd-BzRtQaxY.js → systemd-DzS1CHBe.js} +1 -1
- package/dist/app/assets/{t4-cs-DRmWJZc9.js → t4-cs-ggnb3aeJ.js} +1 -1
- package/dist/app/assets/{t4-templating-DPZ7hNhf.js → t4-templating-Bu_GLHIZ.js} +1 -1
- package/dist/app/assets/{t4-vb-DJ-j33dQ.js → t4-vb-C9FmkhvR.js} +1 -1
- package/dist/app/assets/{tap-Cxx_PgyE.js → tap-CoKAR-fO.js} +1 -1
- package/dist/app/assets/{tcl-Bs4a0Dfs.js → tcl-C2ZkJvLb.js} +1 -1
- package/dist/app/assets/{textile-BoRmwUMy.js → textile-DZALIJzT.js} +1 -1
- package/dist/app/assets/{timeline-definition-GMOUNBTQ-CzfKhXYm.js → timeline-definition-GMOUNBTQ-CDhxUnOk.js} +1 -1
- package/dist/app/assets/{toml-Dt03eQXy.js → toml-C2smfO8e.js} +1 -1
- package/dist/app/assets/{tremor-DAjHRWBi.js → tremor-BjkZp6il.js} +1 -1
- package/dist/app/assets/{tt2-BeNFgyN2.js → tt2-CHuxOCBz.js} +1 -1
- package/dist/app/assets/{turtle-BzI8BWIV.js → turtle-BRML1nbK.js} +1 -1
- package/dist/app/assets/{twig-Df--35lw.js → twig-BXTsXQgH.js} +1 -1
- package/dist/app/assets/{typescript-BAKA2fdq.js → typescript-D97Flp8j.js} +1 -1
- package/dist/app/assets/{typoscript-r0z-RS5y.js → typoscript-DSeb0eJ9.js} +1 -1
- package/dist/app/assets/{unrealscript-dT1dIQam.js → unrealscript-DlHhyJiH.js} +1 -1
- package/dist/app/assets/{uorazor-C4wimjxD.js → uorazor-DAgFaaw5.js} +1 -1
- package/dist/app/assets/{uri-D7oE-PoJ.js → uri-DAISB2-y.js} +1 -1
- package/dist/app/assets/{v-DwJtB8Vm.js → v-BI1fSl4s.js} +1 -1
- package/dist/app/assets/{vala-D0mTgP2k.js → vala-B0O9FrwQ.js} +1 -1
- package/dist/app/assets/{vbnet-BJfu6o8X.js → vbnet-C8BBfsv6.js} +1 -1
- package/dist/app/assets/{velocity-BJB5m8fQ.js → velocity-DxEPgCJp.js} +1 -1
- package/dist/app/assets/{vennDiagram-DHZGUBPP-Cgb8-zyn.js → vennDiagram-DHZGUBPP-ByTJSjE_.js} +1 -1
- package/dist/app/assets/{verilog-Ci2D8dFC.js → verilog-thVOd-Xa.js} +1 -1
- package/dist/app/assets/{vhdl-DcEoROdo.js → vhdl-92ZsOrFg.js} +1 -1
- package/dist/app/assets/{vim-BzWQ6rL0.js → vim-WSNLk7dA.js} +1 -1
- package/dist/app/assets/{visual-basic-C9jUzYfG.js → visual-basic-C47_Fl8T.js} +1 -1
- package/dist/app/assets/{wardley-RL74JXVD-Btw_ODEd.js → wardley-RL74JXVD-wQHV1kk0.js} +1 -1
- package/dist/app/assets/{wardleyDiagram-NUSXRM2D-B84YCqkj.js → wardleyDiagram-NUSXRM2D-DDdoQZLn.js} +1 -1
- package/dist/app/assets/{warpscript-BVhze8vt.js → warpscript-CauvLjrk.js} +1 -1
- package/dist/app/assets/{wasm-zAS-bEPo.js → wasm-DieX6uKz.js} +1 -1
- package/dist/app/assets/{web-idl-G3r7q-fK.js → web-idl-GqldvVwc.js} +1 -1
- package/dist/app/assets/{wiki-exG7pUTP.js → wiki-D070zFKu.js} +1 -1
- package/dist/app/assets/{wolfram-C_Mj1MJG.js → wolfram-COSn3nGG.js} +1 -1
- package/dist/app/assets/{wren-CdV44Tnx.js → wren-Cs5-Z4d-.js} +1 -1
- package/dist/app/assets/{xeora-2KKn4X5q.js → xeora-Dblnaflg.js} +1 -1
- package/dist/app/assets/{xml-doc-DLPYHfMi.js → xml-doc-Cw5SW8IO.js} +1 -1
- package/dist/app/assets/{xojo-B6ggSUBg.js → xojo-BOGyzB1N.js} +1 -1
- package/dist/app/assets/{xquery-B2tHFdf8.js → xquery-Dss_lg3A.js} +1 -1
- package/dist/app/assets/{xychartDiagram-5P7HB3ND-CWuLJaAz.js → xychartDiagram-5P7HB3ND-B6sz9HXS.js} +1 -1
- package/dist/app/assets/{yaml-BkS8H31d.js → yaml-BX2rP5GJ.js} +1 -1
- package/dist/app/assets/{yang-DT_nuuZI.js → yang-CIW2FsLC.js} +1 -1
- package/dist/app/assets/{zig-B0zYSJvR.js → zig-DqhZPLNT.js} +1 -1
- package/dist/app/index.html +2 -2
- package/dist/index.cjs +1750 -893
- package/dist/index.d.cts +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.js +1755 -898
- package/package.json +3 -3
- package/dist/app/assets/channel-DYgM_zKD.js +0 -1
- package/dist/app/assets/classDiagram-6PBFFD2Q-G-7-i5lY.js +0 -1
- package/dist/app/assets/classDiagram-v2-HSJHXN6E-G-7-i5lY.js +0 -1
- package/dist/app/assets/clone-4Dzzc8I_.js +0 -1
- package/dist/app/assets/index-E0F-_Dk8.css +0 -1
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-DrNQuVcu.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 React51 = __toESM(require("react"), 1);
|
|
71
|
+
var import_lucide_react30 = require("lucide-react");
|
|
72
72
|
|
|
73
73
|
// src/lib/utils.ts
|
|
74
74
|
var import_clsx = require("clsx");
|
|
@@ -742,6 +742,9 @@ function ParentMessengerProvider({
|
|
|
742
742
|
const onSetComposerValueHandlersRef = (0, import_react.useRef)(
|
|
743
743
|
/* @__PURE__ */ new Set()
|
|
744
744
|
);
|
|
745
|
+
const onSetRuntimeCapabilitiesHandlersRef = (0, import_react.useRef)(
|
|
746
|
+
/* @__PURE__ */ new Set()
|
|
747
|
+
);
|
|
745
748
|
const onFocusComposerHandlersRef = (0, import_react.useRef)(/* @__PURE__ */ new Set());
|
|
746
749
|
const latestOptionsRef = (0, import_react.useRef)(null);
|
|
747
750
|
const isParentAvailable = (0, import_react.useMemo)(() => {
|
|
@@ -774,6 +777,15 @@ function ParentMessengerProvider({
|
|
|
774
777
|
},
|
|
775
778
|
[]
|
|
776
779
|
);
|
|
780
|
+
const registerOnSetRuntimeCapabilities = (0, import_react.useCallback)(
|
|
781
|
+
(handler) => {
|
|
782
|
+
onSetRuntimeCapabilitiesHandlersRef.current.add(handler);
|
|
783
|
+
return () => {
|
|
784
|
+
onSetRuntimeCapabilitiesHandlersRef.current.delete(handler);
|
|
785
|
+
};
|
|
786
|
+
},
|
|
787
|
+
[]
|
|
788
|
+
);
|
|
777
789
|
const registerOnFocusComposer = (0, import_react.useCallback)(
|
|
778
790
|
(handler) => {
|
|
779
791
|
onFocusComposerHandlersRef.current.add(handler);
|
|
@@ -898,6 +910,23 @@ function ParentMessengerProvider({
|
|
|
898
910
|
});
|
|
899
911
|
return;
|
|
900
912
|
}
|
|
913
|
+
if (payload.type === "command" && payload.command === "onSetRuntimeCapabilities") {
|
|
914
|
+
const selection = isRuntimeCapabilitiesSelection(payload.data) ? payload.data : null;
|
|
915
|
+
void Promise.all(
|
|
916
|
+
[...onSetRuntimeCapabilitiesHandlersRef.current].map(
|
|
917
|
+
(handler2) => Promise.resolve(handler2(selection))
|
|
918
|
+
)
|
|
919
|
+
).then(() => {
|
|
920
|
+
if (payload.nonce) {
|
|
921
|
+
sendResponse(payload.nonce, { ok: true });
|
|
922
|
+
}
|
|
923
|
+
}).catch((error) => {
|
|
924
|
+
if (payload.nonce) {
|
|
925
|
+
sendResponse(payload.nonce, void 0, error);
|
|
926
|
+
}
|
|
927
|
+
});
|
|
928
|
+
return;
|
|
929
|
+
}
|
|
901
930
|
if (payload.type === "command" && payload.command === "onSetOptions") {
|
|
902
931
|
latestOptionsRef.current = payload.data ?? null;
|
|
903
932
|
if (onSetOptionsHandlersRef.current.size > 0) {
|
|
@@ -1019,6 +1048,7 @@ function ParentMessengerProvider({
|
|
|
1019
1048
|
registerOnSetOptions,
|
|
1020
1049
|
registerOnSetPetEnabled,
|
|
1021
1050
|
registerOnSetComposerValue,
|
|
1051
|
+
registerOnSetRuntimeCapabilities,
|
|
1022
1052
|
registerOnFocusComposer
|
|
1023
1053
|
}),
|
|
1024
1054
|
[
|
|
@@ -1028,6 +1058,7 @@ function ParentMessengerProvider({
|
|
|
1028
1058
|
registerOnSetOptions,
|
|
1029
1059
|
registerOnSetPetEnabled,
|
|
1030
1060
|
registerOnSetComposerValue,
|
|
1061
|
+
registerOnSetRuntimeCapabilities,
|
|
1031
1062
|
registerOnFocusComposer
|
|
1032
1063
|
]
|
|
1033
1064
|
);
|
|
@@ -1039,6 +1070,7 @@ function useParentMessenger({
|
|
|
1039
1070
|
onSetOptions,
|
|
1040
1071
|
onSetPetEnabled,
|
|
1041
1072
|
onSetComposerValue,
|
|
1073
|
+
onSetRuntimeCapabilities,
|
|
1042
1074
|
onFocusComposer
|
|
1043
1075
|
} = {}) {
|
|
1044
1076
|
const context = (0, import_react2.useContext)(ParentMessengerContext);
|
|
@@ -1051,12 +1083,14 @@ function useParentMessenger({
|
|
|
1051
1083
|
registerOnSetOptions,
|
|
1052
1084
|
registerOnSetPetEnabled,
|
|
1053
1085
|
registerOnSetComposerValue,
|
|
1086
|
+
registerOnSetRuntimeCapabilities,
|
|
1054
1087
|
registerOnFocusComposer,
|
|
1055
1088
|
...messenger
|
|
1056
1089
|
} = context;
|
|
1057
1090
|
const onSetOptionsRef = (0, import_react2.useRef)(onSetOptions);
|
|
1058
1091
|
const onSetPetEnabledRef = (0, import_react2.useRef)(onSetPetEnabled);
|
|
1059
1092
|
const onSetComposerValueRef = (0, import_react2.useRef)(onSetComposerValue);
|
|
1093
|
+
const onSetRuntimeCapabilitiesRef = (0, import_react2.useRef)(onSetRuntimeCapabilities);
|
|
1060
1094
|
const onFocusComposerRef = (0, import_react2.useRef)(onFocusComposer);
|
|
1061
1095
|
(0, import_react2.useEffect)(() => {
|
|
1062
1096
|
onSetOptionsRef.current = onSetOptions;
|
|
@@ -1067,12 +1101,16 @@ function useParentMessenger({
|
|
|
1067
1101
|
(0, import_react2.useEffect)(() => {
|
|
1068
1102
|
onSetComposerValueRef.current = onSetComposerValue;
|
|
1069
1103
|
}, [onSetComposerValue]);
|
|
1104
|
+
(0, import_react2.useEffect)(() => {
|
|
1105
|
+
onSetRuntimeCapabilitiesRef.current = onSetRuntimeCapabilities;
|
|
1106
|
+
}, [onSetRuntimeCapabilities]);
|
|
1070
1107
|
(0, import_react2.useEffect)(() => {
|
|
1071
1108
|
onFocusComposerRef.current = onFocusComposer;
|
|
1072
1109
|
}, [onFocusComposer]);
|
|
1073
1110
|
const hasOnSetOptions = Boolean(onSetOptions);
|
|
1074
1111
|
const hasOnSetPetEnabled = Boolean(onSetPetEnabled);
|
|
1075
1112
|
const hasOnSetComposerValue = Boolean(onSetComposerValue);
|
|
1113
|
+
const hasOnSetRuntimeCapabilities = Boolean(onSetRuntimeCapabilities);
|
|
1076
1114
|
const hasOnFocusComposer = Boolean(onFocusComposer);
|
|
1077
1115
|
(0, import_react2.useEffect)(() => {
|
|
1078
1116
|
if (!hasOnSetOptions) return;
|
|
@@ -1095,6 +1133,13 @@ function useParentMessenger({
|
|
|
1095
1133
|
};
|
|
1096
1134
|
return registerOnSetComposerValue(handler);
|
|
1097
1135
|
}, [hasOnSetComposerValue, registerOnSetComposerValue]);
|
|
1136
|
+
(0, import_react2.useEffect)(() => {
|
|
1137
|
+
if (!hasOnSetRuntimeCapabilities) return;
|
|
1138
|
+
const handler = (selection) => {
|
|
1139
|
+
onSetRuntimeCapabilitiesRef.current?.(selection);
|
|
1140
|
+
};
|
|
1141
|
+
return registerOnSetRuntimeCapabilities(handler);
|
|
1142
|
+
}, [hasOnSetRuntimeCapabilities, registerOnSetRuntimeCapabilities]);
|
|
1098
1143
|
(0, import_react2.useEffect)(() => {
|
|
1099
1144
|
if (!hasOnFocusComposer) return;
|
|
1100
1145
|
const handler = () => {
|
|
@@ -1680,6 +1725,21 @@ var en_US_default = {
|
|
|
1680
1725
|
loading: "Loading",
|
|
1681
1726
|
thinking: "Thinking",
|
|
1682
1727
|
answering: "Answering",
|
|
1728
|
+
navigation: {
|
|
1729
|
+
label: "Message navigation",
|
|
1730
|
+
system: "System",
|
|
1731
|
+
tool: "Tool",
|
|
1732
|
+
event: "Event",
|
|
1733
|
+
message: "Message",
|
|
1734
|
+
image: "Image",
|
|
1735
|
+
memory: "Memory",
|
|
1736
|
+
widget: "Widget",
|
|
1737
|
+
mcpApp: "MCP App",
|
|
1738
|
+
attachment: "Attachment",
|
|
1739
|
+
reference: "Reference",
|
|
1740
|
+
capability: "Capability",
|
|
1741
|
+
moreTags: "+{{count}}"
|
|
1742
|
+
},
|
|
1683
1743
|
mcpApp: {
|
|
1684
1744
|
loading: "Loading MCP App"
|
|
1685
1745
|
},
|
|
@@ -2073,6 +2133,21 @@ var zh_CN_default = {
|
|
|
2073
2133
|
loading: "\u6B63\u5728\u52A0\u8F7D",
|
|
2074
2134
|
thinking: "\u6B63\u5728\u601D\u8003",
|
|
2075
2135
|
answering: "\u6B63\u5728\u751F\u6210",
|
|
2136
|
+
navigation: {
|
|
2137
|
+
label: "\u6D88\u606F\u5BFC\u822A",
|
|
2138
|
+
system: "\u7CFB\u7EDF",
|
|
2139
|
+
tool: "\u5DE5\u5177",
|
|
2140
|
+
event: "\u4E8B\u4EF6",
|
|
2141
|
+
message: "\u6D88\u606F",
|
|
2142
|
+
image: "\u56FE\u7247",
|
|
2143
|
+
memory: "\u8BB0\u5FC6",
|
|
2144
|
+
widget: "\u7EC4\u4EF6",
|
|
2145
|
+
mcpApp: "MCP App",
|
|
2146
|
+
attachment: "\u9644\u4EF6",
|
|
2147
|
+
reference: "\u5F15\u7528",
|
|
2148
|
+
capability: "\u80FD\u529B",
|
|
2149
|
+
moreTags: "+{{count}}"
|
|
2150
|
+
},
|
|
2076
2151
|
mcpApp: {
|
|
2077
2152
|
loading: "\u6B63\u5728\u52A0\u8F7D MCP App"
|
|
2078
2153
|
},
|
|
@@ -13125,10 +13200,179 @@ function AssistantMessage({
|
|
|
13125
13200
|
] });
|
|
13126
13201
|
}
|
|
13127
13202
|
|
|
13128
|
-
// src/components/thread/
|
|
13203
|
+
// src/components/thread/MessageNavigator.tsx
|
|
13129
13204
|
var React37 = __toESM(require("react"), 1);
|
|
13130
|
-
var import_lucide_react25 = require("lucide-react");
|
|
13131
13205
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
13206
|
+
var ACTIVE_OFFSET_PX = 12;
|
|
13207
|
+
function getMarkerWidthClass(index, active, interactionIndex) {
|
|
13208
|
+
if (interactionIndex >= 0) {
|
|
13209
|
+
const distance = Math.abs(index - interactionIndex);
|
|
13210
|
+
if (distance === 0) return "w-7";
|
|
13211
|
+
if (distance === 1) return "w-5";
|
|
13212
|
+
if (distance === 2) return "w-3.5";
|
|
13213
|
+
return "w-2";
|
|
13214
|
+
}
|
|
13215
|
+
return active ? "w-5" : "w-2";
|
|
13216
|
+
}
|
|
13217
|
+
function getAnchorTop(viewport, anchor) {
|
|
13218
|
+
return anchor.offsetTop - viewport.offsetTop;
|
|
13219
|
+
}
|
|
13220
|
+
function resolveActiveItemId(items, viewport, getAnchor) {
|
|
13221
|
+
if (!viewport || items.length === 0) return null;
|
|
13222
|
+
const targetTop = viewport.scrollTop + ACTIVE_OFFSET_PX;
|
|
13223
|
+
let activeId = items[0]?.id ?? null;
|
|
13224
|
+
for (const item of items) {
|
|
13225
|
+
const anchor = getAnchor(item);
|
|
13226
|
+
if (!anchor) continue;
|
|
13227
|
+
if (getAnchorTop(viewport, anchor) <= targetTop) {
|
|
13228
|
+
activeId = item.id;
|
|
13229
|
+
continue;
|
|
13230
|
+
}
|
|
13231
|
+
break;
|
|
13232
|
+
}
|
|
13233
|
+
return activeId;
|
|
13234
|
+
}
|
|
13235
|
+
function scrollToAnchor(viewport, anchor) {
|
|
13236
|
+
const top = Math.max(0, getAnchorTop(viewport, anchor) - ACTIVE_OFFSET_PX);
|
|
13237
|
+
if (typeof viewport.scrollTo === "function") {
|
|
13238
|
+
viewport.scrollTo({ top, behavior: "smooth" });
|
|
13239
|
+
return;
|
|
13240
|
+
}
|
|
13241
|
+
viewport.scrollTop = top;
|
|
13242
|
+
}
|
|
13243
|
+
function MessageNavigator({
|
|
13244
|
+
items,
|
|
13245
|
+
viewportRef,
|
|
13246
|
+
getAnchor,
|
|
13247
|
+
onNavigate,
|
|
13248
|
+
className,
|
|
13249
|
+
label,
|
|
13250
|
+
tagsOverflowLabel
|
|
13251
|
+
}) {
|
|
13252
|
+
const [hoveredId, setHoveredId] = React37.useState(null);
|
|
13253
|
+
const [focusedId, setFocusedId] = React37.useState(null);
|
|
13254
|
+
const [activeId, setActiveId] = React37.useState(null);
|
|
13255
|
+
const updateActiveItem = React37.useCallback(() => {
|
|
13256
|
+
const viewport = viewportRef.current;
|
|
13257
|
+
setActiveId(resolveActiveItemId(items, viewport, getAnchor));
|
|
13258
|
+
}, [getAnchor, items, viewportRef]);
|
|
13259
|
+
React37.useLayoutEffect(() => {
|
|
13260
|
+
updateActiveItem();
|
|
13261
|
+
}, [updateActiveItem]);
|
|
13262
|
+
React37.useEffect(() => {
|
|
13263
|
+
const viewport = viewportRef.current;
|
|
13264
|
+
if (!viewport) return;
|
|
13265
|
+
let frame = null;
|
|
13266
|
+
const scheduleUpdate = () => {
|
|
13267
|
+
if (frame !== null) return;
|
|
13268
|
+
frame = requestAnimationFrame(() => {
|
|
13269
|
+
frame = null;
|
|
13270
|
+
updateActiveItem();
|
|
13271
|
+
});
|
|
13272
|
+
};
|
|
13273
|
+
viewport.addEventListener("scroll", scheduleUpdate, { passive: true });
|
|
13274
|
+
window.addEventListener("resize", scheduleUpdate, { passive: true });
|
|
13275
|
+
const resizeObserver = typeof ResizeObserver !== "undefined" ? new ResizeObserver(scheduleUpdate) : null;
|
|
13276
|
+
resizeObserver?.observe(viewport);
|
|
13277
|
+
return () => {
|
|
13278
|
+
if (frame !== null) {
|
|
13279
|
+
cancelAnimationFrame(frame);
|
|
13280
|
+
}
|
|
13281
|
+
viewport.removeEventListener("scroll", scheduleUpdate);
|
|
13282
|
+
window.removeEventListener("resize", scheduleUpdate);
|
|
13283
|
+
resizeObserver?.disconnect();
|
|
13284
|
+
};
|
|
13285
|
+
}, [updateActiveItem, viewportRef]);
|
|
13286
|
+
const handleNavigate = React37.useCallback(
|
|
13287
|
+
(item) => {
|
|
13288
|
+
const viewport = viewportRef.current;
|
|
13289
|
+
const anchor = getAnchor(item);
|
|
13290
|
+
if (!viewport || !anchor) return;
|
|
13291
|
+
onNavigate?.();
|
|
13292
|
+
scrollToAnchor(viewport, anchor);
|
|
13293
|
+
setActiveId(item.id);
|
|
13294
|
+
},
|
|
13295
|
+
[getAnchor, onNavigate, viewportRef]
|
|
13296
|
+
);
|
|
13297
|
+
if (items.length === 0) return null;
|
|
13298
|
+
const interactionId = focusedId ?? hoveredId;
|
|
13299
|
+
const interactionIndex = interactionId ? items.findIndex((item) => item.id === interactionId) : -1;
|
|
13300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
13301
|
+
"nav",
|
|
13302
|
+
{
|
|
13303
|
+
"aria-label": label,
|
|
13304
|
+
className: cn(
|
|
13305
|
+
"pointer-events-none sticky top-16 z-20 hidden h-0 w-0 shrink-0 self-start md:block",
|
|
13306
|
+
className
|
|
13307
|
+
),
|
|
13308
|
+
"data-slot": "chatkit-message-navigator",
|
|
13309
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "group/nav relative h-[calc(100vh-9rem)] w-12", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "absolute left-2 top-1/2 flex max-h-full w-10 -translate-y-1/2 flex-col gap-0.5 py-1", children: items.map((item, index) => {
|
|
13310
|
+
const isActive = item.id === activeId;
|
|
13311
|
+
const isPreviewed = item.id === hoveredId || item.id === focusedId;
|
|
13312
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "relative h-3.5 w-10 shrink-0", children: [
|
|
13313
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
13314
|
+
"button",
|
|
13315
|
+
{
|
|
13316
|
+
type: "button",
|
|
13317
|
+
"aria-label": `${item.title}: ${item.preview}`,
|
|
13318
|
+
"aria-current": isActive ? "location" : void 0,
|
|
13319
|
+
className: cn(
|
|
13320
|
+
"pointer-events-auto flex h-3.5 w-10 items-center justify-start rounded-sm outline-none",
|
|
13321
|
+
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
|
|
13322
|
+
),
|
|
13323
|
+
onClick: () => handleNavigate(item),
|
|
13324
|
+
onMouseEnter: () => setHoveredId(item.id),
|
|
13325
|
+
onMouseLeave: () => setHoveredId((id) => id === item.id ? null : id),
|
|
13326
|
+
onFocus: () => setFocusedId(item.id),
|
|
13327
|
+
onBlur: () => setFocusedId((id) => id === item.id ? null : id),
|
|
13328
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
13329
|
+
"span",
|
|
13330
|
+
{
|
|
13331
|
+
className: cn(
|
|
13332
|
+
"block h-0.5 rounded-full bg-muted-foreground/25 transition-all duration-150",
|
|
13333
|
+
getMarkerWidthClass(index, isActive, interactionIndex),
|
|
13334
|
+
isActive && "bg-foreground",
|
|
13335
|
+
isPreviewed && "bg-foreground",
|
|
13336
|
+
interactionIndex >= 0 && !isActive && !isPreviewed && "bg-muted-foreground/35"
|
|
13337
|
+
)
|
|
13338
|
+
}
|
|
13339
|
+
)
|
|
13340
|
+
}
|
|
13341
|
+
),
|
|
13342
|
+
isPreviewed && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
13343
|
+
"div",
|
|
13344
|
+
{
|
|
13345
|
+
className: cn(
|
|
13346
|
+
"pointer-events-none absolute left-9 top-1/2 z-30 w-80 max-w-[min(20rem,calc(100vw-6rem))] -translate-y-1/2",
|
|
13347
|
+
"rounded-lg border border-border bg-background/95 p-3 text-left shadow-xl backdrop-blur"
|
|
13348
|
+
),
|
|
13349
|
+
children: [
|
|
13350
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "mb-1 truncate text-sm font-medium text-foreground", children: item.title }),
|
|
13351
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "line-clamp-2 text-sm leading-5 text-muted-foreground", children: item.preview }),
|
|
13352
|
+
item.tags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "mt-2 flex flex-wrap gap-1.5", children: [
|
|
13353
|
+
item.tags.slice(0, 3).map((tag) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
13354
|
+
"span",
|
|
13355
|
+
{
|
|
13356
|
+
className: "max-w-[8rem] truncate rounded-md bg-muted px-1.5 py-0.5 text-[11px] leading-4 text-muted-foreground",
|
|
13357
|
+
children: tag
|
|
13358
|
+
},
|
|
13359
|
+
tag
|
|
13360
|
+
)),
|
|
13361
|
+
item.tags.length > 3 && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "rounded-md bg-muted px-1.5 py-0.5 text-[11px] leading-4 text-muted-foreground", children: tagsOverflowLabel(item.tags.length - 3) })
|
|
13362
|
+
] })
|
|
13363
|
+
]
|
|
13364
|
+
}
|
|
13365
|
+
)
|
|
13366
|
+
] }, item.id);
|
|
13367
|
+
}) }) })
|
|
13368
|
+
}
|
|
13369
|
+
);
|
|
13370
|
+
}
|
|
13371
|
+
|
|
13372
|
+
// src/components/thread/MessageActions.tsx
|
|
13373
|
+
var React38 = __toESM(require("react"), 1);
|
|
13374
|
+
var import_lucide_react25 = require("lucide-react");
|
|
13375
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
13132
13376
|
function MessageActions({
|
|
13133
13377
|
content,
|
|
13134
13378
|
isAssistant = false,
|
|
@@ -13137,7 +13381,7 @@ function MessageActions({
|
|
|
13137
13381
|
className
|
|
13138
13382
|
}) {
|
|
13139
13383
|
const { t } = useChatkitTranslation();
|
|
13140
|
-
const [copied, setCopied] =
|
|
13384
|
+
const [copied, setCopied] = React38.useState(false);
|
|
13141
13385
|
const handleCopy = async () => {
|
|
13142
13386
|
try {
|
|
13143
13387
|
await navigator.clipboard.writeText(content);
|
|
@@ -13150,7 +13394,7 @@ function MessageActions({
|
|
|
13150
13394
|
if (isStreaming) {
|
|
13151
13395
|
return null;
|
|
13152
13396
|
}
|
|
13153
|
-
return /* @__PURE__ */ (0,
|
|
13397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
13154
13398
|
"div",
|
|
13155
13399
|
{
|
|
13156
13400
|
className: cn(
|
|
@@ -13158,7 +13402,7 @@ function MessageActions({
|
|
|
13158
13402
|
className
|
|
13159
13403
|
),
|
|
13160
13404
|
children: [
|
|
13161
|
-
/* @__PURE__ */ (0,
|
|
13405
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
13162
13406
|
"button",
|
|
13163
13407
|
{
|
|
13164
13408
|
type: "button",
|
|
@@ -13168,17 +13412,17 @@ function MessageActions({
|
|
|
13168
13412
|
copied && "text-green-500"
|
|
13169
13413
|
),
|
|
13170
13414
|
title: copied ? t("messageActions.copied") : t("messageActions.copy"),
|
|
13171
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
13415
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.Check, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.Copy, { size: 14 })
|
|
13172
13416
|
}
|
|
13173
13417
|
),
|
|
13174
|
-
isAssistant && onRetry && /* @__PURE__ */ (0,
|
|
13418
|
+
isAssistant && onRetry && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
13175
13419
|
"button",
|
|
13176
13420
|
{
|
|
13177
13421
|
type: "button",
|
|
13178
13422
|
onClick: onRetry,
|
|
13179
13423
|
className: "p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",
|
|
13180
13424
|
title: t("messageActions.regenerate"),
|
|
13181
|
-
children: /* @__PURE__ */ (0,
|
|
13425
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.RefreshCw, { size: 14 })
|
|
13182
13426
|
}
|
|
13183
13427
|
)
|
|
13184
13428
|
]
|
|
@@ -13187,20 +13431,20 @@ function MessageActions({
|
|
|
13187
13431
|
}
|
|
13188
13432
|
|
|
13189
13433
|
// src/components/thread/StartScreen.tsx
|
|
13190
|
-
var
|
|
13434
|
+
var React39 = require("react");
|
|
13191
13435
|
var import_lucide_react26 = require("lucide-react");
|
|
13192
|
-
var
|
|
13436
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
13193
13437
|
function getIconComponent2(icon) {
|
|
13194
13438
|
const iconMap = {
|
|
13195
|
-
"circle-question": /* @__PURE__ */ (0,
|
|
13196
|
-
"lightbulb": /* @__PURE__ */ (0,
|
|
13197
|
-
"sparkle": /* @__PURE__ */ (0,
|
|
13198
|
-
"write": /* @__PURE__ */ (0,
|
|
13199
|
-
"search": /* @__PURE__ */ (0,
|
|
13200
|
-
"globe": /* @__PURE__ */ (0,
|
|
13201
|
-
"book-open": /* @__PURE__ */ (0,
|
|
13202
|
-
"compass": /* @__PURE__ */ (0,
|
|
13203
|
-
"bolt": /* @__PURE__ */ (0,
|
|
13439
|
+
"circle-question": /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react26.HelpCircle, { size: 20 }),
|
|
13440
|
+
"lightbulb": /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react26.Lightbulb, { size: 20 }),
|
|
13441
|
+
"sparkle": /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react26.Sparkles, { size: 20 }),
|
|
13442
|
+
"write": /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react26.Pencil, { size: 20 }),
|
|
13443
|
+
"search": /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react26.Search, { size: 20 }),
|
|
13444
|
+
"globe": /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react26.Globe, { size: 20 }),
|
|
13445
|
+
"book-open": /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react26.BookOpen, { size: 20 }),
|
|
13446
|
+
"compass": /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react26.Compass, { size: 20 }),
|
|
13447
|
+
"bolt": /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react26.Zap, { size: 20 })
|
|
13204
13448
|
};
|
|
13205
13449
|
return icon ? iconMap[icon] || iconMap["sparkle"] : iconMap["sparkle"];
|
|
13206
13450
|
}
|
|
@@ -13216,7 +13460,7 @@ function StartScreen({
|
|
|
13216
13460
|
const greeting = startScreen?.greeting ?? t("startScreen.greeting");
|
|
13217
13461
|
const prompts = startScreen?.prompts ?? [];
|
|
13218
13462
|
const editPromptLabel = t("startScreen.editPrompt");
|
|
13219
|
-
return /* @__PURE__ */ (0,
|
|
13463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
13220
13464
|
"div",
|
|
13221
13465
|
{
|
|
13222
13466
|
className: cn(
|
|
@@ -13224,8 +13468,8 @@ function StartScreen({
|
|
|
13224
13468
|
className
|
|
13225
13469
|
),
|
|
13226
13470
|
children: [
|
|
13227
|
-
/* @__PURE__ */ (0,
|
|
13228
|
-
prompts.length > 0 && /* @__PURE__ */ (0,
|
|
13471
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "mb-8 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-2", children: greeting }) }),
|
|
13472
|
+
prompts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "w-full max-w-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: prompts.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
13229
13473
|
"div",
|
|
13230
13474
|
{
|
|
13231
13475
|
className: cn(
|
|
@@ -13234,7 +13478,7 @@ function StartScreen({
|
|
|
13234
13478
|
"focus-within:ring-2 focus-within:ring-primary/20"
|
|
13235
13479
|
),
|
|
13236
13480
|
children: [
|
|
13237
|
-
/* @__PURE__ */ (0,
|
|
13481
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
13238
13482
|
"button",
|
|
13239
13483
|
{
|
|
13240
13484
|
type: "button",
|
|
@@ -13245,12 +13489,12 @@ function StartScreen({
|
|
|
13245
13489
|
"focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
|
|
13246
13490
|
),
|
|
13247
13491
|
children: [
|
|
13248
|
-
/* @__PURE__ */ (0,
|
|
13249
|
-
/* @__PURE__ */ (0,
|
|
13492
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.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) }),
|
|
13493
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "text-sm font-medium text-foreground", children: item.label })
|
|
13250
13494
|
]
|
|
13251
13495
|
}
|
|
13252
13496
|
),
|
|
13253
|
-
/* @__PURE__ */ (0,
|
|
13497
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
13254
13498
|
"button",
|
|
13255
13499
|
{
|
|
13256
13500
|
type: "button",
|
|
@@ -13263,7 +13507,7 @@ function StartScreen({
|
|
|
13263
13507
|
"rounded-r-xl transition-colors hover:bg-muted hover:text-foreground",
|
|
13264
13508
|
"focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
|
|
13265
13509
|
),
|
|
13266
|
-
children: /* @__PURE__ */ (0,
|
|
13510
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react26.Pencil, { size: 16 })
|
|
13267
13511
|
}
|
|
13268
13512
|
)
|
|
13269
13513
|
]
|
|
@@ -13276,7 +13520,7 @@ function StartScreen({
|
|
|
13276
13520
|
}
|
|
13277
13521
|
|
|
13278
13522
|
// src/hooks/useThreads.ts
|
|
13279
|
-
var
|
|
13523
|
+
var React40 = __toESM(require("react"), 1);
|
|
13280
13524
|
var DEFAULT_LIMIT = 50;
|
|
13281
13525
|
var getThreadTitle = (threadRecord) => {
|
|
13282
13526
|
const title = threadRecord.title?.trim();
|
|
@@ -13329,16 +13573,16 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
13329
13573
|
isLoading: isStreamLoading,
|
|
13330
13574
|
error: streamError
|
|
13331
13575
|
} = useStreamContext();
|
|
13332
|
-
const [threadRecords, setThreadRecords] =
|
|
13333
|
-
const [isLoading, setIsLoading] =
|
|
13334
|
-
const [error, setError] =
|
|
13335
|
-
const upsertThreadRecord =
|
|
13576
|
+
const [threadRecords, setThreadRecords] = React40.useState([]);
|
|
13577
|
+
const [isLoading, setIsLoading] = React40.useState(false);
|
|
13578
|
+
const [error, setError] = React40.useState(null);
|
|
13579
|
+
const upsertThreadRecord = React40.useCallback((threadRecord) => {
|
|
13336
13580
|
setThreadRecords((prev) => {
|
|
13337
13581
|
const next = prev.filter((item) => item.id !== threadRecord.id);
|
|
13338
13582
|
return sortThreadRecords([threadRecord, ...next]);
|
|
13339
13583
|
});
|
|
13340
13584
|
}, []);
|
|
13341
|
-
const refreshThreads =
|
|
13585
|
+
const refreshThreads = React40.useCallback(async () => {
|
|
13342
13586
|
setIsLoading(true);
|
|
13343
13587
|
setError(null);
|
|
13344
13588
|
try {
|
|
@@ -13354,7 +13598,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
13354
13598
|
setIsLoading(false);
|
|
13355
13599
|
}
|
|
13356
13600
|
}, [client, limit, assistantId]);
|
|
13357
|
-
const createThread =
|
|
13601
|
+
const createThread = React40.useCallback(
|
|
13358
13602
|
async (input) => {
|
|
13359
13603
|
setError(null);
|
|
13360
13604
|
const payload = {};
|
|
@@ -13368,7 +13612,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
13368
13612
|
},
|
|
13369
13613
|
[client, upsertThreadRecord]
|
|
13370
13614
|
);
|
|
13371
|
-
const updateThread =
|
|
13615
|
+
const updateThread = React40.useCallback(
|
|
13372
13616
|
async (recordId, payload) => {
|
|
13373
13617
|
setError(null);
|
|
13374
13618
|
const updated = await client.conversations.update(recordId, payload);
|
|
@@ -13377,7 +13621,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
13377
13621
|
},
|
|
13378
13622
|
[client, upsertThreadRecord]
|
|
13379
13623
|
);
|
|
13380
|
-
const deleteThread =
|
|
13624
|
+
const deleteThread = React40.useCallback(
|
|
13381
13625
|
async (recordId) => {
|
|
13382
13626
|
setError(null);
|
|
13383
13627
|
await client.conversations.delete(recordId);
|
|
@@ -13385,11 +13629,11 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
13385
13629
|
},
|
|
13386
13630
|
[client]
|
|
13387
13631
|
);
|
|
13388
|
-
|
|
13632
|
+
React40.useEffect(() => {
|
|
13389
13633
|
if (!isReady) return;
|
|
13390
13634
|
void refreshThreads();
|
|
13391
13635
|
}, [refreshThreads, isReady]);
|
|
13392
|
-
|
|
13636
|
+
React40.useEffect(() => {
|
|
13393
13637
|
if (!threadId || !isStreamLoading) return;
|
|
13394
13638
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
13395
13639
|
const busyStatus = "busy";
|
|
@@ -13410,7 +13654,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
13410
13654
|
return changed ? sortThreadRecords(next) : prev;
|
|
13411
13655
|
});
|
|
13412
13656
|
}, [threadId, isStreamLoading]);
|
|
13413
|
-
|
|
13657
|
+
React40.useEffect(() => {
|
|
13414
13658
|
const message = getErrorMessage2(streamError)?.trim();
|
|
13415
13659
|
if (!threadId || !message) return;
|
|
13416
13660
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -13432,7 +13676,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
13432
13676
|
return changed ? sortThreadRecords(next) : prev;
|
|
13433
13677
|
});
|
|
13434
13678
|
}, [threadId, streamError]);
|
|
13435
|
-
|
|
13679
|
+
React40.useEffect(() => {
|
|
13436
13680
|
if (!isReady || !threadId || isStreamLoading) return;
|
|
13437
13681
|
let cancelled = false;
|
|
13438
13682
|
void client.conversations.search({ where: { threadId }, limit: 1 }).then((result) => {
|
|
@@ -13446,7 +13690,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
13446
13690
|
cancelled = true;
|
|
13447
13691
|
};
|
|
13448
13692
|
}, [client, threadId, upsertThreadRecord, isReady, isStreamLoading]);
|
|
13449
|
-
const threads =
|
|
13693
|
+
const threads = React40.useMemo(
|
|
13450
13694
|
() => threadRecords.map((threadRecord) => toThreadItem(threadRecord)),
|
|
13451
13695
|
[threadRecords]
|
|
13452
13696
|
);
|
|
@@ -13463,10 +13707,10 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
13463
13707
|
}
|
|
13464
13708
|
|
|
13465
13709
|
// src/components/thread/context-usage-indicator.tsx
|
|
13466
|
-
var
|
|
13710
|
+
var React41 = __toESM(require("react"), 1);
|
|
13467
13711
|
|
|
13468
13712
|
// src/components/ui/progress-circle.tsx
|
|
13469
|
-
var
|
|
13713
|
+
var import_jsx_runtime46 = (
|
|
13470
13714
|
// biome-ignore lint/a11y/useFocusableInteractive: false positive (progress + progressbar are not focusable interactives)
|
|
13471
13715
|
// biome-ignore lint/nursery/useAriaPropsSupportedByRole: biome rule at odds with mdn docs (presumed nursary bug with rule)
|
|
13472
13716
|
require("react/jsx-runtime")
|
|
@@ -13490,7 +13734,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
13490
13734
|
fill: "none",
|
|
13491
13735
|
strokeWidth
|
|
13492
13736
|
};
|
|
13493
|
-
return /* @__PURE__ */ (0,
|
|
13737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
13494
13738
|
"svg",
|
|
13495
13739
|
{
|
|
13496
13740
|
role: "progressbar",
|
|
@@ -13501,8 +13745,8 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
13501
13745
|
"aria-valuemax": 100,
|
|
13502
13746
|
...restSvgProps,
|
|
13503
13747
|
children: [
|
|
13504
|
-
/* @__PURE__ */ (0,
|
|
13505
|
-
/* @__PURE__ */ (0,
|
|
13748
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("circle", { ...commonParams, className: "stroke-current/25" }),
|
|
13749
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
13506
13750
|
"circle",
|
|
13507
13751
|
{
|
|
13508
13752
|
...commonParams,
|
|
@@ -13520,7 +13764,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
13520
13764
|
};
|
|
13521
13765
|
|
|
13522
13766
|
// src/components/thread/context-usage-indicator.tsx
|
|
13523
|
-
var
|
|
13767
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
13524
13768
|
var kNumberFormatter = new Intl.NumberFormat("en-US", {
|
|
13525
13769
|
minimumFractionDigits: 0,
|
|
13526
13770
|
maximumFractionDigits: 1
|
|
@@ -13553,21 +13797,21 @@ function ContextUsageIndicator({
|
|
|
13553
13797
|
}) {
|
|
13554
13798
|
const { t } = useChatkitTranslation();
|
|
13555
13799
|
const stream = useStreamContext();
|
|
13556
|
-
const [maxContextSize, setMaxContextSize] =
|
|
13557
|
-
const [usedContextSize, setUsedContextSize] =
|
|
13558
|
-
const [assistantAgentKey, setAssistantAgentKey] =
|
|
13559
|
-
const latestRealtimeUsageRef =
|
|
13800
|
+
const [maxContextSize, setMaxContextSize] = React41.useState(null);
|
|
13801
|
+
const [usedContextSize, setUsedContextSize] = React41.useState(null);
|
|
13802
|
+
const [assistantAgentKey, setAssistantAgentKey] = React41.useState(null);
|
|
13803
|
+
const latestRealtimeUsageRef = React41.useRef({
|
|
13560
13804
|
threadId: null,
|
|
13561
13805
|
agentKey: null,
|
|
13562
13806
|
usedTokens: null
|
|
13563
13807
|
});
|
|
13564
|
-
const realtimeUsage =
|
|
13808
|
+
const realtimeUsage = React41.useMemo(
|
|
13565
13809
|
() => getThreadContextUsage(stream.contextUsageByAgentKey, assistantAgentKey),
|
|
13566
13810
|
[assistantAgentKey, stream.contextUsageByAgentKey]
|
|
13567
13811
|
);
|
|
13568
13812
|
const realtimeUsedContextSize = getThreadContextUsageTotalTokens(realtimeUsage);
|
|
13569
13813
|
const hasApiConfiguration = Boolean(stream.apiUrl?.trim() && stream.apiKey?.trim());
|
|
13570
|
-
|
|
13814
|
+
React41.useEffect(() => {
|
|
13571
13815
|
if (!hasApiConfiguration || !stream.client || !stream.assistantId) {
|
|
13572
13816
|
setMaxContextSize(null);
|
|
13573
13817
|
setAssistantAgentKey(null);
|
|
@@ -13587,18 +13831,18 @@ function ContextUsageIndicator({
|
|
|
13587
13831
|
cancelled = true;
|
|
13588
13832
|
};
|
|
13589
13833
|
}, [hasApiConfiguration, stream.client, stream.assistantId]);
|
|
13590
|
-
|
|
13834
|
+
React41.useEffect(() => {
|
|
13591
13835
|
latestRealtimeUsageRef.current = {
|
|
13592
13836
|
threadId: stream.threadId ?? null,
|
|
13593
13837
|
agentKey: assistantAgentKey,
|
|
13594
13838
|
usedTokens: realtimeUsedContextSize
|
|
13595
13839
|
};
|
|
13596
13840
|
}, [assistantAgentKey, realtimeUsedContextSize, stream.threadId]);
|
|
13597
|
-
|
|
13841
|
+
React41.useEffect(() => {
|
|
13598
13842
|
if (realtimeUsedContextSize == null) return;
|
|
13599
13843
|
setUsedContextSize(realtimeUsedContextSize);
|
|
13600
13844
|
}, [realtimeUsedContextSize]);
|
|
13601
|
-
|
|
13845
|
+
React41.useEffect(() => {
|
|
13602
13846
|
if (!hasApiConfiguration || !stream.client) {
|
|
13603
13847
|
setUsedContextSize(null);
|
|
13604
13848
|
return;
|
|
@@ -13664,8 +13908,8 @@ function ContextUsageIndicator({
|
|
|
13664
13908
|
});
|
|
13665
13909
|
const usageLabelWithSuffix = usageLabel.endsWith(":") ? usageLabel : `${usageLabel}:`;
|
|
13666
13910
|
const progressClassName = percent >= 90 ? "text-destructive" : percent >= 75 ? "text-amber-500" : "text-primary dark:text-zinc-300";
|
|
13667
|
-
return /* @__PURE__ */ (0,
|
|
13668
|
-
/* @__PURE__ */ (0,
|
|
13911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Tooltip, { children: [
|
|
13912
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
13669
13913
|
"button",
|
|
13670
13914
|
{
|
|
13671
13915
|
type: "button",
|
|
@@ -13674,31 +13918,31 @@ function ContextUsageIndicator({
|
|
|
13674
13918
|
className
|
|
13675
13919
|
),
|
|
13676
13920
|
"aria-label": `${usageLabelWithSuffix} ${usageFullLabel}. ${usageTokensLabel}`,
|
|
13677
|
-
children: /* @__PURE__ */ (0,
|
|
13921
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ProgressCircle, { value: percent, className: cn("size-3.5", progressClassName) })
|
|
13678
13922
|
}
|
|
13679
13923
|
) }),
|
|
13680
|
-
/* @__PURE__ */ (0,
|
|
13681
|
-
/* @__PURE__ */ (0,
|
|
13682
|
-
/* @__PURE__ */ (0,
|
|
13683
|
-
/* @__PURE__ */ (0,
|
|
13924
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(TooltipContent, { side: "top", sideOffset: 6, className: "space-y-0.5 px-3 py-2 text-center", children: [
|
|
13925
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "text-primary-foreground/70", children: usageLabelWithSuffix }),
|
|
13926
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "font-medium text-primary-foreground/80", children: usageFullLabel }),
|
|
13927
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "text-sm font-semibold", children: usageTokensLabel })
|
|
13684
13928
|
] })
|
|
13685
13929
|
] });
|
|
13686
13930
|
}
|
|
13687
13931
|
|
|
13688
13932
|
// src/components/pet/PetBridge.tsx
|
|
13689
|
-
var
|
|
13933
|
+
var React42 = __toESM(require("react"), 1);
|
|
13690
13934
|
var import_chatkit_types10 = require("@xpert-ai/chatkit-types");
|
|
13691
13935
|
function PetBridge({ pet, state }) {
|
|
13692
13936
|
const parentMessenger = useParentMessenger();
|
|
13693
13937
|
const sendEvent = parentMessenger?.sendEvent;
|
|
13694
|
-
const options =
|
|
13695
|
-
|
|
13938
|
+
const options = React42.useMemo(() => (0, import_chatkit_types10.normalizePetOptions)(pet), [pet]);
|
|
13939
|
+
React42.useEffect(() => {
|
|
13696
13940
|
if (!sendEvent) {
|
|
13697
13941
|
return;
|
|
13698
13942
|
}
|
|
13699
13943
|
sendEvent("pet_options_change", { pet: pet ?? null });
|
|
13700
13944
|
}, [sendEvent, pet]);
|
|
13701
|
-
|
|
13945
|
+
React42.useEffect(() => {
|
|
13702
13946
|
if (!sendEvent || !options) {
|
|
13703
13947
|
return;
|
|
13704
13948
|
}
|
|
@@ -13708,15 +13952,15 @@ function PetBridge({ pet, state }) {
|
|
|
13708
13952
|
}
|
|
13709
13953
|
|
|
13710
13954
|
// src/components/settings/SettingsSheet.tsx
|
|
13711
|
-
var
|
|
13955
|
+
var React49 = __toESM(require("react"), 1);
|
|
13712
13956
|
var import_lucide_react28 = require("lucide-react");
|
|
13713
13957
|
|
|
13714
13958
|
// src/components/ui/input.tsx
|
|
13715
|
-
var
|
|
13716
|
-
var
|
|
13717
|
-
var Input =
|
|
13959
|
+
var React43 = __toESM(require("react"), 1);
|
|
13960
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
13961
|
+
var Input = React43.forwardRef(
|
|
13718
13962
|
({ className, type, ...props }, ref) => {
|
|
13719
|
-
return /* @__PURE__ */ (0,
|
|
13963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13720
13964
|
"input",
|
|
13721
13965
|
{
|
|
13722
13966
|
ref,
|
|
@@ -13733,20 +13977,20 @@ var Input = React42.forwardRef(
|
|
|
13733
13977
|
Input.displayName = "Input";
|
|
13734
13978
|
|
|
13735
13979
|
// src/components/ui/select.tsx
|
|
13736
|
-
var
|
|
13980
|
+
var React44 = require("react");
|
|
13737
13981
|
var import_radix_ui2 = require("radix-ui");
|
|
13738
13982
|
var import_lucide_react27 = require("lucide-react");
|
|
13739
|
-
var
|
|
13983
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
13740
13984
|
function Select({
|
|
13741
13985
|
...props
|
|
13742
13986
|
}) {
|
|
13743
|
-
return /* @__PURE__ */ (0,
|
|
13987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_radix_ui2.Select.Root, { "data-slot": "select", ...props });
|
|
13744
13988
|
}
|
|
13745
13989
|
function SelectGroup({
|
|
13746
13990
|
className,
|
|
13747
13991
|
...props
|
|
13748
13992
|
}) {
|
|
13749
|
-
return /* @__PURE__ */ (0,
|
|
13993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13750
13994
|
import_radix_ui2.Select.Group,
|
|
13751
13995
|
{
|
|
13752
13996
|
"data-slot": "select-group",
|
|
@@ -13758,7 +14002,7 @@ function SelectGroup({
|
|
|
13758
14002
|
function SelectValue({
|
|
13759
14003
|
...props
|
|
13760
14004
|
}) {
|
|
13761
|
-
return /* @__PURE__ */ (0,
|
|
14005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_radix_ui2.Select.Value, { "data-slot": "select-value", ...props });
|
|
13762
14006
|
}
|
|
13763
14007
|
function SelectTrigger({
|
|
13764
14008
|
className,
|
|
@@ -13766,7 +14010,7 @@ function SelectTrigger({
|
|
|
13766
14010
|
children,
|
|
13767
14011
|
...props
|
|
13768
14012
|
}) {
|
|
13769
|
-
return /* @__PURE__ */ (0,
|
|
14013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
13770
14014
|
import_radix_ui2.Select.Trigger,
|
|
13771
14015
|
{
|
|
13772
14016
|
"data-slot": "select-trigger",
|
|
@@ -13778,7 +14022,7 @@ function SelectTrigger({
|
|
|
13778
14022
|
...props,
|
|
13779
14023
|
children: [
|
|
13780
14024
|
children,
|
|
13781
|
-
/* @__PURE__ */ (0,
|
|
14025
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_radix_ui2.Select.Icon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react27.ChevronDownIcon, { className: "pointer-events-none size-4 text-muted-foreground" }) })
|
|
13782
14026
|
]
|
|
13783
14027
|
}
|
|
13784
14028
|
);
|
|
@@ -13790,7 +14034,7 @@ function SelectContent({
|
|
|
13790
14034
|
align = "center",
|
|
13791
14035
|
...props
|
|
13792
14036
|
}) {
|
|
13793
|
-
return /* @__PURE__ */ (0,
|
|
14037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_radix_ui2.Select.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
13794
14038
|
import_radix_ui2.Select.Content,
|
|
13795
14039
|
{
|
|
13796
14040
|
"data-slot": "select-content",
|
|
@@ -13800,8 +14044,8 @@ function SelectContent({
|
|
|
13800
14044
|
align,
|
|
13801
14045
|
...props,
|
|
13802
14046
|
children: [
|
|
13803
|
-
/* @__PURE__ */ (0,
|
|
13804
|
-
/* @__PURE__ */ (0,
|
|
14047
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(SelectScrollUpButton, {}),
|
|
14048
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13805
14049
|
import_radix_ui2.Select.Viewport,
|
|
13806
14050
|
{
|
|
13807
14051
|
"data-position": position,
|
|
@@ -13812,7 +14056,7 @@ function SelectContent({
|
|
|
13812
14056
|
children
|
|
13813
14057
|
}
|
|
13814
14058
|
),
|
|
13815
|
-
/* @__PURE__ */ (0,
|
|
14059
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(SelectScrollDownButton, {})
|
|
13816
14060
|
]
|
|
13817
14061
|
}
|
|
13818
14062
|
) });
|
|
@@ -13822,7 +14066,7 @@ function SelectItem({
|
|
|
13822
14066
|
children,
|
|
13823
14067
|
...props
|
|
13824
14068
|
}) {
|
|
13825
|
-
return /* @__PURE__ */ (0,
|
|
14069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
13826
14070
|
import_radix_ui2.Select.Item,
|
|
13827
14071
|
{
|
|
13828
14072
|
"data-slot": "select-item",
|
|
@@ -13832,8 +14076,8 @@ function SelectItem({
|
|
|
13832
14076
|
),
|
|
13833
14077
|
...props,
|
|
13834
14078
|
children: [
|
|
13835
|
-
/* @__PURE__ */ (0,
|
|
13836
|
-
/* @__PURE__ */ (0,
|
|
14079
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_radix_ui2.Select.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react27.CheckIcon, { className: "pointer-events-none" }) }) }),
|
|
14080
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_radix_ui2.Select.ItemText, { children })
|
|
13837
14081
|
]
|
|
13838
14082
|
}
|
|
13839
14083
|
);
|
|
@@ -13842,7 +14086,7 @@ function SelectScrollUpButton({
|
|
|
13842
14086
|
className,
|
|
13843
14087
|
...props
|
|
13844
14088
|
}) {
|
|
13845
|
-
return /* @__PURE__ */ (0,
|
|
14089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13846
14090
|
import_radix_ui2.Select.ScrollUpButton,
|
|
13847
14091
|
{
|
|
13848
14092
|
"data-slot": "select-scroll-up-button",
|
|
@@ -13851,7 +14095,7 @@ function SelectScrollUpButton({
|
|
|
13851
14095
|
className
|
|
13852
14096
|
),
|
|
13853
14097
|
...props,
|
|
13854
|
-
children: /* @__PURE__ */ (0,
|
|
14098
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13855
14099
|
import_lucide_react27.ChevronUpIcon,
|
|
13856
14100
|
{}
|
|
13857
14101
|
)
|
|
@@ -13862,7 +14106,7 @@ function SelectScrollDownButton({
|
|
|
13862
14106
|
className,
|
|
13863
14107
|
...props
|
|
13864
14108
|
}) {
|
|
13865
|
-
return /* @__PURE__ */ (0,
|
|
14109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13866
14110
|
import_radix_ui2.Select.ScrollDownButton,
|
|
13867
14111
|
{
|
|
13868
14112
|
"data-slot": "select-scroll-down-button",
|
|
@@ -13871,7 +14115,7 @@ function SelectScrollDownButton({
|
|
|
13871
14115
|
className
|
|
13872
14116
|
),
|
|
13873
14117
|
...props,
|
|
13874
|
-
children: /* @__PURE__ */ (0,
|
|
14118
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13875
14119
|
import_lucide_react27.ChevronDownIcon,
|
|
13876
14120
|
{}
|
|
13877
14121
|
)
|
|
@@ -13880,9 +14124,9 @@ function SelectScrollDownButton({
|
|
|
13880
14124
|
}
|
|
13881
14125
|
|
|
13882
14126
|
// src/components/ui/slider.tsx
|
|
13883
|
-
var
|
|
14127
|
+
var React45 = __toESM(require("react"), 1);
|
|
13884
14128
|
var import_radix_ui3 = require("radix-ui");
|
|
13885
|
-
var
|
|
14129
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
13886
14130
|
function Slider({
|
|
13887
14131
|
className,
|
|
13888
14132
|
defaultValue,
|
|
@@ -13891,11 +14135,11 @@ function Slider({
|
|
|
13891
14135
|
max = 100,
|
|
13892
14136
|
...props
|
|
13893
14137
|
}) {
|
|
13894
|
-
const _values =
|
|
14138
|
+
const _values = React45.useMemo(
|
|
13895
14139
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
13896
14140
|
[value, defaultValue, min, max]
|
|
13897
14141
|
);
|
|
13898
|
-
return /* @__PURE__ */ (0,
|
|
14142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
13899
14143
|
import_radix_ui3.Slider.Root,
|
|
13900
14144
|
{
|
|
13901
14145
|
"data-slot": "slider",
|
|
@@ -13909,12 +14153,12 @@ function Slider({
|
|
|
13909
14153
|
),
|
|
13910
14154
|
...props,
|
|
13911
14155
|
children: [
|
|
13912
|
-
/* @__PURE__ */ (0,
|
|
14156
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
13913
14157
|
import_radix_ui3.Slider.Track,
|
|
13914
14158
|
{
|
|
13915
14159
|
"data-slot": "slider-track",
|
|
13916
14160
|
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",
|
|
13917
|
-
children: /* @__PURE__ */ (0,
|
|
14161
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
13918
14162
|
import_radix_ui3.Slider.Range,
|
|
13919
14163
|
{
|
|
13920
14164
|
"data-slot": "slider-range",
|
|
@@ -13923,7 +14167,7 @@ function Slider({
|
|
|
13923
14167
|
)
|
|
13924
14168
|
}
|
|
13925
14169
|
),
|
|
13926
|
-
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ (0,
|
|
14170
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
13927
14171
|
import_radix_ui3.Slider.Thumb,
|
|
13928
14172
|
{
|
|
13929
14173
|
"data-slot": "slider-thumb",
|
|
@@ -13937,15 +14181,15 @@ function Slider({
|
|
|
13937
14181
|
}
|
|
13938
14182
|
|
|
13939
14183
|
// src/components/ui/toggle-group.tsx
|
|
13940
|
-
var
|
|
14184
|
+
var React47 = __toESM(require("react"), 1);
|
|
13941
14185
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
13942
14186
|
var import_radix_ui5 = require("radix-ui");
|
|
13943
14187
|
|
|
13944
14188
|
// src/components/ui/toggle.tsx
|
|
13945
|
-
var
|
|
14189
|
+
var React46 = require("react");
|
|
13946
14190
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
13947
14191
|
var import_radix_ui4 = require("radix-ui");
|
|
13948
|
-
var
|
|
14192
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
13949
14193
|
var toggleVariants = (0, import_class_variance_authority2.cva)(
|
|
13950
14194
|
"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",
|
|
13951
14195
|
{
|
|
@@ -13968,8 +14212,8 @@ var toggleVariants = (0, import_class_variance_authority2.cva)(
|
|
|
13968
14212
|
);
|
|
13969
14213
|
|
|
13970
14214
|
// src/components/ui/toggle-group.tsx
|
|
13971
|
-
var
|
|
13972
|
-
var ToggleGroupContext =
|
|
14215
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
14216
|
+
var ToggleGroupContext = React47.createContext({
|
|
13973
14217
|
size: "default",
|
|
13974
14218
|
variant: "default",
|
|
13975
14219
|
spacing: 0,
|
|
@@ -13984,7 +14228,7 @@ function ToggleGroup({
|
|
|
13984
14228
|
children,
|
|
13985
14229
|
...props
|
|
13986
14230
|
}) {
|
|
13987
|
-
return /* @__PURE__ */ (0,
|
|
14231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
13988
14232
|
import_radix_ui5.ToggleGroup.Root,
|
|
13989
14233
|
{
|
|
13990
14234
|
"data-slot": "toggle-group",
|
|
@@ -13998,7 +14242,7 @@ function ToggleGroup({
|
|
|
13998
14242
|
className
|
|
13999
14243
|
),
|
|
14000
14244
|
...props,
|
|
14001
|
-
children: /* @__PURE__ */ (0,
|
|
14245
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14002
14246
|
ToggleGroupContext.Provider,
|
|
14003
14247
|
{
|
|
14004
14248
|
value: { variant, size: size2, spacing, orientation },
|
|
@@ -14015,8 +14259,8 @@ function ToggleGroupItem({
|
|
|
14015
14259
|
size: size2 = "default",
|
|
14016
14260
|
...props
|
|
14017
14261
|
}) {
|
|
14018
|
-
const context =
|
|
14019
|
-
return /* @__PURE__ */ (0,
|
|
14262
|
+
const context = React47.useContext(ToggleGroupContext);
|
|
14263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14020
14264
|
import_radix_ui5.ToggleGroup.Item,
|
|
14021
14265
|
{
|
|
14022
14266
|
"data-slot": "toggle-group-item",
|
|
@@ -14246,13 +14490,13 @@ function isPetEnabled(pet) {
|
|
|
14246
14490
|
}
|
|
14247
14491
|
|
|
14248
14492
|
// src/components/pet/PetPreview.tsx
|
|
14249
|
-
var
|
|
14493
|
+
var React48 = require("react");
|
|
14250
14494
|
|
|
14251
14495
|
// src/components/pet/petSpriteAtlas.ts
|
|
14252
14496
|
var import_chatkit_types12 = require("@xpert-ai/chatkit-types");
|
|
14253
14497
|
|
|
14254
14498
|
// src/components/pet/PetPreview.tsx
|
|
14255
|
-
var
|
|
14499
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
14256
14500
|
function escapeCssUrl(value) {
|
|
14257
14501
|
return value.replace(/["\\]/g, "\\$&");
|
|
14258
14502
|
}
|
|
@@ -14260,7 +14504,7 @@ function PetPreview({ src, label, className }) {
|
|
|
14260
14504
|
const scale = 0.13;
|
|
14261
14505
|
const width = import_chatkit_types12.petSpriteAtlas.cellWidth;
|
|
14262
14506
|
const height = import_chatkit_types12.petSpriteAtlas.cellHeight;
|
|
14263
|
-
return /* @__PURE__ */ (0,
|
|
14507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
14264
14508
|
"span",
|
|
14265
14509
|
{
|
|
14266
14510
|
className: cn(
|
|
@@ -14269,7 +14513,7 @@ function PetPreview({ src, label, className }) {
|
|
|
14269
14513
|
),
|
|
14270
14514
|
"aria-hidden": "true",
|
|
14271
14515
|
title: label,
|
|
14272
|
-
children: /* @__PURE__ */ (0,
|
|
14516
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
14273
14517
|
"span",
|
|
14274
14518
|
{
|
|
14275
14519
|
className: "absolute left-1/2 top-1/2 block",
|
|
@@ -14291,7 +14535,7 @@ function PetPreview({ src, label, className }) {
|
|
|
14291
14535
|
}
|
|
14292
14536
|
|
|
14293
14537
|
// src/components/settings/SettingsSheet.tsx
|
|
14294
|
-
var
|
|
14538
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
14295
14539
|
var CHARACTER_TYPES2 = [
|
|
14296
14540
|
"builtin",
|
|
14297
14541
|
"atlas"
|
|
@@ -14307,13 +14551,13 @@ function SettingsSheet({
|
|
|
14307
14551
|
onSave
|
|
14308
14552
|
}) {
|
|
14309
14553
|
const { t } = useChatkitTranslation();
|
|
14310
|
-
const [draft, setDraft] =
|
|
14311
|
-
|
|
14554
|
+
const [draft, setDraft] = React49.useState(settings);
|
|
14555
|
+
React49.useEffect(() => {
|
|
14312
14556
|
if (open) {
|
|
14313
14557
|
setDraft(petRequired ? { ...settings, enabled: true } : settings);
|
|
14314
14558
|
}
|
|
14315
14559
|
}, [open, petRequired, settings]);
|
|
14316
|
-
const updateDraft =
|
|
14560
|
+
const updateDraft = React49.useCallback(
|
|
14317
14561
|
(patch) => {
|
|
14318
14562
|
setDraft((previous) => ({ ...previous, ...patch }));
|
|
14319
14563
|
},
|
|
@@ -14331,23 +14575,23 @@ function SettingsSheet({
|
|
|
14331
14575
|
defaultValue: selectedBuiltinPet.label
|
|
14332
14576
|
}
|
|
14333
14577
|
);
|
|
14334
|
-
return /* @__PURE__ */ (0,
|
|
14335
|
-
/* @__PURE__ */ (0,
|
|
14336
|
-
/* @__PURE__ */ (0,
|
|
14337
|
-
/* @__PURE__ */ (0,
|
|
14578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Sheet, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(SheetContent, { side: "right", className: "w-[min(92vw,26rem)] overflow-y-auto", children: [
|
|
14579
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SheetHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
14580
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "flex h-8 w-8 items-center justify-center rounded-md bg-primary/10 text-primary", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react28.Settings, { size: 16 }) }),
|
|
14581
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SheetTitle, { children: t("settings.title") })
|
|
14338
14582
|
] }) }),
|
|
14339
|
-
/* @__PURE__ */ (0,
|
|
14340
|
-
/* @__PURE__ */ (0,
|
|
14341
|
-
/* @__PURE__ */ (0,
|
|
14342
|
-
/* @__PURE__ */ (0,
|
|
14343
|
-
/* @__PURE__ */ (0,
|
|
14583
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("form", { className: "mt-6 space-y-5", onSubmit: handleSubmit, children: [
|
|
14584
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("section", { className: "space-y-5", children: [
|
|
14585
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
14586
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "flex h-7 w-7 items-center justify-center rounded-md bg-muted text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react28.PawPrint, { size: 15 }) }),
|
|
14587
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("h3", { className: "text-sm font-semibold", children: t("pet.settings.title") })
|
|
14344
14588
|
] }),
|
|
14345
|
-
/* @__PURE__ */ (0,
|
|
14346
|
-
/* @__PURE__ */ (0,
|
|
14347
|
-
/* @__PURE__ */ (0,
|
|
14348
|
-
petRequired && /* @__PURE__ */ (0,
|
|
14589
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("label", { className: "flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2", children: [
|
|
14590
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "min-w-0", children: [
|
|
14591
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "block text-sm font-medium", children: t("pet.settings.enabled") }),
|
|
14592
|
+
petRequired && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: t("pet.settings.requiredHint") })
|
|
14349
14593
|
] }),
|
|
14350
|
-
/* @__PURE__ */ (0,
|
|
14594
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14351
14595
|
"button",
|
|
14352
14596
|
{
|
|
14353
14597
|
type: "button",
|
|
@@ -14360,7 +14604,7 @@ function SettingsSheet({
|
|
|
14360
14604
|
draft.enabled ? "bg-primary" : "bg-muted-foreground/20",
|
|
14361
14605
|
petRequired ? "cursor-not-allowed opacity-70" : ""
|
|
14362
14606
|
].join(" "),
|
|
14363
|
-
children: /* @__PURE__ */ (0,
|
|
14607
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14364
14608
|
"span",
|
|
14365
14609
|
{
|
|
14366
14610
|
className: [
|
|
@@ -14373,9 +14617,9 @@ function SettingsSheet({
|
|
|
14373
14617
|
)
|
|
14374
14618
|
] })
|
|
14375
14619
|
] }),
|
|
14376
|
-
/* @__PURE__ */ (0,
|
|
14377
|
-
/* @__PURE__ */ (0,
|
|
14378
|
-
/* @__PURE__ */ (0,
|
|
14620
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "space-y-2", children: [
|
|
14621
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { id: "chatkit-pet-type-label", className: "text-sm font-medium", children: t("pet.settings.characterType") }),
|
|
14622
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14379
14623
|
ToggleGroup,
|
|
14380
14624
|
{
|
|
14381
14625
|
id: "chatkit-pet-type",
|
|
@@ -14390,7 +14634,7 @@ function SettingsSheet({
|
|
|
14390
14634
|
variant: "outline",
|
|
14391
14635
|
spacing: 2,
|
|
14392
14636
|
className: "!w-full",
|
|
14393
|
-
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ (0,
|
|
14637
|
+
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14394
14638
|
ToggleGroupItem,
|
|
14395
14639
|
{
|
|
14396
14640
|
value: type,
|
|
@@ -14402,8 +14646,8 @@ function SettingsSheet({
|
|
|
14402
14646
|
}
|
|
14403
14647
|
)
|
|
14404
14648
|
] }),
|
|
14405
|
-
draft.characterType === "builtin" && /* @__PURE__ */ (0,
|
|
14406
|
-
/* @__PURE__ */ (0,
|
|
14649
|
+
draft.characterType === "builtin" && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "space-y-2", children: [
|
|
14650
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14407
14651
|
"label",
|
|
14408
14652
|
{
|
|
14409
14653
|
htmlFor: "chatkit-pet-builtin",
|
|
@@ -14411,7 +14655,7 @@ function SettingsSheet({
|
|
|
14411
14655
|
children: t("pet.settings.builtin")
|
|
14412
14656
|
}
|
|
14413
14657
|
),
|
|
14414
|
-
/* @__PURE__ */ (0,
|
|
14658
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
14415
14659
|
Select,
|
|
14416
14660
|
{
|
|
14417
14661
|
value: selectedBuiltinPet.id,
|
|
@@ -14422,26 +14666,26 @@ function SettingsSheet({
|
|
|
14422
14666
|
}
|
|
14423
14667
|
},
|
|
14424
14668
|
children: [
|
|
14425
|
-
/* @__PURE__ */ (0,
|
|
14669
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14426
14670
|
SelectTrigger,
|
|
14427
14671
|
{
|
|
14428
14672
|
id: "chatkit-pet-builtin",
|
|
14429
14673
|
className: "min-h-12 w-full px-3 py-2",
|
|
14430
|
-
children: /* @__PURE__ */ (0,
|
|
14674
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SelectValue, { placeholder: selectedBuiltinPetLabel })
|
|
14431
14675
|
}
|
|
14432
14676
|
),
|
|
14433
|
-
/* @__PURE__ */ (0,
|
|
14677
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SelectContent, { className: "w-[var(--radix-select-trigger-width)]", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SelectGroup, { children: INCLUDED_PET_OPTIONS.map((pet) => {
|
|
14434
14678
|
const label = t(`pet.settings.builtins.${pet.id}`, {
|
|
14435
14679
|
defaultValue: pet.label
|
|
14436
14680
|
});
|
|
14437
|
-
return /* @__PURE__ */ (0,
|
|
14681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14438
14682
|
SelectItem,
|
|
14439
14683
|
{
|
|
14440
14684
|
value: pet.id,
|
|
14441
14685
|
className: "min-h-10 py-1.5 pl-2 pr-8",
|
|
14442
|
-
children: /* @__PURE__ */ (0,
|
|
14443
|
-
/* @__PURE__ */ (0,
|
|
14444
|
-
/* @__PURE__ */ (0,
|
|
14686
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
14687
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PetPreview, { src: pet.previewSrc, label }),
|
|
14688
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "min-w-0 truncate", children: label })
|
|
14445
14689
|
] })
|
|
14446
14690
|
},
|
|
14447
14691
|
pet.id
|
|
@@ -14451,8 +14695,8 @@ function SettingsSheet({
|
|
|
14451
14695
|
}
|
|
14452
14696
|
)
|
|
14453
14697
|
] }),
|
|
14454
|
-
draft.characterType === "atlas" && /* @__PURE__ */ (0,
|
|
14455
|
-
/* @__PURE__ */ (0,
|
|
14698
|
+
draft.characterType === "atlas" && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "space-y-2", children: [
|
|
14699
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14456
14700
|
"label",
|
|
14457
14701
|
{
|
|
14458
14702
|
className: "text-sm font-medium",
|
|
@@ -14460,7 +14704,7 @@ function SettingsSheet({
|
|
|
14460
14704
|
children: t("pet.settings.atlasUrl")
|
|
14461
14705
|
}
|
|
14462
14706
|
),
|
|
14463
|
-
/* @__PURE__ */ (0,
|
|
14707
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14464
14708
|
Input,
|
|
14465
14709
|
{
|
|
14466
14710
|
id: "chatkit-pet-atlas",
|
|
@@ -14470,15 +14714,15 @@ function SettingsSheet({
|
|
|
14470
14714
|
}
|
|
14471
14715
|
)
|
|
14472
14716
|
] }),
|
|
14473
|
-
/* @__PURE__ */ (0,
|
|
14474
|
-
/* @__PURE__ */ (0,
|
|
14475
|
-
/* @__PURE__ */ (0,
|
|
14476
|
-
/* @__PURE__ */ (0,
|
|
14717
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "space-y-2", children: [
|
|
14718
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
14719
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("label", { className: "text-sm font-medium", htmlFor: "chatkit-pet-scale", children: t("pet.settings.scale") }),
|
|
14720
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "text-xs tabular-nums text-muted-foreground", children: [
|
|
14477
14721
|
draft.scale.toFixed(2),
|
|
14478
14722
|
"x"
|
|
14479
14723
|
] })
|
|
14480
14724
|
] }),
|
|
14481
|
-
/* @__PURE__ */ (0,
|
|
14725
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14482
14726
|
Slider,
|
|
14483
14727
|
{
|
|
14484
14728
|
id: "chatkit-pet-scale",
|
|
@@ -14492,8 +14736,8 @@ function SettingsSheet({
|
|
|
14492
14736
|
}
|
|
14493
14737
|
)
|
|
14494
14738
|
] }),
|
|
14495
|
-
/* @__PURE__ */ (0,
|
|
14496
|
-
/* @__PURE__ */ (0,
|
|
14739
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
14740
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14497
14741
|
"input",
|
|
14498
14742
|
{
|
|
14499
14743
|
type: "checkbox",
|
|
@@ -14504,8 +14748,8 @@ function SettingsSheet({
|
|
|
14504
14748
|
),
|
|
14505
14749
|
t("pet.settings.draggable")
|
|
14506
14750
|
] }),
|
|
14507
|
-
/* @__PURE__ */ (0,
|
|
14508
|
-
/* @__PURE__ */ (0,
|
|
14751
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
14752
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14509
14753
|
"input",
|
|
14510
14754
|
{
|
|
14511
14755
|
type: "checkbox",
|
|
@@ -14516,8 +14760,8 @@ function SettingsSheet({
|
|
|
14516
14760
|
),
|
|
14517
14761
|
t("pet.settings.persistPosition")
|
|
14518
14762
|
] }),
|
|
14519
|
-
/* @__PURE__ */ (0,
|
|
14520
|
-
/* @__PURE__ */ (0,
|
|
14763
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex justify-end gap-2 pt-2", children: [
|
|
14764
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14521
14765
|
Button,
|
|
14522
14766
|
{
|
|
14523
14767
|
type: "button",
|
|
@@ -14526,7 +14770,7 @@ function SettingsSheet({
|
|
|
14526
14770
|
children: t("pet.settings.cancel")
|
|
14527
14771
|
}
|
|
14528
14772
|
),
|
|
14529
|
-
/* @__PURE__ */ (0,
|
|
14773
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Button, { type: "submit", children: t("pet.settings.save") })
|
|
14530
14774
|
] })
|
|
14531
14775
|
] })
|
|
14532
14776
|
] }) });
|
|
@@ -15152,25 +15396,27 @@ function findDomPointForComposerOffset(root, offset) {
|
|
|
15152
15396
|
return result ?? { node: lastNode, offset: lastOffset };
|
|
15153
15397
|
}
|
|
15154
15398
|
|
|
15155
|
-
// src/components/chat.tsx
|
|
15156
|
-
var
|
|
15157
|
-
var
|
|
15158
|
-
var
|
|
15159
|
-
|
|
15160
|
-
|
|
15161
|
-
|
|
15162
|
-
|
|
15163
|
-
|
|
15399
|
+
// src/components/chat/runtime-capabilities.tsx
|
|
15400
|
+
var React50 = __toESM(require("react"), 1);
|
|
15401
|
+
var import_lucide_react29 = require("lucide-react");
|
|
15402
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
15403
|
+
function getHttpStatus(error) {
|
|
15404
|
+
if (!error || typeof error !== "object" || !("status" in error)) {
|
|
15405
|
+
return null;
|
|
15406
|
+
}
|
|
15407
|
+
const status = error.status;
|
|
15408
|
+
return typeof status === "number" ? status : null;
|
|
15164
15409
|
}
|
|
15165
|
-
function
|
|
15166
|
-
if (
|
|
15167
|
-
return
|
|
15410
|
+
function warnMissingRuntimeCapabilityReferences(action, missing) {
|
|
15411
|
+
if (!hasMissingRuntimeCapabilityReferences(missing)) {
|
|
15412
|
+
return;
|
|
15168
15413
|
}
|
|
15169
|
-
|
|
15170
|
-
|
|
15171
|
-
|
|
15414
|
+
console.warn(
|
|
15415
|
+
`[Chat] Runtime capabilities ${action} include unavailable references:`,
|
|
15416
|
+
missing
|
|
15417
|
+
);
|
|
15172
15418
|
}
|
|
15173
|
-
function
|
|
15419
|
+
function getRuntimeCapabilityPaletteEmptyLabelKey(palette, runtimeCapabilitiesReady) {
|
|
15174
15420
|
if (!palette.capabilityTypes || palette.capabilityTypes.length !== 1) {
|
|
15175
15421
|
return "composer.capabilities.emptySearch";
|
|
15176
15422
|
}
|
|
@@ -15187,23 +15433,7 @@ function getSlashPaletteEmptyLabelKey(palette, runtimeCapabilitiesReady) {
|
|
|
15187
15433
|
}
|
|
15188
15434
|
return hasQuery ? "composer.slashCommands.empty.matchingSubAgents" : "composer.slashCommands.empty.subAgents";
|
|
15189
15435
|
}
|
|
15190
|
-
function
|
|
15191
|
-
if (!error || typeof error !== "object" || !("status" in error)) {
|
|
15192
|
-
return null;
|
|
15193
|
-
}
|
|
15194
|
-
const status = error.status;
|
|
15195
|
-
return typeof status === "number" ? status : null;
|
|
15196
|
-
}
|
|
15197
|
-
function warnMissingRuntimeCapabilityReferences(action, missing) {
|
|
15198
|
-
if (!hasMissingRuntimeCapabilityReferences(missing)) {
|
|
15199
|
-
return;
|
|
15200
|
-
}
|
|
15201
|
-
console.warn(
|
|
15202
|
-
`[Chat] Runtime capabilities ${action} include unavailable references:`,
|
|
15203
|
-
missing
|
|
15204
|
-
);
|
|
15205
|
-
}
|
|
15206
|
-
function getSelectedRuntimeCapabilityOptions(selection, options) {
|
|
15436
|
+
function getRuntimeCapabilityOptionsForSelection(selection, options) {
|
|
15207
15437
|
if (!selection) {
|
|
15208
15438
|
return [];
|
|
15209
15439
|
}
|
|
@@ -15211,65 +15441,904 @@ function getSelectedRuntimeCapabilityOptions(selection, options) {
|
|
|
15211
15441
|
(option) => isRuntimeCapabilitySelected(selection, option.type, option.id)
|
|
15212
15442
|
);
|
|
15213
15443
|
}
|
|
15214
|
-
|
|
15215
|
-
|
|
15216
|
-
|
|
15444
|
+
function removeComposerCapabilityPartsFromSelection(selection, removedCapabilities) {
|
|
15445
|
+
let nextSelection = selection;
|
|
15446
|
+
for (const part of removedCapabilities) {
|
|
15447
|
+
nextSelection = toggleRuntimeCapabilitySelection(
|
|
15448
|
+
nextSelection,
|
|
15449
|
+
part.capability.type,
|
|
15450
|
+
part.capability.id,
|
|
15451
|
+
false
|
|
15452
|
+
);
|
|
15217
15453
|
}
|
|
15218
|
-
return
|
|
15219
|
-
const objectUrl = URL.createObjectURL(file);
|
|
15220
|
-
const image = new window.Image();
|
|
15221
|
-
const cleanup = () => {
|
|
15222
|
-
URL.revokeObjectURL(objectUrl);
|
|
15223
|
-
};
|
|
15224
|
-
image.onload = () => {
|
|
15225
|
-
resolve({
|
|
15226
|
-
width: image.naturalWidth || void 0,
|
|
15227
|
-
height: image.naturalHeight || void 0
|
|
15228
|
-
});
|
|
15229
|
-
cleanup();
|
|
15230
|
-
};
|
|
15231
|
-
image.onerror = () => {
|
|
15232
|
-
resolve({});
|
|
15233
|
-
cleanup();
|
|
15234
|
-
};
|
|
15235
|
-
image.src = objectUrl;
|
|
15236
|
-
});
|
|
15237
|
-
}
|
|
15238
|
-
function getUploadedFileUrl(file) {
|
|
15239
|
-
return file.url ?? file.fileUrl ?? file.thumbUrl;
|
|
15454
|
+
return nextSelection;
|
|
15240
15455
|
}
|
|
15241
|
-
function
|
|
15242
|
-
const
|
|
15243
|
-
|
|
15244
|
-
|
|
15245
|
-
|
|
15246
|
-
const height = dimensions?.height;
|
|
15247
|
-
const metaParts = [
|
|
15248
|
-
mimeType,
|
|
15249
|
-
width && height ? `${width}x${height}` : null,
|
|
15250
|
-
typeof size2 === "number" ? `${size2} bytes` : null
|
|
15251
|
-
].filter((part) => Boolean(part));
|
|
15252
|
-
return {
|
|
15253
|
-
type: "image",
|
|
15254
|
-
id: uploadedFile.id,
|
|
15255
|
-
fileId: uploadedFile.storageFileId,
|
|
15256
|
-
url: getUploadedFileUrl(uploadedFile),
|
|
15257
|
-
mimeType,
|
|
15258
|
-
name,
|
|
15259
|
-
...typeof size2 === "number" ? { size: size2 } : {},
|
|
15260
|
-
...width ? { width } : {},
|
|
15261
|
-
...height ? { height } : {},
|
|
15262
|
-
text: `Pasted image${metaParts.length ? ` (${metaParts.join(", ")})` : ""}: ${name}`
|
|
15263
|
-
};
|
|
15456
|
+
function getRemovedComposerCapabilityParts(previousParts, nextParts) {
|
|
15457
|
+
const nextKeys = getComposerCapabilityKeys(nextParts);
|
|
15458
|
+
return previousParts.filter(
|
|
15459
|
+
(part) => part.type === "capability" && !nextKeys.has(part.key)
|
|
15460
|
+
);
|
|
15264
15461
|
}
|
|
15265
|
-
function
|
|
15266
|
-
|
|
15267
|
-
|
|
15268
|
-
|
|
15269
|
-
|
|
15270
|
-
|
|
15271
|
-
|
|
15272
|
-
|
|
15462
|
+
function useRuntimeCapabilitiesState({
|
|
15463
|
+
client,
|
|
15464
|
+
assistantId,
|
|
15465
|
+
threadId,
|
|
15466
|
+
disabled,
|
|
15467
|
+
composerParts
|
|
15468
|
+
}) {
|
|
15469
|
+
const [runtimeCapabilities, setRuntimeCapabilities] = React50.useState(null);
|
|
15470
|
+
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] = React50.useState(false);
|
|
15471
|
+
const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] = React50.useState(
|
|
15472
|
+
() => createEmptyRuntimeCapabilitiesSelection()
|
|
15473
|
+
);
|
|
15474
|
+
const [runRuntimeCapabilities, setRunRuntimeCapabilities] = React50.useState(
|
|
15475
|
+
() => createEmptyRuntimeCapabilitiesSelection()
|
|
15476
|
+
);
|
|
15477
|
+
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] = React50.useState(null);
|
|
15478
|
+
const runtimeCapabilityPreferenceLoadRef = React50.useRef(0);
|
|
15479
|
+
const pendingExternalRuntimeCapabilitiesRef = React50.useRef(null);
|
|
15480
|
+
const runtimeCapabilityOptions = React50.useMemo(
|
|
15481
|
+
() => getRuntimeCapabilityOptions(runtimeCapabilities),
|
|
15482
|
+
[runtimeCapabilities]
|
|
15483
|
+
);
|
|
15484
|
+
const effectiveSessionRuntimeCapabilities = React50.useMemo(
|
|
15485
|
+
() => runtimeCapabilitiesReady && runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
15486
|
+
runtimeCapabilities,
|
|
15487
|
+
sessionRuntimeCapabilities
|
|
15488
|
+
) : null,
|
|
15489
|
+
[runtimeCapabilities, runtimeCapabilitiesReady, sessionRuntimeCapabilities]
|
|
15490
|
+
);
|
|
15491
|
+
const runRuntimeCapabilityOptions = React50.useMemo(
|
|
15492
|
+
() => runtimeCapabilityOptions.filter(
|
|
15493
|
+
(option) => isRuntimeCapabilitySelected(
|
|
15494
|
+
runRuntimeCapabilities,
|
|
15495
|
+
option.type,
|
|
15496
|
+
option.id
|
|
15497
|
+
)
|
|
15498
|
+
),
|
|
15499
|
+
[runRuntimeCapabilities, runtimeCapabilityOptions]
|
|
15500
|
+
);
|
|
15501
|
+
const composerRuntimeCapabilitySelectionKeys = React50.useMemo(
|
|
15502
|
+
() => getComposerCapabilitySelectionKeys(composerParts),
|
|
15503
|
+
[composerParts]
|
|
15504
|
+
);
|
|
15505
|
+
const detachedRunRuntimeCapabilityOptions = React50.useMemo(
|
|
15506
|
+
() => runRuntimeCapabilityOptions.filter(
|
|
15507
|
+
(option) => !composerRuntimeCapabilitySelectionKeys.has(
|
|
15508
|
+
getRuntimeCapabilityOptionKey(option)
|
|
15509
|
+
)
|
|
15510
|
+
),
|
|
15511
|
+
[composerRuntimeCapabilitySelectionKeys, runRuntimeCapabilityOptions]
|
|
15512
|
+
);
|
|
15513
|
+
const persistSessionRuntimeCapabilities = React50.useCallback(
|
|
15514
|
+
async (nextThreadId, selection) => {
|
|
15515
|
+
if (!runtimeCapabilities || !selection || !client) {
|
|
15516
|
+
return;
|
|
15517
|
+
}
|
|
15518
|
+
try {
|
|
15519
|
+
const result = await persistConversationRuntimeCapabilities({
|
|
15520
|
+
client,
|
|
15521
|
+
threadId: nextThreadId,
|
|
15522
|
+
capabilities: runtimeCapabilities,
|
|
15523
|
+
selection
|
|
15524
|
+
});
|
|
15525
|
+
warnMissingRuntimeCapabilityReferences(
|
|
15526
|
+
"persisted selection",
|
|
15527
|
+
result.missing
|
|
15528
|
+
);
|
|
15529
|
+
} catch (error) {
|
|
15530
|
+
console.warn(
|
|
15531
|
+
"[Chat] Failed to persist runtime capabilities selection:",
|
|
15532
|
+
error
|
|
15533
|
+
);
|
|
15534
|
+
}
|
|
15535
|
+
},
|
|
15536
|
+
[client, runtimeCapabilities]
|
|
15537
|
+
);
|
|
15538
|
+
const applyExternalRuntimeCapabilities = React50.useCallback(
|
|
15539
|
+
(selection) => {
|
|
15540
|
+
pendingExternalRuntimeCapabilitiesRef.current = selection;
|
|
15541
|
+
setRunRuntimeCapabilities(() => {
|
|
15542
|
+
const emptySelection = createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities);
|
|
15543
|
+
if (!selection) {
|
|
15544
|
+
return emptySelection;
|
|
15545
|
+
}
|
|
15546
|
+
if (!runtimeCapabilities) {
|
|
15547
|
+
return selection;
|
|
15548
|
+
}
|
|
15549
|
+
pendingExternalRuntimeCapabilitiesRef.current = null;
|
|
15550
|
+
return mergeRuntimeCapabilitiesSelections(
|
|
15551
|
+
runtimeCapabilities,
|
|
15552
|
+
emptySelection,
|
|
15553
|
+
selection
|
|
15554
|
+
);
|
|
15555
|
+
});
|
|
15556
|
+
},
|
|
15557
|
+
[runtimeCapabilities]
|
|
15558
|
+
);
|
|
15559
|
+
const handleSessionRuntimeCapabilityToggle = React50.useCallback(
|
|
15560
|
+
(type, id, selected) => {
|
|
15561
|
+
setSessionRuntimeCapabilities((previous) => {
|
|
15562
|
+
const nextSelection = toggleRuntimeCapabilitySelection(
|
|
15563
|
+
previous,
|
|
15564
|
+
type,
|
|
15565
|
+
id,
|
|
15566
|
+
selected
|
|
15567
|
+
);
|
|
15568
|
+
const normalizedThreadId = threadId?.trim();
|
|
15569
|
+
if (normalizedThreadId) {
|
|
15570
|
+
void persistSessionRuntimeCapabilities(
|
|
15571
|
+
normalizedThreadId,
|
|
15572
|
+
nextSelection
|
|
15573
|
+
);
|
|
15574
|
+
}
|
|
15575
|
+
return nextSelection;
|
|
15576
|
+
});
|
|
15577
|
+
},
|
|
15578
|
+
[persistSessionRuntimeCapabilities, threadId]
|
|
15579
|
+
);
|
|
15580
|
+
const addRunRuntimeCapabilities = React50.useCallback(
|
|
15581
|
+
(selection) => {
|
|
15582
|
+
setRunRuntimeCapabilities(
|
|
15583
|
+
(previous) => runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
15584
|
+
runtimeCapabilities,
|
|
15585
|
+
previous,
|
|
15586
|
+
selection
|
|
15587
|
+
) : previous
|
|
15588
|
+
);
|
|
15589
|
+
},
|
|
15590
|
+
[runtimeCapabilities]
|
|
15591
|
+
);
|
|
15592
|
+
const resetRunRuntimeCapabilities = React50.useCallback(() => {
|
|
15593
|
+
setRunRuntimeCapabilities(
|
|
15594
|
+
createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
|
|
15595
|
+
);
|
|
15596
|
+
setRuntimeCapabilityPalette(null);
|
|
15597
|
+
}, [runtimeCapabilities]);
|
|
15598
|
+
const getRuntimeCapabilitiesForSubmit = React50.useCallback(
|
|
15599
|
+
(recommended) => {
|
|
15600
|
+
const recommendedRuntimeCapabilitiesForSubmit = recommended && runtimeCapabilities && runtimeCapabilitiesReady ? mergeRuntimeCapabilitiesSelections(
|
|
15601
|
+
runtimeCapabilities,
|
|
15602
|
+
runRuntimeCapabilities,
|
|
15603
|
+
recommended
|
|
15604
|
+
) : runRuntimeCapabilities;
|
|
15605
|
+
const runtimeCapabilitiesForSubmit = runtimeCapabilities && runtimeCapabilitiesReady ? createRuntimeCapabilitiesForSubmit({
|
|
15606
|
+
capabilities: runtimeCapabilities,
|
|
15607
|
+
available: effectiveSessionRuntimeCapabilities,
|
|
15608
|
+
recommended: recommendedRuntimeCapabilitiesForSubmit
|
|
15609
|
+
}) : null;
|
|
15610
|
+
const runtimeCapabilityOptionsForMessage = getRuntimeCapabilityOptionsForSelection(
|
|
15611
|
+
getRecommendedRuntimeCapabilitiesSelection(
|
|
15612
|
+
runtimeCapabilitiesForSubmit
|
|
15613
|
+
),
|
|
15614
|
+
runtimeCapabilityOptions
|
|
15615
|
+
);
|
|
15616
|
+
return {
|
|
15617
|
+
runtimeCapabilitiesForSubmit,
|
|
15618
|
+
runtimeCapabilityOptionsForMessage
|
|
15619
|
+
};
|
|
15620
|
+
},
|
|
15621
|
+
[
|
|
15622
|
+
effectiveSessionRuntimeCapabilities,
|
|
15623
|
+
runRuntimeCapabilities,
|
|
15624
|
+
runtimeCapabilities,
|
|
15625
|
+
runtimeCapabilitiesReady,
|
|
15626
|
+
runtimeCapabilityOptions
|
|
15627
|
+
]
|
|
15628
|
+
);
|
|
15629
|
+
const getRuntimeCapabilitiesForCommand = React50.useCallback(
|
|
15630
|
+
(recommended) => runtimeCapabilities && runtimeCapabilitiesReady ? createRuntimeCapabilitiesForSubmit({
|
|
15631
|
+
capabilities: runtimeCapabilities,
|
|
15632
|
+
available: effectiveSessionRuntimeCapabilities,
|
|
15633
|
+
recommended
|
|
15634
|
+
}) : recommended ?? null,
|
|
15635
|
+
[
|
|
15636
|
+
effectiveSessionRuntimeCapabilities,
|
|
15637
|
+
runtimeCapabilities,
|
|
15638
|
+
runtimeCapabilitiesReady
|
|
15639
|
+
]
|
|
15640
|
+
);
|
|
15641
|
+
React50.useEffect(() => {
|
|
15642
|
+
if (disabled || !client || !assistantId) {
|
|
15643
|
+
pendingExternalRuntimeCapabilitiesRef.current = null;
|
|
15644
|
+
setRuntimeCapabilities(null);
|
|
15645
|
+
setRuntimeCapabilitiesReady(false);
|
|
15646
|
+
setSessionRuntimeCapabilities(createEmptyRuntimeCapabilitiesSelection());
|
|
15647
|
+
setRunRuntimeCapabilities(createEmptyRuntimeCapabilitiesSelection());
|
|
15648
|
+
setRuntimeCapabilityPalette(null);
|
|
15649
|
+
return;
|
|
15650
|
+
}
|
|
15651
|
+
const controller = new AbortController();
|
|
15652
|
+
setRuntimeCapabilitiesReady(false);
|
|
15653
|
+
setRuntimeCapabilities(null);
|
|
15654
|
+
setRuntimeCapabilityPalette(null);
|
|
15655
|
+
void client.assistants.getRuntimeCapabilities(assistantId, {
|
|
15656
|
+
signal: controller.signal
|
|
15657
|
+
}).then((payload) => {
|
|
15658
|
+
setRuntimeCapabilities(payload);
|
|
15659
|
+
setRuntimeCapabilitiesReady(true);
|
|
15660
|
+
setSessionRuntimeCapabilities(
|
|
15661
|
+
createDefaultRuntimeCapabilitiesSelection(payload)
|
|
15662
|
+
);
|
|
15663
|
+
setRunRuntimeCapabilities(
|
|
15664
|
+
createEmptyRuntimeCapabilitiesSelection(payload)
|
|
15665
|
+
);
|
|
15666
|
+
}).catch((error) => {
|
|
15667
|
+
if (controller.signal.aborted) {
|
|
15668
|
+
return;
|
|
15669
|
+
}
|
|
15670
|
+
if (getHttpStatus(error) === 404) {
|
|
15671
|
+
setRuntimeCapabilities(null);
|
|
15672
|
+
setRuntimeCapabilitiesReady(false);
|
|
15673
|
+
setSessionRuntimeCapabilities(
|
|
15674
|
+
createEmptyRuntimeCapabilitiesSelection()
|
|
15675
|
+
);
|
|
15676
|
+
setRunRuntimeCapabilities(createEmptyRuntimeCapabilitiesSelection());
|
|
15677
|
+
return;
|
|
15678
|
+
}
|
|
15679
|
+
console.warn("[Chat] Failed to load runtime capabilities:", error);
|
|
15680
|
+
setRuntimeCapabilities(null);
|
|
15681
|
+
setRuntimeCapabilitiesReady(false);
|
|
15682
|
+
setSessionRuntimeCapabilities(
|
|
15683
|
+
createEmptyRuntimeCapabilitiesSelection()
|
|
15684
|
+
);
|
|
15685
|
+
setRunRuntimeCapabilities(createEmptyRuntimeCapabilitiesSelection());
|
|
15686
|
+
});
|
|
15687
|
+
return () => controller.abort();
|
|
15688
|
+
}, [assistantId, client, disabled]);
|
|
15689
|
+
React50.useEffect(() => {
|
|
15690
|
+
const emptyRunSelection = createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities);
|
|
15691
|
+
const pendingExternalSelection = pendingExternalRuntimeCapabilitiesRef.current;
|
|
15692
|
+
if (pendingExternalSelection && runtimeCapabilities) {
|
|
15693
|
+
setRunRuntimeCapabilities(
|
|
15694
|
+
mergeRuntimeCapabilitiesSelections(
|
|
15695
|
+
runtimeCapabilities,
|
|
15696
|
+
emptyRunSelection,
|
|
15697
|
+
pendingExternalSelection
|
|
15698
|
+
)
|
|
15699
|
+
);
|
|
15700
|
+
pendingExternalRuntimeCapabilitiesRef.current = null;
|
|
15701
|
+
} else {
|
|
15702
|
+
setRunRuntimeCapabilities(pendingExternalSelection ?? emptyRunSelection);
|
|
15703
|
+
}
|
|
15704
|
+
if (!runtimeCapabilitiesReady || !runtimeCapabilities || !client) {
|
|
15705
|
+
setSessionRuntimeCapabilities(
|
|
15706
|
+
createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
|
|
15707
|
+
);
|
|
15708
|
+
return;
|
|
15709
|
+
}
|
|
15710
|
+
const defaultSelection = createDefaultRuntimeCapabilitiesSelection(runtimeCapabilities);
|
|
15711
|
+
const normalizedThreadId = threadId?.trim();
|
|
15712
|
+
if (!normalizedThreadId) {
|
|
15713
|
+
setSessionRuntimeCapabilities(defaultSelection);
|
|
15714
|
+
return;
|
|
15715
|
+
}
|
|
15716
|
+
let cancelled = false;
|
|
15717
|
+
const requestId = runtimeCapabilityPreferenceLoadRef.current + 1;
|
|
15718
|
+
runtimeCapabilityPreferenceLoadRef.current = requestId;
|
|
15719
|
+
setSessionRuntimeCapabilities(defaultSelection);
|
|
15720
|
+
void loadConversationRuntimeCapabilities({
|
|
15721
|
+
client,
|
|
15722
|
+
threadId: normalizedThreadId,
|
|
15723
|
+
capabilities: runtimeCapabilities
|
|
15724
|
+
}).then(({ selection, missing }) => {
|
|
15725
|
+
if (cancelled || runtimeCapabilityPreferenceLoadRef.current !== requestId) {
|
|
15726
|
+
return;
|
|
15727
|
+
}
|
|
15728
|
+
warnMissingRuntimeCapabilityReferences("loaded selection", missing);
|
|
15729
|
+
setSessionRuntimeCapabilities(selection ?? defaultSelection);
|
|
15730
|
+
}).catch((error) => {
|
|
15731
|
+
if (cancelled || runtimeCapabilityPreferenceLoadRef.current !== requestId) {
|
|
15732
|
+
return;
|
|
15733
|
+
}
|
|
15734
|
+
console.warn(
|
|
15735
|
+
"[Chat] Failed to load persisted runtime capabilities selection:",
|
|
15736
|
+
error
|
|
15737
|
+
);
|
|
15738
|
+
setSessionRuntimeCapabilities(defaultSelection);
|
|
15739
|
+
});
|
|
15740
|
+
return () => {
|
|
15741
|
+
cancelled = true;
|
|
15742
|
+
};
|
|
15743
|
+
}, [
|
|
15744
|
+
client,
|
|
15745
|
+
runtimeCapabilities,
|
|
15746
|
+
runtimeCapabilitiesReady,
|
|
15747
|
+
threadId
|
|
15748
|
+
]);
|
|
15749
|
+
return {
|
|
15750
|
+
runtimeCapabilities,
|
|
15751
|
+
runtimeCapabilitiesReady,
|
|
15752
|
+
runtimeCapabilityOptions,
|
|
15753
|
+
effectiveSessionRuntimeCapabilities,
|
|
15754
|
+
runRuntimeCapabilities,
|
|
15755
|
+
runRuntimeCapabilityOptions,
|
|
15756
|
+
detachedRunRuntimeCapabilityOptions,
|
|
15757
|
+
runtimeCapabilityPalette,
|
|
15758
|
+
setRunRuntimeCapabilities,
|
|
15759
|
+
setRuntimeCapabilityPalette,
|
|
15760
|
+
applyExternalRuntimeCapabilities,
|
|
15761
|
+
handleSessionRuntimeCapabilityToggle,
|
|
15762
|
+
addRunRuntimeCapabilities,
|
|
15763
|
+
resetRunRuntimeCapabilities,
|
|
15764
|
+
getRuntimeCapabilitiesForSubmit,
|
|
15765
|
+
getRuntimeCapabilitiesForCommand,
|
|
15766
|
+
persistSessionRuntimeCapabilities
|
|
15767
|
+
};
|
|
15768
|
+
}
|
|
15769
|
+
function useRuntimeCapabilityComposerActions({
|
|
15770
|
+
runtimeCapabilities,
|
|
15771
|
+
runtimeCapabilitiesReady,
|
|
15772
|
+
runtimeCapabilityOptions,
|
|
15773
|
+
setRunRuntimeCapabilities,
|
|
15774
|
+
setRuntimeCapabilityPalette,
|
|
15775
|
+
applyExternalRuntimeCapabilities,
|
|
15776
|
+
composerInputRef,
|
|
15777
|
+
composerPartsRef,
|
|
15778
|
+
commitComposerParts,
|
|
15779
|
+
focusComposerAt
|
|
15780
|
+
}) {
|
|
15781
|
+
const pendingExternalRuntimeCapabilityInsertRef = React50.useRef(null);
|
|
15782
|
+
const insertExternalRuntimeCapabilities = React50.useCallback(
|
|
15783
|
+
(selection) => {
|
|
15784
|
+
applyExternalRuntimeCapabilities(selection);
|
|
15785
|
+
if (!selection) {
|
|
15786
|
+
pendingExternalRuntimeCapabilityInsertRef.current = null;
|
|
15787
|
+
return;
|
|
15788
|
+
}
|
|
15789
|
+
if (!runtimeCapabilitiesReady || !runtimeCapabilities) {
|
|
15790
|
+
pendingExternalRuntimeCapabilityInsertRef.current = selection;
|
|
15791
|
+
return;
|
|
15792
|
+
}
|
|
15793
|
+
pendingExternalRuntimeCapabilityInsertRef.current = null;
|
|
15794
|
+
const existingKeys = getComposerCapabilitySelectionKeys(
|
|
15795
|
+
composerPartsRef.current
|
|
15796
|
+
);
|
|
15797
|
+
const selectedOptions = runtimeCapabilityOptions.filter(
|
|
15798
|
+
(option) => isRuntimeCapabilitySelected(selection, option.type, option.id) && !existingKeys.has(getRuntimeCapabilityOptionKey(option))
|
|
15799
|
+
);
|
|
15800
|
+
if (selectedOptions.length === 0) {
|
|
15801
|
+
focusComposerAt();
|
|
15802
|
+
return;
|
|
15803
|
+
}
|
|
15804
|
+
const currentParts = composerPartsRef.current;
|
|
15805
|
+
const insertAt = getComposerEditingLength(currentParts);
|
|
15806
|
+
const nextParts = replaceComposerRange(
|
|
15807
|
+
currentParts,
|
|
15808
|
+
insertAt,
|
|
15809
|
+
insertAt,
|
|
15810
|
+
selectedOptions.map(
|
|
15811
|
+
(option) => createComposerCapabilityPart(option, createMessageId())
|
|
15812
|
+
)
|
|
15813
|
+
);
|
|
15814
|
+
const nextCaretOffset = insertAt + selectedOptions.length;
|
|
15815
|
+
commitComposerParts(nextParts, {
|
|
15816
|
+
caretOffset: nextCaretOffset,
|
|
15817
|
+
resetDom: true,
|
|
15818
|
+
syncRemovedCapabilityTokens: true
|
|
15819
|
+
});
|
|
15820
|
+
setRuntimeCapabilityPalette(null);
|
|
15821
|
+
focusComposerAt(nextCaretOffset);
|
|
15822
|
+
},
|
|
15823
|
+
[
|
|
15824
|
+
applyExternalRuntimeCapabilities,
|
|
15825
|
+
commitComposerParts,
|
|
15826
|
+
composerPartsRef,
|
|
15827
|
+
focusComposerAt,
|
|
15828
|
+
runtimeCapabilities,
|
|
15829
|
+
runtimeCapabilitiesReady,
|
|
15830
|
+
runtimeCapabilityOptions,
|
|
15831
|
+
setRuntimeCapabilityPalette
|
|
15832
|
+
]
|
|
15833
|
+
);
|
|
15834
|
+
const applyComposerValueRuntimeCapabilities = React50.useCallback(
|
|
15835
|
+
(payload) => {
|
|
15836
|
+
const runtimeCapabilitiesPayload = isRuntimeCapabilitiesSelection(payload.runtimeCapabilities) ? payload.runtimeCapabilities : payload.runtimeCapabilities === null ? null : void 0;
|
|
15837
|
+
if (runtimeCapabilitiesPayload === void 0) {
|
|
15838
|
+
return;
|
|
15839
|
+
}
|
|
15840
|
+
if (payload.insertRuntimeCapabilities === true) {
|
|
15841
|
+
insertExternalRuntimeCapabilities(runtimeCapabilitiesPayload);
|
|
15842
|
+
} else {
|
|
15843
|
+
applyExternalRuntimeCapabilities(runtimeCapabilitiesPayload);
|
|
15844
|
+
}
|
|
15845
|
+
},
|
|
15846
|
+
[applyExternalRuntimeCapabilities, insertExternalRuntimeCapabilities]
|
|
15847
|
+
);
|
|
15848
|
+
const updateRuntimeCapabilityPalette = React50.useCallback(
|
|
15849
|
+
(parts, selectionStart) => {
|
|
15850
|
+
const input = composerInputRef.current;
|
|
15851
|
+
const editingText = getComposerEditingText(parts);
|
|
15852
|
+
const nextPalette = resolveRuntimeCapabilityPalette(
|
|
15853
|
+
editingText,
|
|
15854
|
+
typeof selectionStart === "number" ? selectionStart : input ? getComposerSelectionOffset(input) : getComposerEditingLength(parts)
|
|
15855
|
+
);
|
|
15856
|
+
setRuntimeCapabilityPalette(nextPalette);
|
|
15857
|
+
},
|
|
15858
|
+
[composerInputRef, setRuntimeCapabilityPalette]
|
|
15859
|
+
);
|
|
15860
|
+
const removeRunRuntimeCapability = React50.useCallback(
|
|
15861
|
+
(option) => {
|
|
15862
|
+
setRunRuntimeCapabilities(
|
|
15863
|
+
(previous) => toggleRuntimeCapabilitySelection(
|
|
15864
|
+
previous,
|
|
15865
|
+
option.type,
|
|
15866
|
+
option.id,
|
|
15867
|
+
false
|
|
15868
|
+
)
|
|
15869
|
+
);
|
|
15870
|
+
commitComposerParts(
|
|
15871
|
+
removeComposerCapabilityTokens(composerPartsRef.current, option),
|
|
15872
|
+
{
|
|
15873
|
+
resetDom: true,
|
|
15874
|
+
syncRemovedCapabilityTokens: false
|
|
15875
|
+
}
|
|
15876
|
+
);
|
|
15877
|
+
},
|
|
15878
|
+
[commitComposerParts, composerPartsRef, setRunRuntimeCapabilities]
|
|
15879
|
+
);
|
|
15880
|
+
const insertComposerCapabilityToken = React50.useCallback(
|
|
15881
|
+
(capability, range) => {
|
|
15882
|
+
const token = createComposerCapabilityPart(capability, createMessageId());
|
|
15883
|
+
const currentParts = composerPartsRef.current;
|
|
15884
|
+
const replaceRange = range ?? {
|
|
15885
|
+
start: getComposerEditingLength(currentParts),
|
|
15886
|
+
end: getComposerEditingLength(currentParts)
|
|
15887
|
+
};
|
|
15888
|
+
const nextParts = replaceComposerRange(
|
|
15889
|
+
currentParts,
|
|
15890
|
+
replaceRange.start,
|
|
15891
|
+
replaceRange.end,
|
|
15892
|
+
[token]
|
|
15893
|
+
);
|
|
15894
|
+
commitComposerParts(nextParts, {
|
|
15895
|
+
caretOffset: replaceRange.start + 1,
|
|
15896
|
+
resetDom: true,
|
|
15897
|
+
syncRemovedCapabilityTokens: true
|
|
15898
|
+
});
|
|
15899
|
+
setRunRuntimeCapabilities(
|
|
15900
|
+
(previous) => toggleRuntimeCapabilitySelection(
|
|
15901
|
+
previous,
|
|
15902
|
+
capability.type,
|
|
15903
|
+
capability.id,
|
|
15904
|
+
true
|
|
15905
|
+
)
|
|
15906
|
+
);
|
|
15907
|
+
setRuntimeCapabilityPalette(null);
|
|
15908
|
+
focusComposerAt(replaceRange.start + 1);
|
|
15909
|
+
},
|
|
15910
|
+
[
|
|
15911
|
+
commitComposerParts,
|
|
15912
|
+
composerPartsRef,
|
|
15913
|
+
focusComposerAt,
|
|
15914
|
+
setRunRuntimeCapabilities,
|
|
15915
|
+
setRuntimeCapabilityPalette
|
|
15916
|
+
]
|
|
15917
|
+
);
|
|
15918
|
+
React50.useEffect(() => {
|
|
15919
|
+
if (!runtimeCapabilitiesReady || !runtimeCapabilities) {
|
|
15920
|
+
return;
|
|
15921
|
+
}
|
|
15922
|
+
const pendingSelection = pendingExternalRuntimeCapabilityInsertRef.current;
|
|
15923
|
+
if (!pendingSelection) {
|
|
15924
|
+
return;
|
|
15925
|
+
}
|
|
15926
|
+
insertExternalRuntimeCapabilities(pendingSelection);
|
|
15927
|
+
}, [
|
|
15928
|
+
insertExternalRuntimeCapabilities,
|
|
15929
|
+
runtimeCapabilities,
|
|
15930
|
+
runtimeCapabilitiesReady
|
|
15931
|
+
]);
|
|
15932
|
+
return {
|
|
15933
|
+
applyComposerValueRuntimeCapabilities,
|
|
15934
|
+
insertExternalRuntimeCapabilities,
|
|
15935
|
+
updateRuntimeCapabilityPalette,
|
|
15936
|
+
removeRunRuntimeCapability,
|
|
15937
|
+
insertComposerCapabilityToken
|
|
15938
|
+
};
|
|
15939
|
+
}
|
|
15940
|
+
function HumanRuntimeCapabilityChips({
|
|
15941
|
+
options
|
|
15942
|
+
}) {
|
|
15943
|
+
if (options.length === 0) {
|
|
15944
|
+
return null;
|
|
15945
|
+
}
|
|
15946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "mb-2 flex flex-wrap gap-1.5", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
15947
|
+
"span",
|
|
15948
|
+
{
|
|
15949
|
+
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",
|
|
15950
|
+
children: [
|
|
15951
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(RuntimeCapabilityIcon, { option, variant: "chip" }),
|
|
15952
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "max-w-[9rem] truncate", children: option.label })
|
|
15953
|
+
]
|
|
15954
|
+
},
|
|
15955
|
+
`${option.type}:${option.id}`
|
|
15956
|
+
)) });
|
|
15957
|
+
}
|
|
15958
|
+
function DetachedRunRuntimeCapabilities({
|
|
15959
|
+
options,
|
|
15960
|
+
runOnlyLabel,
|
|
15961
|
+
removeLabel,
|
|
15962
|
+
onRemove
|
|
15963
|
+
}) {
|
|
15964
|
+
if (options.length === 0) {
|
|
15965
|
+
return null;
|
|
15966
|
+
}
|
|
15967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "mb-2 flex flex-wrap items-center gap-2", children: [
|
|
15968
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "text-xs text-muted-foreground", children: runOnlyLabel }),
|
|
15969
|
+
options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
15970
|
+
"span",
|
|
15971
|
+
{
|
|
15972
|
+
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",
|
|
15973
|
+
children: [
|
|
15974
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(RuntimeCapabilityIcon, { option, variant: "chip" }),
|
|
15975
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "max-w-40 truncate", children: option.label }),
|
|
15976
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15977
|
+
"button",
|
|
15978
|
+
{
|
|
15979
|
+
type: "button",
|
|
15980
|
+
onClick: () => onRemove(option),
|
|
15981
|
+
className: "rounded-full p-0.5 hover:bg-primary/15",
|
|
15982
|
+
title: removeLabel,
|
|
15983
|
+
"aria-label": removeLabel,
|
|
15984
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react29.X, { size: 11 })
|
|
15985
|
+
}
|
|
15986
|
+
)
|
|
15987
|
+
]
|
|
15988
|
+
},
|
|
15989
|
+
`${option.type}:${option.id}`
|
|
15990
|
+
))
|
|
15991
|
+
] });
|
|
15992
|
+
}
|
|
15993
|
+
function ComposerCapabilityToken({
|
|
15994
|
+
part
|
|
15995
|
+
}) {
|
|
15996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
15997
|
+
"span",
|
|
15998
|
+
{
|
|
15999
|
+
"data-composer-capability-key": part.key,
|
|
16000
|
+
"data-capability-type": part.capability.type,
|
|
16001
|
+
"data-capability-id": part.capability.id,
|
|
16002
|
+
contentEditable: false,
|
|
16003
|
+
className: "mx-0.5 inline-flex max-w-[14rem] select-none items-center gap-1 text-sm font-semibold text-primary align-baseline",
|
|
16004
|
+
children: [
|
|
16005
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(RuntimeCapabilityIcon, { option: part.capability, variant: "chip" }),
|
|
16006
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "truncate", children: part.capability.label })
|
|
16007
|
+
]
|
|
16008
|
+
},
|
|
16009
|
+
part.key
|
|
16010
|
+
);
|
|
16011
|
+
}
|
|
16012
|
+
|
|
16013
|
+
// src/lib/message-navigation.ts
|
|
16014
|
+
var MESSAGE_NAVIGATION_MIN_ITEMS = 3;
|
|
16015
|
+
var MAX_PREVIEW_LENGTH = 180;
|
|
16016
|
+
var MAX_TAG_LENGTH = 40;
|
|
16017
|
+
function isRecord6(value) {
|
|
16018
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
16019
|
+
}
|
|
16020
|
+
function readString4(value) {
|
|
16021
|
+
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
16022
|
+
}
|
|
16023
|
+
function normalizeWhitespace(value) {
|
|
16024
|
+
return value.replace(/\s+/g, " ").trim();
|
|
16025
|
+
}
|
|
16026
|
+
function truncate(value, maxLength) {
|
|
16027
|
+
const normalized = normalizeWhitespace(value);
|
|
16028
|
+
if (normalized.length <= maxLength) return normalized;
|
|
16029
|
+
return `${normalized.slice(0, Math.max(0, maxLength - 1)).trimEnd()}...`;
|
|
16030
|
+
}
|
|
16031
|
+
function pushText(draft, value) {
|
|
16032
|
+
const text = readString4(value);
|
|
16033
|
+
if (text) draft.text.push(text);
|
|
16034
|
+
}
|
|
16035
|
+
function pushTag(draft, value) {
|
|
16036
|
+
const tag = readString4(value);
|
|
16037
|
+
if (!tag) return;
|
|
16038
|
+
const normalized = truncate(tag, MAX_TAG_LENGTH);
|
|
16039
|
+
if (!draft.tags.includes(normalized)) {
|
|
16040
|
+
draft.tags.push(normalized);
|
|
16041
|
+
}
|
|
16042
|
+
}
|
|
16043
|
+
function mergeTags(...tagGroups) {
|
|
16044
|
+
const tags = [];
|
|
16045
|
+
for (const group of tagGroups) {
|
|
16046
|
+
for (const tag of group) {
|
|
16047
|
+
if (!tags.includes(tag)) tags.push(tag);
|
|
16048
|
+
}
|
|
16049
|
+
}
|
|
16050
|
+
return tags;
|
|
16051
|
+
}
|
|
16052
|
+
function getMessageNavigationItemId(message, index) {
|
|
16053
|
+
const messageId = readString4(message.id);
|
|
16054
|
+
if (messageId) return messageId;
|
|
16055
|
+
const type = readString4(message.type) ?? "message";
|
|
16056
|
+
return `${type}-${index}`;
|
|
16057
|
+
}
|
|
16058
|
+
function getMessageNavigationRole(type) {
|
|
16059
|
+
const normalized = readString4(type)?.toLowerCase();
|
|
16060
|
+
if (normalized === "human" || normalized === "user") return "user";
|
|
16061
|
+
if (normalized === "ai" || normalized === "assistant") return "assistant";
|
|
16062
|
+
if (normalized === "system") return "system";
|
|
16063
|
+
if (normalized === "tool") return "tool";
|
|
16064
|
+
if (normalized === "event") return "event";
|
|
16065
|
+
return "message";
|
|
16066
|
+
}
|
|
16067
|
+
function isTextContent4(content) {
|
|
16068
|
+
return content.type === "text";
|
|
16069
|
+
}
|
|
16070
|
+
function isReasoningContent4(content) {
|
|
16071
|
+
return content.type === "reasoning";
|
|
16072
|
+
}
|
|
16073
|
+
function isComponentContent4(content) {
|
|
16074
|
+
return content.type === "component";
|
|
16075
|
+
}
|
|
16076
|
+
function isMemoryContent2(content) {
|
|
16077
|
+
return content.type === "memory";
|
|
16078
|
+
}
|
|
16079
|
+
function isWidgetComponent3(content) {
|
|
16080
|
+
const data = content.data;
|
|
16081
|
+
return data?.type === "Widget" && Array.isArray(data.widgets);
|
|
16082
|
+
}
|
|
16083
|
+
function isMcpAppComponent2(content) {
|
|
16084
|
+
const data = content.data;
|
|
16085
|
+
return data?.type === "McpApp" && typeof data.appInstanceId === "string";
|
|
16086
|
+
}
|
|
16087
|
+
function collectWidgetContent(draft, content, labels) {
|
|
16088
|
+
const names = content.data.widgets.map((widget) => readString4(widget.name)).filter((name) => Boolean(name));
|
|
16089
|
+
if (names.length === 0) {
|
|
16090
|
+
pushTag(draft, labels.widget);
|
|
16091
|
+
return;
|
|
16092
|
+
}
|
|
16093
|
+
for (const name of names) {
|
|
16094
|
+
pushTag(draft, name);
|
|
16095
|
+
}
|
|
16096
|
+
}
|
|
16097
|
+
function collectMcpAppContent(draft, content, labels, language) {
|
|
16098
|
+
const title = readString4((0, import_chatkit_types6.resolveLocalizedText)(content.data.title, language)) ?? readString4(content.data.toolName) ?? labels.mcpApp;
|
|
16099
|
+
pushTag(draft, title);
|
|
16100
|
+
pushText(draft, (0, import_chatkit_types6.resolveLocalizedText)(content.data.description, language));
|
|
16101
|
+
}
|
|
16102
|
+
function collectComponentContent(draft, content, labels, language, options) {
|
|
16103
|
+
if (isWidgetComponent3(content)) {
|
|
16104
|
+
collectWidgetContent(draft, content, labels);
|
|
16105
|
+
return;
|
|
16106
|
+
}
|
|
16107
|
+
if (isMcpAppComponent2(content)) {
|
|
16108
|
+
collectMcpAppContent(draft, content, labels, language);
|
|
16109
|
+
return;
|
|
16110
|
+
}
|
|
16111
|
+
const data = getToolStepData(content);
|
|
16112
|
+
pushTag(
|
|
16113
|
+
draft,
|
|
16114
|
+
(0, import_chatkit_types6.resolveLocalizedText)(data.message, language) ?? getToolActivityLabel(content, language)
|
|
16115
|
+
);
|
|
16116
|
+
if (options.includeComponentText !== false) {
|
|
16117
|
+
pushText(draft, (0, import_chatkit_types6.resolveLocalizedText)(data.message, language));
|
|
16118
|
+
pushText(draft, (0, import_chatkit_types6.resolveLocalizedText)(data.title, language));
|
|
16119
|
+
pushText(draft, (0, import_chatkit_types6.resolveLocalizedText)(data.tool, language));
|
|
16120
|
+
pushText(draft, (0, import_chatkit_types6.resolveLocalizedText)(data.type, language));
|
|
16121
|
+
}
|
|
16122
|
+
}
|
|
16123
|
+
function collectContentItem(draft, item, labels, language, options) {
|
|
16124
|
+
if (item === void 0 || isThreadContextUsageRenderArtifact(item)) return;
|
|
16125
|
+
if (typeof item === "string") {
|
|
16126
|
+
pushText(draft, item);
|
|
16127
|
+
return;
|
|
16128
|
+
}
|
|
16129
|
+
if (isTextContent4(item) || isReasoningContent4(item)) {
|
|
16130
|
+
pushText(draft, item.text);
|
|
16131
|
+
if (isReasoningContent4(item)) pushTag(draft, labels.reasoning);
|
|
16132
|
+
return;
|
|
16133
|
+
}
|
|
16134
|
+
if (item.type === "image_url") {
|
|
16135
|
+
pushTag(draft, labels.image);
|
|
16136
|
+
return;
|
|
16137
|
+
}
|
|
16138
|
+
if (isComponentContent4(item)) {
|
|
16139
|
+
collectComponentContent(draft, item, labels, language, options);
|
|
16140
|
+
return;
|
|
16141
|
+
}
|
|
16142
|
+
if (isMemoryContent2(item)) {
|
|
16143
|
+
pushTag(draft, labels.memory);
|
|
16144
|
+
}
|
|
16145
|
+
}
|
|
16146
|
+
function collectContent(draft, content, labels, language, options = {}) {
|
|
16147
|
+
if (typeof content === "string") {
|
|
16148
|
+
pushText(draft, content);
|
|
16149
|
+
return;
|
|
16150
|
+
}
|
|
16151
|
+
if (!Array.isArray(content)) {
|
|
16152
|
+
return;
|
|
16153
|
+
}
|
|
16154
|
+
for (const item of content) {
|
|
16155
|
+
collectContentItem(
|
|
16156
|
+
draft,
|
|
16157
|
+
item,
|
|
16158
|
+
labels,
|
|
16159
|
+
language,
|
|
16160
|
+
options
|
|
16161
|
+
);
|
|
16162
|
+
}
|
|
16163
|
+
}
|
|
16164
|
+
function collectReasoning(draft, reasoning, labels) {
|
|
16165
|
+
if (!Array.isArray(reasoning)) return;
|
|
16166
|
+
for (const item of reasoning) {
|
|
16167
|
+
if (!isRecord6(item)) continue;
|
|
16168
|
+
pushText(draft, item.text);
|
|
16169
|
+
if (readString4(item.text)) pushTag(draft, labels.reasoning);
|
|
16170
|
+
}
|
|
16171
|
+
}
|
|
16172
|
+
function collectFiles(draft, value, fallbackLabel) {
|
|
16173
|
+
if (!Array.isArray(value)) return;
|
|
16174
|
+
for (const file of value) {
|
|
16175
|
+
if (!isRecord6(file)) continue;
|
|
16176
|
+
pushTag(
|
|
16177
|
+
draft,
|
|
16178
|
+
file.originalName ?? file.name ?? file.fileName ?? file.id ?? fallbackLabel
|
|
16179
|
+
);
|
|
16180
|
+
}
|
|
16181
|
+
}
|
|
16182
|
+
function collectReferences(draft, value) {
|
|
16183
|
+
for (const reference of normalizeReferences(value)) {
|
|
16184
|
+
pushTag(draft, getReferenceLabel(reference));
|
|
16185
|
+
}
|
|
16186
|
+
}
|
|
16187
|
+
function collectRuntimeCapabilities(draft, value) {
|
|
16188
|
+
if (!Array.isArray(value)) return;
|
|
16189
|
+
for (const option of value) {
|
|
16190
|
+
if (!isRecord6(option)) continue;
|
|
16191
|
+
pushTag(draft, option.label ?? option.id ?? option.type);
|
|
16192
|
+
}
|
|
16193
|
+
}
|
|
16194
|
+
function getTitle(role, labels, assistantTitle) {
|
|
16195
|
+
if (role === "assistant" && assistantTitle?.trim()) {
|
|
16196
|
+
return assistantTitle.trim();
|
|
16197
|
+
}
|
|
16198
|
+
return labels[role];
|
|
16199
|
+
}
|
|
16200
|
+
function buildMessageNavigationItemSummary(message, index, options, collectOptions = {}) {
|
|
16201
|
+
const role = getMessageNavigationRole(message.type);
|
|
16202
|
+
const draft = {
|
|
16203
|
+
text: [],
|
|
16204
|
+
tags: []
|
|
16205
|
+
};
|
|
16206
|
+
const language = options.language ?? "en-US";
|
|
16207
|
+
const labels = options.labels;
|
|
16208
|
+
if (role === "user") {
|
|
16209
|
+
pushText(draft, message.submittedInput);
|
|
16210
|
+
}
|
|
16211
|
+
collectContent(draft, message.content, labels, language, collectOptions);
|
|
16212
|
+
collectReasoning(draft, message.reasoning, labels);
|
|
16213
|
+
collectFiles(draft, message.fileAssets, labels.attachment);
|
|
16214
|
+
collectFiles(draft, message.attachments, labels.attachment);
|
|
16215
|
+
collectReferences(draft, message.references);
|
|
16216
|
+
collectRuntimeCapabilities(draft, message.runtimeCapabilityOptions);
|
|
16217
|
+
const text = draft.text.map(normalizeWhitespace).filter(Boolean).join(" ");
|
|
16218
|
+
const preview = truncate(text, MAX_PREVIEW_LENGTH) || draft.tags.slice(0, 2).join(" \xB7 ");
|
|
16219
|
+
if (!preview && draft.tags.length === 0) {
|
|
16220
|
+
return null;
|
|
16221
|
+
}
|
|
16222
|
+
const messageId = readString4(message.id) ?? void 0;
|
|
16223
|
+
return {
|
|
16224
|
+
id: getMessageNavigationItemId(message, index),
|
|
16225
|
+
...messageId ? { messageId } : {},
|
|
16226
|
+
index,
|
|
16227
|
+
role,
|
|
16228
|
+
title: getTitle(role, labels, options.assistantTitle),
|
|
16229
|
+
preview,
|
|
16230
|
+
tags: draft.tags
|
|
16231
|
+
};
|
|
16232
|
+
}
|
|
16233
|
+
function buildMessageNavigationItems(messages, options) {
|
|
16234
|
+
const items = [];
|
|
16235
|
+
let pendingUser = null;
|
|
16236
|
+
messages.forEach((message, messageIndex) => {
|
|
16237
|
+
const item = buildMessageNavigationItemSummary(
|
|
16238
|
+
message,
|
|
16239
|
+
messageIndex,
|
|
16240
|
+
options,
|
|
16241
|
+
{ includeComponentText: false }
|
|
16242
|
+
);
|
|
16243
|
+
if (!item) return;
|
|
16244
|
+
if (item.role === "user") {
|
|
16245
|
+
pendingUser = { item };
|
|
16246
|
+
return;
|
|
16247
|
+
}
|
|
16248
|
+
if (item.role !== "assistant" || !pendingUser) {
|
|
16249
|
+
return;
|
|
16250
|
+
}
|
|
16251
|
+
items.push({
|
|
16252
|
+
id: pendingUser.item.id,
|
|
16253
|
+
...pendingUser.item.messageId ? { messageId: pendingUser.item.messageId } : {},
|
|
16254
|
+
index: items.length,
|
|
16255
|
+
role: "user",
|
|
16256
|
+
title: pendingUser.item.preview,
|
|
16257
|
+
preview: item.preview,
|
|
16258
|
+
tags: mergeTags(item.tags, pendingUser.item.tags)
|
|
16259
|
+
});
|
|
16260
|
+
pendingUser = null;
|
|
16261
|
+
});
|
|
16262
|
+
return items;
|
|
16263
|
+
}
|
|
16264
|
+
|
|
16265
|
+
// src/components/chat.tsx
|
|
16266
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
16267
|
+
var import_meta2 = {};
|
|
16268
|
+
var defaultApiUrl2 = import_meta2.env.VITE_XPERTAI_API_URL;
|
|
16269
|
+
var COMPOSER_INPUT_MAX_HEIGHT = 128;
|
|
16270
|
+
var LONG_TEXT_REFERENCE_THRESHOLD = 5e3;
|
|
16271
|
+
var GOAL_RUN_INPUT = "Continue working toward the active goal.";
|
|
16272
|
+
function isGoalAdapter(value) {
|
|
16273
|
+
return Boolean(value) && typeof value === "object" && typeof value.getGoal === "function" && typeof value.setGoal === "function" && typeof value.updateGoal === "function" && typeof value.clearGoal === "function";
|
|
16274
|
+
}
|
|
16275
|
+
function formatGoalElapsed(seconds) {
|
|
16276
|
+
if (seconds < 60) {
|
|
16277
|
+
return `${seconds}s`;
|
|
16278
|
+
}
|
|
16279
|
+
const minutes = Math.floor(seconds / 60);
|
|
16280
|
+
const remainingSeconds = seconds % 60;
|
|
16281
|
+
return remainingSeconds ? `${minutes}m ${remainingSeconds}s` : `${minutes}m`;
|
|
16282
|
+
}
|
|
16283
|
+
async function readImageDimensions(file) {
|
|
16284
|
+
if (typeof window === "undefined" || typeof URL === "undefined") {
|
|
16285
|
+
return {};
|
|
16286
|
+
}
|
|
16287
|
+
return new Promise((resolve) => {
|
|
16288
|
+
const objectUrl = URL.createObjectURL(file);
|
|
16289
|
+
const image = new window.Image();
|
|
16290
|
+
const cleanup = () => {
|
|
16291
|
+
URL.revokeObjectURL(objectUrl);
|
|
16292
|
+
};
|
|
16293
|
+
image.onload = () => {
|
|
16294
|
+
resolve({
|
|
16295
|
+
width: image.naturalWidth || void 0,
|
|
16296
|
+
height: image.naturalHeight || void 0
|
|
16297
|
+
});
|
|
16298
|
+
cleanup();
|
|
16299
|
+
};
|
|
16300
|
+
image.onerror = () => {
|
|
16301
|
+
resolve({});
|
|
16302
|
+
cleanup();
|
|
16303
|
+
};
|
|
16304
|
+
image.src = objectUrl;
|
|
16305
|
+
});
|
|
16306
|
+
}
|
|
16307
|
+
function getUploadedFileUrl(file) {
|
|
16308
|
+
return file.url ?? file.fileUrl ?? file.thumbUrl;
|
|
16309
|
+
}
|
|
16310
|
+
function buildPastedImageReference(file, uploadedFile, dimensions) {
|
|
16311
|
+
const name = uploadedFile.originalName?.trim() || file.name.trim() || "Pasted image";
|
|
16312
|
+
const mimeType = uploadedFile.mimeType?.trim() || file.type.trim() || "image/*";
|
|
16313
|
+
const size2 = uploadedFile.size ?? file.size;
|
|
16314
|
+
const width = dimensions?.width;
|
|
16315
|
+
const height = dimensions?.height;
|
|
16316
|
+
const metaParts = [
|
|
16317
|
+
mimeType,
|
|
16318
|
+
width && height ? `${width}x${height}` : null,
|
|
16319
|
+
typeof size2 === "number" ? `${size2} bytes` : null
|
|
16320
|
+
].filter((part) => Boolean(part));
|
|
16321
|
+
return {
|
|
16322
|
+
type: "image",
|
|
16323
|
+
id: uploadedFile.id,
|
|
16324
|
+
fileId: uploadedFile.storageFileId,
|
|
16325
|
+
url: getUploadedFileUrl(uploadedFile),
|
|
16326
|
+
mimeType,
|
|
16327
|
+
name,
|
|
16328
|
+
...typeof size2 === "number" ? { size: size2 } : {},
|
|
16329
|
+
...width ? { width } : {},
|
|
16330
|
+
...height ? { height } : {},
|
|
16331
|
+
text: `Pasted image${metaParts.length ? ` (${metaParts.join(", ")})` : ""}: ${name}`
|
|
16332
|
+
};
|
|
16333
|
+
}
|
|
16334
|
+
function formatMessageContent(content) {
|
|
16335
|
+
if (typeof content === "string") {
|
|
16336
|
+
return content;
|
|
16337
|
+
}
|
|
16338
|
+
if (Array.isArray(content)) {
|
|
16339
|
+
return content.map((part) => {
|
|
16340
|
+
if (typeof part === "string") return part;
|
|
16341
|
+
if (part && typeof part === "object" && "text" in part) {
|
|
15273
16342
|
const textValue = part.text;
|
|
15274
16343
|
return typeof textValue === "string" ? textValue : "";
|
|
15275
16344
|
}
|
|
@@ -15298,8 +16367,8 @@ function ReferenceChip({
|
|
|
15298
16367
|
}) {
|
|
15299
16368
|
const metaLine = getReferenceMetaLine(reference);
|
|
15300
16369
|
const isComposer = variant === "composer";
|
|
15301
|
-
const Icon = reference.type === "quote" ?
|
|
15302
|
-
return /* @__PURE__ */ (0,
|
|
16370
|
+
const Icon = reference.type === "quote" ? import_lucide_react30.Quote : reference.type === "image" ? import_lucide_react30.ImageIcon : import_lucide_react30.FileText;
|
|
16371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
15303
16372
|
"div",
|
|
15304
16373
|
{
|
|
15305
16374
|
className: cn(
|
|
@@ -15308,7 +16377,7 @@ function ReferenceChip({
|
|
|
15308
16377
|
),
|
|
15309
16378
|
title: getReferenceTitle(reference),
|
|
15310
16379
|
children: [
|
|
15311
|
-
/* @__PURE__ */ (0,
|
|
16380
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15312
16381
|
Icon,
|
|
15313
16382
|
{
|
|
15314
16383
|
size: isComposer ? 14 : 12,
|
|
@@ -15318,8 +16387,8 @@ function ReferenceChip({
|
|
|
15318
16387
|
)
|
|
15319
16388
|
}
|
|
15320
16389
|
),
|
|
15321
|
-
/* @__PURE__ */ (0,
|
|
15322
|
-
/* @__PURE__ */ (0,
|
|
16390
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
16391
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15323
16392
|
"div",
|
|
15324
16393
|
{
|
|
15325
16394
|
className: cn(
|
|
@@ -15329,7 +16398,7 @@ function ReferenceChip({
|
|
|
15329
16398
|
children: getReferenceLabel(reference)
|
|
15330
16399
|
}
|
|
15331
16400
|
),
|
|
15332
|
-
metaLine && /* @__PURE__ */ (0,
|
|
16401
|
+
metaLine && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15333
16402
|
"div",
|
|
15334
16403
|
{
|
|
15335
16404
|
className: cn(
|
|
@@ -15340,7 +16409,7 @@ function ReferenceChip({
|
|
|
15340
16409
|
}
|
|
15341
16410
|
)
|
|
15342
16411
|
] }),
|
|
15343
|
-
onRemove && removeLabel && /* @__PURE__ */ (0,
|
|
16412
|
+
onRemove && removeLabel && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15344
16413
|
"button",
|
|
15345
16414
|
{
|
|
15346
16415
|
type: "button",
|
|
@@ -15351,7 +16420,7 @@ function ReferenceChip({
|
|
|
15351
16420
|
),
|
|
15352
16421
|
title: removeLabel,
|
|
15353
16422
|
"aria-label": removeLabel,
|
|
15354
|
-
children: /* @__PURE__ */ (0,
|
|
16423
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.X, { size: 12 })
|
|
15355
16424
|
}
|
|
15356
16425
|
)
|
|
15357
16426
|
]
|
|
@@ -15366,35 +16435,66 @@ function Chat({
|
|
|
15366
16435
|
clientSecret = "",
|
|
15367
16436
|
isClientSecretInitializing = false
|
|
15368
16437
|
}) {
|
|
15369
|
-
const { t } = useChatkitTranslation();
|
|
16438
|
+
const { t, i18n: i18n2 } = useChatkitTranslation();
|
|
15370
16439
|
const composer = options?.composer;
|
|
15371
16440
|
const startScreen = options?.startScreen;
|
|
15372
16441
|
const history = options?.history;
|
|
15373
16442
|
const disclaimer = options?.disclaimer;
|
|
15374
16443
|
const apiUrl = options?.api?.apiUrl || defaultApiUrl2;
|
|
16444
|
+
const messageNavigationEnabled = options?.messageNavigation?.enabled !== false;
|
|
15375
16445
|
const { setStream } = useStreamManager();
|
|
15376
16446
|
const stream = useStreamContext();
|
|
15377
16447
|
const { theme } = useTheme();
|
|
15378
|
-
const
|
|
15379
|
-
const
|
|
15380
|
-
|
|
15381
|
-
|
|
15382
|
-
|
|
15383
|
-
const
|
|
15384
|
-
const
|
|
15385
|
-
|
|
15386
|
-
|
|
15387
|
-
|
|
16448
|
+
const effectiveClientSecret = stream.apiKey?.trim() ? stream.apiKey : clientSecret;
|
|
16449
|
+
const missingConfigKind = getMissingApiConfigurationKind({
|
|
16450
|
+
apiUrl,
|
|
16451
|
+
clientSecret: effectiveClientSecret
|
|
16452
|
+
});
|
|
16453
|
+
const missingConfig = Boolean(missingConfigKind);
|
|
16454
|
+
const missingConfigShortMessage = React51.useMemo(() => {
|
|
16455
|
+
switch (missingConfigKind) {
|
|
16456
|
+
case "apiUrl":
|
|
16457
|
+
return t("chat.missingApiUrlShort");
|
|
16458
|
+
case "clientSecret":
|
|
16459
|
+
return t("chat.missingClientSecretShort");
|
|
16460
|
+
case "apiUrlAndClientSecret":
|
|
16461
|
+
return t("chat.missingApiUrlAndClientSecretShort");
|
|
16462
|
+
default:
|
|
16463
|
+
return t("chat.missingConfigShort");
|
|
16464
|
+
}
|
|
16465
|
+
}, [missingConfigKind, t]);
|
|
16466
|
+
const missingConfigDetailMessage = React51.useMemo(() => {
|
|
16467
|
+
switch (missingConfigKind) {
|
|
16468
|
+
case "apiUrl":
|
|
16469
|
+
return t("chat.missingApiUrlDetail");
|
|
16470
|
+
case "clientSecret":
|
|
16471
|
+
return t("chat.missingClientSecretDetail");
|
|
16472
|
+
case "apiUrlAndClientSecret":
|
|
16473
|
+
return t("chat.missingApiUrlAndClientSecretDetail");
|
|
16474
|
+
default:
|
|
16475
|
+
return t("chat.missingConfigDetail");
|
|
16476
|
+
}
|
|
16477
|
+
}, [missingConfigKind, t]);
|
|
16478
|
+
const [isHistoryLoading, setIsHistoryLoading] = React51.useState(false);
|
|
16479
|
+
const [historyError, setHistoryError] = React51.useState(null);
|
|
16480
|
+
const [assistantName, setAssistantName] = React51.useState(null);
|
|
16481
|
+
const [assistantAvatar, setAssistantAvatar] = React51.useState(null);
|
|
16482
|
+
const [threadGoal, setThreadGoal] = React51.useState(null);
|
|
16483
|
+
const [goalError, setGoalError] = React51.useState(null);
|
|
16484
|
+
const [isGoalLoading, setIsGoalLoading] = React51.useState(false);
|
|
16485
|
+
const [isGoalPanelOpen, setIsGoalPanelOpen] = React51.useState(false);
|
|
16486
|
+
const [isGoalObjectiveExpanded, setIsGoalObjectiveExpanded] = React51.useState(false);
|
|
16487
|
+
const [goalElapsedStartedAt, setGoalElapsedStartedAt] = React51.useState(null);
|
|
15388
16488
|
const LOADING_DOTS_MIN_DURATION = 800;
|
|
15389
16489
|
const STREAMING_STATUS_REFRESH_MS = 250;
|
|
15390
|
-
const [showLoadingDots, setShowLoadingDots] =
|
|
15391
|
-
const [streamingNow, setStreamingNow] =
|
|
15392
|
-
const loadingStartTimeRef =
|
|
15393
|
-
const lastStreamOutputAtRef =
|
|
15394
|
-
|
|
16490
|
+
const [showLoadingDots, setShowLoadingDots] = React51.useState(false);
|
|
16491
|
+
const [streamingNow, setStreamingNow] = React51.useState(() => Date.now());
|
|
16492
|
+
const loadingStartTimeRef = React51.useRef(null);
|
|
16493
|
+
const lastStreamOutputAtRef = React51.useRef(null);
|
|
16494
|
+
React51.useEffect(() => {
|
|
15395
16495
|
setStream(stream);
|
|
15396
16496
|
}, [setStream, stream]);
|
|
15397
|
-
|
|
16497
|
+
React51.useEffect(() => {
|
|
15398
16498
|
if (stream.isLoading) {
|
|
15399
16499
|
if (!loadingStartTimeRef.current) {
|
|
15400
16500
|
loadingStartTimeRef.current = Date.now();
|
|
@@ -15417,7 +16517,7 @@ function Chat({
|
|
|
15417
16517
|
}
|
|
15418
16518
|
}
|
|
15419
16519
|
}, [stream.isLoading]);
|
|
15420
|
-
|
|
16520
|
+
React51.useEffect(() => {
|
|
15421
16521
|
if (!stream.isLoading) {
|
|
15422
16522
|
lastStreamOutputAtRef.current = null;
|
|
15423
16523
|
setStreamingNow(Date.now());
|
|
@@ -15427,7 +16527,7 @@ function Chat({
|
|
|
15427
16527
|
lastStreamOutputAtRef.current = now;
|
|
15428
16528
|
setStreamingNow(now);
|
|
15429
16529
|
}, [stream.messages, stream.isLoading]);
|
|
15430
|
-
|
|
16530
|
+
React51.useEffect(() => {
|
|
15431
16531
|
if (!stream.isLoading) {
|
|
15432
16532
|
return;
|
|
15433
16533
|
}
|
|
@@ -15436,7 +16536,7 @@ function Chat({
|
|
|
15436
16536
|
}, STREAMING_STATUS_REFRESH_MS);
|
|
15437
16537
|
return () => window.clearInterval(timer);
|
|
15438
16538
|
}, [stream.isLoading]);
|
|
15439
|
-
|
|
16539
|
+
React51.useEffect(() => {
|
|
15440
16540
|
if (threadGoal?.status === "active" && stream.isLoading) {
|
|
15441
16541
|
setGoalElapsedStartedAt(Date.now());
|
|
15442
16542
|
return;
|
|
@@ -15448,82 +16548,100 @@ function Chat({
|
|
|
15448
16548
|
threadGoal?.id,
|
|
15449
16549
|
threadGoal?.status
|
|
15450
16550
|
]);
|
|
15451
|
-
|
|
16551
|
+
React51.useEffect(() => {
|
|
15452
16552
|
setIsGoalObjectiveExpanded(false);
|
|
15453
16553
|
}, [threadGoal?.id]);
|
|
15454
|
-
const [composerParts, setComposerParts] =
|
|
15455
|
-
const [renderedComposerParts, setRenderedComposerParts] =
|
|
15456
|
-
const [composerDomVersion, setComposerDomVersion] =
|
|
15457
|
-
const [selectedTool, setSelectedTool] =
|
|
16554
|
+
const [composerParts, setComposerParts] = React51.useState([]);
|
|
16555
|
+
const [renderedComposerParts, setRenderedComposerParts] = React51.useState([]);
|
|
16556
|
+
const [composerDomVersion, setComposerDomVersion] = React51.useState(0);
|
|
16557
|
+
const [selectedTool, setSelectedTool] = React51.useState(
|
|
15458
16558
|
null
|
|
15459
16559
|
);
|
|
15460
|
-
const [planModeEnabled, setPlanModeEnabled] =
|
|
15461
|
-
const [petSettingsOpen, setPetSettingsOpen] =
|
|
15462
|
-
const [petLocalSettings, setPetLocalSettings] =
|
|
15463
|
-
const [
|
|
15464
|
-
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] = React49.useState(false);
|
|
15465
|
-
const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] = React49.useState(
|
|
15466
|
-
() => createEmptyRuntimeCapabilitiesSelection()
|
|
15467
|
-
);
|
|
15468
|
-
const [runRuntimeCapabilities, setRunRuntimeCapabilities] = React49.useState(
|
|
15469
|
-
() => createEmptyRuntimeCapabilitiesSelection()
|
|
15470
|
-
);
|
|
15471
|
-
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] = React49.useState(null);
|
|
15472
|
-
const [attachmentState, setAttachmentState] = React49.useState({
|
|
16560
|
+
const [planModeEnabled, setPlanModeEnabled] = React51.useState(false);
|
|
16561
|
+
const [petSettingsOpen, setPetSettingsOpen] = React51.useState(false);
|
|
16562
|
+
const [petLocalSettings, setPetLocalSettings] = React51.useState(() => readPetLocalSettings());
|
|
16563
|
+
const [attachmentState, setAttachmentState] = React51.useState({
|
|
15473
16564
|
uploadedFiles: [],
|
|
15474
16565
|
hasUploadingFiles: false,
|
|
15475
16566
|
hasParsingFiles: false
|
|
15476
16567
|
});
|
|
15477
|
-
const [references, setReferences] =
|
|
15478
|
-
const [isUploadingReferenceImages, setIsUploadingReferenceImages] =
|
|
15479
|
-
const [quoteSelection, setQuoteSelection] =
|
|
15480
|
-
const [isAtBottom, setIsAtBottom] =
|
|
15481
|
-
const [hasUpdatesBelow, setHasUpdatesBelow] =
|
|
16568
|
+
const [references, setReferences] = React51.useState([]);
|
|
16569
|
+
const [isUploadingReferenceImages, setIsUploadingReferenceImages] = React51.useState(false);
|
|
16570
|
+
const [quoteSelection, setQuoteSelection] = React51.useState(null);
|
|
16571
|
+
const [isAtBottom, setIsAtBottom] = React51.useState(true);
|
|
16572
|
+
const [hasUpdatesBelow, setHasUpdatesBelow] = React51.useState(false);
|
|
15482
16573
|
const {
|
|
15483
16574
|
threads,
|
|
15484
16575
|
deleteThread,
|
|
15485
16576
|
refreshThreads,
|
|
15486
16577
|
isLoading: isThreadsLoading
|
|
15487
16578
|
} = useThreads();
|
|
15488
|
-
const viewportRef =
|
|
15489
|
-
const
|
|
15490
|
-
|
|
15491
|
-
|
|
15492
|
-
const
|
|
16579
|
+
const viewportRef = React51.useRef(null);
|
|
16580
|
+
const messageNavigationAnchorsRef = React51.useRef(
|
|
16581
|
+
/* @__PURE__ */ new Map()
|
|
16582
|
+
);
|
|
16583
|
+
const attachmentsRef = React51.useRef(null);
|
|
16584
|
+
const composerInputRef = React51.useRef(null);
|
|
16585
|
+
const slashPaletteRef = React51.useRef(null);
|
|
16586
|
+
const slashPaletteOptionRefs = React51.useRef(
|
|
15493
16587
|
[]
|
|
15494
16588
|
);
|
|
15495
|
-
const composerPartsRef =
|
|
15496
|
-
const pendingComposerCaretOffsetRef =
|
|
15497
|
-
const shouldAutoScrollRef =
|
|
15498
|
-
const forceFollowRef =
|
|
15499
|
-
const previousMessageCountRef =
|
|
15500
|
-
const previousScrollTopRef =
|
|
15501
|
-
const isPrependingHistoryMessagesRef =
|
|
15502
|
-
const autoScrollFrameRef =
|
|
15503
|
-
const isPointerDownRef =
|
|
15504
|
-
const lastTouchYRef =
|
|
15505
|
-
const
|
|
16589
|
+
const composerPartsRef = React51.useRef([]);
|
|
16590
|
+
const pendingComposerCaretOffsetRef = React51.useRef(null);
|
|
16591
|
+
const shouldAutoScrollRef = React51.useRef(true);
|
|
16592
|
+
const forceFollowRef = React51.useRef(false);
|
|
16593
|
+
const previousMessageCountRef = React51.useRef(0);
|
|
16594
|
+
const previousScrollTopRef = React51.useRef(0);
|
|
16595
|
+
const isPrependingHistoryMessagesRef = React51.useRef(false);
|
|
16596
|
+
const autoScrollFrameRef = React51.useRef(null);
|
|
16597
|
+
const isPointerDownRef = React51.useRef(false);
|
|
16598
|
+
const lastTouchYRef = React51.useRef(null);
|
|
16599
|
+
const {
|
|
16600
|
+
runtimeCapabilities,
|
|
16601
|
+
runtimeCapabilitiesReady,
|
|
16602
|
+
runtimeCapabilityOptions,
|
|
16603
|
+
effectiveSessionRuntimeCapabilities,
|
|
16604
|
+
runRuntimeCapabilities,
|
|
16605
|
+
detachedRunRuntimeCapabilityOptions,
|
|
16606
|
+
runtimeCapabilityPalette,
|
|
16607
|
+
setRunRuntimeCapabilities,
|
|
16608
|
+
setRuntimeCapabilityPalette,
|
|
16609
|
+
applyExternalRuntimeCapabilities,
|
|
16610
|
+
handleSessionRuntimeCapabilityToggle,
|
|
16611
|
+
addRunRuntimeCapabilities,
|
|
16612
|
+
resetRunRuntimeCapabilities,
|
|
16613
|
+
getRuntimeCapabilitiesForSubmit,
|
|
16614
|
+
getRuntimeCapabilitiesForCommand,
|
|
16615
|
+
persistSessionRuntimeCapabilities
|
|
16616
|
+
} = useRuntimeCapabilitiesState({
|
|
16617
|
+
client: stream.client,
|
|
16618
|
+
assistantId: stream.assistantId,
|
|
16619
|
+
threadId: stream.threadId,
|
|
16620
|
+
disabled: missingConfig || !stream.client || !stream.assistantId,
|
|
16621
|
+
composerParts
|
|
16622
|
+
});
|
|
15506
16623
|
const resolvedTitle = title ?? t("chat.title");
|
|
15507
16624
|
const resolvedPlaceholder = placeholder ?? t("chat.placeholder");
|
|
16625
|
+
const assistantTitle = assistantName || resolvedTitle;
|
|
15508
16626
|
const petRequired = options?.displayMode === "pet";
|
|
15509
|
-
const basePetSettings =
|
|
16627
|
+
const basePetSettings = React51.useMemo(
|
|
15510
16628
|
() => derivePetLocalSettings(options?.pet),
|
|
15511
16629
|
[options?.pet]
|
|
15512
16630
|
);
|
|
15513
|
-
const displayedPetSettings =
|
|
16631
|
+
const displayedPetSettings = React51.useMemo(
|
|
15514
16632
|
() => ({
|
|
15515
16633
|
...petLocalSettings ?? basePetSettings,
|
|
15516
16634
|
...petRequired ? { enabled: true } : {}
|
|
15517
16635
|
}),
|
|
15518
16636
|
[basePetSettings, petLocalSettings, petRequired]
|
|
15519
16637
|
);
|
|
15520
|
-
const effectivePet =
|
|
16638
|
+
const effectivePet = React51.useMemo(() => {
|
|
15521
16639
|
if (petRequired || petLocalSettings) {
|
|
15522
16640
|
return buildPetOptionsFromLocalSettings(displayedPetSettings);
|
|
15523
16641
|
}
|
|
15524
16642
|
return options?.pet ?? null;
|
|
15525
16643
|
}, [displayedPetSettings, options?.pet, petLocalSettings, petRequired]);
|
|
15526
|
-
const savePetLocalSettings =
|
|
16644
|
+
const savePetLocalSettings = React51.useCallback(
|
|
15527
16645
|
(settings) => {
|
|
15528
16646
|
const nextSettings = petRequired ? { ...settings, enabled: true } : settings;
|
|
15529
16647
|
setPetLocalSettings(nextSettings);
|
|
@@ -15531,7 +16649,7 @@ function Chat({
|
|
|
15531
16649
|
},
|
|
15532
16650
|
[petRequired]
|
|
15533
16651
|
);
|
|
15534
|
-
const handlePetCommand =
|
|
16652
|
+
const handlePetCommand = React51.useCallback(
|
|
15535
16653
|
(mode) => {
|
|
15536
16654
|
if (mode === "settings") {
|
|
15537
16655
|
setPetSettingsOpen(true);
|
|
@@ -15553,16 +16671,53 @@ function Chat({
|
|
|
15553
16671
|
[displayedPetSettings, effectivePet, petRequired, savePetLocalSettings]
|
|
15554
16672
|
);
|
|
15555
16673
|
const inputPlaceholder = selectedTool?.placeholderOverride ?? composer?.placeholder ?? resolvedPlaceholder;
|
|
15556
|
-
const messages =
|
|
16674
|
+
const messages = React51.useMemo(
|
|
15557
16675
|
() => stream.messages ?? [],
|
|
15558
16676
|
[stream.messages]
|
|
15559
16677
|
);
|
|
16678
|
+
const messageNavigationLabels = React51.useMemo(
|
|
16679
|
+
() => ({
|
|
16680
|
+
user: t("chat.youLabel"),
|
|
16681
|
+
assistant: assistantTitle,
|
|
16682
|
+
system: t("message.navigation.system"),
|
|
16683
|
+
tool: t("message.navigation.tool"),
|
|
16684
|
+
event: t("message.navigation.event"),
|
|
16685
|
+
message: t("message.navigation.message"),
|
|
16686
|
+
image: t("message.navigation.image"),
|
|
16687
|
+
memory: t("message.navigation.memory"),
|
|
16688
|
+
widget: t("message.navigation.widget"),
|
|
16689
|
+
mcpApp: t("message.navigation.mcpApp"),
|
|
16690
|
+
attachment: t("message.navigation.attachment"),
|
|
16691
|
+
reference: t("message.navigation.reference"),
|
|
16692
|
+
capability: t("message.navigation.capability"),
|
|
16693
|
+
reasoning: t("message.reasoning")
|
|
16694
|
+
}),
|
|
16695
|
+
[assistantTitle, t]
|
|
16696
|
+
);
|
|
16697
|
+
const messageNavigationItems = React51.useMemo(
|
|
16698
|
+
() => messageNavigationEnabled ? buildMessageNavigationItems(
|
|
16699
|
+
messages,
|
|
16700
|
+
{
|
|
16701
|
+
labels: messageNavigationLabels,
|
|
16702
|
+
language: i18n2.language,
|
|
16703
|
+
assistantTitle
|
|
16704
|
+
}
|
|
16705
|
+
) : [],
|
|
16706
|
+
[
|
|
16707
|
+
assistantTitle,
|
|
16708
|
+
i18n2.language,
|
|
16709
|
+
messageNavigationEnabled,
|
|
16710
|
+
messageNavigationLabels,
|
|
16711
|
+
messages
|
|
16712
|
+
]
|
|
16713
|
+
);
|
|
16714
|
+
const showMessageNavigation = messageNavigationItems.length >= MESSAGE_NAVIGATION_MIN_ITEMS;
|
|
15560
16715
|
const historyMessagePagination = stream.historyMessagePagination;
|
|
15561
16716
|
const isLoadingMoreMessages = Boolean(
|
|
15562
16717
|
historyMessagePagination?.isLoadingMore
|
|
15563
16718
|
);
|
|
15564
16719
|
const canLoadMoreMessages = Boolean(historyMessagePagination?.hasMore);
|
|
15565
|
-
const draft =
|
|
16720
|
+
const draft = React51.useMemo(
|
|
15566
16721
|
() => getComposerPlainText(composerParts),
|
|
15567
16722
|
[composerParts]
|
|
15568
16723
|
);
|
|
@@ -15576,7 +16731,7 @@ function Chat({
|
|
|
15576
16731
|
isEmpty: isComposerInputEmpty,
|
|
15577
16732
|
isStacked: isComposerStacked
|
|
15578
16733
|
});
|
|
15579
|
-
const pendingFollowUps =
|
|
16734
|
+
const pendingFollowUps = React51.useMemo(
|
|
15580
16735
|
() => sortVisiblePendingFollowUps(stream.pendingFollowUps ?? []),
|
|
15581
16736
|
[stream.pendingFollowUps]
|
|
15582
16737
|
);
|
|
@@ -15585,84 +16740,23 @@ function Chat({
|
|
|
15585
16740
|
const hasPendingHITLRequest = Boolean(stream.pendingHITLRequest);
|
|
15586
16741
|
const hasPendingInteractiveRequest = hasPendingRequestUserInput || hasPendingHITLRequest;
|
|
15587
16742
|
const hasPendingTodos = Boolean(stream.todos?.items.length);
|
|
15588
|
-
const
|
|
15589
|
-
()
|
|
15590
|
-
|
|
15591
|
-
|
|
15592
|
-
|
|
15593
|
-
|
|
15594
|
-
if (isGoalAdapter(options?.goal)) {
|
|
15595
|
-
return options.goal;
|
|
15596
|
-
}
|
|
15597
|
-
return supportsXpertThreadGoalAdapter(stream.client) ? createXpertThreadGoalAdapter(stream.client) : null;
|
|
15598
|
-
},
|
|
15599
|
-
[options?.goal, stream.client]
|
|
15600
|
-
);
|
|
16743
|
+
const goalAdapter = React51.useMemo(() => {
|
|
16744
|
+
if (isGoalAdapter(options?.goal)) {
|
|
16745
|
+
return options.goal;
|
|
16746
|
+
}
|
|
16747
|
+
return supportsXpertThreadGoalAdapter(stream.client) ? createXpertThreadGoalAdapter(stream.client) : null;
|
|
16748
|
+
}, [options?.goal, stream.client]);
|
|
15601
16749
|
const displayedGoalElapsedSeconds = threadGoal ? (threadGoal.elapsedSeconds ?? 0) + (goalElapsedStartedAt ? Math.max(0, Math.floor((streamingNow - goalElapsedStartedAt) / 1e3)) : 0) : 0;
|
|
15602
|
-
const effectiveSessionRuntimeCapabilities = React49.useMemo(
|
|
15603
|
-
() => runtimeCapabilitiesReady && runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
15604
|
-
runtimeCapabilities,
|
|
15605
|
-
sessionRuntimeCapabilities
|
|
15606
|
-
) : null,
|
|
15607
|
-
[runtimeCapabilities, runtimeCapabilitiesReady, sessionRuntimeCapabilities]
|
|
15608
|
-
);
|
|
15609
16750
|
const goalCommandAvailable = hasSelectedRuntimeSlashCommand(
|
|
15610
16751
|
runtimeCapabilities,
|
|
15611
16752
|
effectiveSessionRuntimeCapabilities,
|
|
15612
16753
|
"goal"
|
|
15613
16754
|
);
|
|
15614
16755
|
const showGoalStatus = goalCommandAvailable && !hasCompletedGoal && (Boolean(goalError) || threadGoal?.status === "active" && stream.isLoading);
|
|
15615
|
-
const
|
|
15616
|
-
() => runtimeCapabilityOptions.filter(
|
|
15617
|
-
(option) => isRuntimeCapabilitySelected(
|
|
15618
|
-
runRuntimeCapabilities,
|
|
15619
|
-
option.type,
|
|
15620
|
-
option.id
|
|
15621
|
-
)
|
|
15622
|
-
),
|
|
15623
|
-
[runRuntimeCapabilities, runtimeCapabilityOptions]
|
|
15624
|
-
);
|
|
15625
|
-
const composerRuntimeCapabilitySelectionKeys = React49.useMemo(
|
|
15626
|
-
() => getComposerCapabilitySelectionKeys(composerParts),
|
|
15627
|
-
[composerParts]
|
|
15628
|
-
);
|
|
15629
|
-
const detachedRunRuntimeCapabilityOptions = React49.useMemo(
|
|
15630
|
-
() => runRuntimeCapabilityOptions.filter(
|
|
15631
|
-
(option) => !composerRuntimeCapabilitySelectionKeys.has(
|
|
15632
|
-
getRuntimeCapabilityOptionKey(option)
|
|
15633
|
-
)
|
|
15634
|
-
),
|
|
15635
|
-
[composerRuntimeCapabilitySelectionKeys, runRuntimeCapabilityOptions]
|
|
15636
|
-
);
|
|
15637
|
-
const persistSessionRuntimeCapabilities = React49.useCallback(
|
|
15638
|
-
async (threadId, selection) => {
|
|
15639
|
-
if (!runtimeCapabilities || !selection) {
|
|
15640
|
-
return;
|
|
15641
|
-
}
|
|
15642
|
-
try {
|
|
15643
|
-
const result = await persistConversationRuntimeCapabilities({
|
|
15644
|
-
client: stream.client,
|
|
15645
|
-
threadId,
|
|
15646
|
-
capabilities: runtimeCapabilities,
|
|
15647
|
-
selection
|
|
15648
|
-
});
|
|
15649
|
-
warnMissingRuntimeCapabilityReferences(
|
|
15650
|
-
"persisted selection",
|
|
15651
|
-
result.missing
|
|
15652
|
-
);
|
|
15653
|
-
} catch (error) {
|
|
15654
|
-
console.warn(
|
|
15655
|
-
"[Chat] Failed to persist runtime capabilities selection:",
|
|
15656
|
-
error
|
|
15657
|
-
);
|
|
15658
|
-
}
|
|
15659
|
-
},
|
|
15660
|
-
[runtimeCapabilities, stream.client]
|
|
15661
|
-
);
|
|
15662
|
-
const clearQuoteSelection = React49.useCallback(() => {
|
|
16756
|
+
const clearQuoteSelection = React51.useCallback(() => {
|
|
15663
16757
|
setQuoteSelection(null);
|
|
15664
16758
|
}, []);
|
|
15665
|
-
const commitComposerParts =
|
|
16759
|
+
const commitComposerParts = React51.useCallback(
|
|
15666
16760
|
(nextParts, options2) => {
|
|
15667
16761
|
const normalized = normalizeComposerParts(nextParts);
|
|
15668
16762
|
const previous = composerPartsRef.current;
|
|
@@ -15671,23 +16765,17 @@ function Chat({
|
|
|
15671
16765
|
pendingComposerCaretOffsetRef.current = options2.caretOffset;
|
|
15672
16766
|
}
|
|
15673
16767
|
if (options2?.syncRemovedCapabilityTokens ?? true) {
|
|
15674
|
-
const
|
|
15675
|
-
|
|
15676
|
-
|
|
16768
|
+
const removedCapabilities = getRemovedComposerCapabilityParts(
|
|
16769
|
+
previous,
|
|
16770
|
+
normalized
|
|
15677
16771
|
);
|
|
15678
16772
|
if (removedCapabilities.length > 0) {
|
|
15679
|
-
setRunRuntimeCapabilities(
|
|
15680
|
-
|
|
15681
|
-
|
|
15682
|
-
|
|
15683
|
-
|
|
15684
|
-
|
|
15685
|
-
part.capability.id,
|
|
15686
|
-
false
|
|
15687
|
-
);
|
|
15688
|
-
}
|
|
15689
|
-
return nextSelection;
|
|
15690
|
-
});
|
|
16773
|
+
setRunRuntimeCapabilities(
|
|
16774
|
+
(selection) => removeComposerCapabilityPartsFromSelection(
|
|
16775
|
+
selection,
|
|
16776
|
+
removedCapabilities
|
|
16777
|
+
)
|
|
16778
|
+
);
|
|
15691
16779
|
}
|
|
15692
16780
|
}
|
|
15693
16781
|
setComposerParts(normalized);
|
|
@@ -15696,9 +16784,9 @@ function Chat({
|
|
|
15696
16784
|
setComposerDomVersion((version) => version + 1);
|
|
15697
16785
|
}
|
|
15698
16786
|
},
|
|
15699
|
-
[]
|
|
16787
|
+
[setRunRuntimeCapabilities]
|
|
15700
16788
|
);
|
|
15701
|
-
const setComposerText =
|
|
16789
|
+
const setComposerText = React51.useCallback(
|
|
15702
16790
|
(text, caretOffset = text.length) => {
|
|
15703
16791
|
commitComposerParts(createComposerTextParts(text), {
|
|
15704
16792
|
caretOffset,
|
|
@@ -15708,7 +16796,7 @@ function Chat({
|
|
|
15708
16796
|
},
|
|
15709
16797
|
[commitComposerParts]
|
|
15710
16798
|
);
|
|
15711
|
-
const focusComposerAt =
|
|
16799
|
+
const focusComposerAt = React51.useCallback((position) => {
|
|
15712
16800
|
const nextPosition = position ?? getComposerEditingLength(composerPartsRef.current);
|
|
15713
16801
|
pendingComposerCaretOffsetRef.current = nextPosition;
|
|
15714
16802
|
requestAnimationFrame(() => {
|
|
@@ -15719,8 +16807,25 @@ function Chat({
|
|
|
15719
16807
|
setComposerSelectionOffset(input, nextPosition);
|
|
15720
16808
|
});
|
|
15721
16809
|
}, []);
|
|
16810
|
+
const {
|
|
16811
|
+
applyComposerValueRuntimeCapabilities,
|
|
16812
|
+
updateRuntimeCapabilityPalette,
|
|
16813
|
+
removeRunRuntimeCapability,
|
|
16814
|
+
insertComposerCapabilityToken
|
|
16815
|
+
} = useRuntimeCapabilityComposerActions({
|
|
16816
|
+
runtimeCapabilities,
|
|
16817
|
+
runtimeCapabilitiesReady,
|
|
16818
|
+
runtimeCapabilityOptions,
|
|
16819
|
+
setRunRuntimeCapabilities,
|
|
16820
|
+
setRuntimeCapabilityPalette,
|
|
16821
|
+
applyExternalRuntimeCapabilities,
|
|
16822
|
+
composerInputRef,
|
|
16823
|
+
composerPartsRef,
|
|
16824
|
+
commitComposerParts,
|
|
16825
|
+
focusComposerAt
|
|
16826
|
+
});
|
|
15722
16827
|
const parentMessenger = useParentMessenger({
|
|
15723
|
-
onSetComposerValue:
|
|
16828
|
+
onSetComposerValue: React51.useCallback(
|
|
15724
16829
|
(payload) => {
|
|
15725
16830
|
if (!payload) {
|
|
15726
16831
|
return;
|
|
@@ -15740,13 +16845,24 @@ function Chat({
|
|
|
15740
16845
|
) ?? null;
|
|
15741
16846
|
setSelectedTool(nextTool);
|
|
15742
16847
|
}
|
|
16848
|
+
applyComposerValueRuntimeCapabilities(payload);
|
|
15743
16849
|
},
|
|
15744
|
-
[
|
|
16850
|
+
[
|
|
16851
|
+
applyComposerValueRuntimeCapabilities,
|
|
16852
|
+
composer?.tools,
|
|
16853
|
+
setComposerText
|
|
16854
|
+
]
|
|
16855
|
+
),
|
|
16856
|
+
onSetRuntimeCapabilities: React51.useCallback(
|
|
16857
|
+
(selection) => {
|
|
16858
|
+
applyExternalRuntimeCapabilities(selection);
|
|
16859
|
+
},
|
|
16860
|
+
[applyExternalRuntimeCapabilities]
|
|
15745
16861
|
),
|
|
15746
|
-
onFocusComposer:
|
|
16862
|
+
onFocusComposer: React51.useCallback(() => {
|
|
15747
16863
|
composerInputRef.current?.focus();
|
|
15748
16864
|
}, []),
|
|
15749
|
-
onSetPetEnabled:
|
|
16865
|
+
onSetPetEnabled: React51.useCallback(
|
|
15750
16866
|
(enabled) => {
|
|
15751
16867
|
if (petRequired) {
|
|
15752
16868
|
return;
|
|
@@ -15760,10 +16876,10 @@ function Chat({
|
|
|
15760
16876
|
)
|
|
15761
16877
|
});
|
|
15762
16878
|
const canMinimizeToPet = parentMessenger?.isParentAvailable === true && isPetEnabled(effectivePet);
|
|
15763
|
-
const handleMinimizeToPet =
|
|
16879
|
+
const handleMinimizeToPet = React51.useCallback(() => {
|
|
15764
16880
|
parentMessenger?.sendEvent("chat_minimize_change", { minimized: true });
|
|
15765
16881
|
}, [parentMessenger]);
|
|
15766
|
-
const syncQuoteSelection =
|
|
16882
|
+
const syncQuoteSelection = React51.useCallback(() => {
|
|
15767
16883
|
if (typeof window === "undefined") {
|
|
15768
16884
|
clearQuoteSelection();
|
|
15769
16885
|
return;
|
|
@@ -15808,23 +16924,23 @@ function Chat({
|
|
|
15808
16924
|
left
|
|
15809
16925
|
});
|
|
15810
16926
|
}, [clearQuoteSelection]);
|
|
15811
|
-
const cancelPendingAutoScroll =
|
|
16927
|
+
const cancelPendingAutoScroll = React51.useCallback(() => {
|
|
15812
16928
|
if (autoScrollFrameRef.current !== null) {
|
|
15813
16929
|
cancelAnimationFrame(autoScrollFrameRef.current);
|
|
15814
16930
|
autoScrollFrameRef.current = null;
|
|
15815
16931
|
}
|
|
15816
16932
|
}, []);
|
|
15817
|
-
const disableAutoFollow =
|
|
16933
|
+
const disableAutoFollow = React51.useCallback(() => {
|
|
15818
16934
|
forceFollowRef.current = false;
|
|
15819
16935
|
shouldAutoScrollRef.current = false;
|
|
15820
16936
|
cancelPendingAutoScroll();
|
|
15821
16937
|
}, [cancelPendingAutoScroll]);
|
|
15822
|
-
const enableAutoFollow =
|
|
16938
|
+
const enableAutoFollow = React51.useCallback(() => {
|
|
15823
16939
|
forceFollowRef.current = true;
|
|
15824
16940
|
shouldAutoScrollRef.current = true;
|
|
15825
16941
|
setHasUpdatesBelow(false);
|
|
15826
16942
|
}, []);
|
|
15827
|
-
const scrollToBottom =
|
|
16943
|
+
const scrollToBottom = React51.useCallback(
|
|
15828
16944
|
(smooth = false, force = false) => {
|
|
15829
16945
|
if (force) {
|
|
15830
16946
|
enableAutoFollow();
|
|
@@ -15851,7 +16967,25 @@ function Chat({
|
|
|
15851
16967
|
},
|
|
15852
16968
|
[cancelPendingAutoScroll, enableAutoFollow]
|
|
15853
16969
|
);
|
|
15854
|
-
|
|
16970
|
+
const setMessageNavigationAnchor = React51.useCallback(
|
|
16971
|
+
(id, node) => {
|
|
16972
|
+
if (node) {
|
|
16973
|
+
messageNavigationAnchorsRef.current.set(id, node);
|
|
16974
|
+
return;
|
|
16975
|
+
}
|
|
16976
|
+
messageNavigationAnchorsRef.current.delete(id);
|
|
16977
|
+
},
|
|
16978
|
+
[]
|
|
16979
|
+
);
|
|
16980
|
+
const getMessageNavigationAnchor = React51.useCallback(
|
|
16981
|
+
(item) => messageNavigationAnchorsRef.current.get(item.id) ?? null,
|
|
16982
|
+
[]
|
|
16983
|
+
);
|
|
16984
|
+
const handleMessageNavigationNavigate = React51.useCallback(() => {
|
|
16985
|
+
disableAutoFollow();
|
|
16986
|
+
clearQuoteSelection();
|
|
16987
|
+
}, [clearQuoteSelection, disableAutoFollow]);
|
|
16988
|
+
React51.useEffect(() => {
|
|
15855
16989
|
const viewport = viewportRef.current;
|
|
15856
16990
|
if (!viewport) return;
|
|
15857
16991
|
previousScrollTopRef.current = viewport.scrollTop;
|
|
@@ -15932,14 +17066,14 @@ function Chat({
|
|
|
15932
17066
|
window.removeEventListener("pointercancel", stopPointerTracking);
|
|
15933
17067
|
};
|
|
15934
17068
|
}, [cancelPendingAutoScroll, disableAutoFollow]);
|
|
15935
|
-
|
|
17069
|
+
React51.useEffect(() => {
|
|
15936
17070
|
shouldAutoScrollRef.current = true;
|
|
15937
17071
|
forceFollowRef.current = false;
|
|
15938
17072
|
previousScrollTopRef.current = 0;
|
|
15939
17073
|
setIsAtBottom(true);
|
|
15940
17074
|
setHasUpdatesBelow(false);
|
|
15941
17075
|
}, [stream.threadId]);
|
|
15942
|
-
|
|
17076
|
+
React51.useEffect(() => {
|
|
15943
17077
|
const messageCountChanged = messages.length !== previousMessageCountRef.current;
|
|
15944
17078
|
previousMessageCountRef.current = messages.length;
|
|
15945
17079
|
if (isPrependingHistoryMessagesRef.current) {
|
|
@@ -15952,46 +17086,16 @@ function Chat({
|
|
|
15952
17086
|
}
|
|
15953
17087
|
return;
|
|
15954
17088
|
}
|
|
15955
|
-
if (messageCountChanged || stream.isLoading) {
|
|
15956
|
-
scrollToBottom();
|
|
15957
|
-
}
|
|
15958
|
-
}, [stream.isLoading, messages, scrollToBottom]);
|
|
15959
|
-
const effectiveClientSecret = stream.apiKey?.trim() ? stream.apiKey : clientSecret;
|
|
15960
|
-
const missingConfigKind = getMissingApiConfigurationKind({
|
|
15961
|
-
apiUrl,
|
|
15962
|
-
clientSecret: effectiveClientSecret
|
|
15963
|
-
});
|
|
15964
|
-
const missingConfig = Boolean(missingConfigKind);
|
|
15965
|
-
const missingConfigShortMessage = React49.useMemo(() => {
|
|
15966
|
-
switch (missingConfigKind) {
|
|
15967
|
-
case "apiUrl":
|
|
15968
|
-
return t("chat.missingApiUrlShort");
|
|
15969
|
-
case "clientSecret":
|
|
15970
|
-
return t("chat.missingClientSecretShort");
|
|
15971
|
-
case "apiUrlAndClientSecret":
|
|
15972
|
-
return t("chat.missingApiUrlAndClientSecretShort");
|
|
15973
|
-
default:
|
|
15974
|
-
return t("chat.missingConfigShort");
|
|
15975
|
-
}
|
|
15976
|
-
}, [missingConfigKind, t]);
|
|
15977
|
-
const missingConfigDetailMessage = React49.useMemo(() => {
|
|
15978
|
-
switch (missingConfigKind) {
|
|
15979
|
-
case "apiUrl":
|
|
15980
|
-
return t("chat.missingApiUrlDetail");
|
|
15981
|
-
case "clientSecret":
|
|
15982
|
-
return t("chat.missingClientSecretDetail");
|
|
15983
|
-
case "apiUrlAndClientSecret":
|
|
15984
|
-
return t("chat.missingApiUrlAndClientSecretDetail");
|
|
15985
|
-
default:
|
|
15986
|
-
return t("chat.missingConfigDetail");
|
|
17089
|
+
if (messageCountChanged || stream.isLoading) {
|
|
17090
|
+
scrollToBottom();
|
|
15987
17091
|
}
|
|
15988
|
-
}, [
|
|
17092
|
+
}, [stream.isLoading, messages, scrollToBottom]);
|
|
15989
17093
|
const showMissingConfig = !isClientSecretInitializing && missingConfig;
|
|
15990
17094
|
const hasUploadingFiles = attachmentState.hasUploadingFiles;
|
|
15991
17095
|
const isSubmissionBlocked = hasPendingInteractiveRequest || missingConfig || isHistoryLoading || hasUploadingFiles || isUploadingReferenceImages;
|
|
15992
17096
|
const isSendDisabled = !trimmedDraft && !hasReferences || isSubmissionBlocked;
|
|
15993
17097
|
const isPromptEditDisabled = hasPendingInteractiveRequest || missingConfig || isHistoryLoading;
|
|
15994
|
-
const resizeComposerInput =
|
|
17098
|
+
const resizeComposerInput = React51.useCallback(() => {
|
|
15995
17099
|
const input = composerInputRef.current;
|
|
15996
17100
|
if (!input) {
|
|
15997
17101
|
return;
|
|
@@ -15999,7 +17103,7 @@ function Chat({
|
|
|
15999
17103
|
input.style.maxHeight = `${COMPOSER_INPUT_MAX_HEIGHT}px`;
|
|
16000
17104
|
input.style.overflowY = input.scrollHeight > COMPOSER_INPUT_MAX_HEIGHT ? "auto" : "hidden";
|
|
16001
17105
|
}, []);
|
|
16002
|
-
|
|
17106
|
+
React51.useLayoutEffect(() => {
|
|
16003
17107
|
composerPartsRef.current = composerParts;
|
|
16004
17108
|
resizeComposerInput();
|
|
16005
17109
|
const caretOffset = pendingComposerCaretOffsetRef.current;
|
|
@@ -16011,13 +17115,13 @@ function Chat({
|
|
|
16011
17115
|
}
|
|
16012
17116
|
}
|
|
16013
17117
|
}, [composerDomVersion, composerParts, resizeComposerInput]);
|
|
16014
|
-
|
|
17118
|
+
React51.useEffect(() => {
|
|
16015
17119
|
document.addEventListener("selectionchange", syncQuoteSelection);
|
|
16016
17120
|
return () => {
|
|
16017
17121
|
document.removeEventListener("selectionchange", syncQuoteSelection);
|
|
16018
17122
|
};
|
|
16019
17123
|
}, [syncQuoteSelection]);
|
|
16020
|
-
|
|
17124
|
+
React51.useEffect(() => {
|
|
16021
17125
|
const viewport = viewportRef.current;
|
|
16022
17126
|
if (!viewport) {
|
|
16023
17127
|
return;
|
|
@@ -16034,14 +17138,14 @@ function Chat({
|
|
|
16034
17138
|
window.removeEventListener("resize", handleViewportScroll);
|
|
16035
17139
|
};
|
|
16036
17140
|
}, [clearQuoteSelection]);
|
|
16037
|
-
|
|
17141
|
+
React51.useEffect(() => {
|
|
16038
17142
|
clearQuoteSelection();
|
|
16039
17143
|
}, [messages.length, stream.threadId, clearQuoteSelection]);
|
|
16040
|
-
|
|
17144
|
+
React51.useEffect(() => {
|
|
16041
17145
|
if (missingConfig) return;
|
|
16042
17146
|
void refreshThreads();
|
|
16043
17147
|
}, [missingConfig, refreshThreads]);
|
|
16044
|
-
|
|
17148
|
+
React51.useEffect(() => {
|
|
16045
17149
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
16046
17150
|
setAssistantName(null);
|
|
16047
17151
|
setAssistantAvatar(null);
|
|
@@ -16064,106 +17168,10 @@ function Chat({
|
|
|
16064
17168
|
cancelled = true;
|
|
16065
17169
|
};
|
|
16066
17170
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
16067
|
-
|
|
16068
|
-
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
16069
|
-
setRuntimeCapabilities(null);
|
|
16070
|
-
setRuntimeCapabilitiesReady(false);
|
|
16071
|
-
setSessionRuntimeCapabilities(createEmptyRuntimeCapabilitiesSelection());
|
|
16072
|
-
setRunRuntimeCapabilities(createEmptyRuntimeCapabilitiesSelection());
|
|
16073
|
-
setRuntimeCapabilityPalette(null);
|
|
16074
|
-
return;
|
|
16075
|
-
}
|
|
16076
|
-
const controller = new AbortController();
|
|
16077
|
-
setRuntimeCapabilitiesReady(false);
|
|
16078
|
-
setRuntimeCapabilities(null);
|
|
16079
|
-
setRuntimeCapabilityPalette(null);
|
|
16080
|
-
void stream.client.assistants.getRuntimeCapabilities(stream.assistantId, {
|
|
16081
|
-
signal: controller.signal
|
|
16082
|
-
}).then((payload) => {
|
|
16083
|
-
setRuntimeCapabilities(payload);
|
|
16084
|
-
setRuntimeCapabilitiesReady(true);
|
|
16085
|
-
setSessionRuntimeCapabilities(
|
|
16086
|
-
createDefaultRuntimeCapabilitiesSelection(payload)
|
|
16087
|
-
);
|
|
16088
|
-
setRunRuntimeCapabilities(
|
|
16089
|
-
createEmptyRuntimeCapabilitiesSelection(payload)
|
|
16090
|
-
);
|
|
16091
|
-
}).catch((error) => {
|
|
16092
|
-
if (controller.signal.aborted) {
|
|
16093
|
-
return;
|
|
16094
|
-
}
|
|
16095
|
-
if (getHttpStatus(error) === 404) {
|
|
16096
|
-
setRuntimeCapabilities(null);
|
|
16097
|
-
setRuntimeCapabilitiesReady(false);
|
|
16098
|
-
setSessionRuntimeCapabilities(
|
|
16099
|
-
createEmptyRuntimeCapabilitiesSelection()
|
|
16100
|
-
);
|
|
16101
|
-
setRunRuntimeCapabilities(createEmptyRuntimeCapabilitiesSelection());
|
|
16102
|
-
return;
|
|
16103
|
-
}
|
|
16104
|
-
console.warn("[Chat] Failed to load runtime capabilities:", error);
|
|
16105
|
-
setRuntimeCapabilities(null);
|
|
16106
|
-
setRuntimeCapabilitiesReady(false);
|
|
16107
|
-
setSessionRuntimeCapabilities(
|
|
16108
|
-
createEmptyRuntimeCapabilitiesSelection()
|
|
16109
|
-
);
|
|
16110
|
-
setRunRuntimeCapabilities(createEmptyRuntimeCapabilitiesSelection());
|
|
16111
|
-
});
|
|
16112
|
-
return () => controller.abort();
|
|
16113
|
-
}, [missingConfig, stream.client, stream.assistantId]);
|
|
16114
|
-
React49.useEffect(() => {
|
|
16115
|
-
setRunRuntimeCapabilities(
|
|
16116
|
-
createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
|
|
16117
|
-
);
|
|
16118
|
-
if (!runtimeCapabilitiesReady || !runtimeCapabilities) {
|
|
16119
|
-
setSessionRuntimeCapabilities(
|
|
16120
|
-
createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
|
|
16121
|
-
);
|
|
16122
|
-
return;
|
|
16123
|
-
}
|
|
16124
|
-
const defaultSelection = createDefaultRuntimeCapabilitiesSelection(runtimeCapabilities);
|
|
16125
|
-
const threadId = stream.threadId?.trim();
|
|
16126
|
-
if (!threadId) {
|
|
16127
|
-
setSessionRuntimeCapabilities(defaultSelection);
|
|
16128
|
-
return;
|
|
16129
|
-
}
|
|
16130
|
-
let cancelled = false;
|
|
16131
|
-
const requestId = runtimeCapabilityPreferenceLoadRef.current + 1;
|
|
16132
|
-
runtimeCapabilityPreferenceLoadRef.current = requestId;
|
|
16133
|
-
setSessionRuntimeCapabilities(defaultSelection);
|
|
16134
|
-
void loadConversationRuntimeCapabilities({
|
|
16135
|
-
client: stream.client,
|
|
16136
|
-
threadId,
|
|
16137
|
-
capabilities: runtimeCapabilities
|
|
16138
|
-
}).then(({ selection, missing }) => {
|
|
16139
|
-
if (cancelled || runtimeCapabilityPreferenceLoadRef.current !== requestId) {
|
|
16140
|
-
return;
|
|
16141
|
-
}
|
|
16142
|
-
warnMissingRuntimeCapabilityReferences("loaded selection", missing);
|
|
16143
|
-
setSessionRuntimeCapabilities(selection ?? defaultSelection);
|
|
16144
|
-
}).catch((error) => {
|
|
16145
|
-
if (cancelled || runtimeCapabilityPreferenceLoadRef.current !== requestId) {
|
|
16146
|
-
return;
|
|
16147
|
-
}
|
|
16148
|
-
console.warn(
|
|
16149
|
-
"[Chat] Failed to load persisted runtime capabilities selection:",
|
|
16150
|
-
error
|
|
16151
|
-
);
|
|
16152
|
-
setSessionRuntimeCapabilities(defaultSelection);
|
|
16153
|
-
});
|
|
16154
|
-
return () => {
|
|
16155
|
-
cancelled = true;
|
|
16156
|
-
};
|
|
16157
|
-
}, [
|
|
16158
|
-
runtimeCapabilities,
|
|
16159
|
-
runtimeCapabilitiesReady,
|
|
16160
|
-
stream.client,
|
|
16161
|
-
stream.threadId
|
|
16162
|
-
]);
|
|
16163
|
-
React49.useEffect(() => {
|
|
17171
|
+
React51.useEffect(() => {
|
|
16164
17172
|
setThreadGoal(stream.threadGoal);
|
|
16165
17173
|
}, [stream.threadGoal]);
|
|
16166
|
-
|
|
17174
|
+
React51.useEffect(() => {
|
|
16167
17175
|
const threadId = stream.threadId?.trim();
|
|
16168
17176
|
if (!threadId || !goalCommandAvailable) {
|
|
16169
17177
|
setThreadGoal(null);
|
|
@@ -16204,37 +17212,7 @@ function Chat({
|
|
|
16204
17212
|
return () => controller.abort();
|
|
16205
17213
|
}, [goalAdapter, goalCommandAvailable, stream.threadId]);
|
|
16206
17214
|
const uploadedFiles = attachmentState.uploadedFiles;
|
|
16207
|
-
const
|
|
16208
|
-
(type, id, selected) => {
|
|
16209
|
-
setSessionRuntimeCapabilities((previous) => {
|
|
16210
|
-
const nextSelection = toggleRuntimeCapabilitySelection(
|
|
16211
|
-
previous,
|
|
16212
|
-
type,
|
|
16213
|
-
id,
|
|
16214
|
-
selected
|
|
16215
|
-
);
|
|
16216
|
-
const threadId = stream.threadId?.trim();
|
|
16217
|
-
if (threadId) {
|
|
16218
|
-
void persistSessionRuntimeCapabilities(threadId, nextSelection);
|
|
16219
|
-
}
|
|
16220
|
-
return nextSelection;
|
|
16221
|
-
});
|
|
16222
|
-
},
|
|
16223
|
-
[persistSessionRuntimeCapabilities, stream.threadId]
|
|
16224
|
-
);
|
|
16225
|
-
const updateRuntimeCapabilityPalette = React49.useCallback(
|
|
16226
|
-
(parts, selectionStart) => {
|
|
16227
|
-
const input = composerInputRef.current;
|
|
16228
|
-
const editingText = getComposerEditingText(parts);
|
|
16229
|
-
const nextPalette = resolveRuntimeCapabilityPalette(
|
|
16230
|
-
editingText,
|
|
16231
|
-
typeof selectionStart === "number" ? selectionStart : input ? getComposerSelectionOffset(input) : getComposerEditingLength(parts)
|
|
16232
|
-
);
|
|
16233
|
-
setRuntimeCapabilityPalette(nextPalette);
|
|
16234
|
-
},
|
|
16235
|
-
[]
|
|
16236
|
-
);
|
|
16237
|
-
const syncComposerInputFromElement = React49.useCallback(
|
|
17215
|
+
const syncComposerInputFromElement = React51.useCallback(
|
|
16238
17216
|
(input) => {
|
|
16239
17217
|
const previousCapabilities = getComposerCapabilityPartMap(
|
|
16240
17218
|
composerPartsRef.current
|
|
@@ -16252,45 +17230,25 @@ function Chat({
|
|
|
16252
17230
|
},
|
|
16253
17231
|
[commitComposerParts, updateRuntimeCapabilityPalette]
|
|
16254
17232
|
);
|
|
16255
|
-
const handleComposerInput =
|
|
17233
|
+
const handleComposerInput = React51.useCallback(
|
|
16256
17234
|
(event) => {
|
|
16257
17235
|
syncComposerInputFromElement(event.currentTarget);
|
|
16258
17236
|
},
|
|
16259
17237
|
[syncComposerInputFromElement]
|
|
16260
17238
|
);
|
|
16261
|
-
const handleComposerCompositionEnd =
|
|
17239
|
+
const handleComposerCompositionEnd = React51.useCallback(
|
|
16262
17240
|
(event) => {
|
|
16263
17241
|
syncComposerInputFromElement(event.currentTarget);
|
|
16264
17242
|
},
|
|
16265
17243
|
[syncComposerInputFromElement]
|
|
16266
17244
|
);
|
|
16267
|
-
const handleComposerSelect =
|
|
17245
|
+
const handleComposerSelect = React51.useCallback(() => {
|
|
16268
17246
|
updateRuntimeCapabilityPalette(
|
|
16269
17247
|
composerPartsRef.current,
|
|
16270
17248
|
composerInputRef.current ? getComposerSelectionOffset(composerInputRef.current) : void 0
|
|
16271
17249
|
);
|
|
16272
17250
|
}, [updateRuntimeCapabilityPalette]);
|
|
16273
|
-
const
|
|
16274
|
-
(option) => {
|
|
16275
|
-
setRunRuntimeCapabilities(
|
|
16276
|
-
(previous) => toggleRuntimeCapabilitySelection(
|
|
16277
|
-
previous,
|
|
16278
|
-
option.type,
|
|
16279
|
-
option.id,
|
|
16280
|
-
false
|
|
16281
|
-
)
|
|
16282
|
-
);
|
|
16283
|
-
commitComposerParts(
|
|
16284
|
-
removeComposerCapabilityTokens(composerPartsRef.current, option),
|
|
16285
|
-
{
|
|
16286
|
-
resetDom: true,
|
|
16287
|
-
syncRemovedCapabilityTokens: false
|
|
16288
|
-
}
|
|
16289
|
-
);
|
|
16290
|
-
},
|
|
16291
|
-
[commitComposerParts]
|
|
16292
|
-
);
|
|
16293
|
-
const submitDraft = React49.useCallback(
|
|
17251
|
+
const submitDraft = React51.useCallback(
|
|
16294
17252
|
(submitOptions = {}) => {
|
|
16295
17253
|
if (isSubmissionBlocked) return;
|
|
16296
17254
|
const contentToSubmit = (submitOptions.inputText ?? trimmedDraft).trim();
|
|
@@ -16305,22 +17263,10 @@ function Chat({
|
|
|
16305
17263
|
if (!humanInput) {
|
|
16306
17264
|
return;
|
|
16307
17265
|
}
|
|
16308
|
-
const
|
|
16309
|
-
|
|
16310
|
-
|
|
16311
|
-
|
|
16312
|
-
) : runRuntimeCapabilities;
|
|
16313
|
-
const runtimeCapabilitiesForSubmit = runtimeCapabilities && runtimeCapabilitiesReady ? createRuntimeCapabilitiesForSubmit({
|
|
16314
|
-
capabilities: runtimeCapabilities,
|
|
16315
|
-
available: effectiveSessionRuntimeCapabilities,
|
|
16316
|
-
recommended: recommendedRuntimeCapabilitiesForSubmit
|
|
16317
|
-
}) : null;
|
|
16318
|
-
const runtimeCapabilityOptionsForMessage = getSelectedRuntimeCapabilityOptions(
|
|
16319
|
-
getRecommendedRuntimeCapabilitiesSelection(
|
|
16320
|
-
runtimeCapabilitiesForSubmit
|
|
16321
|
-
),
|
|
16322
|
-
runtimeCapabilityOptions
|
|
16323
|
-
);
|
|
17266
|
+
const {
|
|
17267
|
+
runtimeCapabilitiesForSubmit,
|
|
17268
|
+
runtimeCapabilityOptionsForMessage
|
|
17269
|
+
} = getRuntimeCapabilitiesForSubmit(submitOptions.runtimeCapabilities);
|
|
16324
17270
|
const displayContent = submitOptions.displayText || contentToSubmit || (referencesToSend ? t("chat.referencedContentOnly") : "");
|
|
16325
17271
|
const newMessage = {
|
|
16326
17272
|
id: createMessageId(),
|
|
@@ -16388,21 +17334,16 @@ function Chat({
|
|
|
16388
17334
|
}
|
|
16389
17335
|
attachmentsRef.current?.clear();
|
|
16390
17336
|
setReferences([]);
|
|
16391
|
-
|
|
16392
|
-
createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
|
|
16393
|
-
);
|
|
16394
|
-
setRuntimeCapabilityPalette(null);
|
|
17337
|
+
resetRunRuntimeCapabilities();
|
|
16395
17338
|
},
|
|
16396
17339
|
[
|
|
16397
17340
|
effectiveSessionRuntimeCapabilities,
|
|
17341
|
+
getRuntimeCapabilitiesForSubmit,
|
|
16398
17342
|
isSubmissionBlocked,
|
|
16399
17343
|
options?.request,
|
|
16400
17344
|
persistSessionRuntimeCapabilities,
|
|
16401
17345
|
references,
|
|
16402
|
-
|
|
16403
|
-
runtimeCapabilitiesReady,
|
|
16404
|
-
runtimeCapabilityOptions,
|
|
16405
|
-
runRuntimeCapabilities,
|
|
17346
|
+
resetRunRuntimeCapabilities,
|
|
16406
17347
|
scrollToBottom,
|
|
16407
17348
|
selectedTool,
|
|
16408
17349
|
commitComposerParts,
|
|
@@ -16413,7 +17354,7 @@ function Chat({
|
|
|
16413
17354
|
t
|
|
16414
17355
|
]
|
|
16415
17356
|
);
|
|
16416
|
-
const handleGoalCommand =
|
|
17357
|
+
const handleGoalCommand = React51.useCallback(
|
|
16417
17358
|
async ({
|
|
16418
17359
|
args,
|
|
16419
17360
|
commandSource,
|
|
@@ -16458,11 +17399,7 @@ function Chat({
|
|
|
16458
17399
|
}
|
|
16459
17400
|
if (startsGoalRun) {
|
|
16460
17401
|
const goalRunThreadId = result.threadId ?? threadId;
|
|
16461
|
-
const runtimeCapabilitiesForGoalRun =
|
|
16462
|
-
capabilities: runtimeCapabilities,
|
|
16463
|
-
available: effectiveSessionRuntimeCapabilities,
|
|
16464
|
-
recommended: commandRuntimeCapabilities
|
|
16465
|
-
}) : commandRuntimeCapabilities ?? null;
|
|
17402
|
+
const runtimeCapabilitiesForGoalRun = getRuntimeCapabilitiesForCommand(commandRuntimeCapabilities);
|
|
16466
17403
|
const inputPayload = {
|
|
16467
17404
|
input: GOAL_RUN_INPUT,
|
|
16468
17405
|
commandSource,
|
|
@@ -16515,66 +17452,17 @@ function Chat({
|
|
|
16515
17452
|
}
|
|
16516
17453
|
},
|
|
16517
17454
|
[
|
|
16518
|
-
|
|
17455
|
+
getRuntimeCapabilitiesForCommand,
|
|
16519
17456
|
goalAdapter,
|
|
16520
17457
|
options?.request,
|
|
16521
17458
|
refreshThreads,
|
|
16522
|
-
runtimeCapabilities,
|
|
16523
|
-
runtimeCapabilitiesReady,
|
|
16524
17459
|
stream,
|
|
16525
17460
|
t
|
|
16526
17461
|
]
|
|
16527
17462
|
);
|
|
16528
|
-
const handleGoalPanelOpenChange =
|
|
16529
|
-
(open)
|
|
16530
|
-
|
|
16531
|
-
},
|
|
16532
|
-
[]
|
|
16533
|
-
);
|
|
16534
|
-
const addRunRuntimeCapabilities = React49.useCallback(
|
|
16535
|
-
(selection) => {
|
|
16536
|
-
setRunRuntimeCapabilities(
|
|
16537
|
-
(previous) => runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
16538
|
-
runtimeCapabilities,
|
|
16539
|
-
previous,
|
|
16540
|
-
selection
|
|
16541
|
-
) : previous
|
|
16542
|
-
);
|
|
16543
|
-
},
|
|
16544
|
-
[runtimeCapabilities]
|
|
16545
|
-
);
|
|
16546
|
-
const insertComposerCapabilityToken = React49.useCallback(
|
|
16547
|
-
(capability, range) => {
|
|
16548
|
-
const token = createComposerCapabilityPart(capability, createMessageId());
|
|
16549
|
-
const currentParts = composerPartsRef.current;
|
|
16550
|
-
const replaceRange = range ?? {
|
|
16551
|
-
start: getComposerEditingLength(currentParts),
|
|
16552
|
-
end: getComposerEditingLength(currentParts)
|
|
16553
|
-
};
|
|
16554
|
-
const nextParts = replaceComposerRange(
|
|
16555
|
-
currentParts,
|
|
16556
|
-
replaceRange.start,
|
|
16557
|
-
replaceRange.end,
|
|
16558
|
-
[token]
|
|
16559
|
-
);
|
|
16560
|
-
commitComposerParts(nextParts, {
|
|
16561
|
-
caretOffset: replaceRange.start + 1,
|
|
16562
|
-
resetDom: true,
|
|
16563
|
-
syncRemovedCapabilityTokens: true
|
|
16564
|
-
});
|
|
16565
|
-
setRunRuntimeCapabilities(
|
|
16566
|
-
(previous) => toggleRuntimeCapabilitySelection(
|
|
16567
|
-
previous,
|
|
16568
|
-
capability.type,
|
|
16569
|
-
capability.id,
|
|
16570
|
-
true
|
|
16571
|
-
)
|
|
16572
|
-
);
|
|
16573
|
-
setRuntimeCapabilityPalette(null);
|
|
16574
|
-
focusComposerAt(replaceRange.start + 1);
|
|
16575
|
-
},
|
|
16576
|
-
[commitComposerParts, focusComposerAt]
|
|
16577
|
-
);
|
|
17463
|
+
const handleGoalPanelOpenChange = React51.useCallback((open) => {
|
|
17464
|
+
setIsGoalPanelOpen(open);
|
|
17465
|
+
}, []);
|
|
16578
17466
|
const {
|
|
16579
17467
|
slashPaletteOptions,
|
|
16580
17468
|
executeSlashCommandFromDraft,
|
|
@@ -16602,7 +17490,7 @@ function Chat({
|
|
|
16602
17490
|
submitPrompt: submitDraft
|
|
16603
17491
|
});
|
|
16604
17492
|
const slashPaletteEmptyLabel = runtimeCapabilityPalette ? t(
|
|
16605
|
-
|
|
17493
|
+
getRuntimeCapabilityPaletteEmptyLabelKey(
|
|
16606
17494
|
runtimeCapabilityPalette,
|
|
16607
17495
|
runtimeCapabilitiesReady
|
|
16608
17496
|
)
|
|
@@ -16616,7 +17504,7 @@ function Chat({
|
|
|
16616
17504
|
plugin: t("composer.slashCommands.empty.loadingCapabilities"),
|
|
16617
17505
|
subAgent: t("composer.slashCommands.empty.loadingCapabilities")
|
|
16618
17506
|
};
|
|
16619
|
-
|
|
17507
|
+
React51.useEffect(() => {
|
|
16620
17508
|
if (!runtimeCapabilityPalette) {
|
|
16621
17509
|
return;
|
|
16622
17510
|
}
|
|
@@ -16635,7 +17523,7 @@ function Chat({
|
|
|
16635
17523
|
);
|
|
16636
17524
|
}
|
|
16637
17525
|
}, [slashPaletteOptions.length, runtimeCapabilityPalette]);
|
|
16638
|
-
|
|
17526
|
+
React51.useLayoutEffect(() => {
|
|
16639
17527
|
if (!runtimeCapabilityPalette) {
|
|
16640
17528
|
return;
|
|
16641
17529
|
}
|
|
@@ -16652,7 +17540,7 @@ function Chat({
|
|
|
16652
17540
|
container.scrollTop += optionRect.bottom - containerRect.bottom;
|
|
16653
17541
|
}
|
|
16654
17542
|
}, [runtimeCapabilityPalette, slashPaletteOptions.length]);
|
|
16655
|
-
const submitGoalModeDraft =
|
|
17543
|
+
const submitGoalModeDraft = React51.useCallback(() => {
|
|
16656
17544
|
const objective = getComposerPlainText(composerPartsRef.current).trim();
|
|
16657
17545
|
if (!isGoalModeOpen || !goalCommandAvailable || !objective) {
|
|
16658
17546
|
return false;
|
|
@@ -16690,7 +17578,7 @@ function Chat({
|
|
|
16690
17578
|
}
|
|
16691
17579
|
submitDraft();
|
|
16692
17580
|
};
|
|
16693
|
-
const handleEditPendingFollowUp =
|
|
17581
|
+
const handleEditPendingFollowUp = React51.useCallback(
|
|
16694
17582
|
(id) => {
|
|
16695
17583
|
const item = pendingFollowUps.find(
|
|
16696
17584
|
(entry) => entry.id === id && entry.mode === "queue"
|
|
@@ -16717,7 +17605,7 @@ function Chat({
|
|
|
16717
17605
|
},
|
|
16718
17606
|
[pendingFollowUps, setComposerText, stream]
|
|
16719
17607
|
);
|
|
16720
|
-
const handleQuoteSelection =
|
|
17608
|
+
const handleQuoteSelection = React51.useCallback(() => {
|
|
16721
17609
|
if (!quoteSelection) {
|
|
16722
17610
|
return;
|
|
16723
17611
|
}
|
|
@@ -16733,7 +17621,7 @@ function Chat({
|
|
|
16733
17621
|
const handleAttachmentClick = () => {
|
|
16734
17622
|
attachmentsRef.current?.openFilePicker();
|
|
16735
17623
|
};
|
|
16736
|
-
const uploadContextFile =
|
|
17624
|
+
const uploadContextFile = React51.useCallback(
|
|
16737
17625
|
(file) => {
|
|
16738
17626
|
const formData = new FormData();
|
|
16739
17627
|
formData.append("file", file, file.name || "upload");
|
|
@@ -16752,13 +17640,13 @@ function Chat({
|
|
|
16752
17640
|
},
|
|
16753
17641
|
[stream.assistantId, stream.client, stream.threadId]
|
|
16754
17642
|
);
|
|
16755
|
-
const getContextFileStatus =
|
|
17643
|
+
const getContextFileStatus = React51.useCallback(
|
|
16756
17644
|
(fileId) => stream.client.contexts.fetch(`/files/${fileId}/status`, {
|
|
16757
17645
|
method: "GET"
|
|
16758
17646
|
}),
|
|
16759
17647
|
[stream.client]
|
|
16760
17648
|
);
|
|
16761
|
-
const deleteContextFile =
|
|
17649
|
+
const deleteContextFile = React51.useCallback(
|
|
16762
17650
|
(storageFileId) => stream.client.contexts.deleteFile(storageFileId),
|
|
16763
17651
|
[stream.client]
|
|
16764
17652
|
);
|
|
@@ -16866,7 +17754,7 @@ function Chat({
|
|
|
16866
17754
|
}
|
|
16867
17755
|
submitDraft();
|
|
16868
17756
|
};
|
|
16869
|
-
const handleComposerPaste =
|
|
17757
|
+
const handleComposerPaste = React51.useCallback(
|
|
16870
17758
|
(event) => {
|
|
16871
17759
|
const clipboardData = event.clipboardData;
|
|
16872
17760
|
if (!clipboardData) {
|
|
@@ -16968,13 +17856,13 @@ function Chat({
|
|
|
16968
17856
|
const handleToolSelect = (tool) => {
|
|
16969
17857
|
setSelectedTool((prev) => prev?.id === tool.id ? null : tool);
|
|
16970
17858
|
};
|
|
16971
|
-
const handlePromptClick =
|
|
17859
|
+
const handlePromptClick = React51.useCallback(
|
|
16972
17860
|
(prompt) => {
|
|
16973
17861
|
submitDraft({ inputText: prompt, displayText: prompt });
|
|
16974
17862
|
},
|
|
16975
17863
|
[submitDraft]
|
|
16976
17864
|
);
|
|
16977
|
-
const handlePromptEdit =
|
|
17865
|
+
const handlePromptEdit = React51.useCallback(
|
|
16978
17866
|
(prompt) => {
|
|
16979
17867
|
if (isPromptEditDisabled) return;
|
|
16980
17868
|
setComposerText(prompt, prompt.length);
|
|
@@ -16983,7 +17871,7 @@ function Chat({
|
|
|
16983
17871
|
},
|
|
16984
17872
|
[focusComposerAt, isPromptEditDisabled, setComposerText]
|
|
16985
17873
|
);
|
|
16986
|
-
const loadConversationMessages =
|
|
17874
|
+
const loadConversationMessages = React51.useCallback(
|
|
16987
17875
|
async (recordId) => {
|
|
16988
17876
|
if (missingConfig) {
|
|
16989
17877
|
setHistoryError(missingConfigShortMessage);
|
|
@@ -17004,7 +17892,7 @@ function Chat({
|
|
|
17004
17892
|
},
|
|
17005
17893
|
[missingConfig, missingConfigShortMessage, stream, t]
|
|
17006
17894
|
);
|
|
17007
|
-
const handleLoadMoreMessages =
|
|
17895
|
+
const handleLoadMoreMessages = React51.useCallback(async () => {
|
|
17008
17896
|
if (!canLoadMoreMessages || isLoadingMoreMessages) {
|
|
17009
17897
|
return;
|
|
17010
17898
|
}
|
|
@@ -17113,15 +18001,15 @@ function Chat({
|
|
|
17113
18001
|
};
|
|
17114
18002
|
const acceptMimes = composer?.attachments?.accept ? Object.entries(composer.attachments.accept).map(([mime, exts]) => [mime, ...exts.map((e) => `.${e}`)].join(",")).join(",") : void 0;
|
|
17115
18003
|
const canUploadDroppedFiles = composer?.attachments?.enabled === true && !missingConfig && !isHistoryLoading && !hasPendingInteractiveRequest;
|
|
17116
|
-
const handleDroppedFiles =
|
|
18004
|
+
const handleDroppedFiles = React51.useCallback((files) => {
|
|
17117
18005
|
return attachmentsRef.current?.queueFiles(files) ?? false;
|
|
17118
18006
|
}, []);
|
|
17119
|
-
const currentThread =
|
|
18007
|
+
const currentThread = React51.useMemo(
|
|
17120
18008
|
() => threads.find((item) => item.id === stream.threadId),
|
|
17121
18009
|
[threads, stream.threadId]
|
|
17122
18010
|
);
|
|
17123
18011
|
const streamErrorMessage = stream.error instanceof Error ? stream.error.message : void 0;
|
|
17124
|
-
const threadErrorMessage =
|
|
18012
|
+
const threadErrorMessage = React51.useMemo(() => {
|
|
17125
18013
|
if (streamErrorMessage?.trim()) return streamErrorMessage.trim();
|
|
17126
18014
|
if (currentThread?.status !== "error") return void 0;
|
|
17127
18015
|
const message = currentThread.error?.trim();
|
|
@@ -17151,15 +18039,14 @@ function Chat({
|
|
|
17151
18039
|
historyMessageLoadVersion: stream.historyMessageLoadVersion ?? 0,
|
|
17152
18040
|
fallbackTitle: t("history.threadFallback")
|
|
17153
18041
|
});
|
|
17154
|
-
const assistantTitle = assistantName || resolvedTitle;
|
|
17155
18042
|
const layoutMaxWidth = options?.layout?.maxWidth;
|
|
17156
|
-
const chatColumnStyle =
|
|
18043
|
+
const chatColumnStyle = React51.useMemo(() => {
|
|
17157
18044
|
if (layoutMaxWidth === void 0 || layoutMaxWidth === null || layoutMaxWidth === "") {
|
|
17158
18045
|
return void 0;
|
|
17159
18046
|
}
|
|
17160
18047
|
return { maxWidth: layoutMaxWidth };
|
|
17161
18048
|
}, [layoutMaxWidth]);
|
|
17162
|
-
return /* @__PURE__ */ (0,
|
|
18049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
17163
18050
|
UploadDroppedFiles,
|
|
17164
18051
|
{
|
|
17165
18052
|
ref: viewportRef,
|
|
@@ -17174,16 +18061,16 @@ function Chat({
|
|
|
17174
18061
|
className
|
|
17175
18062
|
),
|
|
17176
18063
|
children: [
|
|
17177
|
-
/* @__PURE__ */ (0,
|
|
18064
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
17178
18065
|
"div",
|
|
17179
18066
|
{
|
|
17180
18067
|
"data-slot": "chatkit-chat-header",
|
|
17181
18068
|
className: "mx-auto flex w-full items-center justify-between border-b p-2 sticky top-0 z-10 bg-background",
|
|
17182
18069
|
style: chatColumnStyle,
|
|
17183
18070
|
children: [
|
|
17184
|
-
/* @__PURE__ */ (0,
|
|
17185
|
-
/* @__PURE__ */ (0,
|
|
17186
|
-
/* @__PURE__ */ (0,
|
|
18071
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex items-center gap-3 overflow-hidden", children: [
|
|
18072
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "relative shrink-0", children: [
|
|
18073
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17187
18074
|
ChatkitAvatar,
|
|
17188
18075
|
{
|
|
17189
18076
|
avatar: assistantAvatar,
|
|
@@ -17191,10 +18078,10 @@ function Chat({
|
|
|
17191
18078
|
label: assistantTitle
|
|
17192
18079
|
}
|
|
17193
18080
|
),
|
|
17194
|
-
/* @__PURE__ */ (0,
|
|
18081
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-green-500" })
|
|
17195
18082
|
] }),
|
|
17196
|
-
/* @__PURE__ */ (0,
|
|
17197
|
-
/* @__PURE__ */ (0,
|
|
18083
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "truncate", children: [
|
|
18084
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17198
18085
|
"h2",
|
|
17199
18086
|
{
|
|
17200
18087
|
className: "text-lg font-semibold truncate",
|
|
@@ -17202,12 +18089,12 @@ function Chat({
|
|
|
17202
18089
|
children: assistantTitle
|
|
17203
18090
|
}
|
|
17204
18091
|
),
|
|
17205
|
-
/* @__PURE__ */ (0,
|
|
18092
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("p", { className: "text-xs text-muted-foreground", children: t("chat.statusOnline") })
|
|
17206
18093
|
] })
|
|
17207
18094
|
] }),
|
|
17208
|
-
/* @__PURE__ */ (0,
|
|
17209
|
-
canMinimizeToPet && /* @__PURE__ */ (0,
|
|
17210
|
-
/* @__PURE__ */ (0,
|
|
18095
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
18096
|
+
canMinimizeToPet && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Tooltip, { children: [
|
|
18097
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17211
18098
|
"button",
|
|
17212
18099
|
{
|
|
17213
18100
|
type: "button",
|
|
@@ -17218,13 +18105,13 @@ function Chat({
|
|
|
17218
18105
|
"transition-colors duration-150"
|
|
17219
18106
|
),
|
|
17220
18107
|
"aria-label": t("chat.minimizeToPet"),
|
|
17221
|
-
children: /* @__PURE__ */ (0,
|
|
18108
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.Minus, { size: 16 })
|
|
17222
18109
|
}
|
|
17223
18110
|
) }) }),
|
|
17224
|
-
/* @__PURE__ */ (0,
|
|
18111
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipContent, { side: "bottom", children: t("chat.minimizeToPet") })
|
|
17225
18112
|
] }),
|
|
17226
|
-
/* @__PURE__ */ (0,
|
|
17227
|
-
/* @__PURE__ */ (0,
|
|
18113
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Tooltip, { children: [
|
|
18114
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17228
18115
|
"button",
|
|
17229
18116
|
{
|
|
17230
18117
|
type: "button",
|
|
@@ -17235,14 +18122,14 @@ function Chat({
|
|
|
17235
18122
|
"transition-colors duration-150"
|
|
17236
18123
|
),
|
|
17237
18124
|
"aria-label": t("settings.open"),
|
|
17238
|
-
children: /* @__PURE__ */ (0,
|
|
18125
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.Settings, { size: 16 })
|
|
17239
18126
|
}
|
|
17240
18127
|
) }) }),
|
|
17241
|
-
/* @__PURE__ */ (0,
|
|
18128
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipContent, { side: "bottom", children: t("settings.open") })
|
|
17242
18129
|
] }),
|
|
17243
|
-
history?.enabled !== false && /* @__PURE__ */ (0,
|
|
17244
|
-
/* @__PURE__ */ (0,
|
|
17245
|
-
/* @__PURE__ */ (0,
|
|
18130
|
+
history?.enabled !== false && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
18131
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Tooltip, { children: [
|
|
18132
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17246
18133
|
"button",
|
|
17247
18134
|
{
|
|
17248
18135
|
type: "button",
|
|
@@ -17255,12 +18142,12 @@ function Chat({
|
|
|
17255
18142
|
"disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed"
|
|
17256
18143
|
),
|
|
17257
18144
|
"aria-label": t("history.newThread"),
|
|
17258
|
-
children: /* @__PURE__ */ (0,
|
|
18145
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.Pencil, { size: 16 })
|
|
17259
18146
|
}
|
|
17260
18147
|
) }) }),
|
|
17261
|
-
/* @__PURE__ */ (0,
|
|
18148
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipContent, { side: "bottom", children: t("history.newThread") })
|
|
17262
18149
|
] }),
|
|
17263
|
-
/* @__PURE__ */ (0,
|
|
18150
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17264
18151
|
HistorySidebar,
|
|
17265
18152
|
{
|
|
17266
18153
|
threads,
|
|
@@ -17277,18 +18164,29 @@ function Chat({
|
|
|
17277
18164
|
]
|
|
17278
18165
|
}
|
|
17279
18166
|
),
|
|
17280
|
-
/* @__PURE__ */ (0,
|
|
18167
|
+
showMessageNavigation && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
18168
|
+
MessageNavigator,
|
|
18169
|
+
{
|
|
18170
|
+
items: messageNavigationItems,
|
|
18171
|
+
viewportRef,
|
|
18172
|
+
getAnchor: getMessageNavigationAnchor,
|
|
18173
|
+
onNavigate: handleMessageNavigationNavigate,
|
|
18174
|
+
label: t("message.navigation.label"),
|
|
18175
|
+
tagsOverflowLabel: (count) => t("message.navigation.moreTags", { count })
|
|
18176
|
+
}
|
|
18177
|
+
),
|
|
18178
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
17281
18179
|
"div",
|
|
17282
18180
|
{
|
|
17283
18181
|
"data-slot": "chatkit-chat-content",
|
|
17284
18182
|
className: "mx-auto w-full flex-1 p-4",
|
|
17285
18183
|
style: chatColumnStyle,
|
|
17286
18184
|
children: [
|
|
17287
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
17288
|
-
historyError && /* @__PURE__ */ (0,
|
|
17289
|
-
showMissingConfig && /* @__PURE__ */ (0,
|
|
17290
|
-
isHistoryLoading && /* @__PURE__ */ (0,
|
|
17291
|
-
messages.length === 0 && !canLoadMoreMessages ? /* @__PURE__ */ (0,
|
|
18185
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: errorMessage }),
|
|
18186
|
+
historyError && /* @__PURE__ */ (0, import_jsx_runtime56.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 }),
|
|
18187
|
+
showMissingConfig && /* @__PURE__ */ (0, import_jsx_runtime56.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 }),
|
|
18188
|
+
isHistoryLoading && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "mb-4 rounded-lg border border-muted px-3 py-2 text-sm text-muted-foreground", children: t("chat.loadingThread") }),
|
|
18189
|
+
messages.length === 0 && !canLoadMoreMessages ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17292
18190
|
StartScreen,
|
|
17293
18191
|
{
|
|
17294
18192
|
startScreen,
|
|
@@ -17297,10 +18195,10 @@ function Chat({
|
|
|
17297
18195
|
promptSendDisabled: isSubmissionBlocked,
|
|
17298
18196
|
promptEditDisabled: isPromptEditDisabled
|
|
17299
18197
|
}
|
|
17300
|
-
) : /* @__PURE__ */ (0,
|
|
17301
|
-
canLoadMoreMessages && /* @__PURE__ */ (0,
|
|
17302
|
-
/* @__PURE__ */ (0,
|
|
17303
|
-
/* @__PURE__ */ (0,
|
|
18198
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "space-y-4", children: [
|
|
18199
|
+
canLoadMoreMessages && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex items-center gap-3 py-1", children: [
|
|
18200
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "h-px min-w-8 flex-1 bg-border" }),
|
|
18201
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17304
18202
|
Button,
|
|
17305
18203
|
{
|
|
17306
18204
|
type: "button",
|
|
@@ -17312,7 +18210,7 @@ function Chat({
|
|
|
17312
18210
|
children: isLoadingMoreMessages ? t("chat.loadingMoreMessages") : t("chat.loadMoreMessages")
|
|
17313
18211
|
}
|
|
17314
18212
|
),
|
|
17315
|
-
/* @__PURE__ */ (0,
|
|
18213
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "h-px min-w-8 flex-1 bg-border" })
|
|
17316
18214
|
] }),
|
|
17317
18215
|
messages.map((message, index) => {
|
|
17318
18216
|
const messageType = String(message.type);
|
|
@@ -17337,7 +18235,7 @@ function Chat({
|
|
|
17337
18235
|
...humanMessage.fileAssets ?? [],
|
|
17338
18236
|
...humanMessage.attachments ?? []
|
|
17339
18237
|
];
|
|
17340
|
-
const humanRuntimeCapabilityOptions = message.type === "human" ? humanMessage.runtimeCapabilityOptions ??
|
|
18238
|
+
const humanRuntimeCapabilityOptions = message.type === "human" ? humanMessage.runtimeCapabilityOptions ?? getRuntimeCapabilityOptionsForSelection(
|
|
17341
18239
|
getRecommendedRuntimeCapabilitiesSelection(
|
|
17342
18240
|
humanMessage.runtimeCapabilities
|
|
17343
18241
|
),
|
|
@@ -17346,18 +18244,24 @@ function Chat({
|
|
|
17346
18244
|
const hasHumanAttachments = message.type === "human" && humanAttachments.length > 0;
|
|
17347
18245
|
const canQuoteMessage = message.type === "human" || isAssistantMessage;
|
|
17348
18246
|
const quoteSource = message.type === "human" ? t("chat.youLabel") : assistantTitle;
|
|
18247
|
+
const messageNavigationId = getMessageNavigationItemId(
|
|
18248
|
+
message,
|
|
18249
|
+
index
|
|
18250
|
+
);
|
|
17349
18251
|
if (!isAssistantMessage && !hasPlainRenderableContent && !hasHumanAttachments && humanRuntimeCapabilityOptions.length === 0 && humanReferences.length === 0) {
|
|
17350
18252
|
return null;
|
|
17351
18253
|
}
|
|
17352
|
-
return /* @__PURE__ */ (0,
|
|
18254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17353
18255
|
"div",
|
|
17354
18256
|
{
|
|
18257
|
+
ref: (node) => setMessageNavigationAnchor(messageNavigationId, node),
|
|
18258
|
+
"data-message-navigation-id": messageNavigationId,
|
|
17355
18259
|
className: cn(
|
|
17356
18260
|
"group flex gap-3",
|
|
17357
18261
|
message.type === "human" ? "justify-end" : "justify-start -ml-1"
|
|
17358
18262
|
// AI messages: slightly closer to left
|
|
17359
18263
|
),
|
|
17360
|
-
children: /* @__PURE__ */ (0,
|
|
18264
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
17361
18265
|
"div",
|
|
17362
18266
|
{
|
|
17363
18267
|
className: cn(
|
|
@@ -17365,7 +18269,7 @@ function Chat({
|
|
|
17365
18269
|
isAssistantMessage && "min-w-0 flex-1"
|
|
17366
18270
|
),
|
|
17367
18271
|
children: [
|
|
17368
|
-
/* @__PURE__ */ (0,
|
|
18272
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17369
18273
|
"div",
|
|
17370
18274
|
{
|
|
17371
18275
|
...canQuoteMessage ? {
|
|
@@ -17377,7 +18281,7 @@ function Chat({
|
|
|
17377
18281
|
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"
|
|
17378
18282
|
// AI messages: use chat-specific foreground color
|
|
17379
18283
|
),
|
|
17380
|
-
children: isAssistantMessage ? /* @__PURE__ */ (0,
|
|
18284
|
+
children: isAssistantMessage ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17381
18285
|
AssistantMessage,
|
|
17382
18286
|
{
|
|
17383
18287
|
message: {
|
|
@@ -17396,25 +18300,14 @@ function Chat({
|
|
|
17396
18300
|
organizationId: stream.organizationId,
|
|
17397
18301
|
apiUrl: stream.apiUrl
|
|
17398
18302
|
}
|
|
17399
|
-
) : /* @__PURE__ */ (0,
|
|
17400
|
-
message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0,
|
|
17401
|
-
|
|
18303
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
18304
|
+
message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
18305
|
+
HumanRuntimeCapabilityChips,
|
|
17402
18306
|
{
|
|
17403
|
-
|
|
17404
|
-
|
|
17405
|
-
|
|
17406
|
-
|
|
17407
|
-
{
|
|
17408
|
-
option,
|
|
17409
|
-
variant: "chip"
|
|
17410
|
-
}
|
|
17411
|
-
),
|
|
17412
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "max-w-[9rem] truncate", children: option.label })
|
|
17413
|
-
]
|
|
17414
|
-
},
|
|
17415
|
-
`${option.type}:${option.id}`
|
|
17416
|
-
)) }),
|
|
17417
|
-
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)(
|
|
18307
|
+
options: humanRuntimeCapabilityOptions
|
|
18308
|
+
}
|
|
18309
|
+
),
|
|
18310
|
+
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanReferences.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17418
18311
|
ReferenceChip,
|
|
17419
18312
|
{
|
|
17420
18313
|
reference,
|
|
@@ -17422,29 +18315,29 @@ function Chat({
|
|
|
17422
18315
|
},
|
|
17423
18316
|
getReferenceKey(reference)
|
|
17424
18317
|
)) }),
|
|
17425
|
-
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ (0,
|
|
18318
|
+
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "flex flex-wrap gap-1.5 mb-2", children: humanAttachments.map((file, fileIndex) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
17426
18319
|
"div",
|
|
17427
18320
|
{
|
|
17428
18321
|
className: "flex items-center gap-1.5 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs",
|
|
17429
18322
|
children: [
|
|
17430
|
-
/* @__PURE__ */ (0,
|
|
17431
|
-
/* @__PURE__ */ (0,
|
|
18323
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.FileText, { size: 12 }),
|
|
18324
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "max-w-[100px] truncate", children: file.originalName ?? file.id })
|
|
17432
18325
|
]
|
|
17433
18326
|
},
|
|
17434
18327
|
fileIndex
|
|
17435
18328
|
)) }),
|
|
17436
|
-
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ (0,
|
|
18329
|
+
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17437
18330
|
"p",
|
|
17438
18331
|
{
|
|
17439
18332
|
className: "wrap-break-word text-sm leading-relaxed",
|
|
17440
18333
|
children: formatMessageContent(part)
|
|
17441
18334
|
},
|
|
17442
18335
|
`${part.type}-${partIndex}`
|
|
17443
|
-
)) : /* @__PURE__ */ (0,
|
|
18336
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "wrap-break-word text-sm leading-relaxed", children: formatMessageContent(message.content) })
|
|
17444
18337
|
] })
|
|
17445
18338
|
}
|
|
17446
18339
|
),
|
|
17447
|
-
/* @__PURE__ */ (0,
|
|
18340
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17448
18341
|
MessageActions,
|
|
17449
18342
|
{
|
|
17450
18343
|
content: messageContent,
|
|
@@ -17482,7 +18375,7 @@ function Chat({
|
|
|
17482
18375
|
stream.isLoading,
|
|
17483
18376
|
{ now: streamingNow }
|
|
17484
18377
|
);
|
|
17485
|
-
return /* @__PURE__ */ (0,
|
|
18378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "flex justify-start gap-3 -ml-2", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "max-w-full rounded-2xl py-2.5", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17486
18379
|
AssistantStreamingIndicator,
|
|
17487
18380
|
{
|
|
17488
18381
|
status: fallbackStreamingStatus ?? "loading"
|
|
@@ -17493,7 +18386,7 @@ function Chat({
|
|
|
17493
18386
|
]
|
|
17494
18387
|
}
|
|
17495
18388
|
),
|
|
17496
|
-
!isAtBottom && messages.length > 0 && /* @__PURE__ */ (0,
|
|
18389
|
+
!isAtBottom && messages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "sticky bottom-20 z-20 flex justify-center px-4 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17497
18390
|
Button,
|
|
17498
18391
|
{
|
|
17499
18392
|
type: "button",
|
|
@@ -17506,10 +18399,10 @@ function Chat({
|
|
|
17506
18399
|
onClick: () => scrollToBottom(true, true),
|
|
17507
18400
|
"aria-label": t("chat.scrollToBottom"),
|
|
17508
18401
|
title: t("chat.scrollToBottom"),
|
|
17509
|
-
children: /* @__PURE__ */ (0,
|
|
18402
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.ArrowDown, { size: 16 })
|
|
17510
18403
|
}
|
|
17511
18404
|
) }),
|
|
17512
|
-
quoteSelection && /* @__PURE__ */ (0,
|
|
18405
|
+
quoteSelection && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17513
18406
|
"div",
|
|
17514
18407
|
{
|
|
17515
18408
|
className: "pointer-events-none fixed z-50",
|
|
@@ -17518,7 +18411,7 @@ function Chat({
|
|
|
17518
18411
|
left: `${quoteSelection.left}px`,
|
|
17519
18412
|
transform: "translateX(-50%)"
|
|
17520
18413
|
},
|
|
17521
|
-
children: /* @__PURE__ */ (0,
|
|
18414
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
17522
18415
|
Button,
|
|
17523
18416
|
{
|
|
17524
18417
|
type: "button",
|
|
@@ -17530,22 +18423,22 @@ function Chat({
|
|
|
17530
18423
|
"aria-label": t("composer.quoteSelection"),
|
|
17531
18424
|
title: t("composer.quoteSelection"),
|
|
17532
18425
|
children: [
|
|
17533
|
-
/* @__PURE__ */ (0,
|
|
18426
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.Quote, { size: 14 }),
|
|
17534
18427
|
t("composer.quoteSelection")
|
|
17535
18428
|
]
|
|
17536
18429
|
}
|
|
17537
18430
|
)
|
|
17538
18431
|
}
|
|
17539
18432
|
),
|
|
17540
|
-
/* @__PURE__ */ (0,
|
|
18433
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
17541
18434
|
"div",
|
|
17542
18435
|
{
|
|
17543
18436
|
"data-slot": "chatkit-chat-composer",
|
|
17544
18437
|
className: "mx-auto w-full p-2 sticky bottom-0 z-10 bg-background",
|
|
17545
18438
|
style: chatColumnStyle,
|
|
17546
18439
|
children: [
|
|
17547
|
-
threadErrorMessage && /* @__PURE__ */ (0,
|
|
17548
|
-
/* @__PURE__ */ (0,
|
|
18440
|
+
threadErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime56.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 }),
|
|
18441
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17549
18442
|
ChatAttachments,
|
|
17550
18443
|
{
|
|
17551
18444
|
ref: attachmentsRef,
|
|
@@ -17559,7 +18452,7 @@ function Chat({
|
|
|
17559
18452
|
onStateChange: setAttachmentState
|
|
17560
18453
|
}
|
|
17561
18454
|
),
|
|
17562
|
-
references.length > 0 && /* @__PURE__ */ (0,
|
|
18455
|
+
references.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "mb-3 flex flex-wrap gap-2", children: references.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17563
18456
|
ReferenceChip,
|
|
17564
18457
|
{
|
|
17565
18458
|
reference,
|
|
@@ -17573,32 +18466,16 @@ function Chat({
|
|
|
17573
18466
|
},
|
|
17574
18467
|
getReferenceKey(reference)
|
|
17575
18468
|
)) }),
|
|
17576
|
-
|
|
17577
|
-
|
|
17578
|
-
|
|
17579
|
-
|
|
17580
|
-
|
|
17581
|
-
|
|
17582
|
-
|
|
17583
|
-
|
|
17584
|
-
|
|
17585
|
-
|
|
17586
|
-
"button",
|
|
17587
|
-
{
|
|
17588
|
-
type: "button",
|
|
17589
|
-
onClick: () => removeRunRuntimeCapability(option),
|
|
17590
|
-
className: "rounded-full p-0.5 hover:bg-primary/15",
|
|
17591
|
-
title: t("composer.capabilities.removeRunCapability"),
|
|
17592
|
-
"aria-label": t("composer.capabilities.removeRunCapability"),
|
|
17593
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.X, { size: 11 })
|
|
17594
|
-
}
|
|
17595
|
-
)
|
|
17596
|
-
]
|
|
17597
|
-
},
|
|
17598
|
-
`${option.type}:${option.id}`
|
|
17599
|
-
))
|
|
17600
|
-
] }),
|
|
17601
|
-
showGoalStatus && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
18469
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
18470
|
+
DetachedRunRuntimeCapabilities,
|
|
18471
|
+
{
|
|
18472
|
+
options: detachedRunRuntimeCapabilityOptions,
|
|
18473
|
+
runOnlyLabel: t("composer.capabilities.runOnly"),
|
|
18474
|
+
removeLabel: t("composer.capabilities.removeRunCapability"),
|
|
18475
|
+
onRemove: removeRunRuntimeCapability
|
|
18476
|
+
}
|
|
18477
|
+
),
|
|
18478
|
+
showGoalStatus && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
17602
18479
|
"div",
|
|
17603
18480
|
{
|
|
17604
18481
|
className: cn(
|
|
@@ -17606,8 +18483,8 @@ function Chat({
|
|
|
17606
18483
|
isGoalObjectiveExpanded ? "items-start" : "items-center"
|
|
17607
18484
|
),
|
|
17608
18485
|
children: [
|
|
17609
|
-
/* @__PURE__ */ (0,
|
|
17610
|
-
|
|
18486
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
18487
|
+
import_lucide_react30.Target,
|
|
17611
18488
|
{
|
|
17612
18489
|
className: cn(
|
|
17613
18490
|
"size-4 shrink-0 text-muted-foreground",
|
|
@@ -17615,13 +18492,13 @@ function Chat({
|
|
|
17615
18492
|
)
|
|
17616
18493
|
}
|
|
17617
18494
|
),
|
|
17618
|
-
/* @__PURE__ */ (0,
|
|
17619
|
-
/* @__PURE__ */ (0,
|
|
17620
|
-
/* @__PURE__ */ (0,
|
|
17621
|
-
threadGoal && /* @__PURE__ */ (0,
|
|
17622
|
-
isGoalLoading && /* @__PURE__ */ (0,
|
|
18495
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
18496
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
18497
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "font-medium", children: t("chat.goal.label") }),
|
|
18498
|
+
threadGoal && /* @__PURE__ */ (0, import_jsx_runtime56.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}`) }),
|
|
18499
|
+
isGoalLoading && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.Loader2, { className: "size-3 animate-spin text-muted-foreground" })
|
|
17623
18500
|
] }),
|
|
17624
|
-
/* @__PURE__ */ (0,
|
|
18501
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17625
18502
|
"div",
|
|
17626
18503
|
{
|
|
17627
18504
|
className: cn(
|
|
@@ -17631,13 +18508,13 @@ function Chat({
|
|
|
17631
18508
|
children: goalError || threadGoal?.objective
|
|
17632
18509
|
}
|
|
17633
18510
|
),
|
|
17634
|
-
threadGoal && /* @__PURE__ */ (0,
|
|
18511
|
+
threadGoal && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { children: t("chat.goal.elapsed", {
|
|
17635
18512
|
elapsed: formatGoalElapsed(displayedGoalElapsedSeconds)
|
|
17636
18513
|
}) }) })
|
|
17637
18514
|
] }),
|
|
17638
|
-
threadGoal && /* @__PURE__ */ (0,
|
|
17639
|
-
/* @__PURE__ */ (0,
|
|
17640
|
-
/* @__PURE__ */ (0,
|
|
18515
|
+
threadGoal && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
18516
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Tooltip, { children: [
|
|
18517
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17641
18518
|
Button,
|
|
17642
18519
|
{
|
|
17643
18520
|
type: "button",
|
|
@@ -17648,13 +18525,13 @@ function Chat({
|
|
|
17648
18525
|
const prefix = "/goal edit ";
|
|
17649
18526
|
setComposerText(`${prefix}${threadGoal.objective}`);
|
|
17650
18527
|
},
|
|
17651
|
-
children: /* @__PURE__ */ (0,
|
|
18528
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.Pencil, { className: "size-3" })
|
|
17652
18529
|
}
|
|
17653
18530
|
) }),
|
|
17654
|
-
/* @__PURE__ */ (0,
|
|
18531
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipContent, { children: t("chat.goal.edit") })
|
|
17655
18532
|
] }),
|
|
17656
|
-
/* @__PURE__ */ (0,
|
|
17657
|
-
/* @__PURE__ */ (0,
|
|
18533
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Tooltip, { children: [
|
|
18534
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17658
18535
|
Button,
|
|
17659
18536
|
{
|
|
17660
18537
|
type: "button",
|
|
@@ -17670,13 +18547,13 @@ function Chat({
|
|
|
17670
18547
|
executionType: "insert_invocation"
|
|
17671
18548
|
}
|
|
17672
18549
|
}),
|
|
17673
|
-
children: threadGoal.status === "paused" ? /* @__PURE__ */ (0,
|
|
18550
|
+
children: threadGoal.status === "paused" ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.Play, { className: "size-3" }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.Pause, { className: "size-3" })
|
|
17674
18551
|
}
|
|
17675
18552
|
) }),
|
|
17676
|
-
/* @__PURE__ */ (0,
|
|
18553
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipContent, { children: threadGoal.status === "paused" ? t("chat.goal.resume") : t("chat.goal.pause") })
|
|
17677
18554
|
] }),
|
|
17678
|
-
/* @__PURE__ */ (0,
|
|
17679
|
-
/* @__PURE__ */ (0,
|
|
18555
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Tooltip, { children: [
|
|
18556
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17680
18557
|
Button,
|
|
17681
18558
|
{
|
|
17682
18559
|
type: "button",
|
|
@@ -17692,13 +18569,13 @@ function Chat({
|
|
|
17692
18569
|
executionType: "insert_invocation"
|
|
17693
18570
|
}
|
|
17694
18571
|
}),
|
|
17695
|
-
children: /* @__PURE__ */ (0,
|
|
18572
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.Trash2, { className: "size-3" })
|
|
17696
18573
|
}
|
|
17697
18574
|
) }),
|
|
17698
|
-
/* @__PURE__ */ (0,
|
|
18575
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipContent, { children: t("chat.goal.clear") })
|
|
17699
18576
|
] }),
|
|
17700
|
-
threadGoal.objective && !goalError && /* @__PURE__ */ (0,
|
|
17701
|
-
/* @__PURE__ */ (0,
|
|
18577
|
+
threadGoal.objective && !goalError && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Tooltip, { children: [
|
|
18578
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17702
18579
|
Button,
|
|
17703
18580
|
{
|
|
17704
18581
|
type: "button",
|
|
@@ -17707,8 +18584,8 @@ function Chat({
|
|
|
17707
18584
|
"aria-expanded": isGoalObjectiveExpanded,
|
|
17708
18585
|
"aria-label": isGoalObjectiveExpanded ? t("chat.goal.collapseObjective") : t("chat.goal.expandObjective"),
|
|
17709
18586
|
onClick: () => setIsGoalObjectiveExpanded((expanded) => !expanded),
|
|
17710
|
-
children: /* @__PURE__ */ (0,
|
|
17711
|
-
|
|
18587
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
18588
|
+
import_lucide_react30.ChevronDown,
|
|
17712
18589
|
{
|
|
17713
18590
|
className: cn(
|
|
17714
18591
|
"size-3 transition-transform",
|
|
@@ -17718,13 +18595,13 @@ function Chat({
|
|
|
17718
18595
|
)
|
|
17719
18596
|
}
|
|
17720
18597
|
) }),
|
|
17721
|
-
/* @__PURE__ */ (0,
|
|
18598
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipContent, { children: isGoalObjectiveExpanded ? t("chat.goal.collapseObjective") : t("chat.goal.expandObjective") })
|
|
17722
18599
|
] })
|
|
17723
18600
|
] })
|
|
17724
18601
|
]
|
|
17725
18602
|
}
|
|
17726
18603
|
),
|
|
17727
|
-
/* @__PURE__ */ (0,
|
|
18604
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17728
18605
|
PendingRuntimeServices,
|
|
17729
18606
|
{
|
|
17730
18607
|
state: stream.runtimeActivities.sandboxServices,
|
|
@@ -17733,7 +18610,7 @@ function Chat({
|
|
|
17733
18610
|
className: hasPendingTodos || hasPendingFollowUps ? "mb-2" : void 0
|
|
17734
18611
|
}
|
|
17735
18612
|
),
|
|
17736
|
-
/* @__PURE__ */ (0,
|
|
18613
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17737
18614
|
PendingTodos,
|
|
17738
18615
|
{
|
|
17739
18616
|
snapshot: stream.todos,
|
|
@@ -17741,7 +18618,7 @@ function Chat({
|
|
|
17741
18618
|
className: hasPendingFollowUps ? "mb-2" : void 0
|
|
17742
18619
|
}
|
|
17743
18620
|
),
|
|
17744
|
-
/* @__PURE__ */ (0,
|
|
18621
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17745
18622
|
PendingFollowUps,
|
|
17746
18623
|
{
|
|
17747
18624
|
items: pendingFollowUps,
|
|
@@ -17754,7 +18631,7 @@ function Chat({
|
|
|
17754
18631
|
attachToComposer: true
|
|
17755
18632
|
}
|
|
17756
18633
|
),
|
|
17757
|
-
/* @__PURE__ */ (0,
|
|
18634
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17758
18635
|
RequestUserInputPanel,
|
|
17759
18636
|
{
|
|
17760
18637
|
request: stream.pendingRequestUserInput,
|
|
@@ -17763,7 +18640,7 @@ function Chat({
|
|
|
17763
18640
|
attachToComposer: true
|
|
17764
18641
|
}
|
|
17765
18642
|
),
|
|
17766
|
-
/* @__PURE__ */ (0,
|
|
18643
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17767
18644
|
HITLApprovalPanel,
|
|
17768
18645
|
{
|
|
17769
18646
|
request: stream.pendingHITLRequest,
|
|
@@ -17772,7 +18649,7 @@ function Chat({
|
|
|
17772
18649
|
attachToComposer: true
|
|
17773
18650
|
}
|
|
17774
18651
|
),
|
|
17775
|
-
runtimeCapabilityPalette && /* @__PURE__ */ (0,
|
|
18652
|
+
runtimeCapabilityPalette && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17776
18653
|
SlashPalette,
|
|
17777
18654
|
{
|
|
17778
18655
|
palette: runtimeCapabilityPalette,
|
|
@@ -17786,7 +18663,7 @@ function Chat({
|
|
|
17786
18663
|
onSelect: selectSlashPaletteOption
|
|
17787
18664
|
}
|
|
17788
18665
|
),
|
|
17789
|
-
/* @__PURE__ */ (0,
|
|
18666
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("form", { className: "flex items-end", onSubmit: handleSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
17790
18667
|
"div",
|
|
17791
18668
|
{
|
|
17792
18669
|
"data-slot": "composer-input-shell",
|
|
@@ -17800,7 +18677,7 @@ function Chat({
|
|
|
17800
18677
|
composerInputRoundedClass
|
|
17801
18678
|
),
|
|
17802
18679
|
children: [
|
|
17803
|
-
/* @__PURE__ */ (0,
|
|
18680
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17804
18681
|
"div",
|
|
17805
18682
|
{
|
|
17806
18683
|
ref: composerInputRef,
|
|
@@ -17822,39 +18699,19 @@ function Chat({
|
|
|
17822
18699
|
(missingConfig || isHistoryLoading || hasPendingInteractiveRequest) && "cursor-not-allowed opacity-50"
|
|
17823
18700
|
),
|
|
17824
18701
|
children: renderedComposerParts.map(
|
|
17825
|
-
(part, index) => part.type === "text" ? /* @__PURE__ */ (0,
|
|
17826
|
-
"span",
|
|
17827
|
-
{
|
|
17828
|
-
"data-composer-capability-key": part.key,
|
|
17829
|
-
"data-capability-type": part.capability.type,
|
|
17830
|
-
"data-capability-id": part.capability.id,
|
|
17831
|
-
contentEditable: false,
|
|
17832
|
-
className: "mx-0.5 inline-flex max-w-[14rem] select-none items-center gap-1 text-sm font-semibold text-primary align-baseline",
|
|
17833
|
-
children: [
|
|
17834
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
17835
|
-
RuntimeCapabilityIcon,
|
|
17836
|
-
{
|
|
17837
|
-
option: part.capability,
|
|
17838
|
-
variant: "chip"
|
|
17839
|
-
}
|
|
17840
|
-
),
|
|
17841
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "truncate", children: part.capability.label })
|
|
17842
|
-
]
|
|
17843
|
-
},
|
|
17844
|
-
part.key
|
|
17845
|
-
)
|
|
18702
|
+
(part, index) => part.type === "text" ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(React51.Fragment, { children: part.text }, `text-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ComposerCapabilityToken, { part }, part.key)
|
|
17846
18703
|
)
|
|
17847
18704
|
},
|
|
17848
18705
|
composerDomVersion
|
|
17849
18706
|
),
|
|
17850
|
-
/* @__PURE__ */ (0,
|
|
18707
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
17851
18708
|
"div",
|
|
17852
18709
|
{
|
|
17853
18710
|
"data-slot": "composer-action-bar",
|
|
17854
18711
|
className: "pointer-events-none absolute inset-x-1.5 bottom-1 flex min-h-10 items-center justify-between gap-2",
|
|
17855
18712
|
children: [
|
|
17856
|
-
/* @__PURE__ */ (0,
|
|
17857
|
-
/* @__PURE__ */ (0,
|
|
18713
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "pointer-events-none flex min-w-0 flex-1 items-center gap-1.5", children: [
|
|
18714
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "pointer-events-auto flex shrink-0 items-center gap-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17858
18715
|
ComposerMenu,
|
|
17859
18716
|
{
|
|
17860
18717
|
composer,
|
|
@@ -17872,20 +18729,20 @@ function Chat({
|
|
|
17872
18729
|
disabled: missingConfig || isHistoryLoading || hasPendingInteractiveRequest
|
|
17873
18730
|
}
|
|
17874
18731
|
) }),
|
|
17875
|
-
selectedTool && /* @__PURE__ */ (0,
|
|
17876
|
-
/* @__PURE__ */ (0,
|
|
17877
|
-
/* @__PURE__ */ (0,
|
|
18732
|
+
selectedTool && /* @__PURE__ */ (0, import_jsx_runtime56.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: [
|
|
18733
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "truncate", children: selectedTool.shortLabel ?? selectedTool.label }),
|
|
18734
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17878
18735
|
"button",
|
|
17879
18736
|
{
|
|
17880
18737
|
type: "button",
|
|
17881
18738
|
onClick: () => setSelectedTool(null),
|
|
17882
18739
|
className: "shrink-0 rounded-full p-0.5 text-primary/70 hover:bg-primary/10 hover:text-primary",
|
|
17883
|
-
children: /* @__PURE__ */ (0,
|
|
18740
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.X, { size: 12 })
|
|
17884
18741
|
}
|
|
17885
18742
|
)
|
|
17886
18743
|
] })
|
|
17887
18744
|
] }),
|
|
17888
|
-
/* @__PURE__ */ (0,
|
|
18745
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "pointer-events-auto shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17889
18746
|
SendButton,
|
|
17890
18747
|
{
|
|
17891
18748
|
disabled: isSendDisabled,
|
|
@@ -17908,7 +18765,7 @@ function Chat({
|
|
|
17908
18765
|
]
|
|
17909
18766
|
}
|
|
17910
18767
|
) }),
|
|
17911
|
-
disclaimer?.text && /* @__PURE__ */ (0,
|
|
18768
|
+
disclaimer?.text && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17912
18769
|
"p",
|
|
17913
18770
|
{
|
|
17914
18771
|
className: cn(
|
|
@@ -17918,14 +18775,14 @@ function Chat({
|
|
|
17918
18775
|
children: disclaimer.text
|
|
17919
18776
|
}
|
|
17920
18777
|
),
|
|
17921
|
-
/* @__PURE__ */ (0,
|
|
17922
|
-
/* @__PURE__ */ (0,
|
|
17923
|
-
/* @__PURE__ */ (0,
|
|
18778
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "mt-2 flex items-center justify-center gap-2 text-xs text-muted-foreground", children: [
|
|
18779
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { children: t("chat.poweredBy") }),
|
|
18780
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ContextUsageIndicator, { className: "absolute right-4" })
|
|
17924
18781
|
] })
|
|
17925
18782
|
]
|
|
17926
18783
|
}
|
|
17927
18784
|
),
|
|
17928
|
-
/* @__PURE__ */ (0,
|
|
18785
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17929
18786
|
SettingsSheet,
|
|
17930
18787
|
{
|
|
17931
18788
|
open: petSettingsOpen,
|
|
@@ -17935,17 +18792,17 @@ function Chat({
|
|
|
17935
18792
|
onSave: savePetLocalSettings
|
|
17936
18793
|
}
|
|
17937
18794
|
),
|
|
17938
|
-
/* @__PURE__ */ (0,
|
|
18795
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(PetBridge, { pet: effectivePet, state: petAutoState })
|
|
17939
18796
|
]
|
|
17940
18797
|
}
|
|
17941
18798
|
);
|
|
17942
18799
|
}
|
|
17943
18800
|
|
|
17944
18801
|
// src/components/ui/separator.tsx
|
|
17945
|
-
var
|
|
17946
|
-
var
|
|
17947
|
-
var Separator =
|
|
17948
|
-
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ (0,
|
|
18802
|
+
var React52 = __toESM(require("react"), 1);
|
|
18803
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
18804
|
+
var Separator = React52.forwardRef(
|
|
18805
|
+
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
17949
18806
|
"div",
|
|
17950
18807
|
{
|
|
17951
18808
|
ref,
|