@xpert-ai/chatkit-ui 0.3.4 → 0.3.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-DOSftAYs.js → _baseUniq-PQJUyd2p.js} +1 -1
- package/dist/app/assets/{abap-D8t_liei.js → abap-DBNQvwwq.js} +1 -1
- package/dist/app/assets/{abnf-jhem6Fdp.js → abnf-DAYjyqbD.js} +1 -1
- package/dist/app/assets/{actionscript-AgAqywOC.js → actionscript-CC6WSmTp.js} +1 -1
- package/dist/app/assets/{ada-BR3Q6K2R.js → ada-BKGodcKv.js} +1 -1
- package/dist/app/assets/{agda-s2LPXGxr.js → agda-Btmo1dV2.js} +1 -1
- package/dist/app/assets/{al-DbvPGDsA.js → al-ZGIJe93k.js} +1 -1
- package/dist/app/assets/{antlr4-Dde8A9o-.js → antlr4-5WGUtMyl.js} +1 -1
- package/dist/app/assets/{apacheconf-XU1nZV0U.js → apacheconf-DUR_1QqW.js} +1 -1
- package/dist/app/assets/{apex-dwhJyh_8.js → apex-BintsQD-.js} +1 -1
- package/dist/app/assets/{apl-6TVT9aj4.js → apl-B7pUHOBS.js} +1 -1
- package/dist/app/assets/{applescript-CK6TQ3Fp.js → applescript-CanCSogn.js} +1 -1
- package/dist/app/assets/{aql-CAitgyBw.js → aql-iDHrUFca.js} +1 -1
- package/dist/app/assets/{arc-y7BBKPBC.js → arc-VbTm84dM.js} +1 -1
- package/dist/app/assets/{architectureDiagram-Q4EWVU46-CKPXDiCw.js → architectureDiagram-Q4EWVU46-BwbXOlsJ.js} +1 -1
- package/dist/app/assets/{arduino-BX92l-fC.js → arduino-CvuY6cDV.js} +1 -1
- package/dist/app/assets/{arff-TZ2mzCjA.js → arff-C7UK1Sqo.js} +1 -1
- package/dist/app/assets/{asciidoc-CbdSoDU0.js → asciidoc-jaQgm_Ci.js} +1 -1
- package/dist/app/assets/{asm6502-DB6lK7kM.js → asm6502-Bec9iTSO.js} +1 -1
- package/dist/app/assets/{asmatmel-DUbAVWcI.js → asmatmel-CWWLYM-f.js} +1 -1
- package/dist/app/assets/{aspnet-BJclsNGz.js → aspnet-EICvaNos.js} +1 -1
- package/dist/app/assets/{autohotkey-BAHo4mzJ.js → autohotkey-CgvCc8dt.js} +1 -1
- package/dist/app/assets/{autoit-CpXn4Gjh.js → autoit-BbrdfXjj.js} +1 -1
- package/dist/app/assets/{avisynth-CB7WaK_0.js → avisynth-C7cOgG-q.js} +1 -1
- package/dist/app/assets/{avro-idl-C-DAHRE1.js → avro-idl-BsT9yVqS.js} +1 -1
- package/dist/app/assets/{bash-De_5PB_T.js → bash-BF1ylQ6_.js} +1 -1
- package/dist/app/assets/{basic-TAOzT46e.js → basic-DyO_cuAQ.js} +1 -1
- package/dist/app/assets/{batch-yBjeCG2_.js → batch-DdxmhDRT.js} +1 -1
- package/dist/app/assets/{bbcode-zhuhkwPV.js → bbcode-Csh0dpf7.js} +1 -1
- package/dist/app/assets/{bicep-3sditE87.js → bicep-CEnRCsw4.js} +1 -1
- package/dist/app/assets/{birb-B91lhwFM.js → birb-H4aZEyfE.js} +1 -1
- package/dist/app/assets/{bison-Zl9yhw_8.js → bison-B4NzJQL4.js} +1 -1
- package/dist/app/assets/{blockDiagram-DXYQGD6D-CbzYvF40.js → blockDiagram-DXYQGD6D-BQrs2vZp.js} +1 -1
- package/dist/app/assets/{bnf-BTyJWL2-.js → bnf-BpnLOKBL.js} +1 -1
- package/dist/app/assets/{brainfuck-D-gtcLd6.js → brainfuck-BcXFtTZS.js} +1 -1
- package/dist/app/assets/{brightscript-CtoapRkx.js → brightscript-C-G4maiE.js} +1 -1
- package/dist/app/assets/{bro-MqwpLO_C.js → bro-JcLlkXX7.js} +1 -1
- package/dist/app/assets/{bsl-B51ARJIQ.js → bsl-C7EgrPBt.js} +1 -1
- package/dist/app/assets/{c-Dd7OPCIn.js → c-0vDIBgc3.js} +1 -1
- package/dist/app/assets/{c4Diagram-AHTNJAMY-Cl2FGnEB.js → c4Diagram-AHTNJAMY-wtHHI5rn.js} +1 -1
- package/dist/app/assets/{cfscript-BEyB5tLd.js → cfscript-B5a7v4dm.js} +1 -1
- package/dist/app/assets/{chaiscript-BEE5daDb.js → chaiscript-CC6j4sQE.js} +1 -1
- package/dist/app/assets/channel-B6zrZ2OM.js +1 -0
- package/dist/app/assets/{chunk-4BX2VUAB-CdWO6X3v.js → chunk-4BX2VUAB-Dlz831RQ.js} +1 -1
- package/dist/app/assets/{chunk-4TB4RGXK-B99XSc_o.js → chunk-4TB4RGXK-D5P5dUqt.js} +1 -1
- package/dist/app/assets/{chunk-55IACEB6-Bf8lWYm0.js → chunk-55IACEB6-BqMvjwUA.js} +1 -1
- package/dist/app/assets/{chunk-EDXVE4YY-D0jGhBDV.js → chunk-EDXVE4YY-DnPhlqJA.js} +1 -1
- package/dist/app/assets/{chunk-FMBD7UC4-CPVhZRqV.js → chunk-FMBD7UC4-DNRIZD8O.js} +1 -1
- package/dist/app/assets/{chunk-OYMX7WX6-B3B3qd2F.js → chunk-OYMX7WX6-JXHjhCxm.js} +1 -1
- package/dist/app/assets/{chunk-QZHKN3VN-C9zZSGTB.js → chunk-QZHKN3VN-BkxXCZY4.js} +1 -1
- package/dist/app/assets/{chunk-YZCP3GAM-BX0g-UOY.js → chunk-YZCP3GAM-EpFGzvxp.js} +1 -1
- package/dist/app/assets/{cil-DfLzhPVn.js → cil-iQdhNO4Q.js} +1 -1
- package/dist/app/assets/classDiagram-6PBFFD2Q-CrRCjWNC.js +1 -0
- package/dist/app/assets/classDiagram-v2-HSJHXN6E-CrRCjWNC.js +1 -0
- package/dist/app/assets/{clike-Dd07rx25.js → clike-CQAeHYPM.js} +1 -1
- package/dist/app/assets/{clojure-Du6gb2Do.js → clojure-Cql6MpyZ.js} +1 -1
- package/dist/app/assets/clone-DF9MaeHz.js +1 -0
- package/dist/app/assets/{cmake-DpKAfrpv.js → cmake-BfKHjCsg.js} +1 -1
- package/dist/app/assets/{cobol-CMhyCAN0.js → cobol-CKkM0fVl.js} +1 -1
- package/dist/app/assets/{coffeescript-C_hK5LrH.js → coffeescript-CgyUEXhV.js} +1 -1
- package/dist/app/assets/{concurnas-BzzuO0wJ.js → concurnas-CeEqG40V.js} +1 -1
- package/dist/app/assets/{coq-D28Kf8H7.js → coq-CkWZFRlP.js} +1 -1
- package/dist/app/assets/{core-CkMLmhj1.js → core-CcAPm-aU.js} +1 -1
- package/dist/app/assets/{cose-bilkent-S5V4N54A-Bnbhbxn8.js → cose-bilkent-S5V4N54A-kULVHEg6.js} +1 -1
- package/dist/app/assets/{cpp-DMtEaL9D.js → cpp-Bwq_b1tA.js} +1 -1
- package/dist/app/assets/{crystal-BPv3cq00.js → crystal-YNIUD3Bs.js} +1 -1
- package/dist/app/assets/{csharp-CogydNTP.js → csharp-P6DguRUY.js} +1 -1
- package/dist/app/assets/{cshtml-DwKZdXN4.js → cshtml-B5QmdkLH.js} +1 -1
- package/dist/app/assets/{csp-EdkmOQr2.js → csp-DFeKy3lq.js} +1 -1
- package/dist/app/assets/{css-GGj7gjJp.js → css-CRC3M3rp.js} +1 -1
- package/dist/app/assets/{css-extras-_xrLQVK9.js → css-extras-BFuChsao.js} +1 -1
- package/dist/app/assets/{csv-DQnF4IQS.js → csv-C4LMPB8f.js} +1 -1
- package/dist/app/assets/{cypher-mlTzP2DC.js → cypher-HIcVk2j0.js} +1 -1
- package/dist/app/assets/{d-CA6ua4gG.js → d-BnjQOzu7.js} +1 -1
- package/dist/app/assets/{dagre-KV5264BT-2pUvoHnZ.js → dagre-KV5264BT-DYeQuZ_S.js} +1 -1
- package/dist/app/assets/{dart-BSRdjoJD.js → dart-BY_HEqIc.js} +1 -1
- package/dist/app/assets/{dataweave-CTK9G89H.js → dataweave-IZkekg5J.js} +1 -1
- package/dist/app/assets/{dax-CLAaspXf.js → dax-BDxI87qH.js} +1 -1
- package/dist/app/assets/{dhall-DvmFF2lw.js → dhall-BI7me9By.js} +1 -1
- package/dist/app/assets/{diagram-5BDNPKRD--2m-CBif.js → diagram-5BDNPKRD-DqUtPt3D.js} +1 -1
- package/dist/app/assets/{diagram-G4DWMVQ6-xfTAcTBK.js → diagram-G4DWMVQ6-DUz5iheG.js} +1 -1
- package/dist/app/assets/{diagram-MMDJMWI5-DJ9-7Sko.js → diagram-MMDJMWI5-DqMZVdpe.js} +1 -1
- package/dist/app/assets/{diagram-TYMM5635-Dbu04dwS.js → diagram-TYMM5635-D4dMAYPV.js} +1 -1
- package/dist/app/assets/{diff-DexI-NjF.js → diff-D1eveguk.js} +1 -1
- package/dist/app/assets/{django-BJtz28yd.js → django-n2RdeMZg.js} +1 -1
- package/dist/app/assets/{dns-zone-file-C-rZlLjq.js → dns-zone-file-C7ZVuM_8.js} +1 -1
- package/dist/app/assets/{docker-D3zkJQBB.js → docker-2dKv2uP8.js} +1 -1
- package/dist/app/assets/{dot-CYyhO0AU.js → dot-CnM9kCZh.js} +1 -1
- package/dist/app/assets/{ebnf-DRQkwE29.js → ebnf-DNNgDJ77.js} +1 -1
- package/dist/app/assets/{editorconfig-BqLWNpRj.js → editorconfig-BOtWIdJu.js} +1 -1
- package/dist/app/assets/{eiffel-C9PIq1yy.js → eiffel-DZJsL-6U.js} +1 -1
- package/dist/app/assets/{ejs-B6_5mrfN.js → ejs-DlY_5WK7.js} +1 -1
- package/dist/app/assets/{elixir-jtsDOmKm.js → elixir-DnflWYYw.js} +1 -1
- package/dist/app/assets/{elm-DRbXA7ir.js → elm-DiBtRJyK.js} +1 -1
- package/dist/app/assets/{erDiagram-SMLLAGMA-CrI2ZkzN.js → erDiagram-SMLLAGMA-s249XOhW.js} +1 -1
- package/dist/app/assets/{erb-G2oGuDtf.js → erb-Ctwnlnto.js} +1 -1
- package/dist/app/assets/{erlang-CT-pjUEp.js → erlang-BnrgWRyV.js} +1 -1
- package/dist/app/assets/{etlua-qmLyJp4f.js → etlua-B-b2a1aT.js} +1 -1
- package/dist/app/assets/{excel-formula-3pfMQM_6.js → excel-formula-BfwuYhTY.js} +1 -1
- package/dist/app/assets/{factor-Bo9zUudA.js → factor-2cFlXUFG.js} +1 -1
- package/dist/app/assets/{false-oN6u3jCd.js → false-DVJW4Xbm.js} +1 -1
- package/dist/app/assets/{firestore-security-rules-CtzUeAWq.js → firestore-security-rules-BDB3ruEY.js} +1 -1
- package/dist/app/assets/{flow-nzq0GfkM.js → flow-v_X8TsCx.js} +1 -1
- package/dist/app/assets/{flowDiagram-DWJPFMVM-CGpnDmCG.js → flowDiagram-DWJPFMVM-Dz8lk_A8.js} +1 -1
- package/dist/app/assets/{fortran-DVeArHMZ.js → fortran-VlXf9wYr.js} +1 -1
- package/dist/app/assets/{fsharp--fFnup68.js → fsharp-BgmRbToz.js} +1 -1
- package/dist/app/assets/{ftl-BMxP4X-x.js → ftl-CX7l6a-K.js} +1 -1
- package/dist/app/assets/{ganttDiagram-T4ZO3ILL-CCTn88VZ.js → ganttDiagram-T4ZO3ILL-C8JxZNAd.js} +1 -1
- package/dist/app/assets/{gap-B7zirCOJ.js → gap-C3towync.js} +1 -1
- package/dist/app/assets/{gcode-CQFJN_Te.js → gcode-pPl8BHC6.js} +1 -1
- package/dist/app/assets/{gdscript-BTRKMIlE.js → gdscript-CQ5KQpTU.js} +1 -1
- package/dist/app/assets/{gedcom-4Y3UUWcB.js → gedcom-UKqoiZ_B.js} +1 -1
- package/dist/app/assets/{gherkin-DK5Y4NpK.js → gherkin-oHLPyBSJ.js} +1 -1
- package/dist/app/assets/{git-DD3NDd7U.js → git-QJvYrr1x.js} +1 -1
- package/dist/app/assets/{gitGraphDiagram-UUTBAWPF-nEeDINSI.js → gitGraphDiagram-UUTBAWPF-D8hAIW7o.js} +1 -1
- package/dist/app/assets/{glsl-BCT9m8QS.js → glsl-D9mjvqGV.js} +1 -1
- package/dist/app/assets/{gml-CCB73B6Z.js → gml-DyeDbLje.js} +1 -1
- package/dist/app/assets/{gn-BIFCrkIE.js → gn-CQxx-3wR.js} +1 -1
- package/dist/app/assets/{go-dyQD8YyU.js → go-BlxfTxGG.js} +1 -1
- package/dist/app/assets/{go-module-BXpIFu8x.js → go-module-aUBiuILx.js} +1 -1
- package/dist/app/assets/{graph-wLpqxdfC.js → graph-D-X2uhF1.js} +1 -1
- package/dist/app/assets/{graphql-D-ZoQblr.js → graphql-Clt8HaZ7.js} +1 -1
- package/dist/app/assets/{groovy-CHjkA2bW.js → groovy-CZSeQO36.js} +1 -1
- package/dist/app/assets/{haml-ghcX4l2W.js → haml-DMf7PiKp.js} +1 -1
- package/dist/app/assets/{handlebars-x0LtkeUm.js → handlebars-BphhMxT6.js} +1 -1
- package/dist/app/assets/{haskell-B-bDSuV-.js → haskell-Ccj1mGN_.js} +1 -1
- package/dist/app/assets/{haxe-Vm5mZw57.js → haxe-CtvRdMmt.js} +1 -1
- package/dist/app/assets/{hcl-CGN3jDav.js → hcl-HQGsM91R.js} +1 -1
- package/dist/app/assets/{hlsl-DMKySN6W.js → hlsl-U_2FN4GV.js} +1 -1
- package/dist/app/assets/{hoon-3jplpPAg.js → hoon-DSS3mQR5.js} +1 -1
- package/dist/app/assets/{hpkp-DMJ5jXpf.js → hpkp-BPnzFZ5n.js} +1 -1
- package/dist/app/assets/{hsts-CKBkWb38.js → hsts-BRaWTgmx.js} +1 -1
- package/dist/app/assets/{http-97sq51fE.js → http-DgZif8XP.js} +1 -1
- package/dist/app/assets/{ichigojam-CZ6nOPE1.js → ichigojam-ypramSfH.js} +1 -1
- package/dist/app/assets/{icon-CDqvp1g4.js → icon-DsD0Czia.js} +1 -1
- package/dist/app/assets/{icu-message-format-BjYuZ-Om.js → icu-message-format-BVJiYPkB.js} +1 -1
- package/dist/app/assets/{idris-pEOqm1H_.js → idris-BvurrLkY.js} +1 -1
- package/dist/app/assets/{iecst-CRrTHf_1.js → iecst-Clwdf_8K.js} +1 -1
- package/dist/app/assets/{ignore-CxkUxQmB.js → ignore-DkK-S7HP.js} +1 -1
- package/dist/app/assets/{index-n0Xlprbh.js → index-D-y0b7ri.js} +179 -179
- package/dist/app/assets/index-D4gddvdJ.css +1 -0
- package/dist/app/assets/{infoDiagram-42DDH7IO-C8jVtFvE.js → infoDiagram-42DDH7IO-BocjJZwC.js} +1 -1
- package/dist/app/assets/{inform7-CJDC1PVH.js → inform7-yFSTqWIe.js} +1 -1
- package/dist/app/assets/{ini-BP8l3Q_m.js → ini-BcO8nYi7.js} +1 -1
- package/dist/app/assets/{io-L3Lj4xsH.js → io-BBkn-xXo.js} +1 -1
- package/dist/app/assets/{ishikawaDiagram-UXIWVN3A-BCChdzZf.js → ishikawaDiagram-UXIWVN3A-Dlw93ArC.js} +1 -1
- package/dist/app/assets/{j-BkUK2Ldb.js → j-M5UTfImQ.js} +1 -1
- package/dist/app/assets/{java-lKbQcHmi.js → java-Xjo5k22g.js} +1 -1
- package/dist/app/assets/{javadoc-CkX_P5bm.js → javadoc-D6lpCK4S.js} +1 -1
- package/dist/app/assets/{javadoclike-DKo0tRDk.js → javadoclike-DGBCsKaU.js} +1 -1
- package/dist/app/assets/{javascript-JBI-h3GD.js → javascript-DkE8xAaV.js} +1 -1
- package/dist/app/assets/{javastacktrace-DuXSjAnS.js → javastacktrace-Be5zC165.js} +1 -1
- package/dist/app/assets/{jexl-txJd9uA8.js → jexl-C1l-HPYI.js} +1 -1
- package/dist/app/assets/{jolie-BHXVY7fU.js → jolie-CRI76P3X.js} +1 -1
- package/dist/app/assets/{journeyDiagram-VCZTEJTY-DgqozfYW.js → journeyDiagram-VCZTEJTY-BOongVs3.js} +1 -1
- package/dist/app/assets/{jq-Csyhu6Mu.js → jq-CrFpn7ql.js} +1 -1
- package/dist/app/assets/{js-extras-hN_zFrKs.js → js-extras-BvLZUIJ5.js} +1 -1
- package/dist/app/assets/{js-templates-CKV7gOwt.js → js-templates-fYKII4Os.js} +1 -1
- package/dist/app/assets/{jsdoc-DvQtkqGY.js → jsdoc-DGONDzA5.js} +1 -1
- package/dist/app/assets/{json-BWJc5nIm.js → json-BxIxewuG.js} +1 -1
- package/dist/app/assets/{json5-SIZfmxdY.js → json5-BP9OBqRe.js} +1 -1
- package/dist/app/assets/{jsonp-BCZTSaV5.js → jsonp-Br67zaRL.js} +1 -1
- package/dist/app/assets/{jsstacktrace-gzJEwbAz.js → jsstacktrace-BB-1Bcpa.js} +1 -1
- package/dist/app/assets/{jsx-CjDjGsx0.js → jsx-BNfIlN8n.js} +1 -1
- package/dist/app/assets/{julia-D7oaevR9.js → julia-DVIi4XSJ.js} +1 -1
- package/dist/app/assets/{kanban-definition-6JOO6SKY-IxcIrcgX.js → kanban-definition-6JOO6SKY-DD7E-Llo.js} +1 -1
- package/dist/app/assets/{keepalived-Cd4E72kG.js → keepalived-DmPJ3LF8.js} +1 -1
- package/dist/app/assets/{keyman-CnnhX5FN.js → keyman-Cp-gCfcq.js} +1 -1
- package/dist/app/assets/{kotlin-Bb9joIt9.js → kotlin-DCptm4kq.js} +1 -1
- package/dist/app/assets/{kumir-2AUUqPdZ.js → kumir-Cohjvjog.js} +1 -1
- package/dist/app/assets/{kusto-BYT2Y4Ec.js → kusto-C2dOIgK1.js} +1 -1
- package/dist/app/assets/{latex-C7vJjHLG.js → latex-DaFCffTw.js} +1 -1
- package/dist/app/assets/{latte-B40IhbBN.js → latte-D2mtlTen.js} +1 -1
- package/dist/app/assets/{layout-JYzSZ2a2.js → layout-C7fpWjpB.js} +1 -1
- package/dist/app/assets/{less-CfVevww_.js → less-CycfawGH.js} +1 -1
- package/dist/app/assets/{lilypond-Car5OZdt.js → lilypond-DrvS8AAl.js} +1 -1
- package/dist/app/assets/{linear-C52-vlD3.js → linear-2np4qyjJ.js} +1 -1
- package/dist/app/assets/{liquid-B5H1JE3W.js → liquid-BQH0bAHC.js} +1 -1
- package/dist/app/assets/{lisp-CzR77rD6.js → lisp-BCWvn2A1.js} +1 -1
- package/dist/app/assets/{livescript-DaurQsHd.js → livescript-DGRf3L1-.js} +1 -1
- package/dist/app/assets/{llvm-HQsMJlhb.js → llvm-C_6xvGBO.js} +1 -1
- package/dist/app/assets/{log-p-v4zt5b.js → log-uCcZN8k2.js} +1 -1
- package/dist/app/assets/{lolcode-BUEwX00W.js → lolcode-XEyTNgnB.js} +1 -1
- package/dist/app/assets/{lua-BMmOVEjM.js → lua-Dy0fpGeF.js} +1 -1
- package/dist/app/assets/{magma-B8nyW6y4.js → magma-D6d2r_W9.js} +1 -1
- package/dist/app/assets/{makefile-DcXOWSLr.js → makefile-DOydYPAQ.js} +1 -1
- package/dist/app/assets/{markdown-DLWYEU3e.js → markdown-CPxRHFza.js} +1 -1
- package/dist/app/assets/{markup-jsuSUme0.js → markup-jgYp2Lb8.js} +1 -1
- package/dist/app/assets/{markup-templating-Dm7qXJKw.js → markup-templating-lT8EutTe.js} +1 -1
- package/dist/app/assets/{matlab-C0-FOdqd.js → matlab-y_OOgSc_.js} +1 -1
- package/dist/app/assets/{maxscript-Cfo0XQkR.js → maxscript-PMli6_xE.js} +1 -1
- package/dist/app/assets/{mel-DOCIJjQg.js → mel-CIopQCOU.js} +1 -1
- package/dist/app/assets/{mermaid-BflTtQG8.js → mermaid-CN6aoo9D.js} +1 -1
- package/dist/app/assets/{min-C1ji-XBz.js → min-DDl12nhy.js} +1 -1
- package/dist/app/assets/{mindmap-definition-QFDTVHPH-B5ikGBES.js → mindmap-definition-QFDTVHPH-Bosd0mf9.js} +1 -1
- package/dist/app/assets/{mizar-Bts2s8Hn.js → mizar-A9B8KORd.js} +1 -1
- package/dist/app/assets/{mongodb-DQXudfKX.js → mongodb-DV-yCsoK.js} +1 -1
- package/dist/app/assets/{monkey-DrRHqOn1.js → monkey-HEFodtZa.js} +1 -1
- package/dist/app/assets/{moonscript-C7Xd-yhU.js → moonscript-Bj3xAxEV.js} +1 -1
- package/dist/app/assets/{n1ql-B_wltsIt.js → n1ql-DX2KWloB.js} +1 -1
- package/dist/app/assets/{n4js-BzoEPRsS.js → n4js-DQoNqDS9.js} +1 -1
- package/dist/app/assets/{nand2tetris-hdl-DC6szN4I.js → nand2tetris-hdl-BFqj7ePK.js} +1 -1
- package/dist/app/assets/{naniscript-Dtp-YV0U.js → naniscript-Cz--o1by.js} +1 -1
- package/dist/app/assets/{nasm-0VzUWfWE.js → nasm-Dcb8t8q6.js} +1 -1
- package/dist/app/assets/{neon-7L9mJ622.js → neon-CK7vx6_x.js} +1 -1
- package/dist/app/assets/{nevod-_UYv_FLm.js → nevod-BePMNPK5.js} +1 -1
- package/dist/app/assets/{nginx-DjVc7ZO-.js → nginx-BmbGx2v1.js} +1 -1
- package/dist/app/assets/{nim-DLWLAJSB.js → nim-B8GUCE2H.js} +1 -1
- package/dist/app/assets/{nix-Biu8zxbr.js → nix-lGZ9zLZy.js} +1 -1
- package/dist/app/assets/{nsis-dCQyknmT.js → nsis-kBAOh3Cs.js} +1 -1
- package/dist/app/assets/{objectivec-CSM9DCwb.js → objectivec-Bngj8IHt.js} +1 -1
- package/dist/app/assets/{ocaml-CH0AuJ_r.js → ocaml-Bba8eOIn.js} +1 -1
- package/dist/app/assets/{opencl-JabGmje3.js → opencl-DgfdBrQ_.js} +1 -1
- package/dist/app/assets/{openqasm-BGt4V7bR.js → openqasm-CQV2wxlC.js} +1 -1
- package/dist/app/assets/{oz-DbIu1th5.js → oz-CcMDAMF8.js} +1 -1
- package/dist/app/assets/{parigp-xeAu0pqa.js → parigp-Cr7bHjhJ.js} +1 -1
- package/dist/app/assets/{parser-BWTLDUYa.js → parser-DX-CvQ44.js} +1 -1
- package/dist/app/assets/{pascal-D17KeDTg.js → pascal-CCpiRTqn.js} +1 -1
- package/dist/app/assets/{pascaligo-D2OO9Rgu.js → pascaligo-uYvOwN6J.js} +1 -1
- package/dist/app/assets/{pcaxis-BcB430lz.js → pcaxis-dCoAlH4q.js} +1 -1
- package/dist/app/assets/{peoplecode-Y2S6Vb55.js → peoplecode-BZU0iRIF.js} +1 -1
- package/dist/app/assets/{perl-DS-n0m7F.js → perl-Iesy2DKz.js} +1 -1
- package/dist/app/assets/{php--G5fMCND.js → php-a3Z68PaM.js} +1 -1
- package/dist/app/assets/{php-extras-CaqAl_Dh.js → php-extras-CSgWIoUx.js} +1 -1
- package/dist/app/assets/{phpdoc-DLIcyuW1.js → phpdoc-ClEamK9m.js} +1 -1
- package/dist/app/assets/{pieDiagram-DEJITSTG-BhkQtnMG.js → pieDiagram-DEJITSTG-D3AaN8D3.js} +1 -1
- package/dist/app/assets/{plsql-Fq8oOWwI.js → plsql-BUydR2je.js} +1 -1
- package/dist/app/assets/{powerquery-CeNFj3PH.js → powerquery-CbE5r1LK.js} +1 -1
- package/dist/app/assets/{powershell-DX9U9N7r.js → powershell-DubIcaqQ.js} +1 -1
- package/dist/app/assets/{processing-DkdV2LdA.js → processing-CGZk9MFa.js} +1 -1
- package/dist/app/assets/{prolog-BQyE7F2m.js → prolog-DWiKE05T.js} +1 -1
- package/dist/app/assets/{promql-CO35w8Xd.js → promql-ZM0X0cVe.js} +1 -1
- package/dist/app/assets/{properties-CD226fdu.js → properties-C_MgCVL7.js} +1 -1
- package/dist/app/assets/{protobuf-D44q9Zcx.js → protobuf-DTptx08I.js} +1 -1
- package/dist/app/assets/{psl-BKaJpoBk.js → psl-AUkZATpo.js} +1 -1
- package/dist/app/assets/{pug-DXId-Es4.js → pug-CiJR0sLM.js} +1 -1
- package/dist/app/assets/{puppet-B6U3R2i1.js → puppet-DRojzo7w.js} +1 -1
- package/dist/app/assets/{pure-C6n52fSg.js → pure-DAC784GG.js} +1 -1
- package/dist/app/assets/{purebasic-BSRzkysO.js → purebasic-VM4UEIrk.js} +1 -1
- package/dist/app/assets/{purescript-ac4_QHhP.js → purescript-w5sMhquf.js} +1 -1
- package/dist/app/assets/{q-n7P06m3R.js → q-CBWya0ez.js} +1 -1
- package/dist/app/assets/{qml-Bsb9t-6f.js → qml-BO1SKCTG.js} +1 -1
- package/dist/app/assets/{qore-BY0sM7Wa.js → qore-BLEy3V2Q.js} +1 -1
- package/dist/app/assets/{qsharp-DwMCUEEj.js → qsharp-DpGm5nXm.js} +1 -1
- package/dist/app/assets/{quadrantDiagram-34T5L4WZ-BciQCjKx.js → quadrantDiagram-34T5L4WZ-zqVJRfM0.js} +1 -1
- package/dist/app/assets/{r-wuXzKN8w.js → r-DJwW4woE.js} +1 -1
- package/dist/app/assets/{racket-EWJYOBhv.js → racket-tfAlhm9J.js} +1 -1
- package/dist/app/assets/{reason-b1aTIbDw.js → reason-CuQcs6Us.js} +1 -1
- package/dist/app/assets/{regex-BT-NVms-.js → regex-BjBaDCpX.js} +1 -1
- package/dist/app/assets/{rego-BkXfmH_T.js → rego-DWENKceX.js} +1 -1
- package/dist/app/assets/{renpy-CWSfrITs.js → renpy-BgVqATTk.js} +1 -1
- package/dist/app/assets/{requirementDiagram-MS252O5E-Bw_GMi8G.js → requirementDiagram-MS252O5E-B8E8SJly.js} +1 -1
- package/dist/app/assets/{rest-CSIS2oaI.js → rest-B9oIUmDJ.js} +1 -1
- package/dist/app/assets/{rip-DA5e5rbA.js → rip-kd5zQPVz.js} +1 -1
- package/dist/app/assets/{roboconf-CGLShPJZ.js → roboconf-B1kUkQdY.js} +1 -1
- package/dist/app/assets/{robotframework-AuJ8NHH8.js → robotframework-B8Cn6zw0.js} +1 -1
- package/dist/app/assets/{ruby-Dmo3oqYL.js → ruby-CnbgIhf_.js} +1 -1
- package/dist/app/assets/{rust-Yh4xDsPl.js → rust-C8OTkz5t.js} +1 -1
- package/dist/app/assets/{sankeyDiagram-XADWPNL6-CwpL5Ag9.js → sankeyDiagram-XADWPNL6-BWdy5fPK.js} +1 -1
- package/dist/app/assets/{sas-BajPfouh.js → sas-Dw7vQpkk.js} +1 -1
- package/dist/app/assets/{sass-BZ3IyTf0.js → sass-b7SoCESY.js} +1 -1
- package/dist/app/assets/{scala-BJGdd8vd.js → scala-D-p3rZbv.js} +1 -1
- package/dist/app/assets/{scheme-tmXEra4U.js → scheme-BPbr0IV_.js} +1 -1
- package/dist/app/assets/{scss-Dz5CBs5F.js → scss-Cyjt-V6Q.js} +1 -1
- package/dist/app/assets/{sequenceDiagram-FGHM5R23-Zb9ONvzy.js → sequenceDiagram-FGHM5R23-D-ACA62M.js} +1 -1
- package/dist/app/assets/{shell-session-U_ooQzX-.js → shell-session-C7s1XZ_p.js} +1 -1
- package/dist/app/assets/{smali-DMhdPO_F.js → smali-C621-SJz.js} +1 -1
- package/dist/app/assets/{smalltalk-CtwqxdOy.js → smalltalk-CuF0kpcz.js} +1 -1
- package/dist/app/assets/{smarty-B-_Ggfpm.js → smarty-CHbvlN7a.js} +1 -1
- package/dist/app/assets/{sml-Bvj3KzUv.js → sml-BGi33Pu0.js} +1 -1
- package/dist/app/assets/{solidity-CRfpXCnL.js → solidity-CZYdcu6z.js} +1 -1
- package/dist/app/assets/{solution-file-CYfvOj9X.js → solution-file-ChgVI9u6.js} +1 -1
- package/dist/app/assets/{soy-DoUU5YOQ.js → soy-CWvn9QzG.js} +1 -1
- package/dist/app/assets/{sparql-BRk34Rn9.js → sparql-7JjN18LQ.js} +1 -1
- package/dist/app/assets/{splunk-spl-C5FnseSI.js → splunk-spl-DOh97vYU.js} +1 -1
- package/dist/app/assets/{sqf-BeyFDkm3.js → sqf-x5ivlIR7.js} +1 -1
- package/dist/app/assets/{sql-D-HqwAd-.js → sql-BshsXXbk.js} +1 -1
- package/dist/app/assets/{squirrel-cZQ0YNSS.js → squirrel-BtrGPSbs.js} +1 -1
- package/dist/app/assets/{stan-zqHKC64S.js → stan-sDuPYbZs.js} +1 -1
- package/dist/app/assets/{stateDiagram-FHFEXIEX-CyoWPE1S.js → stateDiagram-FHFEXIEX-C06KYdye.js} +1 -1
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-sEMQqWl2.js +1 -0
- package/dist/app/assets/{stylus-jeXHFpb6.js → stylus-9qu1XZ91.js} +1 -1
- package/dist/app/assets/{swift-DD5qP3LK.js → swift-UgAKrg8O.js} +1 -1
- package/dist/app/assets/{systemd-dyYpUoVh.js → systemd-D1t2IK6h.js} +1 -1
- package/dist/app/assets/{t4-cs-DdzwIItd.js → t4-cs-D5pPXmrn.js} +1 -1
- package/dist/app/assets/{t4-templating-7MUBL1iq.js → t4-templating-DGpA7dEe.js} +1 -1
- package/dist/app/assets/{t4-vb-WExQNH7h.js → t4-vb-DeaFY-L7.js} +1 -1
- package/dist/app/assets/{tap-BK66GXcT.js → tap-B2Jlbmzn.js} +1 -1
- package/dist/app/assets/{tcl-CX-Ne5lF.js → tcl-D3Cxl9RS.js} +1 -1
- package/dist/app/assets/{textile-ByimrlEC.js → textile-vleyTozU.js} +1 -1
- package/dist/app/assets/{timeline-definition-GMOUNBTQ-uUI7-tyD.js → timeline-definition-GMOUNBTQ-DSaRfuOY.js} +1 -1
- package/dist/app/assets/{toml-BLYx3Nck.js → toml-Qo-F6Xf4.js} +1 -1
- package/dist/app/assets/{tremor-18nu0iOH.js → tremor-J5ixbTSm.js} +1 -1
- package/dist/app/assets/{tt2-bzqhHd_O.js → tt2-DOa_Af-o.js} +1 -1
- package/dist/app/assets/{turtle-Cjm_9khs.js → turtle-D8Su1Ry0.js} +1 -1
- package/dist/app/assets/{twig-D0iQcF_6.js → twig-GBJoDW8g.js} +1 -1
- package/dist/app/assets/{typescript-2OfP3mlH.js → typescript-DimFy1wk.js} +1 -1
- package/dist/app/assets/{typoscript-BsOytkAv.js → typoscript-Corm9VPj.js} +1 -1
- package/dist/app/assets/{unrealscript-BWxPoPCn.js → unrealscript-dSS5kIDz.js} +1 -1
- package/dist/app/assets/{uorazor-CscffpjI.js → uorazor-BGl4DTbK.js} +1 -1
- package/dist/app/assets/{uri-DoCyUAH6.js → uri-B403JigU.js} +1 -1
- package/dist/app/assets/{v-BTNlJKoZ.js → v-D1nzy8SK.js} +1 -1
- package/dist/app/assets/{vala-DiIqhFLn.js → vala-CbskSA-6.js} +1 -1
- package/dist/app/assets/{vbnet-CBoOr9B0.js → vbnet-BQwFvsFF.js} +1 -1
- package/dist/app/assets/{velocity-X1I_pFrR.js → velocity-dmmAE00U.js} +1 -1
- package/dist/app/assets/{vennDiagram-DHZGUBPP-B-52fvBA.js → vennDiagram-DHZGUBPP-BZ7Hb9Hn.js} +1 -1
- package/dist/app/assets/{verilog-LAXVYlck.js → verilog-BMPc4qiW.js} +1 -1
- package/dist/app/assets/{vhdl-CXjkeBYt.js → vhdl-BwLIiaQ3.js} +1 -1
- package/dist/app/assets/{vim-prtu90pQ.js → vim-NxGSno01.js} +1 -1
- package/dist/app/assets/{visual-basic-B3Hd0Gdb.js → visual-basic-DT3do2iL.js} +1 -1
- package/dist/app/assets/{wardley-RL74JXVD-BZVhJWb7.js → wardley-RL74JXVD-BQuDsmFg.js} +1 -1
- package/dist/app/assets/{wardleyDiagram-NUSXRM2D-Cm0ghnek.js → wardleyDiagram-NUSXRM2D-DwMCEfDA.js} +1 -1
- package/dist/app/assets/{warpscript-0VPXBfCe.js → warpscript-natO4zPn.js} +1 -1
- package/dist/app/assets/{wasm-6RzyTp2Y.js → wasm-BfugFzDn.js} +1 -1
- package/dist/app/assets/{web-idl-rCsaK0nr.js → web-idl-Bics_ax6.js} +1 -1
- package/dist/app/assets/{wiki-FlEbAGMc.js → wiki-Blq646qq.js} +1 -1
- package/dist/app/assets/{wolfram-DFlSzi0Z.js → wolfram-Ddn6uV9M.js} +1 -1
- package/dist/app/assets/{wren-CRHW6GG3.js → wren-CZ9gfbdr.js} +1 -1
- package/dist/app/assets/{xeora-BcvzW0pz.js → xeora-zVJDHWYP.js} +1 -1
- package/dist/app/assets/{xml-doc-DzJzyzOc.js → xml-doc-D9g-q5Fh.js} +1 -1
- package/dist/app/assets/{xojo-CX4Uo-V_.js → xojo-WpdjfLKR.js} +1 -1
- package/dist/app/assets/{xquery-Cm_nyuyl.js → xquery-DFrusbUY.js} +1 -1
- package/dist/app/assets/{xychartDiagram-5P7HB3ND-CeOBdBC2.js → xychartDiagram-5P7HB3ND-BRMmacnH.js} +1 -1
- package/dist/app/assets/{yaml-zn_2tPBx.js → yaml-DB6og7ei.js} +1 -1
- package/dist/app/assets/{yang-9OrfznQV.js → yang-CdFoUEPj.js} +1 -1
- package/dist/app/assets/{zig-DwTTGKoo.js → zig-C79X6U04.js} +1 -1
- package/dist/app/index.html +2 -2
- package/dist/index.cjs +1893 -746
- package/dist/index.js +1870 -708
- package/package.json +2 -2
- package/dist/app/assets/channel-Ocy9uBDH.js +0 -1
- package/dist/app/assets/classDiagram-6PBFFD2Q-DPVg45WL.js +0 -1
- package/dist/app/assets/classDiagram-v2-HSJHXN6E-DPVg45WL.js +0 -1
- package/dist/app/assets/clone-AdHtfCx4.js +0 -1
- package/dist/app/assets/index-Cb5pIUJX.css +0 -1
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-3eYSeZ9d.js +0 -1
package/dist/index.cjs
CHANGED
|
@@ -67,8 +67,8 @@ __export(index_exports, {
|
|
|
67
67
|
module.exports = __toCommonJS(index_exports);
|
|
68
68
|
|
|
69
69
|
// src/components/chat.tsx
|
|
70
|
-
var
|
|
71
|
-
var
|
|
70
|
+
var React44 = __toESM(require("react"), 1);
|
|
71
|
+
var import_lucide_react24 = require("lucide-react");
|
|
72
72
|
|
|
73
73
|
// src/lib/utils.ts
|
|
74
74
|
var import_clsx = require("clsx");
|
|
@@ -192,7 +192,25 @@ var import_react3 = require("react");
|
|
|
192
192
|
var import_nuqs = require("nuqs");
|
|
193
193
|
var import_xpert_sdk = require("@xpert-ai/xpert-sdk");
|
|
194
194
|
var import_tool = require("@langchain/core/messages/tool");
|
|
195
|
-
var
|
|
195
|
+
var import_chatkit_types5 = require("@xpert-ai/chatkit-types");
|
|
196
|
+
|
|
197
|
+
// src/lib/agent-runs.ts
|
|
198
|
+
var import_chatkit_types = require("@xpert-ai/chatkit-types");
|
|
199
|
+
function isAgentEventContent(content) {
|
|
200
|
+
return content.type === "agent_event";
|
|
201
|
+
}
|
|
202
|
+
function readContentExecutionId(content) {
|
|
203
|
+
if (!content || typeof content === "string") return void 0;
|
|
204
|
+
return typeof content.executionId === "string" && content.executionId.trim() ? content.executionId.trim() : void 0;
|
|
205
|
+
}
|
|
206
|
+
function readContentParentExecutionId(content) {
|
|
207
|
+
if (!content || typeof content === "string") return void 0;
|
|
208
|
+
return typeof content.parentExecutionId === "string" && content.parentExecutionId.trim() ? content.parentExecutionId.trim() : void 0;
|
|
209
|
+
}
|
|
210
|
+
function readContentAgentKey(content) {
|
|
211
|
+
if (!content || typeof content === "string") return void 0;
|
|
212
|
+
return typeof content.agentKey === "string" && content.agentKey.trim() ? content.agentKey.trim() : void 0;
|
|
213
|
+
}
|
|
196
214
|
|
|
197
215
|
// src/lib/api-config.ts
|
|
198
216
|
function hasConfiguredValue(value) {
|
|
@@ -214,12 +232,12 @@ function getMissingApiConfigurationKind({
|
|
|
214
232
|
}
|
|
215
233
|
|
|
216
234
|
// src/lib/request-options.ts
|
|
217
|
-
var
|
|
235
|
+
var import_chatkit_types2 = require("@xpert-ai/chatkit-types");
|
|
218
236
|
function isRecord(value) {
|
|
219
237
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
220
238
|
}
|
|
221
239
|
function resolveHumanStateValue(value) {
|
|
222
|
-
const human = value?.[
|
|
240
|
+
const human = value?.[import_chatkit_types2.STATE_VARIABLE_HUMAN];
|
|
223
241
|
return isRecord(human) ? human : {};
|
|
224
242
|
}
|
|
225
243
|
function splitEnvCarrier(value) {
|
|
@@ -279,7 +297,7 @@ function buildInjectedRequestOptions(input) {
|
|
|
279
297
|
...input.humanInput ?? {}
|
|
280
298
|
};
|
|
281
299
|
if (Object.keys(mergedHumanState).length > 0) {
|
|
282
|
-
mergedState[
|
|
300
|
+
mergedState[import_chatkit_types2.STATE_VARIABLE_HUMAN] = mergedHumanState;
|
|
283
301
|
}
|
|
284
302
|
const hasState = Object.keys(mergedState).length > 0;
|
|
285
303
|
return {
|
|
@@ -294,7 +312,7 @@ var import_react2 = require("react");
|
|
|
294
312
|
|
|
295
313
|
// src/providers/ParentMessenger.tsx
|
|
296
314
|
var import_react = require("react");
|
|
297
|
-
var
|
|
315
|
+
var import_chatkit_types4 = require("@xpert-ai/chatkit-types");
|
|
298
316
|
|
|
299
317
|
// src/hooks/useStream.ts
|
|
300
318
|
var streamRef = { current: null };
|
|
@@ -309,7 +327,7 @@ function useStreamManager() {
|
|
|
309
327
|
}
|
|
310
328
|
|
|
311
329
|
// src/lib/message-metadata.ts
|
|
312
|
-
var
|
|
330
|
+
var import_chatkit_types3 = require("@xpert-ai/chatkit-types");
|
|
313
331
|
|
|
314
332
|
// src/lib/references.ts
|
|
315
333
|
function isObjectLike(value) {
|
|
@@ -737,11 +755,11 @@ function ParentMessengerProvider({
|
|
|
737
755
|
handledSendUserMessageEvents.add(event);
|
|
738
756
|
}
|
|
739
757
|
const params = payload.data;
|
|
740
|
-
const prompt = typeof params.text === "string" ? params.text.trim() : typeof params.state?.[
|
|
758
|
+
const prompt = typeof params.text === "string" ? params.text.trim() : typeof params.state?.[import_chatkit_types4.STATE_VARIABLE_HUMAN]?.input === "string" ? params.state[import_chatkit_types4.STATE_VARIABLE_HUMAN].input.trim() : "";
|
|
741
759
|
const references = normalizeReferences(
|
|
742
|
-
params.references ?? params.state?.[
|
|
760
|
+
params.references ?? params.state?.[import_chatkit_types4.STATE_VARIABLE_HUMAN]?.references
|
|
743
761
|
);
|
|
744
|
-
const referenceComposition = params.referenceComposition ?? params.state?.[
|
|
762
|
+
const referenceComposition = params.referenceComposition ?? params.state?.[import_chatkit_types4.STATE_VARIABLE_HUMAN]?.referenceComposition;
|
|
745
763
|
const humanInput = buildHumanMessageInputPayload({
|
|
746
764
|
content: prompt,
|
|
747
765
|
references,
|
|
@@ -753,13 +771,13 @@ function ParentMessengerProvider({
|
|
|
753
771
|
}
|
|
754
772
|
return;
|
|
755
773
|
}
|
|
756
|
-
const runtimeCapabilitiesCandidate = params.runtimeCapabilities ?? params.state?.[
|
|
774
|
+
const runtimeCapabilitiesCandidate = params.runtimeCapabilities ?? params.state?.[import_chatkit_types4.STATE_VARIABLE_HUMAN]?.runtimeCapabilities;
|
|
757
775
|
const runtimeCapabilities = isRuntimeCapabilitiesSelection(
|
|
758
776
|
runtimeCapabilitiesCandidate
|
|
759
777
|
) ? runtimeCapabilitiesCandidate : void 0;
|
|
760
|
-
const requestHumanInput = params.planMode === true || params.state?.[
|
|
778
|
+
const requestHumanInput = params.planMode === true || params.state?.[import_chatkit_types4.STATE_VARIABLE_HUMAN]?.planMode === true || runtimeCapabilities ? {
|
|
761
779
|
...humanInput,
|
|
762
|
-
...params.planMode === true || params.state?.[
|
|
780
|
+
...params.planMode === true || params.state?.[import_chatkit_types4.STATE_VARIABLE_HUMAN]?.planMode === true ? { planMode: true } : {},
|
|
763
781
|
...runtimeCapabilities ? { runtimeCapabilities } : {}
|
|
764
782
|
} : humanInput;
|
|
765
783
|
const newMessage = {
|
|
@@ -1500,6 +1518,45 @@ var en_US_default = {
|
|
|
1500
1518
|
option: "Option",
|
|
1501
1519
|
other: "Other"
|
|
1502
1520
|
},
|
|
1521
|
+
knowledgeRetriever: {
|
|
1522
|
+
queryTitle: "Query",
|
|
1523
|
+
resultsTitle: "Retrieved results ({{count}})",
|
|
1524
|
+
rawDataTitle: "Raw data",
|
|
1525
|
+
noResults: "No knowledge results found",
|
|
1526
|
+
scoreLabel: "Score"
|
|
1527
|
+
},
|
|
1528
|
+
agentRun: {
|
|
1529
|
+
defaultTitle: "Sub-agent",
|
|
1530
|
+
inputLabel: "Input",
|
|
1531
|
+
errorLabel: "Error",
|
|
1532
|
+
status: {
|
|
1533
|
+
running: "Running",
|
|
1534
|
+
success: "Done",
|
|
1535
|
+
error: "Error",
|
|
1536
|
+
replied: "Replied",
|
|
1537
|
+
pending: "Pending",
|
|
1538
|
+
interrupted: "Interrupted",
|
|
1539
|
+
timeout: "Timed out"
|
|
1540
|
+
},
|
|
1541
|
+
counts: {
|
|
1542
|
+
messages: {
|
|
1543
|
+
one: "{{count}} message",
|
|
1544
|
+
other: "{{count}} messages"
|
|
1545
|
+
},
|
|
1546
|
+
tools: {
|
|
1547
|
+
one: "{{count}} tool",
|
|
1548
|
+
other: "{{count}} tools"
|
|
1549
|
+
},
|
|
1550
|
+
events: {
|
|
1551
|
+
one: "{{count}} event",
|
|
1552
|
+
other: "{{count}} events"
|
|
1553
|
+
},
|
|
1554
|
+
children: {
|
|
1555
|
+
one: "{{count}} child agent",
|
|
1556
|
+
other: "{{count}} child agents"
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
},
|
|
1503
1560
|
toolGroup: {
|
|
1504
1561
|
status: {
|
|
1505
1562
|
running: "Processing",
|
|
@@ -1512,6 +1569,7 @@ var en_US_default = {
|
|
|
1512
1569
|
jsonTitle: "JSON",
|
|
1513
1570
|
jsonTree: "Tree",
|
|
1514
1571
|
jsonRaw: "Raw",
|
|
1572
|
+
sourcesTitle: "Sources",
|
|
1515
1573
|
copy: "Copy",
|
|
1516
1574
|
copied: "Copied",
|
|
1517
1575
|
separator: ", ",
|
|
@@ -1792,6 +1850,45 @@ var zh_CN_default = {
|
|
|
1792
1850
|
option: "\u9009\u9879",
|
|
1793
1851
|
other: "\u5176\u4ED6"
|
|
1794
1852
|
},
|
|
1853
|
+
knowledgeRetriever: {
|
|
1854
|
+
queryTitle: "\u67E5\u8BE2",
|
|
1855
|
+
resultsTitle: "\u68C0\u7D22\u7ED3\u679C\uFF08{{count}}\uFF09",
|
|
1856
|
+
rawDataTitle: "\u539F\u59CB\u6570\u636E",
|
|
1857
|
+
noResults: "\u672A\u627E\u5230\u77E5\u8BC6\u7ED3\u679C",
|
|
1858
|
+
scoreLabel: "\u5206\u6570"
|
|
1859
|
+
},
|
|
1860
|
+
agentRun: {
|
|
1861
|
+
defaultTitle: "\u5B50\u667A\u80FD\u4F53",
|
|
1862
|
+
inputLabel: "\u8F93\u5165",
|
|
1863
|
+
errorLabel: "\u9519\u8BEF",
|
|
1864
|
+
status: {
|
|
1865
|
+
running: "\u8FD0\u884C\u4E2D",
|
|
1866
|
+
success: "\u5DF2\u5B8C\u6210",
|
|
1867
|
+
error: "\u9519\u8BEF",
|
|
1868
|
+
replied: "\u5DF2\u56DE\u590D",
|
|
1869
|
+
pending: "\u7B49\u5F85\u4E2D",
|
|
1870
|
+
interrupted: "\u5DF2\u4E2D\u65AD",
|
|
1871
|
+
timeout: "\u5DF2\u8D85\u65F6"
|
|
1872
|
+
},
|
|
1873
|
+
counts: {
|
|
1874
|
+
messages: {
|
|
1875
|
+
one: "{{count}} \u6761\u6D88\u606F",
|
|
1876
|
+
other: "{{count}} \u6761\u6D88\u606F"
|
|
1877
|
+
},
|
|
1878
|
+
tools: {
|
|
1879
|
+
one: "{{count}} \u4E2A\u5DE5\u5177",
|
|
1880
|
+
other: "{{count}} \u4E2A\u5DE5\u5177"
|
|
1881
|
+
},
|
|
1882
|
+
events: {
|
|
1883
|
+
one: "{{count}} \u4E2A\u4E8B\u4EF6",
|
|
1884
|
+
other: "{{count}} \u4E2A\u4E8B\u4EF6"
|
|
1885
|
+
},
|
|
1886
|
+
children: {
|
|
1887
|
+
one: "{{count}} \u4E2A\u5B50\u667A\u80FD\u4F53",
|
|
1888
|
+
other: "{{count}} \u4E2A\u5B50\u667A\u80FD\u4F53"
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
},
|
|
1795
1892
|
toolGroup: {
|
|
1796
1893
|
status: {
|
|
1797
1894
|
running: "\u6B63\u5728\u5904\u7406",
|
|
@@ -1804,6 +1901,7 @@ var zh_CN_default = {
|
|
|
1804
1901
|
jsonTitle: "JSON",
|
|
1805
1902
|
jsonTree: "\u6811\u5F62",
|
|
1806
1903
|
jsonRaw: "\u539F\u59CB",
|
|
1904
|
+
sourcesTitle: "\u4FE1\u606F\u6E90",
|
|
1807
1905
|
copy: "\u590D\u5236",
|
|
1808
1906
|
copied: "\u5DF2\u590D\u5236",
|
|
1809
1907
|
separator: "\uFF0C",
|
|
@@ -3436,7 +3534,17 @@ function SlashPalette({
|
|
|
3436
3534
|
}
|
|
3437
3535
|
),
|
|
3438
3536
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "flex min-w-0 flex-1 items-baseline gap-2", children: [
|
|
3439
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.
|
|
3537
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "flex min-w-0 shrink-0 items-baseline gap-1.5", children: [
|
|
3538
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "truncate font-medium", children: option.label }),
|
|
3539
|
+
option.kind === "command" && option.capabilityType && typeof option.childCount === "number" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3540
|
+
"span",
|
|
3541
|
+
{
|
|
3542
|
+
"data-slot": "slash-palette-child-count",
|
|
3543
|
+
className: "inline-flex h-4 min-w-4 shrink-0 items-center justify-center rounded-full bg-muted px-1 text-[10px] font-medium leading-none text-muted-foreground",
|
|
3544
|
+
children: option.childCount
|
|
3545
|
+
}
|
|
3546
|
+
) : null
|
|
3547
|
+
] }),
|
|
3440
3548
|
option.description && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "min-w-0 flex-1 truncate text-muted-foreground", children: option.description })
|
|
3441
3549
|
] }),
|
|
3442
3550
|
option.kind === "command" && option.capabilityType ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-muted-foreground", children: option.expanded ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react5.ChevronDown, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react5.ChevronRight, { size: 14 }) }) : null
|
|
@@ -6072,19 +6180,22 @@ function resolveRuntimeCapabilityPalette(value, selectionStart) {
|
|
|
6072
6180
|
return null;
|
|
6073
6181
|
}
|
|
6074
6182
|
const beforeCaret = value.slice(0, selectionStart);
|
|
6075
|
-
const match = /(^|\s)
|
|
6183
|
+
const match = /(^|\s)([/$])([^\s/]*)$/.exec(beforeCaret);
|
|
6076
6184
|
if (!match) {
|
|
6077
6185
|
return null;
|
|
6078
6186
|
}
|
|
6079
|
-
const
|
|
6187
|
+
const trigger = match[2];
|
|
6188
|
+
const query = match[3] ?? "";
|
|
6080
6189
|
const start = beforeCaret.length - query.length - 1;
|
|
6081
6190
|
const beforeTrigger = beforeCaret.slice(0, start);
|
|
6082
6191
|
return {
|
|
6192
|
+
trigger,
|
|
6083
6193
|
query,
|
|
6084
6194
|
start,
|
|
6085
6195
|
end: selectionStart,
|
|
6086
6196
|
activeIndex: 0,
|
|
6087
|
-
atMessageStart: beforeTrigger.trim().length === 0
|
|
6197
|
+
atMessageStart: beforeTrigger.trim().length === 0,
|
|
6198
|
+
...trigger === "$" ? { capabilityTypes: ["skill"] } : {}
|
|
6088
6199
|
};
|
|
6089
6200
|
}
|
|
6090
6201
|
function matchesQuery(values, query) {
|
|
@@ -6121,7 +6232,11 @@ function matchesCapability(option, query, capabilityTypes) {
|
|
|
6121
6232
|
if (capabilityTypes?.length && !capabilityTypes.includes(option.type)) {
|
|
6122
6233
|
return false;
|
|
6123
6234
|
}
|
|
6124
|
-
|
|
6235
|
+
const skillAliases = option.type === "skill" ? [`$${option.id}`, `$${option.label}`] : [];
|
|
6236
|
+
return matchesQuery(
|
|
6237
|
+
[option.id, option.label, option.description, option.type, ...skillAliases],
|
|
6238
|
+
query
|
|
6239
|
+
);
|
|
6125
6240
|
}
|
|
6126
6241
|
function getCommandPaletteOption(command) {
|
|
6127
6242
|
const capabilityType = CAPABILITY_GROUP_COMMANDS[command.name];
|
|
@@ -6668,8 +6783,279 @@ function useSlashCommands({
|
|
|
6668
6783
|
}
|
|
6669
6784
|
|
|
6670
6785
|
// src/components/thread/messages/ai.tsx
|
|
6671
|
-
var
|
|
6672
|
-
var
|
|
6786
|
+
var React31 = __toESM(require("react"), 1);
|
|
6787
|
+
var import_lucide_react19 = require("lucide-react");
|
|
6788
|
+
|
|
6789
|
+
// src/lib/agent-run-render-tree.ts
|
|
6790
|
+
function isTextContent(content) {
|
|
6791
|
+
return content.type === "text";
|
|
6792
|
+
}
|
|
6793
|
+
function isReasoningContent(content) {
|
|
6794
|
+
return content.type === "reasoning";
|
|
6795
|
+
}
|
|
6796
|
+
function isComponentContent(content) {
|
|
6797
|
+
return content.type === "component";
|
|
6798
|
+
}
|
|
6799
|
+
function parseDateValue(value) {
|
|
6800
|
+
if (value instanceof Date) {
|
|
6801
|
+
const timestamp2 = value.getTime();
|
|
6802
|
+
return Number.isNaN(timestamp2) ? null : timestamp2;
|
|
6803
|
+
}
|
|
6804
|
+
if (typeof value !== "string") {
|
|
6805
|
+
return null;
|
|
6806
|
+
}
|
|
6807
|
+
const timestamp = Date.parse(value);
|
|
6808
|
+
return Number.isNaN(timestamp) ? null : timestamp;
|
|
6809
|
+
}
|
|
6810
|
+
function readContentTitle(content) {
|
|
6811
|
+
if (typeof content === "string") return void 0;
|
|
6812
|
+
if (typeof content.xpertName === "string" && content.xpertName.trim()) {
|
|
6813
|
+
return content.xpertName.trim();
|
|
6814
|
+
}
|
|
6815
|
+
return void 0;
|
|
6816
|
+
}
|
|
6817
|
+
function readContentStringField(content, field) {
|
|
6818
|
+
if (typeof content === "string") return void 0;
|
|
6819
|
+
const value = content[field];
|
|
6820
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
6821
|
+
}
|
|
6822
|
+
function normalizeRunStatus(status) {
|
|
6823
|
+
return typeof status === "string" && status.trim() ? status.trim().toLowerCase() : "pending";
|
|
6824
|
+
}
|
|
6825
|
+
function isRunningRunStatus(status) {
|
|
6826
|
+
return normalizeRunStatus(status) === "running";
|
|
6827
|
+
}
|
|
6828
|
+
function isFailedRunStatus(status) {
|
|
6829
|
+
const normalized = normalizeRunStatus(status);
|
|
6830
|
+
return normalized === "error" || normalized === "fail" || normalized === "failed";
|
|
6831
|
+
}
|
|
6832
|
+
function hasVisibleAgentRunDetails(info) {
|
|
6833
|
+
return info.error !== void 0;
|
|
6834
|
+
}
|
|
6835
|
+
function getAgentRunTitle(info, fallback) {
|
|
6836
|
+
return info.title?.trim() || info.xpertName?.trim() || info.agentKey?.trim() || fallback || null;
|
|
6837
|
+
}
|
|
6838
|
+
function getAgentRunDuration(info) {
|
|
6839
|
+
if (typeof info.elapsedTime === "number" && Number.isFinite(info.elapsedTime)) {
|
|
6840
|
+
return info.elapsedTime;
|
|
6841
|
+
}
|
|
6842
|
+
const startedAt = parseDateValue(info.startedAt) ?? parseDateValue(info.createdAt);
|
|
6843
|
+
const endedAt = parseDateValue(info.endedAt) ?? parseDateValue(info.updatedAt);
|
|
6844
|
+
if (startedAt === null || endedAt === null) return null;
|
|
6845
|
+
return Math.max(0, endedAt - startedAt);
|
|
6846
|
+
}
|
|
6847
|
+
function getAgentRunCounts(node) {
|
|
6848
|
+
let text = 0;
|
|
6849
|
+
let tools = 0;
|
|
6850
|
+
let events = 0;
|
|
6851
|
+
for (const entry of node.entries) {
|
|
6852
|
+
const item = entry.item;
|
|
6853
|
+
if (typeof item === "string") {
|
|
6854
|
+
if (item.trim()) text += 1;
|
|
6855
|
+
continue;
|
|
6856
|
+
}
|
|
6857
|
+
if (isTextContent(item) || isReasoningContent(item)) {
|
|
6858
|
+
if (item.text?.trim()) text += 1;
|
|
6859
|
+
continue;
|
|
6860
|
+
}
|
|
6861
|
+
if (isComponentContent(item)) {
|
|
6862
|
+
tools += 1;
|
|
6863
|
+
continue;
|
|
6864
|
+
}
|
|
6865
|
+
if (isAgentEventContent(item)) {
|
|
6866
|
+
events += 1;
|
|
6867
|
+
}
|
|
6868
|
+
}
|
|
6869
|
+
return {
|
|
6870
|
+
text,
|
|
6871
|
+
tools,
|
|
6872
|
+
events,
|
|
6873
|
+
children: node.children.length
|
|
6874
|
+
};
|
|
6875
|
+
}
|
|
6876
|
+
function createAgentRunNode(nodes, id, info, order) {
|
|
6877
|
+
const existing = nodes.get(id);
|
|
6878
|
+
if (existing) {
|
|
6879
|
+
existing.info = {
|
|
6880
|
+
...existing.info,
|
|
6881
|
+
...info,
|
|
6882
|
+
id,
|
|
6883
|
+
parentId: info.parentId ?? existing.info.parentId,
|
|
6884
|
+
parentExecutionId: info.parentExecutionId ?? existing.info.parentExecutionId,
|
|
6885
|
+
agentKey: info.agentKey ?? existing.info.agentKey,
|
|
6886
|
+
xpertName: info.xpertName ?? existing.info.xpertName,
|
|
6887
|
+
title: info.title ?? existing.info.title,
|
|
6888
|
+
status: info.status ?? existing.info.status,
|
|
6889
|
+
elapsedTime: info.elapsedTime ?? existing.info.elapsedTime,
|
|
6890
|
+
error: info.error ?? existing.info.error,
|
|
6891
|
+
inputs: info.inputs ?? existing.info.inputs
|
|
6892
|
+
};
|
|
6893
|
+
existing.firstOrder = Math.min(existing.firstOrder, order);
|
|
6894
|
+
return existing;
|
|
6895
|
+
}
|
|
6896
|
+
const node = {
|
|
6897
|
+
id,
|
|
6898
|
+
info: { ...info, id },
|
|
6899
|
+
entries: [],
|
|
6900
|
+
children: [],
|
|
6901
|
+
firstOrder: order
|
|
6902
|
+
};
|
|
6903
|
+
nodes.set(id, node);
|
|
6904
|
+
return node;
|
|
6905
|
+
}
|
|
6906
|
+
function findFallbackRunByAgentKey(runs, agentKey, rootExecutionId) {
|
|
6907
|
+
if (!agentKey) return null;
|
|
6908
|
+
const candidates = runs.filter(
|
|
6909
|
+
(run) => run.agentKey === agentKey && run.id !== rootExecutionId
|
|
6910
|
+
);
|
|
6911
|
+
if (candidates.length === 0) return null;
|
|
6912
|
+
for (let index = candidates.length - 1; index >= 0; index -= 1) {
|
|
6913
|
+
if (isRunningRunStatus(candidates[index].status)) {
|
|
6914
|
+
return candidates[index];
|
|
6915
|
+
}
|
|
6916
|
+
}
|
|
6917
|
+
return candidates[candidates.length - 1];
|
|
6918
|
+
}
|
|
6919
|
+
function getEntryRunTarget(entry, runs, rootExecutionId) {
|
|
6920
|
+
const item = entry.item;
|
|
6921
|
+
const executionId = readContentExecutionId(item);
|
|
6922
|
+
const parentExecutionId = readContentParentExecutionId(item);
|
|
6923
|
+
const agentKey = readContentAgentKey(item);
|
|
6924
|
+
if (executionId) {
|
|
6925
|
+
return {
|
|
6926
|
+
executionId,
|
|
6927
|
+
parentExecutionId,
|
|
6928
|
+
agentKey
|
|
6929
|
+
};
|
|
6930
|
+
}
|
|
6931
|
+
const fallbackRun = findFallbackRunByAgentKey(
|
|
6932
|
+
runs,
|
|
6933
|
+
agentKey,
|
|
6934
|
+
rootExecutionId
|
|
6935
|
+
);
|
|
6936
|
+
if (!fallbackRun) return null;
|
|
6937
|
+
return {
|
|
6938
|
+
executionId: fallbackRun.id,
|
|
6939
|
+
parentExecutionId: fallbackRun.parentId ?? fallbackRun.parentExecutionId,
|
|
6940
|
+
agentKey
|
|
6941
|
+
};
|
|
6942
|
+
}
|
|
6943
|
+
function createInfoFromEntry(id, entry, parentExecutionId) {
|
|
6944
|
+
return {
|
|
6945
|
+
id,
|
|
6946
|
+
...parentExecutionId ? { parentId: parentExecutionId, parentExecutionId } : {},
|
|
6947
|
+
...readContentAgentKey(entry.item) ? { agentKey: readContentAgentKey(entry.item) } : {},
|
|
6948
|
+
...readContentTitle(entry.item) ? { xpertName: readContentTitle(entry.item) } : {},
|
|
6949
|
+
...readContentStringField(entry.item, "runId") ? { runId: readContentStringField(entry.item, "runId") } : {}
|
|
6950
|
+
};
|
|
6951
|
+
}
|
|
6952
|
+
function normalizeAssistantEntries(message) {
|
|
6953
|
+
const entries = [];
|
|
6954
|
+
if (typeof message.content === "string") {
|
|
6955
|
+
if (message.content.trim()) {
|
|
6956
|
+
entries.push({
|
|
6957
|
+
item: message.content,
|
|
6958
|
+
index: 0,
|
|
6959
|
+
source: "content",
|
|
6960
|
+
order: 0
|
|
6961
|
+
});
|
|
6962
|
+
}
|
|
6963
|
+
} else if (Array.isArray(message.content)) {
|
|
6964
|
+
message.content.forEach((item, index) => {
|
|
6965
|
+
entries.push({
|
|
6966
|
+
item,
|
|
6967
|
+
index,
|
|
6968
|
+
source: "content",
|
|
6969
|
+
order: index
|
|
6970
|
+
});
|
|
6971
|
+
});
|
|
6972
|
+
}
|
|
6973
|
+
const contentCount = entries.length;
|
|
6974
|
+
(message.reasoning ?? []).forEach((item, index) => {
|
|
6975
|
+
entries.push({
|
|
6976
|
+
item,
|
|
6977
|
+
index,
|
|
6978
|
+
source: "reasoning",
|
|
6979
|
+
order: contentCount + index
|
|
6980
|
+
});
|
|
6981
|
+
});
|
|
6982
|
+
return entries;
|
|
6983
|
+
}
|
|
6984
|
+
function refreshAgentNodeOrder(node) {
|
|
6985
|
+
let order = node.firstOrder;
|
|
6986
|
+
for (const child of node.children) {
|
|
6987
|
+
order = Math.min(order, refreshAgentNodeOrder(child));
|
|
6988
|
+
}
|
|
6989
|
+
node.firstOrder = order;
|
|
6990
|
+
node.children.sort((a, b) => a.firstOrder - b.firstOrder);
|
|
6991
|
+
return order;
|
|
6992
|
+
}
|
|
6993
|
+
function buildAssistantRenderTree(message) {
|
|
6994
|
+
const rootExecutionId = message.executionId;
|
|
6995
|
+
const runs = message.agentRuns ?? [];
|
|
6996
|
+
const entries = normalizeAssistantEntries(message);
|
|
6997
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
6998
|
+
const rootEntries = [];
|
|
6999
|
+
const rootReasoning = [];
|
|
7000
|
+
const baseOrder = entries.length + 1;
|
|
7001
|
+
runs.forEach((run, index) => {
|
|
7002
|
+
createAgentRunNode(nodes, run.id, run, baseOrder + index / 1e3);
|
|
7003
|
+
});
|
|
7004
|
+
for (const entry of entries) {
|
|
7005
|
+
const target = getEntryRunTarget(entry, runs, rootExecutionId);
|
|
7006
|
+
const shouldGroup = Boolean(target?.executionId) && (target?.executionId !== rootExecutionId || Boolean(target?.parentExecutionId));
|
|
7007
|
+
if (!target || !shouldGroup) {
|
|
7008
|
+
if (entry.source === "reasoning" && typeof entry.item !== "string") {
|
|
7009
|
+
rootReasoning.push(entry.item);
|
|
7010
|
+
} else {
|
|
7011
|
+
rootEntries.push(entry);
|
|
7012
|
+
}
|
|
7013
|
+
continue;
|
|
7014
|
+
}
|
|
7015
|
+
const node = createAgentRunNode(
|
|
7016
|
+
nodes,
|
|
7017
|
+
target.executionId,
|
|
7018
|
+
createInfoFromEntry(target.executionId, entry, target.parentExecutionId),
|
|
7019
|
+
entry.order
|
|
7020
|
+
);
|
|
7021
|
+
node.entries.push(entry);
|
|
7022
|
+
node.firstOrder = Math.min(node.firstOrder, entry.order);
|
|
7023
|
+
}
|
|
7024
|
+
const roots = [];
|
|
7025
|
+
for (const node of nodes.values()) {
|
|
7026
|
+
if (node.id === rootExecutionId && !node.info.parentId) {
|
|
7027
|
+
continue;
|
|
7028
|
+
}
|
|
7029
|
+
const parentId = node.info.parentId ?? node.info.parentExecutionId;
|
|
7030
|
+
if (parentId && parentId !== rootExecutionId && parentId !== node.id) {
|
|
7031
|
+
const parent = nodes.get(parentId);
|
|
7032
|
+
if (parent) {
|
|
7033
|
+
parent.children.push(node);
|
|
7034
|
+
continue;
|
|
7035
|
+
}
|
|
7036
|
+
}
|
|
7037
|
+
roots.push(node);
|
|
7038
|
+
}
|
|
7039
|
+
roots.forEach(refreshAgentNodeOrder);
|
|
7040
|
+
roots.sort((a, b) => a.firstOrder - b.firstOrder);
|
|
7041
|
+
const units = [
|
|
7042
|
+
...rootEntries.map((entry) => ({
|
|
7043
|
+
type: "entry",
|
|
7044
|
+
entry,
|
|
7045
|
+
order: entry.order
|
|
7046
|
+
})),
|
|
7047
|
+
...roots.map((node) => ({
|
|
7048
|
+
type: "agent",
|
|
7049
|
+
node,
|
|
7050
|
+
order: node.firstOrder
|
|
7051
|
+
}))
|
|
7052
|
+
].sort((a, b) => a.order - b.order);
|
|
7053
|
+
return {
|
|
7054
|
+
units,
|
|
7055
|
+
rootReasoning,
|
|
7056
|
+
hasAgentRuns: roots.length > 0
|
|
7057
|
+
};
|
|
7058
|
+
}
|
|
6673
7059
|
|
|
6674
7060
|
// src/components/ui/badge.tsx
|
|
6675
7061
|
var React24 = __toESM(require("react"), 1);
|
|
@@ -7870,105 +8256,749 @@ var MarkdownTextImpl = ({ children }) => {
|
|
|
7870
8256
|
};
|
|
7871
8257
|
var MarkdownText = (0, import_react6.memo)(MarkdownTextImpl);
|
|
7872
8258
|
|
|
7873
|
-
// src/components/thread/messages/
|
|
8259
|
+
// src/components/thread/messages/agent-run-group.tsx
|
|
7874
8260
|
var React28 = __toESM(require("react"), 1);
|
|
7875
8261
|
var import_lucide_react16 = require("lucide-react");
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
return
|
|
8262
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
8263
|
+
function safeJson2(value) {
|
|
8264
|
+
try {
|
|
8265
|
+
return JSON.stringify(value, null, 2);
|
|
8266
|
+
} catch {
|
|
8267
|
+
return String(value);
|
|
7882
8268
|
}
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
underscoredLanguage,
|
|
7891
|
-
"zh_Hans",
|
|
7892
|
-
"zh-Hans",
|
|
7893
|
-
"zh_CN",
|
|
7894
|
-
"zh-CN",
|
|
7895
|
-
"zh",
|
|
7896
|
-
"en_US",
|
|
7897
|
-
"en-US",
|
|
7898
|
-
"en"
|
|
7899
|
-
] : [
|
|
7900
|
-
normalizedLanguage,
|
|
7901
|
-
underscoredLanguage,
|
|
7902
|
-
"en_US",
|
|
7903
|
-
"en-US",
|
|
7904
|
-
"en",
|
|
7905
|
-
languagePrefix,
|
|
7906
|
-
"zh_Hans",
|
|
7907
|
-
"zh-Hans",
|
|
7908
|
-
"zh_CN",
|
|
7909
|
-
"zh-CN",
|
|
7910
|
-
"zh"
|
|
7911
|
-
];
|
|
7912
|
-
for (const key of preferredKeys) {
|
|
7913
|
-
const candidate = localized[key];
|
|
7914
|
-
if (typeof candidate === "string" && candidate.trim()) {
|
|
7915
|
-
return candidate.trim();
|
|
7916
|
-
}
|
|
8269
|
+
}
|
|
8270
|
+
function formatDisplayValue2(value) {
|
|
8271
|
+
return typeof value === "string" ? value : safeJson2(value);
|
|
8272
|
+
}
|
|
8273
|
+
function formatStepDuration(durationMs) {
|
|
8274
|
+
if (durationMs < 1e3) {
|
|
8275
|
+
return `${durationMs}ms`;
|
|
7917
8276
|
}
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
return candidate.trim();
|
|
7921
|
-
}
|
|
8277
|
+
if (durationMs < 1e4) {
|
|
8278
|
+
return `${(durationMs / 1e3).toFixed(1)}s`;
|
|
7922
8279
|
}
|
|
7923
|
-
|
|
8280
|
+
if (durationMs < 6e4) {
|
|
8281
|
+
return `${Math.round(durationMs / 1e3)}s`;
|
|
8282
|
+
}
|
|
8283
|
+
const hours = Math.floor(durationMs / 36e5);
|
|
8284
|
+
const minutes = Math.floor(durationMs % 36e5 / 6e4);
|
|
8285
|
+
const seconds = Math.floor(durationMs % 6e4 / 1e3);
|
|
8286
|
+
if (hours > 0) {
|
|
8287
|
+
return `${hours}h ${minutes}m ${seconds}s`;
|
|
8288
|
+
}
|
|
8289
|
+
return `${minutes}m ${seconds}s`;
|
|
7924
8290
|
}
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
iconClass: "border-red-500 text-red-700",
|
|
7935
|
-
icon: import_lucide_react16.XCircle
|
|
7936
|
-
},
|
|
7937
|
-
running: {
|
|
7938
|
-
iconClass: "border-blue-500 text-blue-700",
|
|
7939
|
-
icon: import_lucide_react16.Loader2
|
|
8291
|
+
function getAgentRunStatusConfig(status, hasReply = false) {
|
|
8292
|
+
const normalized = normalizeRunStatus(status);
|
|
8293
|
+
if (normalized === "running") {
|
|
8294
|
+
return {
|
|
8295
|
+
icon: import_lucide_react16.Loader2,
|
|
8296
|
+
iconClass: "text-blue-700",
|
|
8297
|
+
labelKey: "running",
|
|
8298
|
+
spin: true
|
|
8299
|
+
};
|
|
7940
8300
|
}
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
8301
|
+
if (normalized === "success" || normalized === "succeeded") {
|
|
8302
|
+
return {
|
|
8303
|
+
icon: import_lucide_react16.CheckCircle2,
|
|
8304
|
+
iconClass: "text-green-700",
|
|
8305
|
+
labelKey: "success",
|
|
8306
|
+
spin: false
|
|
8307
|
+
};
|
|
8308
|
+
}
|
|
8309
|
+
if (isFailedRunStatus(normalized)) {
|
|
8310
|
+
return {
|
|
8311
|
+
icon: import_lucide_react16.XCircle,
|
|
8312
|
+
iconClass: "text-red-700",
|
|
8313
|
+
labelKey: "error",
|
|
8314
|
+
spin: false
|
|
8315
|
+
};
|
|
8316
|
+
}
|
|
8317
|
+
if (normalized === "pending" && hasReply) {
|
|
8318
|
+
return {
|
|
8319
|
+
icon: import_lucide_react16.CheckCircle2,
|
|
8320
|
+
iconClass: "text-green-700",
|
|
8321
|
+
labelKey: "replied",
|
|
8322
|
+
spin: false
|
|
8323
|
+
};
|
|
8324
|
+
}
|
|
8325
|
+
return {
|
|
8326
|
+
icon: import_lucide_react16.Clock3,
|
|
8327
|
+
iconClass: "text-muted-foreground",
|
|
8328
|
+
labelKey: normalized,
|
|
8329
|
+
spin: false
|
|
8330
|
+
};
|
|
8331
|
+
}
|
|
8332
|
+
function AgentRunHeaderMetric({
|
|
8333
|
+
icon: Icon,
|
|
8334
|
+
label,
|
|
8335
|
+
value,
|
|
8336
|
+
children
|
|
8337
|
+
}) {
|
|
8338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Tooltip, { children: [
|
|
8339
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
8340
|
+
"span",
|
|
8341
|
+
{
|
|
8342
|
+
"aria-label": label,
|
|
8343
|
+
className: "inline-flex shrink-0 items-center gap-1 rounded-sm text-[11px] text-muted-foreground/60 transition-colors group-hover/agent:text-muted-foreground",
|
|
8344
|
+
children: [
|
|
8345
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Icon, { className: "h-3.5 w-3.5" }),
|
|
8346
|
+
value !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: value }) : null
|
|
8347
|
+
]
|
|
8348
|
+
}
|
|
8349
|
+
) }),
|
|
8350
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipContent, { side: "top", sideOffset: 6, className: "max-w-80 text-left", children })
|
|
8351
|
+
] });
|
|
8352
|
+
}
|
|
8353
|
+
function getAgentNodeUnits(node) {
|
|
8354
|
+
return [
|
|
8355
|
+
...node.entries.map((entry) => ({
|
|
8356
|
+
type: "entry",
|
|
8357
|
+
entry,
|
|
8358
|
+
order: entry.order
|
|
8359
|
+
})),
|
|
8360
|
+
...node.children.map((child) => ({
|
|
8361
|
+
type: "agent",
|
|
8362
|
+
node: child,
|
|
8363
|
+
order: child.firstOrder
|
|
8364
|
+
}))
|
|
8365
|
+
].sort((a, b) => a.order - b.order);
|
|
8366
|
+
}
|
|
8367
|
+
function AgentEventRow({ content }) {
|
|
8368
|
+
const label = content.title?.trim() || content.message?.trim() || content.event?.trim() || "Event";
|
|
8369
|
+
const detail = content.title?.trim() && content.message?.trim() ? content.message.trim() : null;
|
|
8370
|
+
const isError = content.error !== void 0 || isFailedRunStatus(content.status);
|
|
8371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
8372
|
+
"div",
|
|
8373
|
+
{
|
|
8374
|
+
className: cn(
|
|
8375
|
+
"flex items-start gap-2 rounded-md px-2 py-1.5 text-xs leading-5",
|
|
8376
|
+
isError ? "bg-destructive/10 text-destructive" : "bg-muted/40 text-muted-foreground"
|
|
8377
|
+
),
|
|
8378
|
+
children: [
|
|
8379
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.Info, { className: "mt-0.5 h-3.5 w-3.5 shrink-0" }),
|
|
8380
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
8381
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "truncate font-medium", children: label }),
|
|
8382
|
+
detail ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "wrap-break-word", children: detail }) : null,
|
|
8383
|
+
content.error !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("pre", { className: "mt-1 whitespace-pre-wrap wrap-break-word", children: formatDisplayValue2(content.error) }) : null
|
|
8384
|
+
] })
|
|
8385
|
+
]
|
|
8386
|
+
}
|
|
8387
|
+
);
|
|
8388
|
+
}
|
|
8389
|
+
function AgentRunGroup({
|
|
8390
|
+
node,
|
|
8391
|
+
hasFollowingItem,
|
|
8392
|
+
depth,
|
|
8393
|
+
renderUnits
|
|
8394
|
+
}) {
|
|
8395
|
+
const { t } = useChatkitTranslation();
|
|
8396
|
+
const counts = getAgentRunCounts(node);
|
|
8397
|
+
const statusConfig = getAgentRunStatusConfig(
|
|
8398
|
+
node.info.status,
|
|
8399
|
+
counts.text > 0
|
|
8400
|
+
);
|
|
8401
|
+
const StatusIcon = statusConfig.icon;
|
|
8402
|
+
const isRunning = isRunningRunStatus(node.info.status);
|
|
8403
|
+
const [isExpanded, setIsExpanded] = React28.useState(
|
|
8404
|
+
() => isRunning || !hasFollowingItem
|
|
8405
|
+
);
|
|
8406
|
+
const title = getAgentRunTitle(node.info, t("message.agentRun.defaultTitle"));
|
|
8407
|
+
const duration = getAgentRunDuration(node.info);
|
|
8408
|
+
const statusLabel = t(`message.agentRun.status.${statusConfig.labelKey}`, {
|
|
8409
|
+
defaultValue: node.info.status ?? statusConfig.labelKey
|
|
8410
|
+
});
|
|
8411
|
+
const detailsId = React28.useId();
|
|
8412
|
+
React28.useEffect(() => {
|
|
8413
|
+
if (isRunning) {
|
|
8414
|
+
setIsExpanded(true);
|
|
8415
|
+
return;
|
|
8416
|
+
}
|
|
8417
|
+
setIsExpanded(!hasFollowingItem);
|
|
8418
|
+
}, [hasFollowingItem, isRunning]);
|
|
8419
|
+
const countItems = [
|
|
8420
|
+
counts.text > 0 ? {
|
|
8421
|
+
icon: import_lucide_react16.MessageSquareText,
|
|
8422
|
+
count: counts.text,
|
|
8423
|
+
label: t(
|
|
8424
|
+
`message.agentRun.counts.messages.${counts.text === 1 ? "one" : "other"}`,
|
|
8425
|
+
{ count: counts.text }
|
|
8426
|
+
)
|
|
8427
|
+
} : null,
|
|
8428
|
+
counts.tools > 0 ? {
|
|
8429
|
+
icon: import_lucide_react16.Wrench,
|
|
8430
|
+
count: counts.tools,
|
|
8431
|
+
label: t(
|
|
8432
|
+
`message.agentRun.counts.tools.${counts.tools === 1 ? "one" : "other"}`,
|
|
8433
|
+
{ count: counts.tools }
|
|
8434
|
+
)
|
|
8435
|
+
} : null,
|
|
8436
|
+
counts.events > 0 ? {
|
|
8437
|
+
icon: import_lucide_react16.Info,
|
|
8438
|
+
count: counts.events,
|
|
8439
|
+
label: t(
|
|
8440
|
+
`message.agentRun.counts.events.${counts.events === 1 ? "one" : "other"}`,
|
|
8441
|
+
{ count: counts.events }
|
|
8442
|
+
)
|
|
8443
|
+
} : null,
|
|
8444
|
+
counts.children > 0 ? {
|
|
8445
|
+
icon: import_lucide_react16.GitBranch,
|
|
8446
|
+
count: counts.children,
|
|
8447
|
+
label: t(
|
|
8448
|
+
`message.agentRun.counts.children.${counts.children === 1 ? "one" : "other"}`,
|
|
8449
|
+
{ count: counts.children }
|
|
8450
|
+
)
|
|
8451
|
+
} : null
|
|
8452
|
+
].filter(
|
|
8453
|
+
(item) => Boolean(item)
|
|
8454
|
+
);
|
|
8455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: cn("border-l border-border/70 pl-2", depth > 0 ? "ml-1" : "-mx-2.5"), children: [
|
|
8456
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
8457
|
+
"button",
|
|
8458
|
+
{
|
|
8459
|
+
type: "button",
|
|
8460
|
+
className: "group/agent group-agent flex w-full items-start justify-between gap-2 rounded-md px-0 py-1.5 text-left",
|
|
8461
|
+
"aria-expanded": isExpanded,
|
|
8462
|
+
"aria-controls": detailsId,
|
|
8463
|
+
onClick: () => setIsExpanded((prev) => !prev),
|
|
8464
|
+
children: [
|
|
8465
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1", children: [
|
|
8466
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.Bot, { className: "h-4 w-4 shrink-0 text-muted-foreground/55 transition-colors group-hover/agent:text-muted-foreground" }),
|
|
8467
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "min-w-0 max-w-[16rem] truncate text-sm font-medium text-foreground/65 transition-colors group-hover/agent:text-foreground", children: title }),
|
|
8468
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "inline-flex shrink-0 items-center gap-1 text-[11px] text-muted-foreground/65 transition-colors group-hover/agent:text-muted-foreground", children: [
|
|
8469
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
8470
|
+
StatusIcon,
|
|
8471
|
+
{
|
|
8472
|
+
className: cn(
|
|
8473
|
+
"h-3.5 w-3.5",
|
|
8474
|
+
statusConfig.iconClass,
|
|
8475
|
+
statusConfig.spin && "animate-spin"
|
|
8476
|
+
)
|
|
8477
|
+
}
|
|
8478
|
+
),
|
|
8479
|
+
statusLabel
|
|
8480
|
+
] }),
|
|
8481
|
+
duration !== null ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "inline-flex shrink-0 items-center gap-1 text-[11px] text-muted-foreground/60 tabular-nums transition-colors group-hover/agent:text-muted-foreground", children: [
|
|
8482
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.Clock3, { className: "h-3 w-3" }),
|
|
8483
|
+
formatStepDuration(duration)
|
|
8484
|
+
] }) : null,
|
|
8485
|
+
node.info.inputs !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
8486
|
+
AgentRunHeaderMetric,
|
|
8487
|
+
{
|
|
8488
|
+
icon: import_lucide_react16.Braces,
|
|
8489
|
+
label: t("message.agentRun.inputLabel"),
|
|
8490
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "space-y-1", children: [
|
|
8491
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "font-medium", children: t("message.agentRun.inputLabel") }),
|
|
8492
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("pre", { className: "max-h-64 overflow-auto whitespace-pre-wrap wrap-break-word text-xs", children: formatDisplayValue2(node.info.inputs) })
|
|
8493
|
+
] })
|
|
8494
|
+
}
|
|
8495
|
+
) : null,
|
|
8496
|
+
countItems.map((item) => {
|
|
8497
|
+
const CountIcon = item.icon;
|
|
8498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
8499
|
+
AgentRunHeaderMetric,
|
|
8500
|
+
{
|
|
8501
|
+
icon: CountIcon,
|
|
8502
|
+
label: item.label,
|
|
8503
|
+
value: item.count,
|
|
8504
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: item.label })
|
|
8505
|
+
},
|
|
8506
|
+
item.label
|
|
8507
|
+
);
|
|
8508
|
+
})
|
|
8509
|
+
] }) }),
|
|
8510
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
8511
|
+
import_lucide_react16.ChevronRight,
|
|
8512
|
+
{
|
|
8513
|
+
"aria-hidden": "true",
|
|
8514
|
+
className: cn(
|
|
8515
|
+
"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground/55 opacity-0 transition-[color,transform] group-hover/agent:text-muted-foreground group-hover/agent:opacity-100",
|
|
8516
|
+
isExpanded && "rotate-90"
|
|
8517
|
+
)
|
|
8518
|
+
}
|
|
8519
|
+
)
|
|
8520
|
+
]
|
|
8521
|
+
}
|
|
8522
|
+
),
|
|
8523
|
+
isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { id: detailsId, className: "mt-2 space-y-3", children: [
|
|
8524
|
+
hasVisibleAgentRunDetails(node.info) ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "space-y-2 rounded-md bg-muted/30 px-2 py-2 text-xs text-muted-foreground", children: node.info.error !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { children: [
|
|
8525
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "mb-1 font-medium text-destructive", children: t("message.agentRun.errorLabel") }),
|
|
8526
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word text-destructive", children: formatDisplayValue2(node.info.error) })
|
|
8527
|
+
] }) : null }) : null,
|
|
8528
|
+
renderUnits(getAgentNodeUnits(node), depth + 1)
|
|
8529
|
+
] }) : null
|
|
8530
|
+
] });
|
|
8531
|
+
}
|
|
8532
|
+
|
|
8533
|
+
// src/i18n/localized-text.ts
|
|
8534
|
+
function resolveLocalizedText(value, language) {
|
|
8535
|
+
if (typeof value === "string") {
|
|
8536
|
+
const trimmed = value.trim();
|
|
8537
|
+
return trimmed || null;
|
|
8538
|
+
}
|
|
8539
|
+
if (!value || typeof value !== "object") return null;
|
|
8540
|
+
const localized = value;
|
|
8541
|
+
const normalizedLanguage = language.trim();
|
|
8542
|
+
const underscoredLanguage = normalizedLanguage.replace(/-/g, "_");
|
|
8543
|
+
const languagePrefix = normalizedLanguage.split("-")[0];
|
|
8544
|
+
const preferredKeys = normalizedLanguage.startsWith("zh") ? [
|
|
8545
|
+
normalizedLanguage,
|
|
8546
|
+
underscoredLanguage,
|
|
8547
|
+
"zh_Hans",
|
|
8548
|
+
"zh-Hans",
|
|
8549
|
+
"zh_CN",
|
|
8550
|
+
"zh-CN",
|
|
8551
|
+
"zh",
|
|
8552
|
+
"en_US",
|
|
8553
|
+
"en-US",
|
|
8554
|
+
"en"
|
|
8555
|
+
] : [
|
|
8556
|
+
normalizedLanguage,
|
|
8557
|
+
underscoredLanguage,
|
|
8558
|
+
"en_US",
|
|
8559
|
+
"en-US",
|
|
8560
|
+
"en",
|
|
8561
|
+
languagePrefix,
|
|
8562
|
+
"zh_Hans",
|
|
8563
|
+
"zh-Hans",
|
|
8564
|
+
"zh_CN",
|
|
8565
|
+
"zh-CN",
|
|
8566
|
+
"zh"
|
|
8567
|
+
];
|
|
8568
|
+
for (const key of preferredKeys) {
|
|
8569
|
+
const candidate = localized[key];
|
|
8570
|
+
if (typeof candidate === "string" && candidate.trim()) {
|
|
8571
|
+
return candidate.trim();
|
|
8572
|
+
}
|
|
8573
|
+
}
|
|
8574
|
+
for (const candidate of Object.values(localized)) {
|
|
8575
|
+
if (typeof candidate === "string" && candidate.trim()) {
|
|
8576
|
+
return candidate.trim();
|
|
8577
|
+
}
|
|
8578
|
+
}
|
|
8579
|
+
return null;
|
|
8580
|
+
}
|
|
8581
|
+
|
|
8582
|
+
// src/components/thread/messages/knowledge-retriever-component-renderer.tsx
|
|
8583
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
8584
|
+
var KNOWLEDGE_RETRIEVER_TITLE = "Knowledge Retriever";
|
|
8585
|
+
var KNOWLEDGE_METADATA_SKIP_KEYS = /* @__PURE__ */ new Set([
|
|
8586
|
+
"assets",
|
|
8587
|
+
"children",
|
|
8588
|
+
"loc",
|
|
8589
|
+
"relevanceScore",
|
|
8590
|
+
"score"
|
|
8591
|
+
]);
|
|
8592
|
+
var knowledgeRetrieverComponentRenderer = {
|
|
8593
|
+
id: "knowledge-retriever",
|
|
8594
|
+
presentation: "grouped-step",
|
|
8595
|
+
match: isKnowledgeRetrieverComponent,
|
|
8596
|
+
getTitle: () => KNOWLEDGE_RETRIEVER_TITLE,
|
|
8597
|
+
hasDetails: hasKnowledgeRetrieverDetails,
|
|
8598
|
+
renderDetails: KnowledgeRetrieverDetails
|
|
8599
|
+
};
|
|
8600
|
+
function normalizeToolToken(value) {
|
|
8601
|
+
if (typeof value !== "string") return null;
|
|
8602
|
+
const normalized = value.trim().toLowerCase().replace(/[\s-]+/g, "_");
|
|
8603
|
+
return normalized || null;
|
|
8604
|
+
}
|
|
8605
|
+
function isRecord2(value) {
|
|
8606
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
8607
|
+
}
|
|
8608
|
+
function readString(value) {
|
|
8609
|
+
if (typeof value !== "string") return void 0;
|
|
8610
|
+
const trimmed = value.trim();
|
|
8611
|
+
return trimmed || void 0;
|
|
8612
|
+
}
|
|
8613
|
+
function stringifyValue(value) {
|
|
8614
|
+
if (value === null || value === void 0) return void 0;
|
|
8615
|
+
if (typeof value === "string") return readString(value);
|
|
8616
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
8617
|
+
return String(value);
|
|
8618
|
+
}
|
|
8619
|
+
try {
|
|
8620
|
+
const serialized = JSON.stringify(value);
|
|
8621
|
+
return serialized && serialized !== "{}" ? serialized : void 0;
|
|
8622
|
+
} catch {
|
|
8623
|
+
return String(value);
|
|
8624
|
+
}
|
|
8625
|
+
}
|
|
8626
|
+
function truncateMetadataValue(value) {
|
|
8627
|
+
return value.length > 90 ? `${value.slice(0, 87)}...` : value;
|
|
8628
|
+
}
|
|
8629
|
+
function formatScore(value) {
|
|
8630
|
+
if (typeof value === "number") {
|
|
8631
|
+
return Number.isFinite(value) ? value.toFixed(value < 1 ? 3 : 2) : void 0;
|
|
8632
|
+
}
|
|
8633
|
+
return readString(value);
|
|
8634
|
+
}
|
|
8635
|
+
function getLineRange(metadata) {
|
|
8636
|
+
const loc = metadata.loc;
|
|
8637
|
+
if (!isRecord2(loc)) return void 0;
|
|
8638
|
+
const lines = loc.lines;
|
|
8639
|
+
if (!isRecord2(lines)) return void 0;
|
|
8640
|
+
const from = stringifyValue(lines.from);
|
|
8641
|
+
const to = stringifyValue(lines.to);
|
|
8642
|
+
if (from && to) return `${from}-${to}`;
|
|
8643
|
+
return from ?? to;
|
|
8644
|
+
}
|
|
8645
|
+
function normalizeMetadataEntries(metadata) {
|
|
8646
|
+
return Object.entries(metadata).flatMap(([key, value]) => {
|
|
8647
|
+
if (KNOWLEDGE_METADATA_SKIP_KEYS.has(key)) return [];
|
|
8648
|
+
const formatted = stringifyValue(value);
|
|
8649
|
+
if (!formatted) return [];
|
|
8650
|
+
return [
|
|
8651
|
+
{
|
|
8652
|
+
key,
|
|
8653
|
+
value: truncateMetadataValue(formatted)
|
|
8654
|
+
}
|
|
8655
|
+
];
|
|
8656
|
+
});
|
|
8657
|
+
}
|
|
8658
|
+
function normalizeKnowledgeResult(value, fallbackTitle) {
|
|
8659
|
+
if (!isRecord2(value)) return null;
|
|
8660
|
+
const metadata = isRecord2(value.metadata) ? value.metadata : {};
|
|
8661
|
+
const document2 = isRecord2(value.document) ? value.document : {};
|
|
8662
|
+
const content = readString(value.pageContent);
|
|
8663
|
+
const title = readString(document2.name) ?? readString(metadata.originalFileName) ?? readString(metadata.source) ?? readString(value.id) ?? readString(metadata.chunkId) ?? fallbackTitle;
|
|
8664
|
+
if (!content && Object.keys(metadata).length === 0 && Object.keys(document2).length === 0) {
|
|
8665
|
+
return null;
|
|
8666
|
+
}
|
|
8667
|
+
return {
|
|
8668
|
+
id: readString(value.id) ?? readString(metadata.chunkId),
|
|
8669
|
+
title,
|
|
8670
|
+
url: readString(document2.fileUrl),
|
|
8671
|
+
content,
|
|
8672
|
+
lineRange: getLineRange(metadata),
|
|
8673
|
+
score: formatScore(
|
|
8674
|
+
metadata.relevanceScore ?? metadata.score ?? value.score
|
|
8675
|
+
),
|
|
8676
|
+
metadata: normalizeMetadataEntries(metadata)
|
|
8677
|
+
};
|
|
8678
|
+
}
|
|
8679
|
+
function getKnowledgeResults(data) {
|
|
8680
|
+
if (!Array.isArray(data.data)) return [];
|
|
8681
|
+
return data.data.flatMap((item, index) => {
|
|
8682
|
+
const result = normalizeKnowledgeResult(item, `Result ${index + 1}`);
|
|
8683
|
+
return result ? [result] : [];
|
|
8684
|
+
});
|
|
8685
|
+
}
|
|
8686
|
+
function getRawKnowledgeData(data) {
|
|
8687
|
+
return data.data ?? data.output ?? null;
|
|
8688
|
+
}
|
|
8689
|
+
function getRetrieverQuery(data, language) {
|
|
8690
|
+
const input = data.input;
|
|
8691
|
+
if (isRecord2(input)) {
|
|
8692
|
+
return readString(input.query) ?? readString(input.input) ?? readString(input.question);
|
|
8693
|
+
}
|
|
8694
|
+
return readString(resolveLocalizedText(data.message, language)) ?? readString(input);
|
|
8695
|
+
}
|
|
8696
|
+
function hasKnowledgeRetrieverDetails(_content, data) {
|
|
8697
|
+
return isKnowledgeRetrieverComponent(_content, data);
|
|
8698
|
+
}
|
|
8699
|
+
function isKnowledgeRetrieverComponent(_content, data) {
|
|
8700
|
+
return normalizeToolToken(data.type) === "knowledges";
|
|
8701
|
+
}
|
|
8702
|
+
function KnowledgeRawDataBlock({ value }) {
|
|
8703
|
+
const { t } = useChatkitTranslation();
|
|
8704
|
+
const detected = detectJsonValue(value);
|
|
8705
|
+
if (detected.kind === "text") {
|
|
8706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PlainTextBlock, { value: detected.text });
|
|
8707
|
+
}
|
|
8708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Tabs, { defaultValue: "tree", className: "min-w-0", children: [
|
|
8709
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "mb-2 flex min-w-0 items-center justify-between gap-2", children: [
|
|
8710
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "min-w-0 truncate text-[11px] text-muted-foreground", children: [
|
|
8711
|
+
t("message.toolGroup.jsonTitle"),
|
|
8712
|
+
" \xB7",
|
|
8713
|
+
" ",
|
|
8714
|
+
getJsonValueSummary(detected.value)
|
|
8715
|
+
] }),
|
|
8716
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(TabsList, { className: "rounded-md p-0.5", children: [
|
|
8717
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TabsTrigger, { className: "px-2 py-0.5 text-[11px]", value: "tree", children: t("message.toolGroup.jsonTree") }),
|
|
8718
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TabsTrigger, { className: "px-2 py-0.5 text-[11px]", value: "raw", children: t("message.toolGroup.jsonRaw") })
|
|
8719
|
+
] })
|
|
8720
|
+
] }),
|
|
8721
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TabsContent, { value: "tree", className: "mt-0", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(JsonTreeView, { value: detected.value }) }),
|
|
8722
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TabsContent, { value: "raw", className: "mt-0", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(RawJsonBlock, { raw: detected.raw }) })
|
|
8723
|
+
] });
|
|
8724
|
+
}
|
|
8725
|
+
function KnowledgeRetrieverDetails({
|
|
8726
|
+
data
|
|
8727
|
+
}) {
|
|
8728
|
+
const { i18n: i18n2, t } = useChatkitTranslation();
|
|
8729
|
+
const query = getRetrieverQuery(data, i18n2.language);
|
|
8730
|
+
const results = getKnowledgeResults(data);
|
|
8731
|
+
const rawData = getRawKnowledgeData(data);
|
|
8732
|
+
const hasArrayData = Array.isArray(data.data);
|
|
8733
|
+
const hasRawFallback = rawData !== null && rawData !== void 0 && (!hasArrayData || Array.isArray(data.data) && data.data.length > 0 && results.length === 0);
|
|
8734
|
+
const showEmptyState = results.length === 0 && !hasRawFallback && data.status !== "running";
|
|
8735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "min-w-0 space-y-3 px-3 py-2", children: [
|
|
8736
|
+
query ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "min-w-0 space-y-1", children: [
|
|
8737
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "text-[11px] font-medium text-muted-foreground", children: t("message.knowledgeRetriever.queryTitle") }),
|
|
8738
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "min-w-0 whitespace-pre-wrap wrap-break-word rounded-md bg-muted/40 px-3 py-2 font-mono text-[12px] leading-5 text-foreground/80", children: query })
|
|
8739
|
+
] }) : null,
|
|
8740
|
+
results.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "min-w-0 space-y-2", children: [
|
|
8741
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "text-[11px] font-medium text-muted-foreground", children: t("message.knowledgeRetriever.resultsTitle", {
|
|
8742
|
+
count: results.length
|
|
8743
|
+
}) }),
|
|
8744
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "space-y-2", children: results.map((result, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
8745
|
+
KnowledgeResultCard,
|
|
8746
|
+
{
|
|
8747
|
+
result,
|
|
8748
|
+
index
|
|
8749
|
+
},
|
|
8750
|
+
result.id ?? `${result.title}-${index}`
|
|
8751
|
+
)) })
|
|
8752
|
+
] }) : null,
|
|
8753
|
+
hasRawFallback ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "min-w-0 space-y-1", children: [
|
|
8754
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "text-[11px] font-medium text-muted-foreground", children: t("message.knowledgeRetriever.rawDataTitle") }),
|
|
8755
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(KnowledgeRawDataBlock, { value: rawData })
|
|
8756
|
+
] }) : null,
|
|
8757
|
+
showEmptyState ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "rounded-md border border-dashed border-border/70 px-3 py-4 text-center text-xs text-muted-foreground", children: t("message.knowledgeRetriever.noResults") }) : null
|
|
8758
|
+
] });
|
|
8759
|
+
}
|
|
8760
|
+
function KnowledgeResultCard({
|
|
8761
|
+
result,
|
|
8762
|
+
index
|
|
8763
|
+
}) {
|
|
8764
|
+
const { t } = useChatkitTranslation();
|
|
8765
|
+
const titleId = `knowledge-result-${index + 1}`;
|
|
8766
|
+
const metadata = [
|
|
8767
|
+
...result.score ? [
|
|
8768
|
+
{
|
|
8769
|
+
key: t("message.knowledgeRetriever.scoreLabel"),
|
|
8770
|
+
value: result.score
|
|
8771
|
+
}
|
|
8772
|
+
] : [],
|
|
8773
|
+
...result.metadata
|
|
8774
|
+
];
|
|
8775
|
+
const titleClassName = "min-w-0 line-clamp-2 text-sm font-medium leading-5 text-foreground";
|
|
8776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("article", { className: "min-w-0 rounded-md border border-border/60 bg-background/80 px-3 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex min-w-0 items-start gap-2", children: [
|
|
8777
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "mt-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-[11px] font-medium text-muted-foreground", children: index + 1 }),
|
|
8778
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
8779
|
+
result.url ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
8780
|
+
"a",
|
|
8781
|
+
{
|
|
8782
|
+
id: titleId,
|
|
8783
|
+
href: result.url,
|
|
8784
|
+
target: "_blank",
|
|
8785
|
+
rel: "noreferrer",
|
|
8786
|
+
className: cn(titleClassName, "hover:underline"),
|
|
8787
|
+
children: [
|
|
8788
|
+
result.title,
|
|
8789
|
+
result.lineRange ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "ml-1 text-muted-foreground", children: [
|
|
8790
|
+
"[",
|
|
8791
|
+
result.lineRange,
|
|
8792
|
+
"]"
|
|
8793
|
+
] }) : null
|
|
8794
|
+
]
|
|
8795
|
+
}
|
|
8796
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { id: titleId, className: titleClassName, children: [
|
|
8797
|
+
result.title,
|
|
8798
|
+
result.lineRange ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "ml-1 text-muted-foreground", children: [
|
|
8799
|
+
"[",
|
|
8800
|
+
result.lineRange,
|
|
8801
|
+
"]"
|
|
8802
|
+
] }) : null
|
|
8803
|
+
] }),
|
|
8804
|
+
result.content ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "mt-1 line-clamp-3 whitespace-pre-wrap text-xs leading-5 text-muted-foreground", children: result.content }) : null,
|
|
8805
|
+
metadata.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
8806
|
+
"div",
|
|
8807
|
+
{
|
|
8808
|
+
className: "mt-2 flex flex-wrap gap-1.5",
|
|
8809
|
+
"aria-labelledby": titleId,
|
|
8810
|
+
children: metadata.slice(0, 10).map((item) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
8811
|
+
"span",
|
|
8812
|
+
{
|
|
8813
|
+
className: "inline-flex min-w-0 max-w-full items-center gap-1 rounded-md bg-muted/50 px-1.5 py-0.5 text-[11px] leading-4 text-muted-foreground",
|
|
8814
|
+
children: [
|
|
8815
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "shrink-0 font-medium text-foreground/70", children: [
|
|
8816
|
+
item.key,
|
|
8817
|
+
":"
|
|
8818
|
+
] }),
|
|
8819
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "min-w-0 truncate font-mono", children: item.value })
|
|
8820
|
+
]
|
|
8821
|
+
},
|
|
8822
|
+
`${item.key}:${item.value}`
|
|
8823
|
+
))
|
|
8824
|
+
}
|
|
8825
|
+
) : null
|
|
8826
|
+
] })
|
|
8827
|
+
] }) });
|
|
8828
|
+
}
|
|
8829
|
+
|
|
8830
|
+
// src/components/thread/messages/web-search-component-renderer.tsx
|
|
8831
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
8832
|
+
var webSearchComponentRenderer = {
|
|
8833
|
+
id: "computer-web-search-sources",
|
|
8834
|
+
presentation: "grouped-step",
|
|
8835
|
+
match: isComputerWebSearchComponent,
|
|
8836
|
+
hasDetails: hasWebSearchSources,
|
|
8837
|
+
renderDetails: WebSearchToolCallOutput
|
|
8838
|
+
};
|
|
8839
|
+
function normalizeToolToken2(value) {
|
|
8840
|
+
if (typeof value !== "string") return null;
|
|
8841
|
+
const normalized = value.trim().toLowerCase().replace(/[\s-]+/g, "_");
|
|
8842
|
+
return normalized || null;
|
|
8843
|
+
}
|
|
8844
|
+
function readOptionalString(value) {
|
|
8845
|
+
if (typeof value !== "string") return void 0;
|
|
8846
|
+
const trimmed = value.trim();
|
|
8847
|
+
return trimmed || void 0;
|
|
8848
|
+
}
|
|
8849
|
+
function normalizeWebSearchSource(value) {
|
|
8850
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
8851
|
+
return null;
|
|
8852
|
+
}
|
|
8853
|
+
const candidate = value;
|
|
8854
|
+
const title = readOptionalString(candidate.title);
|
|
8855
|
+
const url = readOptionalString(candidate.url);
|
|
8856
|
+
if (!title || !url) return null;
|
|
8857
|
+
const content = readOptionalString(candidate.content);
|
|
8858
|
+
const description = readOptionalString(candidate.description);
|
|
8859
|
+
const publishedDate = readOptionalString(
|
|
8860
|
+
candidate.publishedDate ?? candidate.published_date ?? candidate.publishedAt
|
|
8861
|
+
);
|
|
8862
|
+
const author = readOptionalString(candidate.author);
|
|
8863
|
+
return {
|
|
8864
|
+
title,
|
|
8865
|
+
url,
|
|
8866
|
+
...content ? { content } : {},
|
|
8867
|
+
...description ? { description } : {},
|
|
8868
|
+
...publishedDate ? { publishedDate } : {},
|
|
8869
|
+
...author ? { author } : {}
|
|
8870
|
+
};
|
|
8871
|
+
}
|
|
8872
|
+
function getWebSearchSources(data) {
|
|
8873
|
+
if (!Array.isArray(data.data)) return [];
|
|
8874
|
+
return data.data.flatMap((item) => {
|
|
8875
|
+
const source = normalizeWebSearchSource(item);
|
|
8876
|
+
return source ? [source] : [];
|
|
8877
|
+
});
|
|
8878
|
+
}
|
|
8879
|
+
function hasWebSearchSources(_content, data) {
|
|
8880
|
+
return getWebSearchSources(data).length > 0;
|
|
8881
|
+
}
|
|
8882
|
+
function isComputerWebSearchComponent(_content, data) {
|
|
8883
|
+
const isComputer = data.category === "Computer";
|
|
8884
|
+
const isWebSearch = normalizeToolToken2(data.type) === "web_search";
|
|
8885
|
+
if (!isComputer || !isWebSearch) return false;
|
|
8886
|
+
return normalizeToolToken2(data.tool) === "web_search" || getWebSearchSources(data).length > 0;
|
|
8887
|
+
}
|
|
8888
|
+
function getSourceHost(url) {
|
|
8889
|
+
try {
|
|
8890
|
+
return new URL(url).hostname.replace(/^www\./, "") || null;
|
|
8891
|
+
} catch {
|
|
8892
|
+
return null;
|
|
8893
|
+
}
|
|
8894
|
+
}
|
|
8895
|
+
function WebSearchToolCallOutput({
|
|
8896
|
+
data
|
|
8897
|
+
}) {
|
|
8898
|
+
const { t } = useChatkitTranslation();
|
|
8899
|
+
const sources = getWebSearchSources(data);
|
|
8900
|
+
if (sources.length === 0 || data.error !== void 0) return null;
|
|
8901
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "space-y-2", children: [
|
|
8902
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "text-[11px] font-medium text-muted-foreground", children: t("message.toolGroup.sourcesTitle") }),
|
|
8903
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "space-y-2", children: sources.map((source, index) => {
|
|
8904
|
+
const sourceHost = getSourceHost(source.url);
|
|
8905
|
+
const snippet = source.content ?? source.description;
|
|
8906
|
+
const metaParts = [
|
|
8907
|
+
sourceHost,
|
|
8908
|
+
source.publishedDate,
|
|
8909
|
+
source.author
|
|
8910
|
+
].filter((item) => Boolean(item));
|
|
8911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
8912
|
+
"div",
|
|
8913
|
+
{
|
|
8914
|
+
className: "min-w-0 rounded-md border border-border/60 bg-background/80 px-3 py-2",
|
|
8915
|
+
children: [
|
|
8916
|
+
metaParts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "mb-1 truncate text-[11px] text-muted-foreground", children: metaParts.join(" / ") }) : null,
|
|
8917
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8918
|
+
"a",
|
|
8919
|
+
{
|
|
8920
|
+
href: source.url,
|
|
8921
|
+
target: "_blank",
|
|
8922
|
+
rel: "noreferrer",
|
|
8923
|
+
className: "block min-w-0 line-clamp-2 text-sm font-medium leading-5 text-foreground hover:underline",
|
|
8924
|
+
children: source.title
|
|
8925
|
+
}
|
|
8926
|
+
),
|
|
8927
|
+
snippet ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "mt-1 line-clamp-3 text-xs leading-5 text-muted-foreground", children: snippet }) : null
|
|
8928
|
+
]
|
|
8929
|
+
},
|
|
8930
|
+
`${source.url}-${index}`
|
|
8931
|
+
);
|
|
8932
|
+
}) })
|
|
8933
|
+
] });
|
|
8934
|
+
}
|
|
8935
|
+
|
|
8936
|
+
// src/components/thread/messages/component-message-renderers.tsx
|
|
8937
|
+
var COMPONENT_MESSAGE_RENDERERS = [
|
|
8938
|
+
knowledgeRetrieverComponentRenderer,
|
|
8939
|
+
webSearchComponentRenderer
|
|
8940
|
+
];
|
|
8941
|
+
function getComponentMessageRenderer(content, data) {
|
|
8942
|
+
return COMPONENT_MESSAGE_RENDERERS.find(
|
|
8943
|
+
(renderer) => renderer.match(content, data)
|
|
8944
|
+
) ?? null;
|
|
8945
|
+
}
|
|
8946
|
+
function getComponentMessagePresentation(content, data) {
|
|
8947
|
+
return getComponentMessageRenderer(content, data)?.presentation ?? null;
|
|
8948
|
+
}
|
|
8949
|
+
function hasComponentMessageRendererDetails(renderer, content, data) {
|
|
8950
|
+
if (!renderer?.renderDetails) return false;
|
|
8951
|
+
return renderer.hasDetails?.(content, data) ?? true;
|
|
8952
|
+
}
|
|
8953
|
+
|
|
8954
|
+
// src/components/thread/messages/tool-component-group.tsx
|
|
8955
|
+
var React29 = __toESM(require("react"), 1);
|
|
8956
|
+
var import_lucide_react17 = require("lucide-react");
|
|
8957
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
8958
|
+
var toolStatusConfig = {
|
|
8959
|
+
success: {
|
|
8960
|
+
iconClass: "border-green-500 text-green-700",
|
|
8961
|
+
icon: import_lucide_react17.CheckCircle2
|
|
8962
|
+
},
|
|
8963
|
+
fail: {
|
|
8964
|
+
iconClass: "border-red-500 text-red-700",
|
|
8965
|
+
icon: import_lucide_react17.XCircle
|
|
8966
|
+
},
|
|
8967
|
+
running: {
|
|
8968
|
+
iconClass: "border-blue-500 text-blue-700",
|
|
8969
|
+
icon: import_lucide_react17.Loader2
|
|
8970
|
+
}
|
|
8971
|
+
};
|
|
8972
|
+
var TOOL_GROUP_CATEGORY_ORDER = [
|
|
8973
|
+
"files",
|
|
8974
|
+
"searches",
|
|
8975
|
+
"commands",
|
|
8976
|
+
"lists",
|
|
8977
|
+
"tasks",
|
|
8978
|
+
"knowledges",
|
|
8979
|
+
"tools"
|
|
8980
|
+
];
|
|
8981
|
+
var TOOL_GROUP_TOKEN_CATEGORY = {
|
|
8982
|
+
file: "files",
|
|
8983
|
+
files: "files",
|
|
8984
|
+
web_search: "searches",
|
|
8985
|
+
search: "searches",
|
|
8986
|
+
searches: "searches",
|
|
8987
|
+
program: "commands",
|
|
8988
|
+
command: "commands",
|
|
8989
|
+
commands: "commands",
|
|
8990
|
+
shell: "commands",
|
|
8991
|
+
terminal: "commands",
|
|
8992
|
+
list: "lists",
|
|
8993
|
+
lists: "lists",
|
|
8994
|
+
task: "tasks",
|
|
8995
|
+
tasks: "tasks",
|
|
8996
|
+
todo: "tasks",
|
|
8997
|
+
todos: "tasks",
|
|
8998
|
+
knowledge: "knowledges",
|
|
8999
|
+
knowledges: "knowledges",
|
|
9000
|
+
retriever: "knowledges",
|
|
9001
|
+
retrieval: "knowledges",
|
|
7972
9002
|
tool: "tools",
|
|
7973
9003
|
tools: "tools"
|
|
7974
9004
|
};
|
|
@@ -8011,7 +9041,7 @@ function getEffectiveToolStepStatus(data, isThreadRunning) {
|
|
|
8011
9041
|
}
|
|
8012
9042
|
return data.status;
|
|
8013
9043
|
}
|
|
8014
|
-
function
|
|
9044
|
+
function formatStepDuration2(durationMs) {
|
|
8015
9045
|
if (durationMs < 1e3) {
|
|
8016
9046
|
return `${durationMs}ms`;
|
|
8017
9047
|
}
|
|
@@ -8030,10 +9060,10 @@ function formatStepDuration(durationMs) {
|
|
|
8030
9060
|
return `${minutes}m ${seconds}s`;
|
|
8031
9061
|
}
|
|
8032
9062
|
function useFrozenTimestamp(shouldFreeze) {
|
|
8033
|
-
const [frozenAt, setFrozenAt] =
|
|
9063
|
+
const [frozenAt, setFrozenAt] = React29.useState(
|
|
8034
9064
|
() => shouldFreeze ? Date.now() : null
|
|
8035
9065
|
);
|
|
8036
|
-
|
|
9066
|
+
React29.useEffect(() => {
|
|
8037
9067
|
if (shouldFreeze) {
|
|
8038
9068
|
setFrozenAt((current) => current ?? Date.now());
|
|
8039
9069
|
return;
|
|
@@ -8043,12 +9073,12 @@ function useFrozenTimestamp(shouldFreeze) {
|
|
|
8043
9073
|
return frozenAt;
|
|
8044
9074
|
}
|
|
8045
9075
|
function useToolStepDurationLabel(data, options) {
|
|
8046
|
-
const [durationNow, setDurationNow] =
|
|
9076
|
+
const [durationNow, setDurationNow] = React29.useState(() => Date.now());
|
|
8047
9077
|
const createdAt = parseStepDate(data.created_date);
|
|
8048
9078
|
const explicitEndedAt = parseStepDate(data.end_date);
|
|
8049
9079
|
const status = options?.status ?? data.status;
|
|
8050
9080
|
const endedAt = explicitEndedAt ?? (status !== "running" ? options?.fallbackEndedAt ?? null : null);
|
|
8051
|
-
|
|
9081
|
+
React29.useEffect(() => {
|
|
8052
9082
|
if (status !== "running" || createdAt === null || endedAt !== null) {
|
|
8053
9083
|
return;
|
|
8054
9084
|
}
|
|
@@ -8062,43 +9092,47 @@ function useToolStepDurationLabel(data, options) {
|
|
|
8062
9092
|
}, [createdAt, endedAt, status]);
|
|
8063
9093
|
if (createdAt === null) return null;
|
|
8064
9094
|
const durationMs = Math.max(0, (endedAt ?? durationNow) - createdAt);
|
|
8065
|
-
return
|
|
9095
|
+
return formatStepDuration2(durationMs);
|
|
8066
9096
|
}
|
|
8067
|
-
function
|
|
9097
|
+
function isComponentContent2(content) {
|
|
8068
9098
|
return content.type === "component";
|
|
8069
9099
|
}
|
|
8070
|
-
function
|
|
9100
|
+
function isTextContent2(content) {
|
|
8071
9101
|
return content.type === "text";
|
|
8072
9102
|
}
|
|
8073
|
-
function
|
|
9103
|
+
function isReasoningContent2(content) {
|
|
8074
9104
|
return content.type === "reasoning";
|
|
8075
9105
|
}
|
|
8076
9106
|
function isWidgetComponent(content) {
|
|
8077
9107
|
const data = content.data;
|
|
8078
9108
|
return data?.type === "Widget" && Array.isArray(data.widgets);
|
|
8079
9109
|
}
|
|
8080
|
-
function
|
|
9110
|
+
function isGroupableStepComponent(content) {
|
|
8081
9111
|
if (!content || typeof content === "string") return false;
|
|
8082
|
-
|
|
9112
|
+
if (!isComponentContent2(content) || isWidgetComponent(content)) return false;
|
|
9113
|
+
const data = getToolStepData(content);
|
|
9114
|
+
const renderer = getComponentMessageRenderer(content, data);
|
|
9115
|
+
if (renderer) return renderer.presentation === "grouped-step";
|
|
9116
|
+
return data.category === "Tool";
|
|
8083
9117
|
}
|
|
8084
9118
|
function isSkippableToolGroupSeparator(content) {
|
|
8085
9119
|
if (typeof content === "string") return !content.trim();
|
|
8086
9120
|
if (!content) return true;
|
|
8087
|
-
if (
|
|
9121
|
+
if (isTextContent2(content)) {
|
|
8088
9122
|
return !content.text?.trim();
|
|
8089
9123
|
}
|
|
8090
|
-
if (
|
|
9124
|
+
if (isReasoningContent2(content)) {
|
|
8091
9125
|
return !content.text?.trim();
|
|
8092
9126
|
}
|
|
8093
9127
|
return false;
|
|
8094
9128
|
}
|
|
8095
|
-
function
|
|
9129
|
+
function normalizeToolToken3(value) {
|
|
8096
9130
|
if (typeof value !== "string") return null;
|
|
8097
9131
|
const normalized = value.trim().toLowerCase().replace(/[\s-]+/g, "_");
|
|
8098
9132
|
return normalized || null;
|
|
8099
9133
|
}
|
|
8100
9134
|
function classifyToolToken(value) {
|
|
8101
|
-
const normalized =
|
|
9135
|
+
const normalized = normalizeToolToken3(
|
|
8102
9136
|
typeof value === "string" ? value : resolveLocalizedText(value, "en-US")
|
|
8103
9137
|
);
|
|
8104
9138
|
if (!normalized) return null;
|
|
@@ -8137,8 +9171,8 @@ function getToolActivityLabel(content, language, statusOverride) {
|
|
|
8137
9171
|
if (status === "running") {
|
|
8138
9172
|
return message ?? title ?? tool ?? type ?? "Tool";
|
|
8139
9173
|
}
|
|
8140
|
-
const titleToken =
|
|
8141
|
-
const genericTitle = titleToken !== null && [tool, type].map((candidate) =>
|
|
9174
|
+
const titleToken = normalizeToolToken3(title);
|
|
9175
|
+
const genericTitle = titleToken !== null && [tool, type].map((candidate) => normalizeToolToken3(candidate)).some((candidate) => candidate === titleToken);
|
|
8142
9176
|
if (message && (!title || genericTitle)) {
|
|
8143
9177
|
return message;
|
|
8144
9178
|
}
|
|
@@ -8157,7 +9191,7 @@ function buildToolComponentRenderUnits(content, options) {
|
|
|
8157
9191
|
const units = [];
|
|
8158
9192
|
const pendingTools = [];
|
|
8159
9193
|
content.forEach((item, index) => {
|
|
8160
|
-
if (
|
|
9194
|
+
if (isGroupableStepComponent(item) && options?.shouldGroupComponent?.(item) !== false) {
|
|
8161
9195
|
pendingTools.push({ item, index });
|
|
8162
9196
|
return;
|
|
8163
9197
|
}
|
|
@@ -8222,13 +9256,13 @@ function createToolsetAvatarUrl(toolsetId, apiUrl) {
|
|
|
8222
9256
|
}
|
|
8223
9257
|
}
|
|
8224
9258
|
function shouldUseToolsetAvatar(toolset) {
|
|
8225
|
-
const normalized =
|
|
9259
|
+
const normalized = normalizeToolToken3(toolset);
|
|
8226
9260
|
return normalized === "mcp" || normalized === "openapi";
|
|
8227
9261
|
}
|
|
8228
9262
|
function useToolsetAvatar(toolsetId, enabled, apiUrl) {
|
|
8229
9263
|
const avatarUrl = enabled ? createToolsetAvatarUrl(toolsetId, apiUrl) : null;
|
|
8230
|
-
const [avatar, setAvatar] =
|
|
8231
|
-
|
|
9264
|
+
const [avatar, setAvatar] = React29.useState(null);
|
|
9265
|
+
React29.useEffect(() => {
|
|
8232
9266
|
if (!avatarUrl) {
|
|
8233
9267
|
setAvatar(null);
|
|
8234
9268
|
return;
|
|
@@ -8260,7 +9294,7 @@ function ToolAvatarIcon({
|
|
|
8260
9294
|
className
|
|
8261
9295
|
}) {
|
|
8262
9296
|
if (avatar.url) {
|
|
8263
|
-
return /* @__PURE__ */ (0,
|
|
9297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8264
9298
|
"img",
|
|
8265
9299
|
{
|
|
8266
9300
|
alt: "",
|
|
@@ -8273,7 +9307,7 @@ function ToolAvatarIcon({
|
|
|
8273
9307
|
}
|
|
8274
9308
|
const emoji = unicodeFromUnified2(avatar.emoji?.unified);
|
|
8275
9309
|
if (emoji) {
|
|
8276
|
-
return /* @__PURE__ */ (0,
|
|
9310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8277
9311
|
"span",
|
|
8278
9312
|
{
|
|
8279
9313
|
"aria-hidden": "true",
|
|
@@ -8288,8 +9322,8 @@ function ToolAvatarIcon({
|
|
|
8288
9322
|
}
|
|
8289
9323
|
);
|
|
8290
9324
|
}
|
|
8291
|
-
return /* @__PURE__ */ (0,
|
|
8292
|
-
|
|
9325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9326
|
+
import_lucide_react17.CircleHelp,
|
|
8293
9327
|
{
|
|
8294
9328
|
className,
|
|
8295
9329
|
"aria-hidden": "true",
|
|
@@ -8298,40 +9332,42 @@ function ToolAvatarIcon({
|
|
|
8298
9332
|
);
|
|
8299
9333
|
}
|
|
8300
9334
|
function getKnownToolsetIcon(toolset) {
|
|
8301
|
-
const normalized =
|
|
9335
|
+
const normalized = normalizeToolToken3(toolset);
|
|
8302
9336
|
if (!normalized) return null;
|
|
8303
9337
|
switch (normalized) {
|
|
8304
9338
|
case "project":
|
|
8305
|
-
return
|
|
9339
|
+
return import_lucide_react17.Building2;
|
|
8306
9340
|
case "transfer_to":
|
|
8307
|
-
return
|
|
9341
|
+
return import_lucide_react17.Repeat2;
|
|
8308
9342
|
case "knowledge":
|
|
8309
9343
|
case "knowledgebase":
|
|
8310
|
-
return
|
|
9344
|
+
return import_lucide_react17.BookOpen;
|
|
8311
9345
|
case "project_tasks":
|
|
8312
|
-
return
|
|
9346
|
+
return import_lucide_react17.ListTodo;
|
|
8313
9347
|
case "memories":
|
|
8314
|
-
return
|
|
9348
|
+
return import_lucide_react17.Brain;
|
|
8315
9349
|
case "workflow_agent_tool":
|
|
8316
|
-
return
|
|
9350
|
+
return import_lucide_react17.Wrench;
|
|
8317
9351
|
case "workflow_task":
|
|
8318
|
-
return
|
|
9352
|
+
return import_lucide_react17.Network;
|
|
8319
9353
|
default:
|
|
8320
9354
|
return null;
|
|
8321
9355
|
}
|
|
8322
9356
|
}
|
|
8323
9357
|
function getStepTypeIcon(type) {
|
|
8324
|
-
const normalized =
|
|
9358
|
+
const normalized = normalizeToolToken3(type);
|
|
8325
9359
|
if (!normalized) return null;
|
|
8326
9360
|
switch (normalized) {
|
|
8327
9361
|
case "file":
|
|
8328
|
-
return
|
|
9362
|
+
return import_lucide_react17.FileText;
|
|
8329
9363
|
case "files":
|
|
8330
|
-
return
|
|
9364
|
+
return import_lucide_react17.Files;
|
|
8331
9365
|
case "program":
|
|
8332
|
-
return
|
|
9366
|
+
return import_lucide_react17.SquareTerminal;
|
|
9367
|
+
case "web_search":
|
|
9368
|
+
return import_lucide_react17.Search;
|
|
8333
9369
|
case "knowledges":
|
|
8334
|
-
return
|
|
9370
|
+
return import_lucide_react17.BookOpen;
|
|
8335
9371
|
default:
|
|
8336
9372
|
return null;
|
|
8337
9373
|
}
|
|
@@ -8349,12 +9385,12 @@ function ToolStepIcon({
|
|
|
8349
9385
|
apiUrl
|
|
8350
9386
|
);
|
|
8351
9387
|
const iconUrl = createToolsetIconUrl(data.toolset, organizationId, apiUrl);
|
|
8352
|
-
const [failedIconUrl, setFailedIconUrl] =
|
|
8353
|
-
|
|
9388
|
+
const [failedIconUrl, setFailedIconUrl] = React29.useState(null);
|
|
9389
|
+
React29.useEffect(() => {
|
|
8354
9390
|
setFailedIconUrl(null);
|
|
8355
9391
|
}, [iconUrl]);
|
|
8356
9392
|
if (avatar) {
|
|
8357
|
-
return /* @__PURE__ */ (0,
|
|
9393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8358
9394
|
ToolAvatarIcon,
|
|
8359
9395
|
{
|
|
8360
9396
|
avatar,
|
|
@@ -8364,7 +9400,7 @@ function ToolStepIcon({
|
|
|
8364
9400
|
);
|
|
8365
9401
|
}
|
|
8366
9402
|
if (iconUrl && failedIconUrl !== iconUrl) {
|
|
8367
|
-
return /* @__PURE__ */ (0,
|
|
9403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8368
9404
|
"img",
|
|
8369
9405
|
{
|
|
8370
9406
|
alt: "",
|
|
@@ -8378,7 +9414,7 @@ function ToolStepIcon({
|
|
|
8378
9414
|
}
|
|
8379
9415
|
const TypeIcon = getStepTypeIcon(data.type);
|
|
8380
9416
|
if (TypeIcon) {
|
|
8381
|
-
return /* @__PURE__ */ (0,
|
|
9417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8382
9418
|
TypeIcon,
|
|
8383
9419
|
{
|
|
8384
9420
|
className,
|
|
@@ -8389,7 +9425,7 @@ function ToolStepIcon({
|
|
|
8389
9425
|
}
|
|
8390
9426
|
const ToolsetIcon = getKnownToolsetIcon(data.toolset);
|
|
8391
9427
|
if (ToolsetIcon) {
|
|
8392
|
-
return /* @__PURE__ */ (0,
|
|
9428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8393
9429
|
ToolsetIcon,
|
|
8394
9430
|
{
|
|
8395
9431
|
className,
|
|
@@ -8399,8 +9435,8 @@ function ToolStepIcon({
|
|
|
8399
9435
|
);
|
|
8400
9436
|
}
|
|
8401
9437
|
if (usesToolsetAvatar) {
|
|
8402
|
-
return /* @__PURE__ */ (0,
|
|
8403
|
-
|
|
9438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9439
|
+
import_lucide_react17.CircleHelp,
|
|
8404
9440
|
{
|
|
8405
9441
|
className,
|
|
8406
9442
|
"aria-hidden": "true",
|
|
@@ -8408,8 +9444,8 @@ function ToolStepIcon({
|
|
|
8408
9444
|
}
|
|
8409
9445
|
);
|
|
8410
9446
|
}
|
|
8411
|
-
return /* @__PURE__ */ (0,
|
|
8412
|
-
|
|
9447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9448
|
+
import_lucide_react17.CircleHelp,
|
|
8413
9449
|
{
|
|
8414
9450
|
className,
|
|
8415
9451
|
"aria-hidden": "true",
|
|
@@ -8419,15 +9455,15 @@ function ToolStepIcon({
|
|
|
8419
9455
|
}
|
|
8420
9456
|
function ToolCallCopyButton({ value }) {
|
|
8421
9457
|
const { t } = useChatkitTranslation();
|
|
8422
|
-
const [isCopied, setIsCopied] =
|
|
8423
|
-
const resetTimeoutRef =
|
|
8424
|
-
const clearResetTimeout =
|
|
9458
|
+
const [isCopied, setIsCopied] = React29.useState(false);
|
|
9459
|
+
const resetTimeoutRef = React29.useRef(null);
|
|
9460
|
+
const clearResetTimeout = React29.useCallback(() => {
|
|
8425
9461
|
if (resetTimeoutRef.current === null) return;
|
|
8426
9462
|
window.clearTimeout(resetTimeoutRef.current);
|
|
8427
9463
|
resetTimeoutRef.current = null;
|
|
8428
9464
|
}, []);
|
|
8429
|
-
|
|
8430
|
-
const handleCopy =
|
|
9465
|
+
React29.useEffect(() => clearResetTimeout, [clearResetTimeout]);
|
|
9466
|
+
const handleCopy = React29.useCallback(() => {
|
|
8431
9467
|
if (typeof navigator === "undefined" || !navigator.clipboard) return;
|
|
8432
9468
|
void navigator.clipboard.writeText(value).then(() => {
|
|
8433
9469
|
setIsCopied(true);
|
|
@@ -8439,7 +9475,7 @@ function ToolCallCopyButton({ value }) {
|
|
|
8439
9475
|
}).catch(() => void 0);
|
|
8440
9476
|
}, [clearResetTimeout, value]);
|
|
8441
9477
|
const label = isCopied ? t("message.toolGroup.copied") : t("message.toolGroup.copy");
|
|
8442
|
-
return /* @__PURE__ */ (0,
|
|
9478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8443
9479
|
"button",
|
|
8444
9480
|
{
|
|
8445
9481
|
type: "button",
|
|
@@ -8447,7 +9483,7 @@ function ToolCallCopyButton({ value }) {
|
|
|
8447
9483
|
"aria-label": label,
|
|
8448
9484
|
title: label,
|
|
8449
9485
|
onClick: handleCopy,
|
|
8450
|
-
children: isCopied ? /* @__PURE__ */ (0,
|
|
9486
|
+
children: isCopied ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react17.Check, { className: "h-3.5 w-3.5", "aria-hidden": "true" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react17.Copy, { className: "h-3.5 w-3.5", "aria-hidden": "true" })
|
|
8451
9487
|
}
|
|
8452
9488
|
);
|
|
8453
9489
|
}
|
|
@@ -8458,28 +9494,28 @@ function ToolCallValueBlock({
|
|
|
8458
9494
|
const { t } = useChatkitTranslation();
|
|
8459
9495
|
const detected = detectJsonValue(value);
|
|
8460
9496
|
if (detected.kind === "text") {
|
|
8461
|
-
return /* @__PURE__ */ (0,
|
|
8462
|
-
/* @__PURE__ */ (0,
|
|
8463
|
-
/* @__PURE__ */ (0,
|
|
9497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "min-w-0 space-y-1", children: [
|
|
9498
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ToolCallCopyButton, { value: detected.text }) }),
|
|
9499
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PlainTextBlock, { value: detected.text, destructive })
|
|
8464
9500
|
] });
|
|
8465
9501
|
}
|
|
8466
|
-
return /* @__PURE__ */ (0,
|
|
8467
|
-
/* @__PURE__ */ (0,
|
|
8468
|
-
/* @__PURE__ */ (0,
|
|
9502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Tabs, { defaultValue: "tree", className: "min-w-0", children: [
|
|
9503
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "mb-2 flex min-w-0 items-center justify-between gap-2", children: [
|
|
9504
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "min-w-0 truncate text-[11px] text-muted-foreground", children: [
|
|
8469
9505
|
t("message.toolGroup.jsonTitle"),
|
|
8470
9506
|
" \xB7 ",
|
|
8471
9507
|
getJsonValueSummary(detected.value)
|
|
8472
9508
|
] }),
|
|
8473
|
-
/* @__PURE__ */ (0,
|
|
8474
|
-
/* @__PURE__ */ (0,
|
|
8475
|
-
/* @__PURE__ */ (0,
|
|
8476
|
-
/* @__PURE__ */ (0,
|
|
8477
|
-
/* @__PURE__ */ (0,
|
|
9509
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
9510
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ToolCallCopyButton, { value: detected.raw }),
|
|
9511
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(TabsList, { className: "rounded-md p-0.5", children: [
|
|
9512
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TabsTrigger, { className: "px-2 py-0.5 text-[11px]", value: "tree", children: t("message.toolGroup.jsonTree") }),
|
|
9513
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TabsTrigger, { className: "px-2 py-0.5 text-[11px]", value: "raw", children: t("message.toolGroup.jsonRaw") })
|
|
8478
9514
|
] })
|
|
8479
9515
|
] })
|
|
8480
9516
|
] }),
|
|
8481
|
-
/* @__PURE__ */ (0,
|
|
8482
|
-
/* @__PURE__ */ (0,
|
|
9517
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TabsContent, { value: "tree", className: "mt-0", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(JsonTreeView, { value: detected.value }) }),
|
|
9518
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TabsContent, { value: "raw", className: "mt-0", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RawJsonBlock, { raw: detected.raw }) })
|
|
8483
9519
|
] });
|
|
8484
9520
|
}
|
|
8485
9521
|
function DefaultToolCallOutput({ data }) {
|
|
@@ -8487,31 +9523,37 @@ function DefaultToolCallOutput({ data }) {
|
|
|
8487
9523
|
const output = data.output ?? null;
|
|
8488
9524
|
const error = data.error ?? null;
|
|
8489
9525
|
if (error) {
|
|
8490
|
-
return /* @__PURE__ */ (0,
|
|
8491
|
-
/* @__PURE__ */ (0,
|
|
8492
|
-
/* @__PURE__ */ (0,
|
|
9526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "space-y-1", children: [
|
|
9527
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "text-[11px] font-medium text-destructive", children: t("message.toolGroup.errorTitle") }),
|
|
9528
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ToolCallValueBlock, { value: error, destructive: true })
|
|
8493
9529
|
] });
|
|
8494
9530
|
}
|
|
8495
9531
|
if (output === null) return null;
|
|
8496
|
-
return /* @__PURE__ */ (0,
|
|
8497
|
-
/* @__PURE__ */ (0,
|
|
8498
|
-
/* @__PURE__ */ (0,
|
|
9532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "space-y-1", children: [
|
|
9533
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "text-[11px] font-medium text-muted-foreground", children: t("message.toolGroup.outputTitle") }),
|
|
9534
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ToolCallValueBlock, { value: output })
|
|
8499
9535
|
] });
|
|
8500
9536
|
}
|
|
8501
9537
|
function ToolCallDetails({ content }) {
|
|
8502
9538
|
const { t } = useChatkitTranslation();
|
|
8503
9539
|
const data = getToolStepData(content);
|
|
9540
|
+
const renderer = getComponentMessageRenderer(content, data);
|
|
9541
|
+
const hasCustomDetails = data.error === void 0 && hasComponentMessageRendererDetails(renderer, content, data);
|
|
9542
|
+
const CustomDetailsRenderer = hasCustomDetails ? renderer?.renderDetails : void 0;
|
|
9543
|
+
if (CustomDetailsRenderer) {
|
|
9544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "ml-6 mt-1 max-h-60 overflow-auto rounded-md bg-muted/30 text-xs text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomDetailsRenderer, { content, data }) });
|
|
9545
|
+
}
|
|
8504
9546
|
const OutputRenderer = getToolCallOutputRenderer(data);
|
|
8505
9547
|
const hasInput = data.input !== void 0 && data.input !== null;
|
|
8506
9548
|
const hasOutput = data.error !== void 0 || data.output !== void 0;
|
|
8507
9549
|
if (!hasInput && !hasOutput) return null;
|
|
8508
|
-
return /* @__PURE__ */ (0,
|
|
8509
|
-
hasInput && /* @__PURE__ */ (0,
|
|
8510
|
-
/* @__PURE__ */ (0,
|
|
8511
|
-
/* @__PURE__ */ (0,
|
|
9550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "ml-6 mt-1 max-h-60 overflow-auto rounded-md bg-muted/30 px-3 py-2 text-xs text-muted-foreground", children: [
|
|
9551
|
+
hasInput && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "space-y-1", children: [
|
|
9552
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "text-[11px] font-medium text-muted-foreground", children: t("message.toolGroup.inputTitle") }),
|
|
9553
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ToolCallValueBlock, { value: data.input })
|
|
8512
9554
|
] }),
|
|
8513
|
-
hasInput && hasOutput ? /* @__PURE__ */ (0,
|
|
8514
|
-
hasOutput ? /* @__PURE__ */ (0,
|
|
9555
|
+
hasInput && hasOutput ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "h-2" }) : null,
|
|
9556
|
+
hasOutput ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(OutputRenderer, { content, data }) : null
|
|
8515
9557
|
] });
|
|
8516
9558
|
}
|
|
8517
9559
|
function areToolCallRowPropsEqual(previous, next) {
|
|
@@ -8527,9 +9569,11 @@ function ToolCallRowContent({
|
|
|
8527
9569
|
const data = getToolStepData(content);
|
|
8528
9570
|
const status = getEffectiveToolStepStatus(data, isThreadRunning);
|
|
8529
9571
|
const hasError = status === "fail" || Boolean(data.error);
|
|
8530
|
-
const
|
|
8531
|
-
const
|
|
8532
|
-
const
|
|
9572
|
+
const detailsId = React29.useId();
|
|
9573
|
+
const renderer = getComponentMessageRenderer(content, data);
|
|
9574
|
+
const label = renderer?.getTitle?.(content, data, i18n2.language) ?? getToolActivityLabel(content, i18n2.language, status);
|
|
9575
|
+
const hasCustomDetails = data.error === void 0 && hasComponentMessageRendererDetails(renderer, content, data);
|
|
9576
|
+
const hasDetails = data.input !== void 0 || data.error !== void 0 || data.output !== void 0 || hasCustomDetails;
|
|
8533
9577
|
const fallbackEndedAt = useFrozenTimestamp(
|
|
8534
9578
|
data.status === "running" && status === "fail"
|
|
8535
9579
|
);
|
|
@@ -8537,14 +9581,14 @@ function ToolCallRowContent({
|
|
|
8537
9581
|
status,
|
|
8538
9582
|
fallbackEndedAt
|
|
8539
9583
|
});
|
|
8540
|
-
const [isExpanded, setIsExpanded] =
|
|
8541
|
-
|
|
9584
|
+
const [isExpanded, setIsExpanded] = React29.useState(false);
|
|
9585
|
+
React29.useEffect(() => {
|
|
8542
9586
|
if (status === "running" && data.output !== void 0) {
|
|
8543
9587
|
setIsExpanded(true);
|
|
8544
9588
|
}
|
|
8545
9589
|
}, [data.output, status]);
|
|
8546
|
-
return /* @__PURE__ */ (0,
|
|
8547
|
-
/* @__PURE__ */ (0,
|
|
9590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("li", { className: "ck-tool-call-row-enter min-w-0", children: [
|
|
9591
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
8548
9592
|
"button",
|
|
8549
9593
|
{
|
|
8550
9594
|
type: "button",
|
|
@@ -8561,7 +9605,7 @@ function ToolCallRowContent({
|
|
|
8561
9605
|
if (hasDetails) setIsExpanded((prev) => !prev);
|
|
8562
9606
|
},
|
|
8563
9607
|
children: [
|
|
8564
|
-
status ? /* @__PURE__ */ (0,
|
|
9608
|
+
status ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8565
9609
|
ToolStepIcon,
|
|
8566
9610
|
{
|
|
8567
9611
|
data,
|
|
@@ -8572,8 +9616,8 @@ function ToolCallRowContent({
|
|
|
8572
9616
|
hasError ? "text-destructive" : "text-muted-foreground"
|
|
8573
9617
|
)
|
|
8574
9618
|
}
|
|
8575
|
-
) : /* @__PURE__ */ (0,
|
|
8576
|
-
/* @__PURE__ */ (0,
|
|
9619
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": "true" }),
|
|
9620
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8577
9621
|
"span",
|
|
8578
9622
|
{
|
|
8579
9623
|
className: cn(
|
|
@@ -8584,9 +9628,9 @@ function ToolCallRowContent({
|
|
|
8584
9628
|
children: label
|
|
8585
9629
|
}
|
|
8586
9630
|
),
|
|
8587
|
-
durationLabel ? /* @__PURE__ */ (0,
|
|
8588
|
-
hasDetails ? /* @__PURE__ */ (0,
|
|
8589
|
-
|
|
9631
|
+
durationLabel ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "shrink-0 text-[11px] tabular-nums text-muted-foreground/80", children: durationLabel }) : null,
|
|
9632
|
+
hasDetails ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9633
|
+
import_lucide_react17.ChevronRight,
|
|
8590
9634
|
{
|
|
8591
9635
|
"aria-hidden": "true",
|
|
8592
9636
|
className: cn(
|
|
@@ -8598,10 +9642,10 @@ function ToolCallRowContent({
|
|
|
8598
9642
|
]
|
|
8599
9643
|
}
|
|
8600
9644
|
),
|
|
8601
|
-
hasDetails && isExpanded ? /* @__PURE__ */ (0,
|
|
9645
|
+
hasDetails && isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { id: detailsId, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ToolCallDetails, { content }) }) : null
|
|
8602
9646
|
] });
|
|
8603
9647
|
}
|
|
8604
|
-
var ToolCallRow =
|
|
9648
|
+
var ToolCallRow = React29.memo(ToolCallRowContent, areToolCallRowPropsEqual);
|
|
8605
9649
|
ToolCallRow.displayName = "ToolCallRow";
|
|
8606
9650
|
function ToolComponentGroup({
|
|
8607
9651
|
items,
|
|
@@ -8611,8 +9655,8 @@ function ToolComponentGroup({
|
|
|
8611
9655
|
apiUrl
|
|
8612
9656
|
}) {
|
|
8613
9657
|
const { t } = useChatkitTranslation();
|
|
8614
|
-
const contentId =
|
|
8615
|
-
const [isExpanded, setIsExpanded] =
|
|
9658
|
+
const contentId = React29.useId();
|
|
9659
|
+
const [isExpanded, setIsExpanded] = React29.useState(!hasFollowingItem);
|
|
8616
9660
|
const categoryCounts = getToolGroupCategoryCounts(items);
|
|
8617
9661
|
const categorySummary = TOOL_GROUP_CATEGORY_ORDER.flatMap((category) => {
|
|
8618
9662
|
const count = categoryCounts[category] ?? 0;
|
|
@@ -8627,11 +9671,11 @@ function ToolComponentGroup({
|
|
|
8627
9671
|
const summary = `${t("message.toolGroup.status.success")} ${categorySummary}`;
|
|
8628
9672
|
const config = toolStatusConfig.success;
|
|
8629
9673
|
const StatusIcon = config.icon;
|
|
8630
|
-
|
|
9674
|
+
React29.useEffect(() => {
|
|
8631
9675
|
setIsExpanded(!hasFollowingItem);
|
|
8632
|
-
}, [hasFollowingItem
|
|
8633
|
-
return /* @__PURE__ */ (0,
|
|
8634
|
-
/* @__PURE__ */ (0,
|
|
9676
|
+
}, [hasFollowingItem]);
|
|
9677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "px-1 py-1", children: [
|
|
9678
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
8635
9679
|
"button",
|
|
8636
9680
|
{
|
|
8637
9681
|
type: "button",
|
|
@@ -8640,8 +9684,8 @@ function ToolComponentGroup({
|
|
|
8640
9684
|
"aria-controls": contentId,
|
|
8641
9685
|
onClick: () => setIsExpanded((prev) => !prev),
|
|
8642
9686
|
children: [
|
|
8643
|
-
/* @__PURE__ */ (0,
|
|
8644
|
-
/* @__PURE__ */ (0,
|
|
9687
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex min-w-0 items-center gap-2 text-sm font-medium text-muted-foreground", children: [
|
|
9688
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8645
9689
|
StatusIcon,
|
|
8646
9690
|
{
|
|
8647
9691
|
className: cn(
|
|
@@ -8650,10 +9694,10 @@ function ToolComponentGroup({
|
|
|
8650
9694
|
)
|
|
8651
9695
|
}
|
|
8652
9696
|
),
|
|
8653
|
-
/* @__PURE__ */ (0,
|
|
9697
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "truncate", children: summary })
|
|
8654
9698
|
] }),
|
|
8655
|
-
/* @__PURE__ */ (0,
|
|
8656
|
-
|
|
9699
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9700
|
+
import_lucide_react17.ChevronRight,
|
|
8657
9701
|
{
|
|
8658
9702
|
"aria-hidden": "true",
|
|
8659
9703
|
className: cn(
|
|
@@ -8665,7 +9709,7 @@ function ToolComponentGroup({
|
|
|
8665
9709
|
]
|
|
8666
9710
|
}
|
|
8667
9711
|
),
|
|
8668
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
9712
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("ul", { id: contentId, className: "mt-2 space-y-1.5 overflow-y-auto pr-1", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8669
9713
|
ToolCallRow,
|
|
8670
9714
|
{
|
|
8671
9715
|
content: item,
|
|
@@ -8679,14 +9723,14 @@ function ToolComponentGroup({
|
|
|
8679
9723
|
}
|
|
8680
9724
|
|
|
8681
9725
|
// src/components/thread/messages/request-user-input-result-card.tsx
|
|
8682
|
-
var
|
|
8683
|
-
var
|
|
8684
|
-
var
|
|
8685
|
-
var
|
|
8686
|
-
function
|
|
9726
|
+
var React30 = require("react");
|
|
9727
|
+
var import_chatkit_types6 = require("@xpert-ai/chatkit-types");
|
|
9728
|
+
var import_lucide_react18 = require("lucide-react");
|
|
9729
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
9730
|
+
function isRecord3(value) {
|
|
8687
9731
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
8688
9732
|
}
|
|
8689
|
-
function
|
|
9733
|
+
function readString2(record, keys) {
|
|
8690
9734
|
for (const key of keys) {
|
|
8691
9735
|
const value = record[key];
|
|
8692
9736
|
if (typeof value === "string" && value.trim()) {
|
|
@@ -8696,12 +9740,12 @@ function readString(record, keys) {
|
|
|
8696
9740
|
return null;
|
|
8697
9741
|
}
|
|
8698
9742
|
function getToolCallId(value) {
|
|
8699
|
-
if (!
|
|
8700
|
-
return
|
|
9743
|
+
if (!isRecord3(value)) return null;
|
|
9744
|
+
return readString2(value, ["id"]);
|
|
8701
9745
|
}
|
|
8702
9746
|
function getToolCallName(value) {
|
|
8703
|
-
if (!
|
|
8704
|
-
return
|
|
9747
|
+
if (!isRecord3(value)) return null;
|
|
9748
|
+
return readString2(value, ["name"]);
|
|
8705
9749
|
}
|
|
8706
9750
|
function pushClientToolCallsFromRecord(record, calls) {
|
|
8707
9751
|
const clientToolCalls = record.clientToolCalls;
|
|
@@ -8721,20 +9765,20 @@ function collectPotentialToolCalls(messages) {
|
|
|
8721
9765
|
function findRequestUserInputClientToolCallById(messages, id) {
|
|
8722
9766
|
if (!id) return null;
|
|
8723
9767
|
return collectPotentialToolCalls(messages).find(
|
|
8724
|
-
(call) => getToolCallId(call) === id && getToolCallName(call) ===
|
|
9768
|
+
(call) => getToolCallId(call) === id && getToolCallName(call) === import_chatkit_types6.REQUEST_USER_INPUT_TOOL_NAME
|
|
8725
9769
|
) ?? null;
|
|
8726
9770
|
}
|
|
8727
9771
|
function normalizeAnswer(value) {
|
|
8728
|
-
if (!
|
|
8729
|
-
const id =
|
|
8730
|
-
const question =
|
|
8731
|
-
const answerValue =
|
|
8732
|
-
const type =
|
|
9772
|
+
if (!isRecord3(value)) return null;
|
|
9773
|
+
const id = readString2(value, ["id"]);
|
|
9774
|
+
const question = readString2(value, ["question"]);
|
|
9775
|
+
const answerValue = readString2(value, ["value"]);
|
|
9776
|
+
const type = readString2(value, ["type"]);
|
|
8733
9777
|
if (!id || !question || !answerValue || type !== "option" && type !== "other") {
|
|
8734
9778
|
return null;
|
|
8735
9779
|
}
|
|
8736
|
-
const label =
|
|
8737
|
-
const description =
|
|
9780
|
+
const label = readString2(value, ["label"]);
|
|
9781
|
+
const description = readString2(value, ["description"]);
|
|
8738
9782
|
return {
|
|
8739
9783
|
id,
|
|
8740
9784
|
question,
|
|
@@ -8753,10 +9797,10 @@ function parseResultOutput(output) {
|
|
|
8753
9797
|
return null;
|
|
8754
9798
|
}
|
|
8755
9799
|
}
|
|
8756
|
-
if (!
|
|
9800
|
+
if (!isRecord3(result) || !Array.isArray(result.answers)) {
|
|
8757
9801
|
return null;
|
|
8758
9802
|
}
|
|
8759
|
-
const hasExplicitType = result.type ===
|
|
9803
|
+
const hasExplicitType = result.type === import_chatkit_types6.REQUEST_USER_INPUT_RESULT_TYPE;
|
|
8760
9804
|
const answers = result.answers.map(normalizeAnswer);
|
|
8761
9805
|
if (answers.some((answer) => answer === null)) {
|
|
8762
9806
|
return null;
|
|
@@ -8767,7 +9811,7 @@ function parseResultOutput(output) {
|
|
|
8767
9811
|
};
|
|
8768
9812
|
}
|
|
8769
9813
|
function getRequestUserInputResultCardData(content, messages) {
|
|
8770
|
-
const data =
|
|
9814
|
+
const data = isRecord3(content.data) ? content.data : null;
|
|
8771
9815
|
if (data?.status !== "success") {
|
|
8772
9816
|
return null;
|
|
8773
9817
|
}
|
|
@@ -8794,7 +9838,7 @@ function RequestUserInputResultCard({
|
|
|
8794
9838
|
className
|
|
8795
9839
|
}) {
|
|
8796
9840
|
const { t } = useChatkitTranslation();
|
|
8797
|
-
return /* @__PURE__ */ (0,
|
|
9841
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8798
9842
|
"section",
|
|
8799
9843
|
{
|
|
8800
9844
|
"aria-label": t("message.requestUserInputResult.title"),
|
|
@@ -8803,23 +9847,23 @@ function RequestUserInputResultCard({
|
|
|
8803
9847
|
className
|
|
8804
9848
|
),
|
|
8805
9849
|
children: [
|
|
8806
|
-
/* @__PURE__ */ (0,
|
|
8807
|
-
/* @__PURE__ */ (0,
|
|
8808
|
-
/* @__PURE__ */ (0,
|
|
9850
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mb-2 flex items-center gap-2 text-sm font-semibold text-foreground", children: [
|
|
9851
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react18.CheckCircle2, { className: "h-4 w-4 text-primary" }),
|
|
9852
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: t("message.requestUserInputResult.title") })
|
|
8809
9853
|
] }),
|
|
8810
|
-
/* @__PURE__ */ (0,
|
|
9854
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "space-y-2", children: result.answers.map((answer, index) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8811
9855
|
"div",
|
|
8812
9856
|
{
|
|
8813
9857
|
className: "rounded-md bg-background/70 px-2.5 py-2",
|
|
8814
9858
|
children: [
|
|
8815
|
-
/* @__PURE__ */ (0,
|
|
8816
|
-
/* @__PURE__ */ (0,
|
|
8817
|
-
/* @__PURE__ */ (0,
|
|
8818
|
-
/* @__PURE__ */ (0,
|
|
9859
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "text-xs font-medium leading-5 text-muted-foreground", children: answer.question }),
|
|
9860
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mt-0.5 flex min-w-0 flex-wrap items-center gap-1.5", children: [
|
|
9861
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "min-w-0 wrap-break-word text-sm font-semibold text-foreground", children: answer.label ?? answer.value }),
|
|
9862
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "rounded-full bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground", children: t(
|
|
8819
9863
|
answer.type === "other" ? "message.requestUserInputResult.other" : "message.requestUserInputResult.option"
|
|
8820
9864
|
) })
|
|
8821
9865
|
] }),
|
|
8822
|
-
answer.description ? /* @__PURE__ */ (0,
|
|
9866
|
+
answer.description ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mt-1 text-xs leading-5 text-muted-foreground", children: answer.description }) : null
|
|
8823
9867
|
]
|
|
8824
9868
|
},
|
|
8825
9869
|
`${answer.id}-${index}`
|
|
@@ -8831,18 +9875,18 @@ function RequestUserInputResultCard({
|
|
|
8831
9875
|
|
|
8832
9876
|
// src/components/thread/messages/widget.tsx
|
|
8833
9877
|
var import_a2ui_react = require("@xpert-ai/a2ui-react");
|
|
8834
|
-
var
|
|
9878
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
8835
9879
|
function WidgetMessage({ messageId, data }) {
|
|
8836
9880
|
const widgets = Array.isArray(data.widgets) ? data.widgets : [];
|
|
8837
9881
|
if (widgets.length === 0) return null;
|
|
8838
9882
|
const baseSurfaceId = `widget-${messageId}`;
|
|
8839
|
-
return /* @__PURE__ */ (0,
|
|
9883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "space-y-3", children: widgets.map((widget, index) => {
|
|
8840
9884
|
const config = widget?.config;
|
|
8841
9885
|
if (!config || typeof config !== "object") {
|
|
8842
9886
|
return null;
|
|
8843
9887
|
}
|
|
8844
9888
|
const surfaceId = widgets.length > 1 ? `${baseSurfaceId}-${index}` : baseSurfaceId;
|
|
8845
|
-
return /* @__PURE__ */ (0,
|
|
9889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
8846
9890
|
import_a2ui_react.SurfaceRenderer,
|
|
8847
9891
|
{
|
|
8848
9892
|
surfaceId,
|
|
@@ -8854,17 +9898,18 @@ function WidgetMessage({ messageId, data }) {
|
|
|
8854
9898
|
}
|
|
8855
9899
|
|
|
8856
9900
|
// src/components/thread/messages/ai.tsx
|
|
8857
|
-
var
|
|
8858
|
-
|
|
9901
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
9902
|
+
var assistantMessageStackClassName = "space-y-3 in-data-[density=compact]:space-y-2 in-data-[density=spacious]:space-y-4";
|
|
9903
|
+
function isTextContent3(content) {
|
|
8859
9904
|
return content.type === "text";
|
|
8860
9905
|
}
|
|
8861
|
-
function
|
|
9906
|
+
function isReasoningContent3(content) {
|
|
8862
9907
|
return content.type === "reasoning";
|
|
8863
9908
|
}
|
|
8864
9909
|
function isImageContent(content) {
|
|
8865
9910
|
return content.type === "image_url";
|
|
8866
9911
|
}
|
|
8867
|
-
function
|
|
9912
|
+
function isComponentContent3(content) {
|
|
8868
9913
|
return content.type === "component";
|
|
8869
9914
|
}
|
|
8870
9915
|
function isWidgetComponent2(content) {
|
|
@@ -8874,24 +9919,24 @@ function isWidgetComponent2(content) {
|
|
|
8874
9919
|
function isMemoryContent(content) {
|
|
8875
9920
|
return content.type === "memory";
|
|
8876
9921
|
}
|
|
8877
|
-
function
|
|
9922
|
+
function safeJson3(value) {
|
|
8878
9923
|
try {
|
|
8879
9924
|
return JSON.stringify(value, null, 2);
|
|
8880
9925
|
} catch {
|
|
8881
9926
|
return String(value);
|
|
8882
9927
|
}
|
|
8883
9928
|
}
|
|
8884
|
-
function
|
|
8885
|
-
return typeof value === "string" ? value :
|
|
9929
|
+
function formatDisplayValue3(value) {
|
|
9930
|
+
return typeof value === "string" ? value : safeJson3(value);
|
|
8886
9931
|
}
|
|
8887
9932
|
function ReasoningBlock({ reasoning }) {
|
|
8888
9933
|
const blocks = reasoning.filter((item) => item.text?.trim());
|
|
8889
9934
|
if (blocks.length === 0) return null;
|
|
8890
|
-
return /* @__PURE__ */ (0,
|
|
9935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "space-y-2", children: blocks.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8891
9936
|
"div",
|
|
8892
9937
|
{
|
|
8893
9938
|
className: "rounded-lg border bg-muted/40 p-3 text-xs text-muted-foreground",
|
|
8894
|
-
children: /* @__PURE__ */ (0,
|
|
9939
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "whitespace-pre-wrap wrap-break-word leading-relaxed", children: item.text })
|
|
8895
9940
|
},
|
|
8896
9941
|
item.id ?? `reasoning-${index}`
|
|
8897
9942
|
)) });
|
|
@@ -8899,20 +9944,20 @@ function ReasoningBlock({ reasoning }) {
|
|
|
8899
9944
|
function ImageBlock({ content }) {
|
|
8900
9945
|
const imageUrl = typeof content.image_url === "string" ? content.image_url : typeof content.image_url?.url === "string" ? content.image_url.url : null;
|
|
8901
9946
|
if (!imageUrl) {
|
|
8902
|
-
return /* @__PURE__ */ (0,
|
|
8903
|
-
/* @__PURE__ */ (0,
|
|
8904
|
-
/* @__PURE__ */ (0,
|
|
9947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Card, { children: [
|
|
9948
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CardHeader, { className: "space-y-1", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CardTitle, { className: "text-sm", children: "Image" }) }),
|
|
9949
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: safeJson3(content) })
|
|
8905
9950
|
] });
|
|
8906
9951
|
}
|
|
8907
|
-
return /* @__PURE__ */ (0,
|
|
9952
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("figure", { className: "overflow-hidden rounded-lg border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("img", { src: imageUrl, alt: "Assistant output", className: "h-auto w-full object-cover" }) });
|
|
8908
9953
|
}
|
|
8909
9954
|
function MemoryBlock({ content }) {
|
|
8910
|
-
return /* @__PURE__ */ (0,
|
|
8911
|
-
/* @__PURE__ */ (0,
|
|
8912
|
-
/* @__PURE__ */ (0,
|
|
8913
|
-
/* @__PURE__ */ (0,
|
|
9955
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Card, { children: [
|
|
9956
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
9957
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CardTitle, { className: "text-sm", children: "Memory" }),
|
|
9958
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Badge, { variant: "secondary", children: "Memory" })
|
|
8914
9959
|
] }),
|
|
8915
|
-
/* @__PURE__ */ (0,
|
|
9960
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: safeJson3(content.data ?? []) }) })
|
|
8916
9961
|
] });
|
|
8917
9962
|
}
|
|
8918
9963
|
function parseStepDate2(value) {
|
|
@@ -8926,7 +9971,7 @@ function parseStepDate2(value) {
|
|
|
8926
9971
|
const timestamp = Date.parse(value);
|
|
8927
9972
|
return Number.isNaN(timestamp) ? null : timestamp;
|
|
8928
9973
|
}
|
|
8929
|
-
function
|
|
9974
|
+
function formatStepDuration3(durationMs) {
|
|
8930
9975
|
if (durationMs < 1e3) {
|
|
8931
9976
|
return `${durationMs}ms`;
|
|
8932
9977
|
}
|
|
@@ -8946,11 +9991,11 @@ function formatStepDuration2(durationMs) {
|
|
|
8946
9991
|
}
|
|
8947
9992
|
function ComponentBlock({ content }) {
|
|
8948
9993
|
const { i18n: i18n2 } = useChatkitTranslation();
|
|
8949
|
-
const [isExpanded, setIsExpanded] =
|
|
8950
|
-
const contentRef =
|
|
8951
|
-
const shouldAutoScrollRef =
|
|
8952
|
-
const previousScrollTopRef =
|
|
8953
|
-
const [durationNow, setDurationNow] =
|
|
9994
|
+
const [isExpanded, setIsExpanded] = React31.useState(false);
|
|
9995
|
+
const contentRef = React31.useRef(null);
|
|
9996
|
+
const shouldAutoScrollRef = React31.useRef(true);
|
|
9997
|
+
const previousScrollTopRef = React31.useRef(0);
|
|
9998
|
+
const [durationNow, setDurationNow] = React31.useState(() => Date.now());
|
|
8954
9999
|
const data = getToolStepData(content);
|
|
8955
10000
|
const category = data.category ?? "Component";
|
|
8956
10001
|
const title = getToolActivityLabel(content, i18n2.language);
|
|
@@ -8963,11 +10008,11 @@ function ComponentBlock({ content }) {
|
|
|
8963
10008
|
const createdAt = parseStepDate2(data.created_date);
|
|
8964
10009
|
const endedAt = parseStepDate2(data.end_date);
|
|
8965
10010
|
const durationMs = createdAt === null ? null : Math.max(0, (endedAt ?? durationNow) - createdAt);
|
|
8966
|
-
const durationLabel = durationMs === null ? null :
|
|
8967
|
-
|
|
10011
|
+
const durationLabel = durationMs === null ? null : formatStepDuration3(durationMs);
|
|
10012
|
+
React31.useEffect(() => {
|
|
8968
10013
|
if (status === "running" && output !== null) setIsExpanded(true);
|
|
8969
10014
|
}, [status, output]);
|
|
8970
|
-
|
|
10015
|
+
React31.useEffect(() => {
|
|
8971
10016
|
if (status !== "running" || createdAt === null || endedAt !== null) {
|
|
8972
10017
|
return;
|
|
8973
10018
|
}
|
|
@@ -8979,7 +10024,7 @@ function ComponentBlock({ content }) {
|
|
|
8979
10024
|
window.clearInterval(timer);
|
|
8980
10025
|
};
|
|
8981
10026
|
}, [createdAt, endedAt, status]);
|
|
8982
|
-
|
|
10027
|
+
React31.useEffect(() => {
|
|
8983
10028
|
const element = contentRef.current;
|
|
8984
10029
|
if (!element) return;
|
|
8985
10030
|
previousScrollTopRef.current = element.scrollTop;
|
|
@@ -8999,7 +10044,7 @@ function ComponentBlock({ content }) {
|
|
|
8999
10044
|
element.removeEventListener("scroll", updateAutoScrollState);
|
|
9000
10045
|
};
|
|
9001
10046
|
}, [isExpanded]);
|
|
9002
|
-
|
|
10047
|
+
React31.useEffect(() => {
|
|
9003
10048
|
if (status !== "running") {
|
|
9004
10049
|
shouldAutoScrollRef.current = true;
|
|
9005
10050
|
return;
|
|
@@ -9012,25 +10057,25 @@ function ComponentBlock({ content }) {
|
|
|
9012
10057
|
}, [isExpanded, output, status]);
|
|
9013
10058
|
const config = status ? toolStatusConfig[status] : null;
|
|
9014
10059
|
const StatusIcon = config?.icon;
|
|
9015
|
-
return /* @__PURE__ */ (0,
|
|
9016
|
-
/* @__PURE__ */ (0,
|
|
9017
|
-
/* @__PURE__ */ (0,
|
|
9018
|
-
status && StatusIcon && /* @__PURE__ */ (0,
|
|
9019
|
-
/* @__PURE__ */ (0,
|
|
10060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Card, { children: [
|
|
10061
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(CardHeader, { className: "flex flex-row items-center justify-between gap-2 px-2 py-1 cursor-pointer", onClick: () => setIsExpanded(!isExpanded), children: [
|
|
10062
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center space-x-1 flex-1 min-w-0", children: [
|
|
10063
|
+
status && StatusIcon && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(StatusIcon, { className: cn("h-4 w-4", config?.iconClass, status === "running" && "animate-spin") }),
|
|
10064
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CardTitle, { className: "text-sm truncate", children: title })
|
|
9020
10065
|
] }),
|
|
9021
|
-
/* @__PURE__ */ (0,
|
|
9022
|
-
durationLabel && /* @__PURE__ */ (0,
|
|
9023
|
-
/* @__PURE__ */ (0,
|
|
9024
|
-
/* @__PURE__ */ (0,
|
|
10066
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-wrap items-center gap-2 shrink-0", children: [
|
|
10067
|
+
durationLabel && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "inline-flex items-center gap-1 text-[11px] text-muted-foreground tabular-nums", children: [
|
|
10068
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react19.Clock3, { className: "h-3 w-3" }),
|
|
10069
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: durationLabel })
|
|
9025
10070
|
] }),
|
|
9026
|
-
/* @__PURE__ */ (0,
|
|
9027
|
-
/* @__PURE__ */ (0,
|
|
10071
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Badge, { variant: "secondary", className: "rounded-lg px-1.5", children: category }),
|
|
10072
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
9028
10073
|
"button",
|
|
9029
10074
|
{
|
|
9030
10075
|
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
9031
10076
|
"aria-label": isExpanded ? "Collapse" : "Expand",
|
|
9032
|
-
children: /* @__PURE__ */ (0,
|
|
9033
|
-
|
|
10077
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
10078
|
+
import_lucide_react19.ChevronDown,
|
|
9034
10079
|
{
|
|
9035
10080
|
className: cn("h-4 w-4 transition-transform", isExpanded && "rotate-180")
|
|
9036
10081
|
}
|
|
@@ -9039,85 +10084,174 @@ function ComponentBlock({ content }) {
|
|
|
9039
10084
|
)
|
|
9040
10085
|
] })
|
|
9041
10086
|
] }),
|
|
9042
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
9043
|
-
data.input && /* @__PURE__ */ (0,
|
|
9044
|
-
error ? /* @__PURE__ */ (0,
|
|
10087
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(CardContent, { ref: contentRef, className: "text-xs text-muted-foreground max-h-60 overflow-auto", children: [
|
|
10088
|
+
data.input && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue3(data.input) }),
|
|
10089
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word text-destructive", children: formatDisplayValue3(error) }) : hasOutput && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue3(fallback) })
|
|
9045
10090
|
] })
|
|
9046
10091
|
] });
|
|
9047
10092
|
}
|
|
9048
10093
|
function UnknownBlock({ content }) {
|
|
9049
|
-
return /* @__PURE__ */ (0,
|
|
9050
|
-
/* @__PURE__ */ (0,
|
|
9051
|
-
/* @__PURE__ */ (0,
|
|
9052
|
-
/* @__PURE__ */ (0,
|
|
10094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Card, { children: [
|
|
10095
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
10096
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CardTitle, { className: "text-sm", children: "Assistant Content" }),
|
|
10097
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Badge, { variant: "outline", children: content.type ?? "unknown" })
|
|
9053
10098
|
] }),
|
|
9054
|
-
/* @__PURE__ */ (0,
|
|
10099
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("pre", { className: "whitespace-pre-wrap break-words", children: safeJson3(content) }) })
|
|
9055
10100
|
] });
|
|
9056
10101
|
}
|
|
9057
|
-
function renderContentItem(content, index, message, lookupMessages) {
|
|
10102
|
+
function renderContentItem(content, index, message, lookupMessages, options) {
|
|
9058
10103
|
const messageId = message.id;
|
|
10104
|
+
const textClassName = options?.isAgentOutput ? "text-sm [&_.markdown-content_p]:!leading-6" : void 0;
|
|
9059
10105
|
if (typeof content === "string") {
|
|
9060
|
-
return /* @__PURE__ */ (0,
|
|
10106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: textClassName, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(MarkdownText, { children: content }) }, `text-${index}`);
|
|
9061
10107
|
}
|
|
9062
|
-
if (
|
|
9063
|
-
return /* @__PURE__ */ (0,
|
|
10108
|
+
if (isTextContent3(content)) {
|
|
10109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: textClassName, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(MarkdownText, { children: content.text }) }, content.id ?? `text-${index}`);
|
|
9064
10110
|
}
|
|
9065
|
-
if (
|
|
9066
|
-
return /* @__PURE__ */ (0,
|
|
10111
|
+
if (isReasoningContent3(content)) {
|
|
10112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ReasoningBlock, { reasoning: [content] }) }, content.id ?? `reasoning-${index}`);
|
|
9067
10113
|
}
|
|
9068
10114
|
if (isImageContent(content)) {
|
|
9069
|
-
return /* @__PURE__ */ (0,
|
|
10115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ImageBlock, { content }) }, content.id ?? `image-${index}`);
|
|
9070
10116
|
}
|
|
9071
|
-
if (
|
|
10117
|
+
if (isComponentContent3(content)) {
|
|
9072
10118
|
const requestUserInputResult = getRequestUserInputResultCardData(
|
|
9073
10119
|
content,
|
|
9074
10120
|
lookupMessages
|
|
9075
10121
|
);
|
|
9076
10122
|
if (requestUserInputResult) {
|
|
9077
|
-
return /* @__PURE__ */ (0,
|
|
10123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(RequestUserInputResultCard, { result: requestUserInputResult }) }, content.id ?? `request-user-input-result-${index}`);
|
|
9078
10124
|
}
|
|
9079
10125
|
if (isWidgetComponent2(content)) {
|
|
9080
|
-
return /* @__PURE__ */ (0,
|
|
10126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(WidgetMessage, { messageId, data: content.data }) }, content.id ?? `widget-${index}`);
|
|
10127
|
+
}
|
|
10128
|
+
if (getComponentMessagePresentation(content, getToolStepData(content)) === "grouped-step") {
|
|
10129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
10130
|
+
ToolComponentGroup,
|
|
10131
|
+
{
|
|
10132
|
+
items: [content],
|
|
10133
|
+
hasFollowingItem: false,
|
|
10134
|
+
isThreadRunning: options?.isThreadRunning,
|
|
10135
|
+
organizationId: options?.organizationId,
|
|
10136
|
+
apiUrl: options?.apiUrl
|
|
10137
|
+
}
|
|
10138
|
+
) }, content.id ?? `component-group-${index}`);
|
|
9081
10139
|
}
|
|
9082
|
-
return /* @__PURE__ */ (0,
|
|
10140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ComponentBlock, { content }) }, content.id ?? `component-${index}`);
|
|
9083
10141
|
}
|
|
9084
10142
|
if (isMemoryContent(content)) {
|
|
9085
|
-
return /* @__PURE__ */ (0,
|
|
10143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(MemoryBlock, { content }) }, content.id ?? `memory-${index}`);
|
|
9086
10144
|
}
|
|
9087
|
-
|
|
10145
|
+
if (isAgentEventContent(content)) {
|
|
10146
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AgentEventRow, { content }) }, content.id ?? `agent-event-${index}`);
|
|
10147
|
+
}
|
|
10148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(UnknownBlock, { content }) }, content.id ?? `unknown-${index}`);
|
|
9088
10149
|
}
|
|
9089
10150
|
function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, options) {
|
|
9090
10151
|
if (unit.type === "item") {
|
|
9091
|
-
return renderContentItem(unit.item, unit.index, message, lookupMessages
|
|
10152
|
+
return renderContentItem(unit.item, unit.index, message, lookupMessages, {
|
|
10153
|
+
isThreadRunning: options?.isThreadRunning,
|
|
10154
|
+
organizationId: options?.organizationId,
|
|
10155
|
+
apiUrl: options?.apiUrl,
|
|
10156
|
+
isAgentOutput: options?.isAgentOutput
|
|
10157
|
+
});
|
|
9092
10158
|
}
|
|
9093
|
-
return /* @__PURE__ */ (0,
|
|
9094
|
-
|
|
10159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
10160
|
+
ToolComponentGroup,
|
|
9095
10161
|
{
|
|
9096
|
-
|
|
9097
|
-
|
|
10162
|
+
items: unit.items,
|
|
10163
|
+
hasFollowingItem,
|
|
10164
|
+
isThreadRunning: options?.isThreadRunning,
|
|
10165
|
+
organizationId: options?.organizationId,
|
|
10166
|
+
apiUrl: options?.apiUrl
|
|
10167
|
+
}
|
|
10168
|
+
) }, `tool-group-${unit.startIndex}-${unit.items[0]?.id ?? "tool"}`);
|
|
10169
|
+
}
|
|
10170
|
+
function renderEntryBatch(entries, message, lookupMessages, hasFollowingItem, options) {
|
|
10171
|
+
if (entries.length === 0) return null;
|
|
10172
|
+
const renderUnits = buildToolComponentRenderUnits(
|
|
10173
|
+
entries.map((entry) => entry.item),
|
|
10174
|
+
{
|
|
10175
|
+
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null
|
|
10176
|
+
}
|
|
10177
|
+
);
|
|
10178
|
+
return renderUnits.map(
|
|
10179
|
+
(unit, index) => renderContentUnit(
|
|
10180
|
+
unit,
|
|
10181
|
+
message,
|
|
10182
|
+
lookupMessages,
|
|
10183
|
+
index < renderUnits.length - 1 || hasFollowingItem,
|
|
10184
|
+
options
|
|
10185
|
+
)
|
|
10186
|
+
);
|
|
10187
|
+
}
|
|
10188
|
+
function renderAssistantRenderUnits(units, message, lookupMessages, options, depth = 0) {
|
|
10189
|
+
const rendered = [];
|
|
10190
|
+
let entryBatch = [];
|
|
10191
|
+
const flushEntries = (hasFollowingItem) => {
|
|
10192
|
+
if (entryBatch.length === 0) return;
|
|
10193
|
+
const batch = entryBatch;
|
|
10194
|
+
entryBatch = [];
|
|
10195
|
+
rendered.push(
|
|
10196
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(React31.Fragment, { children: renderEntryBatch(batch, message, lookupMessages, hasFollowingItem, {
|
|
10197
|
+
...options,
|
|
10198
|
+
isAgentOutput: depth > 0
|
|
10199
|
+
}) }, `entries-${batch[0]?.order ?? rendered.length}`)
|
|
10200
|
+
);
|
|
10201
|
+
};
|
|
10202
|
+
units.forEach((unit, index) => {
|
|
10203
|
+
const hasFollowingItem = index < units.length - 1;
|
|
10204
|
+
if (unit.type === "entry") {
|
|
10205
|
+
entryBatch.push(unit.entry);
|
|
10206
|
+
if (!hasFollowingItem) {
|
|
10207
|
+
flushEntries(false);
|
|
10208
|
+
}
|
|
10209
|
+
return;
|
|
10210
|
+
}
|
|
10211
|
+
flushEntries(true);
|
|
10212
|
+
rendered.push(
|
|
10213
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
10214
|
+
AgentRunGroup,
|
|
9098
10215
|
{
|
|
9099
|
-
|
|
10216
|
+
node: unit.node,
|
|
9100
10217
|
hasFollowingItem,
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9104
|
-
|
|
10218
|
+
depth,
|
|
10219
|
+
renderUnits: (childUnits, nextDepth) => renderAssistantRenderUnits(
|
|
10220
|
+
childUnits,
|
|
10221
|
+
message,
|
|
10222
|
+
lookupMessages,
|
|
10223
|
+
options,
|
|
10224
|
+
nextDepth
|
|
10225
|
+
)
|
|
10226
|
+
},
|
|
10227
|
+
unit.node.id
|
|
9105
10228
|
)
|
|
9106
|
-
|
|
9107
|
-
|
|
9108
|
-
|
|
10229
|
+
);
|
|
10230
|
+
});
|
|
10231
|
+
return rendered;
|
|
9109
10232
|
}
|
|
9110
10233
|
function renderContent(message, lookupMessages, options) {
|
|
10234
|
+
const renderTree = buildAssistantRenderTree(
|
|
10235
|
+
message
|
|
10236
|
+
);
|
|
10237
|
+
if (renderTree.hasAgentRuns) {
|
|
10238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: assistantMessageStackClassName, children: renderAssistantRenderUnits(
|
|
10239
|
+
renderTree.units,
|
|
10240
|
+
message,
|
|
10241
|
+
lookupMessages,
|
|
10242
|
+
options
|
|
10243
|
+
) });
|
|
10244
|
+
}
|
|
9111
10245
|
const content = message.content;
|
|
9112
10246
|
if (typeof content === "string") {
|
|
9113
10247
|
if (!content.trim()) return null;
|
|
9114
|
-
return /* @__PURE__ */ (0,
|
|
10248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(MarkdownText, { children: content });
|
|
9115
10249
|
}
|
|
9116
10250
|
if (!Array.isArray(content) || content.length === 0) return null;
|
|
9117
10251
|
const renderUnits = buildToolComponentRenderUnits(content, {
|
|
9118
10252
|
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null
|
|
9119
10253
|
});
|
|
9120
|
-
return /* @__PURE__ */ (0,
|
|
10254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "space-y-3", children: renderUnits.map(
|
|
9121
10255
|
(unit, index) => renderContentUnit(
|
|
9122
10256
|
unit,
|
|
9123
10257
|
message,
|
|
@@ -9137,20 +10271,29 @@ function AssistantStreamingIndicator({
|
|
|
9137
10271
|
thinking: t("message.thinking"),
|
|
9138
10272
|
answering: t("message.answering")
|
|
9139
10273
|
};
|
|
9140
|
-
return /* @__PURE__ */ (0,
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9147
|
-
|
|
9148
|
-
|
|
9149
|
-
|
|
9150
|
-
|
|
9151
|
-
|
|
9152
|
-
|
|
9153
|
-
|
|
10274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
10275
|
+
"div",
|
|
10276
|
+
{
|
|
10277
|
+
className: cn(
|
|
10278
|
+
"flex items-center gap-2 text-xs text-muted-foreground",
|
|
10279
|
+
className
|
|
10280
|
+
),
|
|
10281
|
+
children: [
|
|
10282
|
+
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react19.Loader2, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
10283
|
+
status === "thinking" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
10284
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.3s]" }),
|
|
10285
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.15s]" }),
|
|
10286
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce" })
|
|
10287
|
+
] }),
|
|
10288
|
+
status === "answering" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
10289
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "h-2 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.25s]" }),
|
|
10290
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "h-3 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.1s]" }),
|
|
10291
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "h-2.5 w-0.5 rounded-full bg-current animate-pulse" })
|
|
10292
|
+
] }),
|
|
10293
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: labelMap[status] })
|
|
10294
|
+
]
|
|
10295
|
+
}
|
|
10296
|
+
);
|
|
9154
10297
|
}
|
|
9155
10298
|
function AssistantMessage({
|
|
9156
10299
|
message,
|
|
@@ -9163,8 +10306,12 @@ function AssistantMessage({
|
|
|
9163
10306
|
apiUrl
|
|
9164
10307
|
}) {
|
|
9165
10308
|
const { t } = useChatkitTranslation();
|
|
9166
|
-
const
|
|
9167
|
-
|
|
10309
|
+
const renderTree = buildAssistantRenderTree(
|
|
10310
|
+
message
|
|
10311
|
+
);
|
|
10312
|
+
const rootReasoning = renderTree.hasAgentRuns ? renderTree.rootReasoning : message.reasoning;
|
|
10313
|
+
const hasContent = hasRenderableMessageContent(message.content) || renderTree.hasAgentRuns;
|
|
10314
|
+
const hasReasoning = hasRenderableReasoning(rootReasoning);
|
|
9168
10315
|
const resolvedStreamingStatus = streamingStatus ?? getAssistantStreamingStatus(message, isStreaming);
|
|
9169
10316
|
const lookupMessages = messages?.length ? messages : [message];
|
|
9170
10317
|
const answerNode = renderContent(message, lookupMessages, {
|
|
@@ -9172,42 +10319,42 @@ function AssistantMessage({
|
|
|
9172
10319
|
organizationId,
|
|
9173
10320
|
apiUrl
|
|
9174
10321
|
});
|
|
9175
|
-
const reasoningNode = hasReasoning ? /* @__PURE__ */ (0,
|
|
9176
|
-
if (!
|
|
10322
|
+
const reasoningNode = hasReasoning ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ReasoningBlock, { reasoning: rootReasoning ?? [] }) : null;
|
|
10323
|
+
if (!hasContent && !hasReasoning && !resolvedStreamingStatus) return null;
|
|
9177
10324
|
const streamingClass = isStreaming ? "streaming-active" : "";
|
|
9178
|
-
if (!
|
|
9179
|
-
return /* @__PURE__ */ (0,
|
|
10325
|
+
if (!hasContent && !hasReasoning && resolvedStreamingStatus) {
|
|
10326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: cn("space-y-3", streamingClass, className), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) });
|
|
9180
10327
|
}
|
|
9181
10328
|
if (hasContent && hasReasoning) {
|
|
9182
|
-
return /* @__PURE__ */ (0,
|
|
9183
|
-
/* @__PURE__ */ (0,
|
|
10329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
10330
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
9184
10331
|
Tabs,
|
|
9185
10332
|
{
|
|
9186
10333
|
defaultValue: message.status === "reasoning" ? "reasoning" : "answer",
|
|
9187
10334
|
className: "w-full",
|
|
9188
10335
|
children: [
|
|
9189
|
-
/* @__PURE__ */ (0,
|
|
9190
|
-
/* @__PURE__ */ (0,
|
|
9191
|
-
/* @__PURE__ */ (0,
|
|
10336
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(TabsList, { className: "", children: [
|
|
10337
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TabsTrigger, { value: "answer", children: t("message.answer") }),
|
|
10338
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TabsTrigger, { value: "reasoning", children: t("message.reasoning") })
|
|
9192
10339
|
] }),
|
|
9193
|
-
/* @__PURE__ */ (0,
|
|
9194
|
-
/* @__PURE__ */ (0,
|
|
10340
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TabsContent, { value: "answer", className: "space-y-3", children: answerNode }),
|
|
10341
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TabsContent, { value: "reasoning", className: "space-y-3", children: reasoningNode })
|
|
9195
10342
|
]
|
|
9196
10343
|
}
|
|
9197
10344
|
),
|
|
9198
|
-
resolvedStreamingStatus ? /* @__PURE__ */ (0,
|
|
10345
|
+
resolvedStreamingStatus ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
9199
10346
|
] });
|
|
9200
10347
|
}
|
|
9201
|
-
return /* @__PURE__ */ (0,
|
|
10348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
9202
10349
|
hasReasoning ? reasoningNode : answerNode,
|
|
9203
|
-
resolvedStreamingStatus ? /* @__PURE__ */ (0,
|
|
10350
|
+
resolvedStreamingStatus ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
9204
10351
|
] });
|
|
9205
10352
|
}
|
|
9206
10353
|
|
|
9207
10354
|
// src/components/thread/MessageActions.tsx
|
|
9208
|
-
var
|
|
9209
|
-
var
|
|
9210
|
-
var
|
|
10355
|
+
var React32 = __toESM(require("react"), 1);
|
|
10356
|
+
var import_lucide_react20 = require("lucide-react");
|
|
10357
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
9211
10358
|
function MessageActions({
|
|
9212
10359
|
content,
|
|
9213
10360
|
isAssistant = false,
|
|
@@ -9216,7 +10363,7 @@ function MessageActions({
|
|
|
9216
10363
|
className
|
|
9217
10364
|
}) {
|
|
9218
10365
|
const { t } = useChatkitTranslation();
|
|
9219
|
-
const [copied, setCopied] =
|
|
10366
|
+
const [copied, setCopied] = React32.useState(false);
|
|
9220
10367
|
const handleCopy = async () => {
|
|
9221
10368
|
try {
|
|
9222
10369
|
await navigator.clipboard.writeText(content);
|
|
@@ -9229,7 +10376,7 @@ function MessageActions({
|
|
|
9229
10376
|
if (isStreaming) {
|
|
9230
10377
|
return null;
|
|
9231
10378
|
}
|
|
9232
|
-
return /* @__PURE__ */ (0,
|
|
10379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
9233
10380
|
"div",
|
|
9234
10381
|
{
|
|
9235
10382
|
className: cn(
|
|
@@ -9237,7 +10384,7 @@ function MessageActions({
|
|
|
9237
10384
|
className
|
|
9238
10385
|
),
|
|
9239
10386
|
children: [
|
|
9240
|
-
/* @__PURE__ */ (0,
|
|
10387
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
9241
10388
|
"button",
|
|
9242
10389
|
{
|
|
9243
10390
|
type: "button",
|
|
@@ -9247,17 +10394,17 @@ function MessageActions({
|
|
|
9247
10394
|
copied && "text-green-500"
|
|
9248
10395
|
),
|
|
9249
10396
|
title: copied ? t("messageActions.copied") : t("messageActions.copy"),
|
|
9250
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
10397
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react20.Check, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react20.Copy, { size: 14 })
|
|
9251
10398
|
}
|
|
9252
10399
|
),
|
|
9253
|
-
isAssistant && onRetry && /* @__PURE__ */ (0,
|
|
10400
|
+
isAssistant && onRetry && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
9254
10401
|
"button",
|
|
9255
10402
|
{
|
|
9256
10403
|
type: "button",
|
|
9257
10404
|
onClick: onRetry,
|
|
9258
10405
|
className: "p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",
|
|
9259
10406
|
title: t("messageActions.regenerate"),
|
|
9260
|
-
children: /* @__PURE__ */ (0,
|
|
10407
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react20.RefreshCw, { size: 14 })
|
|
9261
10408
|
}
|
|
9262
10409
|
)
|
|
9263
10410
|
]
|
|
@@ -9266,20 +10413,20 @@ function MessageActions({
|
|
|
9266
10413
|
}
|
|
9267
10414
|
|
|
9268
10415
|
// src/components/thread/StartScreen.tsx
|
|
9269
|
-
var
|
|
9270
|
-
var
|
|
9271
|
-
var
|
|
10416
|
+
var React33 = require("react");
|
|
10417
|
+
var import_lucide_react21 = require("lucide-react");
|
|
10418
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
9272
10419
|
function getIconComponent2(icon) {
|
|
9273
10420
|
const iconMap = {
|
|
9274
|
-
"circle-question": /* @__PURE__ */ (0,
|
|
9275
|
-
"lightbulb": /* @__PURE__ */ (0,
|
|
9276
|
-
"sparkle": /* @__PURE__ */ (0,
|
|
9277
|
-
"write": /* @__PURE__ */ (0,
|
|
9278
|
-
"search": /* @__PURE__ */ (0,
|
|
9279
|
-
"globe": /* @__PURE__ */ (0,
|
|
9280
|
-
"book-open": /* @__PURE__ */ (0,
|
|
9281
|
-
"compass": /* @__PURE__ */ (0,
|
|
9282
|
-
"bolt": /* @__PURE__ */ (0,
|
|
10421
|
+
"circle-question": /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react21.HelpCircle, { size: 20 }),
|
|
10422
|
+
"lightbulb": /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react21.Lightbulb, { size: 20 }),
|
|
10423
|
+
"sparkle": /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react21.Sparkles, { size: 20 }),
|
|
10424
|
+
"write": /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react21.Pencil, { size: 20 }),
|
|
10425
|
+
"search": /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react21.Search, { size: 20 }),
|
|
10426
|
+
"globe": /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react21.Globe, { size: 20 }),
|
|
10427
|
+
"book-open": /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react21.BookOpen, { size: 20 }),
|
|
10428
|
+
"compass": /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react21.Compass, { size: 20 }),
|
|
10429
|
+
"bolt": /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react21.Zap, { size: 20 })
|
|
9283
10430
|
};
|
|
9284
10431
|
return icon ? iconMap[icon] || iconMap["sparkle"] : iconMap["sparkle"];
|
|
9285
10432
|
}
|
|
@@ -9287,9 +10434,9 @@ function StartScreen({ startScreen, onPromptClick, className }) {
|
|
|
9287
10434
|
const { t } = useChatkitTranslation();
|
|
9288
10435
|
const greeting = startScreen?.greeting ?? t("startScreen.greeting");
|
|
9289
10436
|
const prompts = startScreen?.prompts ?? [];
|
|
9290
|
-
return /* @__PURE__ */ (0,
|
|
9291
|
-
/* @__PURE__ */ (0,
|
|
9292
|
-
prompts.length > 0 && /* @__PURE__ */ (0,
|
|
10437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: cn("flex flex-col items-center justify-center py-12 px-4", className), children: [
|
|
10438
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "mb-8 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-2", children: greeting }) }),
|
|
10439
|
+
prompts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "w-full max-w-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: prompts.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
9293
10440
|
"button",
|
|
9294
10441
|
{
|
|
9295
10442
|
type: "button",
|
|
@@ -9300,8 +10447,8 @@ function StartScreen({ startScreen, onPromptClick, className }) {
|
|
|
9300
10447
|
"focus:outline-none focus:ring-2 focus:ring-primary/20"
|
|
9301
10448
|
),
|
|
9302
10449
|
children: [
|
|
9303
|
-
/* @__PURE__ */ (0,
|
|
9304
|
-
/* @__PURE__ */ (0,
|
|
10450
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.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) }),
|
|
10451
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "text-sm font-medium text-foreground", children: item.label })
|
|
9305
10452
|
]
|
|
9306
10453
|
},
|
|
9307
10454
|
`prompt-${index}`
|
|
@@ -9310,7 +10457,7 @@ function StartScreen({ startScreen, onPromptClick, className }) {
|
|
|
9310
10457
|
}
|
|
9311
10458
|
|
|
9312
10459
|
// src/hooks/useThreads.ts
|
|
9313
|
-
var
|
|
10460
|
+
var React34 = __toESM(require("react"), 1);
|
|
9314
10461
|
var DEFAULT_LIMIT = 50;
|
|
9315
10462
|
var getThreadTitle = (threadRecord) => {
|
|
9316
10463
|
const title = threadRecord.title?.trim();
|
|
@@ -9363,16 +10510,16 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9363
10510
|
isLoading: isStreamLoading,
|
|
9364
10511
|
error: streamError
|
|
9365
10512
|
} = useStreamContext();
|
|
9366
|
-
const [threadRecords, setThreadRecords] =
|
|
9367
|
-
const [isLoading, setIsLoading] =
|
|
9368
|
-
const [error, setError] =
|
|
9369
|
-
const upsertThreadRecord =
|
|
10513
|
+
const [threadRecords, setThreadRecords] = React34.useState([]);
|
|
10514
|
+
const [isLoading, setIsLoading] = React34.useState(false);
|
|
10515
|
+
const [error, setError] = React34.useState(null);
|
|
10516
|
+
const upsertThreadRecord = React34.useCallback((threadRecord) => {
|
|
9370
10517
|
setThreadRecords((prev) => {
|
|
9371
10518
|
const next = prev.filter((item) => item.id !== threadRecord.id);
|
|
9372
10519
|
return sortThreadRecords([threadRecord, ...next]);
|
|
9373
10520
|
});
|
|
9374
10521
|
}, []);
|
|
9375
|
-
const refreshThreads =
|
|
10522
|
+
const refreshThreads = React34.useCallback(async () => {
|
|
9376
10523
|
setIsLoading(true);
|
|
9377
10524
|
setError(null);
|
|
9378
10525
|
try {
|
|
@@ -9388,7 +10535,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9388
10535
|
setIsLoading(false);
|
|
9389
10536
|
}
|
|
9390
10537
|
}, [client, limit, assistantId]);
|
|
9391
|
-
const createThread =
|
|
10538
|
+
const createThread = React34.useCallback(
|
|
9392
10539
|
async (input) => {
|
|
9393
10540
|
setError(null);
|
|
9394
10541
|
const payload = {};
|
|
@@ -9402,7 +10549,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9402
10549
|
},
|
|
9403
10550
|
[client, upsertThreadRecord]
|
|
9404
10551
|
);
|
|
9405
|
-
const updateThread =
|
|
10552
|
+
const updateThread = React34.useCallback(
|
|
9406
10553
|
async (recordId, payload) => {
|
|
9407
10554
|
setError(null);
|
|
9408
10555
|
const updated = await client.conversations.update(recordId, payload);
|
|
@@ -9411,7 +10558,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9411
10558
|
},
|
|
9412
10559
|
[client, upsertThreadRecord]
|
|
9413
10560
|
);
|
|
9414
|
-
const deleteThread =
|
|
10561
|
+
const deleteThread = React34.useCallback(
|
|
9415
10562
|
async (recordId) => {
|
|
9416
10563
|
setError(null);
|
|
9417
10564
|
await client.conversations.delete(recordId);
|
|
@@ -9419,11 +10566,11 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9419
10566
|
},
|
|
9420
10567
|
[client]
|
|
9421
10568
|
);
|
|
9422
|
-
|
|
10569
|
+
React34.useEffect(() => {
|
|
9423
10570
|
if (!isReady) return;
|
|
9424
10571
|
void refreshThreads();
|
|
9425
10572
|
}, [refreshThreads, isReady]);
|
|
9426
|
-
|
|
10573
|
+
React34.useEffect(() => {
|
|
9427
10574
|
if (!threadId || !isStreamLoading) return;
|
|
9428
10575
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
9429
10576
|
const busyStatus = "busy";
|
|
@@ -9444,7 +10591,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9444
10591
|
return changed ? sortThreadRecords(next) : prev;
|
|
9445
10592
|
});
|
|
9446
10593
|
}, [threadId, isStreamLoading]);
|
|
9447
|
-
|
|
10594
|
+
React34.useEffect(() => {
|
|
9448
10595
|
const message = getErrorMessage(streamError)?.trim();
|
|
9449
10596
|
if (!threadId || !message) return;
|
|
9450
10597
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -9466,7 +10613,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9466
10613
|
return changed ? sortThreadRecords(next) : prev;
|
|
9467
10614
|
});
|
|
9468
10615
|
}, [threadId, streamError]);
|
|
9469
|
-
|
|
10616
|
+
React34.useEffect(() => {
|
|
9470
10617
|
if (!isReady || !threadId || isStreamLoading) return;
|
|
9471
10618
|
let cancelled = false;
|
|
9472
10619
|
void client.conversations.search({ where: { threadId }, limit: 1 }).then((result) => {
|
|
@@ -9480,7 +10627,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9480
10627
|
cancelled = true;
|
|
9481
10628
|
};
|
|
9482
10629
|
}, [client, threadId, upsertThreadRecord, isReady, isStreamLoading]);
|
|
9483
|
-
const threads =
|
|
10630
|
+
const threads = React34.useMemo(
|
|
9484
10631
|
() => threadRecords.map((threadRecord) => toThreadItem(threadRecord)),
|
|
9485
10632
|
[threadRecords]
|
|
9486
10633
|
);
|
|
@@ -9497,10 +10644,10 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
9497
10644
|
}
|
|
9498
10645
|
|
|
9499
10646
|
// src/components/thread/context-usage-indicator.tsx
|
|
9500
|
-
var
|
|
10647
|
+
var React35 = __toESM(require("react"), 1);
|
|
9501
10648
|
|
|
9502
10649
|
// src/components/ui/progress-circle.tsx
|
|
9503
|
-
var
|
|
10650
|
+
var import_jsx_runtime40 = (
|
|
9504
10651
|
// biome-ignore lint/a11y/useFocusableInteractive: false positive (progress + progressbar are not focusable interactives)
|
|
9505
10652
|
// biome-ignore lint/nursery/useAriaPropsSupportedByRole: biome rule at odds with mdn docs (presumed nursary bug with rule)
|
|
9506
10653
|
require("react/jsx-runtime")
|
|
@@ -9524,7 +10671,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
9524
10671
|
fill: "none",
|
|
9525
10672
|
strokeWidth
|
|
9526
10673
|
};
|
|
9527
|
-
return /* @__PURE__ */ (0,
|
|
10674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
9528
10675
|
"svg",
|
|
9529
10676
|
{
|
|
9530
10677
|
role: "progressbar",
|
|
@@ -9535,8 +10682,8 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
9535
10682
|
"aria-valuemax": 100,
|
|
9536
10683
|
...restSvgProps,
|
|
9537
10684
|
children: [
|
|
9538
|
-
/* @__PURE__ */ (0,
|
|
9539
|
-
/* @__PURE__ */ (0,
|
|
10685
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("circle", { ...commonParams, className: "stroke-current/25" }),
|
|
10686
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
9540
10687
|
"circle",
|
|
9541
10688
|
{
|
|
9542
10689
|
...commonParams,
|
|
@@ -9554,7 +10701,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
9554
10701
|
};
|
|
9555
10702
|
|
|
9556
10703
|
// src/components/thread/context-usage-indicator.tsx
|
|
9557
|
-
var
|
|
10704
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
9558
10705
|
var kNumberFormatter = new Intl.NumberFormat("en-US", {
|
|
9559
10706
|
minimumFractionDigits: 0,
|
|
9560
10707
|
maximumFractionDigits: 1
|
|
@@ -9587,20 +10734,20 @@ function ContextUsageIndicator({
|
|
|
9587
10734
|
}) {
|
|
9588
10735
|
const { t } = useChatkitTranslation();
|
|
9589
10736
|
const stream = useStreamContext();
|
|
9590
|
-
const [maxContextSize, setMaxContextSize] =
|
|
9591
|
-
const [usedContextSize, setUsedContextSize] =
|
|
9592
|
-
const [assistantAgentKey, setAssistantAgentKey] =
|
|
9593
|
-
const latestRealtimeUsageRef =
|
|
10737
|
+
const [maxContextSize, setMaxContextSize] = React35.useState(null);
|
|
10738
|
+
const [usedContextSize, setUsedContextSize] = React35.useState(null);
|
|
10739
|
+
const [assistantAgentKey, setAssistantAgentKey] = React35.useState(null);
|
|
10740
|
+
const latestRealtimeUsageRef = React35.useRef({
|
|
9594
10741
|
threadId: null,
|
|
9595
10742
|
agentKey: null,
|
|
9596
10743
|
usedTokens: null
|
|
9597
10744
|
});
|
|
9598
|
-
const realtimeUsage =
|
|
10745
|
+
const realtimeUsage = React35.useMemo(
|
|
9599
10746
|
() => getThreadContextUsage(stream.contextUsageByAgentKey, assistantAgentKey),
|
|
9600
10747
|
[assistantAgentKey, stream.contextUsageByAgentKey]
|
|
9601
10748
|
);
|
|
9602
10749
|
const realtimeUsedContextSize = getThreadContextUsageTotalTokens(realtimeUsage);
|
|
9603
|
-
|
|
10750
|
+
React35.useEffect(() => {
|
|
9604
10751
|
if (!stream.client || !stream.assistantId) {
|
|
9605
10752
|
setMaxContextSize(null);
|
|
9606
10753
|
setAssistantAgentKey(null);
|
|
@@ -9620,18 +10767,18 @@ function ContextUsageIndicator({
|
|
|
9620
10767
|
cancelled = true;
|
|
9621
10768
|
};
|
|
9622
10769
|
}, [stream.client, stream.assistantId]);
|
|
9623
|
-
|
|
10770
|
+
React35.useEffect(() => {
|
|
9624
10771
|
latestRealtimeUsageRef.current = {
|
|
9625
10772
|
threadId: stream.threadId ?? null,
|
|
9626
10773
|
agentKey: assistantAgentKey,
|
|
9627
10774
|
usedTokens: realtimeUsedContextSize
|
|
9628
10775
|
};
|
|
9629
10776
|
}, [assistantAgentKey, realtimeUsedContextSize, stream.threadId]);
|
|
9630
|
-
|
|
10777
|
+
React35.useEffect(() => {
|
|
9631
10778
|
if (realtimeUsedContextSize == null) return;
|
|
9632
10779
|
setUsedContextSize(realtimeUsedContextSize);
|
|
9633
10780
|
}, [realtimeUsedContextSize]);
|
|
9634
|
-
|
|
10781
|
+
React35.useEffect(() => {
|
|
9635
10782
|
if (!stream.client) {
|
|
9636
10783
|
setUsedContextSize(null);
|
|
9637
10784
|
return;
|
|
@@ -9696,8 +10843,8 @@ function ContextUsageIndicator({
|
|
|
9696
10843
|
});
|
|
9697
10844
|
const usageLabelWithSuffix = usageLabel.endsWith(":") ? usageLabel : `${usageLabel}:`;
|
|
9698
10845
|
const progressClassName = percent >= 90 ? "text-destructive" : percent >= 75 ? "text-amber-500" : "text-primary dark:text-zinc-300";
|
|
9699
|
-
return /* @__PURE__ */ (0,
|
|
9700
|
-
/* @__PURE__ */ (0,
|
|
10846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Tooltip, { children: [
|
|
10847
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
9701
10848
|
"button",
|
|
9702
10849
|
{
|
|
9703
10850
|
type: "button",
|
|
@@ -9706,31 +10853,31 @@ function ContextUsageIndicator({
|
|
|
9706
10853
|
className
|
|
9707
10854
|
),
|
|
9708
10855
|
"aria-label": `${usageLabelWithSuffix} ${usageFullLabel}. ${usageTokensLabel}`,
|
|
9709
|
-
children: /* @__PURE__ */ (0,
|
|
10856
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ProgressCircle, { value: percent, className: cn("size-3.5", progressClassName) })
|
|
9710
10857
|
}
|
|
9711
10858
|
) }),
|
|
9712
|
-
/* @__PURE__ */ (0,
|
|
9713
|
-
/* @__PURE__ */ (0,
|
|
9714
|
-
/* @__PURE__ */ (0,
|
|
9715
|
-
/* @__PURE__ */ (0,
|
|
10859
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(TooltipContent, { side: "top", sideOffset: 6, className: "space-y-0.5 px-3 py-2 text-center", children: [
|
|
10860
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "text-primary-foreground/70", children: usageLabelWithSuffix }),
|
|
10861
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "font-medium text-primary-foreground/80", children: usageFullLabel }),
|
|
10862
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "text-sm font-semibold", children: usageTokensLabel })
|
|
9716
10863
|
] })
|
|
9717
10864
|
] });
|
|
9718
10865
|
}
|
|
9719
10866
|
|
|
9720
10867
|
// src/components/pet/PetBridge.tsx
|
|
9721
|
-
var
|
|
9722
|
-
var
|
|
10868
|
+
var React36 = __toESM(require("react"), 1);
|
|
10869
|
+
var import_chatkit_types7 = require("@xpert-ai/chatkit-types");
|
|
9723
10870
|
function PetBridge({ pet, state }) {
|
|
9724
10871
|
const parentMessenger = useParentMessenger();
|
|
9725
10872
|
const sendEvent = parentMessenger?.sendEvent;
|
|
9726
|
-
const options =
|
|
9727
|
-
|
|
10873
|
+
const options = React36.useMemo(() => (0, import_chatkit_types7.normalizePetOptions)(pet), [pet]);
|
|
10874
|
+
React36.useEffect(() => {
|
|
9728
10875
|
if (!sendEvent) {
|
|
9729
10876
|
return;
|
|
9730
10877
|
}
|
|
9731
10878
|
sendEvent("pet_options_change", { pet: pet ?? null });
|
|
9732
10879
|
}, [sendEvent, pet]);
|
|
9733
|
-
|
|
10880
|
+
React36.useEffect(() => {
|
|
9734
10881
|
if (!sendEvent || !options) {
|
|
9735
10882
|
return;
|
|
9736
10883
|
}
|
|
@@ -9740,15 +10887,15 @@ function PetBridge({ pet, state }) {
|
|
|
9740
10887
|
}
|
|
9741
10888
|
|
|
9742
10889
|
// src/components/settings/SettingsSheet.tsx
|
|
9743
|
-
var
|
|
9744
|
-
var
|
|
10890
|
+
var React43 = __toESM(require("react"), 1);
|
|
10891
|
+
var import_lucide_react23 = require("lucide-react");
|
|
9745
10892
|
|
|
9746
10893
|
// src/components/ui/input.tsx
|
|
9747
|
-
var
|
|
9748
|
-
var
|
|
9749
|
-
var Input =
|
|
10894
|
+
var React37 = __toESM(require("react"), 1);
|
|
10895
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
10896
|
+
var Input = React37.forwardRef(
|
|
9750
10897
|
({ className, type, ...props }, ref) => {
|
|
9751
|
-
return /* @__PURE__ */ (0,
|
|
10898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
9752
10899
|
"input",
|
|
9753
10900
|
{
|
|
9754
10901
|
ref,
|
|
@@ -9765,20 +10912,20 @@ var Input = React36.forwardRef(
|
|
|
9765
10912
|
Input.displayName = "Input";
|
|
9766
10913
|
|
|
9767
10914
|
// src/components/ui/select.tsx
|
|
9768
|
-
var
|
|
10915
|
+
var React38 = require("react");
|
|
9769
10916
|
var import_radix_ui2 = require("radix-ui");
|
|
9770
|
-
var
|
|
9771
|
-
var
|
|
10917
|
+
var import_lucide_react22 = require("lucide-react");
|
|
10918
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
9772
10919
|
function Select({
|
|
9773
10920
|
...props
|
|
9774
10921
|
}) {
|
|
9775
|
-
return /* @__PURE__ */ (0,
|
|
10922
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_radix_ui2.Select.Root, { "data-slot": "select", ...props });
|
|
9776
10923
|
}
|
|
9777
10924
|
function SelectGroup({
|
|
9778
10925
|
className,
|
|
9779
10926
|
...props
|
|
9780
10927
|
}) {
|
|
9781
|
-
return /* @__PURE__ */ (0,
|
|
10928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9782
10929
|
import_radix_ui2.Select.Group,
|
|
9783
10930
|
{
|
|
9784
10931
|
"data-slot": "select-group",
|
|
@@ -9790,7 +10937,7 @@ function SelectGroup({
|
|
|
9790
10937
|
function SelectValue({
|
|
9791
10938
|
...props
|
|
9792
10939
|
}) {
|
|
9793
|
-
return /* @__PURE__ */ (0,
|
|
10940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_radix_ui2.Select.Value, { "data-slot": "select-value", ...props });
|
|
9794
10941
|
}
|
|
9795
10942
|
function SelectTrigger({
|
|
9796
10943
|
className,
|
|
@@ -9798,7 +10945,7 @@ function SelectTrigger({
|
|
|
9798
10945
|
children,
|
|
9799
10946
|
...props
|
|
9800
10947
|
}) {
|
|
9801
|
-
return /* @__PURE__ */ (0,
|
|
10948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
9802
10949
|
import_radix_ui2.Select.Trigger,
|
|
9803
10950
|
{
|
|
9804
10951
|
"data-slot": "select-trigger",
|
|
@@ -9810,7 +10957,7 @@ function SelectTrigger({
|
|
|
9810
10957
|
...props,
|
|
9811
10958
|
children: [
|
|
9812
10959
|
children,
|
|
9813
|
-
/* @__PURE__ */ (0,
|
|
10960
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_radix_ui2.Select.Icon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react22.ChevronDownIcon, { className: "pointer-events-none size-4 text-muted-foreground" }) })
|
|
9814
10961
|
]
|
|
9815
10962
|
}
|
|
9816
10963
|
);
|
|
@@ -9822,7 +10969,7 @@ function SelectContent({
|
|
|
9822
10969
|
align = "center",
|
|
9823
10970
|
...props
|
|
9824
10971
|
}) {
|
|
9825
|
-
return /* @__PURE__ */ (0,
|
|
10972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_radix_ui2.Select.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
9826
10973
|
import_radix_ui2.Select.Content,
|
|
9827
10974
|
{
|
|
9828
10975
|
"data-slot": "select-content",
|
|
@@ -9832,8 +10979,8 @@ function SelectContent({
|
|
|
9832
10979
|
align,
|
|
9833
10980
|
...props,
|
|
9834
10981
|
children: [
|
|
9835
|
-
/* @__PURE__ */ (0,
|
|
9836
|
-
/* @__PURE__ */ (0,
|
|
10982
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(SelectScrollUpButton, {}),
|
|
10983
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9837
10984
|
import_radix_ui2.Select.Viewport,
|
|
9838
10985
|
{
|
|
9839
10986
|
"data-position": position,
|
|
@@ -9844,7 +10991,7 @@ function SelectContent({
|
|
|
9844
10991
|
children
|
|
9845
10992
|
}
|
|
9846
10993
|
),
|
|
9847
|
-
/* @__PURE__ */ (0,
|
|
10994
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(SelectScrollDownButton, {})
|
|
9848
10995
|
]
|
|
9849
10996
|
}
|
|
9850
10997
|
) });
|
|
@@ -9854,7 +11001,7 @@ function SelectItem({
|
|
|
9854
11001
|
children,
|
|
9855
11002
|
...props
|
|
9856
11003
|
}) {
|
|
9857
|
-
return /* @__PURE__ */ (0,
|
|
11004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
9858
11005
|
import_radix_ui2.Select.Item,
|
|
9859
11006
|
{
|
|
9860
11007
|
"data-slot": "select-item",
|
|
@@ -9864,8 +11011,8 @@ function SelectItem({
|
|
|
9864
11011
|
),
|
|
9865
11012
|
...props,
|
|
9866
11013
|
children: [
|
|
9867
|
-
/* @__PURE__ */ (0,
|
|
9868
|
-
/* @__PURE__ */ (0,
|
|
11014
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_radix_ui2.Select.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react22.CheckIcon, { className: "pointer-events-none" }) }) }),
|
|
11015
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_radix_ui2.Select.ItemText, { children })
|
|
9869
11016
|
]
|
|
9870
11017
|
}
|
|
9871
11018
|
);
|
|
@@ -9874,7 +11021,7 @@ function SelectScrollUpButton({
|
|
|
9874
11021
|
className,
|
|
9875
11022
|
...props
|
|
9876
11023
|
}) {
|
|
9877
|
-
return /* @__PURE__ */ (0,
|
|
11024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9878
11025
|
import_radix_ui2.Select.ScrollUpButton,
|
|
9879
11026
|
{
|
|
9880
11027
|
"data-slot": "select-scroll-up-button",
|
|
@@ -9883,8 +11030,8 @@ function SelectScrollUpButton({
|
|
|
9883
11030
|
className
|
|
9884
11031
|
),
|
|
9885
11032
|
...props,
|
|
9886
|
-
children: /* @__PURE__ */ (0,
|
|
9887
|
-
|
|
11033
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
11034
|
+
import_lucide_react22.ChevronUpIcon,
|
|
9888
11035
|
{}
|
|
9889
11036
|
)
|
|
9890
11037
|
}
|
|
@@ -9894,7 +11041,7 @@ function SelectScrollDownButton({
|
|
|
9894
11041
|
className,
|
|
9895
11042
|
...props
|
|
9896
11043
|
}) {
|
|
9897
|
-
return /* @__PURE__ */ (0,
|
|
11044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9898
11045
|
import_radix_ui2.Select.ScrollDownButton,
|
|
9899
11046
|
{
|
|
9900
11047
|
"data-slot": "select-scroll-down-button",
|
|
@@ -9903,8 +11050,8 @@ function SelectScrollDownButton({
|
|
|
9903
11050
|
className
|
|
9904
11051
|
),
|
|
9905
11052
|
...props,
|
|
9906
|
-
children: /* @__PURE__ */ (0,
|
|
9907
|
-
|
|
11053
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
11054
|
+
import_lucide_react22.ChevronDownIcon,
|
|
9908
11055
|
{}
|
|
9909
11056
|
)
|
|
9910
11057
|
}
|
|
@@ -9912,9 +11059,9 @@ function SelectScrollDownButton({
|
|
|
9912
11059
|
}
|
|
9913
11060
|
|
|
9914
11061
|
// src/components/ui/slider.tsx
|
|
9915
|
-
var
|
|
11062
|
+
var React39 = __toESM(require("react"), 1);
|
|
9916
11063
|
var import_radix_ui3 = require("radix-ui");
|
|
9917
|
-
var
|
|
11064
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
9918
11065
|
function Slider({
|
|
9919
11066
|
className,
|
|
9920
11067
|
defaultValue,
|
|
@@ -9923,11 +11070,11 @@ function Slider({
|
|
|
9923
11070
|
max = 100,
|
|
9924
11071
|
...props
|
|
9925
11072
|
}) {
|
|
9926
|
-
const _values =
|
|
11073
|
+
const _values = React39.useMemo(
|
|
9927
11074
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
9928
11075
|
[value, defaultValue, min, max]
|
|
9929
11076
|
);
|
|
9930
|
-
return /* @__PURE__ */ (0,
|
|
11077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
9931
11078
|
import_radix_ui3.Slider.Root,
|
|
9932
11079
|
{
|
|
9933
11080
|
"data-slot": "slider",
|
|
@@ -9941,12 +11088,12 @@ function Slider({
|
|
|
9941
11088
|
),
|
|
9942
11089
|
...props,
|
|
9943
11090
|
children: [
|
|
9944
|
-
/* @__PURE__ */ (0,
|
|
11091
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
9945
11092
|
import_radix_ui3.Slider.Track,
|
|
9946
11093
|
{
|
|
9947
11094
|
"data-slot": "slider-track",
|
|
9948
11095
|
className: "relative grow overflow-hidden rounded-full bg-muted data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1",
|
|
9949
|
-
children: /* @__PURE__ */ (0,
|
|
11096
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
9950
11097
|
import_radix_ui3.Slider.Range,
|
|
9951
11098
|
{
|
|
9952
11099
|
"data-slot": "slider-range",
|
|
@@ -9955,7 +11102,7 @@ function Slider({
|
|
|
9955
11102
|
)
|
|
9956
11103
|
}
|
|
9957
11104
|
),
|
|
9958
|
-
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ (0,
|
|
11105
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
9959
11106
|
import_radix_ui3.Slider.Thumb,
|
|
9960
11107
|
{
|
|
9961
11108
|
"data-slot": "slider-thumb",
|
|
@@ -9969,15 +11116,15 @@ function Slider({
|
|
|
9969
11116
|
}
|
|
9970
11117
|
|
|
9971
11118
|
// src/components/ui/toggle-group.tsx
|
|
9972
|
-
var
|
|
11119
|
+
var React41 = __toESM(require("react"), 1);
|
|
9973
11120
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
9974
11121
|
var import_radix_ui5 = require("radix-ui");
|
|
9975
11122
|
|
|
9976
11123
|
// src/components/ui/toggle.tsx
|
|
9977
|
-
var
|
|
11124
|
+
var React40 = require("react");
|
|
9978
11125
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
9979
11126
|
var import_radix_ui4 = require("radix-ui");
|
|
9980
|
-
var
|
|
11127
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
9981
11128
|
var toggleVariants = (0, import_class_variance_authority2.cva)(
|
|
9982
11129
|
"group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
9983
11130
|
{
|
|
@@ -10000,8 +11147,8 @@ var toggleVariants = (0, import_class_variance_authority2.cva)(
|
|
|
10000
11147
|
);
|
|
10001
11148
|
|
|
10002
11149
|
// src/components/ui/toggle-group.tsx
|
|
10003
|
-
var
|
|
10004
|
-
var ToggleGroupContext =
|
|
11150
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
11151
|
+
var ToggleGroupContext = React41.createContext({
|
|
10005
11152
|
size: "default",
|
|
10006
11153
|
variant: "default",
|
|
10007
11154
|
spacing: 0,
|
|
@@ -10016,7 +11163,7 @@ function ToggleGroup({
|
|
|
10016
11163
|
children,
|
|
10017
11164
|
...props
|
|
10018
11165
|
}) {
|
|
10019
|
-
return /* @__PURE__ */ (0,
|
|
11166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
10020
11167
|
import_radix_ui5.ToggleGroup.Root,
|
|
10021
11168
|
{
|
|
10022
11169
|
"data-slot": "toggle-group",
|
|
@@ -10030,7 +11177,7 @@ function ToggleGroup({
|
|
|
10030
11177
|
className
|
|
10031
11178
|
),
|
|
10032
11179
|
...props,
|
|
10033
|
-
children: /* @__PURE__ */ (0,
|
|
11180
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
10034
11181
|
ToggleGroupContext.Provider,
|
|
10035
11182
|
{
|
|
10036
11183
|
value: { variant, size: size2, spacing, orientation },
|
|
@@ -10047,8 +11194,8 @@ function ToggleGroupItem({
|
|
|
10047
11194
|
size: size2 = "default",
|
|
10048
11195
|
...props
|
|
10049
11196
|
}) {
|
|
10050
|
-
const context =
|
|
10051
|
-
return /* @__PURE__ */ (0,
|
|
11197
|
+
const context = React41.useContext(ToggleGroupContext);
|
|
11198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
10052
11199
|
import_radix_ui5.ToggleGroup.Item,
|
|
10053
11200
|
{
|
|
10054
11201
|
"data-slot": "toggle-group-item",
|
|
@@ -10070,7 +11217,7 @@ function ToggleGroupItem({
|
|
|
10070
11217
|
}
|
|
10071
11218
|
|
|
10072
11219
|
// src/components/pet/pet-local-settings.ts
|
|
10073
|
-
var
|
|
11220
|
+
var import_chatkit_types8 = require("@xpert-ai/chatkit-types");
|
|
10074
11221
|
|
|
10075
11222
|
// src/components/pet/builtinPets.ts
|
|
10076
11223
|
var PUBLIC_PETS = [
|
|
@@ -10244,7 +11391,7 @@ function derivePetLocalSettings(pet) {
|
|
|
10244
11391
|
if (!pet) {
|
|
10245
11392
|
return { ...DEFAULT_PET_LOCAL_SETTINGS };
|
|
10246
11393
|
}
|
|
10247
|
-
const normalized = (0,
|
|
11394
|
+
const normalized = (0, import_chatkit_types8.normalizePetOptions)(pet ?? null);
|
|
10248
11395
|
if (!normalized) {
|
|
10249
11396
|
return { ...DEFAULT_PET_LOCAL_SETTINGS };
|
|
10250
11397
|
}
|
|
@@ -10274,25 +11421,25 @@ function derivePetLocalSettings(pet) {
|
|
|
10274
11421
|
return base2;
|
|
10275
11422
|
}
|
|
10276
11423
|
function isPetEnabled(pet) {
|
|
10277
|
-
return Boolean((0,
|
|
11424
|
+
return Boolean((0, import_chatkit_types8.normalizePetOptions)(pet ?? null));
|
|
10278
11425
|
}
|
|
10279
11426
|
|
|
10280
11427
|
// src/components/pet/PetPreview.tsx
|
|
10281
|
-
var
|
|
11428
|
+
var React42 = require("react");
|
|
10282
11429
|
|
|
10283
11430
|
// src/components/pet/petSpriteAtlas.ts
|
|
10284
|
-
var
|
|
11431
|
+
var import_chatkit_types9 = require("@xpert-ai/chatkit-types");
|
|
10285
11432
|
|
|
10286
11433
|
// src/components/pet/PetPreview.tsx
|
|
10287
|
-
var
|
|
11434
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
10288
11435
|
function escapeCssUrl(value) {
|
|
10289
11436
|
return value.replace(/["\\]/g, "\\$&");
|
|
10290
11437
|
}
|
|
10291
11438
|
function PetPreview({ src, label, className }) {
|
|
10292
11439
|
const scale = 0.13;
|
|
10293
|
-
const width =
|
|
10294
|
-
const height =
|
|
10295
|
-
return /* @__PURE__ */ (0,
|
|
11440
|
+
const width = import_chatkit_types9.petSpriteAtlas.cellWidth;
|
|
11441
|
+
const height = import_chatkit_types9.petSpriteAtlas.cellHeight;
|
|
11442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10296
11443
|
"span",
|
|
10297
11444
|
{
|
|
10298
11445
|
className: cn(
|
|
@@ -10301,7 +11448,7 @@ function PetPreview({ src, label, className }) {
|
|
|
10301
11448
|
),
|
|
10302
11449
|
"aria-hidden": "true",
|
|
10303
11450
|
title: label,
|
|
10304
|
-
children: /* @__PURE__ */ (0,
|
|
11451
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10305
11452
|
"span",
|
|
10306
11453
|
{
|
|
10307
11454
|
className: "absolute left-1/2 top-1/2 block",
|
|
@@ -10312,7 +11459,7 @@ function PetPreview({ src, label, className }) {
|
|
|
10312
11459
|
transformOrigin: "center",
|
|
10313
11460
|
backgroundImage: `url("${escapeCssUrl(src)}")`,
|
|
10314
11461
|
backgroundRepeat: "no-repeat",
|
|
10315
|
-
backgroundSize: `${
|
|
11462
|
+
backgroundSize: `${import_chatkit_types9.petSpriteAtlas.columns * width}px ${import_chatkit_types9.petSpriteAtlas.rows * height}px`,
|
|
10316
11463
|
backgroundPosition: "0px 0px",
|
|
10317
11464
|
imageRendering: "auto"
|
|
10318
11465
|
}
|
|
@@ -10323,7 +11470,7 @@ function PetPreview({ src, label, className }) {
|
|
|
10323
11470
|
}
|
|
10324
11471
|
|
|
10325
11472
|
// src/components/settings/SettingsSheet.tsx
|
|
10326
|
-
var
|
|
11473
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
10327
11474
|
var CHARACTER_TYPES2 = [
|
|
10328
11475
|
"builtin",
|
|
10329
11476
|
"atlas"
|
|
@@ -10339,13 +11486,13 @@ function SettingsSheet({
|
|
|
10339
11486
|
onSave
|
|
10340
11487
|
}) {
|
|
10341
11488
|
const { t } = useChatkitTranslation();
|
|
10342
|
-
const [draft, setDraft] =
|
|
10343
|
-
|
|
11489
|
+
const [draft, setDraft] = React43.useState(settings);
|
|
11490
|
+
React43.useEffect(() => {
|
|
10344
11491
|
if (open) {
|
|
10345
11492
|
setDraft(petRequired ? { ...settings, enabled: true } : settings);
|
|
10346
11493
|
}
|
|
10347
11494
|
}, [open, petRequired, settings]);
|
|
10348
|
-
const updateDraft =
|
|
11495
|
+
const updateDraft = React43.useCallback(
|
|
10349
11496
|
(patch) => {
|
|
10350
11497
|
setDraft((previous) => ({ ...previous, ...patch }));
|
|
10351
11498
|
},
|
|
@@ -10363,23 +11510,23 @@ function SettingsSheet({
|
|
|
10363
11510
|
defaultValue: selectedBuiltinPet.label
|
|
10364
11511
|
}
|
|
10365
11512
|
);
|
|
10366
|
-
return /* @__PURE__ */ (0,
|
|
10367
|
-
/* @__PURE__ */ (0,
|
|
10368
|
-
/* @__PURE__ */ (0,
|
|
10369
|
-
/* @__PURE__ */ (0,
|
|
11513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Sheet, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(SheetContent, { side: "right", className: "w-[min(92vw,26rem)] overflow-y-auto", children: [
|
|
11514
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SheetHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
11515
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "flex h-8 w-8 items-center justify-center rounded-md bg-primary/10 text-primary", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react23.Settings, { size: 16 }) }),
|
|
11516
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SheetTitle, { children: t("settings.title") })
|
|
10370
11517
|
] }) }),
|
|
10371
|
-
/* @__PURE__ */ (0,
|
|
10372
|
-
/* @__PURE__ */ (0,
|
|
10373
|
-
/* @__PURE__ */ (0,
|
|
10374
|
-
/* @__PURE__ */ (0,
|
|
10375
|
-
/* @__PURE__ */ (0,
|
|
11518
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("form", { className: "mt-6 space-y-5", onSubmit: handleSubmit, children: [
|
|
11519
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("section", { className: "space-y-5", children: [
|
|
11520
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
11521
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "flex h-7 w-7 items-center justify-center rounded-md bg-muted text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react23.PawPrint, { size: 15 }) }),
|
|
11522
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("h3", { className: "text-sm font-semibold", children: t("pet.settings.title") })
|
|
10376
11523
|
] }),
|
|
10377
|
-
/* @__PURE__ */ (0,
|
|
10378
|
-
/* @__PURE__ */ (0,
|
|
10379
|
-
/* @__PURE__ */ (0,
|
|
10380
|
-
petRequired && /* @__PURE__ */ (0,
|
|
11524
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2", children: [
|
|
11525
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "min-w-0", children: [
|
|
11526
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "block text-sm font-medium", children: t("pet.settings.enabled") }),
|
|
11527
|
+
petRequired && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: t("pet.settings.requiredHint") })
|
|
10381
11528
|
] }),
|
|
10382
|
-
/* @__PURE__ */ (0,
|
|
11529
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10383
11530
|
"button",
|
|
10384
11531
|
{
|
|
10385
11532
|
type: "button",
|
|
@@ -10392,7 +11539,7 @@ function SettingsSheet({
|
|
|
10392
11539
|
draft.enabled ? "bg-primary" : "bg-muted-foreground/20",
|
|
10393
11540
|
petRequired ? "cursor-not-allowed opacity-70" : ""
|
|
10394
11541
|
].join(" "),
|
|
10395
|
-
children: /* @__PURE__ */ (0,
|
|
11542
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10396
11543
|
"span",
|
|
10397
11544
|
{
|
|
10398
11545
|
className: [
|
|
@@ -10405,9 +11552,9 @@ function SettingsSheet({
|
|
|
10405
11552
|
)
|
|
10406
11553
|
] })
|
|
10407
11554
|
] }),
|
|
10408
|
-
/* @__PURE__ */ (0,
|
|
10409
|
-
/* @__PURE__ */ (0,
|
|
10410
|
-
/* @__PURE__ */ (0,
|
|
11555
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "space-y-2", children: [
|
|
11556
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { id: "chatkit-pet-type-label", className: "text-sm font-medium", children: t("pet.settings.characterType") }),
|
|
11557
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10411
11558
|
ToggleGroup,
|
|
10412
11559
|
{
|
|
10413
11560
|
id: "chatkit-pet-type",
|
|
@@ -10422,7 +11569,7 @@ function SettingsSheet({
|
|
|
10422
11569
|
variant: "outline",
|
|
10423
11570
|
spacing: 2,
|
|
10424
11571
|
className: "!w-full",
|
|
10425
|
-
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ (0,
|
|
11572
|
+
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10426
11573
|
ToggleGroupItem,
|
|
10427
11574
|
{
|
|
10428
11575
|
value: type,
|
|
@@ -10434,8 +11581,8 @@ function SettingsSheet({
|
|
|
10434
11581
|
}
|
|
10435
11582
|
)
|
|
10436
11583
|
] }),
|
|
10437
|
-
draft.characterType === "builtin" && /* @__PURE__ */ (0,
|
|
10438
|
-
/* @__PURE__ */ (0,
|
|
11584
|
+
draft.characterType === "builtin" && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "space-y-2", children: [
|
|
11585
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10439
11586
|
"label",
|
|
10440
11587
|
{
|
|
10441
11588
|
htmlFor: "chatkit-pet-builtin",
|
|
@@ -10443,7 +11590,7 @@ function SettingsSheet({
|
|
|
10443
11590
|
children: t("pet.settings.builtin")
|
|
10444
11591
|
}
|
|
10445
11592
|
),
|
|
10446
|
-
/* @__PURE__ */ (0,
|
|
11593
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
10447
11594
|
Select,
|
|
10448
11595
|
{
|
|
10449
11596
|
value: selectedBuiltinPet.id,
|
|
@@ -10454,26 +11601,26 @@ function SettingsSheet({
|
|
|
10454
11601
|
}
|
|
10455
11602
|
},
|
|
10456
11603
|
children: [
|
|
10457
|
-
/* @__PURE__ */ (0,
|
|
11604
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10458
11605
|
SelectTrigger,
|
|
10459
11606
|
{
|
|
10460
11607
|
id: "chatkit-pet-builtin",
|
|
10461
11608
|
className: "min-h-12 w-full px-3 py-2",
|
|
10462
|
-
children: /* @__PURE__ */ (0,
|
|
11609
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectValue, { placeholder: selectedBuiltinPetLabel })
|
|
10463
11610
|
}
|
|
10464
11611
|
),
|
|
10465
|
-
/* @__PURE__ */ (0,
|
|
11612
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectContent, { className: "w-[var(--radix-select-trigger-width)]", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectGroup, { children: INCLUDED_PET_OPTIONS.map((pet) => {
|
|
10466
11613
|
const label = t(`pet.settings.builtins.${pet.id}`, {
|
|
10467
11614
|
defaultValue: pet.label
|
|
10468
11615
|
});
|
|
10469
|
-
return /* @__PURE__ */ (0,
|
|
11616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10470
11617
|
SelectItem,
|
|
10471
11618
|
{
|
|
10472
11619
|
value: pet.id,
|
|
10473
11620
|
className: "min-h-10 py-1.5 pl-2 pr-8",
|
|
10474
|
-
children: /* @__PURE__ */ (0,
|
|
10475
|
-
/* @__PURE__ */ (0,
|
|
10476
|
-
/* @__PURE__ */ (0,
|
|
11621
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
11622
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PetPreview, { src: pet.previewSrc, label }),
|
|
11623
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "min-w-0 truncate", children: label })
|
|
10477
11624
|
] })
|
|
10478
11625
|
},
|
|
10479
11626
|
pet.id
|
|
@@ -10483,8 +11630,8 @@ function SettingsSheet({
|
|
|
10483
11630
|
}
|
|
10484
11631
|
)
|
|
10485
11632
|
] }),
|
|
10486
|
-
draft.characterType === "atlas" && /* @__PURE__ */ (0,
|
|
10487
|
-
/* @__PURE__ */ (0,
|
|
11633
|
+
draft.characterType === "atlas" && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "space-y-2", children: [
|
|
11634
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10488
11635
|
"label",
|
|
10489
11636
|
{
|
|
10490
11637
|
className: "text-sm font-medium",
|
|
@@ -10492,7 +11639,7 @@ function SettingsSheet({
|
|
|
10492
11639
|
children: t("pet.settings.atlasUrl")
|
|
10493
11640
|
}
|
|
10494
11641
|
),
|
|
10495
|
-
/* @__PURE__ */ (0,
|
|
11642
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10496
11643
|
Input,
|
|
10497
11644
|
{
|
|
10498
11645
|
id: "chatkit-pet-atlas",
|
|
@@ -10502,15 +11649,15 @@ function SettingsSheet({
|
|
|
10502
11649
|
}
|
|
10503
11650
|
)
|
|
10504
11651
|
] }),
|
|
10505
|
-
/* @__PURE__ */ (0,
|
|
10506
|
-
/* @__PURE__ */ (0,
|
|
10507
|
-
/* @__PURE__ */ (0,
|
|
10508
|
-
/* @__PURE__ */ (0,
|
|
11652
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "space-y-2", children: [
|
|
11653
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
11654
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("label", { className: "text-sm font-medium", htmlFor: "chatkit-pet-scale", children: t("pet.settings.scale") }),
|
|
11655
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "text-xs tabular-nums text-muted-foreground", children: [
|
|
10509
11656
|
draft.scale.toFixed(2),
|
|
10510
11657
|
"x"
|
|
10511
11658
|
] })
|
|
10512
11659
|
] }),
|
|
10513
|
-
/* @__PURE__ */ (0,
|
|
11660
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10514
11661
|
Slider,
|
|
10515
11662
|
{
|
|
10516
11663
|
id: "chatkit-pet-scale",
|
|
@@ -10524,8 +11671,8 @@ function SettingsSheet({
|
|
|
10524
11671
|
}
|
|
10525
11672
|
)
|
|
10526
11673
|
] }),
|
|
10527
|
-
/* @__PURE__ */ (0,
|
|
10528
|
-
/* @__PURE__ */ (0,
|
|
11674
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
11675
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10529
11676
|
"input",
|
|
10530
11677
|
{
|
|
10531
11678
|
type: "checkbox",
|
|
@@ -10536,8 +11683,8 @@ function SettingsSheet({
|
|
|
10536
11683
|
),
|
|
10537
11684
|
t("pet.settings.draggable")
|
|
10538
11685
|
] }),
|
|
10539
|
-
/* @__PURE__ */ (0,
|
|
10540
|
-
/* @__PURE__ */ (0,
|
|
11686
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
11687
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10541
11688
|
"input",
|
|
10542
11689
|
{
|
|
10543
11690
|
type: "checkbox",
|
|
@@ -10548,8 +11695,8 @@ function SettingsSheet({
|
|
|
10548
11695
|
),
|
|
10549
11696
|
t("pet.settings.persistPosition")
|
|
10550
11697
|
] }),
|
|
10551
|
-
/* @__PURE__ */ (0,
|
|
10552
|
-
/* @__PURE__ */ (0,
|
|
11698
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex justify-end gap-2 pt-2", children: [
|
|
11699
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10553
11700
|
Button,
|
|
10554
11701
|
{
|
|
10555
11702
|
type: "button",
|
|
@@ -10558,7 +11705,7 @@ function SettingsSheet({
|
|
|
10558
11705
|
children: t("pet.settings.cancel")
|
|
10559
11706
|
}
|
|
10560
11707
|
),
|
|
10561
|
-
/* @__PURE__ */ (0,
|
|
11708
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Button, { type: "submit", children: t("pet.settings.save") })
|
|
10562
11709
|
] })
|
|
10563
11710
|
] })
|
|
10564
11711
|
] }) });
|
|
@@ -11064,7 +12211,7 @@ function findDomPointForComposerOffset(root, offset) {
|
|
|
11064
12211
|
}
|
|
11065
12212
|
|
|
11066
12213
|
// src/components/chat.tsx
|
|
11067
|
-
var
|
|
12214
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
11068
12215
|
var import_meta2 = {};
|
|
11069
12216
|
var defaultApiUrl2 = import_meta2.env.VITE_XPERTAI_API_URL;
|
|
11070
12217
|
var COMPOSER_INPUT_MAX_HEIGHT = 128;
|
|
@@ -11197,8 +12344,8 @@ function ReferenceChip({
|
|
|
11197
12344
|
}) {
|
|
11198
12345
|
const metaLine = getReferenceMetaLine(reference);
|
|
11199
12346
|
const isComposer = variant === "composer";
|
|
11200
|
-
const Icon = reference.type === "quote" ?
|
|
11201
|
-
return /* @__PURE__ */ (0,
|
|
12347
|
+
const Icon = reference.type === "quote" ? import_lucide_react24.Quote : reference.type === "image" ? import_lucide_react24.ImageIcon : import_lucide_react24.FileText;
|
|
12348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
11202
12349
|
"div",
|
|
11203
12350
|
{
|
|
11204
12351
|
className: cn(
|
|
@@ -11207,7 +12354,7 @@ function ReferenceChip({
|
|
|
11207
12354
|
),
|
|
11208
12355
|
title: getReferenceTitle(reference),
|
|
11209
12356
|
children: [
|
|
11210
|
-
/* @__PURE__ */ (0,
|
|
12357
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
11211
12358
|
Icon,
|
|
11212
12359
|
{
|
|
11213
12360
|
size: isComposer ? 14 : 12,
|
|
@@ -11217,8 +12364,8 @@ function ReferenceChip({
|
|
|
11217
12364
|
)
|
|
11218
12365
|
}
|
|
11219
12366
|
),
|
|
11220
|
-
/* @__PURE__ */ (0,
|
|
11221
|
-
/* @__PURE__ */ (0,
|
|
12367
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
12368
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
11222
12369
|
"div",
|
|
11223
12370
|
{
|
|
11224
12371
|
className: cn(
|
|
@@ -11228,7 +12375,7 @@ function ReferenceChip({
|
|
|
11228
12375
|
children: getReferenceLabel(reference)
|
|
11229
12376
|
}
|
|
11230
12377
|
),
|
|
11231
|
-
metaLine && /* @__PURE__ */ (0,
|
|
12378
|
+
metaLine && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
11232
12379
|
"div",
|
|
11233
12380
|
{
|
|
11234
12381
|
className: cn(
|
|
@@ -11239,7 +12386,7 @@ function ReferenceChip({
|
|
|
11239
12386
|
}
|
|
11240
12387
|
)
|
|
11241
12388
|
] }),
|
|
11242
|
-
onRemove && removeLabel && /* @__PURE__ */ (0,
|
|
12389
|
+
onRemove && removeLabel && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
11243
12390
|
"button",
|
|
11244
12391
|
{
|
|
11245
12392
|
type: "button",
|
|
@@ -11250,7 +12397,7 @@ function ReferenceChip({
|
|
|
11250
12397
|
),
|
|
11251
12398
|
title: removeLabel,
|
|
11252
12399
|
"aria-label": removeLabel,
|
|
11253
|
-
children: /* @__PURE__ */ (0,
|
|
12400
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react24.X, { size: 12 })
|
|
11254
12401
|
}
|
|
11255
12402
|
)
|
|
11256
12403
|
]
|
|
@@ -11274,20 +12421,20 @@ function Chat({
|
|
|
11274
12421
|
const { setStream } = useStreamManager();
|
|
11275
12422
|
const stream = useStreamContext();
|
|
11276
12423
|
const { theme } = useTheme();
|
|
11277
|
-
const [isHistoryLoading, setIsHistoryLoading] =
|
|
11278
|
-
const [historyError, setHistoryError] =
|
|
11279
|
-
const [assistantName, setAssistantName] =
|
|
11280
|
-
const [assistantAvatar, setAssistantAvatar] =
|
|
12424
|
+
const [isHistoryLoading, setIsHistoryLoading] = React44.useState(false);
|
|
12425
|
+
const [historyError, setHistoryError] = React44.useState(null);
|
|
12426
|
+
const [assistantName, setAssistantName] = React44.useState(null);
|
|
12427
|
+
const [assistantAvatar, setAssistantAvatar] = React44.useState(null);
|
|
11281
12428
|
const LOADING_DOTS_MIN_DURATION = 800;
|
|
11282
12429
|
const STREAMING_STATUS_REFRESH_MS = 250;
|
|
11283
|
-
const [showLoadingDots, setShowLoadingDots] =
|
|
11284
|
-
const [streamingNow, setStreamingNow] =
|
|
11285
|
-
const loadingStartTimeRef =
|
|
11286
|
-
const lastStreamOutputAtRef =
|
|
11287
|
-
|
|
12430
|
+
const [showLoadingDots, setShowLoadingDots] = React44.useState(false);
|
|
12431
|
+
const [streamingNow, setStreamingNow] = React44.useState(() => Date.now());
|
|
12432
|
+
const loadingStartTimeRef = React44.useRef(null);
|
|
12433
|
+
const lastStreamOutputAtRef = React44.useRef(null);
|
|
12434
|
+
React44.useEffect(() => {
|
|
11288
12435
|
setStream(stream);
|
|
11289
12436
|
}, [setStream, stream]);
|
|
11290
|
-
|
|
12437
|
+
React44.useEffect(() => {
|
|
11291
12438
|
if (stream.isLoading) {
|
|
11292
12439
|
if (!loadingStartTimeRef.current) {
|
|
11293
12440
|
loadingStartTimeRef.current = Date.now();
|
|
@@ -11310,7 +12457,7 @@ function Chat({
|
|
|
11310
12457
|
}
|
|
11311
12458
|
}
|
|
11312
12459
|
}, [stream.isLoading]);
|
|
11313
|
-
|
|
12460
|
+
React44.useEffect(() => {
|
|
11314
12461
|
if (!stream.isLoading) {
|
|
11315
12462
|
lastStreamOutputAtRef.current = null;
|
|
11316
12463
|
setStreamingNow(Date.now());
|
|
@@ -11320,7 +12467,7 @@ function Chat({
|
|
|
11320
12467
|
lastStreamOutputAtRef.current = now;
|
|
11321
12468
|
setStreamingNow(now);
|
|
11322
12469
|
}, [stream.messages, stream.isLoading]);
|
|
11323
|
-
|
|
12470
|
+
React44.useEffect(() => {
|
|
11324
12471
|
if (!stream.isLoading) {
|
|
11325
12472
|
return;
|
|
11326
12473
|
}
|
|
@@ -11329,74 +12476,74 @@ function Chat({
|
|
|
11329
12476
|
}, STREAMING_STATUS_REFRESH_MS);
|
|
11330
12477
|
return () => window.clearInterval(timer);
|
|
11331
12478
|
}, [stream.isLoading]);
|
|
11332
|
-
const [composerParts, setComposerParts] =
|
|
11333
|
-
const [renderedComposerParts, setRenderedComposerParts] =
|
|
11334
|
-
const [composerDomVersion, setComposerDomVersion] =
|
|
11335
|
-
const [selectedTool, setSelectedTool] =
|
|
12479
|
+
const [composerParts, setComposerParts] = React44.useState([]);
|
|
12480
|
+
const [renderedComposerParts, setRenderedComposerParts] = React44.useState([]);
|
|
12481
|
+
const [composerDomVersion, setComposerDomVersion] = React44.useState(0);
|
|
12482
|
+
const [selectedTool, setSelectedTool] = React44.useState(
|
|
11336
12483
|
null
|
|
11337
12484
|
);
|
|
11338
|
-
const [planModeEnabled, setPlanModeEnabled] =
|
|
11339
|
-
const [petSettingsOpen, setPetSettingsOpen] =
|
|
11340
|
-
const [petLocalSettings, setPetLocalSettings] =
|
|
11341
|
-
const [runtimeCapabilities, setRuntimeCapabilities] =
|
|
11342
|
-
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] =
|
|
11343
|
-
const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] =
|
|
12485
|
+
const [planModeEnabled, setPlanModeEnabled] = React44.useState(false);
|
|
12486
|
+
const [petSettingsOpen, setPetSettingsOpen] = React44.useState(false);
|
|
12487
|
+
const [petLocalSettings, setPetLocalSettings] = React44.useState(() => readPetLocalSettings());
|
|
12488
|
+
const [runtimeCapabilities, setRuntimeCapabilities] = React44.useState(null);
|
|
12489
|
+
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] = React44.useState(false);
|
|
12490
|
+
const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] = React44.useState(
|
|
11344
12491
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
11345
12492
|
);
|
|
11346
|
-
const [runRuntimeCapabilities, setRunRuntimeCapabilities] =
|
|
12493
|
+
const [runRuntimeCapabilities, setRunRuntimeCapabilities] = React44.useState(
|
|
11347
12494
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
11348
12495
|
);
|
|
11349
|
-
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] =
|
|
11350
|
-
const [attachments, setAttachments] =
|
|
11351
|
-
const [references, setReferences] =
|
|
11352
|
-
const [isUploadingReferenceImages, setIsUploadingReferenceImages] =
|
|
11353
|
-
const [quoteSelection, setQuoteSelection] =
|
|
11354
|
-
const [isAtBottom, setIsAtBottom] =
|
|
11355
|
-
const [hasUpdatesBelow, setHasUpdatesBelow] =
|
|
12496
|
+
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] = React44.useState(null);
|
|
12497
|
+
const [attachments, setAttachments] = React44.useState([]);
|
|
12498
|
+
const [references, setReferences] = React44.useState([]);
|
|
12499
|
+
const [isUploadingReferenceImages, setIsUploadingReferenceImages] = React44.useState(false);
|
|
12500
|
+
const [quoteSelection, setQuoteSelection] = React44.useState(null);
|
|
12501
|
+
const [isAtBottom, setIsAtBottom] = React44.useState(true);
|
|
12502
|
+
const [hasUpdatesBelow, setHasUpdatesBelow] = React44.useState(false);
|
|
11356
12503
|
const {
|
|
11357
12504
|
threads,
|
|
11358
12505
|
deleteThread,
|
|
11359
12506
|
refreshThreads,
|
|
11360
12507
|
isLoading: isThreadsLoading
|
|
11361
12508
|
} = useThreads();
|
|
11362
|
-
const viewportRef =
|
|
11363
|
-
const fileInputRef =
|
|
11364
|
-
const composerInputRef =
|
|
11365
|
-
const slashPaletteRef =
|
|
11366
|
-
const slashPaletteOptionRefs =
|
|
12509
|
+
const viewportRef = React44.useRef(null);
|
|
12510
|
+
const fileInputRef = React44.useRef(null);
|
|
12511
|
+
const composerInputRef = React44.useRef(null);
|
|
12512
|
+
const slashPaletteRef = React44.useRef(null);
|
|
12513
|
+
const slashPaletteOptionRefs = React44.useRef(
|
|
11367
12514
|
[]
|
|
11368
12515
|
);
|
|
11369
|
-
const composerPartsRef =
|
|
11370
|
-
const pendingComposerCaretOffsetRef =
|
|
11371
|
-
const shouldAutoScrollRef =
|
|
11372
|
-
const forceFollowRef =
|
|
11373
|
-
const previousMessageCountRef =
|
|
11374
|
-
const previousScrollTopRef =
|
|
11375
|
-
const autoScrollFrameRef =
|
|
11376
|
-
const isPointerDownRef =
|
|
11377
|
-
const lastTouchYRef =
|
|
11378
|
-
const runtimeCapabilityPreferenceLoadRef =
|
|
12516
|
+
const composerPartsRef = React44.useRef([]);
|
|
12517
|
+
const pendingComposerCaretOffsetRef = React44.useRef(null);
|
|
12518
|
+
const shouldAutoScrollRef = React44.useRef(true);
|
|
12519
|
+
const forceFollowRef = React44.useRef(false);
|
|
12520
|
+
const previousMessageCountRef = React44.useRef(0);
|
|
12521
|
+
const previousScrollTopRef = React44.useRef(0);
|
|
12522
|
+
const autoScrollFrameRef = React44.useRef(null);
|
|
12523
|
+
const isPointerDownRef = React44.useRef(false);
|
|
12524
|
+
const lastTouchYRef = React44.useRef(null);
|
|
12525
|
+
const runtimeCapabilityPreferenceLoadRef = React44.useRef(0);
|
|
11379
12526
|
const resolvedTitle = title ?? t("chat.title");
|
|
11380
12527
|
const resolvedPlaceholder = placeholder ?? t("chat.placeholder");
|
|
11381
12528
|
const petRequired = options?.displayMode === "pet";
|
|
11382
|
-
const basePetSettings =
|
|
12529
|
+
const basePetSettings = React44.useMemo(
|
|
11383
12530
|
() => derivePetLocalSettings(options?.pet),
|
|
11384
12531
|
[options?.pet]
|
|
11385
12532
|
);
|
|
11386
|
-
const displayedPetSettings =
|
|
12533
|
+
const displayedPetSettings = React44.useMemo(
|
|
11387
12534
|
() => ({
|
|
11388
12535
|
...petLocalSettings ?? basePetSettings,
|
|
11389
12536
|
...petRequired ? { enabled: true } : {}
|
|
11390
12537
|
}),
|
|
11391
12538
|
[basePetSettings, petLocalSettings, petRequired]
|
|
11392
12539
|
);
|
|
11393
|
-
const effectivePet =
|
|
12540
|
+
const effectivePet = React44.useMemo(() => {
|
|
11394
12541
|
if (petRequired || petLocalSettings) {
|
|
11395
12542
|
return buildPetOptionsFromLocalSettings(displayedPetSettings);
|
|
11396
12543
|
}
|
|
11397
12544
|
return options?.pet ?? null;
|
|
11398
12545
|
}, [displayedPetSettings, options?.pet, petLocalSettings, petRequired]);
|
|
11399
|
-
const savePetLocalSettings =
|
|
12546
|
+
const savePetLocalSettings = React44.useCallback(
|
|
11400
12547
|
(settings) => {
|
|
11401
12548
|
const nextSettings = petRequired ? { ...settings, enabled: true } : settings;
|
|
11402
12549
|
setPetLocalSettings(nextSettings);
|
|
@@ -11404,7 +12551,7 @@ function Chat({
|
|
|
11404
12551
|
},
|
|
11405
12552
|
[petRequired]
|
|
11406
12553
|
);
|
|
11407
|
-
const handlePetCommand =
|
|
12554
|
+
const handlePetCommand = React44.useCallback(
|
|
11408
12555
|
(mode) => {
|
|
11409
12556
|
if (mode === "settings") {
|
|
11410
12557
|
setPetSettingsOpen(true);
|
|
@@ -11426,11 +12573,11 @@ function Chat({
|
|
|
11426
12573
|
[displayedPetSettings, effectivePet, petRequired, savePetLocalSettings]
|
|
11427
12574
|
);
|
|
11428
12575
|
const inputPlaceholder = selectedTool?.placeholderOverride ?? composer?.placeholder ?? resolvedPlaceholder;
|
|
11429
|
-
const messages =
|
|
12576
|
+
const messages = React44.useMemo(
|
|
11430
12577
|
() => stream.messages ?? [],
|
|
11431
12578
|
[stream.messages]
|
|
11432
12579
|
);
|
|
11433
|
-
const draft =
|
|
12580
|
+
const draft = React44.useMemo(
|
|
11434
12581
|
() => getComposerPlainText(composerParts),
|
|
11435
12582
|
[composerParts]
|
|
11436
12583
|
);
|
|
@@ -11442,7 +12589,7 @@ function Chat({
|
|
|
11442
12589
|
isEmpty: isComposerInputEmpty,
|
|
11443
12590
|
isStacked: isComposerStacked
|
|
11444
12591
|
});
|
|
11445
|
-
const pendingFollowUps =
|
|
12592
|
+
const pendingFollowUps = React44.useMemo(
|
|
11446
12593
|
() => [...stream.pendingFollowUps ?? []].sort(
|
|
11447
12594
|
(a, b) => a.createdAt - b.createdAt
|
|
11448
12595
|
),
|
|
@@ -11453,18 +12600,18 @@ function Chat({
|
|
|
11453
12600
|
const hasPendingHITLRequest = Boolean(stream.pendingHITLRequest);
|
|
11454
12601
|
const hasPendingInteractiveRequest = hasPendingRequestUserInput || hasPendingHITLRequest;
|
|
11455
12602
|
const hasPendingTodos = Boolean(stream.todos?.items.length);
|
|
11456
|
-
const runtimeCapabilityOptions =
|
|
12603
|
+
const runtimeCapabilityOptions = React44.useMemo(
|
|
11457
12604
|
() => getRuntimeCapabilityOptions(runtimeCapabilities),
|
|
11458
12605
|
[runtimeCapabilities]
|
|
11459
12606
|
);
|
|
11460
|
-
const effectiveSessionRuntimeCapabilities =
|
|
12607
|
+
const effectiveSessionRuntimeCapabilities = React44.useMemo(
|
|
11461
12608
|
() => runtimeCapabilitiesReady && runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
11462
12609
|
runtimeCapabilities,
|
|
11463
12610
|
sessionRuntimeCapabilities
|
|
11464
12611
|
) : null,
|
|
11465
12612
|
[runtimeCapabilities, runtimeCapabilitiesReady, sessionRuntimeCapabilities]
|
|
11466
12613
|
);
|
|
11467
|
-
const runRuntimeCapabilityOptions =
|
|
12614
|
+
const runRuntimeCapabilityOptions = React44.useMemo(
|
|
11468
12615
|
() => runtimeCapabilityOptions.filter(
|
|
11469
12616
|
(option) => isRuntimeCapabilitySelected(
|
|
11470
12617
|
runRuntimeCapabilities,
|
|
@@ -11474,11 +12621,11 @@ function Chat({
|
|
|
11474
12621
|
),
|
|
11475
12622
|
[runRuntimeCapabilities, runtimeCapabilityOptions]
|
|
11476
12623
|
);
|
|
11477
|
-
const composerRuntimeCapabilitySelectionKeys =
|
|
12624
|
+
const composerRuntimeCapabilitySelectionKeys = React44.useMemo(
|
|
11478
12625
|
() => getComposerCapabilitySelectionKeys(composerParts),
|
|
11479
12626
|
[composerParts]
|
|
11480
12627
|
);
|
|
11481
|
-
const detachedRunRuntimeCapabilityOptions =
|
|
12628
|
+
const detachedRunRuntimeCapabilityOptions = React44.useMemo(
|
|
11482
12629
|
() => runRuntimeCapabilityOptions.filter(
|
|
11483
12630
|
(option) => !composerRuntimeCapabilitySelectionKeys.has(
|
|
11484
12631
|
getRuntimeCapabilityOptionKey(option)
|
|
@@ -11486,7 +12633,7 @@ function Chat({
|
|
|
11486
12633
|
),
|
|
11487
12634
|
[composerRuntimeCapabilitySelectionKeys, runRuntimeCapabilityOptions]
|
|
11488
12635
|
);
|
|
11489
|
-
const persistSessionRuntimeCapabilities =
|
|
12636
|
+
const persistSessionRuntimeCapabilities = React44.useCallback(
|
|
11490
12637
|
async (threadId, selection) => {
|
|
11491
12638
|
if (!runtimeCapabilities || !selection) {
|
|
11492
12639
|
return;
|
|
@@ -11511,10 +12658,10 @@ function Chat({
|
|
|
11511
12658
|
},
|
|
11512
12659
|
[runtimeCapabilities, stream.client]
|
|
11513
12660
|
);
|
|
11514
|
-
const clearQuoteSelection =
|
|
12661
|
+
const clearQuoteSelection = React44.useCallback(() => {
|
|
11515
12662
|
setQuoteSelection(null);
|
|
11516
12663
|
}, []);
|
|
11517
|
-
const commitComposerParts =
|
|
12664
|
+
const commitComposerParts = React44.useCallback(
|
|
11518
12665
|
(nextParts, options2) => {
|
|
11519
12666
|
const normalized = normalizeComposerParts(nextParts);
|
|
11520
12667
|
const previous = composerPartsRef.current;
|
|
@@ -11550,7 +12697,7 @@ function Chat({
|
|
|
11550
12697
|
},
|
|
11551
12698
|
[]
|
|
11552
12699
|
);
|
|
11553
|
-
const setComposerText =
|
|
12700
|
+
const setComposerText = React44.useCallback(
|
|
11554
12701
|
(text, caretOffset = text.length) => {
|
|
11555
12702
|
commitComposerParts(createComposerTextParts(text), {
|
|
11556
12703
|
caretOffset,
|
|
@@ -11560,7 +12707,7 @@ function Chat({
|
|
|
11560
12707
|
},
|
|
11561
12708
|
[commitComposerParts]
|
|
11562
12709
|
);
|
|
11563
|
-
const focusComposerAt =
|
|
12710
|
+
const focusComposerAt = React44.useCallback((position) => {
|
|
11564
12711
|
const nextPosition = position ?? getComposerEditingLength(composerPartsRef.current);
|
|
11565
12712
|
pendingComposerCaretOffsetRef.current = nextPosition;
|
|
11566
12713
|
requestAnimationFrame(() => {
|
|
@@ -11572,7 +12719,7 @@ function Chat({
|
|
|
11572
12719
|
});
|
|
11573
12720
|
}, []);
|
|
11574
12721
|
const parentMessenger = useParentMessenger({
|
|
11575
|
-
onSetComposerValue:
|
|
12722
|
+
onSetComposerValue: React44.useCallback(
|
|
11576
12723
|
(payload) => {
|
|
11577
12724
|
if (!payload) {
|
|
11578
12725
|
return;
|
|
@@ -11595,10 +12742,10 @@ function Chat({
|
|
|
11595
12742
|
},
|
|
11596
12743
|
[composer?.tools, setComposerText]
|
|
11597
12744
|
),
|
|
11598
|
-
onFocusComposer:
|
|
12745
|
+
onFocusComposer: React44.useCallback(() => {
|
|
11599
12746
|
composerInputRef.current?.focus();
|
|
11600
12747
|
}, []),
|
|
11601
|
-
onSetPetEnabled:
|
|
12748
|
+
onSetPetEnabled: React44.useCallback(
|
|
11602
12749
|
(enabled) => {
|
|
11603
12750
|
if (petRequired) {
|
|
11604
12751
|
return;
|
|
@@ -11611,7 +12758,7 @@ function Chat({
|
|
|
11611
12758
|
[displayedPetSettings, petRequired, savePetLocalSettings]
|
|
11612
12759
|
)
|
|
11613
12760
|
});
|
|
11614
|
-
const syncQuoteSelection =
|
|
12761
|
+
const syncQuoteSelection = React44.useCallback(() => {
|
|
11615
12762
|
if (typeof window === "undefined") {
|
|
11616
12763
|
clearQuoteSelection();
|
|
11617
12764
|
return;
|
|
@@ -11656,23 +12803,23 @@ function Chat({
|
|
|
11656
12803
|
left
|
|
11657
12804
|
});
|
|
11658
12805
|
}, [clearQuoteSelection]);
|
|
11659
|
-
const cancelPendingAutoScroll =
|
|
12806
|
+
const cancelPendingAutoScroll = React44.useCallback(() => {
|
|
11660
12807
|
if (autoScrollFrameRef.current !== null) {
|
|
11661
12808
|
cancelAnimationFrame(autoScrollFrameRef.current);
|
|
11662
12809
|
autoScrollFrameRef.current = null;
|
|
11663
12810
|
}
|
|
11664
12811
|
}, []);
|
|
11665
|
-
const disableAutoFollow =
|
|
12812
|
+
const disableAutoFollow = React44.useCallback(() => {
|
|
11666
12813
|
forceFollowRef.current = false;
|
|
11667
12814
|
shouldAutoScrollRef.current = false;
|
|
11668
12815
|
cancelPendingAutoScroll();
|
|
11669
12816
|
}, [cancelPendingAutoScroll]);
|
|
11670
|
-
const enableAutoFollow =
|
|
12817
|
+
const enableAutoFollow = React44.useCallback(() => {
|
|
11671
12818
|
forceFollowRef.current = true;
|
|
11672
12819
|
shouldAutoScrollRef.current = true;
|
|
11673
12820
|
setHasUpdatesBelow(false);
|
|
11674
12821
|
}, []);
|
|
11675
|
-
const scrollToBottom =
|
|
12822
|
+
const scrollToBottom = React44.useCallback(
|
|
11676
12823
|
(smooth = false, force = false) => {
|
|
11677
12824
|
if (force) {
|
|
11678
12825
|
enableAutoFollow();
|
|
@@ -11699,7 +12846,7 @@ function Chat({
|
|
|
11699
12846
|
},
|
|
11700
12847
|
[cancelPendingAutoScroll, enableAutoFollow]
|
|
11701
12848
|
);
|
|
11702
|
-
|
|
12849
|
+
React44.useEffect(() => {
|
|
11703
12850
|
const viewport = viewportRef.current;
|
|
11704
12851
|
if (!viewport) return;
|
|
11705
12852
|
previousScrollTopRef.current = viewport.scrollTop;
|
|
@@ -11780,14 +12927,14 @@ function Chat({
|
|
|
11780
12927
|
window.removeEventListener("pointercancel", stopPointerTracking);
|
|
11781
12928
|
};
|
|
11782
12929
|
}, [cancelPendingAutoScroll, disableAutoFollow]);
|
|
11783
|
-
|
|
12930
|
+
React44.useEffect(() => {
|
|
11784
12931
|
shouldAutoScrollRef.current = true;
|
|
11785
12932
|
forceFollowRef.current = false;
|
|
11786
12933
|
previousScrollTopRef.current = 0;
|
|
11787
12934
|
setIsAtBottom(true);
|
|
11788
12935
|
setHasUpdatesBelow(false);
|
|
11789
12936
|
}, [stream.threadId]);
|
|
11790
|
-
|
|
12937
|
+
React44.useEffect(() => {
|
|
11791
12938
|
const messageCountChanged = messages.length !== previousMessageCountRef.current;
|
|
11792
12939
|
previousMessageCountRef.current = messages.length;
|
|
11793
12940
|
if (!shouldAutoScrollRef.current) {
|
|
@@ -11806,7 +12953,7 @@ function Chat({
|
|
|
11806
12953
|
clientSecret: effectiveClientSecret
|
|
11807
12954
|
});
|
|
11808
12955
|
const missingConfig = Boolean(missingConfigKind);
|
|
11809
|
-
const missingConfigShortMessage =
|
|
12956
|
+
const missingConfigShortMessage = React44.useMemo(() => {
|
|
11810
12957
|
switch (missingConfigKind) {
|
|
11811
12958
|
case "apiUrl":
|
|
11812
12959
|
return t("chat.missingApiUrlShort");
|
|
@@ -11818,7 +12965,7 @@ function Chat({
|
|
|
11818
12965
|
return t("chat.missingConfigShort");
|
|
11819
12966
|
}
|
|
11820
12967
|
}, [missingConfigKind, t]);
|
|
11821
|
-
const missingConfigDetailMessage =
|
|
12968
|
+
const missingConfigDetailMessage = React44.useMemo(() => {
|
|
11822
12969
|
switch (missingConfigKind) {
|
|
11823
12970
|
case "apiUrl":
|
|
11824
12971
|
return t("chat.missingApiUrlDetail");
|
|
@@ -11833,7 +12980,7 @@ function Chat({
|
|
|
11833
12980
|
const showMissingConfig = !isClientSecretInitializing && missingConfig;
|
|
11834
12981
|
const hasUploadingFiles = attachments.some((a) => a.status === "uploading");
|
|
11835
12982
|
const isSendDisabled = !trimmedDraft && !hasReferences || hasPendingInteractiveRequest || missingConfig || isHistoryLoading || hasUploadingFiles || isUploadingReferenceImages;
|
|
11836
|
-
const resizeComposerInput =
|
|
12983
|
+
const resizeComposerInput = React44.useCallback(() => {
|
|
11837
12984
|
const input = composerInputRef.current;
|
|
11838
12985
|
if (!input) {
|
|
11839
12986
|
return;
|
|
@@ -11841,7 +12988,7 @@ function Chat({
|
|
|
11841
12988
|
input.style.maxHeight = `${COMPOSER_INPUT_MAX_HEIGHT}px`;
|
|
11842
12989
|
input.style.overflowY = input.scrollHeight > COMPOSER_INPUT_MAX_HEIGHT ? "auto" : "hidden";
|
|
11843
12990
|
}, []);
|
|
11844
|
-
|
|
12991
|
+
React44.useLayoutEffect(() => {
|
|
11845
12992
|
composerPartsRef.current = composerParts;
|
|
11846
12993
|
resizeComposerInput();
|
|
11847
12994
|
const caretOffset = pendingComposerCaretOffsetRef.current;
|
|
@@ -11853,13 +13000,13 @@ function Chat({
|
|
|
11853
13000
|
}
|
|
11854
13001
|
}
|
|
11855
13002
|
}, [composerDomVersion, composerParts, resizeComposerInput]);
|
|
11856
|
-
|
|
13003
|
+
React44.useEffect(() => {
|
|
11857
13004
|
document.addEventListener("selectionchange", syncQuoteSelection);
|
|
11858
13005
|
return () => {
|
|
11859
13006
|
document.removeEventListener("selectionchange", syncQuoteSelection);
|
|
11860
13007
|
};
|
|
11861
13008
|
}, [syncQuoteSelection]);
|
|
11862
|
-
|
|
13009
|
+
React44.useEffect(() => {
|
|
11863
13010
|
const viewport = viewportRef.current;
|
|
11864
13011
|
if (!viewport) {
|
|
11865
13012
|
return;
|
|
@@ -11876,14 +13023,14 @@ function Chat({
|
|
|
11876
13023
|
window.removeEventListener("resize", handleViewportScroll);
|
|
11877
13024
|
};
|
|
11878
13025
|
}, [clearQuoteSelection]);
|
|
11879
|
-
|
|
13026
|
+
React44.useEffect(() => {
|
|
11880
13027
|
clearQuoteSelection();
|
|
11881
13028
|
}, [messages.length, stream.threadId, clearQuoteSelection]);
|
|
11882
|
-
|
|
13029
|
+
React44.useEffect(() => {
|
|
11883
13030
|
if (missingConfig) return;
|
|
11884
13031
|
void refreshThreads();
|
|
11885
13032
|
}, [missingConfig, refreshThreads]);
|
|
11886
|
-
|
|
13033
|
+
React44.useEffect(() => {
|
|
11887
13034
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
11888
13035
|
setAssistantName(null);
|
|
11889
13036
|
setAssistantAvatar(null);
|
|
@@ -11906,7 +13053,7 @@ function Chat({
|
|
|
11906
13053
|
cancelled = true;
|
|
11907
13054
|
};
|
|
11908
13055
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
11909
|
-
|
|
13056
|
+
React44.useEffect(() => {
|
|
11910
13057
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
11911
13058
|
setRuntimeCapabilities(null);
|
|
11912
13059
|
setRuntimeCapabilitiesReady(false);
|
|
@@ -11953,7 +13100,7 @@ function Chat({
|
|
|
11953
13100
|
});
|
|
11954
13101
|
return () => controller.abort();
|
|
11955
13102
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
11956
|
-
|
|
13103
|
+
React44.useEffect(() => {
|
|
11957
13104
|
setRunRuntimeCapabilities(
|
|
11958
13105
|
createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
|
|
11959
13106
|
);
|
|
@@ -12010,7 +13157,7 @@ function Chat({
|
|
|
12010
13157
|
mimetype: a.storageFile?.mimetype ?? a.file.type,
|
|
12011
13158
|
size: a.storageFile?.size ?? a.file.size
|
|
12012
13159
|
}));
|
|
12013
|
-
const handleSessionRuntimeCapabilityToggle =
|
|
13160
|
+
const handleSessionRuntimeCapabilityToggle = React44.useCallback(
|
|
12014
13161
|
(type, id, selected) => {
|
|
12015
13162
|
setSessionRuntimeCapabilities((previous) => {
|
|
12016
13163
|
const nextSelection = toggleRuntimeCapabilitySelection(
|
|
@@ -12028,7 +13175,7 @@ function Chat({
|
|
|
12028
13175
|
},
|
|
12029
13176
|
[persistSessionRuntimeCapabilities, stream.threadId]
|
|
12030
13177
|
);
|
|
12031
|
-
const updateRuntimeCapabilityPalette =
|
|
13178
|
+
const updateRuntimeCapabilityPalette = React44.useCallback(
|
|
12032
13179
|
(parts, selectionStart) => {
|
|
12033
13180
|
const input = composerInputRef.current;
|
|
12034
13181
|
const editingText = getComposerEditingText(parts);
|
|
@@ -12040,7 +13187,7 @@ function Chat({
|
|
|
12040
13187
|
},
|
|
12041
13188
|
[]
|
|
12042
13189
|
);
|
|
12043
|
-
const syncComposerInputFromElement =
|
|
13190
|
+
const syncComposerInputFromElement = React44.useCallback(
|
|
12044
13191
|
(input) => {
|
|
12045
13192
|
const previousCapabilities = getComposerCapabilityPartMap(
|
|
12046
13193
|
composerPartsRef.current
|
|
@@ -12058,25 +13205,25 @@ function Chat({
|
|
|
12058
13205
|
},
|
|
12059
13206
|
[commitComposerParts, updateRuntimeCapabilityPalette]
|
|
12060
13207
|
);
|
|
12061
|
-
const handleComposerInput =
|
|
13208
|
+
const handleComposerInput = React44.useCallback(
|
|
12062
13209
|
(event) => {
|
|
12063
13210
|
syncComposerInputFromElement(event.currentTarget);
|
|
12064
13211
|
},
|
|
12065
13212
|
[syncComposerInputFromElement]
|
|
12066
13213
|
);
|
|
12067
|
-
const handleComposerCompositionEnd =
|
|
13214
|
+
const handleComposerCompositionEnd = React44.useCallback(
|
|
12068
13215
|
(event) => {
|
|
12069
13216
|
syncComposerInputFromElement(event.currentTarget);
|
|
12070
13217
|
},
|
|
12071
13218
|
[syncComposerInputFromElement]
|
|
12072
13219
|
);
|
|
12073
|
-
const handleComposerSelect =
|
|
13220
|
+
const handleComposerSelect = React44.useCallback(() => {
|
|
12074
13221
|
updateRuntimeCapabilityPalette(
|
|
12075
13222
|
composerPartsRef.current,
|
|
12076
13223
|
composerInputRef.current ? getComposerSelectionOffset(composerInputRef.current) : void 0
|
|
12077
13224
|
);
|
|
12078
13225
|
}, [updateRuntimeCapabilityPalette]);
|
|
12079
|
-
const removeRunRuntimeCapability =
|
|
13226
|
+
const removeRunRuntimeCapability = React44.useCallback(
|
|
12080
13227
|
(option) => {
|
|
12081
13228
|
setRunRuntimeCapabilities(
|
|
12082
13229
|
(previous) => toggleRuntimeCapabilitySelection(
|
|
@@ -12096,7 +13243,7 @@ function Chat({
|
|
|
12096
13243
|
},
|
|
12097
13244
|
[commitComposerParts]
|
|
12098
13245
|
);
|
|
12099
|
-
const submitDraft =
|
|
13246
|
+
const submitDraft = React44.useCallback(
|
|
12100
13247
|
(optionsOrFollowUp) => {
|
|
12101
13248
|
if (isSendDisabled) return;
|
|
12102
13249
|
const submitOptions = typeof optionsOrFollowUp === "string" ? { followUpOverride: optionsOrFollowUp } : optionsOrFollowUp ?? {};
|
|
@@ -12220,7 +13367,7 @@ function Chat({
|
|
|
12220
13367
|
t
|
|
12221
13368
|
]
|
|
12222
13369
|
);
|
|
12223
|
-
const addRunRuntimeCapabilities =
|
|
13370
|
+
const addRunRuntimeCapabilities = React44.useCallback(
|
|
12224
13371
|
(selection) => {
|
|
12225
13372
|
setRunRuntimeCapabilities(
|
|
12226
13373
|
(previous) => runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
@@ -12232,7 +13379,7 @@ function Chat({
|
|
|
12232
13379
|
},
|
|
12233
13380
|
[runtimeCapabilities]
|
|
12234
13381
|
);
|
|
12235
|
-
const insertComposerCapabilityToken =
|
|
13382
|
+
const insertComposerCapabilityToken = React44.useCallback(
|
|
12236
13383
|
(capability, range) => {
|
|
12237
13384
|
const token = createComposerCapabilityPart(capability, createMessageId());
|
|
12238
13385
|
const currentParts = composerPartsRef.current;
|
|
@@ -12303,7 +13450,7 @@ function Chat({
|
|
|
12303
13450
|
plugin: t("composer.slashCommands.empty.loadingCapabilities"),
|
|
12304
13451
|
subAgent: t("composer.slashCommands.empty.loadingCapabilities")
|
|
12305
13452
|
};
|
|
12306
|
-
|
|
13453
|
+
React44.useEffect(() => {
|
|
12307
13454
|
if (!runtimeCapabilityPalette) {
|
|
12308
13455
|
return;
|
|
12309
13456
|
}
|
|
@@ -12322,7 +13469,7 @@ function Chat({
|
|
|
12322
13469
|
);
|
|
12323
13470
|
}
|
|
12324
13471
|
}, [slashPaletteOptions.length, runtimeCapabilityPalette]);
|
|
12325
|
-
|
|
13472
|
+
React44.useLayoutEffect(() => {
|
|
12326
13473
|
if (!runtimeCapabilityPalette) {
|
|
12327
13474
|
return;
|
|
12328
13475
|
}
|
|
@@ -12346,7 +13493,7 @@ function Chat({
|
|
|
12346
13493
|
}
|
|
12347
13494
|
submitDraft();
|
|
12348
13495
|
};
|
|
12349
|
-
const handleEditPendingFollowUp =
|
|
13496
|
+
const handleEditPendingFollowUp = React44.useCallback(
|
|
12350
13497
|
(id) => {
|
|
12351
13498
|
const item = pendingFollowUps.find(
|
|
12352
13499
|
(entry) => entry.id === id && entry.mode === "queue"
|
|
@@ -12373,7 +13520,7 @@ function Chat({
|
|
|
12373
13520
|
},
|
|
12374
13521
|
[pendingFollowUps, setComposerText, stream]
|
|
12375
13522
|
);
|
|
12376
|
-
const handleQuoteSelection =
|
|
13523
|
+
const handleQuoteSelection = React44.useCallback(() => {
|
|
12377
13524
|
if (!quoteSelection) {
|
|
12378
13525
|
return;
|
|
12379
13526
|
}
|
|
@@ -12389,7 +13536,7 @@ function Chat({
|
|
|
12389
13536
|
const handleAttachmentClick = () => {
|
|
12390
13537
|
fileInputRef.current?.click();
|
|
12391
13538
|
};
|
|
12392
|
-
const uploadContextFile =
|
|
13539
|
+
const uploadContextFile = React44.useCallback(
|
|
12393
13540
|
(file) => stream.client.contexts.uploadFile(file),
|
|
12394
13541
|
[stream.client]
|
|
12395
13542
|
);
|
|
@@ -12493,7 +13640,7 @@ function Chat({
|
|
|
12493
13640
|
}
|
|
12494
13641
|
submitDraft();
|
|
12495
13642
|
};
|
|
12496
|
-
const handleComposerPaste =
|
|
13643
|
+
const handleComposerPaste = React44.useCallback(
|
|
12497
13644
|
(event) => {
|
|
12498
13645
|
const clipboardData = event.clipboardData;
|
|
12499
13646
|
if (!clipboardData) {
|
|
@@ -12592,18 +13739,18 @@ function Chat({
|
|
|
12592
13739
|
uploadContextFile
|
|
12593
13740
|
]
|
|
12594
13741
|
);
|
|
12595
|
-
const alternateFollowUpShortcutLabel =
|
|
13742
|
+
const alternateFollowUpShortcutLabel = React44.useMemo(() => {
|
|
12596
13743
|
if (typeof navigator === "undefined") {
|
|
12597
13744
|
return "\u2318Enter";
|
|
12598
13745
|
}
|
|
12599
13746
|
const platform = navigator.platform || navigator.userAgent;
|
|
12600
13747
|
return /Mac|iPhone|iPad|iPod/i.test(platform) ? "\u2318Enter" : "Ctrl+Enter";
|
|
12601
13748
|
}, []);
|
|
12602
|
-
const followUpShortcutLabels =
|
|
13749
|
+
const followUpShortcutLabels = React44.useMemo(
|
|
12603
13750
|
() => getComposerFollowUpShortcutLabels(alternateFollowUpShortcutLabel),
|
|
12604
13751
|
[alternateFollowUpShortcutLabel]
|
|
12605
13752
|
);
|
|
12606
|
-
const uploadFile =
|
|
13753
|
+
const uploadFile = React44.useCallback(
|
|
12607
13754
|
async (localId, file) => {
|
|
12608
13755
|
try {
|
|
12609
13756
|
const result = await uploadContextFile(file);
|
|
@@ -12626,7 +13773,7 @@ function Chat({
|
|
|
12626
13773
|
},
|
|
12627
13774
|
[uploadContextFile]
|
|
12628
13775
|
);
|
|
12629
|
-
const handleRetryUpload =
|
|
13776
|
+
const handleRetryUpload = React44.useCallback(
|
|
12630
13777
|
(localId) => {
|
|
12631
13778
|
const attachment = attachments.find((a) => a.localId === localId);
|
|
12632
13779
|
if (!attachment || attachment.status !== "error") return;
|
|
@@ -12725,7 +13872,7 @@ function Chat({
|
|
|
12725
13872
|
);
|
|
12726
13873
|
scrollToBottom(true, true);
|
|
12727
13874
|
};
|
|
12728
|
-
const loadConversationMessages =
|
|
13875
|
+
const loadConversationMessages = React44.useCallback(
|
|
12729
13876
|
async (recordId) => {
|
|
12730
13877
|
if (missingConfig) {
|
|
12731
13878
|
setHistoryError(missingConfigShortMessage);
|
|
@@ -12820,12 +13967,12 @@ function Chat({
|
|
|
12820
13967
|
}
|
|
12821
13968
|
};
|
|
12822
13969
|
const acceptMimes = composer?.attachments?.accept ? Object.entries(composer.attachments.accept).map(([mime, exts]) => [mime, ...exts.map((e) => `.${e}`)].join(",")).join(",") : void 0;
|
|
12823
|
-
const currentThread =
|
|
13970
|
+
const currentThread = React44.useMemo(
|
|
12824
13971
|
() => threads.find((item) => item.id === stream.threadId),
|
|
12825
13972
|
[threads, stream.threadId]
|
|
12826
13973
|
);
|
|
12827
13974
|
const streamErrorMessage = stream.error instanceof Error ? stream.error.message : void 0;
|
|
12828
|
-
const threadErrorMessage =
|
|
13975
|
+
const threadErrorMessage = React44.useMemo(() => {
|
|
12829
13976
|
if (streamErrorMessage?.trim()) return streamErrorMessage.trim();
|
|
12830
13977
|
if (currentThread?.status !== "error") return void 0;
|
|
12831
13978
|
const message = currentThread.error?.trim();
|
|
@@ -12856,7 +14003,7 @@ function Chat({
|
|
|
12856
14003
|
fallbackTitle: t("history.threadFallback")
|
|
12857
14004
|
});
|
|
12858
14005
|
const assistantTitle = assistantName || resolvedTitle;
|
|
12859
|
-
return /* @__PURE__ */ (0,
|
|
14006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
12860
14007
|
"div",
|
|
12861
14008
|
{
|
|
12862
14009
|
ref: viewportRef,
|
|
@@ -12866,10 +14013,10 @@ function Chat({
|
|
|
12866
14013
|
className
|
|
12867
14014
|
),
|
|
12868
14015
|
children: [
|
|
12869
|
-
/* @__PURE__ */ (0,
|
|
12870
|
-
/* @__PURE__ */ (0,
|
|
12871
|
-
/* @__PURE__ */ (0,
|
|
12872
|
-
/* @__PURE__ */ (0,
|
|
14016
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center justify-between border-b p-2 sticky top-0 z-10 bg-background", children: [
|
|
14017
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center gap-3 overflow-hidden", children: [
|
|
14018
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "relative shrink-0", children: [
|
|
14019
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12873
14020
|
ChatkitAvatar,
|
|
12874
14021
|
{
|
|
12875
14022
|
avatar: assistantAvatar,
|
|
@@ -12877,10 +14024,10 @@ function Chat({
|
|
|
12877
14024
|
label: assistantTitle
|
|
12878
14025
|
}
|
|
12879
14026
|
),
|
|
12880
|
-
/* @__PURE__ */ (0,
|
|
14027
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-green-500" })
|
|
12881
14028
|
] }),
|
|
12882
|
-
/* @__PURE__ */ (0,
|
|
12883
|
-
/* @__PURE__ */ (0,
|
|
14029
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "truncate", children: [
|
|
14030
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12884
14031
|
"h2",
|
|
12885
14032
|
{
|
|
12886
14033
|
className: "text-lg font-semibold truncate",
|
|
@@ -12888,12 +14035,12 @@ function Chat({
|
|
|
12888
14035
|
children: assistantTitle
|
|
12889
14036
|
}
|
|
12890
14037
|
),
|
|
12891
|
-
/* @__PURE__ */ (0,
|
|
14038
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-xs text-muted-foreground", children: t("chat.statusOnline") })
|
|
12892
14039
|
] })
|
|
12893
14040
|
] }),
|
|
12894
|
-
/* @__PURE__ */ (0,
|
|
12895
|
-
/* @__PURE__ */ (0,
|
|
12896
|
-
/* @__PURE__ */ (0,
|
|
14041
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
14042
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(Tooltip, { children: [
|
|
14043
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12897
14044
|
"button",
|
|
12898
14045
|
{
|
|
12899
14046
|
type: "button",
|
|
@@ -12904,14 +14051,14 @@ function Chat({
|
|
|
12904
14051
|
"transition-colors duration-150"
|
|
12905
14052
|
),
|
|
12906
14053
|
"aria-label": t("settings.open"),
|
|
12907
|
-
children: /* @__PURE__ */ (0,
|
|
14054
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react24.Settings, { size: 16 })
|
|
12908
14055
|
}
|
|
12909
14056
|
) }) }),
|
|
12910
|
-
/* @__PURE__ */ (0,
|
|
14057
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TooltipContent, { side: "bottom", children: t("settings.open") })
|
|
12911
14058
|
] }),
|
|
12912
|
-
history?.enabled !== false && /* @__PURE__ */ (0,
|
|
12913
|
-
/* @__PURE__ */ (0,
|
|
12914
|
-
/* @__PURE__ */ (0,
|
|
14059
|
+
history?.enabled !== false && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
14060
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(Tooltip, { children: [
|
|
14061
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12915
14062
|
"button",
|
|
12916
14063
|
{
|
|
12917
14064
|
type: "button",
|
|
@@ -12924,12 +14071,12 @@ function Chat({
|
|
|
12924
14071
|
"disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed"
|
|
12925
14072
|
),
|
|
12926
14073
|
"aria-label": t("history.newThread"),
|
|
12927
|
-
children: /* @__PURE__ */ (0,
|
|
14074
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react24.Pencil, { size: 16 })
|
|
12928
14075
|
}
|
|
12929
14076
|
) }) }),
|
|
12930
|
-
/* @__PURE__ */ (0,
|
|
14077
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TooltipContent, { side: "bottom", children: t("history.newThread") })
|
|
12931
14078
|
] }),
|
|
12932
|
-
/* @__PURE__ */ (0,
|
|
14079
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12933
14080
|
HistorySidebar,
|
|
12934
14081
|
{
|
|
12935
14082
|
threads,
|
|
@@ -12944,18 +14091,18 @@ function Chat({
|
|
|
12944
14091
|
] })
|
|
12945
14092
|
] })
|
|
12946
14093
|
] }),
|
|
12947
|
-
/* @__PURE__ */ (0,
|
|
12948
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
12949
|
-
historyError && /* @__PURE__ */ (0,
|
|
12950
|
-
showMissingConfig && /* @__PURE__ */ (0,
|
|
12951
|
-
isHistoryLoading && /* @__PURE__ */ (0,
|
|
12952
|
-
messages.length === 0 ? /* @__PURE__ */ (0,
|
|
14094
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex-1 p-4", children: [
|
|
14095
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: errorMessage }),
|
|
14096
|
+
historyError && /* @__PURE__ */ (0, import_jsx_runtime49.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 }),
|
|
14097
|
+
showMissingConfig && /* @__PURE__ */ (0, import_jsx_runtime49.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 }),
|
|
14098
|
+
isHistoryLoading && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "mb-4 rounded-lg border border-muted px-3 py-2 text-sm text-muted-foreground", children: t("chat.loadingThread") }),
|
|
14099
|
+
messages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12953
14100
|
StartScreen,
|
|
12954
14101
|
{
|
|
12955
14102
|
startScreen,
|
|
12956
14103
|
onPromptClick: handlePromptClick
|
|
12957
14104
|
}
|
|
12958
|
-
) : /* @__PURE__ */ (0,
|
|
14105
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "space-y-4", children: [
|
|
12959
14106
|
messages.map((message, index) => {
|
|
12960
14107
|
const messageType = String(message.type);
|
|
12961
14108
|
const isAssistantMessage = messageType === "assistant" || messageType === "ai";
|
|
@@ -12988,7 +14135,7 @@ function Chat({
|
|
|
12988
14135
|
if (!isAssistantMessage && !hasPlainRenderableContent && !hasHumanAttachments && humanRuntimeCapabilityOptions.length === 0 && humanReferences.length === 0) {
|
|
12989
14136
|
return null;
|
|
12990
14137
|
}
|
|
12991
|
-
return /* @__PURE__ */ (0,
|
|
14138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12992
14139
|
"div",
|
|
12993
14140
|
{
|
|
12994
14141
|
className: cn(
|
|
@@ -12996,8 +14143,8 @@ function Chat({
|
|
|
12996
14143
|
message.type === "human" ? "justify-end" : "justify-start -ml-1"
|
|
12997
14144
|
// AI messages: slightly closer to left
|
|
12998
14145
|
),
|
|
12999
|
-
children: /* @__PURE__ */ (0,
|
|
13000
|
-
/* @__PURE__ */ (0,
|
|
14146
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col px-3 overflow-hidden", children: [
|
|
14147
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13001
14148
|
"div",
|
|
13002
14149
|
{
|
|
13003
14150
|
...canQuoteMessage ? {
|
|
@@ -13009,7 +14156,7 @@ function Chat({
|
|
|
13009
14156
|
message.type === "human" ? "bg-primary text-primary-foreground px-4 py-2.5" : message.type === "system" ? "bg-muted text-muted-foreground text-xs px-4 py-2.5" : "py-1 text-chat-foreground"
|
|
13010
14157
|
// AI messages: use chat-specific foreground color
|
|
13011
14158
|
),
|
|
13012
|
-
children: isAssistantMessage ? /* @__PURE__ */ (0,
|
|
14159
|
+
children: isAssistantMessage ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13013
14160
|
AssistantMessage,
|
|
13014
14161
|
{
|
|
13015
14162
|
message: {
|
|
@@ -13028,25 +14175,25 @@ function Chat({
|
|
|
13028
14175
|
organizationId: stream.organizationId,
|
|
13029
14176
|
apiUrl: stream.apiUrl
|
|
13030
14177
|
}
|
|
13031
|
-
) : /* @__PURE__ */ (0,
|
|
13032
|
-
message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0,
|
|
14178
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
14179
|
+
message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
13033
14180
|
"span",
|
|
13034
14181
|
{
|
|
13035
14182
|
className: "inline-flex max-w-full items-center gap-1 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs font-medium text-primary-foreground",
|
|
13036
14183
|
children: [
|
|
13037
|
-
/* @__PURE__ */ (0,
|
|
14184
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13038
14185
|
RuntimeCapabilityIcon,
|
|
13039
14186
|
{
|
|
13040
14187
|
option,
|
|
13041
14188
|
variant: "chip"
|
|
13042
14189
|
}
|
|
13043
14190
|
),
|
|
13044
|
-
/* @__PURE__ */ (0,
|
|
14191
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "max-w-[9rem] truncate", children: option.label })
|
|
13045
14192
|
]
|
|
13046
14193
|
},
|
|
13047
14194
|
`${option.type}:${option.id}`
|
|
13048
14195
|
)) }),
|
|
13049
|
-
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ (0,
|
|
14196
|
+
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanReferences.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13050
14197
|
ReferenceChip,
|
|
13051
14198
|
{
|
|
13052
14199
|
reference,
|
|
@@ -13054,29 +14201,29 @@ function Chat({
|
|
|
13054
14201
|
},
|
|
13055
14202
|
getReferenceKey(reference)
|
|
13056
14203
|
)) }),
|
|
13057
|
-
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ (0,
|
|
14204
|
+
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex flex-wrap gap-1.5 mb-2", children: humanAttachments.map((file, fileIndex) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
13058
14205
|
"div",
|
|
13059
14206
|
{
|
|
13060
14207
|
className: "flex items-center gap-1.5 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs",
|
|
13061
14208
|
children: [
|
|
13062
|
-
/* @__PURE__ */ (0,
|
|
13063
|
-
/* @__PURE__ */ (0,
|
|
14209
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react24.FileText, { size: 12 }),
|
|
14210
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "max-w-[100px] truncate", children: file.originalName })
|
|
13064
14211
|
]
|
|
13065
14212
|
},
|
|
13066
14213
|
fileIndex
|
|
13067
14214
|
)) }),
|
|
13068
|
-
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ (0,
|
|
14215
|
+
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13069
14216
|
"p",
|
|
13070
14217
|
{
|
|
13071
14218
|
className: "wrap-break-word text-sm leading-relaxed",
|
|
13072
14219
|
children: formatMessageContent(part)
|
|
13073
14220
|
},
|
|
13074
14221
|
`${part.type}-${partIndex}`
|
|
13075
|
-
)) : /* @__PURE__ */ (0,
|
|
14222
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "wrap-break-word text-sm leading-relaxed", children: formatMessageContent(message.content) })
|
|
13076
14223
|
] })
|
|
13077
14224
|
}
|
|
13078
14225
|
),
|
|
13079
|
-
/* @__PURE__ */ (0,
|
|
14226
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13080
14227
|
MessageActions,
|
|
13081
14228
|
{
|
|
13082
14229
|
content: messageContent,
|
|
@@ -13112,7 +14259,7 @@ function Chat({
|
|
|
13112
14259
|
stream.isLoading,
|
|
13113
14260
|
{ now: streamingNow }
|
|
13114
14261
|
);
|
|
13115
|
-
return /* @__PURE__ */ (0,
|
|
14262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex justify-start gap-3 -ml-2", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "max-w-full rounded-2xl py-2.5", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13116
14263
|
AssistantStreamingIndicator,
|
|
13117
14264
|
{
|
|
13118
14265
|
status: fallbackStreamingStatus ?? "loading"
|
|
@@ -13121,7 +14268,7 @@ function Chat({
|
|
|
13121
14268
|
})()
|
|
13122
14269
|
] })
|
|
13123
14270
|
] }),
|
|
13124
|
-
!isAtBottom && messages.length > 0 && /* @__PURE__ */ (0,
|
|
14271
|
+
!isAtBottom && messages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "sticky bottom-20 z-20 flex justify-center px-4 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13125
14272
|
Button,
|
|
13126
14273
|
{
|
|
13127
14274
|
type: "button",
|
|
@@ -13134,10 +14281,10 @@ function Chat({
|
|
|
13134
14281
|
onClick: () => scrollToBottom(true, true),
|
|
13135
14282
|
"aria-label": t("chat.scrollToBottom"),
|
|
13136
14283
|
title: t("chat.scrollToBottom"),
|
|
13137
|
-
children: /* @__PURE__ */ (0,
|
|
14284
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react24.ArrowDown, { size: 16 })
|
|
13138
14285
|
}
|
|
13139
14286
|
) }),
|
|
13140
|
-
quoteSelection && /* @__PURE__ */ (0,
|
|
14287
|
+
quoteSelection && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13141
14288
|
"div",
|
|
13142
14289
|
{
|
|
13143
14290
|
className: "pointer-events-none fixed z-50",
|
|
@@ -13146,7 +14293,7 @@ function Chat({
|
|
|
13146
14293
|
left: `${quoteSelection.left}px`,
|
|
13147
14294
|
transform: "translateX(-50%)"
|
|
13148
14295
|
},
|
|
13149
|
-
children: /* @__PURE__ */ (0,
|
|
14296
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
13150
14297
|
Button,
|
|
13151
14298
|
{
|
|
13152
14299
|
type: "button",
|
|
@@ -13158,16 +14305,16 @@ function Chat({
|
|
|
13158
14305
|
"aria-label": t("composer.quoteSelection"),
|
|
13159
14306
|
title: t("composer.quoteSelection"),
|
|
13160
14307
|
children: [
|
|
13161
|
-
/* @__PURE__ */ (0,
|
|
14308
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react24.Quote, { size: 14 }),
|
|
13162
14309
|
t("composer.quoteSelection")
|
|
13163
14310
|
]
|
|
13164
14311
|
}
|
|
13165
14312
|
)
|
|
13166
14313
|
}
|
|
13167
14314
|
),
|
|
13168
|
-
/* @__PURE__ */ (0,
|
|
13169
|
-
threadErrorMessage && /* @__PURE__ */ (0,
|
|
13170
|
-
/* @__PURE__ */ (0,
|
|
14315
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "p-2 sticky bottom-0 z-10 bg-background", children: [
|
|
14316
|
+
threadErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime49.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 }),
|
|
14317
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13171
14318
|
"input",
|
|
13172
14319
|
{
|
|
13173
14320
|
ref: fileInputRef,
|
|
@@ -13178,7 +14325,7 @@ function Chat({
|
|
|
13178
14325
|
className: "hidden"
|
|
13179
14326
|
}
|
|
13180
14327
|
),
|
|
13181
|
-
attachments.length > 0 && /* @__PURE__ */ (0,
|
|
14328
|
+
attachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "mb-3 flex flex-wrap gap-2", children: attachments.map((item) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
13182
14329
|
"div",
|
|
13183
14330
|
{
|
|
13184
14331
|
className: cn(
|
|
@@ -13186,16 +14333,16 @@ function Chat({
|
|
|
13186
14333
|
item.status === "error" ? "bg-destructive/10 border border-destructive/30" : "bg-muted"
|
|
13187
14334
|
),
|
|
13188
14335
|
children: [
|
|
13189
|
-
item.status === "uploading" && /* @__PURE__ */ (0,
|
|
13190
|
-
|
|
14336
|
+
item.status === "uploading" && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
14337
|
+
import_lucide_react24.Loader2,
|
|
13191
14338
|
{
|
|
13192
14339
|
size: 14,
|
|
13193
14340
|
className: "animate-spin text-muted-foreground"
|
|
13194
14341
|
}
|
|
13195
14342
|
),
|
|
13196
|
-
item.status === "success" && /* @__PURE__ */ (0,
|
|
13197
|
-
item.status === "error" && /* @__PURE__ */ (0,
|
|
13198
|
-
/* @__PURE__ */ (0,
|
|
14343
|
+
item.status === "success" && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react24.FileText, { size: 14, className: "text-muted-foreground" }),
|
|
14344
|
+
item.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react24.FileText, { size: 14, className: "text-destructive" }),
|
|
14345
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13199
14346
|
"span",
|
|
13200
14347
|
{
|
|
13201
14348
|
className: cn(
|
|
@@ -13205,17 +14352,17 @@ function Chat({
|
|
|
13205
14352
|
children: item.file.name
|
|
13206
14353
|
}
|
|
13207
14354
|
),
|
|
13208
|
-
item.status === "error" && /* @__PURE__ */ (0,
|
|
14355
|
+
item.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13209
14356
|
"button",
|
|
13210
14357
|
{
|
|
13211
14358
|
type: "button",
|
|
13212
14359
|
onClick: () => handleRetryUpload(item.localId),
|
|
13213
14360
|
className: "ml-1 rounded-full p-0.5 text-destructive hover:bg-destructive/20",
|
|
13214
14361
|
title: t("chat.retryUpload"),
|
|
13215
|
-
children: /* @__PURE__ */ (0,
|
|
14362
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react24.RefreshCw, { size: 12 })
|
|
13216
14363
|
}
|
|
13217
14364
|
),
|
|
13218
|
-
/* @__PURE__ */ (0,
|
|
14365
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13219
14366
|
"button",
|
|
13220
14367
|
{
|
|
13221
14368
|
type: "button",
|
|
@@ -13224,14 +14371,14 @@ function Chat({
|
|
|
13224
14371
|
"ml-1 rounded-full p-0.5",
|
|
13225
14372
|
item.status === "error" ? "text-destructive hover:bg-destructive/20" : "hover:bg-muted-foreground/20"
|
|
13226
14373
|
),
|
|
13227
|
-
children: /* @__PURE__ */ (0,
|
|
14374
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react24.X, { size: 12 })
|
|
13228
14375
|
}
|
|
13229
14376
|
)
|
|
13230
14377
|
]
|
|
13231
14378
|
},
|
|
13232
14379
|
item.localId
|
|
13233
14380
|
)) }),
|
|
13234
|
-
references.length > 0 && /* @__PURE__ */ (0,
|
|
14381
|
+
references.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "mb-3 flex flex-wrap gap-2", children: references.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13235
14382
|
ReferenceChip,
|
|
13236
14383
|
{
|
|
13237
14384
|
reference,
|
|
@@ -13245,16 +14392,16 @@ function Chat({
|
|
|
13245
14392
|
},
|
|
13246
14393
|
getReferenceKey(reference)
|
|
13247
14394
|
)) }),
|
|
13248
|
-
detachedRunRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0,
|
|
13249
|
-
/* @__PURE__ */ (0,
|
|
13250
|
-
detachedRunRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ (0,
|
|
14395
|
+
detachedRunRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "mb-2 flex flex-wrap items-center gap-2", children: [
|
|
14396
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "text-xs text-muted-foreground", children: t("composer.capabilities.runOnly") }),
|
|
14397
|
+
detachedRunRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
13251
14398
|
"span",
|
|
13252
14399
|
{
|
|
13253
14400
|
className: "inline-flex max-w-full items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",
|
|
13254
14401
|
children: [
|
|
13255
|
-
/* @__PURE__ */ (0,
|
|
13256
|
-
/* @__PURE__ */ (0,
|
|
13257
|
-
/* @__PURE__ */ (0,
|
|
14402
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(RuntimeCapabilityIcon, { option, variant: "chip" }),
|
|
14403
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "max-w-40 truncate", children: option.label }),
|
|
14404
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13258
14405
|
"button",
|
|
13259
14406
|
{
|
|
13260
14407
|
type: "button",
|
|
@@ -13262,7 +14409,7 @@ function Chat({
|
|
|
13262
14409
|
className: "rounded-full p-0.5 hover:bg-primary/15",
|
|
13263
14410
|
title: t("composer.capabilities.removeRunCapability"),
|
|
13264
14411
|
"aria-label": t("composer.capabilities.removeRunCapability"),
|
|
13265
|
-
children: /* @__PURE__ */ (0,
|
|
14412
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react24.X, { size: 11 })
|
|
13266
14413
|
}
|
|
13267
14414
|
)
|
|
13268
14415
|
]
|
|
@@ -13270,7 +14417,7 @@ function Chat({
|
|
|
13270
14417
|
`${option.type}:${option.id}`
|
|
13271
14418
|
))
|
|
13272
14419
|
] }),
|
|
13273
|
-
/* @__PURE__ */ (0,
|
|
14420
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13274
14421
|
PendingRuntimeServices,
|
|
13275
14422
|
{
|
|
13276
14423
|
state: stream.runtimeActivities.sandboxServices,
|
|
@@ -13279,7 +14426,7 @@ function Chat({
|
|
|
13279
14426
|
className: hasPendingTodos || hasPendingFollowUps ? "mb-2" : void 0
|
|
13280
14427
|
}
|
|
13281
14428
|
),
|
|
13282
|
-
/* @__PURE__ */ (0,
|
|
14429
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13283
14430
|
PendingTodos,
|
|
13284
14431
|
{
|
|
13285
14432
|
snapshot: stream.todos,
|
|
@@ -13287,7 +14434,7 @@ function Chat({
|
|
|
13287
14434
|
className: hasPendingFollowUps ? "mb-2" : void 0
|
|
13288
14435
|
}
|
|
13289
14436
|
),
|
|
13290
|
-
/* @__PURE__ */ (0,
|
|
14437
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13291
14438
|
PendingFollowUps,
|
|
13292
14439
|
{
|
|
13293
14440
|
items: pendingFollowUps,
|
|
@@ -13302,7 +14449,7 @@ function Chat({
|
|
|
13302
14449
|
attachToComposer: true
|
|
13303
14450
|
}
|
|
13304
14451
|
),
|
|
13305
|
-
/* @__PURE__ */ (0,
|
|
14452
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13306
14453
|
RequestUserInputPanel,
|
|
13307
14454
|
{
|
|
13308
14455
|
request: stream.pendingRequestUserInput,
|
|
@@ -13311,7 +14458,7 @@ function Chat({
|
|
|
13311
14458
|
attachToComposer: true
|
|
13312
14459
|
}
|
|
13313
14460
|
),
|
|
13314
|
-
/* @__PURE__ */ (0,
|
|
14461
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13315
14462
|
HITLApprovalPanel,
|
|
13316
14463
|
{
|
|
13317
14464
|
request: stream.pendingHITLRequest,
|
|
@@ -13320,7 +14467,7 @@ function Chat({
|
|
|
13320
14467
|
attachToComposer: true
|
|
13321
14468
|
}
|
|
13322
14469
|
),
|
|
13323
|
-
runtimeCapabilityPalette && /* @__PURE__ */ (0,
|
|
14470
|
+
runtimeCapabilityPalette && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13324
14471
|
SlashPalette,
|
|
13325
14472
|
{
|
|
13326
14473
|
palette: runtimeCapabilityPalette,
|
|
@@ -13334,7 +14481,7 @@ function Chat({
|
|
|
13334
14481
|
onSelect: selectSlashPaletteOption
|
|
13335
14482
|
}
|
|
13336
14483
|
),
|
|
13337
|
-
/* @__PURE__ */ (0,
|
|
14484
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("form", { className: "flex items-end", onSubmit: handleSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
13338
14485
|
"div",
|
|
13339
14486
|
{
|
|
13340
14487
|
"data-slot": "composer-input-shell",
|
|
@@ -13348,7 +14495,7 @@ function Chat({
|
|
|
13348
14495
|
composerInputRoundedClass
|
|
13349
14496
|
),
|
|
13350
14497
|
children: [
|
|
13351
|
-
/* @__PURE__ */ (0,
|
|
14498
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13352
14499
|
"div",
|
|
13353
14500
|
{
|
|
13354
14501
|
ref: composerInputRef,
|
|
@@ -13370,7 +14517,7 @@ function Chat({
|
|
|
13370
14517
|
(missingConfig || isHistoryLoading || hasPendingInteractiveRequest) && "cursor-not-allowed opacity-50"
|
|
13371
14518
|
),
|
|
13372
14519
|
children: renderedComposerParts.map(
|
|
13373
|
-
(part, index) => part.type === "text" ? /* @__PURE__ */ (0,
|
|
14520
|
+
(part, index) => part.type === "text" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(React44.Fragment, { children: part.text }, `text-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
13374
14521
|
"span",
|
|
13375
14522
|
{
|
|
13376
14523
|
"data-composer-capability-key": part.key,
|
|
@@ -13379,14 +14526,14 @@ function Chat({
|
|
|
13379
14526
|
contentEditable: false,
|
|
13380
14527
|
className: "mx-0.5 inline-flex max-w-[14rem] select-none items-center gap-1 text-sm font-semibold text-primary align-baseline",
|
|
13381
14528
|
children: [
|
|
13382
|
-
/* @__PURE__ */ (0,
|
|
14529
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13383
14530
|
RuntimeCapabilityIcon,
|
|
13384
14531
|
{
|
|
13385
14532
|
option: part.capability,
|
|
13386
14533
|
variant: "chip"
|
|
13387
14534
|
}
|
|
13388
14535
|
),
|
|
13389
|
-
/* @__PURE__ */ (0,
|
|
14536
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "truncate", children: part.capability.label })
|
|
13390
14537
|
]
|
|
13391
14538
|
},
|
|
13392
14539
|
part.key
|
|
@@ -13395,14 +14542,14 @@ function Chat({
|
|
|
13395
14542
|
},
|
|
13396
14543
|
composerDomVersion
|
|
13397
14544
|
),
|
|
13398
|
-
/* @__PURE__ */ (0,
|
|
14545
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
13399
14546
|
"div",
|
|
13400
14547
|
{
|
|
13401
14548
|
"data-slot": "composer-action-bar",
|
|
13402
14549
|
className: "pointer-events-none absolute inset-x-1.5 bottom-1 flex min-h-10 items-center justify-between gap-2",
|
|
13403
14550
|
children: [
|
|
13404
|
-
/* @__PURE__ */ (0,
|
|
13405
|
-
/* @__PURE__ */ (0,
|
|
14551
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "pointer-events-none flex min-w-0 flex-1 items-center gap-1.5", children: [
|
|
14552
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "pointer-events-auto flex shrink-0 items-center gap-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13406
14553
|
ComposerMenu,
|
|
13407
14554
|
{
|
|
13408
14555
|
composer,
|
|
@@ -13417,20 +14564,20 @@ function Chat({
|
|
|
13417
14564
|
disabled: missingConfig || isHistoryLoading || hasPendingInteractiveRequest
|
|
13418
14565
|
}
|
|
13419
14566
|
) }),
|
|
13420
|
-
selectedTool && /* @__PURE__ */ (0,
|
|
13421
|
-
/* @__PURE__ */ (0,
|
|
13422
|
-
/* @__PURE__ */ (0,
|
|
14567
|
+
selectedTool && /* @__PURE__ */ (0, import_jsx_runtime49.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: [
|
|
14568
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "truncate", children: selectedTool.shortLabel ?? selectedTool.label }),
|
|
14569
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13423
14570
|
"button",
|
|
13424
14571
|
{
|
|
13425
14572
|
type: "button",
|
|
13426
14573
|
onClick: () => setSelectedTool(null),
|
|
13427
14574
|
className: "shrink-0 rounded-full p-0.5 text-primary/70 hover:bg-primary/10 hover:text-primary",
|
|
13428
|
-
children: /* @__PURE__ */ (0,
|
|
14575
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react24.X, { size: 12 })
|
|
13429
14576
|
}
|
|
13430
14577
|
)
|
|
13431
14578
|
] })
|
|
13432
14579
|
] }),
|
|
13433
|
-
/* @__PURE__ */ (0,
|
|
14580
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "pointer-events-auto shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13434
14581
|
SendButton,
|
|
13435
14582
|
{
|
|
13436
14583
|
disabled: isSendDisabled,
|
|
@@ -13457,7 +14604,7 @@ function Chat({
|
|
|
13457
14604
|
]
|
|
13458
14605
|
}
|
|
13459
14606
|
) }),
|
|
13460
|
-
disclaimer?.text && /* @__PURE__ */ (0,
|
|
14607
|
+
disclaimer?.text && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13461
14608
|
"p",
|
|
13462
14609
|
{
|
|
13463
14610
|
className: cn(
|
|
@@ -13467,12 +14614,12 @@ function Chat({
|
|
|
13467
14614
|
children: disclaimer.text
|
|
13468
14615
|
}
|
|
13469
14616
|
),
|
|
13470
|
-
/* @__PURE__ */ (0,
|
|
13471
|
-
/* @__PURE__ */ (0,
|
|
13472
|
-
/* @__PURE__ */ (0,
|
|
14617
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "mt-2 flex items-center justify-center gap-2 text-xs text-muted-foreground", children: [
|
|
14618
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: t("chat.poweredBy") }),
|
|
14619
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ContextUsageIndicator, { className: "absolute right-4" })
|
|
13473
14620
|
] })
|
|
13474
14621
|
] }),
|
|
13475
|
-
/* @__PURE__ */ (0,
|
|
14622
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13476
14623
|
SettingsSheet,
|
|
13477
14624
|
{
|
|
13478
14625
|
open: petSettingsOpen,
|
|
@@ -13482,17 +14629,17 @@ function Chat({
|
|
|
13482
14629
|
onSave: savePetLocalSettings
|
|
13483
14630
|
}
|
|
13484
14631
|
),
|
|
13485
|
-
/* @__PURE__ */ (0,
|
|
14632
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(PetBridge, { pet: effectivePet, state: petAutoState })
|
|
13486
14633
|
]
|
|
13487
14634
|
}
|
|
13488
14635
|
);
|
|
13489
14636
|
}
|
|
13490
14637
|
|
|
13491
14638
|
// src/components/ui/separator.tsx
|
|
13492
|
-
var
|
|
13493
|
-
var
|
|
13494
|
-
var Separator =
|
|
13495
|
-
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ (0,
|
|
14639
|
+
var React45 = __toESM(require("react"), 1);
|
|
14640
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
14641
|
+
var Separator = React45.forwardRef(
|
|
14642
|
+
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
13496
14643
|
"div",
|
|
13497
14644
|
{
|
|
13498
14645
|
ref,
|