@xpert-ai/chatkit-ui 0.0.2
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/README.md +62 -0
- package/dist/app/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/app/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/app/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/app/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/app/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/app/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/app/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/app/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/app/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/app/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/app/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/app/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/app/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/app/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/app/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/app/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/app/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/app/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/app/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/app/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/app/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/app/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/app/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/app/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/app/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/app/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/app/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/app/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/app/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/app/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/app/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/app/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/app/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/app/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/app/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/app/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/app/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/app/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/app/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/app/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/app/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/app/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/app/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/app/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/app/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/app/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/app/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/app/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/app/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/app/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/app/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/app/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/app/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/app/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/app/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/app/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/app/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/app/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/app/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/app/assets/abap-r5qEZhbP.js +1 -0
- package/dist/app/assets/abnf-B1-snbnN.js +1 -0
- package/dist/app/assets/actionscript-DKuzag0S.js +1 -0
- package/dist/app/assets/ada-Cf7_jj9e.js +1 -0
- package/dist/app/assets/agda-DTzFiqCe.js +1 -0
- package/dist/app/assets/al-CxK958n6.js +1 -0
- package/dist/app/assets/antlr4-BAQNvWAR.js +1 -0
- package/dist/app/assets/apacheconf-BDS7lzSp.js +1 -0
- package/dist/app/assets/apex-PrEYueYu.js +1 -0
- package/dist/app/assets/apl-BxCE3pUM.js +1 -0
- package/dist/app/assets/applescript-CbmkMI2b.js +1 -0
- package/dist/app/assets/aql-Br7w2FWv.js +1 -0
- package/dist/app/assets/arduino-DztvkRBm.js +1 -0
- package/dist/app/assets/arff-DMIMEeal.js +1 -0
- package/dist/app/assets/asciidoc-6sbk5AU3.js +1 -0
- package/dist/app/assets/asm6502-pvPxs3SS.js +1 -0
- package/dist/app/assets/asmatmel-C6DNoRbE.js +1 -0
- package/dist/app/assets/aspnet-BbJerGfY.js +1 -0
- package/dist/app/assets/autohotkey-DKwYophK.js +1 -0
- package/dist/app/assets/autoit-DAz38rob.js +1 -0
- package/dist/app/assets/avisynth-CA38jZ01.js +1 -0
- package/dist/app/assets/avro-idl-DsorjIu9.js +1 -0
- package/dist/app/assets/bash-Byt0YIsi.js +1 -0
- package/dist/app/assets/bash-CefCgV5_.js +1 -0
- package/dist/app/assets/basic-CMWvkpXD.js +1 -0
- package/dist/app/assets/basic-DBS9NaGG.js +1 -0
- package/dist/app/assets/batch-DuBQ3McD.js +1 -0
- package/dist/app/assets/bbcode-DfssxBA1.js +1 -0
- package/dist/app/assets/bicep-9hsCe6m3.js +1 -0
- package/dist/app/assets/birb-Bc9BRwRB.js +1 -0
- package/dist/app/assets/bison-xsfiYnBc.js +1 -0
- package/dist/app/assets/bnf-DjWYNABY.js +1 -0
- package/dist/app/assets/brainfuck-DRIStkin.js +1 -0
- package/dist/app/assets/brightscript-C2PUL6fB.js +1 -0
- package/dist/app/assets/bro-CGiYkxiS.js +1 -0
- package/dist/app/assets/bsl-Bl8C3_3D.js +1 -0
- package/dist/app/assets/c-ZYvTJlSO.js +1 -0
- package/dist/app/assets/c-kgVuzdLE.js +1 -0
- package/dist/app/assets/cfscript-BMhAq5o9.js +1 -0
- package/dist/app/assets/chaiscript-CPmV-euz.js +1 -0
- package/dist/app/assets/cil-B6Amcpic.js +1 -0
- package/dist/app/assets/clike-B5tY_8Hg.js +1 -0
- package/dist/app/assets/clike-BJEDekBy.js +1 -0
- package/dist/app/assets/clojure-CW8XdyJM.js +1 -0
- package/dist/app/assets/cmake-C67VTXlG.js +1 -0
- package/dist/app/assets/cobol-36MS0vW5.js +1 -0
- package/dist/app/assets/coffeescript-HPCQWKbV.js +1 -0
- package/dist/app/assets/concurnas-BdV-2hSV.js +1 -0
- package/dist/app/assets/coq-B4X2Mh4T.js +1 -0
- package/dist/app/assets/core-xfKxb2c-.js +1 -0
- package/dist/app/assets/cpp-BdJVwJpi.js +1 -0
- package/dist/app/assets/cpp-DbuAZI9Z.js +1 -0
- package/dist/app/assets/crystal-Bn0O5Oft.js +1 -0
- package/dist/app/assets/csharp-Cd5Udg29.js +1 -0
- package/dist/app/assets/csharp-CjsjgIr3.js +1 -0
- package/dist/app/assets/cshtml-Cy8WSSs7.js +1 -0
- package/dist/app/assets/csp-CfCdno1W.js +1 -0
- package/dist/app/assets/css-CF9HHZb0.js +1 -0
- package/dist/app/assets/css-DenRb6F4.js +1 -0
- package/dist/app/assets/css-extras-Xo_fwYbL.js +1 -0
- package/dist/app/assets/csv-BWaJLMiL.js +1 -0
- package/dist/app/assets/cypher-BgX9fVzJ.js +1 -0
- package/dist/app/assets/d-DyyCNOIH.js +1 -0
- package/dist/app/assets/dart-DjzwYiLS.js +1 -0
- package/dist/app/assets/dataweave-B-Vy-inP.js +1 -0
- package/dist/app/assets/dax-CZ05y54Z.js +1 -0
- package/dist/app/assets/dhall-CwkbNTKc.js +1 -0
- package/dist/app/assets/diff-C_qDIIt8.js +3 -0
- package/dist/app/assets/django-Cchdv5xU.js +1 -0
- package/dist/app/assets/dns-zone-file-CyQNz9kq.js +1 -0
- package/dist/app/assets/docker-B0pp2G5o.js +1 -0
- package/dist/app/assets/dot-CYXSIdXI.js +1 -0
- package/dist/app/assets/ebnf-BhtXTbQG.js +1 -0
- package/dist/app/assets/editorconfig-BDSiMJB3.js +1 -0
- package/dist/app/assets/eiffel-CSI_WtNY.js +1 -0
- package/dist/app/assets/ejs-B7FjKtFB.js +1 -0
- package/dist/app/assets/elixir-D5ItL-Mz.js +1 -0
- package/dist/app/assets/elm-hVteuOs9.js +1 -0
- package/dist/app/assets/erb-BN7dXGSL.js +1 -0
- package/dist/app/assets/erlang-BSP_-sRS.js +1 -0
- package/dist/app/assets/etlua-BJLOsyG2.js +1 -0
- package/dist/app/assets/excel-formula-Cz8oPHlg.js +1 -0
- package/dist/app/assets/factor-B18ayaMg.js +1 -0
- package/dist/app/assets/false-BbwgoANn.js +1 -0
- package/dist/app/assets/firestore-security-rules-Cb-sIv4N.js +1 -0
- package/dist/app/assets/flow-DwNhMKdq.js +1 -0
- package/dist/app/assets/fortran-Q9_x6NYJ.js +1 -0
- package/dist/app/assets/fsharp-DAn0fWAf.js +1 -0
- package/dist/app/assets/ftl-0VJqQF7L.js +1 -0
- package/dist/app/assets/gap-CwARvyeO.js +1 -0
- package/dist/app/assets/gcode-DRZ-NtIf.js +1 -0
- package/dist/app/assets/gdscript-DLWUxJKZ.js +1 -0
- package/dist/app/assets/gedcom-LrWyJR_l.js +1 -0
- package/dist/app/assets/gherkin-DILlSFJd.js +1 -0
- package/dist/app/assets/git-tykDb3ub.js +1 -0
- package/dist/app/assets/glsl-D97iKuQJ.js +1 -0
- package/dist/app/assets/gml-DB1PeyPv.js +1 -0
- package/dist/app/assets/gn-Oqf78vQS.js +1 -0
- package/dist/app/assets/go-module-D7KyvJ4u.js +1 -0
- package/dist/app/assets/go-uYHARARY.js +1 -0
- package/dist/app/assets/graphql-BIap2FqQ.js +1 -0
- package/dist/app/assets/groovy-Cr9o9fqv.js +1 -0
- package/dist/app/assets/haml-Dbj6JAX0.js +1 -0
- package/dist/app/assets/handlebars-TWtx7Zmf.js +1 -0
- package/dist/app/assets/haskell-Ds42Eazu.js +1 -0
- package/dist/app/assets/haskell-_f6nn-YC.js +1 -0
- package/dist/app/assets/haxe-Dz8mYH5i.js +1 -0
- package/dist/app/assets/hcl-CWBhK_2d.js +1 -0
- package/dist/app/assets/hlsl-C8w84-ui.js +1 -0
- package/dist/app/assets/hoon-EPQkWoKN.js +1 -0
- package/dist/app/assets/hpkp-Cuo4Xy5e.js +1 -0
- package/dist/app/assets/hsts-CpNIILMG.js +1 -0
- package/dist/app/assets/http-CYP6yT6s.js +1 -0
- package/dist/app/assets/ichigojam-hUSaDBKO.js +1 -0
- package/dist/app/assets/icon-CiwrwB3z.js +1 -0
- package/dist/app/assets/icu-message-format-VDYKiTmx.js +1 -0
- package/dist/app/assets/idris-BrYqIHFw.js +1 -0
- package/dist/app/assets/iecst-CY8zdJ-p.js +1 -0
- package/dist/app/assets/ignore-DnPVmmQY.js +1 -0
- package/dist/app/assets/index-C3ZmJ6gF.css +1 -0
- package/dist/app/assets/index-CfiLrrLw.js +438 -0
- package/dist/app/assets/inform7-B5v6FoDj.js +1 -0
- package/dist/app/assets/ini-DgEXlHMC.js +1 -0
- package/dist/app/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/dist/app/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/dist/app/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/dist/app/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/dist/app/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/dist/app/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/dist/app/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/dist/app/assets/io-CyM_37VY.js +1 -0
- package/dist/app/assets/j-DH8W8lNX.js +1 -0
- package/dist/app/assets/java-BxMbkJZ_.js +1 -0
- package/dist/app/assets/java-CqyMp51C.js +1 -0
- package/dist/app/assets/javadoc-D8u9HkgH.js +1 -0
- package/dist/app/assets/javadoclike-C1Lq0x6T.js +1 -0
- package/dist/app/assets/javadoclike-myFApC35.js +1 -0
- package/dist/app/assets/javascript-D8vYUPHd.js +1 -0
- package/dist/app/assets/javascript-Dg-dDZaa.js +1 -0
- package/dist/app/assets/javastacktrace-tDCrTG88.js +1 -0
- package/dist/app/assets/jexl-xmkYJPWN.js +1 -0
- package/dist/app/assets/jolie-BxjtsVcI.js +1 -0
- package/dist/app/assets/jq-t_D06nWO.js +1 -0
- package/dist/app/assets/js-extras-BBCqHvzI.js +1 -0
- package/dist/app/assets/js-templates-Bg1HmpMK.js +1 -0
- package/dist/app/assets/jsdoc-D80EteFV.js +1 -0
- package/dist/app/assets/json-BESjz4hO.js +1 -0
- package/dist/app/assets/json-C1i6SnC5.js +1 -0
- package/dist/app/assets/json5-CZOwksJ6.js +1 -0
- package/dist/app/assets/jsonp-CMd_XDVf.js +1 -0
- package/dist/app/assets/jsstacktrace-DGrGR7kW.js +1 -0
- package/dist/app/assets/jsx-CYygDQtl.js +1 -0
- package/dist/app/assets/julia-BR0LDBvi.js +1 -0
- package/dist/app/assets/keepalived-D44bjXvu.js +1 -0
- package/dist/app/assets/keyman-DzuVPclz.js +1 -0
- package/dist/app/assets/kotlin-DOwz6NW2.js +1 -0
- package/dist/app/assets/kumir-nVco3tEb.js +1 -0
- package/dist/app/assets/kusto-CM18Mfrd.js +1 -0
- package/dist/app/assets/latex-BROy64ts.js +1 -0
- package/dist/app/assets/latte-BTs2KkCX.js +1 -0
- package/dist/app/assets/less-BKd5Zil6.js +1 -0
- package/dist/app/assets/lilypond-COFiYhj_.js +1 -0
- package/dist/app/assets/liquid-CJguD-PK.js +1 -0
- package/dist/app/assets/lisp-D49Pqw-8.js +1 -0
- package/dist/app/assets/livescript-Ik0P2d90.js +1 -0
- package/dist/app/assets/llvm-D1Ep8sh7.js +1 -0
- package/dist/app/assets/log-C3qpQ9j4.js +1 -0
- package/dist/app/assets/lolcode-DRI6_ZBz.js +1 -0
- package/dist/app/assets/lua-BmFhPjSF.js +1 -0
- package/dist/app/assets/lua-DER4jxlW.js +1 -0
- package/dist/app/assets/magma-CU_SnAJn.js +1 -0
- package/dist/app/assets/makefile-Br-PJxmu.js +1 -0
- package/dist/app/assets/markdown-DNpDsBSv.js +1 -0
- package/dist/app/assets/markup-BONeskWm.js +1 -0
- package/dist/app/assets/markup-eMO994fL.js +1 -0
- package/dist/app/assets/markup-templating-5gNayUbG.js +1 -0
- package/dist/app/assets/markup-templating-BxAVv-bL.js +1 -0
- package/dist/app/assets/matlab-GWJYeB2_.js +1 -0
- package/dist/app/assets/maxscript-CpFmD-Fw.js +1 -0
- package/dist/app/assets/mel-BteQuMj1.js +1 -0
- package/dist/app/assets/mermaid-CdUPJtSd.js +1 -0
- package/dist/app/assets/mizar-MajG2Dpn.js +1 -0
- package/dist/app/assets/mongodb-DDvaIpbe.js +1 -0
- package/dist/app/assets/monkey-D2s8GYu3.js +1 -0
- package/dist/app/assets/moonscript-C3OwgoDV.js +1 -0
- package/dist/app/assets/n1ql-B-I37duX.js +1 -0
- package/dist/app/assets/n4js-mpVOXLsz.js +1 -0
- package/dist/app/assets/nand2tetris-hdl-D3LeJ4lR.js +1 -0
- package/dist/app/assets/naniscript-BLmLFeRO.js +1 -0
- package/dist/app/assets/nasm-Dab_l8tl.js +1 -0
- package/dist/app/assets/neon-Cfars9KI.js +1 -0
- package/dist/app/assets/nevod-BZuwf-5p.js +1 -0
- package/dist/app/assets/nginx-PFxBbEel.js +1 -0
- package/dist/app/assets/nim-vCFXO-Nn.js +1 -0
- package/dist/app/assets/nix-BWxxabUK.js +1 -0
- package/dist/app/assets/nsis-BnGcOg9C.js +1 -0
- package/dist/app/assets/objectivec-B65eHGmp.js +1 -0
- package/dist/app/assets/ocaml-DjvuAe7V.js +1 -0
- package/dist/app/assets/opencl-Durkzx8Q.js +1 -0
- package/dist/app/assets/openqasm-D8fmu6EO.js +1 -0
- package/dist/app/assets/oz-B_AoXlHI.js +1 -0
- package/dist/app/assets/parigp-CELpLnU5.js +1 -0
- package/dist/app/assets/parser-BRBykfrA.js +1 -0
- package/dist/app/assets/pascal-Ce2bsA8F.js +1 -0
- package/dist/app/assets/pascaligo-BOccKAjF.js +1 -0
- package/dist/app/assets/pcaxis-_8AUMo8I.js +1 -0
- package/dist/app/assets/peoplecode-B7vJSvNe.js +1 -0
- package/dist/app/assets/perl-B6IUwOJU.js +1 -0
- package/dist/app/assets/php-DZZMsf5_.js +1 -0
- package/dist/app/assets/php-extras-CFCou6pE.js +1 -0
- package/dist/app/assets/php-iTdQntIy.js +1 -0
- package/dist/app/assets/phpdoc-BihYeqX2.js +1 -0
- package/dist/app/assets/plsql-DkoJO_WC.js +1 -0
- package/dist/app/assets/powerquery-C9BdK_n1.js +1 -0
- package/dist/app/assets/powershell-B6i5FlCn.js +1 -0
- package/dist/app/assets/processing-7XippcCI.js +1 -0
- package/dist/app/assets/prolog-Pp-7CZ0i.js +1 -0
- package/dist/app/assets/promql-B6Hu2BCx.js +1 -0
- package/dist/app/assets/properties-BOn4P5Zq.js +1 -0
- package/dist/app/assets/protobuf-B3NNx_Xr.js +1 -0
- package/dist/app/assets/psl-CIRU9YYt.js +1 -0
- package/dist/app/assets/pug-C7F7xuzy.js +1 -0
- package/dist/app/assets/puppet-B0u-JHH7.js +1 -0
- package/dist/app/assets/pure-CTpP4_SN.js +1 -0
- package/dist/app/assets/purebasic-CRaKz7Bg.js +1 -0
- package/dist/app/assets/purescript-BwoF668l.js +1 -0
- package/dist/app/assets/q-DPdcJodp.js +1 -0
- package/dist/app/assets/qml-DOG1bBnZ.js +1 -0
- package/dist/app/assets/qore-Bl9DZz9p.js +1 -0
- package/dist/app/assets/qsharp-D61ab9U0.js +1 -0
- package/dist/app/assets/r-BRGCy6GC.js +1 -0
- package/dist/app/assets/racket-DX1mUQtk.js +1 -0
- package/dist/app/assets/reason-jGsz7TNy.js +1 -0
- package/dist/app/assets/regex-BgBGl-Po.js +1 -0
- package/dist/app/assets/rego-DzMdKj2S.js +1 -0
- package/dist/app/assets/renpy-CZQbSS0W.js +1 -0
- package/dist/app/assets/rest-BlHXtJh-.js +1 -0
- package/dist/app/assets/rip-Cp8amRhg.js +1 -0
- package/dist/app/assets/roboconf-8dICkxq_.js +1 -0
- package/dist/app/assets/robotframework-CQBVnI1B.js +1 -0
- package/dist/app/assets/ruby-BySgJbQh.js +1 -0
- package/dist/app/assets/ruby-DYsn9XfW.js +1 -0
- package/dist/app/assets/rust-DwFCpVnM.js +1 -0
- package/dist/app/assets/sas-BVz4-dXi.js +1 -0
- package/dist/app/assets/sass-kF1eV1tc.js +1 -0
- package/dist/app/assets/scala-BCd79KMC.js +1 -0
- package/dist/app/assets/scheme-Cscf027c.js +1 -0
- package/dist/app/assets/scheme-DGDH5UrN.js +1 -0
- package/dist/app/assets/scss-C3A6bKF2.js +1 -0
- package/dist/app/assets/shell-session-Bt1ByUnn.js +1 -0
- package/dist/app/assets/smali-BG59gVAI.js +1 -0
- package/dist/app/assets/smalltalk-DeWMrHCy.js +1 -0
- package/dist/app/assets/smarty-BlMz3kJS.js +1 -0
- package/dist/app/assets/sml-CWaZSpkP.js +1 -0
- package/dist/app/assets/solidity-Bjo0yzXA.js +1 -0
- package/dist/app/assets/solution-file-D8MELZgB.js +1 -0
- package/dist/app/assets/soy-BZNmPo5T.js +1 -0
- package/dist/app/assets/sparql-W4BcW6wH.js +1 -0
- package/dist/app/assets/splunk-spl-hrA6j7ir.js +1 -0
- package/dist/app/assets/sqf-Buh6IqkS.js +1 -0
- package/dist/app/assets/sql-CJATM1Qp.js +1 -0
- package/dist/app/assets/sql-XQlNmVmI.js +1 -0
- package/dist/app/assets/squirrel-ogEthJ_u.js +1 -0
- package/dist/app/assets/stan-C3I9t6dB.js +1 -0
- package/dist/app/assets/stylus-awj24PQU.js +1 -0
- package/dist/app/assets/swift-mDS-oIFf.js +1 -0
- package/dist/app/assets/systemd-C2laI5tS.js +2 -0
- package/dist/app/assets/t4-cs-C03LNWmj.js +1 -0
- package/dist/app/assets/t4-templating-B5EzSFYT.js +1 -0
- package/dist/app/assets/t4-templating-BsqHjv_U.js +1 -0
- package/dist/app/assets/t4-vb-CO8Pw53s.js +1 -0
- package/dist/app/assets/tap-Do_BVzJ7.js +1 -0
- package/dist/app/assets/tcl-EmfIWHBm.js +1 -0
- package/dist/app/assets/textile-RGeNEtU0.js +1 -0
- package/dist/app/assets/toml-DOSAiG5P.js +1 -0
- package/dist/app/assets/tremor-C8teCYgc.js +1 -0
- package/dist/app/assets/tt2-CZSbMCZy.js +1 -0
- package/dist/app/assets/turtle-DFryR16s.js +1 -0
- package/dist/app/assets/turtle-Ro1R6Je7.js +1 -0
- package/dist/app/assets/twig-y7WI1mGR.js +1 -0
- package/dist/app/assets/typescript-DZIZH67S.js +1 -0
- package/dist/app/assets/typoscript-B5Pie--I.js +1 -0
- package/dist/app/assets/unrealscript-DEQuLPVx.js +1 -0
- package/dist/app/assets/uorazor-C3fd8YVl.js +1 -0
- package/dist/app/assets/uri-i-FmRGl_.js +1 -0
- package/dist/app/assets/v-DJ6LpC6A.js +1 -0
- package/dist/app/assets/vala-BuGDftgP.js +1 -0
- package/dist/app/assets/vbnet-BhrUc4aD.js +1 -0
- package/dist/app/assets/vbnet-BnZaMO7X.js +1 -0
- package/dist/app/assets/velocity-WmSIATwx.js +1 -0
- package/dist/app/assets/verilog-CAXR3v8A.js +1 -0
- package/dist/app/assets/vhdl-5m-SQ1vR.js +1 -0
- package/dist/app/assets/vim-CQxy_hpv.js +1 -0
- package/dist/app/assets/visual-basic-DUXEe4eb.js +1 -0
- package/dist/app/assets/warpscript-Dn2sF1Na.js +1 -0
- package/dist/app/assets/wasm-CNYCO55I.js +1 -0
- package/dist/app/assets/web-idl-qpTEzhMi.js +1 -0
- package/dist/app/assets/wiki-IUIM-gLF.js +1 -0
- package/dist/app/assets/wolfram-WHvqmd61.js +1 -0
- package/dist/app/assets/wren-DHDfXRyN.js +1 -0
- package/dist/app/assets/xeora-BmALMX-C.js +1 -0
- package/dist/app/assets/xml-doc-DipNs41l.js +1 -0
- package/dist/app/assets/xojo-Ch51-LqE.js +1 -0
- package/dist/app/assets/xquery-BkfTblI-.js +1 -0
- package/dist/app/assets/yaml-DR3QJEOe.js +1 -0
- package/dist/app/assets/yaml-pHjxJgpq.js +1 -0
- package/dist/app/assets/yang-BnYvEcuQ.js +1 -0
- package/dist/app/assets/zig-6vTJYoFe.js +1 -0
- package/dist/app/index.html +14 -0
- package/dist/index.cjs +2748 -0
- package/dist/index.css +107 -0
- package/dist/index.d.cts +77 -0
- package/dist/index.d.ts +77 -0
- package/dist/index.js +2694 -0
- package/package.json +93 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2694 @@
|
|
|
1
|
+
// src/components/chat.tsx
|
|
2
|
+
import * as React17 from "react";
|
|
3
|
+
|
|
4
|
+
// src/lib/utils.ts
|
|
5
|
+
import { clsx } from "clsx";
|
|
6
|
+
import { twMerge } from "tailwind-merge";
|
|
7
|
+
function cn(...inputs) {
|
|
8
|
+
return twMerge(clsx(inputs));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// src/providers/Stream.tsx
|
|
12
|
+
import {
|
|
13
|
+
createContext,
|
|
14
|
+
useCallback as useCallback2,
|
|
15
|
+
useContext,
|
|
16
|
+
useMemo as useMemo2,
|
|
17
|
+
useRef as useRef2,
|
|
18
|
+
useState
|
|
19
|
+
} from "react";
|
|
20
|
+
import { useQueryState } from "nuqs";
|
|
21
|
+
import {
|
|
22
|
+
Client
|
|
23
|
+
} from "@xpert-ai/xpert-sdk";
|
|
24
|
+
import "@langchain/core/messages/tool";
|
|
25
|
+
import { ChatMessageEventTypeEnum, ChatMessageTypeEnum } from "@xpert-ai/chatkit-types";
|
|
26
|
+
|
|
27
|
+
// src/hooks/useParentMessenger.ts
|
|
28
|
+
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
29
|
+
|
|
30
|
+
// src/hooks/useStream.ts
|
|
31
|
+
var streamRef = { current: null };
|
|
32
|
+
function useStreamManager() {
|
|
33
|
+
return {
|
|
34
|
+
streamRef,
|
|
35
|
+
stream: streamRef.current,
|
|
36
|
+
setStream: (stream) => {
|
|
37
|
+
streamRef.current = stream;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// src/hooks/useParentMessenger.ts
|
|
43
|
+
var getParentOrigin = () => {
|
|
44
|
+
if (typeof document === "undefined" || !document.referrer) return "*";
|
|
45
|
+
try {
|
|
46
|
+
return new URL(document.referrer).origin;
|
|
47
|
+
} catch {
|
|
48
|
+
return "*";
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var createNonce = () => {
|
|
52
|
+
if (typeof crypto !== "undefined" && "randomUUID" in crypto) {
|
|
53
|
+
return crypto.randomUUID();
|
|
54
|
+
}
|
|
55
|
+
return `ck_${Date.now()}_${Math.random().toString(16).slice(2)}`;
|
|
56
|
+
};
|
|
57
|
+
function useParentMessenger({ onSetOptions } = {}) {
|
|
58
|
+
const { streamRef: streamRef2 } = useStreamManager();
|
|
59
|
+
const parentOriginRef = useRef("*");
|
|
60
|
+
const pendingRef = useRef(
|
|
61
|
+
/* @__PURE__ */ new Map()
|
|
62
|
+
);
|
|
63
|
+
const isParentAvailable = useMemo(() => {
|
|
64
|
+
return typeof window !== "undefined" && window.parent !== window;
|
|
65
|
+
}, []);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
parentOriginRef.current = getParentOrigin();
|
|
68
|
+
}, []);
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (!isParentAvailable) return;
|
|
71
|
+
const sendResponse = (nonce, response, error) => {
|
|
72
|
+
const message = {
|
|
73
|
+
__xpaiChatKit: true,
|
|
74
|
+
type: "response",
|
|
75
|
+
nonce,
|
|
76
|
+
response,
|
|
77
|
+
error
|
|
78
|
+
};
|
|
79
|
+
window.parent.postMessage(message, parentOriginRef.current);
|
|
80
|
+
};
|
|
81
|
+
const handleMessage = (event) => {
|
|
82
|
+
if (event.source !== window.parent) return;
|
|
83
|
+
if (!event.data || typeof event.data !== "object") return;
|
|
84
|
+
if (parentOriginRef.current !== "*" && typeof event.origin === "string" && event.origin !== parentOriginRef.current) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const payload = event.data;
|
|
88
|
+
if (payload.__xpaiChatKit !== true) return;
|
|
89
|
+
if (payload.type == "command" && payload.command === "onSendUserMessage") {
|
|
90
|
+
streamRef2.current?.submit({
|
|
91
|
+
input: {
|
|
92
|
+
input: payload.data.text
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
if (payload.nonce) {
|
|
96
|
+
sendResponse(payload.nonce, { ok: true });
|
|
97
|
+
}
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (payload.type == "command" && payload.command === "onSetOptions") {
|
|
101
|
+
if (onSetOptions) {
|
|
102
|
+
onSetOptions(payload.data);
|
|
103
|
+
}
|
|
104
|
+
if (payload.nonce) {
|
|
105
|
+
sendResponse(payload.nonce, { ok: true });
|
|
106
|
+
}
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (payload.type !== "response") return;
|
|
110
|
+
if (typeof payload.nonce !== "string") return;
|
|
111
|
+
const handler = pendingRef.current.get(payload.nonce);
|
|
112
|
+
if (!handler) return;
|
|
113
|
+
if (payload.error !== void 0) {
|
|
114
|
+
handler.reject(payload.error);
|
|
115
|
+
} else {
|
|
116
|
+
handler.resolve(payload.response);
|
|
117
|
+
}
|
|
118
|
+
pendingRef.current.delete(payload.nonce);
|
|
119
|
+
};
|
|
120
|
+
window.addEventListener("message", handleMessage);
|
|
121
|
+
return () => {
|
|
122
|
+
window.removeEventListener("message", handleMessage);
|
|
123
|
+
pendingRef.current.forEach((handler) => {
|
|
124
|
+
handler.reject(new Error("Parent messenger closed"));
|
|
125
|
+
});
|
|
126
|
+
pendingRef.current.clear();
|
|
127
|
+
};
|
|
128
|
+
}, [isParentAvailable]);
|
|
129
|
+
const sendCommand = useCallback(
|
|
130
|
+
(command, data, transfer) => {
|
|
131
|
+
if (!isParentAvailable) {
|
|
132
|
+
return Promise.reject(new Error("Parent window not available"));
|
|
133
|
+
}
|
|
134
|
+
const nonce = createNonce();
|
|
135
|
+
const message = {
|
|
136
|
+
__xpaiChatKit: true,
|
|
137
|
+
type: "command",
|
|
138
|
+
nonce,
|
|
139
|
+
command,
|
|
140
|
+
data: data ?? null
|
|
141
|
+
};
|
|
142
|
+
return new Promise((resolve, reject) => {
|
|
143
|
+
pendingRef.current.set(nonce, { resolve, reject });
|
|
144
|
+
window.parent.postMessage(message, parentOriginRef.current, transfer);
|
|
145
|
+
});
|
|
146
|
+
},
|
|
147
|
+
[isParentAvailable]
|
|
148
|
+
);
|
|
149
|
+
const sendEvent = useCallback(
|
|
150
|
+
(event, data, transfer) => {
|
|
151
|
+
if (!isParentAvailable) return;
|
|
152
|
+
const message = {
|
|
153
|
+
__xpaiChatKit: true,
|
|
154
|
+
type: "event",
|
|
155
|
+
event,
|
|
156
|
+
data
|
|
157
|
+
};
|
|
158
|
+
window.parent.postMessage(message, parentOriginRef.current, transfer);
|
|
159
|
+
},
|
|
160
|
+
[isParentAvailable]
|
|
161
|
+
);
|
|
162
|
+
return {
|
|
163
|
+
isParentAvailable,
|
|
164
|
+
sendCommand,
|
|
165
|
+
sendEvent
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// src/providers/Stream.tsx
|
|
170
|
+
import { jsx } from "react/jsx-runtime";
|
|
171
|
+
var StreamContext = createContext(void 0);
|
|
172
|
+
var defaultApiUrl = import.meta.env.VITE_XPERTAI_API_URL ?? "https://api.mtda.cloud/api/ai";
|
|
173
|
+
var useStreamContext = () => {
|
|
174
|
+
const context = useContext(StreamContext);
|
|
175
|
+
if (!context) {
|
|
176
|
+
throw new Error("useStreamContext must be used within a StreamProvider");
|
|
177
|
+
}
|
|
178
|
+
return context;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// src/components/composer/ComposerMenu.tsx
|
|
182
|
+
import * as React4 from "react";
|
|
183
|
+
|
|
184
|
+
// src/components/ui/button.tsx
|
|
185
|
+
import * as React2 from "react";
|
|
186
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
187
|
+
var base = "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 ring-offset-background";
|
|
188
|
+
var variants = {
|
|
189
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
190
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
191
|
+
ghost: "hover:bg-accent hover:text-accent-foreground"
|
|
192
|
+
};
|
|
193
|
+
var sizes = {
|
|
194
|
+
default: "h-10 px-4 py-2",
|
|
195
|
+
sm: "h-9 rounded-md px-3",
|
|
196
|
+
icon: "h-10 w-10"
|
|
197
|
+
};
|
|
198
|
+
var Button = React2.forwardRef(
|
|
199
|
+
({ className, variant = "default", size = "default", type, ...props }, ref) => {
|
|
200
|
+
return /* @__PURE__ */ jsx2(
|
|
201
|
+
"button",
|
|
202
|
+
{
|
|
203
|
+
ref,
|
|
204
|
+
type: type ?? "button",
|
|
205
|
+
className: cn(base, variants[variant], sizes[size], className),
|
|
206
|
+
...props
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
Button.displayName = "Button";
|
|
212
|
+
|
|
213
|
+
// src/components/ui/popover.tsx
|
|
214
|
+
import "react";
|
|
215
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
216
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
217
|
+
function Popover({
|
|
218
|
+
...props
|
|
219
|
+
}) {
|
|
220
|
+
return /* @__PURE__ */ jsx3(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
|
|
221
|
+
}
|
|
222
|
+
function PopoverTrigger({
|
|
223
|
+
...props
|
|
224
|
+
}) {
|
|
225
|
+
return /* @__PURE__ */ jsx3(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
226
|
+
}
|
|
227
|
+
function PopoverContent({
|
|
228
|
+
className,
|
|
229
|
+
align = "center",
|
|
230
|
+
sideOffset = 4,
|
|
231
|
+
...props
|
|
232
|
+
}) {
|
|
233
|
+
return /* @__PURE__ */ jsx3(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx3(
|
|
234
|
+
PopoverPrimitive.Content,
|
|
235
|
+
{
|
|
236
|
+
"data-slot": "popover-content",
|
|
237
|
+
align,
|
|
238
|
+
sideOffset,
|
|
239
|
+
className: cn(
|
|
240
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",
|
|
241
|
+
className
|
|
242
|
+
),
|
|
243
|
+
...props
|
|
244
|
+
}
|
|
245
|
+
) });
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// src/i18n/useChatkitTranslation.ts
|
|
249
|
+
import { useTranslation } from "react-i18next";
|
|
250
|
+
|
|
251
|
+
// src/i18n/index.ts
|
|
252
|
+
import i18n from "i18next";
|
|
253
|
+
import { initReactI18next } from "react-i18next";
|
|
254
|
+
|
|
255
|
+
// src/i18n/locales/en-US.json
|
|
256
|
+
var en_US_default = {
|
|
257
|
+
chat: {
|
|
258
|
+
title: "Chat",
|
|
259
|
+
placeholder: "Type a message...",
|
|
260
|
+
statusOnline: "Online",
|
|
261
|
+
missingConfigShort: "Missing ChatKit configuration.",
|
|
262
|
+
missingConfigDetail: "Missing ChatKit configuration. Check `VITE_XPERTAI_API_URL`, and the `clientSecret` prop.",
|
|
263
|
+
loadingConversation: "Loading conversation...",
|
|
264
|
+
stop: "Stop",
|
|
265
|
+
send: "Send message",
|
|
266
|
+
poweredBy: "Powered by Xpert AI",
|
|
267
|
+
errors: {
|
|
268
|
+
loadMessages: "Failed to load conversation messages",
|
|
269
|
+
createConversation: "Failed to create conversation",
|
|
270
|
+
deleteConversation: "Failed to delete conversation"
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
history: {
|
|
274
|
+
conversationHistory: "Conversation history",
|
|
275
|
+
title: "Conversations",
|
|
276
|
+
newChat: "New Chat",
|
|
277
|
+
empty: "No conversations yet",
|
|
278
|
+
newConversationTitle: "New conversation",
|
|
279
|
+
conversationWithId: "Conversation {{id}}",
|
|
280
|
+
conversationFallback: "Conversation"
|
|
281
|
+
},
|
|
282
|
+
messageActions: {
|
|
283
|
+
copied: "Copied!",
|
|
284
|
+
copy: "Copy to clipboard",
|
|
285
|
+
regenerate: "Regenerate response"
|
|
286
|
+
},
|
|
287
|
+
startScreen: {
|
|
288
|
+
greeting: "What can I help with today?"
|
|
289
|
+
},
|
|
290
|
+
composer: {
|
|
291
|
+
openMenu: "Open menu",
|
|
292
|
+
addAttachment: "Add attachment"
|
|
293
|
+
},
|
|
294
|
+
sheet: {
|
|
295
|
+
close: "Close"
|
|
296
|
+
},
|
|
297
|
+
markdown: {
|
|
298
|
+
copy: "Copy"
|
|
299
|
+
},
|
|
300
|
+
thread: {
|
|
301
|
+
errorToast: "An error occurred. Please try again.",
|
|
302
|
+
errorLabel: "Error:",
|
|
303
|
+
langGraphMessages: "LangGraph Messages..."
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
// src/i18n/locales/zh-CN.json
|
|
308
|
+
var zh_CN_default = {
|
|
309
|
+
chat: {
|
|
310
|
+
title: "\u804A\u5929",
|
|
311
|
+
placeholder: "\u8F93\u5165\u6D88\u606F...",
|
|
312
|
+
statusOnline: "\u5728\u7EBF",
|
|
313
|
+
missingConfigShort: "\u7F3A\u5C11 ChatKit \u914D\u7F6E\u3002",
|
|
314
|
+
missingConfigDetail: "\u7F3A\u5C11 ChatKit \u914D\u7F6E\u3002\u8BF7\u68C0\u67E5 `VITE_XPERTAI_API_URL` \u548C `clientSecret` \u53C2\u6570\u3002",
|
|
315
|
+
loadingConversation: "\u6B63\u5728\u52A0\u8F7D\u5BF9\u8BDD...",
|
|
316
|
+
stop: "\u505C\u6B62",
|
|
317
|
+
send: "\u53D1\u9001\u6D88\u606F",
|
|
318
|
+
poweredBy: "\u7531 Xpert AI \u9A71\u52A8",
|
|
319
|
+
errors: {
|
|
320
|
+
loadMessages: "\u52A0\u8F7D\u5BF9\u8BDD\u6D88\u606F\u5931\u8D25",
|
|
321
|
+
createConversation: "\u521B\u5EFA\u5BF9\u8BDD\u5931\u8D25",
|
|
322
|
+
deleteConversation: "\u5220\u9664\u5BF9\u8BDD\u5931\u8D25"
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
history: {
|
|
326
|
+
conversationHistory: "\u5BF9\u8BDD\u5386\u53F2",
|
|
327
|
+
title: "\u5BF9\u8BDD",
|
|
328
|
+
newChat: "\u65B0\u5BF9\u8BDD",
|
|
329
|
+
empty: "\u6682\u65E0\u5BF9\u8BDD",
|
|
330
|
+
newConversationTitle: "\u65B0\u5BF9\u8BDD",
|
|
331
|
+
conversationWithId: "\u5BF9\u8BDD {{id}}",
|
|
332
|
+
conversationFallback: "\u5BF9\u8BDD"
|
|
333
|
+
},
|
|
334
|
+
messageActions: {
|
|
335
|
+
copied: "\u5DF2\u590D\u5236\uFF01",
|
|
336
|
+
copy: "\u590D\u5236\u5230\u526A\u8D34\u677F",
|
|
337
|
+
regenerate: "\u91CD\u65B0\u751F\u6210\u56DE\u590D"
|
|
338
|
+
},
|
|
339
|
+
startScreen: {
|
|
340
|
+
greeting: "\u4ECA\u5929\u6211\u80FD\u5E2E\u4F60\u4EC0\u4E48\uFF1F"
|
|
341
|
+
},
|
|
342
|
+
composer: {
|
|
343
|
+
openMenu: "\u6253\u5F00\u83DC\u5355",
|
|
344
|
+
addAttachment: "\u6DFB\u52A0\u9644\u4EF6"
|
|
345
|
+
},
|
|
346
|
+
sheet: {
|
|
347
|
+
close: "\u5173\u95ED"
|
|
348
|
+
},
|
|
349
|
+
markdown: {
|
|
350
|
+
copy: "\u590D\u5236"
|
|
351
|
+
},
|
|
352
|
+
thread: {
|
|
353
|
+
errorToast: "\u53D1\u751F\u9519\u8BEF\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
354
|
+
errorLabel: "\u9519\u8BEF\uFF1A",
|
|
355
|
+
langGraphMessages: "LangGraph \u6D88\u606F..."
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
// src/i18n/index.ts
|
|
360
|
+
var localeStorageKey = "chatkit:locale";
|
|
361
|
+
var supportedLocales = ["en-US", "zh-CN"];
|
|
362
|
+
var defaultLocale = "en-US";
|
|
363
|
+
function normalizeLocale(locale) {
|
|
364
|
+
if (!locale) return defaultLocale;
|
|
365
|
+
const normalized = locale.trim();
|
|
366
|
+
if (!normalized) return defaultLocale;
|
|
367
|
+
if (normalized === "zh-CN" || normalized.startsWith("zh")) return "zh-CN";
|
|
368
|
+
if (normalized === "en-US" || normalized.startsWith("en")) return "en-US";
|
|
369
|
+
return defaultLocale;
|
|
370
|
+
}
|
|
371
|
+
function getStoredLocale() {
|
|
372
|
+
if (typeof window === "undefined") return null;
|
|
373
|
+
try {
|
|
374
|
+
return window.localStorage.getItem(localeStorageKey);
|
|
375
|
+
} catch {
|
|
376
|
+
return null;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
function getBrowserLocale() {
|
|
380
|
+
if (typeof navigator === "undefined") return null;
|
|
381
|
+
return navigator.language || null;
|
|
382
|
+
}
|
|
383
|
+
function initI18n() {
|
|
384
|
+
if (i18n.isInitialized) return i18n;
|
|
385
|
+
const initialLocale = normalizeLocale(getStoredLocale() ?? getBrowserLocale());
|
|
386
|
+
void i18n.use(initReactI18next).init({
|
|
387
|
+
resources: {
|
|
388
|
+
"en-US": { translation: en_US_default },
|
|
389
|
+
"zh-CN": { translation: zh_CN_default }
|
|
390
|
+
},
|
|
391
|
+
lng: initialLocale,
|
|
392
|
+
fallbackLng: defaultLocale,
|
|
393
|
+
interpolation: {
|
|
394
|
+
escapeValue: false
|
|
395
|
+
},
|
|
396
|
+
react: {
|
|
397
|
+
useSuspense: false
|
|
398
|
+
},
|
|
399
|
+
initImmediate: false
|
|
400
|
+
});
|
|
401
|
+
return i18n;
|
|
402
|
+
}
|
|
403
|
+
function setLanguage(locale) {
|
|
404
|
+
const resolved = normalizeLocale(locale);
|
|
405
|
+
initI18n();
|
|
406
|
+
void i18n.changeLanguage(resolved);
|
|
407
|
+
if (typeof window !== "undefined") {
|
|
408
|
+
try {
|
|
409
|
+
window.localStorage.setItem(localeStorageKey, resolved);
|
|
410
|
+
} catch {
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return resolved;
|
|
414
|
+
}
|
|
415
|
+
function getLanguage() {
|
|
416
|
+
if (i18n.isInitialized) {
|
|
417
|
+
return normalizeLocale(i18n.language);
|
|
418
|
+
}
|
|
419
|
+
return normalizeLocale(getStoredLocale() ?? getBrowserLocale());
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// src/i18n/useChatkitTranslation.ts
|
|
423
|
+
function useChatkitTranslation() {
|
|
424
|
+
initI18n();
|
|
425
|
+
return useTranslation();
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// src/components/composer/ComposerMenu.tsx
|
|
429
|
+
import { Fragment, jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
430
|
+
function getIconComponent(icon) {
|
|
431
|
+
const iconMap = {
|
|
432
|
+
"plus": /* @__PURE__ */ jsx4("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx4("path", { d: "M5 12h14M12 5v14" }) }),
|
|
433
|
+
"document": /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
434
|
+
/* @__PURE__ */ jsx4("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" }),
|
|
435
|
+
/* @__PURE__ */ jsx4("polyline", { points: "14 2 14 8 20 8" })
|
|
436
|
+
] }),
|
|
437
|
+
"write": /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
438
|
+
/* @__PURE__ */ jsx4("path", { d: "M12 20h9" }),
|
|
439
|
+
/* @__PURE__ */ jsx4("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })
|
|
440
|
+
] }),
|
|
441
|
+
"sparkle": /* @__PURE__ */ jsx4("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx4("path", { d: "M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z" }) }),
|
|
442
|
+
"lightbulb": /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
443
|
+
/* @__PURE__ */ jsx4("path", { d: "M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5" }),
|
|
444
|
+
/* @__PURE__ */ jsx4("path", { d: "M9 18h6" }),
|
|
445
|
+
/* @__PURE__ */ jsx4("path", { d: "M10 22h4" })
|
|
446
|
+
] }),
|
|
447
|
+
"settings-slider": /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
448
|
+
/* @__PURE__ */ jsx4("line", { x1: "4", x2: "4", y1: "21", y2: "14" }),
|
|
449
|
+
/* @__PURE__ */ jsx4("line", { x1: "4", x2: "4", y1: "10", y2: "3" }),
|
|
450
|
+
/* @__PURE__ */ jsx4("line", { x1: "12", x2: "12", y1: "21", y2: "12" }),
|
|
451
|
+
/* @__PURE__ */ jsx4("line", { x1: "12", x2: "12", y1: "8", y2: "3" }),
|
|
452
|
+
/* @__PURE__ */ jsx4("line", { x1: "20", x2: "20", y1: "21", y2: "16" }),
|
|
453
|
+
/* @__PURE__ */ jsx4("line", { x1: "20", x2: "20", y1: "12", y2: "3" }),
|
|
454
|
+
/* @__PURE__ */ jsx4("line", { x1: "2", x2: "6", y1: "14", y2: "14" }),
|
|
455
|
+
/* @__PURE__ */ jsx4("line", { x1: "10", x2: "14", y1: "8", y2: "8" }),
|
|
456
|
+
/* @__PURE__ */ jsx4("line", { x1: "18", x2: "22", y1: "16", y2: "16" })
|
|
457
|
+
] }),
|
|
458
|
+
"search": /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
459
|
+
/* @__PURE__ */ jsx4("circle", { cx: "11", cy: "11", r: "8" }),
|
|
460
|
+
/* @__PURE__ */ jsx4("path", { d: "m21 21-4.3-4.3" })
|
|
461
|
+
] }),
|
|
462
|
+
"globe": /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
463
|
+
/* @__PURE__ */ jsx4("circle", { cx: "12", cy: "12", r: "10" }),
|
|
464
|
+
/* @__PURE__ */ jsx4("line", { x1: "2", x2: "22", y1: "12", y2: "12" }),
|
|
465
|
+
/* @__PURE__ */ jsx4("path", { d: "M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z" })
|
|
466
|
+
] }),
|
|
467
|
+
"images": /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
468
|
+
/* @__PURE__ */ jsx4("path", { d: "M18 22H4a2 2 0 0 1-2-2V6" }),
|
|
469
|
+
/* @__PURE__ */ jsx4("path", { d: "m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18" }),
|
|
470
|
+
/* @__PURE__ */ jsx4("circle", { cx: "12", cy: "8", r: "2" }),
|
|
471
|
+
/* @__PURE__ */ jsx4("rect", { width: "16", height: "16", x: "6", y: "2", rx: "2" })
|
|
472
|
+
] })
|
|
473
|
+
};
|
|
474
|
+
return iconMap[icon] || iconMap["sparkle"];
|
|
475
|
+
}
|
|
476
|
+
function PaperclipIcon() {
|
|
477
|
+
return /* @__PURE__ */ jsx4("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx4("path", { d: "m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48" }) });
|
|
478
|
+
}
|
|
479
|
+
function PlusIcon() {
|
|
480
|
+
return /* @__PURE__ */ jsx4("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx4("path", { d: "M5 12h14M12 5v14" }) });
|
|
481
|
+
}
|
|
482
|
+
function ComposerMenu({
|
|
483
|
+
composer,
|
|
484
|
+
onAttachmentClick,
|
|
485
|
+
onToolSelect,
|
|
486
|
+
selectedTool,
|
|
487
|
+
disabled = false
|
|
488
|
+
}) {
|
|
489
|
+
const { t } = useChatkitTranslation();
|
|
490
|
+
const [open, setOpen] = React4.useState(false);
|
|
491
|
+
const attachmentsEnabled = composer?.attachments?.enabled ?? false;
|
|
492
|
+
const tools = composer?.tools ?? [];
|
|
493
|
+
if (!attachmentsEnabled && tools.length === 0) {
|
|
494
|
+
return null;
|
|
495
|
+
}
|
|
496
|
+
const handleAttachmentClick = () => {
|
|
497
|
+
onAttachmentClick?.();
|
|
498
|
+
setOpen(false);
|
|
499
|
+
};
|
|
500
|
+
const handleToolSelect = (tool) => {
|
|
501
|
+
onToolSelect?.(tool);
|
|
502
|
+
setOpen(false);
|
|
503
|
+
};
|
|
504
|
+
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
505
|
+
/* @__PURE__ */ jsx4(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
506
|
+
Button,
|
|
507
|
+
{
|
|
508
|
+
type: "button",
|
|
509
|
+
variant: "ghost",
|
|
510
|
+
size: "icon",
|
|
511
|
+
disabled,
|
|
512
|
+
className: cn(
|
|
513
|
+
"h-10 w-10 shrink-0 rounded-full hover:bg-muted",
|
|
514
|
+
open && "bg-muted"
|
|
515
|
+
),
|
|
516
|
+
children: [
|
|
517
|
+
/* @__PURE__ */ jsx4(PlusIcon, {}),
|
|
518
|
+
/* @__PURE__ */ jsx4("span", { className: "sr-only", children: t("composer.openMenu") })
|
|
519
|
+
]
|
|
520
|
+
}
|
|
521
|
+
) }),
|
|
522
|
+
/* @__PURE__ */ jsx4(
|
|
523
|
+
PopoverContent,
|
|
524
|
+
{
|
|
525
|
+
align: "start",
|
|
526
|
+
side: "top",
|
|
527
|
+
className: "w-56 p-1",
|
|
528
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
529
|
+
attachmentsEnabled && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
530
|
+
/* @__PURE__ */ jsxs(
|
|
531
|
+
"button",
|
|
532
|
+
{
|
|
533
|
+
type: "button",
|
|
534
|
+
onClick: handleAttachmentClick,
|
|
535
|
+
className: "flex items-center gap-3 rounded-md px-3 py-2 text-sm hover:bg-muted transition-colors",
|
|
536
|
+
children: [
|
|
537
|
+
/* @__PURE__ */ jsx4("span", { className: "flex h-6 w-6 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ jsx4(PaperclipIcon, {}) }),
|
|
538
|
+
/* @__PURE__ */ jsx4("span", { children: t("composer.addAttachment") })
|
|
539
|
+
]
|
|
540
|
+
}
|
|
541
|
+
),
|
|
542
|
+
tools.length > 0 && /* @__PURE__ */ jsx4("div", { className: "my-1 h-px bg-border" })
|
|
543
|
+
] }),
|
|
544
|
+
tools.map((tool) => /* @__PURE__ */ jsxs(
|
|
545
|
+
"button",
|
|
546
|
+
{
|
|
547
|
+
type: "button",
|
|
548
|
+
onClick: () => handleToolSelect(tool),
|
|
549
|
+
className: cn(
|
|
550
|
+
"flex items-center gap-3 rounded-md px-3 py-2 text-sm hover:bg-muted transition-colors",
|
|
551
|
+
selectedTool?.id === tool.id && "bg-muted"
|
|
552
|
+
),
|
|
553
|
+
children: [
|
|
554
|
+
/* @__PURE__ */ jsx4("span", { className: "flex h-6 w-6 items-center justify-center text-muted-foreground", children: getIconComponent(tool.icon) }),
|
|
555
|
+
/* @__PURE__ */ jsx4("span", { children: tool.label })
|
|
556
|
+
]
|
|
557
|
+
},
|
|
558
|
+
tool.id
|
|
559
|
+
))
|
|
560
|
+
] })
|
|
561
|
+
}
|
|
562
|
+
)
|
|
563
|
+
] });
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
// src/components/composer/SendButton.tsx
|
|
567
|
+
import "react";
|
|
568
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
569
|
+
function ArrowUpIcon() {
|
|
570
|
+
return /* @__PURE__ */ jsx5(
|
|
571
|
+
"svg",
|
|
572
|
+
{
|
|
573
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
574
|
+
width: "18",
|
|
575
|
+
height: "18",
|
|
576
|
+
viewBox: "0 0 24 24",
|
|
577
|
+
fill: "none",
|
|
578
|
+
stroke: "currentColor",
|
|
579
|
+
strokeWidth: "2.5",
|
|
580
|
+
strokeLinecap: "round",
|
|
581
|
+
strokeLinejoin: "round",
|
|
582
|
+
children: /* @__PURE__ */ jsx5("path", { d: "M12 19V5M5 12l7-7 7 7" })
|
|
583
|
+
}
|
|
584
|
+
);
|
|
585
|
+
}
|
|
586
|
+
function StopIcon() {
|
|
587
|
+
return /* @__PURE__ */ jsx5(
|
|
588
|
+
"svg",
|
|
589
|
+
{
|
|
590
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
591
|
+
width: "14",
|
|
592
|
+
height: "14",
|
|
593
|
+
viewBox: "0 0 24 24",
|
|
594
|
+
fill: "currentColor",
|
|
595
|
+
children: /* @__PURE__ */ jsx5("rect", { x: "4", y: "4", width: "16", height: "16", rx: "2" })
|
|
596
|
+
}
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
function SendButton({
|
|
600
|
+
disabled = false,
|
|
601
|
+
isLoading = false,
|
|
602
|
+
onStop,
|
|
603
|
+
stopLabel = "Stop",
|
|
604
|
+
sendLabel = "Send"
|
|
605
|
+
}) {
|
|
606
|
+
if (isLoading) {
|
|
607
|
+
return /* @__PURE__ */ jsx5(
|
|
608
|
+
"button",
|
|
609
|
+
{
|
|
610
|
+
type: "button",
|
|
611
|
+
onClick: onStop,
|
|
612
|
+
className: cn(
|
|
613
|
+
"flex h-9 w-9 shrink-0 items-center justify-center rounded-full",
|
|
614
|
+
"bg-foreground text-background",
|
|
615
|
+
"transition-transform duration-150 ease-out",
|
|
616
|
+
"hover:scale-105 active:scale-95"
|
|
617
|
+
),
|
|
618
|
+
"aria-label": stopLabel,
|
|
619
|
+
children: /* @__PURE__ */ jsx5(StopIcon, {})
|
|
620
|
+
}
|
|
621
|
+
);
|
|
622
|
+
}
|
|
623
|
+
return /* @__PURE__ */ jsx5(
|
|
624
|
+
"button",
|
|
625
|
+
{
|
|
626
|
+
type: "submit",
|
|
627
|
+
disabled,
|
|
628
|
+
className: cn(
|
|
629
|
+
"flex h-9 w-9 shrink-0 items-center justify-center rounded-full",
|
|
630
|
+
"bg-foreground text-background",
|
|
631
|
+
"transition-all duration-150 ease-out",
|
|
632
|
+
"hover:scale-105 active:scale-95",
|
|
633
|
+
"disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:scale-100"
|
|
634
|
+
),
|
|
635
|
+
"aria-label": sendLabel,
|
|
636
|
+
children: /* @__PURE__ */ jsx5(ArrowUpIcon, {})
|
|
637
|
+
}
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
// src/components/history/HistorySidebar.tsx
|
|
642
|
+
import * as React8 from "react";
|
|
643
|
+
|
|
644
|
+
// src/components/ui/scroll-area.tsx
|
|
645
|
+
import * as React6 from "react";
|
|
646
|
+
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
647
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
648
|
+
var ScrollArea = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs2(
|
|
649
|
+
ScrollAreaPrimitive.Root,
|
|
650
|
+
{
|
|
651
|
+
ref,
|
|
652
|
+
className: cn("relative overflow-hidden", className),
|
|
653
|
+
...props,
|
|
654
|
+
children: [
|
|
655
|
+
/* @__PURE__ */ jsx6(ScrollAreaPrimitive.Viewport, { className: "h-full w-full rounded-[inherit]", children }),
|
|
656
|
+
/* @__PURE__ */ jsx6(ScrollBar, {}),
|
|
657
|
+
/* @__PURE__ */ jsx6(ScrollAreaPrimitive.Corner, {})
|
|
658
|
+
]
|
|
659
|
+
}
|
|
660
|
+
));
|
|
661
|
+
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
662
|
+
var ScrollBar = React6.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
663
|
+
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
664
|
+
{
|
|
665
|
+
ref,
|
|
666
|
+
orientation,
|
|
667
|
+
className: cn(
|
|
668
|
+
"flex touch-none select-none transition-colors",
|
|
669
|
+
orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
|
|
670
|
+
orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
|
671
|
+
className
|
|
672
|
+
),
|
|
673
|
+
...props,
|
|
674
|
+
children: /* @__PURE__ */ jsx6(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
|
|
675
|
+
}
|
|
676
|
+
));
|
|
677
|
+
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
678
|
+
|
|
679
|
+
// src/components/ui/sheet.tsx
|
|
680
|
+
import "react";
|
|
681
|
+
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
682
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
683
|
+
function Sheet({ ...props }) {
|
|
684
|
+
return /* @__PURE__ */ jsx7(SheetPrimitive.Root, { ...props });
|
|
685
|
+
}
|
|
686
|
+
function SheetTrigger({ ...props }) {
|
|
687
|
+
return /* @__PURE__ */ jsx7(SheetPrimitive.Trigger, { ...props });
|
|
688
|
+
}
|
|
689
|
+
function SheetPortal({ ...props }) {
|
|
690
|
+
return /* @__PURE__ */ jsx7(SheetPrimitive.Portal, { ...props });
|
|
691
|
+
}
|
|
692
|
+
function SheetOverlay({
|
|
693
|
+
className,
|
|
694
|
+
...props
|
|
695
|
+
}) {
|
|
696
|
+
return /* @__PURE__ */ jsx7(
|
|
697
|
+
SheetPrimitive.Overlay,
|
|
698
|
+
{
|
|
699
|
+
className: cn(
|
|
700
|
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
701
|
+
className
|
|
702
|
+
),
|
|
703
|
+
...props
|
|
704
|
+
}
|
|
705
|
+
);
|
|
706
|
+
}
|
|
707
|
+
function SheetContent({
|
|
708
|
+
side = "right",
|
|
709
|
+
className,
|
|
710
|
+
children,
|
|
711
|
+
...props
|
|
712
|
+
}) {
|
|
713
|
+
const { t } = useChatkitTranslation();
|
|
714
|
+
const sideVariants = {
|
|
715
|
+
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
716
|
+
bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
717
|
+
left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
|
|
718
|
+
right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"
|
|
719
|
+
};
|
|
720
|
+
return /* @__PURE__ */ jsxs3(SheetPortal, { children: [
|
|
721
|
+
/* @__PURE__ */ jsx7(SheetOverlay, {}),
|
|
722
|
+
/* @__PURE__ */ jsxs3(
|
|
723
|
+
SheetPrimitive.Content,
|
|
724
|
+
{
|
|
725
|
+
className: cn(
|
|
726
|
+
"fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
727
|
+
sideVariants[side],
|
|
728
|
+
className
|
|
729
|
+
),
|
|
730
|
+
...props,
|
|
731
|
+
children: [
|
|
732
|
+
children,
|
|
733
|
+
/* @__PURE__ */ jsxs3(SheetPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
|
|
734
|
+
/* @__PURE__ */ jsx7(
|
|
735
|
+
"svg",
|
|
736
|
+
{
|
|
737
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
738
|
+
width: "16",
|
|
739
|
+
height: "16",
|
|
740
|
+
viewBox: "0 0 24 24",
|
|
741
|
+
fill: "none",
|
|
742
|
+
stroke: "currentColor",
|
|
743
|
+
strokeWidth: "2",
|
|
744
|
+
strokeLinecap: "round",
|
|
745
|
+
strokeLinejoin: "round",
|
|
746
|
+
children: /* @__PURE__ */ jsx7("path", { d: "M18 6 6 18M6 6l12 12" })
|
|
747
|
+
}
|
|
748
|
+
),
|
|
749
|
+
/* @__PURE__ */ jsx7("span", { className: "sr-only", children: t("sheet.close") })
|
|
750
|
+
] })
|
|
751
|
+
]
|
|
752
|
+
}
|
|
753
|
+
)
|
|
754
|
+
] });
|
|
755
|
+
}
|
|
756
|
+
function SheetHeader({
|
|
757
|
+
className,
|
|
758
|
+
...props
|
|
759
|
+
}) {
|
|
760
|
+
return /* @__PURE__ */ jsx7(
|
|
761
|
+
"div",
|
|
762
|
+
{
|
|
763
|
+
className: cn(
|
|
764
|
+
"flex flex-col space-y-2 text-center sm:text-left",
|
|
765
|
+
className
|
|
766
|
+
),
|
|
767
|
+
...props
|
|
768
|
+
}
|
|
769
|
+
);
|
|
770
|
+
}
|
|
771
|
+
function SheetTitle({
|
|
772
|
+
className,
|
|
773
|
+
...props
|
|
774
|
+
}) {
|
|
775
|
+
return /* @__PURE__ */ jsx7(
|
|
776
|
+
SheetPrimitive.Title,
|
|
777
|
+
{
|
|
778
|
+
className: cn("text-lg font-semibold text-foreground", className),
|
|
779
|
+
...props
|
|
780
|
+
}
|
|
781
|
+
);
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
// src/components/history/HistorySidebar.tsx
|
|
785
|
+
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
786
|
+
function HistoryIcon() {
|
|
787
|
+
return /* @__PURE__ */ jsxs4(
|
|
788
|
+
"svg",
|
|
789
|
+
{
|
|
790
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
791
|
+
width: "18",
|
|
792
|
+
height: "18",
|
|
793
|
+
viewBox: "0 0 24 24",
|
|
794
|
+
fill: "none",
|
|
795
|
+
stroke: "currentColor",
|
|
796
|
+
strokeWidth: "2",
|
|
797
|
+
strokeLinecap: "round",
|
|
798
|
+
strokeLinejoin: "round",
|
|
799
|
+
children: [
|
|
800
|
+
/* @__PURE__ */ jsx8("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
|
|
801
|
+
/* @__PURE__ */ jsx8("path", { d: "M3 3v5h5" }),
|
|
802
|
+
/* @__PURE__ */ jsx8("path", { d: "M12 7v5l4 2" })
|
|
803
|
+
]
|
|
804
|
+
}
|
|
805
|
+
);
|
|
806
|
+
}
|
|
807
|
+
function PlusCircleIcon() {
|
|
808
|
+
return /* @__PURE__ */ jsxs4(
|
|
809
|
+
"svg",
|
|
810
|
+
{
|
|
811
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
812
|
+
width: "16",
|
|
813
|
+
height: "16",
|
|
814
|
+
viewBox: "0 0 24 24",
|
|
815
|
+
fill: "none",
|
|
816
|
+
stroke: "currentColor",
|
|
817
|
+
strokeWidth: "2",
|
|
818
|
+
strokeLinecap: "round",
|
|
819
|
+
strokeLinejoin: "round",
|
|
820
|
+
children: [
|
|
821
|
+
/* @__PURE__ */ jsx8("circle", { cx: "12", cy: "12", r: "10" }),
|
|
822
|
+
/* @__PURE__ */ jsx8("path", { d: "M8 12h8M12 8v8" })
|
|
823
|
+
]
|
|
824
|
+
}
|
|
825
|
+
);
|
|
826
|
+
}
|
|
827
|
+
function MessageIcon() {
|
|
828
|
+
return /* @__PURE__ */ jsx8(
|
|
829
|
+
"svg",
|
|
830
|
+
{
|
|
831
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
832
|
+
width: "16",
|
|
833
|
+
height: "16",
|
|
834
|
+
viewBox: "0 0 24 24",
|
|
835
|
+
fill: "none",
|
|
836
|
+
stroke: "currentColor",
|
|
837
|
+
strokeWidth: "2",
|
|
838
|
+
strokeLinecap: "round",
|
|
839
|
+
strokeLinejoin: "round",
|
|
840
|
+
children: /* @__PURE__ */ jsx8("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" })
|
|
841
|
+
}
|
|
842
|
+
);
|
|
843
|
+
}
|
|
844
|
+
function TrashIcon() {
|
|
845
|
+
return /* @__PURE__ */ jsxs4(
|
|
846
|
+
"svg",
|
|
847
|
+
{
|
|
848
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
849
|
+
width: "14",
|
|
850
|
+
height: "14",
|
|
851
|
+
viewBox: "0 0 24 24",
|
|
852
|
+
fill: "none",
|
|
853
|
+
stroke: "currentColor",
|
|
854
|
+
strokeWidth: "2",
|
|
855
|
+
strokeLinecap: "round",
|
|
856
|
+
strokeLinejoin: "round",
|
|
857
|
+
children: [
|
|
858
|
+
/* @__PURE__ */ jsx8("path", { d: "M3 6h18" }),
|
|
859
|
+
/* @__PURE__ */ jsx8("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }),
|
|
860
|
+
/* @__PURE__ */ jsx8("path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" })
|
|
861
|
+
]
|
|
862
|
+
}
|
|
863
|
+
);
|
|
864
|
+
}
|
|
865
|
+
function HistorySidebar({
|
|
866
|
+
conversations = [],
|
|
867
|
+
currentConversationId,
|
|
868
|
+
onNewConversation,
|
|
869
|
+
onSelectConversation,
|
|
870
|
+
onDeleteConversation,
|
|
871
|
+
showDelete = true,
|
|
872
|
+
disabled = false
|
|
873
|
+
}) {
|
|
874
|
+
const { t } = useChatkitTranslation();
|
|
875
|
+
const [open, setOpen] = React8.useState(false);
|
|
876
|
+
const handleNewConversation = () => {
|
|
877
|
+
onNewConversation?.();
|
|
878
|
+
setOpen(false);
|
|
879
|
+
};
|
|
880
|
+
const handleSelectConversation = (id) => {
|
|
881
|
+
onSelectConversation?.(id);
|
|
882
|
+
setOpen(false);
|
|
883
|
+
};
|
|
884
|
+
return /* @__PURE__ */ jsxs4(Sheet, { open, onOpenChange: setOpen, children: [
|
|
885
|
+
/* @__PURE__ */ jsx8(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsxs4(
|
|
886
|
+
Button,
|
|
887
|
+
{
|
|
888
|
+
variant: "ghost",
|
|
889
|
+
size: "icon",
|
|
890
|
+
disabled,
|
|
891
|
+
className: "h-8 w-8",
|
|
892
|
+
children: [
|
|
893
|
+
/* @__PURE__ */ jsx8(HistoryIcon, {}),
|
|
894
|
+
/* @__PURE__ */ jsx8("span", { className: "sr-only", children: t("history.conversationHistory") })
|
|
895
|
+
]
|
|
896
|
+
}
|
|
897
|
+
) }),
|
|
898
|
+
/* @__PURE__ */ jsxs4(SheetContent, { side: "right", className: "w-80 p-0", children: [
|
|
899
|
+
/* @__PURE__ */ jsx8(SheetHeader, { className: "border-b p-4", children: /* @__PURE__ */ jsx8(SheetTitle, { children: t("history.title") }) }),
|
|
900
|
+
/* @__PURE__ */ jsx8("div", { className: "p-4", children: /* @__PURE__ */ jsxs4(
|
|
901
|
+
Button,
|
|
902
|
+
{
|
|
903
|
+
onClick: handleNewConversation,
|
|
904
|
+
className: "w-full justify-start gap-2",
|
|
905
|
+
variant: "secondary",
|
|
906
|
+
children: [
|
|
907
|
+
/* @__PURE__ */ jsx8(PlusCircleIcon, {}),
|
|
908
|
+
t("history.newChat")
|
|
909
|
+
]
|
|
910
|
+
}
|
|
911
|
+
) }),
|
|
912
|
+
/* @__PURE__ */ jsx8(ScrollArea, { className: "h-[calc(100vh-140px)]", children: /* @__PURE__ */ jsx8("div", { className: "px-4 pb-4", children: conversations.length === 0 ? /* @__PURE__ */ jsx8("div", { className: "py-8 text-center text-sm text-muted-foreground", children: t("history.empty") }) : /* @__PURE__ */ jsx8("div", { className: "space-y-1", children: conversations.map((conversation) => /* @__PURE__ */ jsxs4(
|
|
913
|
+
"div",
|
|
914
|
+
{
|
|
915
|
+
className: cn(
|
|
916
|
+
"group flex items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors",
|
|
917
|
+
"hover:bg-muted cursor-pointer",
|
|
918
|
+
currentConversationId === conversation.id && "bg-muted"
|
|
919
|
+
),
|
|
920
|
+
onClick: () => handleSelectConversation(conversation.id),
|
|
921
|
+
children: [
|
|
922
|
+
/* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: /* @__PURE__ */ jsx8(MessageIcon, {}) }),
|
|
923
|
+
/* @__PURE__ */ jsx8("span", { className: "flex-1 truncate", children: conversation.title }),
|
|
924
|
+
showDelete && onDeleteConversation && /* @__PURE__ */ jsx8(
|
|
925
|
+
"button",
|
|
926
|
+
{
|
|
927
|
+
type: "button",
|
|
928
|
+
onClick: (e) => {
|
|
929
|
+
e.stopPropagation();
|
|
930
|
+
onDeleteConversation(conversation.id);
|
|
931
|
+
},
|
|
932
|
+
className: "opacity-0 group-hover:opacity-100 p-1 rounded hover:bg-destructive/10 hover:text-destructive transition-all",
|
|
933
|
+
children: /* @__PURE__ */ jsx8(TrashIcon, {})
|
|
934
|
+
}
|
|
935
|
+
)
|
|
936
|
+
]
|
|
937
|
+
},
|
|
938
|
+
conversation.id
|
|
939
|
+
)) }) }) })
|
|
940
|
+
] })
|
|
941
|
+
] });
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
// src/components/thread/messages/ai.tsx
|
|
945
|
+
import "react";
|
|
946
|
+
|
|
947
|
+
// src/components/ui/badge.tsx
|
|
948
|
+
import * as React9 from "react";
|
|
949
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
950
|
+
var base2 = "inline-flex items-center rounded-full border border-transparent px-2.5 py-0.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ring-offset-background";
|
|
951
|
+
var variants2 = {
|
|
952
|
+
default: "bg-primary text-primary-foreground",
|
|
953
|
+
secondary: "bg-secondary text-secondary-foreground",
|
|
954
|
+
outline: "border-input text-foreground"
|
|
955
|
+
};
|
|
956
|
+
var Badge = React9.forwardRef(
|
|
957
|
+
({ className, variant = "default", ...props }, ref) => {
|
|
958
|
+
return /* @__PURE__ */ jsx9("span", { ref, className: cn(base2, variants2[variant], className), ...props });
|
|
959
|
+
}
|
|
960
|
+
);
|
|
961
|
+
Badge.displayName = "Badge";
|
|
962
|
+
|
|
963
|
+
// src/components/ui/card.tsx
|
|
964
|
+
import * as React10 from "react";
|
|
965
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
966
|
+
var Card = React10.forwardRef(
|
|
967
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
|
|
968
|
+
"div",
|
|
969
|
+
{
|
|
970
|
+
ref,
|
|
971
|
+
className: cn(
|
|
972
|
+
"rounded-xl border bg-background/80 text-foreground shadow-[0_14px_40px_-30px_rgba(15,23,42,0.5)] backdrop-blur",
|
|
973
|
+
className
|
|
974
|
+
),
|
|
975
|
+
...props
|
|
976
|
+
}
|
|
977
|
+
)
|
|
978
|
+
);
|
|
979
|
+
Card.displayName = "Card";
|
|
980
|
+
var CardHeader = React10.forwardRef(
|
|
981
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx10("div", { ref, className: cn("flex flex-col gap-1.5 px-6 pt-6", className), ...props })
|
|
982
|
+
);
|
|
983
|
+
CardHeader.displayName = "CardHeader";
|
|
984
|
+
var CardTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10("h3", { ref, className: cn("text-lg font-semibold leading-tight", className), ...props }));
|
|
985
|
+
CardTitle.displayName = "CardTitle";
|
|
986
|
+
var CardDescription = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10("p", { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
987
|
+
CardDescription.displayName = "CardDescription";
|
|
988
|
+
var CardContent = React10.forwardRef(
|
|
989
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx10("div", { ref, className: cn("px-6 pb-6", className), ...props })
|
|
990
|
+
);
|
|
991
|
+
CardContent.displayName = "CardContent";
|
|
992
|
+
var CardFooter = React10.forwardRef(
|
|
993
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx10("div", { ref, className: cn("flex items-center px-6 pb-6", className), ...props })
|
|
994
|
+
);
|
|
995
|
+
CardFooter.displayName = "CardFooter";
|
|
996
|
+
var CardAction = React10.forwardRef(
|
|
997
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx10("div", { ref, className: cn("ml-auto flex items-center", className), ...props })
|
|
998
|
+
);
|
|
999
|
+
CardAction.displayName = "CardAction";
|
|
1000
|
+
|
|
1001
|
+
// src/components/ui/tabs.tsx
|
|
1002
|
+
import * as React11 from "react";
|
|
1003
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1004
|
+
var TabsContext = React11.createContext(null);
|
|
1005
|
+
function Tabs({ className, defaultValue, value, onValueChange, ...props }) {
|
|
1006
|
+
const [internalValue, setInternalValue] = React11.useState(defaultValue ?? "");
|
|
1007
|
+
const activeValue = value ?? internalValue;
|
|
1008
|
+
const setValue = React11.useCallback(
|
|
1009
|
+
(nextValue) => {
|
|
1010
|
+
if (value === void 0) setInternalValue(nextValue);
|
|
1011
|
+
onValueChange?.(nextValue);
|
|
1012
|
+
},
|
|
1013
|
+
[onValueChange, value]
|
|
1014
|
+
);
|
|
1015
|
+
return /* @__PURE__ */ jsx11(TabsContext.Provider, { value: { value: activeValue, setValue }, children: /* @__PURE__ */ jsx11("div", { className: cn("w-full", className), ...props }) });
|
|
1016
|
+
}
|
|
1017
|
+
var TabsList = React11.forwardRef(
|
|
1018
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
1019
|
+
"div",
|
|
1020
|
+
{
|
|
1021
|
+
ref,
|
|
1022
|
+
className: cn(
|
|
1023
|
+
"inline-flex h-11 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
|
|
1024
|
+
className
|
|
1025
|
+
),
|
|
1026
|
+
role: "tablist",
|
|
1027
|
+
...props
|
|
1028
|
+
}
|
|
1029
|
+
)
|
|
1030
|
+
);
|
|
1031
|
+
TabsList.displayName = "TabsList";
|
|
1032
|
+
var TabsTrigger = React11.forwardRef(
|
|
1033
|
+
({ className, value, onClick, ...props }, ref) => {
|
|
1034
|
+
const context = React11.useContext(TabsContext);
|
|
1035
|
+
if (!context) {
|
|
1036
|
+
throw new Error("TabsTrigger must be used within Tabs");
|
|
1037
|
+
}
|
|
1038
|
+
const isActive = context.value === value;
|
|
1039
|
+
return /* @__PURE__ */ jsx11(
|
|
1040
|
+
"button",
|
|
1041
|
+
{
|
|
1042
|
+
ref,
|
|
1043
|
+
type: "button",
|
|
1044
|
+
role: "tab",
|
|
1045
|
+
"aria-selected": isActive,
|
|
1046
|
+
"data-state": isActive ? "active" : "inactive",
|
|
1047
|
+
className: cn(
|
|
1048
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-2 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ring-offset-background disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
|
|
1049
|
+
className
|
|
1050
|
+
),
|
|
1051
|
+
onClick: (event) => {
|
|
1052
|
+
context.setValue(value);
|
|
1053
|
+
onClick?.(event);
|
|
1054
|
+
},
|
|
1055
|
+
...props
|
|
1056
|
+
}
|
|
1057
|
+
);
|
|
1058
|
+
}
|
|
1059
|
+
);
|
|
1060
|
+
TabsTrigger.displayName = "TabsTrigger";
|
|
1061
|
+
var TabsContent = React11.forwardRef(
|
|
1062
|
+
({ className, value, ...props }, ref) => {
|
|
1063
|
+
const context = React11.useContext(TabsContext);
|
|
1064
|
+
if (!context) {
|
|
1065
|
+
throw new Error("TabsContent must be used within Tabs");
|
|
1066
|
+
}
|
|
1067
|
+
if (context.value !== value) return null;
|
|
1068
|
+
return /* @__PURE__ */ jsx11(
|
|
1069
|
+
"div",
|
|
1070
|
+
{
|
|
1071
|
+
ref,
|
|
1072
|
+
role: "tabpanel",
|
|
1073
|
+
className: cn(
|
|
1074
|
+
"mt-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ring-offset-background",
|
|
1075
|
+
className
|
|
1076
|
+
),
|
|
1077
|
+
...props
|
|
1078
|
+
}
|
|
1079
|
+
);
|
|
1080
|
+
}
|
|
1081
|
+
);
|
|
1082
|
+
TabsContent.displayName = "TabsContent";
|
|
1083
|
+
|
|
1084
|
+
// src/components/thread/markdown-text.tsx
|
|
1085
|
+
import ReactMarkdown from "react-markdown";
|
|
1086
|
+
import remarkGfm from "remark-gfm";
|
|
1087
|
+
import rehypeKatex from "rehype-katex";
|
|
1088
|
+
import remarkMath from "remark-math";
|
|
1089
|
+
import { memo, useState as useState5 } from "react";
|
|
1090
|
+
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
1091
|
+
|
|
1092
|
+
// src/components/thread/syntax-highlighter.tsx
|
|
1093
|
+
import { PrismAsyncLight as SyntaxHighlighterPrism } from "react-syntax-highlighter";
|
|
1094
|
+
import tsx from "react-syntax-highlighter/dist/esm/languages/prism/tsx";
|
|
1095
|
+
import python from "react-syntax-highlighter/dist/esm/languages/prism/python";
|
|
1096
|
+
import { coldarkDark } from "react-syntax-highlighter/dist/cjs/styles/prism";
|
|
1097
|
+
import "react";
|
|
1098
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1099
|
+
SyntaxHighlighterPrism.registerLanguage("js", tsx);
|
|
1100
|
+
SyntaxHighlighterPrism.registerLanguage("jsx", tsx);
|
|
1101
|
+
SyntaxHighlighterPrism.registerLanguage("ts", tsx);
|
|
1102
|
+
SyntaxHighlighterPrism.registerLanguage("tsx", tsx);
|
|
1103
|
+
SyntaxHighlighterPrism.registerLanguage("python", python);
|
|
1104
|
+
var SyntaxHighlighter = ({
|
|
1105
|
+
children,
|
|
1106
|
+
language,
|
|
1107
|
+
className
|
|
1108
|
+
}) => {
|
|
1109
|
+
return /* @__PURE__ */ jsx12(
|
|
1110
|
+
SyntaxHighlighterPrism,
|
|
1111
|
+
{
|
|
1112
|
+
language,
|
|
1113
|
+
style: coldarkDark,
|
|
1114
|
+
customStyle: {
|
|
1115
|
+
margin: 0,
|
|
1116
|
+
width: "100%",
|
|
1117
|
+
background: "transparent",
|
|
1118
|
+
padding: "1.5rem 1rem"
|
|
1119
|
+
},
|
|
1120
|
+
className,
|
|
1121
|
+
children
|
|
1122
|
+
}
|
|
1123
|
+
);
|
|
1124
|
+
};
|
|
1125
|
+
|
|
1126
|
+
// src/components/thread/tooltip-icon-button.tsx
|
|
1127
|
+
import { forwardRef as forwardRef6 } from "react";
|
|
1128
|
+
|
|
1129
|
+
// src/components/ui/tooltip.tsx
|
|
1130
|
+
import "react";
|
|
1131
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
1132
|
+
import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1133
|
+
function TooltipProvider({
|
|
1134
|
+
delayDuration = 0,
|
|
1135
|
+
...props
|
|
1136
|
+
}) {
|
|
1137
|
+
return /* @__PURE__ */ jsx13(
|
|
1138
|
+
TooltipPrimitive.Provider,
|
|
1139
|
+
{
|
|
1140
|
+
"data-slot": "tooltip-provider",
|
|
1141
|
+
delayDuration,
|
|
1142
|
+
...props
|
|
1143
|
+
}
|
|
1144
|
+
);
|
|
1145
|
+
}
|
|
1146
|
+
function Tooltip({
|
|
1147
|
+
...props
|
|
1148
|
+
}) {
|
|
1149
|
+
return /* @__PURE__ */ jsx13(TooltipProvider, { children: /* @__PURE__ */ jsx13(
|
|
1150
|
+
TooltipPrimitive.Root,
|
|
1151
|
+
{
|
|
1152
|
+
"data-slot": "tooltip",
|
|
1153
|
+
...props
|
|
1154
|
+
}
|
|
1155
|
+
) });
|
|
1156
|
+
}
|
|
1157
|
+
function TooltipTrigger({
|
|
1158
|
+
...props
|
|
1159
|
+
}) {
|
|
1160
|
+
return /* @__PURE__ */ jsx13(
|
|
1161
|
+
TooltipPrimitive.Trigger,
|
|
1162
|
+
{
|
|
1163
|
+
"data-slot": "tooltip-trigger",
|
|
1164
|
+
...props
|
|
1165
|
+
}
|
|
1166
|
+
);
|
|
1167
|
+
}
|
|
1168
|
+
function TooltipContent({
|
|
1169
|
+
className,
|
|
1170
|
+
sideOffset = 0,
|
|
1171
|
+
children,
|
|
1172
|
+
...props
|
|
1173
|
+
}) {
|
|
1174
|
+
return /* @__PURE__ */ jsx13(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs5(
|
|
1175
|
+
TooltipPrimitive.Content,
|
|
1176
|
+
{
|
|
1177
|
+
"data-slot": "tooltip-content",
|
|
1178
|
+
sideOffset,
|
|
1179
|
+
className: cn(
|
|
1180
|
+
"bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit rounded-md px-3 py-1.5 text-xs text-balance",
|
|
1181
|
+
className
|
|
1182
|
+
),
|
|
1183
|
+
...props,
|
|
1184
|
+
children: [
|
|
1185
|
+
children,
|
|
1186
|
+
/* @__PURE__ */ jsx13(TooltipPrimitive.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
|
|
1187
|
+
]
|
|
1188
|
+
}
|
|
1189
|
+
) });
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
// src/components/thread/tooltip-icon-button.tsx
|
|
1193
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1194
|
+
var TooltipIconButton = forwardRef6(({ children, tooltip, side = "bottom", className, ...rest }, ref) => {
|
|
1195
|
+
return /* @__PURE__ */ jsx14(TooltipProvider, { children: /* @__PURE__ */ jsxs6(Tooltip, { children: [
|
|
1196
|
+
/* @__PURE__ */ jsx14(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs6(
|
|
1197
|
+
Button,
|
|
1198
|
+
{
|
|
1199
|
+
variant: "ghost",
|
|
1200
|
+
size: "icon",
|
|
1201
|
+
...rest,
|
|
1202
|
+
className: cn("size-6 p-1", className),
|
|
1203
|
+
ref,
|
|
1204
|
+
children: [
|
|
1205
|
+
children,
|
|
1206
|
+
/* @__PURE__ */ jsx14("span", { className: "sr-only", children: tooltip })
|
|
1207
|
+
]
|
|
1208
|
+
}
|
|
1209
|
+
) }),
|
|
1210
|
+
/* @__PURE__ */ jsx14(TooltipContent, { side, children: tooltip })
|
|
1211
|
+
] }) });
|
|
1212
|
+
});
|
|
1213
|
+
TooltipIconButton.displayName = "TooltipIconButton";
|
|
1214
|
+
|
|
1215
|
+
// src/components/thread/markdown-text.tsx
|
|
1216
|
+
import "katex/dist/katex.min.css";
|
|
1217
|
+
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1218
|
+
var useCopyToClipboard = ({
|
|
1219
|
+
copiedDuration = 3e3
|
|
1220
|
+
} = {}) => {
|
|
1221
|
+
const [isCopied, setIsCopied] = useState5(false);
|
|
1222
|
+
const copyToClipboard = (value) => {
|
|
1223
|
+
if (!value) return;
|
|
1224
|
+
navigator.clipboard.writeText(value).then(() => {
|
|
1225
|
+
setIsCopied(true);
|
|
1226
|
+
setTimeout(() => setIsCopied(false), copiedDuration);
|
|
1227
|
+
});
|
|
1228
|
+
};
|
|
1229
|
+
return { isCopied, copyToClipboard };
|
|
1230
|
+
};
|
|
1231
|
+
var CodeHeader = ({ language, code }) => {
|
|
1232
|
+
const { t } = useChatkitTranslation();
|
|
1233
|
+
const { isCopied, copyToClipboard } = useCopyToClipboard();
|
|
1234
|
+
const onCopy = () => {
|
|
1235
|
+
if (!code || isCopied) return;
|
|
1236
|
+
copyToClipboard(code);
|
|
1237
|
+
};
|
|
1238
|
+
return /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between gap-4 rounded-t-lg bg-zinc-900 px-4 py-2 text-sm font-semibold text-white", children: [
|
|
1239
|
+
/* @__PURE__ */ jsx15("span", { className: "lowercase [&>span]:text-xs", children: language }),
|
|
1240
|
+
/* @__PURE__ */ jsxs7(
|
|
1241
|
+
TooltipIconButton,
|
|
1242
|
+
{
|
|
1243
|
+
tooltip: t("markdown.copy"),
|
|
1244
|
+
onClick: onCopy,
|
|
1245
|
+
children: [
|
|
1246
|
+
!isCopied && /* @__PURE__ */ jsx15(CopyIcon, {}),
|
|
1247
|
+
isCopied && /* @__PURE__ */ jsx15(CheckIcon, {})
|
|
1248
|
+
]
|
|
1249
|
+
}
|
|
1250
|
+
)
|
|
1251
|
+
] });
|
|
1252
|
+
};
|
|
1253
|
+
var defaultComponents = {
|
|
1254
|
+
h1: ({ className, ...props }) => /* @__PURE__ */ jsx15(
|
|
1255
|
+
"h1",
|
|
1256
|
+
{
|
|
1257
|
+
className: cn(
|
|
1258
|
+
"mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0",
|
|
1259
|
+
className
|
|
1260
|
+
),
|
|
1261
|
+
...props
|
|
1262
|
+
}
|
|
1263
|
+
),
|
|
1264
|
+
h2: ({ className, ...props }) => /* @__PURE__ */ jsx15(
|
|
1265
|
+
"h2",
|
|
1266
|
+
{
|
|
1267
|
+
className: cn(
|
|
1268
|
+
"mt-8 mb-4 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0",
|
|
1269
|
+
className
|
|
1270
|
+
),
|
|
1271
|
+
...props
|
|
1272
|
+
}
|
|
1273
|
+
),
|
|
1274
|
+
h3: ({ className, ...props }) => /* @__PURE__ */ jsx15(
|
|
1275
|
+
"h3",
|
|
1276
|
+
{
|
|
1277
|
+
className: cn(
|
|
1278
|
+
"mt-6 mb-4 scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0",
|
|
1279
|
+
className
|
|
1280
|
+
),
|
|
1281
|
+
...props
|
|
1282
|
+
}
|
|
1283
|
+
),
|
|
1284
|
+
h4: ({ className, ...props }) => /* @__PURE__ */ jsx15(
|
|
1285
|
+
"h4",
|
|
1286
|
+
{
|
|
1287
|
+
className: cn(
|
|
1288
|
+
"mt-6 mb-4 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0",
|
|
1289
|
+
className
|
|
1290
|
+
),
|
|
1291
|
+
...props
|
|
1292
|
+
}
|
|
1293
|
+
),
|
|
1294
|
+
h5: ({ className, ...props }) => /* @__PURE__ */ jsx15(
|
|
1295
|
+
"h5",
|
|
1296
|
+
{
|
|
1297
|
+
className: cn(
|
|
1298
|
+
"my-4 text-lg font-semibold first:mt-0 last:mb-0",
|
|
1299
|
+
className
|
|
1300
|
+
),
|
|
1301
|
+
...props
|
|
1302
|
+
}
|
|
1303
|
+
),
|
|
1304
|
+
h6: ({ className, ...props }) => /* @__PURE__ */ jsx15(
|
|
1305
|
+
"h6",
|
|
1306
|
+
{
|
|
1307
|
+
className: cn("my-4 font-semibold first:mt-0 last:mb-0", className),
|
|
1308
|
+
...props
|
|
1309
|
+
}
|
|
1310
|
+
),
|
|
1311
|
+
p: ({ className, ...props }) => /* @__PURE__ */ jsx15(
|
|
1312
|
+
"p",
|
|
1313
|
+
{
|
|
1314
|
+
className: cn("mt-5 mb-5 leading-7 first:mt-0 last:mb-0", className),
|
|
1315
|
+
...props
|
|
1316
|
+
}
|
|
1317
|
+
),
|
|
1318
|
+
a: ({ className, ...props }) => /* @__PURE__ */ jsx15(
|
|
1319
|
+
"a",
|
|
1320
|
+
{
|
|
1321
|
+
className: cn(
|
|
1322
|
+
"text-primary font-medium underline underline-offset-4",
|
|
1323
|
+
className
|
|
1324
|
+
),
|
|
1325
|
+
...props
|
|
1326
|
+
}
|
|
1327
|
+
),
|
|
1328
|
+
blockquote: ({ className, ...props }) => /* @__PURE__ */ jsx15(
|
|
1329
|
+
"blockquote",
|
|
1330
|
+
{
|
|
1331
|
+
className: cn("border-l-2 pl-6 italic", className),
|
|
1332
|
+
...props
|
|
1333
|
+
}
|
|
1334
|
+
),
|
|
1335
|
+
ul: ({ className, ...props }) => /* @__PURE__ */ jsx15(
|
|
1336
|
+
"ul",
|
|
1337
|
+
{
|
|
1338
|
+
className: cn("my-5 ml-6 list-disc [&>li]:mt-2", className),
|
|
1339
|
+
...props
|
|
1340
|
+
}
|
|
1341
|
+
),
|
|
1342
|
+
ol: ({ className, ...props }) => /* @__PURE__ */ jsx15(
|
|
1343
|
+
"ol",
|
|
1344
|
+
{
|
|
1345
|
+
className: cn("my-5 ml-6 list-decimal [&>li]:mt-2", className),
|
|
1346
|
+
...props
|
|
1347
|
+
}
|
|
1348
|
+
),
|
|
1349
|
+
hr: ({ className, ...props }) => /* @__PURE__ */ jsx15(
|
|
1350
|
+
"hr",
|
|
1351
|
+
{
|
|
1352
|
+
className: cn("my-5 border-b", className),
|
|
1353
|
+
...props
|
|
1354
|
+
}
|
|
1355
|
+
),
|
|
1356
|
+
table: ({ className, ...props }) => /* @__PURE__ */ jsx15(
|
|
1357
|
+
"table",
|
|
1358
|
+
{
|
|
1359
|
+
className: cn(
|
|
1360
|
+
"my-5 w-full border-separate border-spacing-0 overflow-y-auto",
|
|
1361
|
+
className
|
|
1362
|
+
),
|
|
1363
|
+
...props
|
|
1364
|
+
}
|
|
1365
|
+
),
|
|
1366
|
+
th: ({ className, ...props }) => /* @__PURE__ */ jsx15(
|
|
1367
|
+
"th",
|
|
1368
|
+
{
|
|
1369
|
+
className: cn(
|
|
1370
|
+
"bg-muted px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [&[align=center]]:text-center [&[align=right]]:text-right",
|
|
1371
|
+
className
|
|
1372
|
+
),
|
|
1373
|
+
...props
|
|
1374
|
+
}
|
|
1375
|
+
),
|
|
1376
|
+
td: ({ className, ...props }) => /* @__PURE__ */ jsx15(
|
|
1377
|
+
"td",
|
|
1378
|
+
{
|
|
1379
|
+
className: cn(
|
|
1380
|
+
"border-b border-l px-4 py-2 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right",
|
|
1381
|
+
className
|
|
1382
|
+
),
|
|
1383
|
+
...props
|
|
1384
|
+
}
|
|
1385
|
+
),
|
|
1386
|
+
tr: ({ className, ...props }) => /* @__PURE__ */ jsx15(
|
|
1387
|
+
"tr",
|
|
1388
|
+
{
|
|
1389
|
+
className: cn(
|
|
1390
|
+
"m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg",
|
|
1391
|
+
className
|
|
1392
|
+
),
|
|
1393
|
+
...props
|
|
1394
|
+
}
|
|
1395
|
+
),
|
|
1396
|
+
sup: ({ className, ...props }) => /* @__PURE__ */ jsx15(
|
|
1397
|
+
"sup",
|
|
1398
|
+
{
|
|
1399
|
+
className: cn("[&>a]:text-xs [&>a]:no-underline", className),
|
|
1400
|
+
...props
|
|
1401
|
+
}
|
|
1402
|
+
),
|
|
1403
|
+
pre: ({ className, ...props }) => /* @__PURE__ */ jsx15(
|
|
1404
|
+
"pre",
|
|
1405
|
+
{
|
|
1406
|
+
className: cn(
|
|
1407
|
+
"max-w-4xl overflow-x-auto rounded-lg bg-black text-white",
|
|
1408
|
+
className
|
|
1409
|
+
),
|
|
1410
|
+
...props
|
|
1411
|
+
}
|
|
1412
|
+
),
|
|
1413
|
+
code: ({
|
|
1414
|
+
className,
|
|
1415
|
+
children,
|
|
1416
|
+
...props
|
|
1417
|
+
}) => {
|
|
1418
|
+
const match = /language-(\w+)/.exec(className || "");
|
|
1419
|
+
if (match) {
|
|
1420
|
+
const language = match[1];
|
|
1421
|
+
const code = String(children).replace(/\n$/, "");
|
|
1422
|
+
return /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
1423
|
+
/* @__PURE__ */ jsx15(
|
|
1424
|
+
CodeHeader,
|
|
1425
|
+
{
|
|
1426
|
+
language,
|
|
1427
|
+
code
|
|
1428
|
+
}
|
|
1429
|
+
),
|
|
1430
|
+
/* @__PURE__ */ jsx15(
|
|
1431
|
+
SyntaxHighlighter,
|
|
1432
|
+
{
|
|
1433
|
+
language,
|
|
1434
|
+
className,
|
|
1435
|
+
children: code
|
|
1436
|
+
}
|
|
1437
|
+
)
|
|
1438
|
+
] });
|
|
1439
|
+
}
|
|
1440
|
+
return /* @__PURE__ */ jsx15(
|
|
1441
|
+
"code",
|
|
1442
|
+
{
|
|
1443
|
+
className: cn("rounded font-semibold", className),
|
|
1444
|
+
...props,
|
|
1445
|
+
children
|
|
1446
|
+
}
|
|
1447
|
+
);
|
|
1448
|
+
}
|
|
1449
|
+
};
|
|
1450
|
+
var MarkdownTextImpl = ({ children }) => {
|
|
1451
|
+
return /* @__PURE__ */ jsx15("div", { className: "markdown-content", children: /* @__PURE__ */ jsx15(
|
|
1452
|
+
ReactMarkdown,
|
|
1453
|
+
{
|
|
1454
|
+
remarkPlugins: [remarkGfm, remarkMath],
|
|
1455
|
+
rehypePlugins: [rehypeKatex],
|
|
1456
|
+
components: defaultComponents,
|
|
1457
|
+
children
|
|
1458
|
+
}
|
|
1459
|
+
) });
|
|
1460
|
+
};
|
|
1461
|
+
var MarkdownText = memo(MarkdownTextImpl);
|
|
1462
|
+
|
|
1463
|
+
// src/components/thread/messages/widget.tsx
|
|
1464
|
+
import { SurfaceRenderer } from "@xpert-ai/a2ui-react";
|
|
1465
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1466
|
+
function WidgetMessage({ messageId, data }) {
|
|
1467
|
+
const widgets = Array.isArray(data.widgets) ? data.widgets : [];
|
|
1468
|
+
if (widgets.length === 0) return null;
|
|
1469
|
+
const baseSurfaceId = `widget-${messageId}`;
|
|
1470
|
+
return /* @__PURE__ */ jsx16("div", { className: "space-y-3", children: widgets.map((widget, index) => {
|
|
1471
|
+
const config = widget?.config;
|
|
1472
|
+
if (!config || typeof config !== "object") {
|
|
1473
|
+
return null;
|
|
1474
|
+
}
|
|
1475
|
+
const surfaceId = widgets.length > 1 ? `${baseSurfaceId}-${index}` : baseSurfaceId;
|
|
1476
|
+
return /* @__PURE__ */ jsx16(
|
|
1477
|
+
SurfaceRenderer,
|
|
1478
|
+
{
|
|
1479
|
+
surfaceId,
|
|
1480
|
+
surface: config
|
|
1481
|
+
},
|
|
1482
|
+
widget?.name ?? surfaceId
|
|
1483
|
+
);
|
|
1484
|
+
}) });
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
// src/components/thread/messages/ai.tsx
|
|
1488
|
+
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1489
|
+
function isTextContent(content) {
|
|
1490
|
+
return content.type === "text";
|
|
1491
|
+
}
|
|
1492
|
+
function isReasoningContent(content) {
|
|
1493
|
+
return content.type === "reasoning";
|
|
1494
|
+
}
|
|
1495
|
+
function isImageContent(content) {
|
|
1496
|
+
return content.type === "image_url";
|
|
1497
|
+
}
|
|
1498
|
+
function isComponentContent(content) {
|
|
1499
|
+
return content.type === "component";
|
|
1500
|
+
}
|
|
1501
|
+
function isWidgetComponent(content) {
|
|
1502
|
+
const data = content.data;
|
|
1503
|
+
return data?.type === "Widget" && Array.isArray(data.widgets);
|
|
1504
|
+
}
|
|
1505
|
+
function isMemoryContent(content) {
|
|
1506
|
+
return content.type === "memory";
|
|
1507
|
+
}
|
|
1508
|
+
function safeJson(value) {
|
|
1509
|
+
try {
|
|
1510
|
+
return JSON.stringify(value, null, 2);
|
|
1511
|
+
} catch {
|
|
1512
|
+
return String(value);
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
function ReasoningBlock({ reasoning }) {
|
|
1516
|
+
const blocks = reasoning.filter((item) => item.text?.trim());
|
|
1517
|
+
if (blocks.length === 0) return null;
|
|
1518
|
+
return /* @__PURE__ */ jsx17("div", { className: "space-y-2", children: blocks.map((item, index) => /* @__PURE__ */ jsx17(
|
|
1519
|
+
"div",
|
|
1520
|
+
{
|
|
1521
|
+
className: "rounded-lg border bg-muted/40 p-3 text-xs text-muted-foreground",
|
|
1522
|
+
children: /* @__PURE__ */ jsx17("p", { className: "whitespace-pre-wrap break-words leading-relaxed", children: item.text })
|
|
1523
|
+
},
|
|
1524
|
+
item.id ?? `reasoning-${index}`
|
|
1525
|
+
)) });
|
|
1526
|
+
}
|
|
1527
|
+
function ImageBlock({ content }) {
|
|
1528
|
+
const imageUrl = typeof content.image_url === "string" ? content.image_url : typeof content.image_url?.url === "string" ? content.image_url.url : null;
|
|
1529
|
+
if (!imageUrl) {
|
|
1530
|
+
return /* @__PURE__ */ jsxs8(Card, { children: [
|
|
1531
|
+
/* @__PURE__ */ jsx17(CardHeader, { className: "space-y-1", children: /* @__PURE__ */ jsx17(CardTitle, { className: "text-sm", children: "Image" }) }),
|
|
1532
|
+
/* @__PURE__ */ jsx17(CardContent, { className: "text-xs text-muted-foreground", children: safeJson(content) })
|
|
1533
|
+
] });
|
|
1534
|
+
}
|
|
1535
|
+
return /* @__PURE__ */ jsx17("figure", { className: "overflow-hidden rounded-lg border bg-background", children: /* @__PURE__ */ jsx17("img", { src: imageUrl, alt: "Assistant output", className: "h-auto w-full object-cover" }) });
|
|
1536
|
+
}
|
|
1537
|
+
function MemoryBlock({ content }) {
|
|
1538
|
+
return /* @__PURE__ */ jsxs8(Card, { children: [
|
|
1539
|
+
/* @__PURE__ */ jsxs8(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
1540
|
+
/* @__PURE__ */ jsx17(CardTitle, { className: "text-sm", children: "Memory" }),
|
|
1541
|
+
/* @__PURE__ */ jsx17(Badge, { variant: "secondary", children: "Memory" })
|
|
1542
|
+
] }),
|
|
1543
|
+
/* @__PURE__ */ jsx17(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ jsx17("pre", { className: "whitespace-pre-wrap break-words", children: safeJson(content.data ?? []) }) })
|
|
1544
|
+
] });
|
|
1545
|
+
}
|
|
1546
|
+
function ComponentBlock({ content }) {
|
|
1547
|
+
console.log(content);
|
|
1548
|
+
const data = content.data ?? {};
|
|
1549
|
+
const title = typeof data.title === "string" ? data.title : typeof data.type === "string" ? data.type : "Component";
|
|
1550
|
+
const category = typeof data.category === "string" ? data.category : "Component";
|
|
1551
|
+
const status = typeof data.status === "string" ? data.status : null;
|
|
1552
|
+
const message = typeof data.message === "string" ? data.message : null;
|
|
1553
|
+
const output = typeof data.output === "string" ? data.output : null;
|
|
1554
|
+
const fallback = message ?? output ?? safeJson(data.data ?? data.input ?? data);
|
|
1555
|
+
return /* @__PURE__ */ jsxs8(Card, { children: [
|
|
1556
|
+
/* @__PURE__ */ jsxs8(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
1557
|
+
/* @__PURE__ */ jsxs8("div", { className: "space-y-1", children: [
|
|
1558
|
+
/* @__PURE__ */ jsx17(CardTitle, { className: "text-sm", children: title }),
|
|
1559
|
+
/* @__PURE__ */ jsx17("p", { className: "text-xs text-muted-foreground", children: category })
|
|
1560
|
+
] }),
|
|
1561
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1562
|
+
/* @__PURE__ */ jsx17(Badge, { variant: "secondary", children: category }),
|
|
1563
|
+
status && /* @__PURE__ */ jsx17(Badge, { variant: "outline", children: status })
|
|
1564
|
+
] })
|
|
1565
|
+
] }),
|
|
1566
|
+
/* @__PURE__ */ jsx17(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ jsx17("pre", { className: "whitespace-pre-wrap break-words", children: fallback }) })
|
|
1567
|
+
] });
|
|
1568
|
+
}
|
|
1569
|
+
function UnknownBlock({ content }) {
|
|
1570
|
+
return /* @__PURE__ */ jsxs8(Card, { children: [
|
|
1571
|
+
/* @__PURE__ */ jsxs8(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
1572
|
+
/* @__PURE__ */ jsx17(CardTitle, { className: "text-sm", children: "Assistant Content" }),
|
|
1573
|
+
/* @__PURE__ */ jsx17(Badge, { variant: "outline", children: content.type ?? "unknown" })
|
|
1574
|
+
] }),
|
|
1575
|
+
/* @__PURE__ */ jsx17(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ jsx17("pre", { className: "whitespace-pre-wrap break-words", children: safeJson(content) }) })
|
|
1576
|
+
] });
|
|
1577
|
+
}
|
|
1578
|
+
function renderContentItem(content, index, messageId) {
|
|
1579
|
+
if (typeof content === "string") {
|
|
1580
|
+
return /* @__PURE__ */ jsxs8("div", { children: [
|
|
1581
|
+
/* @__PURE__ */ jsx17(MarkdownText, { children: content }),
|
|
1582
|
+
";"
|
|
1583
|
+
] }, `text-${index}`);
|
|
1584
|
+
}
|
|
1585
|
+
if (isTextContent(content)) {
|
|
1586
|
+
return /* @__PURE__ */ jsx17("div", { children: /* @__PURE__ */ jsx17(MarkdownText, { children: content.text }) }, content.id ?? `text-${index}`);
|
|
1587
|
+
}
|
|
1588
|
+
if (isReasoningContent(content)) {
|
|
1589
|
+
return /* @__PURE__ */ jsx17("div", { children: /* @__PURE__ */ jsx17(ReasoningBlock, { reasoning: [content] }) }, content.id ?? `reasoning-${index}`);
|
|
1590
|
+
}
|
|
1591
|
+
if (isImageContent(content)) {
|
|
1592
|
+
return /* @__PURE__ */ jsx17("div", { children: /* @__PURE__ */ jsx17(ImageBlock, { content }) }, content.id ?? `image-${index}`);
|
|
1593
|
+
}
|
|
1594
|
+
if (isComponentContent(content)) {
|
|
1595
|
+
if (isWidgetComponent(content)) {
|
|
1596
|
+
return /* @__PURE__ */ jsx17("div", { children: /* @__PURE__ */ jsx17(WidgetMessage, { messageId, data: content.data }) }, content.id ?? `widget-${index}`);
|
|
1597
|
+
}
|
|
1598
|
+
return /* @__PURE__ */ jsx17("div", { children: /* @__PURE__ */ jsx17(ComponentBlock, { content }) }, content.id ?? `component-${index}`);
|
|
1599
|
+
}
|
|
1600
|
+
if (isMemoryContent(content)) {
|
|
1601
|
+
return /* @__PURE__ */ jsx17("div", { children: /* @__PURE__ */ jsx17(MemoryBlock, { content }) }, content.id ?? `memory-${index}`);
|
|
1602
|
+
}
|
|
1603
|
+
return /* @__PURE__ */ jsx17("div", { children: /* @__PURE__ */ jsx17(UnknownBlock, { content }) }, content.id ?? `unknown-${index}`);
|
|
1604
|
+
}
|
|
1605
|
+
function renderContent(content, messageId) {
|
|
1606
|
+
if (typeof content === "string") {
|
|
1607
|
+
if (!content.trim()) return null;
|
|
1608
|
+
return /* @__PURE__ */ jsx17(MarkdownText, { children: content });
|
|
1609
|
+
}
|
|
1610
|
+
if (!Array.isArray(content) || content.length === 0) return null;
|
|
1611
|
+
return /* @__PURE__ */ jsx17("div", { className: "space-y-3", children: content.map((item, index) => renderContentItem(item, index, messageId)) });
|
|
1612
|
+
}
|
|
1613
|
+
function AssistantMessage({ message, className, isStreaming = false }) {
|
|
1614
|
+
const hasContent = message.content != null && !(typeof message.content === "string" && message.content.trim() === "" || Array.isArray(message.content) && message.content.length === 0);
|
|
1615
|
+
const hasReasoning = Array.isArray(message.reasoning) && message.reasoning.some((item) => item.text?.trim());
|
|
1616
|
+
const answerNode = renderContent(message.content, message.id);
|
|
1617
|
+
const reasoningNode = hasReasoning ? /* @__PURE__ */ jsx17(ReasoningBlock, { reasoning: message.reasoning ?? [] }) : null;
|
|
1618
|
+
if (!hasContent && !hasReasoning) return null;
|
|
1619
|
+
const streamingClass = isStreaming ? "streaming-active" : "";
|
|
1620
|
+
if (hasContent && hasReasoning) {
|
|
1621
|
+
return /* @__PURE__ */ jsx17("div", { className: cn("space-y-3", streamingClass, className), children: /* @__PURE__ */ jsxs8(
|
|
1622
|
+
Tabs,
|
|
1623
|
+
{
|
|
1624
|
+
defaultValue: message.status === "reasoning" ? "reasoning" : "answer",
|
|
1625
|
+
className: "w-full",
|
|
1626
|
+
children: [
|
|
1627
|
+
/* @__PURE__ */ jsxs8(TabsList, { className: "h-9", children: [
|
|
1628
|
+
/* @__PURE__ */ jsx17(TabsTrigger, { value: "answer", children: "Answer" }),
|
|
1629
|
+
/* @__PURE__ */ jsx17(TabsTrigger, { value: "reasoning", children: "Reasoning" })
|
|
1630
|
+
] }),
|
|
1631
|
+
/* @__PURE__ */ jsx17(TabsContent, { value: "answer", className: "space-y-3", children: answerNode }),
|
|
1632
|
+
/* @__PURE__ */ jsx17(TabsContent, { value: "reasoning", className: "space-y-3", children: reasoningNode })
|
|
1633
|
+
]
|
|
1634
|
+
}
|
|
1635
|
+
) });
|
|
1636
|
+
}
|
|
1637
|
+
return /* @__PURE__ */ jsx17("div", { className: cn("space-y-3", streamingClass, className), children: hasReasoning ? reasoningNode : answerNode });
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
// src/components/thread/MessageActions.tsx
|
|
1641
|
+
import * as React14 from "react";
|
|
1642
|
+
import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1643
|
+
function CopyIcon2() {
|
|
1644
|
+
return /* @__PURE__ */ jsxs9(
|
|
1645
|
+
"svg",
|
|
1646
|
+
{
|
|
1647
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1648
|
+
width: "14",
|
|
1649
|
+
height: "14",
|
|
1650
|
+
viewBox: "0 0 24 24",
|
|
1651
|
+
fill: "none",
|
|
1652
|
+
stroke: "currentColor",
|
|
1653
|
+
strokeWidth: "2",
|
|
1654
|
+
strokeLinecap: "round",
|
|
1655
|
+
strokeLinejoin: "round",
|
|
1656
|
+
children: [
|
|
1657
|
+
/* @__PURE__ */ jsx18("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" }),
|
|
1658
|
+
/* @__PURE__ */ jsx18("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })
|
|
1659
|
+
]
|
|
1660
|
+
}
|
|
1661
|
+
);
|
|
1662
|
+
}
|
|
1663
|
+
function CheckIcon2() {
|
|
1664
|
+
return /* @__PURE__ */ jsx18(
|
|
1665
|
+
"svg",
|
|
1666
|
+
{
|
|
1667
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1668
|
+
width: "14",
|
|
1669
|
+
height: "14",
|
|
1670
|
+
viewBox: "0 0 24 24",
|
|
1671
|
+
fill: "none",
|
|
1672
|
+
stroke: "currentColor",
|
|
1673
|
+
strokeWidth: "2",
|
|
1674
|
+
strokeLinecap: "round",
|
|
1675
|
+
strokeLinejoin: "round",
|
|
1676
|
+
children: /* @__PURE__ */ jsx18("path", { d: "M20 6 9 17l-5-5" })
|
|
1677
|
+
}
|
|
1678
|
+
);
|
|
1679
|
+
}
|
|
1680
|
+
function RetryIcon() {
|
|
1681
|
+
return /* @__PURE__ */ jsxs9(
|
|
1682
|
+
"svg",
|
|
1683
|
+
{
|
|
1684
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1685
|
+
width: "14",
|
|
1686
|
+
height: "14",
|
|
1687
|
+
viewBox: "0 0 24 24",
|
|
1688
|
+
fill: "none",
|
|
1689
|
+
stroke: "currentColor",
|
|
1690
|
+
strokeWidth: "2",
|
|
1691
|
+
strokeLinecap: "round",
|
|
1692
|
+
strokeLinejoin: "round",
|
|
1693
|
+
children: [
|
|
1694
|
+
/* @__PURE__ */ jsx18("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
|
|
1695
|
+
/* @__PURE__ */ jsx18("path", { d: "M21 3v5h-5" }),
|
|
1696
|
+
/* @__PURE__ */ jsx18("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }),
|
|
1697
|
+
/* @__PURE__ */ jsx18("path", { d: "M8 16H3v5" })
|
|
1698
|
+
]
|
|
1699
|
+
}
|
|
1700
|
+
);
|
|
1701
|
+
}
|
|
1702
|
+
function MessageActions({
|
|
1703
|
+
content,
|
|
1704
|
+
isAssistant = false,
|
|
1705
|
+
isStreaming = false,
|
|
1706
|
+
onRetry,
|
|
1707
|
+
className
|
|
1708
|
+
}) {
|
|
1709
|
+
const { t } = useChatkitTranslation();
|
|
1710
|
+
const [copied, setCopied] = React14.useState(false);
|
|
1711
|
+
const handleCopy = async () => {
|
|
1712
|
+
try {
|
|
1713
|
+
await navigator.clipboard.writeText(content);
|
|
1714
|
+
setCopied(true);
|
|
1715
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
1716
|
+
} catch (err) {
|
|
1717
|
+
console.error("Failed to copy:", err);
|
|
1718
|
+
}
|
|
1719
|
+
};
|
|
1720
|
+
if (isStreaming) {
|
|
1721
|
+
return null;
|
|
1722
|
+
}
|
|
1723
|
+
return /* @__PURE__ */ jsxs9(
|
|
1724
|
+
"div",
|
|
1725
|
+
{
|
|
1726
|
+
className: cn(
|
|
1727
|
+
"flex items-center gap-1 mt-2 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1728
|
+
className
|
|
1729
|
+
),
|
|
1730
|
+
children: [
|
|
1731
|
+
/* @__PURE__ */ jsx18(
|
|
1732
|
+
"button",
|
|
1733
|
+
{
|
|
1734
|
+
type: "button",
|
|
1735
|
+
onClick: handleCopy,
|
|
1736
|
+
className: cn(
|
|
1737
|
+
"p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",
|
|
1738
|
+
copied && "text-green-500"
|
|
1739
|
+
),
|
|
1740
|
+
title: copied ? t("messageActions.copied") : t("messageActions.copy"),
|
|
1741
|
+
children: copied ? /* @__PURE__ */ jsx18(CheckIcon2, {}) : /* @__PURE__ */ jsx18(CopyIcon2, {})
|
|
1742
|
+
}
|
|
1743
|
+
),
|
|
1744
|
+
isAssistant && onRetry && /* @__PURE__ */ jsx18(
|
|
1745
|
+
"button",
|
|
1746
|
+
{
|
|
1747
|
+
type: "button",
|
|
1748
|
+
onClick: onRetry,
|
|
1749
|
+
className: "p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",
|
|
1750
|
+
title: t("messageActions.regenerate"),
|
|
1751
|
+
children: /* @__PURE__ */ jsx18(RetryIcon, {})
|
|
1752
|
+
}
|
|
1753
|
+
)
|
|
1754
|
+
]
|
|
1755
|
+
}
|
|
1756
|
+
);
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
// src/components/thread/StartScreen.tsx
|
|
1760
|
+
import "react";
|
|
1761
|
+
import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1762
|
+
function getIconComponent2(icon) {
|
|
1763
|
+
const iconMap = {
|
|
1764
|
+
"circle-question": /* @__PURE__ */ jsxs10("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1765
|
+
/* @__PURE__ */ jsx19("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1766
|
+
/* @__PURE__ */ jsx19("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
|
|
1767
|
+
/* @__PURE__ */ jsx19("path", { d: "M12 17h.01" })
|
|
1768
|
+
] }),
|
|
1769
|
+
"lightbulb": /* @__PURE__ */ jsxs10("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1770
|
+
/* @__PURE__ */ jsx19("path", { d: "M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5" }),
|
|
1771
|
+
/* @__PURE__ */ jsx19("path", { d: "M9 18h6" }),
|
|
1772
|
+
/* @__PURE__ */ jsx19("path", { d: "M10 22h4" })
|
|
1773
|
+
] }),
|
|
1774
|
+
"sparkle": /* @__PURE__ */ jsx19("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx19("path", { d: "M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z" }) }),
|
|
1775
|
+
"write": /* @__PURE__ */ jsxs10("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1776
|
+
/* @__PURE__ */ jsx19("path", { d: "M12 20h9" }),
|
|
1777
|
+
/* @__PURE__ */ jsx19("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })
|
|
1778
|
+
] }),
|
|
1779
|
+
"search": /* @__PURE__ */ jsxs10("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1780
|
+
/* @__PURE__ */ jsx19("circle", { cx: "11", cy: "11", r: "8" }),
|
|
1781
|
+
/* @__PURE__ */ jsx19("path", { d: "m21 21-4.3-4.3" })
|
|
1782
|
+
] }),
|
|
1783
|
+
"globe": /* @__PURE__ */ jsxs10("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1784
|
+
/* @__PURE__ */ jsx19("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1785
|
+
/* @__PURE__ */ jsx19("line", { x1: "2", x2: "22", y1: "12", y2: "12" }),
|
|
1786
|
+
/* @__PURE__ */ jsx19("path", { d: "M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z" })
|
|
1787
|
+
] }),
|
|
1788
|
+
"book-open": /* @__PURE__ */ jsxs10("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1789
|
+
/* @__PURE__ */ jsx19("path", { d: "M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z" }),
|
|
1790
|
+
/* @__PURE__ */ jsx19("path", { d: "M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z" })
|
|
1791
|
+
] }),
|
|
1792
|
+
"compass": /* @__PURE__ */ jsxs10("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1793
|
+
/* @__PURE__ */ jsx19("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1794
|
+
/* @__PURE__ */ jsx19("polygon", { points: "16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76" })
|
|
1795
|
+
] }),
|
|
1796
|
+
"bolt": /* @__PURE__ */ jsx19("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx19("path", { d: "M13 2 3 14h9l-1 8 10-12h-9l1-8z" }) })
|
|
1797
|
+
};
|
|
1798
|
+
return icon ? iconMap[icon] || iconMap["sparkle"] : iconMap["sparkle"];
|
|
1799
|
+
}
|
|
1800
|
+
function StartScreen({ startScreen, onPromptClick, className }) {
|
|
1801
|
+
const { t } = useChatkitTranslation();
|
|
1802
|
+
const greeting = startScreen?.greeting ?? t("startScreen.greeting");
|
|
1803
|
+
const prompts = startScreen?.prompts ?? [];
|
|
1804
|
+
return /* @__PURE__ */ jsxs10("div", { className: cn("flex flex-col items-center justify-center py-12 px-4", className), children: [
|
|
1805
|
+
/* @__PURE__ */ jsx19("div", { className: "mb-8 text-center", children: /* @__PURE__ */ jsx19("h2", { className: "text-2xl font-semibold text-foreground mb-2", children: greeting }) }),
|
|
1806
|
+
prompts.length > 0 && /* @__PURE__ */ jsx19("div", { className: "w-full max-w-2xl", children: /* @__PURE__ */ jsx19("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: prompts.map((item, index) => /* @__PURE__ */ jsxs10(
|
|
1807
|
+
"button",
|
|
1808
|
+
{
|
|
1809
|
+
type: "button",
|
|
1810
|
+
onClick: () => onPromptClick?.(item.prompt),
|
|
1811
|
+
className: cn(
|
|
1812
|
+
"flex items-center gap-3 rounded-xl border bg-card p-4 text-left",
|
|
1813
|
+
"hover:bg-muted/50 hover:border-primary/20 transition-colors",
|
|
1814
|
+
"focus:outline-none focus:ring-2 focus:ring-primary/20"
|
|
1815
|
+
),
|
|
1816
|
+
children: [
|
|
1817
|
+
/* @__PURE__ */ jsx19("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: getIconComponent2(item.icon) }),
|
|
1818
|
+
/* @__PURE__ */ jsx19("span", { className: "text-sm font-medium text-foreground", children: item.label })
|
|
1819
|
+
]
|
|
1820
|
+
},
|
|
1821
|
+
`prompt-${index}`
|
|
1822
|
+
)) }) })
|
|
1823
|
+
] });
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
// src/hooks/useThreads.ts
|
|
1827
|
+
import * as React16 from "react";
|
|
1828
|
+
var DEFAULT_LIMIT = 50;
|
|
1829
|
+
var getConversationTitle = (conversation) => {
|
|
1830
|
+
const title = conversation.title?.trim();
|
|
1831
|
+
if (title) return title;
|
|
1832
|
+
initI18n();
|
|
1833
|
+
const suffix = (conversation.id ?? conversation.threadId ?? "").slice(0, 8);
|
|
1834
|
+
return suffix ? i18n.t("history.conversationWithId", { id: suffix }) : i18n.t("history.conversationFallback");
|
|
1835
|
+
};
|
|
1836
|
+
var toDate = (value) => {
|
|
1837
|
+
if (!value) return void 0;
|
|
1838
|
+
const timestamp = Date.parse(value);
|
|
1839
|
+
if (Number.isNaN(timestamp)) return void 0;
|
|
1840
|
+
return new Date(timestamp);
|
|
1841
|
+
};
|
|
1842
|
+
var toConversation = (conversation) => ({
|
|
1843
|
+
id: conversation.id,
|
|
1844
|
+
threadId: conversation.threadId ?? null,
|
|
1845
|
+
title: getConversationTitle(conversation),
|
|
1846
|
+
lastMessageAt: toDate(conversation.updatedAt)
|
|
1847
|
+
});
|
|
1848
|
+
var sortConversations = (conversations) => {
|
|
1849
|
+
return [...conversations].sort((a, b) => {
|
|
1850
|
+
const aTime = Date.parse(a.updatedAt ?? "");
|
|
1851
|
+
const bTime = Date.parse(b.updatedAt ?? "");
|
|
1852
|
+
return (Number.isNaN(bTime) ? 0 : bTime) - (Number.isNaN(aTime) ? 0 : aTime);
|
|
1853
|
+
});
|
|
1854
|
+
};
|
|
1855
|
+
function useThreads(limit = DEFAULT_LIMIT) {
|
|
1856
|
+
const { client, threadId } = useStreamContext();
|
|
1857
|
+
const [conversationsState, setConversationsState] = React16.useState([]);
|
|
1858
|
+
const [isLoading, setIsLoading] = React16.useState(false);
|
|
1859
|
+
const [error, setError] = React16.useState(null);
|
|
1860
|
+
const upsertConversation = React16.useCallback((conversation) => {
|
|
1861
|
+
setConversationsState((prev) => {
|
|
1862
|
+
const next = prev.filter((item) => item.id !== conversation.id);
|
|
1863
|
+
return sortConversations([conversation, ...next]);
|
|
1864
|
+
});
|
|
1865
|
+
}, []);
|
|
1866
|
+
const refreshConversations = React16.useCallback(async () => {
|
|
1867
|
+
setIsLoading(true);
|
|
1868
|
+
setError(null);
|
|
1869
|
+
try {
|
|
1870
|
+
const { items } = await client.conversations.search({
|
|
1871
|
+
limit,
|
|
1872
|
+
order: { updatedAt: "DESC" }
|
|
1873
|
+
});
|
|
1874
|
+
setConversationsState(items ?? []);
|
|
1875
|
+
console.log("Conversations refreshed", items);
|
|
1876
|
+
} catch (err) {
|
|
1877
|
+
setError(err);
|
|
1878
|
+
} finally {
|
|
1879
|
+
setIsLoading(false);
|
|
1880
|
+
}
|
|
1881
|
+
}, [client, limit]);
|
|
1882
|
+
const createConversation = React16.useCallback(
|
|
1883
|
+
async (input) => {
|
|
1884
|
+
setError(null);
|
|
1885
|
+
const payload = {};
|
|
1886
|
+
if (input?.conversationId) payload.id = input.conversationId;
|
|
1887
|
+
if (input?.threadId) payload.threadId = input.threadId;
|
|
1888
|
+
if (input?.title) payload.title = input.title;
|
|
1889
|
+
if (input?.options) payload.options = input.options;
|
|
1890
|
+
const created = await client.conversations.create(payload);
|
|
1891
|
+
upsertConversation(created);
|
|
1892
|
+
return created;
|
|
1893
|
+
},
|
|
1894
|
+
[client, upsertConversation]
|
|
1895
|
+
);
|
|
1896
|
+
const updateConversation = React16.useCallback(
|
|
1897
|
+
async (id, payload) => {
|
|
1898
|
+
setError(null);
|
|
1899
|
+
const updated = await client.conversations.update(id, payload);
|
|
1900
|
+
upsertConversation(updated);
|
|
1901
|
+
return updated;
|
|
1902
|
+
},
|
|
1903
|
+
[client, upsertConversation]
|
|
1904
|
+
);
|
|
1905
|
+
const deleteConversation = React16.useCallback(
|
|
1906
|
+
async (id) => {
|
|
1907
|
+
setError(null);
|
|
1908
|
+
await client.conversations.delete(id);
|
|
1909
|
+
setConversationsState((prev) => prev.filter((item) => item.id !== id));
|
|
1910
|
+
},
|
|
1911
|
+
[client]
|
|
1912
|
+
);
|
|
1913
|
+
React16.useEffect(() => {
|
|
1914
|
+
void refreshConversations();
|
|
1915
|
+
}, [refreshConversations]);
|
|
1916
|
+
React16.useEffect(() => {
|
|
1917
|
+
if (!threadId) return;
|
|
1918
|
+
if (conversationsState.some((item) => item.threadId === threadId)) return;
|
|
1919
|
+
void client.conversations.search({ where: { threadId }, limit: 1 }).then((result) => {
|
|
1920
|
+
const found = result.items?.[0];
|
|
1921
|
+
if (found) upsertConversation(found);
|
|
1922
|
+
}).catch((err) => {
|
|
1923
|
+
setError(err);
|
|
1924
|
+
});
|
|
1925
|
+
}, [client, threadId, conversationsState, upsertConversation]);
|
|
1926
|
+
const conversations = React16.useMemo(
|
|
1927
|
+
() => conversationsState.map((conversation) => toConversation(conversation)),
|
|
1928
|
+
[conversationsState]
|
|
1929
|
+
);
|
|
1930
|
+
return {
|
|
1931
|
+
conversations,
|
|
1932
|
+
rawConversations: conversationsState,
|
|
1933
|
+
isLoading,
|
|
1934
|
+
error,
|
|
1935
|
+
refreshConversations,
|
|
1936
|
+
createConversation,
|
|
1937
|
+
updateConversation,
|
|
1938
|
+
deleteConversation,
|
|
1939
|
+
// Legacy aliases
|
|
1940
|
+
refreshThreads: refreshConversations,
|
|
1941
|
+
createThread: createConversation,
|
|
1942
|
+
updateThreadMetadata: updateConversation,
|
|
1943
|
+
deleteThread: deleteConversation
|
|
1944
|
+
};
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
// src/components/chat.tsx
|
|
1948
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1949
|
+
var defaultApiUrl2 = import.meta.env.VITE_XPERTAI_API_URL;
|
|
1950
|
+
var DEFAULT_HISTORY_LIMIT = 200;
|
|
1951
|
+
function createMessageId() {
|
|
1952
|
+
return globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
1953
|
+
}
|
|
1954
|
+
function formatMessageContent(content) {
|
|
1955
|
+
if (typeof content === "string") {
|
|
1956
|
+
return content;
|
|
1957
|
+
}
|
|
1958
|
+
if (Array.isArray(content)) {
|
|
1959
|
+
return content.map((part) => {
|
|
1960
|
+
if (typeof part === "string") return part;
|
|
1961
|
+
if (part && typeof part === "object" && "text" in part) {
|
|
1962
|
+
const textValue = part.text;
|
|
1963
|
+
return typeof textValue === "string" ? textValue : "";
|
|
1964
|
+
}
|
|
1965
|
+
return "";
|
|
1966
|
+
}).join("");
|
|
1967
|
+
}
|
|
1968
|
+
if (content == null) return "";
|
|
1969
|
+
if (typeof content === "object" && "text" in content) {
|
|
1970
|
+
const textValue = content.text;
|
|
1971
|
+
return typeof textValue === "string" ? textValue : "";
|
|
1972
|
+
}
|
|
1973
|
+
return "";
|
|
1974
|
+
}
|
|
1975
|
+
function normalizeRoleToMessageType(role) {
|
|
1976
|
+
const normalized = (role ?? "").toLowerCase();
|
|
1977
|
+
if (normalized === "user" || normalized === "human") return "human";
|
|
1978
|
+
if (normalized === "assistant" || normalized === "ai") return "ai";
|
|
1979
|
+
if (normalized === "system") return "system";
|
|
1980
|
+
if (normalized === "tool") return "tool";
|
|
1981
|
+
return "ai";
|
|
1982
|
+
}
|
|
1983
|
+
function mapChatMessageToUiMessage(message) {
|
|
1984
|
+
return {
|
|
1985
|
+
id: message.id ?? createMessageId(),
|
|
1986
|
+
type: normalizeRoleToMessageType(message.role),
|
|
1987
|
+
content: message.content ?? "",
|
|
1988
|
+
...message.reasoning ? { reasoning: message.reasoning } : {},
|
|
1989
|
+
...message.executionId ? { executionId: message.executionId } : {}
|
|
1990
|
+
};
|
|
1991
|
+
}
|
|
1992
|
+
function sortMessagesByCreatedAt(items) {
|
|
1993
|
+
return [...items].sort((a, b) => {
|
|
1994
|
+
const aTime = Date.parse(a.createdAt ?? "");
|
|
1995
|
+
const bTime = Date.parse(b.createdAt ?? "");
|
|
1996
|
+
if (Number.isNaN(aTime) && Number.isNaN(bTime)) return 0;
|
|
1997
|
+
if (Number.isNaN(aTime)) return -1;
|
|
1998
|
+
if (Number.isNaN(bTime)) return 1;
|
|
1999
|
+
return aTime - bTime;
|
|
2000
|
+
});
|
|
2001
|
+
}
|
|
2002
|
+
function Chat({
|
|
2003
|
+
className,
|
|
2004
|
+
options,
|
|
2005
|
+
title,
|
|
2006
|
+
placeholder,
|
|
2007
|
+
clientSecret = ""
|
|
2008
|
+
}) {
|
|
2009
|
+
const { t } = useChatkitTranslation();
|
|
2010
|
+
const composer = options?.composer;
|
|
2011
|
+
const startScreen = options?.startScreen;
|
|
2012
|
+
const history = options?.history;
|
|
2013
|
+
const disclaimer = options?.disclaimer;
|
|
2014
|
+
const apiUrl = options?.api?.apiUrl || defaultApiUrl2;
|
|
2015
|
+
const { setStream } = useStreamManager();
|
|
2016
|
+
const stream = useStreamContext();
|
|
2017
|
+
const [activeConversationId, setActiveConversationId] = React17.useState(null);
|
|
2018
|
+
const [isHistoryLoading, setIsHistoryLoading] = React17.useState(false);
|
|
2019
|
+
const [historyError, setHistoryError] = React17.useState(null);
|
|
2020
|
+
const [assistantName, setAssistantName] = React17.useState(null);
|
|
2021
|
+
const LOADING_DOTS_MIN_DURATION = 800;
|
|
2022
|
+
const [showLoadingDots, setShowLoadingDots] = React17.useState(false);
|
|
2023
|
+
const loadingStartTimeRef = React17.useRef(null);
|
|
2024
|
+
React17.useEffect(() => {
|
|
2025
|
+
setStream(stream);
|
|
2026
|
+
}, [setStream, stream]);
|
|
2027
|
+
React17.useEffect(() => {
|
|
2028
|
+
if (stream.isLoading) {
|
|
2029
|
+
if (!loadingStartTimeRef.current) {
|
|
2030
|
+
loadingStartTimeRef.current = Date.now();
|
|
2031
|
+
setShowLoadingDots(true);
|
|
2032
|
+
}
|
|
2033
|
+
} else {
|
|
2034
|
+
if (loadingStartTimeRef.current) {
|
|
2035
|
+
const elapsed = Date.now() - loadingStartTimeRef.current;
|
|
2036
|
+
const remaining = LOADING_DOTS_MIN_DURATION - elapsed;
|
|
2037
|
+
if (remaining > 0) {
|
|
2038
|
+
const timer = setTimeout(() => {
|
|
2039
|
+
setShowLoadingDots(false);
|
|
2040
|
+
loadingStartTimeRef.current = null;
|
|
2041
|
+
}, remaining);
|
|
2042
|
+
return () => clearTimeout(timer);
|
|
2043
|
+
} else {
|
|
2044
|
+
setShowLoadingDots(false);
|
|
2045
|
+
loadingStartTimeRef.current = null;
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
}, [stream.isLoading]);
|
|
2050
|
+
const [draft, setDraft] = React17.useState("");
|
|
2051
|
+
const [selectedTool, setSelectedTool] = React17.useState(null);
|
|
2052
|
+
const [attachments, setAttachments] = React17.useState([]);
|
|
2053
|
+
const {
|
|
2054
|
+
conversations,
|
|
2055
|
+
createConversation,
|
|
2056
|
+
deleteConversation,
|
|
2057
|
+
refreshConversations,
|
|
2058
|
+
isLoading: isThreadsLoading
|
|
2059
|
+
} = useThreads();
|
|
2060
|
+
const scrollAreaRef = React17.useRef(null);
|
|
2061
|
+
const viewportRef = React17.useRef(null);
|
|
2062
|
+
const fileInputRef = React17.useRef(null);
|
|
2063
|
+
const resolvedTitle = title ?? t("chat.title");
|
|
2064
|
+
const resolvedPlaceholder = placeholder ?? t("chat.placeholder");
|
|
2065
|
+
const inputPlaceholder = selectedTool?.placeholderOverride ?? composer?.placeholder ?? resolvedPlaceholder;
|
|
2066
|
+
const messages = stream.messages ?? [];
|
|
2067
|
+
const trimmedDraft = draft.trim();
|
|
2068
|
+
const scrollToBottom = React17.useCallback((smooth = false) => {
|
|
2069
|
+
requestAnimationFrame(() => {
|
|
2070
|
+
const viewport = scrollAreaRef.current?.querySelector("[data-radix-scroll-area-viewport]");
|
|
2071
|
+
if (viewport) {
|
|
2072
|
+
viewport.scrollTo({
|
|
2073
|
+
top: viewport.scrollHeight,
|
|
2074
|
+
behavior: smooth ? "smooth" : "instant"
|
|
2075
|
+
});
|
|
2076
|
+
}
|
|
2077
|
+
});
|
|
2078
|
+
}, []);
|
|
2079
|
+
React17.useEffect(() => {
|
|
2080
|
+
scrollToBottom();
|
|
2081
|
+
}, [messages.length, scrollToBottom]);
|
|
2082
|
+
React17.useEffect(() => {
|
|
2083
|
+
if (stream.isLoading) {
|
|
2084
|
+
scrollToBottom();
|
|
2085
|
+
}
|
|
2086
|
+
}, [stream.isLoading, messages, scrollToBottom]);
|
|
2087
|
+
const hasApiKey = Boolean(clientSecret.trim());
|
|
2088
|
+
const missingConfig = !apiUrl || !hasApiKey;
|
|
2089
|
+
const isSendDisabled = !trimmedDraft || stream.isLoading || missingConfig || isHistoryLoading;
|
|
2090
|
+
React17.useEffect(() => {
|
|
2091
|
+
if (missingConfig) return;
|
|
2092
|
+
void refreshConversations();
|
|
2093
|
+
}, [missingConfig, refreshConversations]);
|
|
2094
|
+
React17.useEffect(() => {
|
|
2095
|
+
if (missingConfig || !stream.client || !stream.assistantId) return;
|
|
2096
|
+
stream.client.assistants.get(stream.assistantId).then((assistant) => {
|
|
2097
|
+
if (assistant?.name) {
|
|
2098
|
+
setAssistantName(assistant.name);
|
|
2099
|
+
}
|
|
2100
|
+
}).catch((err) => {
|
|
2101
|
+
console.warn("[Chat] Failed to load assistant info:", err);
|
|
2102
|
+
});
|
|
2103
|
+
}, [missingConfig, stream.client, stream.assistantId]);
|
|
2104
|
+
const handleSubmit = (event) => {
|
|
2105
|
+
event.preventDefault();
|
|
2106
|
+
if (isSendDisabled) return;
|
|
2107
|
+
const newMessage = {
|
|
2108
|
+
id: createMessageId(),
|
|
2109
|
+
type: "human",
|
|
2110
|
+
content: trimmedDraft
|
|
2111
|
+
};
|
|
2112
|
+
setDraft("");
|
|
2113
|
+
stream.submit(
|
|
2114
|
+
{ input: { input: trimmedDraft } },
|
|
2115
|
+
{
|
|
2116
|
+
optimisticValues: (prev) => {
|
|
2117
|
+
const prevMessages = prev?.messages ?? [];
|
|
2118
|
+
return { ...prev, messages: [...prevMessages, newMessage] };
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
);
|
|
2122
|
+
scrollToBottom(true);
|
|
2123
|
+
if (selectedTool && !selectedTool.pinned) {
|
|
2124
|
+
setSelectedTool(null);
|
|
2125
|
+
}
|
|
2126
|
+
setAttachments([]);
|
|
2127
|
+
};
|
|
2128
|
+
const handleAttachmentClick = () => {
|
|
2129
|
+
fileInputRef.current?.click();
|
|
2130
|
+
};
|
|
2131
|
+
const handleFileChange = (event) => {
|
|
2132
|
+
const files = event.target.files;
|
|
2133
|
+
if (!files || files.length === 0) return;
|
|
2134
|
+
const maxCount = composer?.attachments?.maxCount ?? 10;
|
|
2135
|
+
const maxSize = composer?.attachments?.maxSize ?? 100 * 1024 * 1024;
|
|
2136
|
+
const validFiles = [];
|
|
2137
|
+
for (let i = 0; i < files.length; i++) {
|
|
2138
|
+
const file = files[i];
|
|
2139
|
+
if (file.size > maxSize) {
|
|
2140
|
+
console.warn(`File ${file.name} exceeds max size of ${maxSize} bytes`);
|
|
2141
|
+
continue;
|
|
2142
|
+
}
|
|
2143
|
+
validFiles.push(file);
|
|
2144
|
+
}
|
|
2145
|
+
setAttachments((prev) => {
|
|
2146
|
+
const combined = [...prev, ...validFiles];
|
|
2147
|
+
return combined.slice(0, maxCount);
|
|
2148
|
+
});
|
|
2149
|
+
event.target.value = "";
|
|
2150
|
+
};
|
|
2151
|
+
const handleRemoveAttachment = (index) => {
|
|
2152
|
+
setAttachments((prev) => prev.filter((_, i) => i !== index));
|
|
2153
|
+
};
|
|
2154
|
+
const handleToolSelect = (tool) => {
|
|
2155
|
+
setSelectedTool((prev) => prev?.id === tool.id ? null : tool);
|
|
2156
|
+
};
|
|
2157
|
+
const handlePromptClick = (prompt) => {
|
|
2158
|
+
if (missingConfig || stream.isLoading || isHistoryLoading) return;
|
|
2159
|
+
const newMessage = {
|
|
2160
|
+
id: createMessageId(),
|
|
2161
|
+
type: "human",
|
|
2162
|
+
content: prompt
|
|
2163
|
+
};
|
|
2164
|
+
stream.submit(
|
|
2165
|
+
{ input: { input: prompt } },
|
|
2166
|
+
{
|
|
2167
|
+
optimisticValues: (prev) => {
|
|
2168
|
+
const prevMessages = prev?.messages ?? [];
|
|
2169
|
+
return { ...prev, messages: [...prevMessages, newMessage] };
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
);
|
|
2173
|
+
scrollToBottom(true);
|
|
2174
|
+
};
|
|
2175
|
+
const loadConversationMessages = React17.useCallback(
|
|
2176
|
+
async (conversationId, threadId) => {
|
|
2177
|
+
if (missingConfig) {
|
|
2178
|
+
setHistoryError(t("chat.missingConfigShort"));
|
|
2179
|
+
return;
|
|
2180
|
+
}
|
|
2181
|
+
setHistoryError(null);
|
|
2182
|
+
setIsHistoryLoading(true);
|
|
2183
|
+
try {
|
|
2184
|
+
stream.stop();
|
|
2185
|
+
} catch {
|
|
2186
|
+
}
|
|
2187
|
+
try {
|
|
2188
|
+
const response = await stream.client.conversations.listMessages(conversationId, {
|
|
2189
|
+
limit: DEFAULT_HISTORY_LIMIT,
|
|
2190
|
+
offset: 0
|
|
2191
|
+
});
|
|
2192
|
+
const sorted = sortMessagesByCreatedAt(response.items ?? []);
|
|
2193
|
+
const mapped = sorted.map(mapChatMessageToUiMessage);
|
|
2194
|
+
stream.reset(threadId ?? null, mapped);
|
|
2195
|
+
setActiveConversationId(conversationId);
|
|
2196
|
+
} catch (err) {
|
|
2197
|
+
console.warn("Failed to load conversation messages", err);
|
|
2198
|
+
setHistoryError(
|
|
2199
|
+
err instanceof Error ? err.message : t("chat.errors.loadMessages")
|
|
2200
|
+
);
|
|
2201
|
+
stream.reset(threadId ?? null, []);
|
|
2202
|
+
} finally {
|
|
2203
|
+
setIsHistoryLoading(false);
|
|
2204
|
+
}
|
|
2205
|
+
},
|
|
2206
|
+
[missingConfig, stream, t]
|
|
2207
|
+
);
|
|
2208
|
+
React17.useEffect(() => {
|
|
2209
|
+
if (!stream.threadId) return;
|
|
2210
|
+
if (isHistoryLoading) return;
|
|
2211
|
+
const matched = conversations.find((item) => item.threadId === stream.threadId);
|
|
2212
|
+
if (!matched) return;
|
|
2213
|
+
if (activeConversationId && activeConversationId === matched.id) return;
|
|
2214
|
+
if (messages.length > 0) {
|
|
2215
|
+
setActiveConversationId(matched.id);
|
|
2216
|
+
return;
|
|
2217
|
+
}
|
|
2218
|
+
void loadConversationMessages(matched.id, matched.threadId ?? null);
|
|
2219
|
+
}, [
|
|
2220
|
+
conversations,
|
|
2221
|
+
stream.threadId,
|
|
2222
|
+
messages.length,
|
|
2223
|
+
activeConversationId,
|
|
2224
|
+
isHistoryLoading,
|
|
2225
|
+
loadConversationMessages
|
|
2226
|
+
]);
|
|
2227
|
+
const handleNewConversation = async () => {
|
|
2228
|
+
if (missingConfig || stream.isLoading || isHistoryLoading) return;
|
|
2229
|
+
setHistoryError(null);
|
|
2230
|
+
try {
|
|
2231
|
+
const created = await createConversation({ title: t("history.newConversationTitle") });
|
|
2232
|
+
setActiveConversationId(created.id);
|
|
2233
|
+
stream.reset(created.threadId ?? null, []);
|
|
2234
|
+
await refreshConversations();
|
|
2235
|
+
} catch (err) {
|
|
2236
|
+
console.warn("Failed to create conversation", err);
|
|
2237
|
+
setHistoryError(
|
|
2238
|
+
err instanceof Error ? err.message : t("chat.errors.createConversation")
|
|
2239
|
+
);
|
|
2240
|
+
}
|
|
2241
|
+
};
|
|
2242
|
+
const handleSelectConversation = (id) => {
|
|
2243
|
+
if (isHistoryLoading) return;
|
|
2244
|
+
setHistoryError(null);
|
|
2245
|
+
const conversation = conversations.find((item) => item.id === id);
|
|
2246
|
+
const nextThreadId = conversation?.threadId ?? null;
|
|
2247
|
+
if (id === activeConversationId && stream.threadId === nextThreadId) return;
|
|
2248
|
+
void loadConversationMessages(id, nextThreadId);
|
|
2249
|
+
};
|
|
2250
|
+
const handleDeleteConversation = (id) => {
|
|
2251
|
+
setHistoryError(null);
|
|
2252
|
+
void deleteConversation(id).then(() => {
|
|
2253
|
+
if (activeConversationId === id) {
|
|
2254
|
+
stream.reset(null, []);
|
|
2255
|
+
setActiveConversationId(null);
|
|
2256
|
+
}
|
|
2257
|
+
return refreshConversations();
|
|
2258
|
+
}).catch((err) => {
|
|
2259
|
+
console.warn("Failed to delete conversation", err);
|
|
2260
|
+
setHistoryError(
|
|
2261
|
+
err instanceof Error ? err.message : t("chat.errors.deleteConversation")
|
|
2262
|
+
);
|
|
2263
|
+
});
|
|
2264
|
+
};
|
|
2265
|
+
const handleRetry = (messageIndex) => {
|
|
2266
|
+
const messagesUpToIndex = messages.slice(0, messageIndex);
|
|
2267
|
+
const lastHumanMessage = [...messagesUpToIndex].reverse().find(
|
|
2268
|
+
(m) => String(m.type) === "human"
|
|
2269
|
+
);
|
|
2270
|
+
if (lastHumanMessage && typeof lastHumanMessage.content === "string") {
|
|
2271
|
+
stream.submit(
|
|
2272
|
+
{ input: { input: lastHumanMessage.content } },
|
|
2273
|
+
{
|
|
2274
|
+
optimisticValues: (prev) => {
|
|
2275
|
+
const prevMessages = prev?.messages ?? [];
|
|
2276
|
+
return {
|
|
2277
|
+
...prev,
|
|
2278
|
+
messages: prevMessages.slice(0, messageIndex)
|
|
2279
|
+
};
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
);
|
|
2283
|
+
}
|
|
2284
|
+
};
|
|
2285
|
+
const acceptMimes = composer?.attachments?.accept ? Object.entries(composer.attachments.accept).map(([mime, exts]) => [mime, ...exts.map((e) => `.${e}`)].join(",")).join(",") : void 0;
|
|
2286
|
+
const errorMessage = stream.error instanceof Error ? stream.error.message : void 0;
|
|
2287
|
+
return /* @__PURE__ */ jsxs11(
|
|
2288
|
+
"div",
|
|
2289
|
+
{
|
|
2290
|
+
className: cn(
|
|
2291
|
+
"flex h-full w-full flex-col overflow-hidden bg-background shadow-sm",
|
|
2292
|
+
className
|
|
2293
|
+
),
|
|
2294
|
+
children: [
|
|
2295
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between border-b bg-muted/30 px-6 py-4", children: [
|
|
2296
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-3", children: [
|
|
2297
|
+
/* @__PURE__ */ jsx20("div", { className: "h-2 w-2 rounded-full bg-green-500" }),
|
|
2298
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
2299
|
+
/* @__PURE__ */ jsx20("h2", { className: "text-lg font-semibold", children: assistantName || resolvedTitle }),
|
|
2300
|
+
/* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground", children: t("chat.statusOnline") })
|
|
2301
|
+
] })
|
|
2302
|
+
] }),
|
|
2303
|
+
history?.enabled !== false && /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
|
|
2304
|
+
/* @__PURE__ */ jsx20(
|
|
2305
|
+
"button",
|
|
2306
|
+
{
|
|
2307
|
+
type: "button",
|
|
2308
|
+
onClick: handleNewConversation,
|
|
2309
|
+
disabled: missingConfig || stream.isLoading || isHistoryLoading,
|
|
2310
|
+
className: cn(
|
|
2311
|
+
"flex h-9 w-9 items-center justify-center rounded-md",
|
|
2312
|
+
"text-muted-foreground hover:text-foreground hover:bg-muted",
|
|
2313
|
+
"transition-colors duration-150",
|
|
2314
|
+
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
2315
|
+
),
|
|
2316
|
+
title: t("history.newConversation"),
|
|
2317
|
+
children: /* @__PURE__ */ jsxs11(
|
|
2318
|
+
"svg",
|
|
2319
|
+
{
|
|
2320
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2321
|
+
width: "18",
|
|
2322
|
+
height: "18",
|
|
2323
|
+
viewBox: "0 0 24 24",
|
|
2324
|
+
fill: "none",
|
|
2325
|
+
stroke: "currentColor",
|
|
2326
|
+
strokeWidth: "2",
|
|
2327
|
+
strokeLinecap: "round",
|
|
2328
|
+
strokeLinejoin: "round",
|
|
2329
|
+
children: [
|
|
2330
|
+
/* @__PURE__ */ jsx20("path", { d: "M12 20h9" }),
|
|
2331
|
+
/* @__PURE__ */ jsx20("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })
|
|
2332
|
+
]
|
|
2333
|
+
}
|
|
2334
|
+
)
|
|
2335
|
+
}
|
|
2336
|
+
),
|
|
2337
|
+
/* @__PURE__ */ jsx20(
|
|
2338
|
+
HistorySidebar,
|
|
2339
|
+
{
|
|
2340
|
+
conversations,
|
|
2341
|
+
currentConversationId: activeConversationId ?? void 0,
|
|
2342
|
+
onNewConversation: handleNewConversation,
|
|
2343
|
+
onSelectConversation: handleSelectConversation,
|
|
2344
|
+
onDeleteConversation: handleDeleteConversation,
|
|
2345
|
+
showDelete: history?.showDelete !== false,
|
|
2346
|
+
disabled: missingConfig || stream.isLoading || isThreadsLoading || isHistoryLoading
|
|
2347
|
+
}
|
|
2348
|
+
)
|
|
2349
|
+
] })
|
|
2350
|
+
] }),
|
|
2351
|
+
/* @__PURE__ */ jsx20(ScrollArea, { ref: scrollAreaRef, className: "flex-1", children: /* @__PURE__ */ jsxs11("div", { ref: viewportRef, className: "px-6 py-4", children: [
|
|
2352
|
+
errorMessage && /* @__PURE__ */ jsx20("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: errorMessage }),
|
|
2353
|
+
historyError && /* @__PURE__ */ jsx20("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: historyError }),
|
|
2354
|
+
missingConfig && /* @__PURE__ */ jsx20("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: t("chat.missingConfigDetail") }),
|
|
2355
|
+
isHistoryLoading && /* @__PURE__ */ jsx20("div", { className: "mb-4 rounded-lg border border-muted px-3 py-2 text-sm text-muted-foreground", children: t("chat.loadingConversation") }),
|
|
2356
|
+
messages.length === 0 ? /* @__PURE__ */ jsx20(
|
|
2357
|
+
StartScreen,
|
|
2358
|
+
{
|
|
2359
|
+
startScreen,
|
|
2360
|
+
onPromptClick: handlePromptClick
|
|
2361
|
+
}
|
|
2362
|
+
) : /* @__PURE__ */ jsxs11("div", { className: "space-y-4", children: [
|
|
2363
|
+
messages.map((message, index) => {
|
|
2364
|
+
const messageType = String(message.type);
|
|
2365
|
+
const isAssistantMessage = messageType === "assistant" || messageType === "ai";
|
|
2366
|
+
const messageContent = typeof message.content === "string" ? message.content : Array.isArray(message.content) ? message.content.map((part) => formatMessageContent(part)).join("") : formatMessageContent(message.content);
|
|
2367
|
+
return /* @__PURE__ */ jsx20(
|
|
2368
|
+
"div",
|
|
2369
|
+
{
|
|
2370
|
+
className: cn(
|
|
2371
|
+
"group flex gap-3",
|
|
2372
|
+
message.type === "human" ? "justify-end" : "justify-start -ml-1"
|
|
2373
|
+
// AI messages: slightly closer to left
|
|
2374
|
+
),
|
|
2375
|
+
children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-col", children: [
|
|
2376
|
+
/* @__PURE__ */ jsx20(
|
|
2377
|
+
"div",
|
|
2378
|
+
{
|
|
2379
|
+
className: cn(
|
|
2380
|
+
"max-w-full rounded-2xl",
|
|
2381
|
+
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"
|
|
2382
|
+
// AI messages: use chat-specific foreground color
|
|
2383
|
+
),
|
|
2384
|
+
children: isAssistantMessage ? /* @__PURE__ */ jsx20(
|
|
2385
|
+
AssistantMessage,
|
|
2386
|
+
{
|
|
2387
|
+
message: {
|
|
2388
|
+
...message,
|
|
2389
|
+
type: "assistant"
|
|
2390
|
+
},
|
|
2391
|
+
isStreaming: stream.isLoading && index === messages.length - 1
|
|
2392
|
+
}
|
|
2393
|
+
) : Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ jsx20(
|
|
2394
|
+
"p",
|
|
2395
|
+
{
|
|
2396
|
+
className: "break-words text-sm leading-relaxed",
|
|
2397
|
+
children: formatMessageContent(part)
|
|
2398
|
+
},
|
|
2399
|
+
`${part.type}-${partIndex}`
|
|
2400
|
+
)) : formatMessageContent(message.content)
|
|
2401
|
+
}
|
|
2402
|
+
),
|
|
2403
|
+
/* @__PURE__ */ jsx20(
|
|
2404
|
+
MessageActions,
|
|
2405
|
+
{
|
|
2406
|
+
content: messageContent,
|
|
2407
|
+
isAssistant: isAssistantMessage,
|
|
2408
|
+
isStreaming: stream.isLoading && index === messages.length - 1,
|
|
2409
|
+
onRetry: isAssistantMessage && !stream.isLoading && index === messages.length - 1 ? () => handleRetry(index) : void 0
|
|
2410
|
+
}
|
|
2411
|
+
)
|
|
2412
|
+
] })
|
|
2413
|
+
},
|
|
2414
|
+
message.id ?? `${message.type}-${index}`
|
|
2415
|
+
);
|
|
2416
|
+
}),
|
|
2417
|
+
showLoadingDots && (() => {
|
|
2418
|
+
const lastMessage = messages[messages.length - 1];
|
|
2419
|
+
const lastMessageType = lastMessage ? String(lastMessage.type) : "";
|
|
2420
|
+
const isLastMessageFromAI = lastMessageType === "ai" || lastMessageType === "assistant";
|
|
2421
|
+
const lastMsgContent = lastMessage?.content;
|
|
2422
|
+
const hasSubstantialContent = isLastMessageFromAI && (typeof lastMsgContent === "string" && lastMsgContent.length > 10 || Array.isArray(lastMsgContent) && lastMsgContent.length > 0);
|
|
2423
|
+
if (hasSubstantialContent) return null;
|
|
2424
|
+
return /* @__PURE__ */ jsx20("div", { className: "flex justify-start gap-3 -ml-2", children: /* @__PURE__ */ jsx20("div", { className: "max-w-full rounded-2xl py-2.5", children: /* @__PURE__ */ jsxs11("div", { className: "flex gap-1.5", children: [
|
|
2425
|
+
/* @__PURE__ */ jsx20("div", { className: "h-2 w-2 animate-bounce rounded-full bg-muted-foreground/60 [animation-delay:-0.3s]" }),
|
|
2426
|
+
/* @__PURE__ */ jsx20("div", { className: "h-2 w-2 animate-bounce rounded-full bg-muted-foreground/60 [animation-delay:-0.15s]" }),
|
|
2427
|
+
/* @__PURE__ */ jsx20("div", { className: "h-2 w-2 animate-bounce rounded-full bg-muted-foreground/60" })
|
|
2428
|
+
] }) }) });
|
|
2429
|
+
})()
|
|
2430
|
+
] })
|
|
2431
|
+
] }) }),
|
|
2432
|
+
/* @__PURE__ */ jsxs11("div", { className: "border-t bg-muted/30 p-4", children: [
|
|
2433
|
+
/* @__PURE__ */ jsx20(
|
|
2434
|
+
"input",
|
|
2435
|
+
{
|
|
2436
|
+
ref: fileInputRef,
|
|
2437
|
+
type: "file",
|
|
2438
|
+
multiple: true,
|
|
2439
|
+
accept: acceptMimes,
|
|
2440
|
+
onChange: handleFileChange,
|
|
2441
|
+
className: "hidden"
|
|
2442
|
+
}
|
|
2443
|
+
),
|
|
2444
|
+
attachments.length > 0 && /* @__PURE__ */ jsx20("div", { className: "mb-3 flex flex-wrap gap-2", children: attachments.map((file, index) => /* @__PURE__ */ jsxs11(
|
|
2445
|
+
"div",
|
|
2446
|
+
{
|
|
2447
|
+
className: "flex items-center gap-2 rounded-md bg-muted px-2 py-1 text-sm",
|
|
2448
|
+
children: [
|
|
2449
|
+
/* @__PURE__ */ jsxs11(
|
|
2450
|
+
"svg",
|
|
2451
|
+
{
|
|
2452
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2453
|
+
width: "14",
|
|
2454
|
+
height: "14",
|
|
2455
|
+
viewBox: "0 0 24 24",
|
|
2456
|
+
fill: "none",
|
|
2457
|
+
stroke: "currentColor",
|
|
2458
|
+
strokeWidth: "2",
|
|
2459
|
+
strokeLinecap: "round",
|
|
2460
|
+
strokeLinejoin: "round",
|
|
2461
|
+
className: "text-muted-foreground",
|
|
2462
|
+
children: [
|
|
2463
|
+
/* @__PURE__ */ jsx20("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" }),
|
|
2464
|
+
/* @__PURE__ */ jsx20("polyline", { points: "14 2 14 8 20 8" })
|
|
2465
|
+
]
|
|
2466
|
+
}
|
|
2467
|
+
),
|
|
2468
|
+
/* @__PURE__ */ jsx20("span", { className: "max-w-[120px] truncate", children: file.name }),
|
|
2469
|
+
/* @__PURE__ */ jsx20(
|
|
2470
|
+
"button",
|
|
2471
|
+
{
|
|
2472
|
+
type: "button",
|
|
2473
|
+
onClick: () => handleRemoveAttachment(index),
|
|
2474
|
+
className: "ml-1 rounded-full p-0.5 hover:bg-muted-foreground/20",
|
|
2475
|
+
children: /* @__PURE__ */ jsx20(
|
|
2476
|
+
"svg",
|
|
2477
|
+
{
|
|
2478
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2479
|
+
width: "12",
|
|
2480
|
+
height: "12",
|
|
2481
|
+
viewBox: "0 0 24 24",
|
|
2482
|
+
fill: "none",
|
|
2483
|
+
stroke: "currentColor",
|
|
2484
|
+
strokeWidth: "2",
|
|
2485
|
+
strokeLinecap: "round",
|
|
2486
|
+
strokeLinejoin: "round",
|
|
2487
|
+
children: /* @__PURE__ */ jsx20("path", { d: "M18 6 6 18M6 6l12 12" })
|
|
2488
|
+
}
|
|
2489
|
+
)
|
|
2490
|
+
}
|
|
2491
|
+
)
|
|
2492
|
+
]
|
|
2493
|
+
},
|
|
2494
|
+
`${file.name}-${index}`
|
|
2495
|
+
)) }),
|
|
2496
|
+
selectedTool && /* @__PURE__ */ jsxs11("div", { className: "mb-2 flex items-center gap-2", children: [
|
|
2497
|
+
/* @__PURE__ */ jsx20("span", { className: "rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary", children: selectedTool.shortLabel ?? selectedTool.label }),
|
|
2498
|
+
/* @__PURE__ */ jsx20(
|
|
2499
|
+
"button",
|
|
2500
|
+
{
|
|
2501
|
+
type: "button",
|
|
2502
|
+
onClick: () => setSelectedTool(null),
|
|
2503
|
+
className: "rounded-full p-0.5 text-muted-foreground hover:bg-muted",
|
|
2504
|
+
children: /* @__PURE__ */ jsx20(
|
|
2505
|
+
"svg",
|
|
2506
|
+
{
|
|
2507
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2508
|
+
width: "12",
|
|
2509
|
+
height: "12",
|
|
2510
|
+
viewBox: "0 0 24 24",
|
|
2511
|
+
fill: "none",
|
|
2512
|
+
stroke: "currentColor",
|
|
2513
|
+
strokeWidth: "2",
|
|
2514
|
+
strokeLinecap: "round",
|
|
2515
|
+
strokeLinejoin: "round",
|
|
2516
|
+
children: /* @__PURE__ */ jsx20("path", { d: "M18 6 6 18M6 6l12 12" })
|
|
2517
|
+
}
|
|
2518
|
+
)
|
|
2519
|
+
}
|
|
2520
|
+
)
|
|
2521
|
+
] }),
|
|
2522
|
+
/* @__PURE__ */ jsx20("form", { className: "flex items-center", onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs11(
|
|
2523
|
+
"div",
|
|
2524
|
+
{
|
|
2525
|
+
className: cn(
|
|
2526
|
+
"flex flex-1 items-center gap-1 rounded-full",
|
|
2527
|
+
"bg-background border border-border shadow-sm",
|
|
2528
|
+
"pl-1.5 pr-1.5 py-1",
|
|
2529
|
+
"focus-within:border-muted-foreground/30 focus-within:shadow-md",
|
|
2530
|
+
"transition-shadow duration-200"
|
|
2531
|
+
),
|
|
2532
|
+
children: [
|
|
2533
|
+
/* @__PURE__ */ jsx20(
|
|
2534
|
+
ComposerMenu,
|
|
2535
|
+
{
|
|
2536
|
+
composer,
|
|
2537
|
+
onAttachmentClick: handleAttachmentClick,
|
|
2538
|
+
onToolSelect: handleToolSelect,
|
|
2539
|
+
selectedTool,
|
|
2540
|
+
disabled: stream.isLoading || missingConfig || isHistoryLoading
|
|
2541
|
+
}
|
|
2542
|
+
),
|
|
2543
|
+
/* @__PURE__ */ jsx20(
|
|
2544
|
+
"input",
|
|
2545
|
+
{
|
|
2546
|
+
type: "text",
|
|
2547
|
+
value: draft,
|
|
2548
|
+
onChange: (event) => setDraft(event.target.value),
|
|
2549
|
+
placeholder: inputPlaceholder,
|
|
2550
|
+
disabled: stream.isLoading || missingConfig || isHistoryLoading,
|
|
2551
|
+
className: cn(
|
|
2552
|
+
"flex-1 bg-transparent text-sm text-foreground outline-none px-2",
|
|
2553
|
+
"placeholder:text-muted-foreground",
|
|
2554
|
+
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
2555
|
+
),
|
|
2556
|
+
autoComplete: "off"
|
|
2557
|
+
}
|
|
2558
|
+
),
|
|
2559
|
+
/* @__PURE__ */ jsx20(
|
|
2560
|
+
SendButton,
|
|
2561
|
+
{
|
|
2562
|
+
disabled: isSendDisabled,
|
|
2563
|
+
isLoading: stream.isLoading,
|
|
2564
|
+
onStop: () => stream.stop(),
|
|
2565
|
+
stopLabel: t("chat.stop"),
|
|
2566
|
+
sendLabel: t("chat.send")
|
|
2567
|
+
}
|
|
2568
|
+
)
|
|
2569
|
+
]
|
|
2570
|
+
}
|
|
2571
|
+
) }),
|
|
2572
|
+
disclaimer?.text && /* @__PURE__ */ jsx20(
|
|
2573
|
+
"p",
|
|
2574
|
+
{
|
|
2575
|
+
className: cn(
|
|
2576
|
+
"mt-2 text-center text-xs",
|
|
2577
|
+
disclaimer.highContrast ? "text-foreground" : "text-muted-foreground"
|
|
2578
|
+
),
|
|
2579
|
+
children: disclaimer.text
|
|
2580
|
+
}
|
|
2581
|
+
),
|
|
2582
|
+
/* @__PURE__ */ jsx20("p", { className: "mt-2 text-center text-xs text-muted-foreground", children: t("chat.poweredBy") })
|
|
2583
|
+
] })
|
|
2584
|
+
]
|
|
2585
|
+
}
|
|
2586
|
+
);
|
|
2587
|
+
}
|
|
2588
|
+
|
|
2589
|
+
// src/components/ui/input.tsx
|
|
2590
|
+
import * as React18 from "react";
|
|
2591
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
2592
|
+
var Input = React18.forwardRef(
|
|
2593
|
+
({ className, type, ...props }, ref) => {
|
|
2594
|
+
return /* @__PURE__ */ jsx21(
|
|
2595
|
+
"input",
|
|
2596
|
+
{
|
|
2597
|
+
ref,
|
|
2598
|
+
type,
|
|
2599
|
+
className: cn(
|
|
2600
|
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
2601
|
+
className
|
|
2602
|
+
),
|
|
2603
|
+
...props
|
|
2604
|
+
}
|
|
2605
|
+
);
|
|
2606
|
+
}
|
|
2607
|
+
);
|
|
2608
|
+
Input.displayName = "Input";
|
|
2609
|
+
|
|
2610
|
+
// src/components/ui/avatar.tsx
|
|
2611
|
+
import * as React19 from "react";
|
|
2612
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
2613
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
2614
|
+
var Avatar = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx22(
|
|
2615
|
+
AvatarPrimitive.Root,
|
|
2616
|
+
{
|
|
2617
|
+
ref,
|
|
2618
|
+
className: cn(
|
|
2619
|
+
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
|
|
2620
|
+
className
|
|
2621
|
+
),
|
|
2622
|
+
...props
|
|
2623
|
+
}
|
|
2624
|
+
));
|
|
2625
|
+
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
2626
|
+
var AvatarImage = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx22(
|
|
2627
|
+
AvatarPrimitive.Image,
|
|
2628
|
+
{
|
|
2629
|
+
ref,
|
|
2630
|
+
className: cn("aspect-square h-full w-full", className),
|
|
2631
|
+
...props
|
|
2632
|
+
}
|
|
2633
|
+
));
|
|
2634
|
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
2635
|
+
var AvatarFallback = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx22(
|
|
2636
|
+
AvatarPrimitive.Fallback,
|
|
2637
|
+
{
|
|
2638
|
+
ref,
|
|
2639
|
+
className: cn(
|
|
2640
|
+
"flex h-full w-full items-center justify-center rounded-full bg-muted",
|
|
2641
|
+
className
|
|
2642
|
+
),
|
|
2643
|
+
...props
|
|
2644
|
+
}
|
|
2645
|
+
));
|
|
2646
|
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
2647
|
+
|
|
2648
|
+
// src/components/ui/separator.tsx
|
|
2649
|
+
import * as React20 from "react";
|
|
2650
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
2651
|
+
var Separator = React20.forwardRef(
|
|
2652
|
+
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ jsx23(
|
|
2653
|
+
"div",
|
|
2654
|
+
{
|
|
2655
|
+
ref,
|
|
2656
|
+
role: "separator",
|
|
2657
|
+
"aria-orientation": orientation,
|
|
2658
|
+
className: cn(
|
|
2659
|
+
"shrink-0 bg-border",
|
|
2660
|
+
orientation === "horizontal" ? "h-px w-full" : "h-full w-px",
|
|
2661
|
+
className
|
|
2662
|
+
),
|
|
2663
|
+
...props
|
|
2664
|
+
}
|
|
2665
|
+
)
|
|
2666
|
+
);
|
|
2667
|
+
Separator.displayName = "Separator";
|
|
2668
|
+
export {
|
|
2669
|
+
Avatar,
|
|
2670
|
+
AvatarFallback,
|
|
2671
|
+
AvatarImage,
|
|
2672
|
+
Badge,
|
|
2673
|
+
Button,
|
|
2674
|
+
Card,
|
|
2675
|
+
CardAction,
|
|
2676
|
+
CardContent,
|
|
2677
|
+
CardDescription,
|
|
2678
|
+
CardFooter,
|
|
2679
|
+
CardHeader,
|
|
2680
|
+
CardTitle,
|
|
2681
|
+
Chat,
|
|
2682
|
+
Input,
|
|
2683
|
+
ScrollArea,
|
|
2684
|
+
ScrollBar,
|
|
2685
|
+
Separator,
|
|
2686
|
+
Tabs,
|
|
2687
|
+
TabsContent,
|
|
2688
|
+
TabsList,
|
|
2689
|
+
TabsTrigger,
|
|
2690
|
+
supportedLocales as chatkitSupportedLocales,
|
|
2691
|
+
getLanguage as getChatkitLanguage,
|
|
2692
|
+
setLanguage as setChatkitLanguage,
|
|
2693
|
+
useParentMessenger
|
|
2694
|
+
};
|