@xpert-ai/chatkit-ui 0.1.0 → 0.1.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/dist/app/assets/_baseUniq-Cjg58ynO.js +1 -0
- package/dist/app/assets/abap-CaHNU3KZ.js +1 -0
- package/dist/app/assets/abnf-D-YMXYdM.js +1 -0
- package/dist/app/assets/actionscript-CrHB5nA4.js +1 -0
- package/dist/app/assets/ada-Dv2nikaa.js +1 -0
- package/dist/app/assets/agda-DFaAW7Yp.js +1 -0
- package/dist/app/assets/al-CgiCJJan.js +1 -0
- package/dist/app/assets/antlr4-BtYcfzHN.js +1 -0
- package/dist/app/assets/apacheconf-CQ7_TaHr.js +1 -0
- package/dist/app/assets/apex-B4zhZGbX.js +1 -0
- package/dist/app/assets/apl-CYl9UMD4.js +1 -0
- package/dist/app/assets/applescript-CqOg5uaM.js +1 -0
- package/dist/app/assets/aql-g4FQmCtN.js +1 -0
- package/dist/app/assets/arc-Dg9GdpOd.js +1 -0
- package/dist/app/assets/architectureDiagram-Q4EWVU46-D_Hf6A9k.js +36 -0
- package/dist/app/assets/arduino-CLAoEDGh.js +1 -0
- package/dist/app/assets/arff-CkPQOMpJ.js +1 -0
- package/dist/app/assets/asciidoc-D6FBYhU4.js +1 -0
- package/dist/app/assets/asm6502-BNREQutf.js +1 -0
- package/dist/app/assets/asmatmel-AsGe04C5.js +1 -0
- package/dist/app/assets/aspnet-BowT6uwS.js +1 -0
- package/dist/app/assets/autohotkey-CYQjpY2v.js +1 -0
- package/dist/app/assets/autoit-DZuwPYYs.js +1 -0
- package/dist/app/assets/avisynth-BApmLDkf.js +1 -0
- package/dist/app/assets/avro-idl-DTdqv6Sr.js +1 -0
- package/dist/app/assets/{basic-B4YxRCle.js → bash-COtf9s5e.js} +1 -1
- package/dist/app/assets/basic-0Wk0Z9hh.js +1 -0
- package/dist/app/assets/batch-yLGV74r2.js +1 -0
- package/dist/app/assets/bbcode-gj0k8ZdD.js +1 -0
- package/dist/app/assets/bicep-BsCXg-ZU.js +1 -0
- package/dist/app/assets/birb-CrVXepVH.js +1 -0
- package/dist/app/assets/bison-CEkN9m61.js +1 -0
- package/dist/app/assets/blockDiagram-DXYQGD6D-Cxg7TJzM.js +132 -0
- package/dist/app/assets/bnf-BNo5FkNz.js +1 -0
- package/dist/app/assets/brainfuck-Be3VzThb.js +1 -0
- package/dist/app/assets/brightscript-DvlnFSog.js +1 -0
- package/dist/app/assets/bro-v-4Gv7xz.js +1 -0
- package/dist/app/assets/bsl-Ckf08F6h.js +1 -0
- package/dist/app/assets/c-DzIU03a7.js +1 -0
- package/dist/app/assets/c4Diagram-AHTNJAMY-ClK737fG.js +10 -0
- package/dist/app/assets/cfscript-BjMiAM6E.js +1 -0
- package/dist/app/assets/chaiscript-B43Wj-Sh.js +1 -0
- package/dist/app/assets/channel-SVZNtrjN.js +1 -0
- package/dist/app/assets/chunk-4BX2VUAB-CLpouVUP.js +1 -0
- package/dist/app/assets/chunk-4TB4RGXK-Bx935_8R.js +206 -0
- package/dist/app/assets/chunk-55IACEB6-BBvPym8v.js +1 -0
- package/dist/app/assets/chunk-EDXVE4YY-DjPOkQ8M.js +1 -0
- package/dist/app/assets/chunk-FMBD7UC4-DYYB_Z9z.js +15 -0
- package/dist/app/assets/chunk-OYMX7WX6-D6RNfja3.js +231 -0
- package/dist/app/assets/chunk-QZHKN3VN-C8ZgdC9O.js +1 -0
- package/dist/app/assets/chunk-YZCP3GAM-BBgDUOse.js +1 -0
- package/dist/app/assets/cil-B9ihzdF2.js +1 -0
- package/dist/app/assets/classDiagram-6PBFFD2Q-BiMmE_Ro.js +1 -0
- package/dist/app/assets/classDiagram-v2-HSJHXN6E-BiMmE_Ro.js +1 -0
- package/dist/app/assets/clike-CJh4oCgy.js +1 -0
- package/dist/app/assets/clojure-TlSbaE4l.js +1 -0
- package/dist/app/assets/clone-E2Stvins.js +1 -0
- package/dist/app/assets/cmake-BSn84SxA.js +1 -0
- package/dist/app/assets/cobol-CJ6-cTtI.js +1 -0
- package/dist/app/assets/coffeescript-stKJEoMv.js +1 -0
- package/dist/app/assets/concurnas-1ifwVnR3.js +1 -0
- package/dist/app/assets/coq-DVFU6UV7.js +1 -0
- package/dist/app/assets/core-Yh44uZBs.js +1 -0
- package/dist/app/assets/cose-bilkent-S5V4N54A-Dx7-_QHb.js +1 -0
- package/dist/app/assets/cpp-Zzzi5FD8.js +1 -0
- package/dist/app/assets/crystal-DDbZAA_E.js +1 -0
- package/dist/app/assets/csharp-BZcvKq6n.js +1 -0
- package/dist/app/assets/cshtml-9x1DpGIK.js +1 -0
- package/dist/app/assets/csp-D1hHVDgG.js +1 -0
- package/dist/app/assets/css-BFu7Iqqk.js +1 -0
- package/dist/app/assets/css-extras-COx1Ei_l.js +1 -0
- package/dist/app/assets/csv-D0CxHXjS.js +1 -0
- package/dist/app/assets/cypher-BsuAyRBu.js +1 -0
- package/dist/app/assets/cytoscape.esm-DkOyvmE4.js +321 -0
- package/dist/app/assets/d-CtjOdpDZ.js +1 -0
- package/dist/app/assets/dagre-KV5264BT-DjhJCF-B.js +4 -0
- package/dist/app/assets/dart-BN9c8RLX.js +1 -0
- package/dist/app/assets/dataweave-DzlUCFjQ.js +1 -0
- package/dist/app/assets/dax-D0KU-54t.js +1 -0
- package/dist/app/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/dist/app/assets/dhall-BZJS2G5U.js +1 -0
- package/dist/app/assets/diagram-5BDNPKRD-DSws8TSr.js +10 -0
- package/dist/app/assets/diagram-G4DWMVQ6-Cx7BBH89.js +24 -0
- package/dist/app/assets/diagram-MMDJMWI5-D9n-fpq5.js +43 -0
- package/dist/app/assets/diagram-TYMM5635-A2Du0da2.js +24 -0
- package/dist/app/assets/diff-2klWb1Uo.js +3 -0
- package/dist/app/assets/django-B2AbqJYz.js +1 -0
- package/dist/app/assets/dns-zone-file-CvZSGx-4.js +1 -0
- package/dist/app/assets/docker-Cn7U_QhX.js +1 -0
- package/dist/app/assets/dot-B8xtegaK.js +1 -0
- package/dist/app/assets/ebnf-oe3GchaY.js +1 -0
- package/dist/app/assets/editorconfig-BcXP_CBv.js +1 -0
- package/dist/app/assets/eiffel-2H-hw0_M.js +1 -0
- package/dist/app/assets/ejs-Ba0Dl3hs.js +1 -0
- package/dist/app/assets/elixir-Zqex1hfd.js +1 -0
- package/dist/app/assets/elm-BaLOxH54.js +1 -0
- package/dist/app/assets/erDiagram-SMLLAGMA-lphP26u7.js +85 -0
- package/dist/app/assets/erb-D4zKB7vm.js +1 -0
- package/dist/app/assets/erlang-hK3qlNLz.js +1 -0
- package/dist/app/assets/etlua-DmORWQ6o.js +1 -0
- package/dist/app/assets/excel-formula-Dyve7tHx.js +1 -0
- package/dist/app/assets/factor-aKN6m8fH.js +1 -0
- package/dist/app/assets/false-CIRDgfm3.js +1 -0
- package/dist/app/assets/firestore-security-rules-D8Ht8z5e.js +1 -0
- package/dist/app/assets/flow-CoMa0rFO.js +1 -0
- package/dist/app/assets/flowDiagram-DWJPFMVM-BLg6doOr.js +162 -0
- package/dist/app/assets/fortran-CN_uZJ_i.js +1 -0
- package/dist/app/assets/fsharp-C9nE9g7s.js +1 -0
- package/dist/app/assets/ftl-DvqhmJFJ.js +1 -0
- package/dist/app/assets/ganttDiagram-T4ZO3ILL-20MMEZeq.js +292 -0
- package/dist/app/assets/gap-ChJ4bKbS.js +1 -0
- package/dist/app/assets/gcode-D6-Q_Sls.js +1 -0
- package/dist/app/assets/gdscript-uy9Z57J0.js +1 -0
- package/dist/app/assets/gedcom-DKejVBFQ.js +1 -0
- package/dist/app/assets/gherkin-D309wbrl.js +1 -0
- package/dist/app/assets/git-CXyU-4Kx.js +1 -0
- package/dist/app/assets/gitGraphDiagram-UUTBAWPF-CdbhEKk_.js +106 -0
- package/dist/app/assets/glsl-CUHcECEi.js +1 -0
- package/dist/app/assets/gml-BYJwp8Mq.js +1 -0
- package/dist/app/assets/gn-C5jDEgl-.js +1 -0
- package/dist/app/assets/go-4DBR4Ukq.js +1 -0
- package/dist/app/assets/go-module-BDCY5HMb.js +1 -0
- package/dist/app/assets/graph-CasqcucB.js +1 -0
- package/dist/app/assets/graphql-CUOhePaJ.js +1 -0
- package/dist/app/assets/groovy-C6NRtaMF.js +1 -0
- package/dist/app/assets/haml-CeFDFdq_.js +1 -0
- package/dist/app/assets/handlebars-Diav69MK.js +1 -0
- package/dist/app/assets/haskell-BRtS7ZYk.js +1 -0
- package/dist/app/assets/haxe-okolorzn.js +1 -0
- package/dist/app/assets/hcl-DUovHBmz.js +1 -0
- package/dist/app/assets/hlsl-Est_RcA2.js +1 -0
- package/dist/app/assets/hoon-BiOVdLrI.js +1 -0
- package/dist/app/assets/hpkp-Bm0WuAFk.js +1 -0
- package/dist/app/assets/hsts-CbOaMMM4.js +1 -0
- package/dist/app/assets/http-D0tGKTH_.js +1 -0
- package/dist/app/assets/ichigojam-WTyjHjN0.js +1 -0
- package/dist/app/assets/icon-Bcw6nO7C.js +1 -0
- package/dist/app/assets/icu-message-format-1IVITSOw.js +1 -0
- package/dist/app/assets/idris-DGiKWxqv.js +1 -0
- package/dist/app/assets/iecst-_G6fk-6o.js +1 -0
- package/dist/app/assets/ignore-CGGRjy1I.js +1 -0
- package/dist/app/assets/index-BnLZxiSt.js +747 -0
- package/dist/app/assets/index-D58ynlvg.css +1 -0
- package/dist/app/assets/infoDiagram-42DDH7IO-DNXFcEYI.js +2 -0
- package/dist/app/assets/inform7-DJNO-7Vs.js +1 -0
- package/dist/app/assets/ini-BXxeA4dZ.js +1 -0
- package/dist/app/assets/init-Gi6I4Gst.js +1 -0
- package/dist/app/assets/io-CZYqA1fa.js +1 -0
- package/dist/app/assets/ishikawaDiagram-UXIWVN3A-1FFzVMOS.js +70 -0
- package/dist/app/assets/j-CLXGTuej.js +1 -0
- package/dist/app/assets/java-DgCJQY9_.js +1 -0
- package/dist/app/assets/javadoc-rf7ABQVy.js +1 -0
- package/dist/app/assets/javadoclike-BhPYSoi1.js +1 -0
- package/dist/app/assets/javascript-DOESY9kn.js +1 -0
- package/dist/app/assets/javastacktrace-B40tpYFc.js +1 -0
- package/dist/app/assets/jexl-CVSwBfWj.js +1 -0
- package/dist/app/assets/jolie-CuMdzw00.js +1 -0
- package/dist/app/assets/journeyDiagram-VCZTEJTY-DCh9QB_1.js +139 -0
- package/dist/app/assets/jq-rSPG4wjz.js +1 -0
- package/dist/app/assets/js-extras-DtC7d85t.js +1 -0
- package/dist/app/assets/js-templates-BkzRtF3M.js +1 -0
- package/dist/app/assets/jsdoc-CdEDtKIx.js +1 -0
- package/dist/app/assets/json-DFUISOXb.js +1 -0
- package/dist/app/assets/json5-DDXB8kVt.js +1 -0
- package/dist/app/assets/jsonp-B6KceYOu.js +1 -0
- package/dist/app/assets/jsstacktrace-BmLmkRns.js +1 -0
- package/dist/app/assets/jsx-tZerg2PH.js +1 -0
- package/dist/app/assets/julia-Bc1WscpO.js +1 -0
- package/dist/app/assets/kanban-definition-6JOO6SKY-BG2AO71l.js +89 -0
- package/dist/app/assets/keepalived-C-VxfNGq.js +1 -0
- package/dist/app/assets/keyman-EjQIu4mX.js +1 -0
- package/dist/app/assets/kotlin-CQALgAA5.js +1 -0
- package/dist/app/assets/kumir-7Nk84McD.js +1 -0
- package/dist/app/assets/kusto-DaP91ut7.js +1 -0
- package/dist/app/assets/latex-DjQNRo9H.js +1 -0
- package/dist/app/assets/latte-5JEuNRoR.js +1 -0
- package/dist/app/assets/layout-FVsf45l9.js +1 -0
- package/dist/app/assets/less-8yUOsL09.js +1 -0
- package/dist/app/assets/lilypond-COsmQkBk.js +1 -0
- package/dist/app/assets/linear-C_63YKi4.js +1 -0
- package/dist/app/assets/liquid--Ji9gJSD.js +1 -0
- package/dist/app/assets/lisp-DuUkFEfd.js +1 -0
- package/dist/app/assets/livescript-Cs6PchSa.js +1 -0
- package/dist/app/assets/llvm-COqWFLYS.js +1 -0
- package/dist/app/assets/log-C8QHMZzv.js +1 -0
- package/dist/app/assets/lolcode-BIsqHJ6H.js +1 -0
- package/dist/app/assets/{java-DvhwWZfy.js → lua-Ds7uGUxB.js} +1 -1
- package/dist/app/assets/magma-DLHoFFMW.js +1 -0
- package/dist/app/assets/makefile-CW_5azpn.js +1 -0
- package/dist/app/assets/markdown-wU5DnlD5.js +1 -0
- package/dist/app/assets/markup-BjK1nSyh.js +1 -0
- package/dist/app/assets/markup-templating-CfGV0lcD.js +1 -0
- package/dist/app/assets/matlab-Bs2eP0LD.js +1 -0
- package/dist/app/assets/maxscript-D8jwXiPi.js +1 -0
- package/dist/app/assets/mel-Cmbsj11e.js +1 -0
- package/dist/app/assets/mermaid-C-cxdm_P.js +1 -0
- package/dist/app/assets/min-BctQ8xDj.js +1 -0
- package/dist/app/assets/mindmap-definition-QFDTVHPH-DHcgEjW6.js +96 -0
- package/dist/app/assets/mizar-Ca1dbNOh.js +1 -0
- package/dist/app/assets/mongodb-BocaDOlW.js +1 -0
- package/dist/app/assets/monkey-BLhpedmj.js +1 -0
- package/dist/app/assets/moonscript-CElpz-Ug.js +1 -0
- package/dist/app/assets/n1ql-CwNqjlWA.js +1 -0
- package/dist/app/assets/n4js-B1i6cZX9.js +1 -0
- package/dist/app/assets/nand2tetris-hdl-DO01eHXa.js +1 -0
- package/dist/app/assets/naniscript-C86I87cR.js +1 -0
- package/dist/app/assets/nasm-X9SuO04-.js +1 -0
- package/dist/app/assets/neon-Cb3VrB_2.js +1 -0
- package/dist/app/assets/nevod-BiEf92s6.js +1 -0
- package/dist/app/assets/nginx-CUAldmyK.js +1 -0
- package/dist/app/assets/nim-CicsGaXu.js +1 -0
- package/dist/app/assets/nix-CqX4i_yR.js +1 -0
- package/dist/app/assets/nsis-TyCoq1Up.js +1 -0
- package/dist/app/assets/objectivec-COzECw8M.js +1 -0
- package/dist/app/assets/ocaml-CouJ1SZ_.js +1 -0
- package/dist/app/assets/opencl-BNCeQsDQ.js +1 -0
- package/dist/app/assets/openqasm-DX-rtDDv.js +1 -0
- package/dist/app/assets/ordinal-Cboi1Yqb.js +1 -0
- package/dist/app/assets/oz-CAFaEfY9.js +1 -0
- package/dist/app/assets/parigp-DTj7bCjF.js +1 -0
- package/dist/app/assets/parser-Dw8xYjDE.js +1 -0
- package/dist/app/assets/pascal-rnwnKrYC.js +1 -0
- package/dist/app/assets/pascaligo-x1XdfDyr.js +1 -0
- package/dist/app/assets/pcaxis-2ZAgxxTO.js +1 -0
- package/dist/app/assets/peoplecode-pTltM-sq.js +1 -0
- package/dist/app/assets/perl-CdAlw2Ho.js +1 -0
- package/dist/app/assets/php-C2mFD2oC.js +1 -0
- package/dist/app/assets/php-extras-D7Zt-ImZ.js +1 -0
- package/dist/app/assets/phpdoc-C1kmfh9i.js +1 -0
- package/dist/app/assets/pieDiagram-DEJITSTG-B_eQU9Uk.js +30 -0
- package/dist/app/assets/plsql-Im5gOG9c.js +1 -0
- package/dist/app/assets/powerquery-poq2eyPm.js +1 -0
- package/dist/app/assets/powershell-DJ56nmEi.js +1 -0
- package/dist/app/assets/processing-Bn-H7mMf.js +1 -0
- package/dist/app/assets/prolog-BCb-6dWU.js +1 -0
- package/dist/app/assets/promql-CtbjoMKF.js +1 -0
- package/dist/app/assets/properties-CU4TDD4l.js +1 -0
- package/dist/app/assets/protobuf-_Q2Yj86k.js +1 -0
- package/dist/app/assets/psl-DqN21NC_.js +1 -0
- package/dist/app/assets/pug-DAgKMecD.js +1 -0
- package/dist/app/assets/puppet-Cc2ljXH1.js +1 -0
- package/dist/app/assets/pure-B0x_E1bn.js +1 -0
- package/dist/app/assets/purebasic-DcsxzNqC.js +1 -0
- package/dist/app/assets/purescript-Cc11iskN.js +1 -0
- package/dist/app/assets/q-SRKQXeFP.js +1 -0
- package/dist/app/assets/qml-COWYdH0A.js +1 -0
- package/dist/app/assets/qore-AdoWA6sw.js +1 -0
- package/dist/app/assets/qsharp-k5lgGfSV.js +1 -0
- package/dist/app/assets/quadrantDiagram-34T5L4WZ-U_BUH870.js +7 -0
- package/dist/app/assets/r-Bmcjr3EC.js +1 -0
- package/dist/app/assets/racket-506ZDFuM.js +1 -0
- package/dist/app/assets/reason-BngsaqkW.js +1 -0
- package/dist/app/assets/regex-BC6jlFZr.js +1 -0
- package/dist/app/assets/rego-BYCQ91X3.js +1 -0
- package/dist/app/assets/renpy-D95h89N9.js +1 -0
- package/dist/app/assets/requirementDiagram-MS252O5E-CWAV9Lki.js +84 -0
- package/dist/app/assets/rest-DiYuUdld.js +1 -0
- package/dist/app/assets/rip-B1Ip8kd2.js +1 -0
- package/dist/app/assets/roboconf-DHaw-Q3G.js +1 -0
- package/dist/app/assets/robotframework-HN9oBCJd.js +1 -0
- package/dist/app/assets/ruby-C42HzAMc.js +1 -0
- package/dist/app/assets/rust-DJdUDgl0.js +1 -0
- package/dist/app/assets/sankeyDiagram-XADWPNL6-DzoDqMzU.js +10 -0
- package/dist/app/assets/sas-EmHkISJg.js +1 -0
- package/dist/app/assets/sass-BEWMjvc2.js +1 -0
- package/dist/app/assets/scala-Y9l-QmB_.js +1 -0
- package/dist/app/assets/scheme-oQH0YeM4.js +1 -0
- package/dist/app/assets/scss-DDqkkzfA.js +1 -0
- package/dist/app/assets/sequenceDiagram-FGHM5R23-BRWyyuf5.js +157 -0
- package/dist/app/assets/shell-session-DUtkYnuZ.js +1 -0
- package/dist/app/assets/smali-CQN_R6JD.js +1 -0
- package/dist/app/assets/smalltalk-C5vveBjr.js +1 -0
- package/dist/app/assets/smarty-BF9avlDB.js +1 -0
- package/dist/app/assets/sml-C_smEF_i.js +1 -0
- package/dist/app/assets/solidity-CsmKUFUp.js +1 -0
- package/dist/app/assets/solution-file-5OHlEmXf.js +1 -0
- package/dist/app/assets/soy-DHS0rtw_.js +1 -0
- package/dist/app/assets/sparql-BxBq3H35.js +1 -0
- package/dist/app/assets/splunk-spl-C8VgtuYE.js +1 -0
- package/dist/app/assets/sqf-hSDek24H.js +1 -0
- package/dist/app/assets/sql-DYgxUZFA.js +1 -0
- package/dist/app/assets/squirrel-C7uGEJgW.js +1 -0
- package/dist/app/assets/stan-CGYqPG3F.js +1 -0
- package/dist/app/assets/stateDiagram-FHFEXIEX-Dj_QL8hp.js +1 -0
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-BJgU_5Se.js +1 -0
- package/dist/app/assets/stylus-BCrv-hm1.js +1 -0
- package/dist/app/assets/swift-3XnbN5uB.js +1 -0
- package/dist/app/assets/systemd-DzUq_PeH.js +2 -0
- package/dist/app/assets/t4-cs-DaXmHhdA.js +1 -0
- package/dist/app/assets/t4-templating-C1pqdj2v.js +1 -0
- package/dist/app/assets/t4-vb-4wqP1_sy.js +1 -0
- package/dist/app/assets/tap-FHe0A6pH.js +1 -0
- package/dist/app/assets/tcl-DlumdfOH.js +1 -0
- package/dist/app/assets/textile-BmxrCmib.js +1 -0
- package/dist/app/assets/timeline-definition-GMOUNBTQ-BcI-XOle.js +120 -0
- package/dist/app/assets/toml-BngAbTT7.js +1 -0
- package/dist/app/assets/tremor-BoVxotcN.js +1 -0
- package/dist/app/assets/tt2-BoBfCiJa.js +1 -0
- package/dist/app/assets/turtle-CJfK17BD.js +1 -0
- package/dist/app/assets/twig-BoM58FfM.js +1 -0
- package/dist/app/assets/typescript-BU7mQ9Me.js +1 -0
- package/dist/app/assets/typoscript-BQMBCyle.js +1 -0
- package/dist/app/assets/unrealscript-Bly1rszO.js +1 -0
- package/dist/app/assets/uorazor-AR6v804j.js +1 -0
- package/dist/app/assets/uri-DQN5AlR9.js +1 -0
- package/dist/app/assets/v-CzlNjPFF.js +1 -0
- package/dist/app/assets/vala-D4j-TYUj.js +1 -0
- package/dist/app/assets/{turtle-BtZWKoZ_.js → vbnet-BO_zrLTA.js} +1 -1
- package/dist/app/assets/velocity-D14EQjuJ.js +1 -0
- package/dist/app/assets/vennDiagram-DHZGUBPP-Ct-BJj4e.js +34 -0
- package/dist/app/assets/verilog-8HBCyzJW.js +1 -0
- package/dist/app/assets/vhdl-CABoGFHh.js +1 -0
- package/dist/app/assets/vim-BqejDUiH.js +1 -0
- package/dist/app/assets/visual-basic-BBFqe9IH.js +1 -0
- package/dist/app/assets/wardley-RL74JXVD-DF76BHVV.js +162 -0
- package/dist/app/assets/wardleyDiagram-NUSXRM2D-tb9-DpEL.js +20 -0
- package/dist/app/assets/warpscript-D8JsH2aH.js +1 -0
- package/dist/app/assets/wasm-usuPS3UI.js +1 -0
- package/dist/app/assets/web-idl-CtjhIrn5.js +1 -0
- package/dist/app/assets/wiki-nE7oYJAm.js +1 -0
- package/dist/app/assets/wolfram-BpCCg-Fp.js +1 -0
- package/dist/app/assets/wren-Dtkpodh6.js +1 -0
- package/dist/app/assets/xeora-BpTlDPdY.js +1 -0
- package/dist/app/assets/xml-doc-CcDifcyn.js +1 -0
- package/dist/app/assets/xojo-O-0SvFwZ.js +1 -0
- package/dist/app/assets/xquery-UAB2jKQB.js +1 -0
- package/dist/app/assets/xychartDiagram-5P7HB3ND-d6FXhzUl.js +7 -0
- package/dist/app/assets/yaml-eCAjf2lJ.js +1 -0
- package/dist/app/assets/yang-BkCZ0omw.js +1 -0
- package/dist/app/assets/zig-DEIPVEHz.js +1 -0
- package/dist/app/index.html +2 -2
- package/dist/index.cjs +1623 -555
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1643 -552
- package/package.json +6 -2
- package/dist/app/assets/abap-DMqO-Um8.js +0 -1
- package/dist/app/assets/abnf-CBYpoE1H.js +0 -1
- package/dist/app/assets/actionscript-ieE-wJMz.js +0 -1
- package/dist/app/assets/ada-0-3Dx7g-.js +0 -1
- package/dist/app/assets/agda-uvq9b4Kv.js +0 -1
- package/dist/app/assets/al-BmajJCAx.js +0 -1
- package/dist/app/assets/antlr4-DnRRgAfR.js +0 -1
- package/dist/app/assets/apacheconf-BWoRK3Q3.js +0 -1
- package/dist/app/assets/apex-u3cbevj3.js +0 -1
- package/dist/app/assets/apl-Cifc7IZj.js +0 -1
- package/dist/app/assets/applescript-CpHbiQqz.js +0 -1
- package/dist/app/assets/aql-C_VCCvUl.js +0 -1
- package/dist/app/assets/arduino-CSAc4iDr.js +0 -1
- package/dist/app/assets/arff-B8hSQDyJ.js +0 -1
- package/dist/app/assets/asciidoc-Guc1Uqnw.js +0 -1
- package/dist/app/assets/asm6502-CxPqNdV6.js +0 -1
- package/dist/app/assets/asmatmel-C76CHB5e.js +0 -1
- package/dist/app/assets/aspnet-BQFc33QF.js +0 -1
- package/dist/app/assets/autohotkey-uQeN2mix.js +0 -1
- package/dist/app/assets/autoit-Bmy0PsAQ.js +0 -1
- package/dist/app/assets/avisynth-BvuIlb62.js +0 -1
- package/dist/app/assets/avro-idl-DWeVWQR3.js +0 -1
- package/dist/app/assets/bash-HypWaeXO.js +0 -1
- package/dist/app/assets/batch-B1yKhArW.js +0 -1
- package/dist/app/assets/bbcode-BIDNxh7c.js +0 -1
- package/dist/app/assets/bicep-DkupOIs7.js +0 -1
- package/dist/app/assets/birb-Jo6NYQYX.js +0 -1
- package/dist/app/assets/bison-BjPiLxuX.js +0 -1
- package/dist/app/assets/bnf-BjygHCSE.js +0 -1
- package/dist/app/assets/brainfuck-CsnLnGPx.js +0 -1
- package/dist/app/assets/brightscript-CwmmyoHc.js +0 -1
- package/dist/app/assets/bro-BNKXu22N.js +0 -1
- package/dist/app/assets/bsl-DOwsbsXU.js +0 -1
- package/dist/app/assets/c-DyedRTs7.js +0 -1
- package/dist/app/assets/cfscript-DCpmh-J_.js +0 -1
- package/dist/app/assets/chaiscript-DRaisf-4.js +0 -1
- package/dist/app/assets/cil-C5bobqND.js +0 -1
- package/dist/app/assets/clike-CvmXR497.js +0 -1
- package/dist/app/assets/clojure-BH_u6xTK.js +0 -1
- package/dist/app/assets/cmake-CZruZSdT.js +0 -1
- package/dist/app/assets/cobol-qc5xAkcg.js +0 -1
- package/dist/app/assets/coffeescript-DGM4CLoq.js +0 -1
- package/dist/app/assets/concurnas-DFyZRxPp.js +0 -1
- package/dist/app/assets/coq-DbZe2f_H.js +0 -1
- package/dist/app/assets/core-BWUnDrKt.js +0 -1
- package/dist/app/assets/cpp-CidpRyAJ.js +0 -1
- package/dist/app/assets/crystal-DZE9-h5D.js +0 -1
- package/dist/app/assets/csharp-Cf2K5CJJ.js +0 -1
- package/dist/app/assets/cshtml-DRjf7C5F.js +0 -1
- package/dist/app/assets/csp-dEoRcP0N.js +0 -1
- package/dist/app/assets/css-BWUfAyau.js +0 -1
- package/dist/app/assets/css-extras-pPY_Crez.js +0 -1
- package/dist/app/assets/csv-DdkqZn4I.js +0 -1
- package/dist/app/assets/cypher-BXQbix41.js +0 -1
- package/dist/app/assets/d-BctgRQp0.js +0 -1
- package/dist/app/assets/dart-DuiikcDB.js +0 -1
- package/dist/app/assets/dataweave-ClZ_D-Ju.js +0 -1
- package/dist/app/assets/dax-DXNfCTH9.js +0 -1
- package/dist/app/assets/dhall-Cbz5hfMr.js +0 -1
- package/dist/app/assets/diff-bify6WLh.js +0 -3
- package/dist/app/assets/django-5DdvW3LZ.js +0 -1
- package/dist/app/assets/dns-zone-file-DIIW7lsW.js +0 -1
- package/dist/app/assets/docker-BxIMVoJD.js +0 -1
- package/dist/app/assets/dot-DLEHPnum.js +0 -1
- package/dist/app/assets/ebnf-DHWaG3pk.js +0 -1
- package/dist/app/assets/editorconfig-D2gTUSqU.js +0 -1
- package/dist/app/assets/eiffel-C3dcM2dq.js +0 -1
- package/dist/app/assets/ejs-0qd3jtKi.js +0 -1
- package/dist/app/assets/elixir-BbBaHIGe.js +0 -1
- package/dist/app/assets/elm-KJmeOU7e.js +0 -1
- package/dist/app/assets/erb-BncgAY0M.js +0 -1
- package/dist/app/assets/erlang-DS2SHYdK.js +0 -1
- package/dist/app/assets/etlua-CvdrPEPO.js +0 -1
- package/dist/app/assets/excel-formula-BSj1zROW.js +0 -1
- package/dist/app/assets/factor-DAbcpTN7.js +0 -1
- package/dist/app/assets/false-CI895JmG.js +0 -1
- package/dist/app/assets/firestore-security-rules-CJ33YIQv.js +0 -1
- package/dist/app/assets/flow-a2eNz08o.js +0 -1
- package/dist/app/assets/fortran-Bt9e6qJa.js +0 -1
- package/dist/app/assets/fsharp-Y0Qf2U16.js +0 -1
- package/dist/app/assets/ftl-D-TrqPet.js +0 -1
- package/dist/app/assets/gap-CP5bMoJx.js +0 -1
- package/dist/app/assets/gcode-DQNcGCou.js +0 -1
- package/dist/app/assets/gdscript-Bxt6W-z5.js +0 -1
- package/dist/app/assets/gedcom-Cqgp4wkt.js +0 -1
- package/dist/app/assets/gherkin-D7pNUe8Z.js +0 -1
- package/dist/app/assets/git-C4ec-8cM.js +0 -1
- package/dist/app/assets/glsl-8sVKxech.js +0 -1
- package/dist/app/assets/gml-TuwFoFK6.js +0 -1
- package/dist/app/assets/gn-BwHrmBhU.js +0 -1
- package/dist/app/assets/go-module-cqolzX_W.js +0 -1
- package/dist/app/assets/go-vGJJNlGP.js +0 -1
- package/dist/app/assets/graphql-Do6Lisgl.js +0 -1
- package/dist/app/assets/groovy--87wZh42.js +0 -1
- package/dist/app/assets/haml-vhodueeI.js +0 -1
- package/dist/app/assets/handlebars-CNLRaZ5R.js +0 -1
- package/dist/app/assets/haskell-BWTsCqP4.js +0 -1
- package/dist/app/assets/haxe-CSb0SWYW.js +0 -1
- package/dist/app/assets/hcl-ftOASTH-.js +0 -1
- package/dist/app/assets/hlsl-BnaGHwDi.js +0 -1
- package/dist/app/assets/hoon-wyj1oNzn.js +0 -1
- package/dist/app/assets/hpkp-Broim0YQ.js +0 -1
- package/dist/app/assets/hsts-BSMt-Rhs.js +0 -1
- package/dist/app/assets/http-yK1zPe9M.js +0 -1
- package/dist/app/assets/ichigojam-Bpzuxs1S.js +0 -1
- package/dist/app/assets/icon-DjPW0ImK.js +0 -1
- package/dist/app/assets/icu-message-format-CTS86FWW.js +0 -1
- package/dist/app/assets/idris-DkPie8bu.js +0 -1
- package/dist/app/assets/iecst-CG1KmB8U.js +0 -1
- package/dist/app/assets/ignore-D9eho3CQ.js +0 -1
- package/dist/app/assets/index-4J46qBCc.js +0 -445
- package/dist/app/assets/index-DTn9OjqV.css +0 -1
- package/dist/app/assets/inform7-DD1mc6Wh.js +0 -1
- package/dist/app/assets/ini-Db6U4nBT.js +0 -1
- package/dist/app/assets/io-BRkH6hzB.js +0 -1
- package/dist/app/assets/j-CD22iLrA.js +0 -1
- package/dist/app/assets/javadoc-Ecoxhe_9.js +0 -1
- package/dist/app/assets/javadoclike-Realhpv4.js +0 -1
- package/dist/app/assets/javascript-BBd1k8wl.js +0 -1
- package/dist/app/assets/javastacktrace-C8QW0vuU.js +0 -1
- package/dist/app/assets/jexl-CT2UXrnH.js +0 -1
- package/dist/app/assets/jolie-qtyDXXST.js +0 -1
- package/dist/app/assets/jq-CNJQULTZ.js +0 -1
- package/dist/app/assets/js-extras-DwIZLd4T.js +0 -1
- package/dist/app/assets/js-templates-glA_Un9b.js +0 -1
- package/dist/app/assets/jsdoc-BsXlBBjy.js +0 -1
- package/dist/app/assets/json-BC3xmMOU.js +0 -1
- package/dist/app/assets/json5-CiePGcB9.js +0 -1
- package/dist/app/assets/jsonp-B9HJmhak.js +0 -1
- package/dist/app/assets/jsstacktrace-3xS0eyZd.js +0 -1
- package/dist/app/assets/jsx-B5kMqxBm.js +0 -1
- package/dist/app/assets/julia-B5Udq0EY.js +0 -1
- package/dist/app/assets/keepalived-CI0hMS1b.js +0 -1
- package/dist/app/assets/keyman-BCtXwe5i.js +0 -1
- package/dist/app/assets/kotlin-B3l0V1Fn.js +0 -1
- package/dist/app/assets/kumir-BmC_PBOp.js +0 -1
- package/dist/app/assets/kusto-B0p1ppsT.js +0 -1
- package/dist/app/assets/latex-CHwNDYz_.js +0 -1
- package/dist/app/assets/latte-DihAtCCl.js +0 -1
- package/dist/app/assets/less-BLGkFSp1.js +0 -1
- package/dist/app/assets/lilypond-CCsAc8Nl.js +0 -1
- package/dist/app/assets/liquid-jBSQx5I5.js +0 -1
- package/dist/app/assets/lisp-CgzQXnYE.js +0 -1
- package/dist/app/assets/livescript-u96H-zdx.js +0 -1
- package/dist/app/assets/llvm-WmVcvcNM.js +0 -1
- package/dist/app/assets/log-990P-Rch.js +0 -1
- package/dist/app/assets/lolcode-DdFIjfxs.js +0 -1
- package/dist/app/assets/lua-GkhnMu0T.js +0 -1
- package/dist/app/assets/magma-wajb6K9F.js +0 -1
- package/dist/app/assets/makefile-CGHjuGaS.js +0 -1
- package/dist/app/assets/markdown-BFWQ31vs.js +0 -1
- package/dist/app/assets/markup-1ihI0X17.js +0 -1
- package/dist/app/assets/markup-templating-DblqKZLi.js +0 -1
- package/dist/app/assets/matlab-CPqo7ZUC.js +0 -1
- package/dist/app/assets/maxscript-CTgVjA7o.js +0 -1
- package/dist/app/assets/mel-Cxah6vYr.js +0 -1
- package/dist/app/assets/mermaid-BAgJSsZ7.js +0 -1
- package/dist/app/assets/mizar-BL3spn8_.js +0 -1
- package/dist/app/assets/mongodb-DXzP7tR0.js +0 -1
- package/dist/app/assets/monkey-anPtBsfj.js +0 -1
- package/dist/app/assets/moonscript-Y_tcmLfW.js +0 -1
- package/dist/app/assets/n1ql-B7NGFYRY.js +0 -1
- package/dist/app/assets/n4js-zh8URwWB.js +0 -1
- package/dist/app/assets/nand2tetris-hdl-CDUtzUHw.js +0 -1
- package/dist/app/assets/naniscript-CjJGU6C6.js +0 -1
- package/dist/app/assets/nasm-D6biC9Vr.js +0 -1
- package/dist/app/assets/neon-C3Z0pCuH.js +0 -1
- package/dist/app/assets/nevod-BT4Ivkzb.js +0 -1
- package/dist/app/assets/nginx-vHHTRs1B.js +0 -1
- package/dist/app/assets/nim-Jk1NOWk0.js +0 -1
- package/dist/app/assets/nix-CEkA_w3B.js +0 -1
- package/dist/app/assets/nsis-Du9w_Qb8.js +0 -1
- package/dist/app/assets/objectivec-BciYUGRR.js +0 -1
- package/dist/app/assets/ocaml-CpZ_M4DP.js +0 -1
- package/dist/app/assets/opencl-C-4M-Mvx.js +0 -1
- package/dist/app/assets/openqasm-CilZXlSe.js +0 -1
- package/dist/app/assets/oz-DluYJ10T.js +0 -1
- package/dist/app/assets/parigp-BlIaVN51.js +0 -1
- package/dist/app/assets/parser-BZVTYRp4.js +0 -1
- package/dist/app/assets/pascal-CMz_wkC0.js +0 -1
- package/dist/app/assets/pascaligo-DLQY1QwY.js +0 -1
- package/dist/app/assets/pcaxis-C-5nzMDp.js +0 -1
- package/dist/app/assets/peoplecode-BhTicHl8.js +0 -1
- package/dist/app/assets/perl-BArlZZ8M.js +0 -1
- package/dist/app/assets/php-C6zNUOf5.js +0 -1
- package/dist/app/assets/php-extras-DD5Glhrz.js +0 -1
- package/dist/app/assets/phpdoc-Buj0qa-9.js +0 -1
- package/dist/app/assets/plsql-o2-C-Ezr.js +0 -1
- package/dist/app/assets/powerquery-Cl0Dbp57.js +0 -1
- package/dist/app/assets/powershell-BVFtl1FS.js +0 -1
- package/dist/app/assets/processing-BHJTqgxZ.js +0 -1
- package/dist/app/assets/prolog-C9gykhtA.js +0 -1
- package/dist/app/assets/promql-TzYBDR1F.js +0 -1
- package/dist/app/assets/properties-Bi8GxxCM.js +0 -1
- package/dist/app/assets/protobuf-s08U24Jk.js +0 -1
- package/dist/app/assets/psl-By228u9L.js +0 -1
- package/dist/app/assets/pug-CahxgaMR.js +0 -1
- package/dist/app/assets/puppet-BAY6TBQY.js +0 -1
- package/dist/app/assets/pure-IA8ihD9R.js +0 -1
- package/dist/app/assets/purebasic-B6joY-ZH.js +0 -1
- package/dist/app/assets/purescript-DczXEj8E.js +0 -1
- package/dist/app/assets/q-CEXq_tpX.js +0 -1
- package/dist/app/assets/qml-ND31CBLa.js +0 -1
- package/dist/app/assets/qore-DAjVLL2F.js +0 -1
- package/dist/app/assets/qsharp-jccBvH6Y.js +0 -1
- package/dist/app/assets/r-pv5Xhvsd.js +0 -1
- package/dist/app/assets/racket-xRigDwdL.js +0 -1
- package/dist/app/assets/reason-DnAP7dec.js +0 -1
- package/dist/app/assets/regex-Dwkma1bN.js +0 -1
- package/dist/app/assets/rego-3dHPz-ut.js +0 -1
- package/dist/app/assets/renpy-Czxc7hu0.js +0 -1
- package/dist/app/assets/rest-BP_JQ_AG.js +0 -1
- package/dist/app/assets/rip-Nredd5kD.js +0 -1
- package/dist/app/assets/roboconf-CkR4ACer.js +0 -1
- package/dist/app/assets/robotframework-CYYV7JaP.js +0 -1
- package/dist/app/assets/ruby-EA_sSyU6.js +0 -1
- package/dist/app/assets/rust-BM2hEYJt.js +0 -1
- package/dist/app/assets/sas-jaxOWx-0.js +0 -1
- package/dist/app/assets/sass-pkiTdYnF.js +0 -1
- package/dist/app/assets/scala-lTsQiijh.js +0 -1
- package/dist/app/assets/scheme-DkPZYA1o.js +0 -1
- package/dist/app/assets/scss-DZjxUgqE.js +0 -1
- package/dist/app/assets/shell-session-CKXJ0a90.js +0 -1
- package/dist/app/assets/smali-DVWpHHAX.js +0 -1
- package/dist/app/assets/smalltalk-ChiRh9QF.js +0 -1
- package/dist/app/assets/smarty-C4i7AVoC.js +0 -1
- package/dist/app/assets/sml-v9dKzil3.js +0 -1
- package/dist/app/assets/solidity-DaxM8K8t.js +0 -1
- package/dist/app/assets/solution-file-Ch7ajMI6.js +0 -1
- package/dist/app/assets/soy-CHeWJZPl.js +0 -1
- package/dist/app/assets/sparql-f56EhPSR.js +0 -1
- package/dist/app/assets/splunk-spl-CNX2IshN.js +0 -1
- package/dist/app/assets/sqf-B9Z5kTgF.js +0 -1
- package/dist/app/assets/sql-PZTLdUd4.js +0 -1
- package/dist/app/assets/squirrel-_QTHEJtD.js +0 -1
- package/dist/app/assets/stan-y02QaMQQ.js +0 -1
- package/dist/app/assets/stylus-CGYq1GKp.js +0 -1
- package/dist/app/assets/swift-BBMLpv3H.js +0 -1
- package/dist/app/assets/systemd-CD7Dfv8Y.js +0 -2
- package/dist/app/assets/t4-cs-BtxQixNP.js +0 -1
- package/dist/app/assets/t4-templating-BX2jWZwS.js +0 -1
- package/dist/app/assets/t4-vb-CX3AQUVf.js +0 -1
- package/dist/app/assets/tap-BRBB20R0.js +0 -1
- package/dist/app/assets/tcl-CWrqc_vL.js +0 -1
- package/dist/app/assets/textile-EJMS8IJv.js +0 -1
- package/dist/app/assets/toml-DLWr0_Sd.js +0 -1
- package/dist/app/assets/tremor-D0DGH64h.js +0 -1
- package/dist/app/assets/tt2-CaSD1IpZ.js +0 -1
- package/dist/app/assets/twig-BQ0AWwu3.js +0 -1
- package/dist/app/assets/typescript-sByRs_H7.js +0 -1
- package/dist/app/assets/typoscript-Bs3x5DVu.js +0 -1
- package/dist/app/assets/unrealscript-BPk-JGuX.js +0 -1
- package/dist/app/assets/uorazor-Dxr1B729.js +0 -1
- package/dist/app/assets/uri-B18d7fGy.js +0 -1
- package/dist/app/assets/v-B-4se_c_.js +0 -1
- package/dist/app/assets/vala-CZJMpckw.js +0 -1
- package/dist/app/assets/vbnet-Bon1nLZm.js +0 -1
- package/dist/app/assets/velocity-Ck8gHF4B.js +0 -1
- package/dist/app/assets/verilog-zADKtd-6.js +0 -1
- package/dist/app/assets/vhdl-Ce3jhJNh.js +0 -1
- package/dist/app/assets/vim-CwgyIdo-.js +0 -1
- package/dist/app/assets/visual-basic-BWQC7pBF.js +0 -1
- package/dist/app/assets/warpscript-CVp7w3zz.js +0 -1
- package/dist/app/assets/wasm-yPowz3sM.js +0 -1
- package/dist/app/assets/web-idl-BkghLEob.js +0 -1
- package/dist/app/assets/wiki-TBH4TnLK.js +0 -1
- package/dist/app/assets/wolfram-BmgF1AlB.js +0 -1
- package/dist/app/assets/wren-CJ8nrMy_.js +0 -1
- package/dist/app/assets/xeora-N6_5XQpC.js +0 -1
- package/dist/app/assets/xml-doc-GBGxTNFc.js +0 -1
- package/dist/app/assets/xojo-CmpAfzYO.js +0 -1
- package/dist/app/assets/xquery-BA22D3yp.js +0 -1
- package/dist/app/assets/yaml-CDGmAMpu.js +0 -1
- package/dist/app/assets/yang-rFKIXOjI.js +0 -1
- package/dist/app/assets/zig-rH4Tzjve.js +0 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// src/components/chat.tsx
|
|
2
|
-
import * as
|
|
2
|
+
import * as React23 from "react";
|
|
3
3
|
import {
|
|
4
4
|
ArrowDown,
|
|
5
5
|
FileText as FileText2,
|
|
6
|
-
|
|
6
|
+
ImageIcon,
|
|
7
|
+
Loader2 as Loader23,
|
|
7
8
|
Pencil as Pencil3,
|
|
8
9
|
Quote,
|
|
9
10
|
RefreshCw as RefreshCw2,
|
|
10
|
-
X as
|
|
11
|
+
X as X3
|
|
11
12
|
} from "lucide-react";
|
|
12
13
|
|
|
13
14
|
// src/lib/utils.ts
|
|
@@ -247,6 +248,9 @@ function isObjectLike(value) {
|
|
|
247
248
|
function isNonEmptyString(value) {
|
|
248
249
|
return typeof value === "string" && value.trim().length > 0;
|
|
249
250
|
}
|
|
251
|
+
function isOptionalString(value) {
|
|
252
|
+
return value === void 0 || typeof value === "string";
|
|
253
|
+
}
|
|
250
254
|
function toOptionalString(value) {
|
|
251
255
|
return isNonEmptyString(value) ? value.trim() : void 0;
|
|
252
256
|
}
|
|
@@ -259,42 +263,90 @@ function toLineNumber(value) {
|
|
|
259
263
|
}
|
|
260
264
|
return null;
|
|
261
265
|
}
|
|
262
|
-
function
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
const
|
|
267
|
-
if (!
|
|
268
|
-
return
|
|
266
|
+
function isOptionalNumber(value) {
|
|
267
|
+
return value === void 0 || Number.isFinite(value);
|
|
268
|
+
}
|
|
269
|
+
function toOptionalNumber(value, options) {
|
|
270
|
+
const allowZero = options?.allowZero ?? false;
|
|
271
|
+
if (!Number.isFinite(value)) {
|
|
272
|
+
return void 0;
|
|
273
|
+
}
|
|
274
|
+
const numberValue = value;
|
|
275
|
+
if (numberValue > 0 || allowZero && numberValue === 0) {
|
|
276
|
+
return numberValue;
|
|
277
|
+
}
|
|
278
|
+
return void 0;
|
|
279
|
+
}
|
|
280
|
+
function hasImageReferenceLocator(candidate) {
|
|
281
|
+
return isNonEmptyString(candidate.fileId) || isNonEmptyString(candidate.url) || isNonEmptyString(candidate.name) || isNonEmptyString(candidate.label) || isNonEmptyString(candidate.text);
|
|
282
|
+
}
|
|
283
|
+
function isCodeReferenceCandidate(value) {
|
|
284
|
+
if (!isObjectLike(value)) {
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
287
|
+
const candidate = value;
|
|
288
|
+
return isNonEmptyString(candidate.path) && toLineNumber(candidate.startLine) !== null && toLineNumber(candidate.endLine) !== null && toReferenceText(candidate.text) !== null && isOptionalString(candidate.id) && isOptionalString(candidate.label) && isOptionalString(candidate.language) && isOptionalString(candidate.taskId);
|
|
289
|
+
}
|
|
290
|
+
function isQuoteReferenceCandidate(value) {
|
|
291
|
+
if (!isObjectLike(value)) {
|
|
292
|
+
return false;
|
|
269
293
|
}
|
|
294
|
+
const candidate = value;
|
|
295
|
+
return candidate.type === "quote" && toReferenceText(candidate.text) !== null && isOptionalString(candidate.id) && isOptionalString(candidate.label) && isOptionalString(candidate.messageId) && isOptionalString(candidate.source);
|
|
296
|
+
}
|
|
297
|
+
function isImageReferenceCandidate(value) {
|
|
298
|
+
if (!isObjectLike(value)) {
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
const candidate = value;
|
|
302
|
+
return candidate.type === "image" && isOptionalString(candidate.id) && isOptionalString(candidate.label) && isOptionalString(candidate.text) && isOptionalString(candidate.fileId) && isOptionalString(candidate.url) && isOptionalString(candidate.mimeType) && isOptionalString(candidate.name) && isOptionalNumber(candidate.size) && isOptionalNumber(candidate.width) && isOptionalNumber(candidate.height) && hasImageReferenceLocator(candidate);
|
|
303
|
+
}
|
|
304
|
+
function toCodeReference(candidate) {
|
|
270
305
|
return {
|
|
271
306
|
type: "code",
|
|
272
307
|
...toOptionalString(candidate.id) ? { id: toOptionalString(candidate.id) } : {},
|
|
273
308
|
...toOptionalString(candidate.label) ? { label: toOptionalString(candidate.label) } : {},
|
|
274
|
-
path,
|
|
275
|
-
startLine,
|
|
276
|
-
endLine,
|
|
277
|
-
text,
|
|
309
|
+
path: candidate.path.trim(),
|
|
310
|
+
startLine: candidate.startLine,
|
|
311
|
+
endLine: candidate.endLine,
|
|
312
|
+
text: candidate.text,
|
|
278
313
|
...toOptionalString(candidate.language) ? { language: toOptionalString(candidate.language) } : {},
|
|
279
314
|
...toOptionalString(candidate.taskId) ? { taskId: toOptionalString(candidate.taskId) } : {}
|
|
280
315
|
};
|
|
281
316
|
}
|
|
282
|
-
function
|
|
283
|
-
const text = toReferenceText(candidate.text);
|
|
284
|
-
if (!text) {
|
|
285
|
-
return null;
|
|
286
|
-
}
|
|
317
|
+
function toQuoteReference(candidate) {
|
|
287
318
|
return {
|
|
288
319
|
type: "quote",
|
|
289
320
|
...toOptionalString(candidate.id) ? { id: toOptionalString(candidate.id) } : {},
|
|
290
321
|
...toOptionalString(candidate.label) ? { label: toOptionalString(candidate.label) } : {},
|
|
291
|
-
text,
|
|
322
|
+
text: candidate.text,
|
|
292
323
|
...toOptionalString(candidate.messageId) ? { messageId: toOptionalString(candidate.messageId) } : {},
|
|
293
324
|
...toOptionalString(candidate.source) ? { source: toOptionalString(candidate.source) } : {}
|
|
294
325
|
};
|
|
295
326
|
}
|
|
327
|
+
function toImageReference(candidate) {
|
|
328
|
+
const fileId = toOptionalString(candidate.fileId);
|
|
329
|
+
const url = toOptionalString(candidate.url);
|
|
330
|
+
const name = toOptionalString(candidate.name);
|
|
331
|
+
const label = toOptionalString(candidate.label);
|
|
332
|
+
const rawText = toReferenceText(candidate.text);
|
|
333
|
+
const text = rawText ?? name ?? label ?? "Pasted image";
|
|
334
|
+
return {
|
|
335
|
+
type: "image",
|
|
336
|
+
...toOptionalString(candidate.id) ? { id: toOptionalString(candidate.id) } : {},
|
|
337
|
+
...label ? { label } : {},
|
|
338
|
+
text,
|
|
339
|
+
...fileId ? { fileId } : {},
|
|
340
|
+
...url ? { url } : {},
|
|
341
|
+
...toOptionalString(candidate.mimeType) ? { mimeType: toOptionalString(candidate.mimeType) } : {},
|
|
342
|
+
...name ? { name } : {},
|
|
343
|
+
...toOptionalNumber(candidate.size, { allowZero: true }) !== void 0 ? { size: toOptionalNumber(candidate.size, { allowZero: true }) } : {},
|
|
344
|
+
...toOptionalNumber(candidate.width) !== void 0 ? { width: toOptionalNumber(candidate.width) } : {},
|
|
345
|
+
...toOptionalNumber(candidate.height) !== void 0 ? { height: toOptionalNumber(candidate.height) } : {}
|
|
346
|
+
};
|
|
347
|
+
}
|
|
296
348
|
function isLegacyCodeReference(candidate) {
|
|
297
|
-
return isNonEmptyString(candidate.path) && toLineNumber(candidate.startLine) !== null && toLineNumber(candidate.endLine) !== null && toReferenceText(candidate.text) !== null;
|
|
349
|
+
return candidate.type === void 0 && isNonEmptyString(candidate.path) && toLineNumber(candidate.startLine) !== null && toLineNumber(candidate.endLine) !== null && toReferenceText(candidate.text) !== null;
|
|
298
350
|
}
|
|
299
351
|
function normalizeReference(value) {
|
|
300
352
|
if (!isObjectLike(value)) {
|
|
@@ -302,14 +354,17 @@ function normalizeReference(value) {
|
|
|
302
354
|
}
|
|
303
355
|
const candidate = value;
|
|
304
356
|
const type = toOptionalString(candidate.type);
|
|
305
|
-
if (type === "code") {
|
|
306
|
-
return
|
|
357
|
+
if (type === "code" && isCodeReferenceCandidate(candidate)) {
|
|
358
|
+
return toCodeReference(candidate);
|
|
359
|
+
}
|
|
360
|
+
if (isQuoteReferenceCandidate(candidate)) {
|
|
361
|
+
return toQuoteReference(candidate);
|
|
307
362
|
}
|
|
308
|
-
if (
|
|
309
|
-
return
|
|
363
|
+
if (isImageReferenceCandidate(candidate)) {
|
|
364
|
+
return toImageReference(candidate);
|
|
310
365
|
}
|
|
311
366
|
if (type === void 0 && isLegacyCodeReference(candidate)) {
|
|
312
|
-
return
|
|
367
|
+
return toCodeReference(candidate);
|
|
313
368
|
}
|
|
314
369
|
return null;
|
|
315
370
|
}
|
|
@@ -332,7 +387,32 @@ function getQuoteExcerpt(reference) {
|
|
|
332
387
|
function getCodeReferenceLocation(reference) {
|
|
333
388
|
return `${reference.path}:${getCodeReferenceRange(reference)}`;
|
|
334
389
|
}
|
|
390
|
+
function formatReferenceSize(size2) {
|
|
391
|
+
if (size2 < 1024) {
|
|
392
|
+
return `${size2} B`;
|
|
393
|
+
}
|
|
394
|
+
if (size2 < 1024 * 1024) {
|
|
395
|
+
return `${(size2 / 1024).toFixed(size2 < 10 * 1024 ? 1 : 0)} KB`;
|
|
396
|
+
}
|
|
397
|
+
return `${(size2 / (1024 * 1024)).toFixed(size2 < 10 * 1024 * 1024 ? 1 : 0)} MB`;
|
|
398
|
+
}
|
|
399
|
+
function getImageReferenceDimensions(reference) {
|
|
400
|
+
if (!reference.width || !reference.height) {
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
return `${reference.width}x${reference.height}`;
|
|
404
|
+
}
|
|
405
|
+
function getImageReferenceMetaParts(reference) {
|
|
406
|
+
return [
|
|
407
|
+
reference.mimeType?.trim() || null,
|
|
408
|
+
getImageReferenceDimensions(reference),
|
|
409
|
+
typeof reference.size === "number" ? formatReferenceSize(reference.size) : null
|
|
410
|
+
].filter((part) => Boolean(part));
|
|
411
|
+
}
|
|
335
412
|
function getReferenceKey(reference) {
|
|
413
|
+
if (reference.type === "image" && reference.fileId?.trim()) {
|
|
414
|
+
return `image:${reference.fileId.trim()}`;
|
|
415
|
+
}
|
|
336
416
|
if (reference.id && reference.id.trim()) {
|
|
337
417
|
return reference.id.trim();
|
|
338
418
|
}
|
|
@@ -345,6 +425,18 @@ function getReferenceKey(reference) {
|
|
|
345
425
|
reference.text
|
|
346
426
|
].join(":");
|
|
347
427
|
}
|
|
428
|
+
if (reference.type === "image") {
|
|
429
|
+
return [
|
|
430
|
+
reference.type,
|
|
431
|
+
reference.url ?? "",
|
|
432
|
+
reference.name ?? "",
|
|
433
|
+
reference.mimeType ?? "",
|
|
434
|
+
reference.size ?? "",
|
|
435
|
+
reference.width ?? "",
|
|
436
|
+
reference.height ?? "",
|
|
437
|
+
reference.text
|
|
438
|
+
].join(":");
|
|
439
|
+
}
|
|
348
440
|
return [
|
|
349
441
|
reference.type,
|
|
350
442
|
reference.messageId ?? "",
|
|
@@ -374,6 +466,9 @@ function getReferenceLabel(reference) {
|
|
|
374
466
|
const fileName = segments[segments.length - 1] || reference.path;
|
|
375
467
|
return `${fileName} ${getCodeReferenceRange(reference)}`;
|
|
376
468
|
}
|
|
469
|
+
if (reference.type === "image") {
|
|
470
|
+
return reference.name?.trim() || "Pasted image";
|
|
471
|
+
}
|
|
377
472
|
if (reference.source && reference.source.trim()) {
|
|
378
473
|
return reference.source.trim();
|
|
379
474
|
}
|
|
@@ -383,6 +478,10 @@ function getReferenceMetaLine(reference) {
|
|
|
383
478
|
if (reference.type === "code") {
|
|
384
479
|
return getCodeReferenceLocation(reference);
|
|
385
480
|
}
|
|
481
|
+
if (reference.type === "image") {
|
|
482
|
+
const parts = getImageReferenceMetaParts(reference);
|
|
483
|
+
return parts.length ? parts.join(" \u2022 ") : null;
|
|
484
|
+
}
|
|
386
485
|
if (reference.source && reference.source.trim()) {
|
|
387
486
|
return getQuoteExcerpt(reference);
|
|
388
487
|
}
|
|
@@ -397,6 +496,21 @@ function getReferenceTitle(reference) {
|
|
|
397
496
|
|
|
398
497
|
${reference.text}`;
|
|
399
498
|
}
|
|
499
|
+
if (reference.type === "image") {
|
|
500
|
+
const titleLines = [getReferenceLabel(reference)];
|
|
501
|
+
const metaLine = getReferenceMetaLine(reference);
|
|
502
|
+
const url = reference.url?.trim() && !reference.url.trim().startsWith("data:") ? reference.url.trim() : null;
|
|
503
|
+
if (metaLine) {
|
|
504
|
+
titleLines.push(metaLine);
|
|
505
|
+
}
|
|
506
|
+
if (url) {
|
|
507
|
+
titleLines.push(url);
|
|
508
|
+
}
|
|
509
|
+
if (reference.text.trim() && reference.text.trim() !== getReferenceLabel(reference)) {
|
|
510
|
+
titleLines.push("", reference.text.trim());
|
|
511
|
+
}
|
|
512
|
+
return titleLines.join("\n");
|
|
513
|
+
}
|
|
400
514
|
const header = reference.label?.trim() || reference.source?.trim() || "Quoted text";
|
|
401
515
|
return `${header}
|
|
402
516
|
|
|
@@ -801,6 +915,22 @@ function resolveUsedContextSize(options) {
|
|
|
801
915
|
return normalizeContextUsageNumber(options.fallbackUsedTokens) ?? 0;
|
|
802
916
|
}
|
|
803
917
|
|
|
918
|
+
// src/lib/follow-ups.ts
|
|
919
|
+
function getComposerFollowUpShortcutLabels(queueShortcutLabel) {
|
|
920
|
+
return {
|
|
921
|
+
steer: "Enter",
|
|
922
|
+
queue: queueShortcutLabel
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
function getBusyComposerShortcutFollowUpMode(useQueueShortcut) {
|
|
926
|
+
return useQueueShortcut ? "queue" : "steer";
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
// src/lib/todos.ts
|
|
930
|
+
function countCompletedTodos(items) {
|
|
931
|
+
return items.filter((item) => item.status === "completed").length;
|
|
932
|
+
}
|
|
933
|
+
|
|
804
934
|
// src/providers/Stream.tsx
|
|
805
935
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
806
936
|
var StreamContext = createContext2(void 0);
|
|
@@ -965,6 +1095,9 @@ var en_US_default = {
|
|
|
965
1095
|
manualQueueHint: "Ready to send as a new run",
|
|
966
1096
|
steerHint: "Injects after the current tool call"
|
|
967
1097
|
},
|
|
1098
|
+
todos: {
|
|
1099
|
+
summary: "{{total}} tasks, {{completed}} completed"
|
|
1100
|
+
},
|
|
968
1101
|
errors: {
|
|
969
1102
|
loadMessages: "Failed to load thread messages",
|
|
970
1103
|
createThread: "Failed to create thread",
|
|
@@ -1003,7 +1136,16 @@ var en_US_default = {
|
|
|
1003
1136
|
close: "Close"
|
|
1004
1137
|
},
|
|
1005
1138
|
markdown: {
|
|
1006
|
-
copy: "Copy"
|
|
1139
|
+
copy: "Copy",
|
|
1140
|
+
mermaid: {
|
|
1141
|
+
title: "Mermaid",
|
|
1142
|
+
diagram: "Diagram",
|
|
1143
|
+
code: "Code",
|
|
1144
|
+
download: "Download SVG",
|
|
1145
|
+
fullScreen: "Open full screen",
|
|
1146
|
+
rendering: "Rendering diagram",
|
|
1147
|
+
failed: "Failed to render diagram"
|
|
1148
|
+
}
|
|
1007
1149
|
},
|
|
1008
1150
|
thread: {
|
|
1009
1151
|
errorToast: "An error occurred. Please try again.",
|
|
@@ -1049,7 +1191,7 @@ var zh_CN_default = {
|
|
|
1049
1191
|
pending: "\u5F85\u5904\u7406 Follow-up",
|
|
1050
1192
|
queue: "\u6392\u961F",
|
|
1051
1193
|
steer: "\u5F15\u5BFC",
|
|
1052
|
-
steerAction: "
|
|
1194
|
+
steerAction: "\u5F15\u5BFC",
|
|
1053
1195
|
promoteToSteer: "\u8F6C\u4E3A\u5F15\u5BFC",
|
|
1054
1196
|
sendNow: "\u7ACB\u5373\u53D1\u9001",
|
|
1055
1197
|
remove: "\u79FB\u9664\u6B64\u5F85\u5904\u7406 Follow-up",
|
|
@@ -1060,6 +1202,9 @@ var zh_CN_default = {
|
|
|
1060
1202
|
manualQueueHint: "\u4FDD\u7559\u4E3A\u5F85\u53D1\u9001\uFF0C\u53EF\u624B\u52A8\u5F00\u542F\u65B0\u4E00\u8F6E",
|
|
1061
1203
|
steerHint: "\u5F53\u524D\u5DE5\u5177\u8C03\u7528\u5B8C\u6210\u540E\u6CE8\u5165"
|
|
1062
1204
|
},
|
|
1205
|
+
todos: {
|
|
1206
|
+
summary: "\u5171 {{total}} \u4E2A\u4EFB\u52A1\uFF0C\u5DF2\u7ECF\u5B8C\u6210 {{completed}} \u4E2A"
|
|
1207
|
+
},
|
|
1063
1208
|
errors: {
|
|
1064
1209
|
loadMessages: "\u52A0\u8F7D\u7EBF\u7A0B\u6D88\u606F\u5931\u8D25",
|
|
1065
1210
|
createThread: "\u521B\u5EFA\u7EBF\u7A0B\u5931\u8D25",
|
|
@@ -1098,7 +1243,16 @@ var zh_CN_default = {
|
|
|
1098
1243
|
close: "\u5173\u95ED"
|
|
1099
1244
|
},
|
|
1100
1245
|
markdown: {
|
|
1101
|
-
copy: "\u590D\u5236"
|
|
1246
|
+
copy: "\u590D\u5236",
|
|
1247
|
+
mermaid: {
|
|
1248
|
+
title: "Mermaid",
|
|
1249
|
+
diagram: "\u56FE\u8868",
|
|
1250
|
+
code: "\u4EE3\u7801",
|
|
1251
|
+
download: "\u4E0B\u8F7D SVG",
|
|
1252
|
+
fullScreen: "\u5168\u5C4F\u67E5\u770B",
|
|
1253
|
+
rendering: "\u6B63\u5728\u6E32\u67D3\u56FE\u8868",
|
|
1254
|
+
failed: "\u56FE\u8868\u6E32\u67D3\u5931\u8D25"
|
|
1255
|
+
}
|
|
1102
1256
|
},
|
|
1103
1257
|
thread: {
|
|
1104
1258
|
errorToast: "\u53D1\u751F\u9519\u8BEF\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
@@ -1631,19 +1785,86 @@ function ComposerMenu({
|
|
|
1631
1785
|
|
|
1632
1786
|
// src/components/composer/SendButton.tsx
|
|
1633
1787
|
import { ArrowUp, Square } from "lucide-react";
|
|
1634
|
-
|
|
1788
|
+
|
|
1789
|
+
// src/components/ui/tooltip.tsx
|
|
1790
|
+
import "react";
|
|
1791
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
1792
|
+
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1793
|
+
function TooltipProvider({
|
|
1794
|
+
delayDuration = 0,
|
|
1795
|
+
...props
|
|
1796
|
+
}) {
|
|
1797
|
+
return /* @__PURE__ */ jsx7(
|
|
1798
|
+
TooltipPrimitive.Provider,
|
|
1799
|
+
{
|
|
1800
|
+
"data-slot": "tooltip-provider",
|
|
1801
|
+
delayDuration,
|
|
1802
|
+
...props
|
|
1803
|
+
}
|
|
1804
|
+
);
|
|
1805
|
+
}
|
|
1806
|
+
function Tooltip({
|
|
1807
|
+
...props
|
|
1808
|
+
}) {
|
|
1809
|
+
return /* @__PURE__ */ jsx7(TooltipProvider, { children: /* @__PURE__ */ jsx7(
|
|
1810
|
+
TooltipPrimitive.Root,
|
|
1811
|
+
{
|
|
1812
|
+
"data-slot": "tooltip",
|
|
1813
|
+
...props
|
|
1814
|
+
}
|
|
1815
|
+
) });
|
|
1816
|
+
}
|
|
1817
|
+
function TooltipTrigger({
|
|
1818
|
+
...props
|
|
1819
|
+
}) {
|
|
1820
|
+
return /* @__PURE__ */ jsx7(
|
|
1821
|
+
TooltipPrimitive.Trigger,
|
|
1822
|
+
{
|
|
1823
|
+
"data-slot": "tooltip-trigger",
|
|
1824
|
+
...props
|
|
1825
|
+
}
|
|
1826
|
+
);
|
|
1827
|
+
}
|
|
1828
|
+
function TooltipContent({
|
|
1829
|
+
className,
|
|
1830
|
+
sideOffset = 0,
|
|
1831
|
+
hideArrow = false,
|
|
1832
|
+
children,
|
|
1833
|
+
...props
|
|
1834
|
+
}) {
|
|
1835
|
+
return /* @__PURE__ */ jsx7(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs2(
|
|
1836
|
+
TooltipPrimitive.Content,
|
|
1837
|
+
{
|
|
1838
|
+
"data-slot": "tooltip-content",
|
|
1839
|
+
sideOffset,
|
|
1840
|
+
className: cn(
|
|
1841
|
+
"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",
|
|
1842
|
+
className
|
|
1843
|
+
),
|
|
1844
|
+
...props,
|
|
1845
|
+
children: [
|
|
1846
|
+
children,
|
|
1847
|
+
!hideArrow ? /* @__PURE__ */ jsx7(TooltipPrimitive.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" }) : null
|
|
1848
|
+
]
|
|
1849
|
+
}
|
|
1850
|
+
) });
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1853
|
+
// src/components/composer/SendButton.tsx
|
|
1854
|
+
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1635
1855
|
function SendButton({
|
|
1636
1856
|
disabled = false,
|
|
1637
1857
|
isLoading = false,
|
|
1638
1858
|
showStop = isLoading,
|
|
1639
1859
|
onStop,
|
|
1640
1860
|
stopLabel = "Stop",
|
|
1641
|
-
sendLabel = "Send"
|
|
1861
|
+
sendLabel = "Send",
|
|
1862
|
+
shortcuts
|
|
1642
1863
|
}) {
|
|
1643
1864
|
const { theme } = useTheme();
|
|
1644
1865
|
const roundedClass = getRoundedClass(theme.radius);
|
|
1645
1866
|
if (showStop) {
|
|
1646
|
-
return /* @__PURE__ */
|
|
1867
|
+
return /* @__PURE__ */ jsx8(
|
|
1647
1868
|
"button",
|
|
1648
1869
|
{
|
|
1649
1870
|
type: "button",
|
|
@@ -1656,11 +1877,11 @@ function SendButton({
|
|
|
1656
1877
|
"hover:scale-105 active:scale-95"
|
|
1657
1878
|
),
|
|
1658
1879
|
"aria-label": stopLabel,
|
|
1659
|
-
children: /* @__PURE__ */
|
|
1880
|
+
children: /* @__PURE__ */ jsx8(Square, { size: 14, fill: "currentColor", stroke: "currentColor", strokeWidth: 0 })
|
|
1660
1881
|
}
|
|
1661
1882
|
);
|
|
1662
1883
|
}
|
|
1663
|
-
|
|
1884
|
+
const button = /* @__PURE__ */ jsx8(
|
|
1664
1885
|
"button",
|
|
1665
1886
|
{
|
|
1666
1887
|
type: "submit",
|
|
@@ -1674,34 +1895,63 @@ function SendButton({
|
|
|
1674
1895
|
"disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:scale-100"
|
|
1675
1896
|
),
|
|
1676
1897
|
"aria-label": sendLabel,
|
|
1677
|
-
children: /* @__PURE__ */
|
|
1898
|
+
children: /* @__PURE__ */ jsx8(ArrowUp, { size: 18, strokeWidth: 2.5 })
|
|
1678
1899
|
}
|
|
1679
1900
|
);
|
|
1901
|
+
if (!shortcuts?.length || disabled) {
|
|
1902
|
+
return button;
|
|
1903
|
+
}
|
|
1904
|
+
return /* @__PURE__ */ jsxs3(Tooltip, { children: [
|
|
1905
|
+
/* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: button }),
|
|
1906
|
+
/* @__PURE__ */ jsx8(
|
|
1907
|
+
TooltipContent,
|
|
1908
|
+
{
|
|
1909
|
+
side: "top",
|
|
1910
|
+
sideOffset: 10,
|
|
1911
|
+
hideArrow: true,
|
|
1912
|
+
className: cn(
|
|
1913
|
+
"min-w-36 border border-border/70 bg-background px-3 py-2 text-foreground shadow-lg",
|
|
1914
|
+
roundedClass
|
|
1915
|
+
),
|
|
1916
|
+
children: /* @__PURE__ */ jsx8("div", { className: "space-y-1", children: shortcuts.map((shortcut) => /* @__PURE__ */ jsxs3(
|
|
1917
|
+
"div",
|
|
1918
|
+
{
|
|
1919
|
+
className: "flex items-center justify-between gap-4 text-sm",
|
|
1920
|
+
children: [
|
|
1921
|
+
/* @__PURE__ */ jsx8("span", { className: "font-medium", children: shortcut.label }),
|
|
1922
|
+
/* @__PURE__ */ jsx8("kbd", { className: "inline-flex min-w-16 items-center justify-center rounded-full bg-muted px-2.5 py-0.5 text-xs font-medium text-muted-foreground", children: shortcut.keys })
|
|
1923
|
+
]
|
|
1924
|
+
},
|
|
1925
|
+
`${shortcut.label}-${shortcut.keys}`
|
|
1926
|
+
)) })
|
|
1927
|
+
}
|
|
1928
|
+
)
|
|
1929
|
+
] });
|
|
1680
1930
|
}
|
|
1681
1931
|
|
|
1682
1932
|
// src/components/history/HistorySidebar.tsx
|
|
1683
|
-
import * as
|
|
1933
|
+
import * as React9 from "react";
|
|
1684
1934
|
import { History, MessageSquare, PlusCircle, Trash2 } from "lucide-react";
|
|
1685
1935
|
|
|
1686
1936
|
// src/components/ui/scroll-area.tsx
|
|
1687
|
-
import * as
|
|
1937
|
+
import * as React7 from "react";
|
|
1688
1938
|
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
1689
|
-
import { jsx as
|
|
1690
|
-
var ScrollArea =
|
|
1939
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1940
|
+
var ScrollArea = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs4(
|
|
1691
1941
|
ScrollAreaPrimitive.Root,
|
|
1692
1942
|
{
|
|
1693
1943
|
ref,
|
|
1694
1944
|
className: cn("relative overflow-hidden", className),
|
|
1695
1945
|
...props,
|
|
1696
1946
|
children: [
|
|
1697
|
-
/* @__PURE__ */
|
|
1698
|
-
/* @__PURE__ */
|
|
1699
|
-
/* @__PURE__ */
|
|
1947
|
+
/* @__PURE__ */ jsx9(ScrollAreaPrimitive.Viewport, { className: "h-full w-full rounded-[inherit]", children }),
|
|
1948
|
+
/* @__PURE__ */ jsx9(ScrollBar, {}),
|
|
1949
|
+
/* @__PURE__ */ jsx9(ScrollAreaPrimitive.Corner, {})
|
|
1700
1950
|
]
|
|
1701
1951
|
}
|
|
1702
1952
|
));
|
|
1703
1953
|
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
1704
|
-
var ScrollBar =
|
|
1954
|
+
var ScrollBar = React7.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx9(
|
|
1705
1955
|
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
1706
1956
|
{
|
|
1707
1957
|
ref,
|
|
@@ -1713,7 +1963,7 @@ var ScrollBar = React6.forwardRef(({ className, orientation = "vertical", ...pro
|
|
|
1713
1963
|
className
|
|
1714
1964
|
),
|
|
1715
1965
|
...props,
|
|
1716
|
-
children: /* @__PURE__ */
|
|
1966
|
+
children: /* @__PURE__ */ jsx9(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
|
|
1717
1967
|
}
|
|
1718
1968
|
));
|
|
1719
1969
|
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
@@ -1722,21 +1972,21 @@ ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
|
1722
1972
|
import "react";
|
|
1723
1973
|
import { X } from "lucide-react";
|
|
1724
1974
|
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
1725
|
-
import { jsx as
|
|
1975
|
+
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1726
1976
|
function Sheet({ ...props }) {
|
|
1727
|
-
return /* @__PURE__ */
|
|
1977
|
+
return /* @__PURE__ */ jsx10(SheetPrimitive.Root, { ...props });
|
|
1728
1978
|
}
|
|
1729
1979
|
function SheetTrigger({ ...props }) {
|
|
1730
|
-
return /* @__PURE__ */
|
|
1980
|
+
return /* @__PURE__ */ jsx10(SheetPrimitive.Trigger, { ...props });
|
|
1731
1981
|
}
|
|
1732
1982
|
function SheetPortal({ ...props }) {
|
|
1733
|
-
return /* @__PURE__ */
|
|
1983
|
+
return /* @__PURE__ */ jsx10(SheetPrimitive.Portal, { ...props });
|
|
1734
1984
|
}
|
|
1735
1985
|
function SheetOverlay({
|
|
1736
1986
|
className,
|
|
1737
1987
|
...props
|
|
1738
1988
|
}) {
|
|
1739
|
-
return /* @__PURE__ */
|
|
1989
|
+
return /* @__PURE__ */ jsx10(
|
|
1740
1990
|
SheetPrimitive.Overlay,
|
|
1741
1991
|
{
|
|
1742
1992
|
className: cn(
|
|
@@ -1760,9 +2010,9 @@ function SheetContent({
|
|
|
1760
2010
|
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",
|
|
1761
2011
|
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"
|
|
1762
2012
|
};
|
|
1763
|
-
return /* @__PURE__ */
|
|
1764
|
-
/* @__PURE__ */
|
|
1765
|
-
/* @__PURE__ */
|
|
2013
|
+
return /* @__PURE__ */ jsxs5(SheetPortal, { children: [
|
|
2014
|
+
/* @__PURE__ */ jsx10(SheetOverlay, {}),
|
|
2015
|
+
/* @__PURE__ */ jsxs5(
|
|
1766
2016
|
SheetPrimitive.Content,
|
|
1767
2017
|
{
|
|
1768
2018
|
className: cn(
|
|
@@ -1773,9 +2023,9 @@ function SheetContent({
|
|
|
1773
2023
|
...props,
|
|
1774
2024
|
children: [
|
|
1775
2025
|
children,
|
|
1776
|
-
/* @__PURE__ */
|
|
1777
|
-
/* @__PURE__ */
|
|
1778
|
-
/* @__PURE__ */
|
|
2026
|
+
/* @__PURE__ */ jsxs5(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: [
|
|
2027
|
+
/* @__PURE__ */ jsx10(X, { size: 16 }),
|
|
2028
|
+
/* @__PURE__ */ jsx10("span", { className: "sr-only", children: t("sheet.close") })
|
|
1779
2029
|
] })
|
|
1780
2030
|
]
|
|
1781
2031
|
}
|
|
@@ -1786,7 +2036,7 @@ function SheetHeader({
|
|
|
1786
2036
|
className,
|
|
1787
2037
|
...props
|
|
1788
2038
|
}) {
|
|
1789
|
-
return /* @__PURE__ */
|
|
2039
|
+
return /* @__PURE__ */ jsx10(
|
|
1790
2040
|
"div",
|
|
1791
2041
|
{
|
|
1792
2042
|
className: cn(
|
|
@@ -1801,7 +2051,7 @@ function SheetTitle({
|
|
|
1801
2051
|
className,
|
|
1802
2052
|
...props
|
|
1803
2053
|
}) {
|
|
1804
|
-
return /* @__PURE__ */
|
|
2054
|
+
return /* @__PURE__ */ jsx10(
|
|
1805
2055
|
SheetPrimitive.Title,
|
|
1806
2056
|
{
|
|
1807
2057
|
className: cn("text-lg font-semibold text-foreground", className),
|
|
@@ -1811,7 +2061,7 @@ function SheetTitle({
|
|
|
1811
2061
|
}
|
|
1812
2062
|
|
|
1813
2063
|
// src/components/history/HistorySidebar.tsx
|
|
1814
|
-
import { jsx as
|
|
2064
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1815
2065
|
function HistorySidebar({
|
|
1816
2066
|
threads = [],
|
|
1817
2067
|
currentThreadId,
|
|
@@ -1822,7 +2072,7 @@ function HistorySidebar({
|
|
|
1822
2072
|
disabled = false
|
|
1823
2073
|
}) {
|
|
1824
2074
|
const { t } = useChatkitTranslation();
|
|
1825
|
-
const [open, setOpen] =
|
|
2075
|
+
const [open, setOpen] = React9.useState(false);
|
|
1826
2076
|
const handleNewThread = () => {
|
|
1827
2077
|
onNewThread?.();
|
|
1828
2078
|
setOpen(false);
|
|
@@ -1831,8 +2081,8 @@ function HistorySidebar({
|
|
|
1831
2081
|
onSelectThread?.(id);
|
|
1832
2082
|
setOpen(false);
|
|
1833
2083
|
};
|
|
1834
|
-
return /* @__PURE__ */
|
|
1835
|
-
/* @__PURE__ */
|
|
2084
|
+
return /* @__PURE__ */ jsxs6(Sheet, { open, onOpenChange: setOpen, children: [
|
|
2085
|
+
/* @__PURE__ */ jsx11(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsxs6(
|
|
1836
2086
|
Button,
|
|
1837
2087
|
{
|
|
1838
2088
|
variant: "ghost",
|
|
@@ -1840,26 +2090,26 @@ function HistorySidebar({
|
|
|
1840
2090
|
disabled,
|
|
1841
2091
|
className: "h-8 w-8 cursor-pointer",
|
|
1842
2092
|
children: [
|
|
1843
|
-
/* @__PURE__ */
|
|
1844
|
-
/* @__PURE__ */
|
|
2093
|
+
/* @__PURE__ */ jsx11(History, { size: 16 }),
|
|
2094
|
+
/* @__PURE__ */ jsx11("span", { className: "sr-only", children: t("history.threadHistory") })
|
|
1845
2095
|
]
|
|
1846
2096
|
}
|
|
1847
2097
|
) }),
|
|
1848
|
-
/* @__PURE__ */
|
|
1849
|
-
/* @__PURE__ */
|
|
1850
|
-
/* @__PURE__ */
|
|
2098
|
+
/* @__PURE__ */ jsxs6(SheetContent, { side: "right", className: "w-80 p-0", children: [
|
|
2099
|
+
/* @__PURE__ */ jsx11(SheetHeader, { className: "border-b p-4", children: /* @__PURE__ */ jsx11(SheetTitle, { children: t("history.title") }) }),
|
|
2100
|
+
/* @__PURE__ */ jsx11("div", { className: "p-4", children: /* @__PURE__ */ jsxs6(
|
|
1851
2101
|
Button,
|
|
1852
2102
|
{
|
|
1853
2103
|
onClick: handleNewThread,
|
|
1854
2104
|
className: "w-full justify-start gap-2",
|
|
1855
2105
|
variant: "secondary",
|
|
1856
2106
|
children: [
|
|
1857
|
-
/* @__PURE__ */
|
|
2107
|
+
/* @__PURE__ */ jsx11(PlusCircle, { size: 16 }),
|
|
1858
2108
|
t("history.newThread")
|
|
1859
2109
|
]
|
|
1860
2110
|
}
|
|
1861
2111
|
) }),
|
|
1862
|
-
/* @__PURE__ */
|
|
2112
|
+
/* @__PURE__ */ jsx11(ScrollArea, { className: "h-[calc(100vh-140px)]", children: /* @__PURE__ */ jsx11("div", { className: "px-4 pb-4", children: threads.length === 0 ? /* @__PURE__ */ jsx11("div", { className: "py-8 text-center text-sm text-muted-foreground", children: t("history.empty") }) : /* @__PURE__ */ jsx11("div", { className: "space-y-1", children: threads.map((thread) => /* @__PURE__ */ jsxs6(
|
|
1863
2113
|
"div",
|
|
1864
2114
|
{
|
|
1865
2115
|
className: cn(
|
|
@@ -1869,9 +2119,9 @@ function HistorySidebar({
|
|
|
1869
2119
|
),
|
|
1870
2120
|
onClick: () => handleSelectThread(thread.id),
|
|
1871
2121
|
children: [
|
|
1872
|
-
/* @__PURE__ */
|
|
1873
|
-
/* @__PURE__ */
|
|
1874
|
-
showDelete && onDeleteThread && /* @__PURE__ */
|
|
2122
|
+
/* @__PURE__ */ jsx11("span", { className: "text-muted-foreground", children: /* @__PURE__ */ jsx11(MessageSquare, { size: 16 }) }),
|
|
2123
|
+
/* @__PURE__ */ jsx11("span", { className: "flex-1 truncate", children: thread.title }),
|
|
2124
|
+
showDelete && onDeleteThread && /* @__PURE__ */ jsx11(
|
|
1875
2125
|
"button",
|
|
1876
2126
|
{
|
|
1877
2127
|
type: "button",
|
|
@@ -1880,7 +2130,7 @@ function HistorySidebar({
|
|
|
1880
2130
|
onDeleteThread(thread.id);
|
|
1881
2131
|
},
|
|
1882
2132
|
className: "opacity-0 group-hover:opacity-100 p-1 rounded hover:bg-destructive/10 hover:text-destructive transition-all",
|
|
1883
|
-
children: /* @__PURE__ */
|
|
2133
|
+
children: /* @__PURE__ */ jsx11(Trash2, { size: 14 })
|
|
1884
2134
|
}
|
|
1885
2135
|
)
|
|
1886
2136
|
]
|
|
@@ -1901,72 +2151,7 @@ import {
|
|
|
1901
2151
|
SlidersHorizontal as SlidersHorizontal2,
|
|
1902
2152
|
Trash2 as Trash22
|
|
1903
2153
|
} from "lucide-react";
|
|
1904
|
-
|
|
1905
|
-
// src/components/ui/tooltip.tsx
|
|
1906
|
-
import "react";
|
|
1907
|
-
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
1908
|
-
import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1909
|
-
function TooltipProvider({
|
|
1910
|
-
delayDuration = 0,
|
|
1911
|
-
...props
|
|
1912
|
-
}) {
|
|
1913
|
-
return /* @__PURE__ */ jsx11(
|
|
1914
|
-
TooltipPrimitive.Provider,
|
|
1915
|
-
{
|
|
1916
|
-
"data-slot": "tooltip-provider",
|
|
1917
|
-
delayDuration,
|
|
1918
|
-
...props
|
|
1919
|
-
}
|
|
1920
|
-
);
|
|
1921
|
-
}
|
|
1922
|
-
function Tooltip({
|
|
1923
|
-
...props
|
|
1924
|
-
}) {
|
|
1925
|
-
return /* @__PURE__ */ jsx11(TooltipProvider, { children: /* @__PURE__ */ jsx11(
|
|
1926
|
-
TooltipPrimitive.Root,
|
|
1927
|
-
{
|
|
1928
|
-
"data-slot": "tooltip",
|
|
1929
|
-
...props
|
|
1930
|
-
}
|
|
1931
|
-
) });
|
|
1932
|
-
}
|
|
1933
|
-
function TooltipTrigger({
|
|
1934
|
-
...props
|
|
1935
|
-
}) {
|
|
1936
|
-
return /* @__PURE__ */ jsx11(
|
|
1937
|
-
TooltipPrimitive.Trigger,
|
|
1938
|
-
{
|
|
1939
|
-
"data-slot": "tooltip-trigger",
|
|
1940
|
-
...props
|
|
1941
|
-
}
|
|
1942
|
-
);
|
|
1943
|
-
}
|
|
1944
|
-
function TooltipContent({
|
|
1945
|
-
className,
|
|
1946
|
-
sideOffset = 0,
|
|
1947
|
-
children,
|
|
1948
|
-
...props
|
|
1949
|
-
}) {
|
|
1950
|
-
return /* @__PURE__ */ jsx11(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs5(
|
|
1951
|
-
TooltipPrimitive.Content,
|
|
1952
|
-
{
|
|
1953
|
-
"data-slot": "tooltip-content",
|
|
1954
|
-
sideOffset,
|
|
1955
|
-
className: cn(
|
|
1956
|
-
"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",
|
|
1957
|
-
className
|
|
1958
|
-
),
|
|
1959
|
-
...props,
|
|
1960
|
-
children: [
|
|
1961
|
-
children,
|
|
1962
|
-
/* @__PURE__ */ jsx11(TooltipPrimitive.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
|
|
1963
|
-
]
|
|
1964
|
-
}
|
|
1965
|
-
) });
|
|
1966
|
-
}
|
|
1967
|
-
|
|
1968
|
-
// src/components/composer/pending-follow-ups.tsx
|
|
1969
|
-
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2154
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1970
2155
|
function getPendingFollowUpText(item, referencedContentFallback) {
|
|
1971
2156
|
const text = item.request?.input?.input?.trim() ?? "";
|
|
1972
2157
|
if (text) {
|
|
@@ -2005,6 +2190,7 @@ function PendingFollowUps({
|
|
|
2005
2190
|
onSendNow,
|
|
2006
2191
|
onEdit,
|
|
2007
2192
|
onRemove,
|
|
2193
|
+
attachToComposer = true,
|
|
2008
2194
|
className
|
|
2009
2195
|
}) {
|
|
2010
2196
|
const { t } = useChatkitTranslation();
|
|
@@ -2027,15 +2213,16 @@ function PendingFollowUps({
|
|
|
2027
2213
|
"div",
|
|
2028
2214
|
{
|
|
2029
2215
|
className: cn(
|
|
2030
|
-
"space-y-2 mx-2 p-2 border border-border
|
|
2031
|
-
|
|
2216
|
+
"space-y-2 mx-2 p-2 border border-border",
|
|
2217
|
+
attachToComposer ? "border-b-0" : null,
|
|
2218
|
+
attachToComposer ? rounded.top : rounded.panel,
|
|
2032
2219
|
className
|
|
2033
2220
|
),
|
|
2034
|
-
children: /* @__PURE__ */
|
|
2035
|
-
/* @__PURE__ */
|
|
2221
|
+
children: /* @__PURE__ */ jsxs7("div", { className: "space-y-1", children: [
|
|
2222
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between gap-3", children: [
|
|
2036
2223
|
/* @__PURE__ */ jsx12("div", { className: "text-xs font-medium text-foreground", children: t("chat.followUps.pending") }),
|
|
2037
|
-
/* @__PURE__ */
|
|
2038
|
-
/* @__PURE__ */ jsx12(TooltipTrigger, { asChild: true, children: /* @__PURE__ */
|
|
2224
|
+
/* @__PURE__ */ jsxs7(Tooltip, { children: [
|
|
2225
|
+
/* @__PURE__ */ jsx12(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs7(
|
|
2039
2226
|
"button",
|
|
2040
2227
|
{
|
|
2041
2228
|
type: "button",
|
|
@@ -2065,8 +2252,8 @@ function PendingFollowUps({
|
|
|
2065
2252
|
"border border-border/70 bg-muted/20 px-3 py-2",
|
|
2066
2253
|
rounded.panel
|
|
2067
2254
|
),
|
|
2068
|
-
children: /* @__PURE__ */
|
|
2069
|
-
/* @__PURE__ */
|
|
2255
|
+
children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between gap-3", children: [
|
|
2256
|
+
/* @__PURE__ */ jsxs7("div", { className: "min-w-0", children: [
|
|
2070
2257
|
/* @__PURE__ */ jsx12("div", { className: "text-xs font-medium text-foreground", children: t("chat.followUps.label") }),
|
|
2071
2258
|
/* @__PURE__ */ jsx12("div", { className: "text-[11px] text-muted-foreground", children: isLoading ? t("chat.followUps.activeHint") : t("chat.followUps.idleHint") })
|
|
2072
2259
|
] }),
|
|
@@ -2077,7 +2264,7 @@ function PendingFollowUps({
|
|
|
2077
2264
|
"inline-flex shrink-0 border border-border bg-background p-1",
|
|
2078
2265
|
rounded.control
|
|
2079
2266
|
),
|
|
2080
|
-
children: ["queue", "steer"].map((behavior) => /* @__PURE__ */
|
|
2267
|
+
children: ["queue", "steer"].map((behavior) => /* @__PURE__ */ jsxs7(Tooltip, { children: [
|
|
2081
2268
|
/* @__PURE__ */ jsx12(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx12(
|
|
2082
2269
|
"button",
|
|
2083
2270
|
{
|
|
@@ -2110,10 +2297,10 @@ function PendingFollowUps({
|
|
|
2110
2297
|
"border border-border/50 bg-muted/15 px-2 py-1",
|
|
2111
2298
|
rounded.panel
|
|
2112
2299
|
),
|
|
2113
|
-
children: /* @__PURE__ */
|
|
2300
|
+
children: /* @__PURE__ */ jsxs7("div", { className: "flex items-start gap-2.5", children: [
|
|
2114
2301
|
/* @__PURE__ */ jsx12(CornerDownLeft, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
2115
|
-
/* @__PURE__ */
|
|
2116
|
-
/* @__PURE__ */
|
|
2302
|
+
/* @__PURE__ */ jsxs7("div", { className: "min-w-0 flex-1", children: [
|
|
2303
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-start gap-2", children: [
|
|
2117
2304
|
/* @__PURE__ */ jsx12("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx12(
|
|
2118
2305
|
"div",
|
|
2119
2306
|
{
|
|
@@ -2128,7 +2315,7 @@ function PendingFollowUps({
|
|
|
2128
2315
|
)
|
|
2129
2316
|
}
|
|
2130
2317
|
) }),
|
|
2131
|
-
/* @__PURE__ */
|
|
2318
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
2132
2319
|
item.mode === "queue" && isLoading && /* @__PURE__ */ jsx12(
|
|
2133
2320
|
"button",
|
|
2134
2321
|
{
|
|
@@ -2171,7 +2358,7 @@ function PendingFollowUps({
|
|
|
2171
2358
|
children: /* @__PURE__ */ jsx12(Trash22, { size: 13 })
|
|
2172
2359
|
}
|
|
2173
2360
|
),
|
|
2174
|
-
item.mode === "queue" && /* @__PURE__ */
|
|
2361
|
+
item.mode === "queue" && /* @__PURE__ */ jsxs7(
|
|
2175
2362
|
Popover,
|
|
2176
2363
|
{
|
|
2177
2364
|
open: openMenuId === item.id,
|
|
@@ -2199,8 +2386,8 @@ function PendingFollowUps({
|
|
|
2199
2386
|
"w-52 border-border/70 bg-background p-1.5",
|
|
2200
2387
|
rounded.panel
|
|
2201
2388
|
),
|
|
2202
|
-
children: /* @__PURE__ */
|
|
2203
|
-
/* @__PURE__ */
|
|
2389
|
+
children: /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-1", children: [
|
|
2390
|
+
/* @__PURE__ */ jsxs7(
|
|
2204
2391
|
"button",
|
|
2205
2392
|
{
|
|
2206
2393
|
type: "button",
|
|
@@ -2218,7 +2405,7 @@ function PendingFollowUps({
|
|
|
2218
2405
|
]
|
|
2219
2406
|
}
|
|
2220
2407
|
),
|
|
2221
|
-
/* @__PURE__ */
|
|
2408
|
+
/* @__PURE__ */ jsxs7(
|
|
2222
2409
|
"button",
|
|
2223
2410
|
{
|
|
2224
2411
|
type: "button",
|
|
@@ -2244,7 +2431,7 @@ function PendingFollowUps({
|
|
|
2244
2431
|
)
|
|
2245
2432
|
] })
|
|
2246
2433
|
] }),
|
|
2247
|
-
/* @__PURE__ */
|
|
2434
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-1.5 text-[10px] leading-4 text-muted-foreground", children: [
|
|
2248
2435
|
/* @__PURE__ */ jsx12(Info, { className: "h-3 w-3 shrink-0" }),
|
|
2249
2436
|
/* @__PURE__ */ jsx12("span", { className: "truncate", children: item.mode === "queue" ? canSendItemNow ? t("chat.followUps.manualQueueHint") : t("chat.followUps.queueHint") : t("chat.followUps.steerHint") })
|
|
2250
2437
|
] })
|
|
@@ -2259,31 +2446,162 @@ function PendingFollowUps({
|
|
|
2259
2446
|
);
|
|
2260
2447
|
}
|
|
2261
2448
|
|
|
2449
|
+
// src/components/composer/pending-todos.tsx
|
|
2450
|
+
import * as React11 from "react";
|
|
2451
|
+
import {
|
|
2452
|
+
CheckCircle2,
|
|
2453
|
+
ChevronDown,
|
|
2454
|
+
Circle,
|
|
2455
|
+
CircleDashed,
|
|
2456
|
+
ListTodo
|
|
2457
|
+
} from "lucide-react";
|
|
2458
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2459
|
+
function useRoundedClasses2() {
|
|
2460
|
+
const { theme } = useTheme();
|
|
2461
|
+
return {
|
|
2462
|
+
top: theme.radius ? {
|
|
2463
|
+
pill: "rounded-t-full",
|
|
2464
|
+
round: "rounded-t-xl",
|
|
2465
|
+
soft: "rounded-t-lg",
|
|
2466
|
+
sharp: "rounded-t-none"
|
|
2467
|
+
}[theme.radius] : "rounded-t-lg",
|
|
2468
|
+
panel: getRoundedClass(theme.radius, "rounded-lg")
|
|
2469
|
+
};
|
|
2470
|
+
}
|
|
2471
|
+
function TodoStatusIcon({ status }) {
|
|
2472
|
+
if (status === "completed") {
|
|
2473
|
+
return /* @__PURE__ */ jsx13(CheckCircle2, { className: "mt-1 h-4 w-4 shrink-0 text-emerald-600" });
|
|
2474
|
+
}
|
|
2475
|
+
if (status === "in_progress") {
|
|
2476
|
+
return /* @__PURE__ */ jsx13(CircleDashed, { className: "mt-1 h-4 w-4 shrink-0 text-foreground/70" });
|
|
2477
|
+
}
|
|
2478
|
+
return /* @__PURE__ */ jsx13(Circle, { className: "mt-1 h-4 w-4 shrink-0 text-muted-foreground" });
|
|
2479
|
+
}
|
|
2480
|
+
function PendingTodos({
|
|
2481
|
+
snapshot,
|
|
2482
|
+
attachToComposer = true,
|
|
2483
|
+
className
|
|
2484
|
+
}) {
|
|
2485
|
+
const { t } = useChatkitTranslation();
|
|
2486
|
+
const rounded = useRoundedClasses2();
|
|
2487
|
+
const listId = React11.useId();
|
|
2488
|
+
const [isCollapsed, setIsCollapsed] = React11.useState(false);
|
|
2489
|
+
React11.useEffect(() => {
|
|
2490
|
+
setIsCollapsed(false);
|
|
2491
|
+
}, [snapshot?.componentId]);
|
|
2492
|
+
if (!snapshot || snapshot.items.length === 0) {
|
|
2493
|
+
return null;
|
|
2494
|
+
}
|
|
2495
|
+
const completedCount = countCompletedTodos(snapshot.items);
|
|
2496
|
+
return /* @__PURE__ */ jsxs8(
|
|
2497
|
+
"div",
|
|
2498
|
+
{
|
|
2499
|
+
"aria-live": "polite",
|
|
2500
|
+
className: cn(
|
|
2501
|
+
"mx-2 border border-border bg-background/95 px-3 py-3 shadow-sm",
|
|
2502
|
+
attachToComposer ? "border-b-0" : null,
|
|
2503
|
+
attachToComposer ? rounded.top : rounded.panel,
|
|
2504
|
+
className
|
|
2505
|
+
),
|
|
2506
|
+
children: [
|
|
2507
|
+
/* @__PURE__ */ jsxs8(
|
|
2508
|
+
"button",
|
|
2509
|
+
{
|
|
2510
|
+
type: "button",
|
|
2511
|
+
className: "flex w-full items-center justify-between gap-3 text-left",
|
|
2512
|
+
"aria-expanded": !isCollapsed,
|
|
2513
|
+
"aria-controls": listId,
|
|
2514
|
+
onClick: () => setIsCollapsed((prev) => !prev),
|
|
2515
|
+
children: [
|
|
2516
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 items-center gap-2 text-sm font-medium text-foreground", children: [
|
|
2517
|
+
/* @__PURE__ */ jsx13(ListTodo, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
2518
|
+
/* @__PURE__ */ jsx13("span", { className: "truncate", children: t("chat.todos.summary", {
|
|
2519
|
+
total: snapshot.items.length,
|
|
2520
|
+
completed: completedCount
|
|
2521
|
+
}) })
|
|
2522
|
+
] }),
|
|
2523
|
+
/* @__PURE__ */ jsx13("div", { className: "flex items-center shrink-0", children: /* @__PURE__ */ jsx13(
|
|
2524
|
+
ChevronDown,
|
|
2525
|
+
{
|
|
2526
|
+
className: cn(
|
|
2527
|
+
"h-4 w-4 text-muted-foreground transition-transform",
|
|
2528
|
+
isCollapsed ? null : "rotate-180"
|
|
2529
|
+
)
|
|
2530
|
+
}
|
|
2531
|
+
) })
|
|
2532
|
+
]
|
|
2533
|
+
}
|
|
2534
|
+
),
|
|
2535
|
+
!isCollapsed && /* @__PURE__ */ jsx13("ol", { id: listId, className: "mt-3 space-y-2.5", children: snapshot.items.map((item, index) => /* @__PURE__ */ jsxs8(
|
|
2536
|
+
"li",
|
|
2537
|
+
{
|
|
2538
|
+
className: "grid min-w-0 grid-cols-[16px_24px_minmax(0,1fr)] items-start gap-2 overflow-hidden",
|
|
2539
|
+
children: [
|
|
2540
|
+
/* @__PURE__ */ jsx13(TodoStatusIcon, { status: item.status }),
|
|
2541
|
+
/* @__PURE__ */ jsxs8(
|
|
2542
|
+
"span",
|
|
2543
|
+
{
|
|
2544
|
+
className: cn(
|
|
2545
|
+
"text-sm leading-6 text-foreground",
|
|
2546
|
+
item.status === "completed" ? "text-muted-foreground" : null
|
|
2547
|
+
),
|
|
2548
|
+
children: [
|
|
2549
|
+
index + 1,
|
|
2550
|
+
"."
|
|
2551
|
+
]
|
|
2552
|
+
}
|
|
2553
|
+
),
|
|
2554
|
+
/* @__PURE__ */ jsx13(
|
|
2555
|
+
"span",
|
|
2556
|
+
{
|
|
2557
|
+
title: item.content,
|
|
2558
|
+
className: cn(
|
|
2559
|
+
"block min-w-0 truncate text-sm leading-6 text-foreground",
|
|
2560
|
+
item.status === "completed" ? "text-muted-foreground line-through" : item.status === "in_progress" ? "font-medium" : null
|
|
2561
|
+
),
|
|
2562
|
+
children: item.content
|
|
2563
|
+
}
|
|
2564
|
+
)
|
|
2565
|
+
]
|
|
2566
|
+
},
|
|
2567
|
+
item.id
|
|
2568
|
+
)) })
|
|
2569
|
+
]
|
|
2570
|
+
}
|
|
2571
|
+
);
|
|
2572
|
+
}
|
|
2573
|
+
|
|
2262
2574
|
// src/components/thread/messages/ai.tsx
|
|
2263
|
-
import * as
|
|
2264
|
-
import {
|
|
2575
|
+
import * as React16 from "react";
|
|
2576
|
+
import {
|
|
2577
|
+
ChevronDown as ChevronDown2,
|
|
2578
|
+
CheckCircle2 as CheckCircle22,
|
|
2579
|
+
Clock3,
|
|
2580
|
+
XCircle,
|
|
2581
|
+
Loader2 as Loader22
|
|
2582
|
+
} from "lucide-react";
|
|
2265
2583
|
|
|
2266
2584
|
// src/components/ui/badge.tsx
|
|
2267
|
-
import * as
|
|
2268
|
-
import { jsx as
|
|
2585
|
+
import * as React12 from "react";
|
|
2586
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2269
2587
|
var base = "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";
|
|
2270
2588
|
var variants = {
|
|
2271
2589
|
default: "bg-primary text-primary-foreground",
|
|
2272
2590
|
secondary: "bg-secondary text-secondary-foreground",
|
|
2273
2591
|
outline: "border-input text-foreground"
|
|
2274
2592
|
};
|
|
2275
|
-
var Badge =
|
|
2593
|
+
var Badge = React12.forwardRef(
|
|
2276
2594
|
({ className, variant = "default", ...props }, ref) => {
|
|
2277
|
-
return /* @__PURE__ */
|
|
2595
|
+
return /* @__PURE__ */ jsx14("span", { ref, className: cn(base, variants[variant], className), ...props });
|
|
2278
2596
|
}
|
|
2279
2597
|
);
|
|
2280
2598
|
Badge.displayName = "Badge";
|
|
2281
2599
|
|
|
2282
2600
|
// src/components/ui/card.tsx
|
|
2283
|
-
import * as
|
|
2284
|
-
import { jsx as
|
|
2285
|
-
var Card =
|
|
2286
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2601
|
+
import * as React13 from "react";
|
|
2602
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
2603
|
+
var Card = React13.forwardRef(
|
|
2604
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx15(
|
|
2287
2605
|
"div",
|
|
2288
2606
|
{
|
|
2289
2607
|
ref,
|
|
@@ -2296,50 +2614,50 @@ var Card = React12.forwardRef(
|
|
|
2296
2614
|
)
|
|
2297
2615
|
);
|
|
2298
2616
|
Card.displayName = "Card";
|
|
2299
|
-
var CardHeader =
|
|
2300
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2617
|
+
var CardHeader = React13.forwardRef(
|
|
2618
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx15("div", { ref, className: cn("flex flex-col gap-1.5 px-6 pt-6", className), ...props })
|
|
2301
2619
|
);
|
|
2302
2620
|
CardHeader.displayName = "CardHeader";
|
|
2303
|
-
var CardTitle =
|
|
2621
|
+
var CardTitle = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx15("h3", { ref, className: cn("text-lg font-semibold leading-tight", className), ...props }));
|
|
2304
2622
|
CardTitle.displayName = "CardTitle";
|
|
2305
|
-
var CardDescription =
|
|
2623
|
+
var CardDescription = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx15("p", { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
2306
2624
|
CardDescription.displayName = "CardDescription";
|
|
2307
|
-
var CardContent =
|
|
2308
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2625
|
+
var CardContent = React13.forwardRef(
|
|
2626
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx15("div", { ref, className: cn("px-6 pb-6", className), ...props })
|
|
2309
2627
|
);
|
|
2310
2628
|
CardContent.displayName = "CardContent";
|
|
2311
|
-
var CardFooter =
|
|
2312
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2629
|
+
var CardFooter = React13.forwardRef(
|
|
2630
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx15("div", { ref, className: cn("flex items-center px-6 pb-6", className), ...props })
|
|
2313
2631
|
);
|
|
2314
2632
|
CardFooter.displayName = "CardFooter";
|
|
2315
|
-
var CardAction =
|
|
2316
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2633
|
+
var CardAction = React13.forwardRef(
|
|
2634
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx15("div", { ref, className: cn("ml-auto flex items-center", className), ...props })
|
|
2317
2635
|
);
|
|
2318
2636
|
CardAction.displayName = "CardAction";
|
|
2319
2637
|
|
|
2320
2638
|
// src/components/ui/tabs.tsx
|
|
2321
|
-
import * as
|
|
2322
|
-
import { jsx as
|
|
2323
|
-
var TabsContext =
|
|
2639
|
+
import * as React14 from "react";
|
|
2640
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
2641
|
+
var TabsContext = React14.createContext(null);
|
|
2324
2642
|
function Tabs({ className, defaultValue, value, onValueChange, ...props }) {
|
|
2325
|
-
const [internalValue, setInternalValue] =
|
|
2643
|
+
const [internalValue, setInternalValue] = React14.useState(defaultValue ?? "");
|
|
2326
2644
|
const activeValue = value ?? internalValue;
|
|
2327
|
-
const setValue =
|
|
2645
|
+
const setValue = React14.useCallback(
|
|
2328
2646
|
(nextValue) => {
|
|
2329
2647
|
if (value === void 0) setInternalValue(nextValue);
|
|
2330
2648
|
onValueChange?.(nextValue);
|
|
2331
2649
|
},
|
|
2332
2650
|
[onValueChange, value]
|
|
2333
2651
|
);
|
|
2334
|
-
return /* @__PURE__ */
|
|
2652
|
+
return /* @__PURE__ */ jsx16(TabsContext.Provider, { value: { value: activeValue, setValue }, children: /* @__PURE__ */ jsx16("div", { className: cn("w-full", className), ...props }) });
|
|
2335
2653
|
}
|
|
2336
|
-
var TabsList =
|
|
2337
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2654
|
+
var TabsList = React14.forwardRef(
|
|
2655
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx16(
|
|
2338
2656
|
"div",
|
|
2339
2657
|
{
|
|
2340
2658
|
ref,
|
|
2341
2659
|
className: cn(
|
|
2342
|
-
"inline-flex
|
|
2660
|
+
"inline-flex items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
|
|
2343
2661
|
className
|
|
2344
2662
|
),
|
|
2345
2663
|
role: "tablist",
|
|
@@ -2348,14 +2666,14 @@ var TabsList = React13.forwardRef(
|
|
|
2348
2666
|
)
|
|
2349
2667
|
);
|
|
2350
2668
|
TabsList.displayName = "TabsList";
|
|
2351
|
-
var TabsTrigger =
|
|
2669
|
+
var TabsTrigger = React14.forwardRef(
|
|
2352
2670
|
({ className, value, onClick, ...props }, ref) => {
|
|
2353
|
-
const context =
|
|
2671
|
+
const context = React14.useContext(TabsContext);
|
|
2354
2672
|
if (!context) {
|
|
2355
2673
|
throw new Error("TabsTrigger must be used within Tabs");
|
|
2356
2674
|
}
|
|
2357
2675
|
const isActive = context.value === value;
|
|
2358
|
-
return /* @__PURE__ */
|
|
2676
|
+
return /* @__PURE__ */ jsx16(
|
|
2359
2677
|
"button",
|
|
2360
2678
|
{
|
|
2361
2679
|
ref,
|
|
@@ -2364,7 +2682,7 @@ var TabsTrigger = React13.forwardRef(
|
|
|
2364
2682
|
"aria-selected": isActive,
|
|
2365
2683
|
"data-state": isActive ? "active" : "inactive",
|
|
2366
2684
|
className: cn(
|
|
2367
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-
|
|
2685
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 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",
|
|
2368
2686
|
className
|
|
2369
2687
|
),
|
|
2370
2688
|
onClick: (event) => {
|
|
@@ -2377,14 +2695,14 @@ var TabsTrigger = React13.forwardRef(
|
|
|
2377
2695
|
}
|
|
2378
2696
|
);
|
|
2379
2697
|
TabsTrigger.displayName = "TabsTrigger";
|
|
2380
|
-
var TabsContent =
|
|
2698
|
+
var TabsContent = React14.forwardRef(
|
|
2381
2699
|
({ className, value, ...props }, ref) => {
|
|
2382
|
-
const context =
|
|
2700
|
+
const context = React14.useContext(TabsContext);
|
|
2383
2701
|
if (!context) {
|
|
2384
2702
|
throw new Error("TabsContent must be used within Tabs");
|
|
2385
2703
|
}
|
|
2386
2704
|
if (context.value !== value) return null;
|
|
2387
|
-
return /* @__PURE__ */
|
|
2705
|
+
return /* @__PURE__ */ jsx16(
|
|
2388
2706
|
"div",
|
|
2389
2707
|
{
|
|
2390
2708
|
ref,
|
|
@@ -2407,10 +2725,11 @@ import rehypeKatex from "rehype-katex";
|
|
|
2407
2725
|
import remarkMath from "remark-math";
|
|
2408
2726
|
import {
|
|
2409
2727
|
Children,
|
|
2728
|
+
isValidElement,
|
|
2410
2729
|
memo,
|
|
2411
|
-
useState as
|
|
2730
|
+
useState as useState8
|
|
2412
2731
|
} from "react";
|
|
2413
|
-
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
2732
|
+
import { CheckIcon as CheckIcon2, CopyIcon as CopyIcon2 } from "lucide-react";
|
|
2414
2733
|
|
|
2415
2734
|
// src/components/thread/syntax-highlighter.tsx
|
|
2416
2735
|
import { PrismAsyncLight as SyntaxHighlighterPrism } from "react-syntax-highlighter";
|
|
@@ -2418,7 +2737,7 @@ import tsx from "react-syntax-highlighter/dist/esm/languages/prism/tsx";
|
|
|
2418
2737
|
import python from "react-syntax-highlighter/dist/esm/languages/prism/python";
|
|
2419
2738
|
import { coldarkDark } from "react-syntax-highlighter/dist/cjs/styles/prism";
|
|
2420
2739
|
import "react";
|
|
2421
|
-
import { jsx as
|
|
2740
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2422
2741
|
SyntaxHighlighterPrism.registerLanguage("js", tsx);
|
|
2423
2742
|
SyntaxHighlighterPrism.registerLanguage("jsx", tsx);
|
|
2424
2743
|
SyntaxHighlighterPrism.registerLanguage("ts", tsx);
|
|
@@ -2429,7 +2748,7 @@ var SyntaxHighlighter = ({
|
|
|
2429
2748
|
language,
|
|
2430
2749
|
className
|
|
2431
2750
|
}) => {
|
|
2432
|
-
return /* @__PURE__ */
|
|
2751
|
+
return /* @__PURE__ */ jsx17(
|
|
2433
2752
|
SyntaxHighlighterPrism,
|
|
2434
2753
|
{
|
|
2435
2754
|
language,
|
|
@@ -2446,12 +2765,27 @@ var SyntaxHighlighter = ({
|
|
|
2446
2765
|
);
|
|
2447
2766
|
};
|
|
2448
2767
|
|
|
2768
|
+
// src/components/thread/mermaid-block.tsx
|
|
2769
|
+
import * as Dialog from "@radix-ui/react-dialog";
|
|
2770
|
+
import mermaid from "mermaid";
|
|
2771
|
+
import {
|
|
2772
|
+
CheckIcon,
|
|
2773
|
+
Code2Icon,
|
|
2774
|
+
CopyIcon,
|
|
2775
|
+
DownloadIcon,
|
|
2776
|
+
ExpandIcon,
|
|
2777
|
+
Loader2,
|
|
2778
|
+
TriangleAlert,
|
|
2779
|
+
X as X2
|
|
2780
|
+
} from "lucide-react";
|
|
2781
|
+
import * as React15 from "react";
|
|
2782
|
+
|
|
2449
2783
|
// src/components/thread/tooltip-icon-button.tsx
|
|
2450
2784
|
import { forwardRef as forwardRef5 } from "react";
|
|
2451
|
-
import { jsx as
|
|
2785
|
+
import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2452
2786
|
var TooltipIconButton = forwardRef5(({ children, tooltip, side = "bottom", className, ...rest }, ref) => {
|
|
2453
|
-
return /* @__PURE__ */
|
|
2454
|
-
/* @__PURE__ */
|
|
2787
|
+
return /* @__PURE__ */ jsx18(TooltipProvider, { children: /* @__PURE__ */ jsxs9(Tooltip, { children: [
|
|
2788
|
+
/* @__PURE__ */ jsx18(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs9(
|
|
2455
2789
|
Button,
|
|
2456
2790
|
{
|
|
2457
2791
|
variant: "ghost",
|
|
@@ -2461,28 +2795,525 @@ var TooltipIconButton = forwardRef5(({ children, tooltip, side = "bottom", class
|
|
|
2461
2795
|
ref,
|
|
2462
2796
|
children: [
|
|
2463
2797
|
children,
|
|
2464
|
-
/* @__PURE__ */
|
|
2798
|
+
/* @__PURE__ */ jsx18("span", { className: "sr-only", children: tooltip })
|
|
2465
2799
|
]
|
|
2466
2800
|
}
|
|
2467
2801
|
) }),
|
|
2468
|
-
/* @__PURE__ */
|
|
2802
|
+
/* @__PURE__ */ jsx18(TooltipContent, { side, children: tooltip })
|
|
2469
2803
|
] }) });
|
|
2470
2804
|
});
|
|
2471
2805
|
TooltipIconButton.displayName = "TooltipIconButton";
|
|
2472
2806
|
|
|
2807
|
+
// src/components/thread/mermaid-block.tsx
|
|
2808
|
+
import { Fragment as Fragment2, jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2809
|
+
var HEX_COLOR_PATTERN = /^#([\da-f]{3,8})$/i;
|
|
2810
|
+
var MERMAID_DIRECTIVE_PATTERN = /%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
|
|
2811
|
+
var MERMAID_FRONTMATTER_PATTERN = /^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s;
|
|
2812
|
+
var OKLCH_COLOR_PATTERN = /^oklch\((.+)\)$/i;
|
|
2813
|
+
var RGB_COLOR_PATTERN = /^rgba?\((.+)\)$/i;
|
|
2814
|
+
var MERMAID_SECURE_KEYS = [
|
|
2815
|
+
"fontFamily",
|
|
2816
|
+
"maxEdges",
|
|
2817
|
+
"maxTextSize",
|
|
2818
|
+
"securityLevel",
|
|
2819
|
+
"secure",
|
|
2820
|
+
"startOnLoad",
|
|
2821
|
+
"suppressErrorRendering",
|
|
2822
|
+
"theme",
|
|
2823
|
+
"themeVariables"
|
|
2824
|
+
];
|
|
2825
|
+
function clamp(value, min, max) {
|
|
2826
|
+
return Math.min(max, Math.max(min, value));
|
|
2827
|
+
}
|
|
2828
|
+
function normalizeMermaidCode(code) {
|
|
2829
|
+
return code.replace(MERMAID_FRONTMATTER_PATTERN, "").replace(MERMAID_DIRECTIVE_PATTERN, "").trim();
|
|
2830
|
+
}
|
|
2831
|
+
function parseAlpha(value) {
|
|
2832
|
+
if (!value) return 1;
|
|
2833
|
+
const normalized = value.trim();
|
|
2834
|
+
if (!normalized) return 1;
|
|
2835
|
+
if (normalized.endsWith("%")) {
|
|
2836
|
+
return clamp(Number.parseFloat(normalized) / 100, 0, 1);
|
|
2837
|
+
}
|
|
2838
|
+
return clamp(Number.parseFloat(normalized), 0, 1);
|
|
2839
|
+
}
|
|
2840
|
+
function parseHexColor(value) {
|
|
2841
|
+
const match = value.trim().match(HEX_COLOR_PATTERN);
|
|
2842
|
+
if (!match) return null;
|
|
2843
|
+
const hex = match[1];
|
|
2844
|
+
if (hex.length === 3 || hex.length === 4) {
|
|
2845
|
+
const [r, g, b, a = "f"] = hex.split("");
|
|
2846
|
+
return {
|
|
2847
|
+
r: Number.parseInt(r + r, 16),
|
|
2848
|
+
g: Number.parseInt(g + g, 16),
|
|
2849
|
+
b: Number.parseInt(b + b, 16),
|
|
2850
|
+
a: Number.parseInt(a + a, 16) / 255
|
|
2851
|
+
};
|
|
2852
|
+
}
|
|
2853
|
+
if (hex.length === 6 || hex.length === 8) {
|
|
2854
|
+
const alphaHex = hex.length === 8 ? hex.slice(6, 8) : "ff";
|
|
2855
|
+
return {
|
|
2856
|
+
r: Number.parseInt(hex.slice(0, 2), 16),
|
|
2857
|
+
g: Number.parseInt(hex.slice(2, 4), 16),
|
|
2858
|
+
b: Number.parseInt(hex.slice(4, 6), 16),
|
|
2859
|
+
a: Number.parseInt(alphaHex, 16) / 255
|
|
2860
|
+
};
|
|
2861
|
+
}
|
|
2862
|
+
return null;
|
|
2863
|
+
}
|
|
2864
|
+
function parseRgbChannel(value) {
|
|
2865
|
+
const normalized = value.trim();
|
|
2866
|
+
if (normalized.endsWith("%")) {
|
|
2867
|
+
return clamp(Math.round(Number.parseFloat(normalized) / 100 * 255), 0, 255);
|
|
2868
|
+
}
|
|
2869
|
+
return clamp(Math.round(Number.parseFloat(normalized)), 0, 255);
|
|
2870
|
+
}
|
|
2871
|
+
function parseRgbColor(value) {
|
|
2872
|
+
const match = value.trim().match(RGB_COLOR_PATTERN);
|
|
2873
|
+
if (!match) return null;
|
|
2874
|
+
const parts = match[1].split(/[,\s/]+/).map((part) => part.trim()).filter(Boolean);
|
|
2875
|
+
if (parts.length < 3) return null;
|
|
2876
|
+
return {
|
|
2877
|
+
r: parseRgbChannel(parts[0]),
|
|
2878
|
+
g: parseRgbChannel(parts[1]),
|
|
2879
|
+
b: parseRgbChannel(parts[2]),
|
|
2880
|
+
a: parseAlpha(parts[3])
|
|
2881
|
+
};
|
|
2882
|
+
}
|
|
2883
|
+
function parseOklchLightness(value) {
|
|
2884
|
+
const normalized = value.trim();
|
|
2885
|
+
if (normalized.endsWith("%")) {
|
|
2886
|
+
return clamp(Number.parseFloat(normalized) / 100, 0, 1);
|
|
2887
|
+
}
|
|
2888
|
+
return clamp(Number.parseFloat(normalized), 0, 1);
|
|
2889
|
+
}
|
|
2890
|
+
function parseHue(value) {
|
|
2891
|
+
const normalized = value.trim().toLowerCase();
|
|
2892
|
+
const numeric = Number.parseFloat(normalized);
|
|
2893
|
+
if (Number.isNaN(numeric)) return 0;
|
|
2894
|
+
if (normalized.endsWith("turn")) return numeric * 360;
|
|
2895
|
+
if (normalized.endsWith("rad")) return numeric * (180 / Math.PI);
|
|
2896
|
+
if (normalized.endsWith("grad")) return numeric * 0.9;
|
|
2897
|
+
return numeric;
|
|
2898
|
+
}
|
|
2899
|
+
function linearToSrgb(linear) {
|
|
2900
|
+
if (linear <= 31308e-7) {
|
|
2901
|
+
return 12.92 * linear;
|
|
2902
|
+
}
|
|
2903
|
+
return 1.055 * Math.pow(linear, 1 / 2.4) - 0.055;
|
|
2904
|
+
}
|
|
2905
|
+
function parseOklchColor(value) {
|
|
2906
|
+
const match = value.trim().match(OKLCH_COLOR_PATTERN);
|
|
2907
|
+
if (!match) return null;
|
|
2908
|
+
const [base2, alphaSegment] = match[1].split("/");
|
|
2909
|
+
const parts = base2.trim().split(/\s+/).map((part) => part.trim()).filter(Boolean);
|
|
2910
|
+
if (parts.length < 3) return null;
|
|
2911
|
+
const lightness = parseOklchLightness(parts[0]);
|
|
2912
|
+
const chroma = Number.parseFloat(parts[1]);
|
|
2913
|
+
const hueRadians = parseHue(parts[2]) * Math.PI / 180;
|
|
2914
|
+
const alpha = parseAlpha(alphaSegment);
|
|
2915
|
+
const a = chroma * Math.cos(hueRadians);
|
|
2916
|
+
const b = chroma * Math.sin(hueRadians);
|
|
2917
|
+
const l_ = lightness + 0.3963377774 * a + 0.2158037573 * b;
|
|
2918
|
+
const m_ = lightness - 0.1055613458 * a - 0.0638541728 * b;
|
|
2919
|
+
const s_ = lightness - 0.0894841775 * a - 1.291485548 * b;
|
|
2920
|
+
const l = l_ * l_ * l_;
|
|
2921
|
+
const m = m_ * m_ * m_;
|
|
2922
|
+
const s = s_ * s_ * s_;
|
|
2923
|
+
const linearR = 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s;
|
|
2924
|
+
const linearG = -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s;
|
|
2925
|
+
const linearB = -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s;
|
|
2926
|
+
return {
|
|
2927
|
+
r: clamp(Math.round(linearToSrgb(linearR) * 255), 0, 255),
|
|
2928
|
+
g: clamp(Math.round(linearToSrgb(linearG) * 255), 0, 255),
|
|
2929
|
+
b: clamp(Math.round(linearToSrgb(linearB) * 255), 0, 255),
|
|
2930
|
+
a: alpha
|
|
2931
|
+
};
|
|
2932
|
+
}
|
|
2933
|
+
function parseCssColor(value) {
|
|
2934
|
+
const normalized = value.trim();
|
|
2935
|
+
if (!normalized) return null;
|
|
2936
|
+
return parseHexColor(normalized) ?? parseRgbColor(normalized) ?? parseOklchColor(normalized);
|
|
2937
|
+
}
|
|
2938
|
+
function compositeColor(foreground, background) {
|
|
2939
|
+
const alpha = foreground.a + background.a * (1 - foreground.a);
|
|
2940
|
+
if (alpha <= 0) {
|
|
2941
|
+
return { r: 0, g: 0, b: 0, a: 0 };
|
|
2942
|
+
}
|
|
2943
|
+
const r = (foreground.r * foreground.a + background.r * background.a * (1 - foreground.a)) / alpha;
|
|
2944
|
+
const g = (foreground.g * foreground.a + background.g * background.a * (1 - foreground.a)) / alpha;
|
|
2945
|
+
const b = (foreground.b * foreground.a + background.b * background.a * (1 - foreground.a)) / alpha;
|
|
2946
|
+
return {
|
|
2947
|
+
r: clamp(Math.round(r), 0, 255),
|
|
2948
|
+
g: clamp(Math.round(g), 0, 255),
|
|
2949
|
+
b: clamp(Math.round(b), 0, 255),
|
|
2950
|
+
a: clamp(alpha, 0, 1)
|
|
2951
|
+
};
|
|
2952
|
+
}
|
|
2953
|
+
function toHexChannel(value) {
|
|
2954
|
+
return value.toString(16).padStart(2, "0");
|
|
2955
|
+
}
|
|
2956
|
+
function rgbaToHex(value) {
|
|
2957
|
+
return `#${toHexChannel(value.r)}${toHexChannel(value.g)}${toHexChannel(value.b)}`;
|
|
2958
|
+
}
|
|
2959
|
+
function getFallbackPalette(isDarkMode) {
|
|
2960
|
+
if (isDarkMode) {
|
|
2961
|
+
return {
|
|
2962
|
+
background: "#171717",
|
|
2963
|
+
border: "#52525b",
|
|
2964
|
+
fontFamily: "Inter Variable, sans-serif",
|
|
2965
|
+
line: "#a1a1aa",
|
|
2966
|
+
surface: "#262626",
|
|
2967
|
+
surfaceAlt: "#3f3f46",
|
|
2968
|
+
text: "#fafafa"
|
|
2969
|
+
};
|
|
2970
|
+
}
|
|
2971
|
+
return {
|
|
2972
|
+
background: "#ffffff",
|
|
2973
|
+
border: "#e4e4e7",
|
|
2974
|
+
fontFamily: "Inter Variable, sans-serif",
|
|
2975
|
+
line: "#71717a",
|
|
2976
|
+
surface: "#ffffff",
|
|
2977
|
+
surfaceAlt: "#f4f4f5",
|
|
2978
|
+
text: "#18181b"
|
|
2979
|
+
};
|
|
2980
|
+
}
|
|
2981
|
+
function resolveColor(styles, property, fallback, background) {
|
|
2982
|
+
const parsed = parseCssColor(styles.getPropertyValue(property));
|
|
2983
|
+
if (!parsed) return fallback;
|
|
2984
|
+
if (parsed.a < 1 && background) {
|
|
2985
|
+
return rgbaToHex(compositeColor(parsed, background));
|
|
2986
|
+
}
|
|
2987
|
+
return rgbaToHex(parsed);
|
|
2988
|
+
}
|
|
2989
|
+
function resolvePalette(element, isDarkMode) {
|
|
2990
|
+
const fallback = getFallbackPalette(isDarkMode);
|
|
2991
|
+
const styles = window.getComputedStyle(element);
|
|
2992
|
+
const backgroundColor = parseCssColor(styles.getPropertyValue("--card")) ?? parseCssColor(styles.getPropertyValue("--background")) ?? parseCssColor(fallback.surface);
|
|
2993
|
+
return {
|
|
2994
|
+
background: resolveColor(styles, "--background", fallback.background, backgroundColor),
|
|
2995
|
+
border: resolveColor(styles, "--border", fallback.border, backgroundColor),
|
|
2996
|
+
fontFamily: styles.getPropertyValue("font-family").trim() || fallback.fontFamily,
|
|
2997
|
+
line: resolveColor(styles, "--muted-foreground", fallback.line, backgroundColor),
|
|
2998
|
+
surface: resolveColor(styles, "--card", fallback.surface, backgroundColor),
|
|
2999
|
+
surfaceAlt: resolveColor(styles, "--muted", fallback.surfaceAlt, backgroundColor),
|
|
3000
|
+
text: resolveColor(styles, "--foreground", fallback.text, backgroundColor)
|
|
3001
|
+
};
|
|
3002
|
+
}
|
|
3003
|
+
function buildThemeVariables(palette) {
|
|
3004
|
+
return {
|
|
3005
|
+
background: palette.background,
|
|
3006
|
+
clusterBkg: palette.surfaceAlt,
|
|
3007
|
+
clusterBorder: palette.border,
|
|
3008
|
+
edgeLabelBackground: palette.surface,
|
|
3009
|
+
fontFamily: palette.fontFamily,
|
|
3010
|
+
lineColor: palette.line,
|
|
3011
|
+
mainBkg: palette.surface,
|
|
3012
|
+
nodeBorder: palette.border,
|
|
3013
|
+
nodeTextColor: palette.text,
|
|
3014
|
+
primaryBorderColor: palette.border,
|
|
3015
|
+
primaryColor: palette.surfaceAlt,
|
|
3016
|
+
primaryTextColor: palette.text,
|
|
3017
|
+
secondaryBorderColor: palette.border,
|
|
3018
|
+
secondaryColor: palette.surface,
|
|
3019
|
+
secondaryTextColor: palette.text,
|
|
3020
|
+
tertiaryBorderColor: palette.border,
|
|
3021
|
+
tertiaryColor: palette.surface,
|
|
3022
|
+
tertiaryTextColor: palette.text,
|
|
3023
|
+
textColor: palette.text
|
|
3024
|
+
};
|
|
3025
|
+
}
|
|
3026
|
+
async function renderMermaidDiagram({
|
|
3027
|
+
code,
|
|
3028
|
+
host,
|
|
3029
|
+
id,
|
|
3030
|
+
palette
|
|
3031
|
+
}) {
|
|
3032
|
+
host.innerHTML = "";
|
|
3033
|
+
mermaid.initialize({
|
|
3034
|
+
flowchart: {
|
|
3035
|
+
htmlLabels: false,
|
|
3036
|
+
useMaxWidth: true
|
|
3037
|
+
},
|
|
3038
|
+
fontFamily: palette.fontFamily,
|
|
3039
|
+
secure: [...MERMAID_SECURE_KEYS],
|
|
3040
|
+
securityLevel: "strict",
|
|
3041
|
+
startOnLoad: false,
|
|
3042
|
+
theme: "base",
|
|
3043
|
+
themeVariables: buildThemeVariables(palette)
|
|
3044
|
+
});
|
|
3045
|
+
const { svg } = await mermaid.render(id, code, host);
|
|
3046
|
+
host.innerHTML = "";
|
|
3047
|
+
return svg;
|
|
3048
|
+
}
|
|
3049
|
+
function MermaidPreviewDialog({
|
|
3050
|
+
closeLabel,
|
|
3051
|
+
onOpenChange,
|
|
3052
|
+
open,
|
|
3053
|
+
svgMarkup,
|
|
3054
|
+
title
|
|
3055
|
+
}) {
|
|
3056
|
+
return /* @__PURE__ */ jsx19(Dialog.Root, { open, onOpenChange, children: /* @__PURE__ */ jsxs10(Dialog.Portal, { children: [
|
|
3057
|
+
/* @__PURE__ */ jsx19(Dialog.Overlay, { className: "fixed inset-0 z-50 bg-black/60 backdrop-blur-sm data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" }),
|
|
3058
|
+
/* @__PURE__ */ jsxs10(Dialog.Content, { className: "fixed inset-[5vh] z-50 flex flex-col overflow-hidden rounded-3xl border border-border bg-background shadow-2xl outline-none data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", children: [
|
|
3059
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between gap-4 border-b border-border px-5 py-4", children: [
|
|
3060
|
+
/* @__PURE__ */ jsx19(Dialog.Title, { className: "text-base font-semibold text-foreground", children: title }),
|
|
3061
|
+
/* @__PURE__ */ jsx19(Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsxs10(
|
|
3062
|
+
"button",
|
|
3063
|
+
{
|
|
3064
|
+
type: "button",
|
|
3065
|
+
className: "inline-flex size-10 items-center justify-center rounded-full border border-border bg-card text-muted-foreground transition-colors hover:text-foreground",
|
|
3066
|
+
children: [
|
|
3067
|
+
/* @__PURE__ */ jsx19(X2, { className: "size-4" }),
|
|
3068
|
+
/* @__PURE__ */ jsx19("span", { className: "sr-only", children: closeLabel })
|
|
3069
|
+
]
|
|
3070
|
+
}
|
|
3071
|
+
) })
|
|
3072
|
+
] }),
|
|
3073
|
+
/* @__PURE__ */ jsx19("div", { className: "flex-1 overflow-auto bg-card p-6", children: /* @__PURE__ */ jsx19(
|
|
3074
|
+
"div",
|
|
3075
|
+
{
|
|
3076
|
+
"data-slot": "mermaid-preview",
|
|
3077
|
+
className: "min-h-full rounded-[calc(var(--radius)+0.5rem)] border border-border bg-background p-6 [&_svg]:mx-auto [&_svg]:h-auto [&_svg]:max-w-none",
|
|
3078
|
+
dangerouslySetInnerHTML: { __html: svgMarkup }
|
|
3079
|
+
}
|
|
3080
|
+
) })
|
|
3081
|
+
] })
|
|
3082
|
+
] }) });
|
|
3083
|
+
}
|
|
3084
|
+
function MermaidBlock({ code }) {
|
|
3085
|
+
const { t } = useChatkitTranslation();
|
|
3086
|
+
const { theme, isDarkMode } = useTheme();
|
|
3087
|
+
const containerRef = React15.useRef(null);
|
|
3088
|
+
const renderHostRef = React15.useRef(null);
|
|
3089
|
+
const renderSequenceRef = React15.useRef(0);
|
|
3090
|
+
const copyResetTimeoutRef = React15.useRef(null);
|
|
3091
|
+
const diagramId = React15.useId().replace(/:/g, "");
|
|
3092
|
+
const [activeTab, setActiveTab] = React15.useState("diagram");
|
|
3093
|
+
const [isCopied, setIsCopied] = React15.useState(false);
|
|
3094
|
+
const [isPreviewOpen, setIsPreviewOpen] = React15.useState(false);
|
|
3095
|
+
const [isRendering, setIsRendering] = React15.useState(true);
|
|
3096
|
+
const [renderError, setRenderError] = React15.useState(null);
|
|
3097
|
+
const [svgMarkup, setSvgMarkup] = React15.useState(null);
|
|
3098
|
+
const normalizedCode = React15.useMemo(() => normalizeMermaidCode(code), [code]);
|
|
3099
|
+
const clearCopyResetTimeout = React15.useCallback(() => {
|
|
3100
|
+
if (copyResetTimeoutRef.current === null) return;
|
|
3101
|
+
window.clearTimeout(copyResetTimeoutRef.current);
|
|
3102
|
+
copyResetTimeoutRef.current = null;
|
|
3103
|
+
}, []);
|
|
3104
|
+
React15.useEffect(() => {
|
|
3105
|
+
let isActive = true;
|
|
3106
|
+
async function runRender() {
|
|
3107
|
+
const container = containerRef.current;
|
|
3108
|
+
const renderHost = renderHostRef.current;
|
|
3109
|
+
if (!container || !renderHost) return;
|
|
3110
|
+
setIsRendering(true);
|
|
3111
|
+
setRenderError(null);
|
|
3112
|
+
try {
|
|
3113
|
+
renderSequenceRef.current += 1;
|
|
3114
|
+
const svg = await renderMermaidDiagram({
|
|
3115
|
+
code: normalizedCode,
|
|
3116
|
+
host: renderHost,
|
|
3117
|
+
id: `mermaid-${diagramId}-${renderSequenceRef.current}`,
|
|
3118
|
+
palette: resolvePalette(container, isDarkMode)
|
|
3119
|
+
});
|
|
3120
|
+
if (!isActive) return;
|
|
3121
|
+
setSvgMarkup(svg);
|
|
3122
|
+
} catch (error) {
|
|
3123
|
+
if (!isActive) return;
|
|
3124
|
+
setSvgMarkup(null);
|
|
3125
|
+
setRenderError(error instanceof Error ? error.message : "render_failed");
|
|
3126
|
+
setActiveTab((currentTab) => currentTab === "diagram" ? "code" : currentTab);
|
|
3127
|
+
} finally {
|
|
3128
|
+
if (isActive) {
|
|
3129
|
+
setIsRendering(false);
|
|
3130
|
+
renderHost.innerHTML = "";
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3134
|
+
void runRender();
|
|
3135
|
+
return () => {
|
|
3136
|
+
isActive = false;
|
|
3137
|
+
if (renderHostRef.current) {
|
|
3138
|
+
renderHostRef.current.innerHTML = "";
|
|
3139
|
+
}
|
|
3140
|
+
};
|
|
3141
|
+
}, [diagramId, isDarkMode, normalizedCode, theme]);
|
|
3142
|
+
React15.useEffect(() => {
|
|
3143
|
+
clearCopyResetTimeout();
|
|
3144
|
+
setIsCopied(false);
|
|
3145
|
+
}, [activeTab, clearCopyResetTimeout, code]);
|
|
3146
|
+
React15.useEffect(
|
|
3147
|
+
() => () => {
|
|
3148
|
+
clearCopyResetTimeout();
|
|
3149
|
+
},
|
|
3150
|
+
[clearCopyResetTimeout]
|
|
3151
|
+
);
|
|
3152
|
+
const handleDownload = React15.useCallback(() => {
|
|
3153
|
+
if (!svgMarkup) return;
|
|
3154
|
+
const blob = new Blob([svgMarkup], {
|
|
3155
|
+
type: "image/svg+xml;charset=utf-8"
|
|
3156
|
+
});
|
|
3157
|
+
const url = window.URL.createObjectURL(blob);
|
|
3158
|
+
const anchor = document.createElement("a");
|
|
3159
|
+
anchor.href = url;
|
|
3160
|
+
anchor.download = `mermaid-diagram-${diagramId}.svg`;
|
|
3161
|
+
document.body.append(anchor);
|
|
3162
|
+
anchor.click();
|
|
3163
|
+
anchor.remove();
|
|
3164
|
+
window.URL.revokeObjectURL(url);
|
|
3165
|
+
}, [diagramId, svgMarkup]);
|
|
3166
|
+
const handleCopyCode = React15.useCallback(() => {
|
|
3167
|
+
if (!code || isCopied) return;
|
|
3168
|
+
navigator.clipboard.writeText(code).then(() => {
|
|
3169
|
+
setIsCopied(true);
|
|
3170
|
+
clearCopyResetTimeout();
|
|
3171
|
+
copyResetTimeoutRef.current = window.setTimeout(() => {
|
|
3172
|
+
setIsCopied(false);
|
|
3173
|
+
copyResetTimeoutRef.current = null;
|
|
3174
|
+
}, 3e3);
|
|
3175
|
+
}).catch(() => {
|
|
3176
|
+
});
|
|
3177
|
+
}, [clearCopyResetTimeout, code, isCopied]);
|
|
3178
|
+
const hasRenderedDiagram = svgMarkup !== null && !renderError;
|
|
3179
|
+
const statusMessage = isRendering ? t("markdown.mermaid.rendering") : t("markdown.mermaid.failed");
|
|
3180
|
+
return /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
3181
|
+
/* @__PURE__ */ jsx19(
|
|
3182
|
+
Tabs,
|
|
3183
|
+
{
|
|
3184
|
+
className: "w-full",
|
|
3185
|
+
onValueChange: (value) => setActiveTab(value),
|
|
3186
|
+
value: activeTab,
|
|
3187
|
+
children: /* @__PURE__ */ jsxs10(
|
|
3188
|
+
"div",
|
|
3189
|
+
{
|
|
3190
|
+
ref: containerRef,
|
|
3191
|
+
"data-slot": "mermaid-block",
|
|
3192
|
+
className: "relative overflow-hidden text-card-foreground",
|
|
3193
|
+
children: [
|
|
3194
|
+
/* @__PURE__ */ jsx19(
|
|
3195
|
+
"div",
|
|
3196
|
+
{
|
|
3197
|
+
ref: renderHostRef,
|
|
3198
|
+
"aria-hidden": "true",
|
|
3199
|
+
className: "pointer-events-none absolute inset-0 -z-10 overflow-hidden opacity-0",
|
|
3200
|
+
"data-slot": "mermaid-render-host"
|
|
3201
|
+
}
|
|
3202
|
+
),
|
|
3203
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap items-center justify-between gap-3 px-4 py-3", children: [
|
|
3204
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
3205
|
+
/* @__PURE__ */ jsx19("span", { className: "inline-flex size-9 shrink-0 items-center justify-center rounded-full bg-muted text-foreground", children: /* @__PURE__ */ jsx19(Code2Icon, { className: "size-4" }) }),
|
|
3206
|
+
/* @__PURE__ */ jsx19("span", { className: "truncate text-base font-semibold text-foreground", children: t("markdown.mermaid.title") })
|
|
3207
|
+
] }),
|
|
3208
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex shrink-0 items-center gap-2", children: [
|
|
3209
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
3210
|
+
activeTab === "diagram" && hasRenderedDiagram ? /* @__PURE__ */ jsx19(
|
|
3211
|
+
TooltipIconButton,
|
|
3212
|
+
{
|
|
3213
|
+
onClick: handleDownload,
|
|
3214
|
+
tooltip: t("markdown.mermaid.download"),
|
|
3215
|
+
children: /* @__PURE__ */ jsx19(DownloadIcon, { className: "size-4" })
|
|
3216
|
+
}
|
|
3217
|
+
) : null,
|
|
3218
|
+
activeTab === "diagram" && hasRenderedDiagram ? /* @__PURE__ */ jsx19(
|
|
3219
|
+
TooltipIconButton,
|
|
3220
|
+
{
|
|
3221
|
+
onClick: () => setIsPreviewOpen(true),
|
|
3222
|
+
tooltip: t("markdown.mermaid.fullScreen"),
|
|
3223
|
+
children: /* @__PURE__ */ jsx19(ExpandIcon, { className: "size-4" })
|
|
3224
|
+
}
|
|
3225
|
+
) : null,
|
|
3226
|
+
activeTab === "code" ? /* @__PURE__ */ jsx19(
|
|
3227
|
+
TooltipIconButton,
|
|
3228
|
+
{
|
|
3229
|
+
onClick: handleCopyCode,
|
|
3230
|
+
tooltip: t("markdown.copy"),
|
|
3231
|
+
children: isCopied ? /* @__PURE__ */ jsx19(CheckIcon, { className: "size-4" }) : /* @__PURE__ */ jsx19(CopyIcon, { className: "size-4" })
|
|
3232
|
+
}
|
|
3233
|
+
) : null
|
|
3234
|
+
] }),
|
|
3235
|
+
/* @__PURE__ */ jsxs10(TabsList, { children: [
|
|
3236
|
+
/* @__PURE__ */ jsx19(TabsTrigger, { value: "diagram", children: t("markdown.mermaid.diagram") }),
|
|
3237
|
+
/* @__PURE__ */ jsx19(TabsTrigger, { value: "code", children: t("markdown.mermaid.code") })
|
|
3238
|
+
] })
|
|
3239
|
+
] })
|
|
3240
|
+
] }),
|
|
3241
|
+
/* @__PURE__ */ jsxs10("div", { className: "border-t border-border pt-4", children: [
|
|
3242
|
+
renderError ? /* @__PURE__ */ jsx19("p", { role: "alert", className: "mb-4 text-sm font-medium text-destructive", children: t("markdown.mermaid.failed") }) : null,
|
|
3243
|
+
/* @__PURE__ */ jsx19(TabsContent, { value: "diagram", className: "mt-0 space-y-4", children: /* @__PURE__ */ jsx19(
|
|
3244
|
+
"div",
|
|
3245
|
+
{
|
|
3246
|
+
className: cn(
|
|
3247
|
+
"relative overflow-auto rounded-[calc(var(--radius)+0.5rem)] border border-border bg-background p-4",
|
|
3248
|
+
hasRenderedDiagram ? "[&_svg]:mx-auto [&_svg]:h-auto [&_svg]:w-full [&_svg]:max-w-none" : "min-h-[14rem]"
|
|
3249
|
+
),
|
|
3250
|
+
children: hasRenderedDiagram ? /* @__PURE__ */ jsx19(
|
|
3251
|
+
"div",
|
|
3252
|
+
{
|
|
3253
|
+
"data-slot": "mermaid-diagram",
|
|
3254
|
+
dangerouslySetInnerHTML: { __html: svgMarkup }
|
|
3255
|
+
}
|
|
3256
|
+
) : /* @__PURE__ */ jsxs10("div", { className: "flex min-h-[12rem] flex-col items-center justify-center gap-3 text-center text-muted-foreground", children: [
|
|
3257
|
+
isRendering ? /* @__PURE__ */ jsx19(Loader2, { className: "size-5 animate-spin" }) : /* @__PURE__ */ jsx19(TriangleAlert, { className: "size-5 text-destructive" }),
|
|
3258
|
+
/* @__PURE__ */ jsx19(
|
|
3259
|
+
"p",
|
|
3260
|
+
{
|
|
3261
|
+
className: cn("text-sm font-medium", !isRendering && "text-destructive"),
|
|
3262
|
+
role: renderError ? "alert" : void 0,
|
|
3263
|
+
children: statusMessage
|
|
3264
|
+
}
|
|
3265
|
+
)
|
|
3266
|
+
] })
|
|
3267
|
+
}
|
|
3268
|
+
) }),
|
|
3269
|
+
/* @__PURE__ */ jsx19(TabsContent, { value: "code", className: "mt-0", children: /* @__PURE__ */ jsx19(
|
|
3270
|
+
"pre",
|
|
3271
|
+
{
|
|
3272
|
+
"data-slot": "mermaid-code",
|
|
3273
|
+
className: "overflow-x-auto rounded-[calc(var(--radius)+0.5rem)] border border-border bg-zinc-950 px-4 py-4 text-sm text-zinc-50",
|
|
3274
|
+
children: /* @__PURE__ */ jsx19("code", { className: "block whitespace-pre font-mono", children: code })
|
|
3275
|
+
}
|
|
3276
|
+
) })
|
|
3277
|
+
] })
|
|
3278
|
+
]
|
|
3279
|
+
}
|
|
3280
|
+
)
|
|
3281
|
+
}
|
|
3282
|
+
),
|
|
3283
|
+
svgMarkup ? /* @__PURE__ */ jsx19(
|
|
3284
|
+
MermaidPreviewDialog,
|
|
3285
|
+
{
|
|
3286
|
+
closeLabel: t("sheet.close"),
|
|
3287
|
+
onOpenChange: setIsPreviewOpen,
|
|
3288
|
+
open: isPreviewOpen,
|
|
3289
|
+
svgMarkup,
|
|
3290
|
+
title: t("markdown.mermaid.title")
|
|
3291
|
+
}
|
|
3292
|
+
) : null
|
|
3293
|
+
] });
|
|
3294
|
+
}
|
|
3295
|
+
|
|
2473
3296
|
// src/components/thread/markdown-text.tsx
|
|
2474
3297
|
import "katex/dist/katex.min.css";
|
|
2475
|
-
import { Fragment as
|
|
3298
|
+
import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3299
|
+
var markdownTableMinWidth = "max(7rem, calc(8rem * var(--density-spacing, 1)))";
|
|
3300
|
+
var markdownTableCellPaddingInline = "calc(var(--density-padding, 1rem) * 1.25)";
|
|
3301
|
+
var markdownTableCellPaddingBlock = "max(0.5rem, calc(var(--density-padding, 1rem) * 0.75))";
|
|
3302
|
+
var markdownTableLineHeight = "max(1.375rem, calc(1.5rem * var(--density-spacing, 1)))";
|
|
3303
|
+
var markdownInlineCodePaddingInline = "max(0.25rem, calc(var(--density-gap, 0.5rem) * 0.75))";
|
|
3304
|
+
var markdownInlineCodePaddingBlock = "max(0.125rem, calc(var(--density-gap, 0.5rem) * 0.5))";
|
|
2476
3305
|
var getTextContent = (children) => Children.toArray(children).map((child) => {
|
|
2477
3306
|
if (typeof child === "string" || typeof child === "number") {
|
|
2478
3307
|
return String(child);
|
|
2479
3308
|
}
|
|
2480
3309
|
return "";
|
|
2481
3310
|
}).join("");
|
|
3311
|
+
var isMermaidBlockChild = (child) => isValidElement(child) && child.type === MermaidBlock;
|
|
3312
|
+
var isMermaidCodeElement = (child) => isValidElement(child) && typeof child.props.className === "string" && child.props.className.includes("language-mermaid");
|
|
2482
3313
|
var useCopyToClipboard = ({
|
|
2483
3314
|
copiedDuration = 3e3
|
|
2484
3315
|
} = {}) => {
|
|
2485
|
-
const [isCopied, setIsCopied] =
|
|
3316
|
+
const [isCopied, setIsCopied] = useState8(false);
|
|
2486
3317
|
const copyToClipboard = (value) => {
|
|
2487
3318
|
if (!value) return;
|
|
2488
3319
|
navigator.clipboard.writeText(value).then(() => {
|
|
@@ -2499,23 +3330,23 @@ var CodeHeader = ({ language, code }) => {
|
|
|
2499
3330
|
if (!code || isCopied) return;
|
|
2500
3331
|
copyToClipboard(code);
|
|
2501
3332
|
};
|
|
2502
|
-
return /* @__PURE__ */
|
|
2503
|
-
/* @__PURE__ */
|
|
2504
|
-
/* @__PURE__ */
|
|
3333
|
+
return /* @__PURE__ */ jsxs11("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: [
|
|
3334
|
+
/* @__PURE__ */ jsx20("span", { className: "lowercase [&>span]:text-xs", children: language }),
|
|
3335
|
+
/* @__PURE__ */ jsxs11(
|
|
2505
3336
|
TooltipIconButton,
|
|
2506
3337
|
{
|
|
2507
3338
|
tooltip: t("markdown.copy"),
|
|
2508
3339
|
onClick: onCopy,
|
|
2509
3340
|
children: [
|
|
2510
|
-
!isCopied && /* @__PURE__ */
|
|
2511
|
-
isCopied && /* @__PURE__ */
|
|
3341
|
+
!isCopied && /* @__PURE__ */ jsx20(CopyIcon2, {}),
|
|
3342
|
+
isCopied && /* @__PURE__ */ jsx20(CheckIcon2, {})
|
|
2512
3343
|
]
|
|
2513
3344
|
}
|
|
2514
3345
|
)
|
|
2515
3346
|
] });
|
|
2516
3347
|
};
|
|
2517
3348
|
var defaultComponents = {
|
|
2518
|
-
h1: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3349
|
+
h1: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx20(
|
|
2519
3350
|
"h1",
|
|
2520
3351
|
{
|
|
2521
3352
|
className: cn(
|
|
@@ -2525,7 +3356,7 @@ var defaultComponents = {
|
|
|
2525
3356
|
...props
|
|
2526
3357
|
}
|
|
2527
3358
|
),
|
|
2528
|
-
h2: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3359
|
+
h2: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx20(
|
|
2529
3360
|
"h2",
|
|
2530
3361
|
{
|
|
2531
3362
|
className: cn(
|
|
@@ -2535,7 +3366,7 @@ var defaultComponents = {
|
|
|
2535
3366
|
...props
|
|
2536
3367
|
}
|
|
2537
3368
|
),
|
|
2538
|
-
h3: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3369
|
+
h3: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx20(
|
|
2539
3370
|
"h3",
|
|
2540
3371
|
{
|
|
2541
3372
|
className: cn(
|
|
@@ -2545,7 +3376,7 @@ var defaultComponents = {
|
|
|
2545
3376
|
...props
|
|
2546
3377
|
}
|
|
2547
3378
|
),
|
|
2548
|
-
h4: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3379
|
+
h4: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx20(
|
|
2549
3380
|
"h4",
|
|
2550
3381
|
{
|
|
2551
3382
|
className: cn(
|
|
@@ -2555,7 +3386,7 @@ var defaultComponents = {
|
|
|
2555
3386
|
...props
|
|
2556
3387
|
}
|
|
2557
3388
|
),
|
|
2558
|
-
h5: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3389
|
+
h5: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx20(
|
|
2559
3390
|
"h5",
|
|
2560
3391
|
{
|
|
2561
3392
|
className: cn(
|
|
@@ -2565,21 +3396,21 @@ var defaultComponents = {
|
|
|
2565
3396
|
...props
|
|
2566
3397
|
}
|
|
2567
3398
|
),
|
|
2568
|
-
h6: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3399
|
+
h6: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx20(
|
|
2569
3400
|
"h6",
|
|
2570
3401
|
{
|
|
2571
3402
|
className: cn("my-4 font-semibold first:mt-0 last:mb-0", className),
|
|
2572
3403
|
...props
|
|
2573
3404
|
}
|
|
2574
3405
|
),
|
|
2575
|
-
p: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3406
|
+
p: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx20(
|
|
2576
3407
|
"p",
|
|
2577
3408
|
{
|
|
2578
3409
|
className: cn("mt-5 mb-5 leading-7 first:mt-0 last:mb-0", className),
|
|
2579
3410
|
...props
|
|
2580
3411
|
}
|
|
2581
3412
|
),
|
|
2582
|
-
a: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3413
|
+
a: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx20(
|
|
2583
3414
|
"a",
|
|
2584
3415
|
{
|
|
2585
3416
|
className: cn(
|
|
@@ -2595,7 +3426,7 @@ var defaultComponents = {
|
|
|
2595
3426
|
className,
|
|
2596
3427
|
node: _node,
|
|
2597
3428
|
...props
|
|
2598
|
-
}) => /* @__PURE__ */
|
|
3429
|
+
}) => /* @__PURE__ */ jsx20(
|
|
2599
3430
|
"blockquote",
|
|
2600
3431
|
{
|
|
2601
3432
|
className: cn(
|
|
@@ -2605,21 +3436,21 @@ var defaultComponents = {
|
|
|
2605
3436
|
...props
|
|
2606
3437
|
}
|
|
2607
3438
|
),
|
|
2608
|
-
ul: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3439
|
+
ul: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx20(
|
|
2609
3440
|
"ul",
|
|
2610
3441
|
{
|
|
2611
3442
|
className: cn("my-5 list-outside list-disc pl-6 [&>li]:mt-2", className),
|
|
2612
3443
|
...props
|
|
2613
3444
|
}
|
|
2614
3445
|
),
|
|
2615
|
-
ol: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3446
|
+
ol: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx20(
|
|
2616
3447
|
"ol",
|
|
2617
3448
|
{
|
|
2618
3449
|
className: cn("my-5 list-outside list-decimal pl-8 [&>li]:mt-2", className),
|
|
2619
3450
|
...props
|
|
2620
3451
|
}
|
|
2621
3452
|
),
|
|
2622
|
-
hr: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3453
|
+
hr: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx20(
|
|
2623
3454
|
"hr",
|
|
2624
3455
|
{
|
|
2625
3456
|
className: cn("my-5 border-b", className),
|
|
@@ -2629,85 +3460,123 @@ var defaultComponents = {
|
|
|
2629
3460
|
table: ({
|
|
2630
3461
|
className,
|
|
2631
3462
|
node: _node,
|
|
3463
|
+
style,
|
|
2632
3464
|
...props
|
|
2633
|
-
}) => /* @__PURE__ */
|
|
2634
|
-
"
|
|
3465
|
+
}) => /* @__PURE__ */ jsx20(
|
|
3466
|
+
"div",
|
|
2635
3467
|
{
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
3468
|
+
"data-slot": "markdown-table-container",
|
|
3469
|
+
className: "my-5 max-w-full overflow-x-auto rounded-xl border border-border bg-background",
|
|
3470
|
+
children: /* @__PURE__ */ jsx20(
|
|
3471
|
+
"table",
|
|
3472
|
+
{
|
|
3473
|
+
className: cn(
|
|
3474
|
+
"min-w-full w-max border-separate border-spacing-0 text-sm",
|
|
3475
|
+
className
|
|
3476
|
+
),
|
|
3477
|
+
style: {
|
|
3478
|
+
lineHeight: markdownTableLineHeight,
|
|
3479
|
+
...style
|
|
3480
|
+
},
|
|
3481
|
+
...props
|
|
3482
|
+
}
|
|
3483
|
+
)
|
|
2641
3484
|
}
|
|
2642
3485
|
),
|
|
2643
|
-
th: ({
|
|
3486
|
+
th: ({
|
|
3487
|
+
className,
|
|
3488
|
+
node: _node,
|
|
3489
|
+
style,
|
|
3490
|
+
...props
|
|
3491
|
+
}) => /* @__PURE__ */ jsx20(
|
|
2644
3492
|
"th",
|
|
2645
3493
|
{
|
|
2646
3494
|
className: cn(
|
|
2647
|
-
"bg-muted border-border border-
|
|
3495
|
+
"bg-muted/80 border-border border-l text-left align-top font-semibold whitespace-normal break-words first:border-l-0 first:rounded-tl-xl last:rounded-tr-xl [&[align=center]]:text-center [&[align=right]]:text-right",
|
|
2648
3496
|
className
|
|
2649
3497
|
),
|
|
3498
|
+
style: {
|
|
3499
|
+
minWidth: markdownTableMinWidth,
|
|
3500
|
+
paddingInline: markdownTableCellPaddingInline,
|
|
3501
|
+
paddingBlock: markdownTableCellPaddingBlock,
|
|
3502
|
+
...style
|
|
3503
|
+
},
|
|
2650
3504
|
...props
|
|
2651
3505
|
}
|
|
2652
3506
|
),
|
|
2653
|
-
td: ({
|
|
3507
|
+
td: ({
|
|
3508
|
+
className,
|
|
3509
|
+
node: _node,
|
|
3510
|
+
style,
|
|
3511
|
+
...props
|
|
3512
|
+
}) => /* @__PURE__ */ jsx20(
|
|
2654
3513
|
"td",
|
|
2655
3514
|
{
|
|
2656
3515
|
className: cn(
|
|
2657
|
-
"border-border border-
|
|
3516
|
+
"border-border border-t border-l text-left align-top whitespace-normal break-words first:border-l-0 [&[align=center]]:text-center [&[align=right]]:text-right [&_code]:break-words [&_code]:whitespace-pre-wrap [&_code]:[overflow-wrap:anywhere]",
|
|
2658
3517
|
className
|
|
2659
3518
|
),
|
|
3519
|
+
style: {
|
|
3520
|
+
minWidth: markdownTableMinWidth,
|
|
3521
|
+
paddingInline: markdownTableCellPaddingInline,
|
|
3522
|
+
paddingBlock: markdownTableCellPaddingBlock,
|
|
3523
|
+
...style
|
|
3524
|
+
},
|
|
2660
3525
|
...props
|
|
2661
3526
|
}
|
|
2662
3527
|
),
|
|
2663
|
-
tr: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3528
|
+
tr: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx20(
|
|
2664
3529
|
"tr",
|
|
2665
3530
|
{
|
|
2666
3531
|
className: cn(
|
|
2667
|
-
"m-0 p-0 even:bg-muted/
|
|
3532
|
+
"m-0 p-0 even:bg-muted/30 [&:last-child>td:first-child]:rounded-bl-xl [&:last-child>td:last-child]:rounded-br-xl",
|
|
2668
3533
|
className
|
|
2669
3534
|
),
|
|
2670
3535
|
...props
|
|
2671
3536
|
}
|
|
2672
3537
|
),
|
|
2673
|
-
sup: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3538
|
+
sup: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx20(
|
|
2674
3539
|
"sup",
|
|
2675
3540
|
{
|
|
2676
3541
|
className: cn("[&>a]:text-xs [&>a]:no-underline", className),
|
|
2677
3542
|
...props
|
|
2678
3543
|
}
|
|
2679
3544
|
),
|
|
2680
|
-
pre: ({ className, node: _node,
|
|
3545
|
+
pre: ({ className, children, node: _node }) => Children.toArray(children).length === 1 && (isMermaidBlockChild(Children.toArray(children)[0]) || isMermaidCodeElement(Children.toArray(children)[0])) ? /* @__PURE__ */ jsx20(Fragment3, { children }) : /* @__PURE__ */ jsx20(
|
|
2681
3546
|
"div",
|
|
2682
3547
|
{
|
|
2683
3548
|
className: cn(
|
|
2684
3549
|
"max-w-4xl overflow-x-auto rounded-lg text-sm bg-black text-white dark:bg-zinc-800",
|
|
2685
3550
|
className
|
|
2686
3551
|
),
|
|
2687
|
-
|
|
3552
|
+
children
|
|
2688
3553
|
}
|
|
2689
3554
|
),
|
|
2690
3555
|
code: ({
|
|
2691
3556
|
className,
|
|
2692
3557
|
children,
|
|
2693
3558
|
node: _node,
|
|
3559
|
+
style,
|
|
2694
3560
|
...props
|
|
2695
3561
|
}) => {
|
|
2696
|
-
const match = /language-(\w+)/.exec(className || "");
|
|
3562
|
+
const match = /language-([\w-]+)/.exec(className || "");
|
|
2697
3563
|
const code = getTextContent(children);
|
|
2698
3564
|
const isBlockCode = code.includes("\n");
|
|
2699
3565
|
if (match) {
|
|
2700
3566
|
const language = match[1];
|
|
2701
3567
|
const normalizedCode = code.replace(/\n$/, "");
|
|
2702
|
-
|
|
2703
|
-
/* @__PURE__ */
|
|
3568
|
+
if (language === "mermaid") {
|
|
3569
|
+
return /* @__PURE__ */ jsx20(MermaidBlock, { code: normalizedCode });
|
|
3570
|
+
}
|
|
3571
|
+
return /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
3572
|
+
/* @__PURE__ */ jsx20(
|
|
2704
3573
|
CodeHeader,
|
|
2705
3574
|
{
|
|
2706
3575
|
language,
|
|
2707
3576
|
code: normalizedCode
|
|
2708
3577
|
}
|
|
2709
3578
|
),
|
|
2710
|
-
/* @__PURE__ */
|
|
3579
|
+
/* @__PURE__ */ jsx20(
|
|
2711
3580
|
SyntaxHighlighter,
|
|
2712
3581
|
{
|
|
2713
3582
|
language,
|
|
@@ -2718,7 +3587,7 @@ var defaultComponents = {
|
|
|
2718
3587
|
] });
|
|
2719
3588
|
}
|
|
2720
3589
|
if (isBlockCode) {
|
|
2721
|
-
return /* @__PURE__ */
|
|
3590
|
+
return /* @__PURE__ */ jsx20(
|
|
2722
3591
|
"code",
|
|
2723
3592
|
{
|
|
2724
3593
|
className: cn(
|
|
@@ -2730,13 +3599,18 @@ var defaultComponents = {
|
|
|
2730
3599
|
}
|
|
2731
3600
|
);
|
|
2732
3601
|
}
|
|
2733
|
-
return /* @__PURE__ */
|
|
3602
|
+
return /* @__PURE__ */ jsx20(
|
|
2734
3603
|
"code",
|
|
2735
3604
|
{
|
|
2736
3605
|
className: cn(
|
|
2737
|
-
"bg-muted rounded
|
|
3606
|
+
"bg-muted rounded font-mono text-[0.9em] font-semibold whitespace-pre-wrap [overflow-wrap:anywhere]",
|
|
2738
3607
|
className
|
|
2739
3608
|
),
|
|
3609
|
+
style: {
|
|
3610
|
+
paddingInline: markdownInlineCodePaddingInline,
|
|
3611
|
+
paddingBlock: markdownInlineCodePaddingBlock,
|
|
3612
|
+
...style
|
|
3613
|
+
},
|
|
2740
3614
|
...props,
|
|
2741
3615
|
children
|
|
2742
3616
|
}
|
|
@@ -2744,7 +3618,7 @@ var defaultComponents = {
|
|
|
2744
3618
|
}
|
|
2745
3619
|
};
|
|
2746
3620
|
var MarkdownTextImpl = ({ children }) => {
|
|
2747
|
-
return /* @__PURE__ */
|
|
3621
|
+
return /* @__PURE__ */ jsx20("div", { className: "markdown-content", children: /* @__PURE__ */ jsx20(
|
|
2748
3622
|
ReactMarkdown,
|
|
2749
3623
|
{
|
|
2750
3624
|
remarkPlugins: [remarkGfm, remarkMath],
|
|
@@ -2758,18 +3632,18 @@ var MarkdownText = memo(MarkdownTextImpl);
|
|
|
2758
3632
|
|
|
2759
3633
|
// src/components/thread/messages/widget.tsx
|
|
2760
3634
|
import { SurfaceRenderer } from "@xpert-ai/a2ui-react";
|
|
2761
|
-
import { jsx as
|
|
3635
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
2762
3636
|
function WidgetMessage({ messageId, data }) {
|
|
2763
3637
|
const widgets = Array.isArray(data.widgets) ? data.widgets : [];
|
|
2764
3638
|
if (widgets.length === 0) return null;
|
|
2765
3639
|
const baseSurfaceId = `widget-${messageId}`;
|
|
2766
|
-
return /* @__PURE__ */
|
|
3640
|
+
return /* @__PURE__ */ jsx21("div", { className: "space-y-3", children: widgets.map((widget, index) => {
|
|
2767
3641
|
const config = widget?.config;
|
|
2768
3642
|
if (!config || typeof config !== "object") {
|
|
2769
3643
|
return null;
|
|
2770
3644
|
}
|
|
2771
3645
|
const surfaceId = widgets.length > 1 ? `${baseSurfaceId}-${index}` : baseSurfaceId;
|
|
2772
|
-
return /* @__PURE__ */
|
|
3646
|
+
return /* @__PURE__ */ jsx21(
|
|
2773
3647
|
SurfaceRenderer,
|
|
2774
3648
|
{
|
|
2775
3649
|
surfaceId,
|
|
@@ -2781,7 +3655,7 @@ function WidgetMessage({ messageId, data }) {
|
|
|
2781
3655
|
}
|
|
2782
3656
|
|
|
2783
3657
|
// src/components/thread/messages/ai.tsx
|
|
2784
|
-
import { jsx as
|
|
3658
|
+
import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2785
3659
|
function isTextContent(content) {
|
|
2786
3660
|
return content.type === "text";
|
|
2787
3661
|
}
|
|
@@ -2797,7 +3671,7 @@ function isComponentContent(content) {
|
|
|
2797
3671
|
var statusConfig = {
|
|
2798
3672
|
success: {
|
|
2799
3673
|
iconClass: "border-green-500 text-green-700",
|
|
2800
|
-
icon:
|
|
3674
|
+
icon: CheckCircle22
|
|
2801
3675
|
},
|
|
2802
3676
|
fail: {
|
|
2803
3677
|
iconClass: "border-red-500 text-red-700",
|
|
@@ -2805,7 +3679,7 @@ var statusConfig = {
|
|
|
2805
3679
|
},
|
|
2806
3680
|
running: {
|
|
2807
3681
|
iconClass: "border-blue-500 text-blue-700",
|
|
2808
|
-
icon:
|
|
3682
|
+
icon: Loader22
|
|
2809
3683
|
}
|
|
2810
3684
|
};
|
|
2811
3685
|
function isWidgetComponent(content) {
|
|
@@ -2822,14 +3696,17 @@ function safeJson(value) {
|
|
|
2822
3696
|
return String(value);
|
|
2823
3697
|
}
|
|
2824
3698
|
}
|
|
3699
|
+
function formatDisplayValue(value) {
|
|
3700
|
+
return typeof value === "string" ? value : safeJson(value);
|
|
3701
|
+
}
|
|
2825
3702
|
function ReasoningBlock({ reasoning }) {
|
|
2826
3703
|
const blocks = reasoning.filter((item) => item.text?.trim());
|
|
2827
3704
|
if (blocks.length === 0) return null;
|
|
2828
|
-
return /* @__PURE__ */
|
|
3705
|
+
return /* @__PURE__ */ jsx22("div", { className: "space-y-2", children: blocks.map((item, index) => /* @__PURE__ */ jsx22(
|
|
2829
3706
|
"div",
|
|
2830
3707
|
{
|
|
2831
3708
|
className: "rounded-lg border bg-muted/40 p-3 text-xs text-muted-foreground",
|
|
2832
|
-
children: /* @__PURE__ */
|
|
3709
|
+
children: /* @__PURE__ */ jsx22("p", { className: "whitespace-pre-wrap wrap-break-word leading-relaxed", children: item.text })
|
|
2833
3710
|
},
|
|
2834
3711
|
item.id ?? `reasoning-${index}`
|
|
2835
3712
|
)) });
|
|
@@ -2837,27 +3714,57 @@ function ReasoningBlock({ reasoning }) {
|
|
|
2837
3714
|
function ImageBlock({ content }) {
|
|
2838
3715
|
const imageUrl = typeof content.image_url === "string" ? content.image_url : typeof content.image_url?.url === "string" ? content.image_url.url : null;
|
|
2839
3716
|
if (!imageUrl) {
|
|
2840
|
-
return /* @__PURE__ */
|
|
2841
|
-
/* @__PURE__ */
|
|
2842
|
-
/* @__PURE__ */
|
|
3717
|
+
return /* @__PURE__ */ jsxs12(Card, { children: [
|
|
3718
|
+
/* @__PURE__ */ jsx22(CardHeader, { className: "space-y-1", children: /* @__PURE__ */ jsx22(CardTitle, { className: "text-sm", children: "Image" }) }),
|
|
3719
|
+
/* @__PURE__ */ jsx22(CardContent, { className: "text-xs text-muted-foreground", children: safeJson(content) })
|
|
2843
3720
|
] });
|
|
2844
3721
|
}
|
|
2845
|
-
return /* @__PURE__ */
|
|
3722
|
+
return /* @__PURE__ */ jsx22("figure", { className: "overflow-hidden rounded-lg border bg-background", children: /* @__PURE__ */ jsx22("img", { src: imageUrl, alt: "Assistant output", className: "h-auto w-full object-cover" }) });
|
|
2846
3723
|
}
|
|
2847
3724
|
function MemoryBlock({ content }) {
|
|
2848
|
-
return /* @__PURE__ */
|
|
2849
|
-
/* @__PURE__ */
|
|
2850
|
-
/* @__PURE__ */
|
|
2851
|
-
/* @__PURE__ */
|
|
3725
|
+
return /* @__PURE__ */ jsxs12(Card, { children: [
|
|
3726
|
+
/* @__PURE__ */ jsxs12(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
3727
|
+
/* @__PURE__ */ jsx22(CardTitle, { className: "text-sm", children: "Memory" }),
|
|
3728
|
+
/* @__PURE__ */ jsx22(Badge, { variant: "secondary", children: "Memory" })
|
|
2852
3729
|
] }),
|
|
2853
|
-
/* @__PURE__ */
|
|
3730
|
+
/* @__PURE__ */ jsx22(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ jsx22("pre", { className: "whitespace-pre-wrap wrap-break-word", children: safeJson(content.data ?? []) }) })
|
|
2854
3731
|
] });
|
|
2855
3732
|
}
|
|
3733
|
+
function parseStepDate(value) {
|
|
3734
|
+
if (value instanceof Date) {
|
|
3735
|
+
const timestamp2 = value.getTime();
|
|
3736
|
+
return Number.isNaN(timestamp2) ? null : timestamp2;
|
|
3737
|
+
}
|
|
3738
|
+
if (typeof value !== "string") {
|
|
3739
|
+
return null;
|
|
3740
|
+
}
|
|
3741
|
+
const timestamp = Date.parse(value);
|
|
3742
|
+
return Number.isNaN(timestamp) ? null : timestamp;
|
|
3743
|
+
}
|
|
3744
|
+
function formatStepDuration(durationMs) {
|
|
3745
|
+
if (durationMs < 1e3) {
|
|
3746
|
+
return `${durationMs}ms`;
|
|
3747
|
+
}
|
|
3748
|
+
if (durationMs < 1e4) {
|
|
3749
|
+
return `${(durationMs / 1e3).toFixed(1)}s`;
|
|
3750
|
+
}
|
|
3751
|
+
if (durationMs < 6e4) {
|
|
3752
|
+
return `${Math.round(durationMs / 1e3)}s`;
|
|
3753
|
+
}
|
|
3754
|
+
const hours = Math.floor(durationMs / 36e5);
|
|
3755
|
+
const minutes = Math.floor(durationMs % 36e5 / 6e4);
|
|
3756
|
+
const seconds = Math.floor(durationMs % 6e4 / 1e3);
|
|
3757
|
+
if (hours > 0) {
|
|
3758
|
+
return `${hours}h ${minutes}m ${seconds}s`;
|
|
3759
|
+
}
|
|
3760
|
+
return `${minutes}m ${seconds}s`;
|
|
3761
|
+
}
|
|
2856
3762
|
function ComponentBlock({ content }) {
|
|
2857
|
-
const [isExpanded, setIsExpanded] =
|
|
2858
|
-
const contentRef =
|
|
2859
|
-
const shouldAutoScrollRef =
|
|
2860
|
-
const previousScrollTopRef =
|
|
3763
|
+
const [isExpanded, setIsExpanded] = React16.useState(false);
|
|
3764
|
+
const contentRef = React16.useRef(null);
|
|
3765
|
+
const shouldAutoScrollRef = React16.useRef(true);
|
|
3766
|
+
const previousScrollTopRef = React16.useRef(0);
|
|
3767
|
+
const [durationNow, setDurationNow] = React16.useState(() => Date.now());
|
|
2861
3768
|
const data = content.data ?? {};
|
|
2862
3769
|
const category = data.category ?? "Component";
|
|
2863
3770
|
const title = data.tool && category === "Tool" ? data.tool : data.title ?? data.type ?? "Component";
|
|
@@ -2865,12 +3772,28 @@ function ComponentBlock({ content }) {
|
|
|
2865
3772
|
const message = data.message ?? null;
|
|
2866
3773
|
const output = data.output ?? null;
|
|
2867
3774
|
const error = data.error ?? null;
|
|
2868
|
-
const fallback = message ?? output ??
|
|
3775
|
+
const fallback = message ?? output ?? data.data ?? data;
|
|
2869
3776
|
const hasOutput = message !== null || output !== null;
|
|
2870
|
-
|
|
3777
|
+
const createdAt = parseStepDate(data.created_date);
|
|
3778
|
+
const endedAt = parseStepDate(data.end_date);
|
|
3779
|
+
const durationMs = createdAt === null ? null : Math.max(0, (endedAt ?? durationNow) - createdAt);
|
|
3780
|
+
const durationLabel = durationMs === null ? null : formatStepDuration(durationMs);
|
|
3781
|
+
React16.useEffect(() => {
|
|
2871
3782
|
if (status === "running" && output !== null) setIsExpanded(true);
|
|
2872
3783
|
}, [status, output]);
|
|
2873
|
-
|
|
3784
|
+
React16.useEffect(() => {
|
|
3785
|
+
if (status !== "running" || createdAt === null || endedAt !== null) {
|
|
3786
|
+
return;
|
|
3787
|
+
}
|
|
3788
|
+
setDurationNow(Date.now());
|
|
3789
|
+
const timer = window.setInterval(() => {
|
|
3790
|
+
setDurationNow(Date.now());
|
|
3791
|
+
}, 100);
|
|
3792
|
+
return () => {
|
|
3793
|
+
window.clearInterval(timer);
|
|
3794
|
+
};
|
|
3795
|
+
}, [createdAt, endedAt, status]);
|
|
3796
|
+
React16.useEffect(() => {
|
|
2874
3797
|
const element = contentRef.current;
|
|
2875
3798
|
if (!element) return;
|
|
2876
3799
|
previousScrollTopRef.current = element.scrollTop;
|
|
@@ -2890,7 +3813,7 @@ function ComponentBlock({ content }) {
|
|
|
2890
3813
|
element.removeEventListener("scroll", updateAutoScrollState);
|
|
2891
3814
|
};
|
|
2892
3815
|
}, [isExpanded]);
|
|
2893
|
-
|
|
3816
|
+
React16.useEffect(() => {
|
|
2894
3817
|
if (status !== "running") {
|
|
2895
3818
|
shouldAutoScrollRef.current = true;
|
|
2896
3819
|
return;
|
|
@@ -2903,21 +3826,25 @@ function ComponentBlock({ content }) {
|
|
|
2903
3826
|
}, [isExpanded, output, status]);
|
|
2904
3827
|
const config = status ? statusConfig[status] : null;
|
|
2905
3828
|
const StatusIcon = config?.icon;
|
|
2906
|
-
return /* @__PURE__ */
|
|
2907
|
-
/* @__PURE__ */
|
|
2908
|
-
/* @__PURE__ */
|
|
2909
|
-
status && StatusIcon && /* @__PURE__ */
|
|
2910
|
-
/* @__PURE__ */
|
|
3829
|
+
return /* @__PURE__ */ jsxs12(Card, { children: [
|
|
3830
|
+
/* @__PURE__ */ jsxs12(CardHeader, { className: "flex flex-row items-center justify-between gap-2 px-2 py-1 cursor-pointer", onClick: () => setIsExpanded(!isExpanded), children: [
|
|
3831
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center space-x-1 flex-1 min-w-0", children: [
|
|
3832
|
+
status && StatusIcon && /* @__PURE__ */ jsx22(StatusIcon, { className: cn("h-4 w-4", config?.iconClass, status === "running" && "animate-spin") }),
|
|
3833
|
+
/* @__PURE__ */ jsx22(CardTitle, { className: "text-sm truncate", children: title })
|
|
2911
3834
|
] }),
|
|
2912
|
-
/* @__PURE__ */
|
|
2913
|
-
/* @__PURE__ */
|
|
2914
|
-
|
|
3835
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-2 shrink-0", children: [
|
|
3836
|
+
durationLabel && /* @__PURE__ */ jsxs12("div", { className: "inline-flex items-center gap-1 text-[11px] text-muted-foreground tabular-nums", children: [
|
|
3837
|
+
/* @__PURE__ */ jsx22(Clock3, { className: "h-3 w-3" }),
|
|
3838
|
+
/* @__PURE__ */ jsx22("span", { children: durationLabel })
|
|
3839
|
+
] }),
|
|
3840
|
+
/* @__PURE__ */ jsx22(Badge, { variant: "secondary", className: "rounded-lg px-1.5", children: category }),
|
|
3841
|
+
/* @__PURE__ */ jsx22(
|
|
2915
3842
|
"button",
|
|
2916
3843
|
{
|
|
2917
3844
|
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
2918
3845
|
"aria-label": isExpanded ? "Collapse" : "Expand",
|
|
2919
|
-
children: /* @__PURE__ */
|
|
2920
|
-
|
|
3846
|
+
children: /* @__PURE__ */ jsx22(
|
|
3847
|
+
ChevronDown2,
|
|
2921
3848
|
{
|
|
2922
3849
|
className: cn("h-4 w-4 transition-transform", isExpanded && "rotate-180")
|
|
2923
3850
|
}
|
|
@@ -2926,55 +3853,55 @@ function ComponentBlock({ content }) {
|
|
|
2926
3853
|
)
|
|
2927
3854
|
] })
|
|
2928
3855
|
] }),
|
|
2929
|
-
isExpanded && /* @__PURE__ */
|
|
2930
|
-
data.input && /* @__PURE__ */
|
|
2931
|
-
error ? /* @__PURE__ */
|
|
3856
|
+
isExpanded && /* @__PURE__ */ jsxs12(CardContent, { ref: contentRef, className: "text-xs text-muted-foreground max-h-60 overflow-auto", children: [
|
|
3857
|
+
data.input && /* @__PURE__ */ jsx22("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue(data.input) }),
|
|
3858
|
+
error ? /* @__PURE__ */ jsx22("pre", { className: "whitespace-pre-wrap wrap-break-word text-destructive", children: formatDisplayValue(error) }) : hasOutput && /* @__PURE__ */ jsx22("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue(fallback) })
|
|
2932
3859
|
] })
|
|
2933
3860
|
] });
|
|
2934
3861
|
}
|
|
2935
3862
|
function UnknownBlock({ content }) {
|
|
2936
|
-
return /* @__PURE__ */
|
|
2937
|
-
/* @__PURE__ */
|
|
2938
|
-
/* @__PURE__ */
|
|
2939
|
-
/* @__PURE__ */
|
|
3863
|
+
return /* @__PURE__ */ jsxs12(Card, { children: [
|
|
3864
|
+
/* @__PURE__ */ jsxs12(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
3865
|
+
/* @__PURE__ */ jsx22(CardTitle, { className: "text-sm", children: "Assistant Content" }),
|
|
3866
|
+
/* @__PURE__ */ jsx22(Badge, { variant: "outline", children: content.type ?? "unknown" })
|
|
2940
3867
|
] }),
|
|
2941
|
-
/* @__PURE__ */
|
|
3868
|
+
/* @__PURE__ */ jsx22(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ jsx22("pre", { className: "whitespace-pre-wrap break-words", children: safeJson(content) }) })
|
|
2942
3869
|
] });
|
|
2943
3870
|
}
|
|
2944
3871
|
function renderContentItem(content, index, messageId) {
|
|
2945
3872
|
if (typeof content === "string") {
|
|
2946
|
-
return /* @__PURE__ */
|
|
2947
|
-
/* @__PURE__ */
|
|
3873
|
+
return /* @__PURE__ */ jsxs12("div", { children: [
|
|
3874
|
+
/* @__PURE__ */ jsx22(MarkdownText, { children: content }),
|
|
2948
3875
|
";"
|
|
2949
3876
|
] }, `text-${index}`);
|
|
2950
3877
|
}
|
|
2951
3878
|
if (isTextContent(content)) {
|
|
2952
|
-
return /* @__PURE__ */
|
|
3879
|
+
return /* @__PURE__ */ jsx22("div", { children: /* @__PURE__ */ jsx22(MarkdownText, { children: content.text }) }, content.id ?? `text-${index}`);
|
|
2953
3880
|
}
|
|
2954
3881
|
if (isReasoningContent(content)) {
|
|
2955
|
-
return /* @__PURE__ */
|
|
3882
|
+
return /* @__PURE__ */ jsx22("div", { children: /* @__PURE__ */ jsx22(ReasoningBlock, { reasoning: [content] }) }, content.id ?? `reasoning-${index}`);
|
|
2956
3883
|
}
|
|
2957
3884
|
if (isImageContent(content)) {
|
|
2958
|
-
return /* @__PURE__ */
|
|
3885
|
+
return /* @__PURE__ */ jsx22("div", { children: /* @__PURE__ */ jsx22(ImageBlock, { content }) }, content.id ?? `image-${index}`);
|
|
2959
3886
|
}
|
|
2960
3887
|
if (isComponentContent(content)) {
|
|
2961
3888
|
if (isWidgetComponent(content)) {
|
|
2962
|
-
return /* @__PURE__ */
|
|
3889
|
+
return /* @__PURE__ */ jsx22("div", { children: /* @__PURE__ */ jsx22(WidgetMessage, { messageId, data: content.data }) }, content.id ?? `widget-${index}`);
|
|
2963
3890
|
}
|
|
2964
|
-
return /* @__PURE__ */
|
|
3891
|
+
return /* @__PURE__ */ jsx22("div", { children: /* @__PURE__ */ jsx22(ComponentBlock, { content }) }, content.id ?? `component-${index}`);
|
|
2965
3892
|
}
|
|
2966
3893
|
if (isMemoryContent(content)) {
|
|
2967
|
-
return /* @__PURE__ */
|
|
3894
|
+
return /* @__PURE__ */ jsx22("div", { children: /* @__PURE__ */ jsx22(MemoryBlock, { content }) }, content.id ?? `memory-${index}`);
|
|
2968
3895
|
}
|
|
2969
|
-
return /* @__PURE__ */
|
|
3896
|
+
return /* @__PURE__ */ jsx22("div", { children: /* @__PURE__ */ jsx22(UnknownBlock, { content }) }, content.id ?? `unknown-${index}`);
|
|
2970
3897
|
}
|
|
2971
3898
|
function renderContent(content, messageId) {
|
|
2972
3899
|
if (typeof content === "string") {
|
|
2973
3900
|
if (!content.trim()) return null;
|
|
2974
|
-
return /* @__PURE__ */
|
|
3901
|
+
return /* @__PURE__ */ jsx22(MarkdownText, { children: content });
|
|
2975
3902
|
}
|
|
2976
3903
|
if (!Array.isArray(content) || content.length === 0) return null;
|
|
2977
|
-
return /* @__PURE__ */
|
|
3904
|
+
return /* @__PURE__ */ jsx22("div", { className: "space-y-3", children: content.map((item, index) => renderContentItem(item, index, messageId)) });
|
|
2978
3905
|
}
|
|
2979
3906
|
function AssistantStreamingIndicator({
|
|
2980
3907
|
status,
|
|
@@ -2986,19 +3913,19 @@ function AssistantStreamingIndicator({
|
|
|
2986
3913
|
thinking: t("message.thinking"),
|
|
2987
3914
|
answering: t("message.answering")
|
|
2988
3915
|
};
|
|
2989
|
-
return /* @__PURE__ */
|
|
2990
|
-
status === "loading" && /* @__PURE__ */
|
|
2991
|
-
status === "thinking" && /* @__PURE__ */
|
|
2992
|
-
/* @__PURE__ */
|
|
2993
|
-
/* @__PURE__ */
|
|
2994
|
-
/* @__PURE__ */
|
|
3916
|
+
return /* @__PURE__ */ jsxs12("div", { className: cn("flex items-center gap-2 text-xs text-muted-foreground", className), children: [
|
|
3917
|
+
status === "loading" && /* @__PURE__ */ jsx22(Loader22, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
3918
|
+
status === "thinking" && /* @__PURE__ */ jsxs12("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
3919
|
+
/* @__PURE__ */ jsx22("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.3s]" }),
|
|
3920
|
+
/* @__PURE__ */ jsx22("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.15s]" }),
|
|
3921
|
+
/* @__PURE__ */ jsx22("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce" })
|
|
2995
3922
|
] }),
|
|
2996
|
-
status === "answering" && /* @__PURE__ */
|
|
2997
|
-
/* @__PURE__ */
|
|
2998
|
-
/* @__PURE__ */
|
|
2999
|
-
/* @__PURE__ */
|
|
3923
|
+
status === "answering" && /* @__PURE__ */ jsxs12("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
3924
|
+
/* @__PURE__ */ jsx22("span", { className: "h-2 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.25s]" }),
|
|
3925
|
+
/* @__PURE__ */ jsx22("span", { className: "h-3 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.1s]" }),
|
|
3926
|
+
/* @__PURE__ */ jsx22("span", { className: "h-2.5 w-0.5 rounded-full bg-current animate-pulse" })
|
|
3000
3927
|
] }),
|
|
3001
|
-
/* @__PURE__ */
|
|
3928
|
+
/* @__PURE__ */ jsx22("span", { children: labelMap[status] })
|
|
3002
3929
|
] });
|
|
3003
3930
|
}
|
|
3004
3931
|
function AssistantMessage({
|
|
@@ -3012,42 +3939,42 @@ function AssistantMessage({
|
|
|
3012
3939
|
const hasReasoning = hasRenderableReasoning(message.reasoning);
|
|
3013
3940
|
const resolvedStreamingStatus = streamingStatus ?? getAssistantStreamingStatus(message, isStreaming);
|
|
3014
3941
|
const answerNode = renderContent(message.content, message.id);
|
|
3015
|
-
const reasoningNode = hasReasoning ? /* @__PURE__ */
|
|
3942
|
+
const reasoningNode = hasReasoning ? /* @__PURE__ */ jsx22(ReasoningBlock, { reasoning: message.reasoning ?? [] }) : null;
|
|
3016
3943
|
if (!hasRenderableAssistantMessage(message) && !resolvedStreamingStatus) return null;
|
|
3017
3944
|
const streamingClass = isStreaming ? "streaming-active" : "";
|
|
3018
3945
|
if (!hasRenderableAssistantMessage(message) && resolvedStreamingStatus) {
|
|
3019
|
-
return /* @__PURE__ */
|
|
3946
|
+
return /* @__PURE__ */ jsx22("div", { className: cn("space-y-3", streamingClass, className), children: /* @__PURE__ */ jsx22(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) });
|
|
3020
3947
|
}
|
|
3021
3948
|
if (hasContent && hasReasoning) {
|
|
3022
|
-
return /* @__PURE__ */
|
|
3023
|
-
/* @__PURE__ */
|
|
3949
|
+
return /* @__PURE__ */ jsxs12("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
3950
|
+
/* @__PURE__ */ jsxs12(
|
|
3024
3951
|
Tabs,
|
|
3025
3952
|
{
|
|
3026
3953
|
defaultValue: message.status === "reasoning" ? "reasoning" : "answer",
|
|
3027
3954
|
className: "w-full",
|
|
3028
3955
|
children: [
|
|
3029
|
-
/* @__PURE__ */
|
|
3030
|
-
/* @__PURE__ */
|
|
3031
|
-
/* @__PURE__ */
|
|
3956
|
+
/* @__PURE__ */ jsxs12(TabsList, { className: "", children: [
|
|
3957
|
+
/* @__PURE__ */ jsx22(TabsTrigger, { value: "answer", children: t("message.answer") }),
|
|
3958
|
+
/* @__PURE__ */ jsx22(TabsTrigger, { value: "reasoning", children: t("message.reasoning") })
|
|
3032
3959
|
] }),
|
|
3033
|
-
/* @__PURE__ */
|
|
3034
|
-
/* @__PURE__ */
|
|
3960
|
+
/* @__PURE__ */ jsx22(TabsContent, { value: "answer", className: "space-y-3", children: answerNode }),
|
|
3961
|
+
/* @__PURE__ */ jsx22(TabsContent, { value: "reasoning", className: "space-y-3", children: reasoningNode })
|
|
3035
3962
|
]
|
|
3036
3963
|
}
|
|
3037
3964
|
),
|
|
3038
|
-
resolvedStreamingStatus ? /* @__PURE__ */
|
|
3965
|
+
resolvedStreamingStatus ? /* @__PURE__ */ jsx22(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
3039
3966
|
] });
|
|
3040
3967
|
}
|
|
3041
|
-
return /* @__PURE__ */
|
|
3968
|
+
return /* @__PURE__ */ jsxs12("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
3042
3969
|
hasReasoning ? reasoningNode : answerNode,
|
|
3043
|
-
resolvedStreamingStatus ? /* @__PURE__ */
|
|
3970
|
+
resolvedStreamingStatus ? /* @__PURE__ */ jsx22(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
3044
3971
|
] });
|
|
3045
3972
|
}
|
|
3046
3973
|
|
|
3047
3974
|
// src/components/thread/MessageActions.tsx
|
|
3048
|
-
import * as
|
|
3975
|
+
import * as React17 from "react";
|
|
3049
3976
|
import { Check, Copy, RefreshCw } from "lucide-react";
|
|
3050
|
-
import { jsx as
|
|
3977
|
+
import { jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3051
3978
|
function MessageActions({
|
|
3052
3979
|
content,
|
|
3053
3980
|
isAssistant = false,
|
|
@@ -3056,7 +3983,7 @@ function MessageActions({
|
|
|
3056
3983
|
className
|
|
3057
3984
|
}) {
|
|
3058
3985
|
const { t } = useChatkitTranslation();
|
|
3059
|
-
const [copied, setCopied] =
|
|
3986
|
+
const [copied, setCopied] = React17.useState(false);
|
|
3060
3987
|
const handleCopy = async () => {
|
|
3061
3988
|
try {
|
|
3062
3989
|
await navigator.clipboard.writeText(content);
|
|
@@ -3069,7 +3996,7 @@ function MessageActions({
|
|
|
3069
3996
|
if (isStreaming) {
|
|
3070
3997
|
return null;
|
|
3071
3998
|
}
|
|
3072
|
-
return /* @__PURE__ */
|
|
3999
|
+
return /* @__PURE__ */ jsxs13(
|
|
3073
4000
|
"div",
|
|
3074
4001
|
{
|
|
3075
4002
|
className: cn(
|
|
@@ -3077,7 +4004,7 @@ function MessageActions({
|
|
|
3077
4004
|
className
|
|
3078
4005
|
),
|
|
3079
4006
|
children: [
|
|
3080
|
-
/* @__PURE__ */
|
|
4007
|
+
/* @__PURE__ */ jsx23(
|
|
3081
4008
|
"button",
|
|
3082
4009
|
{
|
|
3083
4010
|
type: "button",
|
|
@@ -3087,17 +4014,17 @@ function MessageActions({
|
|
|
3087
4014
|
copied && "text-green-500"
|
|
3088
4015
|
),
|
|
3089
4016
|
title: copied ? t("messageActions.copied") : t("messageActions.copy"),
|
|
3090
|
-
children: copied ? /* @__PURE__ */
|
|
4017
|
+
children: copied ? /* @__PURE__ */ jsx23(Check, { size: 14 }) : /* @__PURE__ */ jsx23(Copy, { size: 14 })
|
|
3091
4018
|
}
|
|
3092
4019
|
),
|
|
3093
|
-
isAssistant && onRetry && /* @__PURE__ */
|
|
4020
|
+
isAssistant && onRetry && /* @__PURE__ */ jsx23(
|
|
3094
4021
|
"button",
|
|
3095
4022
|
{
|
|
3096
4023
|
type: "button",
|
|
3097
4024
|
onClick: onRetry,
|
|
3098
4025
|
className: "p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",
|
|
3099
4026
|
title: t("messageActions.regenerate"),
|
|
3100
|
-
children: /* @__PURE__ */
|
|
4027
|
+
children: /* @__PURE__ */ jsx23(RefreshCw, { size: 14 })
|
|
3101
4028
|
}
|
|
3102
4029
|
)
|
|
3103
4030
|
]
|
|
@@ -3118,18 +4045,18 @@ import {
|
|
|
3118
4045
|
Sparkles as Sparkles2,
|
|
3119
4046
|
Zap
|
|
3120
4047
|
} from "lucide-react";
|
|
3121
|
-
import { jsx as
|
|
4048
|
+
import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3122
4049
|
function getIconComponent2(icon) {
|
|
3123
4050
|
const iconMap = {
|
|
3124
|
-
"circle-question": /* @__PURE__ */
|
|
3125
|
-
"lightbulb": /* @__PURE__ */
|
|
3126
|
-
"sparkle": /* @__PURE__ */
|
|
3127
|
-
"write": /* @__PURE__ */
|
|
3128
|
-
"search": /* @__PURE__ */
|
|
3129
|
-
"globe": /* @__PURE__ */
|
|
3130
|
-
"book-open": /* @__PURE__ */
|
|
3131
|
-
"compass": /* @__PURE__ */
|
|
3132
|
-
"bolt": /* @__PURE__ */
|
|
4051
|
+
"circle-question": /* @__PURE__ */ jsx24(HelpCircle, { size: 20 }),
|
|
4052
|
+
"lightbulb": /* @__PURE__ */ jsx24(Lightbulb2, { size: 20 }),
|
|
4053
|
+
"sparkle": /* @__PURE__ */ jsx24(Sparkles2, { size: 20 }),
|
|
4054
|
+
"write": /* @__PURE__ */ jsx24(Pencil2, { size: 20 }),
|
|
4055
|
+
"search": /* @__PURE__ */ jsx24(Search2, { size: 20 }),
|
|
4056
|
+
"globe": /* @__PURE__ */ jsx24(Globe2, { size: 20 }),
|
|
4057
|
+
"book-open": /* @__PURE__ */ jsx24(BookOpen, { size: 20 }),
|
|
4058
|
+
"compass": /* @__PURE__ */ jsx24(Compass, { size: 20 }),
|
|
4059
|
+
"bolt": /* @__PURE__ */ jsx24(Zap, { size: 20 })
|
|
3133
4060
|
};
|
|
3134
4061
|
return icon ? iconMap[icon] || iconMap["sparkle"] : iconMap["sparkle"];
|
|
3135
4062
|
}
|
|
@@ -3137,9 +4064,9 @@ function StartScreen({ startScreen, onPromptClick, className }) {
|
|
|
3137
4064
|
const { t } = useChatkitTranslation();
|
|
3138
4065
|
const greeting = startScreen?.greeting ?? t("startScreen.greeting");
|
|
3139
4066
|
const prompts = startScreen?.prompts ?? [];
|
|
3140
|
-
return /* @__PURE__ */
|
|
3141
|
-
/* @__PURE__ */
|
|
3142
|
-
prompts.length > 0 && /* @__PURE__ */
|
|
4067
|
+
return /* @__PURE__ */ jsxs14("div", { className: cn("flex flex-col items-center justify-center py-12 px-4", className), children: [
|
|
4068
|
+
/* @__PURE__ */ jsx24("div", { className: "mb-8 text-center", children: /* @__PURE__ */ jsx24("h2", { className: "text-2xl font-semibold text-foreground mb-2", children: greeting }) }),
|
|
4069
|
+
prompts.length > 0 && /* @__PURE__ */ jsx24("div", { className: "w-full max-w-2xl", children: /* @__PURE__ */ jsx24("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: prompts.map((item, index) => /* @__PURE__ */ jsxs14(
|
|
3143
4070
|
"button",
|
|
3144
4071
|
{
|
|
3145
4072
|
type: "button",
|
|
@@ -3150,8 +4077,8 @@ function StartScreen({ startScreen, onPromptClick, className }) {
|
|
|
3150
4077
|
"focus:outline-none focus:ring-2 focus:ring-primary/20"
|
|
3151
4078
|
),
|
|
3152
4079
|
children: [
|
|
3153
|
-
/* @__PURE__ */
|
|
3154
|
-
/* @__PURE__ */
|
|
4080
|
+
/* @__PURE__ */ jsx24("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: getIconComponent2(item.icon) }),
|
|
4081
|
+
/* @__PURE__ */ jsx24("span", { className: "text-sm font-medium text-foreground", children: item.label })
|
|
3155
4082
|
]
|
|
3156
4083
|
},
|
|
3157
4084
|
`prompt-${index}`
|
|
@@ -3163,10 +4090,10 @@ function StartScreen({ startScreen, onPromptClick, className }) {
|
|
|
3163
4090
|
import "react";
|
|
3164
4091
|
|
|
3165
4092
|
// src/components/ui/avatar.tsx
|
|
3166
|
-
import * as
|
|
4093
|
+
import * as React19 from "react";
|
|
3167
4094
|
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
3168
|
-
import { jsx as
|
|
3169
|
-
var Avatar =
|
|
4095
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
4096
|
+
var Avatar = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
|
|
3170
4097
|
AvatarPrimitive.Root,
|
|
3171
4098
|
{
|
|
3172
4099
|
ref,
|
|
@@ -3178,7 +4105,7 @@ var Avatar = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
3178
4105
|
}
|
|
3179
4106
|
));
|
|
3180
4107
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
3181
|
-
var AvatarImage =
|
|
4108
|
+
var AvatarImage = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
|
|
3182
4109
|
AvatarPrimitive.Image,
|
|
3183
4110
|
{
|
|
3184
4111
|
ref,
|
|
@@ -3187,7 +4114,7 @@ var AvatarImage = React17.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
3187
4114
|
}
|
|
3188
4115
|
));
|
|
3189
4116
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
3190
|
-
var AvatarFallback =
|
|
4117
|
+
var AvatarFallback = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
|
|
3191
4118
|
AvatarPrimitive.Fallback,
|
|
3192
4119
|
{
|
|
3193
4120
|
ref,
|
|
@@ -3201,7 +4128,7 @@ var AvatarFallback = React17.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
3201
4128
|
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
3202
4129
|
|
|
3203
4130
|
// src/components/ui/chatkit-avatar.tsx
|
|
3204
|
-
import { jsx as
|
|
4131
|
+
import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3205
4132
|
function asRecord(value) {
|
|
3206
4133
|
return value && typeof value === "object" ? value : null;
|
|
3207
4134
|
}
|
|
@@ -3274,21 +4201,21 @@ function ChatkitAvatar({
|
|
|
3274
4201
|
const fallbackStyle = {
|
|
3275
4202
|
...avatar?.background ? { background: avatar.background } : {}
|
|
3276
4203
|
};
|
|
3277
|
-
return /* @__PURE__ */
|
|
3278
|
-
avatar?.url ? /* @__PURE__ */
|
|
3279
|
-
/* @__PURE__ */
|
|
4204
|
+
return /* @__PURE__ */ jsxs15(Avatar, { className: cn(roundedClass, className), style, ...props, children: [
|
|
4205
|
+
avatar?.url ? /* @__PURE__ */ jsx26(AvatarImage, { className: imageClassName, src: avatar.url, alt: label }) : null,
|
|
4206
|
+
/* @__PURE__ */ jsx26(
|
|
3280
4207
|
AvatarFallback,
|
|
3281
4208
|
{
|
|
3282
4209
|
className: cn(roundedClass, "text-sm font-medium text-foreground", fallbackClassName),
|
|
3283
4210
|
style: fallbackStyle,
|
|
3284
|
-
children: emojiCharacter ? /* @__PURE__ */
|
|
4211
|
+
children: emojiCharacter ? /* @__PURE__ */ jsx26("span", { className: "text-[1.1em] leading-none", style: emojiStyle, children: emojiCharacter }) : fallbackText
|
|
3285
4212
|
}
|
|
3286
4213
|
)
|
|
3287
4214
|
] });
|
|
3288
4215
|
}
|
|
3289
4216
|
|
|
3290
4217
|
// src/hooks/useThreads.ts
|
|
3291
|
-
import * as
|
|
4218
|
+
import * as React21 from "react";
|
|
3292
4219
|
var DEFAULT_LIMIT = 50;
|
|
3293
4220
|
var getThreadTitle = (threadRecord) => {
|
|
3294
4221
|
const title = threadRecord.title?.trim();
|
|
@@ -3326,16 +4253,16 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
3326
4253
|
isReady,
|
|
3327
4254
|
isLoading: isStreamLoading
|
|
3328
4255
|
} = useStreamContext();
|
|
3329
|
-
const [threadRecords, setThreadRecords] =
|
|
3330
|
-
const [isLoading, setIsLoading] =
|
|
3331
|
-
const [error, setError] =
|
|
3332
|
-
const upsertThreadRecord =
|
|
4256
|
+
const [threadRecords, setThreadRecords] = React21.useState([]);
|
|
4257
|
+
const [isLoading, setIsLoading] = React21.useState(false);
|
|
4258
|
+
const [error, setError] = React21.useState(null);
|
|
4259
|
+
const upsertThreadRecord = React21.useCallback((threadRecord) => {
|
|
3333
4260
|
setThreadRecords((prev) => {
|
|
3334
4261
|
const next = prev.filter((item) => item.id !== threadRecord.id);
|
|
3335
4262
|
return sortThreadRecords([threadRecord, ...next]);
|
|
3336
4263
|
});
|
|
3337
4264
|
}, []);
|
|
3338
|
-
const refreshThreads =
|
|
4265
|
+
const refreshThreads = React21.useCallback(async () => {
|
|
3339
4266
|
setIsLoading(true);
|
|
3340
4267
|
setError(null);
|
|
3341
4268
|
try {
|
|
@@ -3351,7 +4278,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
3351
4278
|
setIsLoading(false);
|
|
3352
4279
|
}
|
|
3353
4280
|
}, [client, limit, assistantId]);
|
|
3354
|
-
const createThread =
|
|
4281
|
+
const createThread = React21.useCallback(
|
|
3355
4282
|
async (input) => {
|
|
3356
4283
|
setError(null);
|
|
3357
4284
|
const payload = {};
|
|
@@ -3365,7 +4292,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
3365
4292
|
},
|
|
3366
4293
|
[client, upsertThreadRecord]
|
|
3367
4294
|
);
|
|
3368
|
-
const updateThread =
|
|
4295
|
+
const updateThread = React21.useCallback(
|
|
3369
4296
|
async (recordId, payload) => {
|
|
3370
4297
|
setError(null);
|
|
3371
4298
|
const updated = await client.conversations.update(recordId, payload);
|
|
@@ -3374,7 +4301,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
3374
4301
|
},
|
|
3375
4302
|
[client, upsertThreadRecord]
|
|
3376
4303
|
);
|
|
3377
|
-
const deleteThread =
|
|
4304
|
+
const deleteThread = React21.useCallback(
|
|
3378
4305
|
async (recordId) => {
|
|
3379
4306
|
setError(null);
|
|
3380
4307
|
await client.conversations.delete(recordId);
|
|
@@ -3382,23 +4309,24 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
3382
4309
|
},
|
|
3383
4310
|
[client]
|
|
3384
4311
|
);
|
|
3385
|
-
|
|
4312
|
+
React21.useEffect(() => {
|
|
3386
4313
|
if (!isReady) return;
|
|
3387
4314
|
void refreshThreads();
|
|
3388
4315
|
}, [refreshThreads, isReady]);
|
|
3389
|
-
|
|
4316
|
+
React21.useEffect(() => {
|
|
3390
4317
|
if (!threadId || !isStreamLoading) return;
|
|
3391
4318
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4319
|
+
const busyStatus = "busy";
|
|
3392
4320
|
setThreadRecords((prev) => {
|
|
3393
4321
|
let changed = false;
|
|
3394
4322
|
const next = prev.map((item) => {
|
|
3395
4323
|
const isCurrentThread = item.threadId === threadId || item.id === threadId;
|
|
3396
4324
|
if (!isCurrentThread) return item;
|
|
3397
|
-
if (item.status ===
|
|
4325
|
+
if (item.status === busyStatus && !item.error) return item;
|
|
3398
4326
|
changed = true;
|
|
3399
4327
|
return {
|
|
3400
4328
|
...item,
|
|
3401
|
-
status:
|
|
4329
|
+
status: busyStatus,
|
|
3402
4330
|
error: void 0,
|
|
3403
4331
|
updatedAt: now
|
|
3404
4332
|
};
|
|
@@ -3406,7 +4334,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
3406
4334
|
return changed ? sortThreadRecords(next) : prev;
|
|
3407
4335
|
});
|
|
3408
4336
|
}, [threadId, isStreamLoading]);
|
|
3409
|
-
|
|
4337
|
+
React21.useEffect(() => {
|
|
3410
4338
|
if (!isReady || !threadId || isStreamLoading) return;
|
|
3411
4339
|
let cancelled = false;
|
|
3412
4340
|
void client.conversations.search({ where: { threadId }, limit: 1 }).then((result) => {
|
|
@@ -3420,7 +4348,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
3420
4348
|
cancelled = true;
|
|
3421
4349
|
};
|
|
3422
4350
|
}, [client, threadId, upsertThreadRecord, isReady, isStreamLoading]);
|
|
3423
|
-
const threads =
|
|
4351
|
+
const threads = React21.useMemo(
|
|
3424
4352
|
() => threadRecords.map((threadRecord) => toThreadItem(threadRecord)),
|
|
3425
4353
|
[threadRecords]
|
|
3426
4354
|
);
|
|
@@ -3437,18 +4365,18 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
3437
4365
|
}
|
|
3438
4366
|
|
|
3439
4367
|
// src/components/thread/context-usage-indicator.tsx
|
|
3440
|
-
import * as
|
|
4368
|
+
import * as React22 from "react";
|
|
3441
4369
|
|
|
3442
4370
|
// src/components/ui/progress-circle.tsx
|
|
3443
|
-
import { jsx as
|
|
3444
|
-
function
|
|
4371
|
+
import { jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4372
|
+
function clamp2(input, a, b) {
|
|
3445
4373
|
return Math.max(Math.min(input, Math.max(a, b)), Math.min(a, b));
|
|
3446
4374
|
}
|
|
3447
4375
|
var size = 24;
|
|
3448
4376
|
var strokeWidth = 4;
|
|
3449
4377
|
var total = 100;
|
|
3450
4378
|
var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
3451
|
-
const normalizedValue =
|
|
4379
|
+
const normalizedValue = clamp2(value, 0, total);
|
|
3452
4380
|
const radius = (size - strokeWidth) / 2;
|
|
3453
4381
|
const circumference = 2 * Math.PI * radius;
|
|
3454
4382
|
const progress = normalizedValue / total * circumference;
|
|
@@ -3463,7 +4391,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
3463
4391
|
return (
|
|
3464
4392
|
// biome-ignore lint/a11y/useFocusableInteractive: false positive (progress + progressbar are not focusable interactives)
|
|
3465
4393
|
// biome-ignore lint/nursery/useAriaPropsSupportedByRole: biome rule at odds with mdn docs (presumed nursary bug with rule)
|
|
3466
|
-
/* @__PURE__ */
|
|
4394
|
+
/* @__PURE__ */ jsxs16(
|
|
3467
4395
|
"svg",
|
|
3468
4396
|
{
|
|
3469
4397
|
role: "progressbar",
|
|
@@ -3474,8 +4402,8 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
3474
4402
|
"aria-valuemax": 100,
|
|
3475
4403
|
...restSvgProps,
|
|
3476
4404
|
children: [
|
|
3477
|
-
/* @__PURE__ */
|
|
3478
|
-
/* @__PURE__ */
|
|
4405
|
+
/* @__PURE__ */ jsx27("circle", { ...commonParams, className: "stroke-current/25" }),
|
|
4406
|
+
/* @__PURE__ */ jsx27(
|
|
3479
4407
|
"circle",
|
|
3480
4408
|
{
|
|
3481
4409
|
...commonParams,
|
|
@@ -3494,7 +4422,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
3494
4422
|
};
|
|
3495
4423
|
|
|
3496
4424
|
// src/components/thread/context-usage-indicator.tsx
|
|
3497
|
-
import { jsx as
|
|
4425
|
+
import { jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3498
4426
|
var kNumberFormatter = new Intl.NumberFormat("en-US", {
|
|
3499
4427
|
minimumFractionDigits: 0,
|
|
3500
4428
|
maximumFractionDigits: 1
|
|
@@ -3527,20 +4455,20 @@ function ContextUsageIndicator({
|
|
|
3527
4455
|
}) {
|
|
3528
4456
|
const { t } = useChatkitTranslation();
|
|
3529
4457
|
const stream = useStreamContext();
|
|
3530
|
-
const [maxContextSize, setMaxContextSize] =
|
|
3531
|
-
const [usedContextSize, setUsedContextSize] =
|
|
3532
|
-
const [assistantAgentKey, setAssistantAgentKey] =
|
|
3533
|
-
const latestRealtimeUsageRef =
|
|
4458
|
+
const [maxContextSize, setMaxContextSize] = React22.useState(null);
|
|
4459
|
+
const [usedContextSize, setUsedContextSize] = React22.useState(null);
|
|
4460
|
+
const [assistantAgentKey, setAssistantAgentKey] = React22.useState(null);
|
|
4461
|
+
const latestRealtimeUsageRef = React22.useRef({
|
|
3534
4462
|
threadId: null,
|
|
3535
4463
|
agentKey: null,
|
|
3536
4464
|
usedTokens: null
|
|
3537
4465
|
});
|
|
3538
|
-
const realtimeUsage =
|
|
4466
|
+
const realtimeUsage = React22.useMemo(
|
|
3539
4467
|
() => getThreadContextUsage(stream.contextUsageByAgentKey, assistantAgentKey),
|
|
3540
4468
|
[assistantAgentKey, stream.contextUsageByAgentKey]
|
|
3541
4469
|
);
|
|
3542
4470
|
const realtimeUsedContextSize = getThreadContextUsageTotalTokens(realtimeUsage);
|
|
3543
|
-
|
|
4471
|
+
React22.useEffect(() => {
|
|
3544
4472
|
if (!stream.client || !stream.assistantId) {
|
|
3545
4473
|
setMaxContextSize(null);
|
|
3546
4474
|
setAssistantAgentKey(null);
|
|
@@ -3560,18 +4488,18 @@ function ContextUsageIndicator({
|
|
|
3560
4488
|
cancelled = true;
|
|
3561
4489
|
};
|
|
3562
4490
|
}, [stream.client, stream.assistantId]);
|
|
3563
|
-
|
|
4491
|
+
React22.useEffect(() => {
|
|
3564
4492
|
latestRealtimeUsageRef.current = {
|
|
3565
4493
|
threadId: stream.threadId ?? null,
|
|
3566
4494
|
agentKey: assistantAgentKey,
|
|
3567
4495
|
usedTokens: realtimeUsedContextSize
|
|
3568
4496
|
};
|
|
3569
4497
|
}, [assistantAgentKey, realtimeUsedContextSize, stream.threadId]);
|
|
3570
|
-
|
|
4498
|
+
React22.useEffect(() => {
|
|
3571
4499
|
if (realtimeUsedContextSize == null) return;
|
|
3572
4500
|
setUsedContextSize(realtimeUsedContextSize);
|
|
3573
4501
|
}, [realtimeUsedContextSize]);
|
|
3574
|
-
|
|
4502
|
+
React22.useEffect(() => {
|
|
3575
4503
|
if (!stream.client) {
|
|
3576
4504
|
setUsedContextSize(null);
|
|
3577
4505
|
return;
|
|
@@ -3636,8 +4564,8 @@ function ContextUsageIndicator({
|
|
|
3636
4564
|
});
|
|
3637
4565
|
const usageLabelWithSuffix = usageLabel.endsWith(":") ? usageLabel : `${usageLabel}:`;
|
|
3638
4566
|
const progressClassName = percent >= 90 ? "text-destructive" : percent >= 75 ? "text-amber-500" : "text-primary dark:text-zinc-300";
|
|
3639
|
-
return /* @__PURE__ */
|
|
3640
|
-
/* @__PURE__ */
|
|
4567
|
+
return /* @__PURE__ */ jsxs17(Tooltip, { children: [
|
|
4568
|
+
/* @__PURE__ */ jsx28(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx28(
|
|
3641
4569
|
"button",
|
|
3642
4570
|
{
|
|
3643
4571
|
type: "button",
|
|
@@ -3646,21 +4574,73 @@ function ContextUsageIndicator({
|
|
|
3646
4574
|
className
|
|
3647
4575
|
),
|
|
3648
4576
|
"aria-label": `${usageLabelWithSuffix} ${usageFullLabel}. ${usageTokensLabel}`,
|
|
3649
|
-
children: /* @__PURE__ */
|
|
4577
|
+
children: /* @__PURE__ */ jsx28(ProgressCircle, { value: percent, className: cn("size-3.5", progressClassName) })
|
|
3650
4578
|
}
|
|
3651
4579
|
) }),
|
|
3652
|
-
/* @__PURE__ */
|
|
3653
|
-
/* @__PURE__ */
|
|
3654
|
-
/* @__PURE__ */
|
|
3655
|
-
/* @__PURE__ */
|
|
4580
|
+
/* @__PURE__ */ jsxs17(TooltipContent, { side: "top", sideOffset: 6, className: "space-y-0.5 px-3 py-2 text-center", children: [
|
|
4581
|
+
/* @__PURE__ */ jsx28("div", { className: "text-primary-foreground/70", children: usageLabelWithSuffix }),
|
|
4582
|
+
/* @__PURE__ */ jsx28("div", { className: "font-medium text-primary-foreground/80", children: usageFullLabel }),
|
|
4583
|
+
/* @__PURE__ */ jsx28("div", { className: "text-sm font-semibold", children: usageTokensLabel })
|
|
3656
4584
|
] })
|
|
3657
4585
|
] });
|
|
3658
4586
|
}
|
|
3659
4587
|
|
|
3660
4588
|
// src/components/chat.tsx
|
|
3661
|
-
import { Fragment as
|
|
4589
|
+
import { Fragment as Fragment4, jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3662
4590
|
var defaultApiUrl2 = import.meta.env.VITE_XPERTAI_API_URL;
|
|
3663
4591
|
var COMPOSER_INPUT_MAX_HEIGHT = 128;
|
|
4592
|
+
var LONG_TEXT_REFERENCE_THRESHOLD = 5e3;
|
|
4593
|
+
async function readImageDimensions(file) {
|
|
4594
|
+
if (typeof window === "undefined" || typeof URL === "undefined") {
|
|
4595
|
+
return {};
|
|
4596
|
+
}
|
|
4597
|
+
return new Promise((resolve) => {
|
|
4598
|
+
const objectUrl = URL.createObjectURL(file);
|
|
4599
|
+
const image = new window.Image();
|
|
4600
|
+
const cleanup = () => {
|
|
4601
|
+
URL.revokeObjectURL(objectUrl);
|
|
4602
|
+
};
|
|
4603
|
+
image.onload = () => {
|
|
4604
|
+
resolve({
|
|
4605
|
+
width: image.naturalWidth || void 0,
|
|
4606
|
+
height: image.naturalHeight || void 0
|
|
4607
|
+
});
|
|
4608
|
+
cleanup();
|
|
4609
|
+
};
|
|
4610
|
+
image.onerror = () => {
|
|
4611
|
+
resolve({});
|
|
4612
|
+
cleanup();
|
|
4613
|
+
};
|
|
4614
|
+
image.src = objectUrl;
|
|
4615
|
+
});
|
|
4616
|
+
}
|
|
4617
|
+
function getStorageFileUrl(file) {
|
|
4618
|
+
return file.url ?? file.fileUrl ?? file.thumbUrl;
|
|
4619
|
+
}
|
|
4620
|
+
function buildPastedImageReference(file, storageFile, dimensions) {
|
|
4621
|
+
const name = storageFile.originalName?.trim() || file.name.trim() || "Pasted image";
|
|
4622
|
+
const mimeType = storageFile.mimetype?.trim() || file.type.trim() || "image/*";
|
|
4623
|
+
const size2 = storageFile.size ?? file.size;
|
|
4624
|
+
const width = dimensions?.width;
|
|
4625
|
+
const height = dimensions?.height;
|
|
4626
|
+
const metaParts = [
|
|
4627
|
+
mimeType,
|
|
4628
|
+
width && height ? `${width}x${height}` : null,
|
|
4629
|
+
typeof size2 === "number" ? `${size2} bytes` : null
|
|
4630
|
+
].filter((part) => Boolean(part));
|
|
4631
|
+
return {
|
|
4632
|
+
type: "image",
|
|
4633
|
+
id: storageFile.id,
|
|
4634
|
+
fileId: storageFile.id,
|
|
4635
|
+
url: getStorageFileUrl(storageFile),
|
|
4636
|
+
mimeType,
|
|
4637
|
+
name,
|
|
4638
|
+
...typeof size2 === "number" ? { size: size2 } : {},
|
|
4639
|
+
...width ? { width } : {},
|
|
4640
|
+
...height ? { height } : {},
|
|
4641
|
+
text: `Pasted image${metaParts.length ? ` (${metaParts.join(", ")})` : ""}: ${name}`
|
|
4642
|
+
};
|
|
4643
|
+
}
|
|
3664
4644
|
function formatMessageContent(content) {
|
|
3665
4645
|
if (typeof content === "string") {
|
|
3666
4646
|
return content;
|
|
@@ -3697,8 +4677,8 @@ function ReferenceChip({
|
|
|
3697
4677
|
}) {
|
|
3698
4678
|
const metaLine = getReferenceMetaLine(reference);
|
|
3699
4679
|
const isComposer = variant === "composer";
|
|
3700
|
-
const Icon = reference.type === "quote" ? Quote : FileText2;
|
|
3701
|
-
return /* @__PURE__ */
|
|
4680
|
+
const Icon = reference.type === "quote" ? Quote : reference.type === "image" ? ImageIcon : FileText2;
|
|
4681
|
+
return /* @__PURE__ */ jsxs18(
|
|
3702
4682
|
"div",
|
|
3703
4683
|
{
|
|
3704
4684
|
className: cn(
|
|
@@ -3707,7 +4687,7 @@ function ReferenceChip({
|
|
|
3707
4687
|
),
|
|
3708
4688
|
title: getReferenceTitle(reference),
|
|
3709
4689
|
children: [
|
|
3710
|
-
/* @__PURE__ */
|
|
4690
|
+
/* @__PURE__ */ jsx29(
|
|
3711
4691
|
Icon,
|
|
3712
4692
|
{
|
|
3713
4693
|
size: isComposer ? 14 : 12,
|
|
@@ -3717,29 +4697,29 @@ function ReferenceChip({
|
|
|
3717
4697
|
)
|
|
3718
4698
|
}
|
|
3719
4699
|
),
|
|
3720
|
-
/* @__PURE__ */
|
|
3721
|
-
/* @__PURE__ */
|
|
4700
|
+
/* @__PURE__ */ jsxs18("div", { className: "min-w-0 flex-1", children: [
|
|
4701
|
+
/* @__PURE__ */ jsx29(
|
|
3722
4702
|
"div",
|
|
3723
4703
|
{
|
|
3724
4704
|
className: cn(
|
|
3725
|
-
"truncate",
|
|
4705
|
+
"truncate whitespace-pre-wrap",
|
|
3726
4706
|
isComposer ? "text-sm" : "text-xs font-medium"
|
|
3727
4707
|
),
|
|
3728
4708
|
children: getReferenceLabel(reference)
|
|
3729
4709
|
}
|
|
3730
4710
|
),
|
|
3731
|
-
metaLine && /* @__PURE__ */
|
|
4711
|
+
metaLine && /* @__PURE__ */ jsx29(
|
|
3732
4712
|
"div",
|
|
3733
4713
|
{
|
|
3734
4714
|
className: cn(
|
|
3735
|
-
"truncate",
|
|
4715
|
+
"truncate whitespace-pre-wrap",
|
|
3736
4716
|
isComposer ? "text-xs text-muted-foreground" : "text-[10px] text-primary-foreground/75"
|
|
3737
4717
|
),
|
|
3738
4718
|
children: metaLine
|
|
3739
4719
|
}
|
|
3740
4720
|
)
|
|
3741
4721
|
] }),
|
|
3742
|
-
onRemove && removeLabel && /* @__PURE__ */
|
|
4722
|
+
onRemove && removeLabel && /* @__PURE__ */ jsx29(
|
|
3743
4723
|
"button",
|
|
3744
4724
|
{
|
|
3745
4725
|
type: "button",
|
|
@@ -3750,7 +4730,7 @@ function ReferenceChip({
|
|
|
3750
4730
|
),
|
|
3751
4731
|
title: removeLabel,
|
|
3752
4732
|
"aria-label": removeLabel,
|
|
3753
|
-
children: /* @__PURE__ */
|
|
4733
|
+
children: /* @__PURE__ */ jsx29(X3, { size: 12 })
|
|
3754
4734
|
}
|
|
3755
4735
|
)
|
|
3756
4736
|
]
|
|
@@ -3774,20 +4754,20 @@ function Chat({
|
|
|
3774
4754
|
const { setStream } = useStreamManager();
|
|
3775
4755
|
const stream = useStreamContext();
|
|
3776
4756
|
const { theme } = useTheme();
|
|
3777
|
-
const [isHistoryLoading, setIsHistoryLoading] =
|
|
3778
|
-
const [historyError, setHistoryError] =
|
|
3779
|
-
const [assistantName, setAssistantName] =
|
|
3780
|
-
const [assistantAvatar, setAssistantAvatar] =
|
|
4757
|
+
const [isHistoryLoading, setIsHistoryLoading] = React23.useState(false);
|
|
4758
|
+
const [historyError, setHistoryError] = React23.useState(null);
|
|
4759
|
+
const [assistantName, setAssistantName] = React23.useState(null);
|
|
4760
|
+
const [assistantAvatar, setAssistantAvatar] = React23.useState(null);
|
|
3781
4761
|
const LOADING_DOTS_MIN_DURATION = 800;
|
|
3782
4762
|
const STREAMING_STATUS_REFRESH_MS = 250;
|
|
3783
|
-
const [showLoadingDots, setShowLoadingDots] =
|
|
3784
|
-
const [streamingNow, setStreamingNow] =
|
|
3785
|
-
const loadingStartTimeRef =
|
|
3786
|
-
const lastStreamOutputAtRef =
|
|
3787
|
-
|
|
4763
|
+
const [showLoadingDots, setShowLoadingDots] = React23.useState(false);
|
|
4764
|
+
const [streamingNow, setStreamingNow] = React23.useState(() => Date.now());
|
|
4765
|
+
const loadingStartTimeRef = React23.useRef(null);
|
|
4766
|
+
const lastStreamOutputAtRef = React23.useRef(null);
|
|
4767
|
+
React23.useEffect(() => {
|
|
3788
4768
|
setStream(stream);
|
|
3789
4769
|
}, [setStream, stream]);
|
|
3790
|
-
|
|
4770
|
+
React23.useEffect(() => {
|
|
3791
4771
|
if (stream.isLoading) {
|
|
3792
4772
|
if (!loadingStartTimeRef.current) {
|
|
3793
4773
|
loadingStartTimeRef.current = Date.now();
|
|
@@ -3810,7 +4790,7 @@ function Chat({
|
|
|
3810
4790
|
}
|
|
3811
4791
|
}
|
|
3812
4792
|
}, [stream.isLoading]);
|
|
3813
|
-
|
|
4793
|
+
React23.useEffect(() => {
|
|
3814
4794
|
if (!stream.isLoading) {
|
|
3815
4795
|
lastStreamOutputAtRef.current = null;
|
|
3816
4796
|
setStreamingNow(Date.now());
|
|
@@ -3820,7 +4800,7 @@ function Chat({
|
|
|
3820
4800
|
lastStreamOutputAtRef.current = now;
|
|
3821
4801
|
setStreamingNow(now);
|
|
3822
4802
|
}, [stream.messages, stream.isLoading]);
|
|
3823
|
-
|
|
4803
|
+
React23.useEffect(() => {
|
|
3824
4804
|
if (!stream.isLoading) {
|
|
3825
4805
|
return;
|
|
3826
4806
|
}
|
|
@@ -3829,51 +4809,53 @@ function Chat({
|
|
|
3829
4809
|
}, STREAMING_STATUS_REFRESH_MS);
|
|
3830
4810
|
return () => window.clearInterval(timer);
|
|
3831
4811
|
}, [stream.isLoading]);
|
|
3832
|
-
const [draft, setDraft] =
|
|
3833
|
-
const [selectedTool, setSelectedTool] =
|
|
4812
|
+
const [draft, setDraft] = React23.useState("");
|
|
4813
|
+
const [selectedTool, setSelectedTool] = React23.useState(
|
|
3834
4814
|
null
|
|
3835
4815
|
);
|
|
3836
|
-
const [attachments, setAttachments] =
|
|
3837
|
-
const [references, setReferences] =
|
|
3838
|
-
const [
|
|
3839
|
-
const [
|
|
3840
|
-
const [
|
|
4816
|
+
const [attachments, setAttachments] = React23.useState([]);
|
|
4817
|
+
const [references, setReferences] = React23.useState([]);
|
|
4818
|
+
const [isUploadingReferenceImages, setIsUploadingReferenceImages] = React23.useState(false);
|
|
4819
|
+
const [quoteSelection, setQuoteSelection] = React23.useState(null);
|
|
4820
|
+
const [isAtBottom, setIsAtBottom] = React23.useState(true);
|
|
4821
|
+
const [hasUpdatesBelow, setHasUpdatesBelow] = React23.useState(false);
|
|
3841
4822
|
const {
|
|
3842
4823
|
threads,
|
|
3843
4824
|
deleteThread,
|
|
3844
4825
|
refreshThreads,
|
|
3845
4826
|
isLoading: isThreadsLoading
|
|
3846
4827
|
} = useThreads();
|
|
3847
|
-
const viewportRef =
|
|
3848
|
-
const fileInputRef =
|
|
3849
|
-
const composerInputRef =
|
|
3850
|
-
const shouldAutoScrollRef =
|
|
3851
|
-
const forceFollowRef =
|
|
3852
|
-
const previousMessageCountRef =
|
|
3853
|
-
const previousScrollTopRef =
|
|
3854
|
-
const autoScrollFrameRef =
|
|
3855
|
-
const isPointerDownRef =
|
|
3856
|
-
const lastTouchYRef =
|
|
4828
|
+
const viewportRef = React23.useRef(null);
|
|
4829
|
+
const fileInputRef = React23.useRef(null);
|
|
4830
|
+
const composerInputRef = React23.useRef(null);
|
|
4831
|
+
const shouldAutoScrollRef = React23.useRef(true);
|
|
4832
|
+
const forceFollowRef = React23.useRef(false);
|
|
4833
|
+
const previousMessageCountRef = React23.useRef(0);
|
|
4834
|
+
const previousScrollTopRef = React23.useRef(0);
|
|
4835
|
+
const autoScrollFrameRef = React23.useRef(null);
|
|
4836
|
+
const isPointerDownRef = React23.useRef(false);
|
|
4837
|
+
const lastTouchYRef = React23.useRef(null);
|
|
3857
4838
|
const resolvedTitle = title ?? t("chat.title");
|
|
3858
4839
|
const resolvedPlaceholder = placeholder ?? t("chat.placeholder");
|
|
3859
4840
|
const inputPlaceholder = selectedTool?.placeholderOverride ?? composer?.placeholder ?? resolvedPlaceholder;
|
|
3860
|
-
const messages =
|
|
4841
|
+
const messages = React23.useMemo(
|
|
3861
4842
|
() => stream.messages ?? [],
|
|
3862
4843
|
[stream.messages]
|
|
3863
4844
|
);
|
|
3864
4845
|
const trimmedDraft = draft.trim();
|
|
3865
4846
|
const hasReferences = references.length > 0;
|
|
3866
|
-
const pendingFollowUps =
|
|
4847
|
+
const pendingFollowUps = React23.useMemo(
|
|
3867
4848
|
() => [...stream.pendingFollowUps ?? []].sort(
|
|
3868
4849
|
(a, b) => a.createdAt - b.createdAt
|
|
3869
4850
|
),
|
|
3870
4851
|
[stream.pendingFollowUps]
|
|
3871
4852
|
);
|
|
3872
|
-
const
|
|
4853
|
+
const hasPendingFollowUps = pendingFollowUps.length > 0;
|
|
4854
|
+
const clearQuoteSelection = React23.useCallback(() => {
|
|
3873
4855
|
setQuoteSelection(null);
|
|
3874
4856
|
}, []);
|
|
3875
4857
|
useParentMessenger({
|
|
3876
|
-
onSetComposerValue:
|
|
4858
|
+
onSetComposerValue: React23.useCallback(
|
|
3877
4859
|
(payload) => {
|
|
3878
4860
|
if (!payload) {
|
|
3879
4861
|
return;
|
|
@@ -3896,11 +4878,11 @@ function Chat({
|
|
|
3896
4878
|
},
|
|
3897
4879
|
[composer?.tools]
|
|
3898
4880
|
),
|
|
3899
|
-
onFocusComposer:
|
|
4881
|
+
onFocusComposer: React23.useCallback(() => {
|
|
3900
4882
|
composerInputRef.current?.focus();
|
|
3901
4883
|
}, [])
|
|
3902
4884
|
});
|
|
3903
|
-
const syncQuoteSelection =
|
|
4885
|
+
const syncQuoteSelection = React23.useCallback(() => {
|
|
3904
4886
|
if (typeof window === "undefined") {
|
|
3905
4887
|
clearQuoteSelection();
|
|
3906
4888
|
return;
|
|
@@ -3945,23 +4927,23 @@ function Chat({
|
|
|
3945
4927
|
left
|
|
3946
4928
|
});
|
|
3947
4929
|
}, [clearQuoteSelection]);
|
|
3948
|
-
const cancelPendingAutoScroll =
|
|
4930
|
+
const cancelPendingAutoScroll = React23.useCallback(() => {
|
|
3949
4931
|
if (autoScrollFrameRef.current !== null) {
|
|
3950
4932
|
cancelAnimationFrame(autoScrollFrameRef.current);
|
|
3951
4933
|
autoScrollFrameRef.current = null;
|
|
3952
4934
|
}
|
|
3953
4935
|
}, []);
|
|
3954
|
-
const disableAutoFollow =
|
|
4936
|
+
const disableAutoFollow = React23.useCallback(() => {
|
|
3955
4937
|
forceFollowRef.current = false;
|
|
3956
4938
|
shouldAutoScrollRef.current = false;
|
|
3957
4939
|
cancelPendingAutoScroll();
|
|
3958
4940
|
}, [cancelPendingAutoScroll]);
|
|
3959
|
-
const enableAutoFollow =
|
|
4941
|
+
const enableAutoFollow = React23.useCallback(() => {
|
|
3960
4942
|
forceFollowRef.current = true;
|
|
3961
4943
|
shouldAutoScrollRef.current = true;
|
|
3962
4944
|
setHasUpdatesBelow(false);
|
|
3963
4945
|
}, []);
|
|
3964
|
-
const scrollToBottom =
|
|
4946
|
+
const scrollToBottom = React23.useCallback(
|
|
3965
4947
|
(smooth = false, force = false) => {
|
|
3966
4948
|
if (force) {
|
|
3967
4949
|
enableAutoFollow();
|
|
@@ -3983,7 +4965,7 @@ function Chat({
|
|
|
3983
4965
|
},
|
|
3984
4966
|
[cancelPendingAutoScroll, enableAutoFollow]
|
|
3985
4967
|
);
|
|
3986
|
-
|
|
4968
|
+
React23.useEffect(() => {
|
|
3987
4969
|
const viewport = viewportRef.current;
|
|
3988
4970
|
if (!viewport) return;
|
|
3989
4971
|
previousScrollTopRef.current = viewport.scrollTop;
|
|
@@ -4064,14 +5046,14 @@ function Chat({
|
|
|
4064
5046
|
window.removeEventListener("pointercancel", stopPointerTracking);
|
|
4065
5047
|
};
|
|
4066
5048
|
}, [cancelPendingAutoScroll, disableAutoFollow]);
|
|
4067
|
-
|
|
5049
|
+
React23.useEffect(() => {
|
|
4068
5050
|
shouldAutoScrollRef.current = true;
|
|
4069
5051
|
forceFollowRef.current = false;
|
|
4070
5052
|
previousScrollTopRef.current = 0;
|
|
4071
5053
|
setIsAtBottom(true);
|
|
4072
5054
|
setHasUpdatesBelow(false);
|
|
4073
5055
|
}, [stream.threadId]);
|
|
4074
|
-
|
|
5056
|
+
React23.useEffect(() => {
|
|
4075
5057
|
const messageCountChanged = messages.length !== previousMessageCountRef.current;
|
|
4076
5058
|
previousMessageCountRef.current = messages.length;
|
|
4077
5059
|
if (!shouldAutoScrollRef.current) {
|
|
@@ -4090,7 +5072,7 @@ function Chat({
|
|
|
4090
5072
|
clientSecret: effectiveClientSecret
|
|
4091
5073
|
});
|
|
4092
5074
|
const missingConfig = Boolean(missingConfigKind);
|
|
4093
|
-
const missingConfigShortMessage =
|
|
5075
|
+
const missingConfigShortMessage = React23.useMemo(() => {
|
|
4094
5076
|
switch (missingConfigKind) {
|
|
4095
5077
|
case "apiUrl":
|
|
4096
5078
|
return t("chat.missingApiUrlShort");
|
|
@@ -4102,7 +5084,7 @@ function Chat({
|
|
|
4102
5084
|
return t("chat.missingConfigShort");
|
|
4103
5085
|
}
|
|
4104
5086
|
}, [missingConfigKind, t]);
|
|
4105
|
-
const missingConfigDetailMessage =
|
|
5087
|
+
const missingConfigDetailMessage = React23.useMemo(() => {
|
|
4106
5088
|
switch (missingConfigKind) {
|
|
4107
5089
|
case "apiUrl":
|
|
4108
5090
|
return t("chat.missingApiUrlDetail");
|
|
@@ -4116,8 +5098,8 @@ function Chat({
|
|
|
4116
5098
|
}, [missingConfigKind, t]);
|
|
4117
5099
|
const showMissingConfig = !isClientSecretInitializing && missingConfig;
|
|
4118
5100
|
const hasUploadingFiles = attachments.some((a) => a.status === "uploading");
|
|
4119
|
-
const isSendDisabled = !trimmedDraft && !hasReferences || missingConfig || isHistoryLoading || hasUploadingFiles;
|
|
4120
|
-
const resizeComposerInput =
|
|
5101
|
+
const isSendDisabled = !trimmedDraft && !hasReferences || missingConfig || isHistoryLoading || hasUploadingFiles || isUploadingReferenceImages;
|
|
5102
|
+
const resizeComposerInput = React23.useCallback(() => {
|
|
4121
5103
|
const textarea = composerInputRef.current;
|
|
4122
5104
|
if (!textarea) {
|
|
4123
5105
|
return;
|
|
@@ -4130,16 +5112,16 @@ function Chat({
|
|
|
4130
5112
|
textarea.style.height = `${nextHeight}px`;
|
|
4131
5113
|
textarea.style.overflowY = textarea.scrollHeight > COMPOSER_INPUT_MAX_HEIGHT ? "auto" : "hidden";
|
|
4132
5114
|
}, []);
|
|
4133
|
-
|
|
5115
|
+
React23.useEffect(() => {
|
|
4134
5116
|
resizeComposerInput();
|
|
4135
5117
|
}, [draft, resizeComposerInput]);
|
|
4136
|
-
|
|
5118
|
+
React23.useEffect(() => {
|
|
4137
5119
|
document.addEventListener("selectionchange", syncQuoteSelection);
|
|
4138
5120
|
return () => {
|
|
4139
5121
|
document.removeEventListener("selectionchange", syncQuoteSelection);
|
|
4140
5122
|
};
|
|
4141
5123
|
}, [syncQuoteSelection]);
|
|
4142
|
-
|
|
5124
|
+
React23.useEffect(() => {
|
|
4143
5125
|
const viewport = viewportRef.current;
|
|
4144
5126
|
if (!viewport) {
|
|
4145
5127
|
return;
|
|
@@ -4156,14 +5138,14 @@ function Chat({
|
|
|
4156
5138
|
window.removeEventListener("resize", handleViewportScroll);
|
|
4157
5139
|
};
|
|
4158
5140
|
}, [clearQuoteSelection]);
|
|
4159
|
-
|
|
5141
|
+
React23.useEffect(() => {
|
|
4160
5142
|
clearQuoteSelection();
|
|
4161
5143
|
}, [messages.length, stream.threadId, clearQuoteSelection]);
|
|
4162
|
-
|
|
5144
|
+
React23.useEffect(() => {
|
|
4163
5145
|
if (missingConfig) return;
|
|
4164
5146
|
void refreshThreads();
|
|
4165
5147
|
}, [missingConfig, refreshThreads]);
|
|
4166
|
-
|
|
5148
|
+
React23.useEffect(() => {
|
|
4167
5149
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
4168
5150
|
setAssistantName(null);
|
|
4169
5151
|
setAssistantAvatar(null);
|
|
@@ -4194,7 +5176,7 @@ function Chat({
|
|
|
4194
5176
|
mimetype: a.storageFile?.mimetype ?? a.file.type,
|
|
4195
5177
|
size: a.storageFile?.size ?? a.file.size
|
|
4196
5178
|
}));
|
|
4197
|
-
const submitDraft =
|
|
5179
|
+
const submitDraft = React23.useCallback(
|
|
4198
5180
|
(followUpOverride) => {
|
|
4199
5181
|
if (isSendDisabled) return;
|
|
4200
5182
|
const filesToSend = uploadedFiles.length > 0 ? [...uploadedFiles] : void 0;
|
|
@@ -4268,7 +5250,7 @@ function Chat({
|
|
|
4268
5250
|
event.preventDefault();
|
|
4269
5251
|
submitDraft();
|
|
4270
5252
|
};
|
|
4271
|
-
const handleEditPendingFollowUp =
|
|
5253
|
+
const handleEditPendingFollowUp = React23.useCallback(
|
|
4272
5254
|
(id) => {
|
|
4273
5255
|
const item = pendingFollowUps.find(
|
|
4274
5256
|
(entry) => entry.id === id && entry.mode === "queue"
|
|
@@ -4295,7 +5277,7 @@ function Chat({
|
|
|
4295
5277
|
},
|
|
4296
5278
|
[pendingFollowUps, stream]
|
|
4297
5279
|
);
|
|
4298
|
-
const handleQuoteSelection =
|
|
5280
|
+
const handleQuoteSelection = React23.useCallback(() => {
|
|
4299
5281
|
if (!quoteSelection) {
|
|
4300
5282
|
return;
|
|
4301
5283
|
}
|
|
@@ -4311,21 +5293,14 @@ function Chat({
|
|
|
4311
5293
|
const handleAttachmentClick = () => {
|
|
4312
5294
|
fileInputRef.current?.click();
|
|
4313
5295
|
};
|
|
5296
|
+
const uploadContextFile = React23.useCallback(
|
|
5297
|
+
(file) => stream.client.contexts.uploadFile(file),
|
|
5298
|
+
[stream.client]
|
|
5299
|
+
);
|
|
4314
5300
|
const handleComposerKeyDown = (event) => {
|
|
4315
5301
|
if (event.key !== "Enter") {
|
|
4316
5302
|
return;
|
|
4317
5303
|
}
|
|
4318
|
-
if (event.shiftKey && (event.metaKey || event.ctrlKey)) {
|
|
4319
|
-
if (event.nativeEvent.isComposing) {
|
|
4320
|
-
return;
|
|
4321
|
-
}
|
|
4322
|
-
event.preventDefault();
|
|
4323
|
-
if (isSendDisabled) {
|
|
4324
|
-
return;
|
|
4325
|
-
}
|
|
4326
|
-
submitDraft(stream.followUpBehavior === "queue" ? "steer" : "queue");
|
|
4327
|
-
return;
|
|
4328
|
-
}
|
|
4329
5304
|
if (event.shiftKey) {
|
|
4330
5305
|
return;
|
|
4331
5306
|
}
|
|
@@ -4336,12 +5311,108 @@ function Chat({
|
|
|
4336
5311
|
if (isSendDisabled) {
|
|
4337
5312
|
return;
|
|
4338
5313
|
}
|
|
5314
|
+
if (stream.isLoading) {
|
|
5315
|
+
submitDraft(
|
|
5316
|
+
getBusyComposerShortcutFollowUpMode(event.metaKey || event.ctrlKey)
|
|
5317
|
+
);
|
|
5318
|
+
return;
|
|
5319
|
+
}
|
|
4339
5320
|
submitDraft();
|
|
4340
5321
|
};
|
|
4341
|
-
const
|
|
5322
|
+
const handleComposerPaste = React23.useCallback(
|
|
5323
|
+
(event) => {
|
|
5324
|
+
const clipboardData = event.clipboardData;
|
|
5325
|
+
if (!clipboardData) {
|
|
5326
|
+
return;
|
|
5327
|
+
}
|
|
5328
|
+
const imageFiles = Array.from(clipboardData.items).filter(
|
|
5329
|
+
(item) => item.kind === "file" && item.type.startsWith("image/")
|
|
5330
|
+
).map((item) => item.getAsFile()).filter((item) => Boolean(item));
|
|
5331
|
+
if (imageFiles.length > 0) {
|
|
5332
|
+
event.preventDefault();
|
|
5333
|
+
const maxCount = composer?.attachments?.maxCount ?? 10;
|
|
5334
|
+
const maxSize = composer?.attachments?.maxSize ?? 100 * 1024 * 1024;
|
|
5335
|
+
const currentImageReferenceCount = references.filter(
|
|
5336
|
+
(reference) => reference.type === "image"
|
|
5337
|
+
).length;
|
|
5338
|
+
const availableSlots = Math.max(
|
|
5339
|
+
0,
|
|
5340
|
+
maxCount - currentImageReferenceCount
|
|
5341
|
+
);
|
|
5342
|
+
const nextFiles = imageFiles.filter((file) => file.size <= maxSize).slice(0, availableSlots);
|
|
5343
|
+
if (nextFiles.length === 0) {
|
|
5344
|
+
return;
|
|
5345
|
+
}
|
|
5346
|
+
setIsUploadingReferenceImages(true);
|
|
5347
|
+
void Promise.allSettled(
|
|
5348
|
+
nextFiles.map(async (file) => {
|
|
5349
|
+
const [dimensions, storageFile] = await Promise.all([
|
|
5350
|
+
readImageDimensions(file),
|
|
5351
|
+
uploadContextFile(file)
|
|
5352
|
+
]);
|
|
5353
|
+
return buildPastedImageReference(file, storageFile, dimensions);
|
|
5354
|
+
})
|
|
5355
|
+
).then((results) => {
|
|
5356
|
+
const nextReferences = results.filter(
|
|
5357
|
+
(result) => result.status === "fulfilled"
|
|
5358
|
+
).map((result) => result.value);
|
|
5359
|
+
if (nextReferences.length > 0) {
|
|
5360
|
+
setReferences(
|
|
5361
|
+
(previous) => mergeReferences(previous, nextReferences)
|
|
5362
|
+
);
|
|
5363
|
+
composerInputRef.current?.focus();
|
|
5364
|
+
}
|
|
5365
|
+
results.filter(
|
|
5366
|
+
(result) => result.status === "rejected"
|
|
5367
|
+
).forEach((result) => {
|
|
5368
|
+
console.warn(
|
|
5369
|
+
"[Chat] Failed to upload pasted image reference:",
|
|
5370
|
+
result.reason
|
|
5371
|
+
);
|
|
5372
|
+
});
|
|
5373
|
+
}).finally(() => {
|
|
5374
|
+
setIsUploadingReferenceImages(false);
|
|
5375
|
+
});
|
|
5376
|
+
return;
|
|
5377
|
+
}
|
|
5378
|
+
const pastedText = clipboardData.getData("text/plain");
|
|
5379
|
+
if (pastedText.trim().length <= LONG_TEXT_REFERENCE_THRESHOLD) {
|
|
5380
|
+
return;
|
|
5381
|
+
}
|
|
5382
|
+
event.preventDefault();
|
|
5383
|
+
setReferences(
|
|
5384
|
+
(previous) => mergeReferences(previous, [
|
|
5385
|
+
{
|
|
5386
|
+
type: "quote",
|
|
5387
|
+
source: "Pasted text",
|
|
5388
|
+
text: pastedText
|
|
5389
|
+
}
|
|
5390
|
+
])
|
|
5391
|
+
);
|
|
5392
|
+
composerInputRef.current?.focus();
|
|
5393
|
+
},
|
|
5394
|
+
[
|
|
5395
|
+
composer?.attachments?.maxCount,
|
|
5396
|
+
composer?.attachments?.maxSize,
|
|
5397
|
+
references,
|
|
5398
|
+
uploadContextFile
|
|
5399
|
+
]
|
|
5400
|
+
);
|
|
5401
|
+
const alternateFollowUpShortcutLabel = React23.useMemo(() => {
|
|
5402
|
+
if (typeof navigator === "undefined") {
|
|
5403
|
+
return "\u2318Enter";
|
|
5404
|
+
}
|
|
5405
|
+
const platform = navigator.platform || navigator.userAgent;
|
|
5406
|
+
return /Mac|iPhone|iPad|iPod/i.test(platform) ? "\u2318Enter" : "Ctrl+Enter";
|
|
5407
|
+
}, []);
|
|
5408
|
+
const followUpShortcutLabels = React23.useMemo(
|
|
5409
|
+
() => getComposerFollowUpShortcutLabels(alternateFollowUpShortcutLabel),
|
|
5410
|
+
[alternateFollowUpShortcutLabel]
|
|
5411
|
+
);
|
|
5412
|
+
const uploadFile = React23.useCallback(
|
|
4342
5413
|
async (localId, file) => {
|
|
4343
5414
|
try {
|
|
4344
|
-
const result = await
|
|
5415
|
+
const result = await uploadContextFile(file);
|
|
4345
5416
|
setAttachments(
|
|
4346
5417
|
(prev) => prev.map(
|
|
4347
5418
|
(item) => item.localId === localId ? { ...item, status: "success", storageFile: result } : item
|
|
@@ -4359,9 +5430,9 @@ function Chat({
|
|
|
4359
5430
|
);
|
|
4360
5431
|
}
|
|
4361
5432
|
},
|
|
4362
|
-
[
|
|
5433
|
+
[uploadContextFile]
|
|
4363
5434
|
);
|
|
4364
|
-
const handleRetryUpload =
|
|
5435
|
+
const handleRetryUpload = React23.useCallback(
|
|
4365
5436
|
(localId) => {
|
|
4366
5437
|
const attachment = attachments.find((a) => a.localId === localId);
|
|
4367
5438
|
if (!attachment || attachment.status !== "error") return;
|
|
@@ -4446,7 +5517,7 @@ function Chat({
|
|
|
4446
5517
|
);
|
|
4447
5518
|
scrollToBottom(true, true);
|
|
4448
5519
|
};
|
|
4449
|
-
const loadConversationMessages =
|
|
5520
|
+
const loadConversationMessages = React23.useCallback(
|
|
4450
5521
|
async (recordId) => {
|
|
4451
5522
|
if (missingConfig) {
|
|
4452
5523
|
setHistoryError(missingConfigShortMessage);
|
|
@@ -4532,18 +5603,18 @@ function Chat({
|
|
|
4532
5603
|
}
|
|
4533
5604
|
};
|
|
4534
5605
|
const acceptMimes = composer?.attachments?.accept ? Object.entries(composer.attachments.accept).map(([mime, exts]) => [mime, ...exts.map((e) => `.${e}`)].join(",")).join(",") : void 0;
|
|
4535
|
-
const currentThread =
|
|
5606
|
+
const currentThread = React23.useMemo(
|
|
4536
5607
|
() => threads.find((item) => item.id === stream.threadId),
|
|
4537
5608
|
[threads, stream.threadId]
|
|
4538
5609
|
);
|
|
4539
5610
|
const errorMessage = stream.error instanceof Error ? stream.error.message : void 0;
|
|
4540
|
-
const threadErrorMessage =
|
|
5611
|
+
const threadErrorMessage = React23.useMemo(() => {
|
|
4541
5612
|
if (currentThread?.status !== "error") return void 0;
|
|
4542
5613
|
const message = currentThread.error?.trim();
|
|
4543
5614
|
return message || t("thread.errorToast");
|
|
4544
5615
|
}, [currentThread, t]);
|
|
4545
5616
|
const assistantTitle = assistantName || resolvedTitle;
|
|
4546
|
-
return /* @__PURE__ */
|
|
5617
|
+
return /* @__PURE__ */ jsxs18(
|
|
4547
5618
|
"div",
|
|
4548
5619
|
{
|
|
4549
5620
|
ref: viewportRef,
|
|
@@ -4552,10 +5623,10 @@ function Chat({
|
|
|
4552
5623
|
className
|
|
4553
5624
|
),
|
|
4554
5625
|
children: [
|
|
4555
|
-
/* @__PURE__ */
|
|
4556
|
-
/* @__PURE__ */
|
|
4557
|
-
/* @__PURE__ */
|
|
4558
|
-
/* @__PURE__ */
|
|
5626
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between border-b p-2 sticky top-0 z-10 bg-background", children: [
|
|
5627
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-3 overflow-hidden", children: [
|
|
5628
|
+
/* @__PURE__ */ jsxs18("div", { className: "relative shrink-0", children: [
|
|
5629
|
+
/* @__PURE__ */ jsx29(
|
|
4559
5630
|
ChatkitAvatar,
|
|
4560
5631
|
{
|
|
4561
5632
|
avatar: assistantAvatar,
|
|
@@ -4563,10 +5634,10 @@ function Chat({
|
|
|
4563
5634
|
label: assistantTitle
|
|
4564
5635
|
}
|
|
4565
5636
|
),
|
|
4566
|
-
/* @__PURE__ */
|
|
5637
|
+
/* @__PURE__ */ jsx29("span", { className: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-green-500" })
|
|
4567
5638
|
] }),
|
|
4568
|
-
/* @__PURE__ */
|
|
4569
|
-
/* @__PURE__ */
|
|
5639
|
+
/* @__PURE__ */ jsxs18("div", { className: "truncate", children: [
|
|
5640
|
+
/* @__PURE__ */ jsx29(
|
|
4570
5641
|
"h2",
|
|
4571
5642
|
{
|
|
4572
5643
|
className: "text-lg font-semibold truncate",
|
|
@@ -4574,11 +5645,11 @@ function Chat({
|
|
|
4574
5645
|
children: assistantTitle
|
|
4575
5646
|
}
|
|
4576
5647
|
),
|
|
4577
|
-
/* @__PURE__ */
|
|
5648
|
+
/* @__PURE__ */ jsx29("p", { className: "text-xs text-muted-foreground", children: t("chat.statusOnline") })
|
|
4578
5649
|
] })
|
|
4579
5650
|
] }),
|
|
4580
|
-
history?.enabled !== false && /* @__PURE__ */
|
|
4581
|
-
/* @__PURE__ */
|
|
5651
|
+
history?.enabled !== false && /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-1", children: [
|
|
5652
|
+
/* @__PURE__ */ jsx29(
|
|
4582
5653
|
"button",
|
|
4583
5654
|
{
|
|
4584
5655
|
type: "button",
|
|
@@ -4591,10 +5662,10 @@ function Chat({
|
|
|
4591
5662
|
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
4592
5663
|
),
|
|
4593
5664
|
title: t("history.newThread"),
|
|
4594
|
-
children: /* @__PURE__ */
|
|
5665
|
+
children: /* @__PURE__ */ jsx29(Pencil3, { size: 16 })
|
|
4595
5666
|
}
|
|
4596
5667
|
),
|
|
4597
|
-
/* @__PURE__ */
|
|
5668
|
+
/* @__PURE__ */ jsx29(
|
|
4598
5669
|
HistorySidebar,
|
|
4599
5670
|
{
|
|
4600
5671
|
threads,
|
|
@@ -4608,18 +5679,18 @@ function Chat({
|
|
|
4608
5679
|
)
|
|
4609
5680
|
] })
|
|
4610
5681
|
] }),
|
|
4611
|
-
/* @__PURE__ */
|
|
4612
|
-
errorMessage && /* @__PURE__ */
|
|
4613
|
-
historyError && /* @__PURE__ */
|
|
4614
|
-
showMissingConfig && /* @__PURE__ */
|
|
4615
|
-
isHistoryLoading && /* @__PURE__ */
|
|
4616
|
-
messages.length === 0 ? /* @__PURE__ */
|
|
5682
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex-1 p-4", children: [
|
|
5683
|
+
errorMessage && /* @__PURE__ */ jsx29("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: errorMessage }),
|
|
5684
|
+
historyError && /* @__PURE__ */ jsx29("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: historyError }),
|
|
5685
|
+
showMissingConfig && /* @__PURE__ */ jsx29("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: missingConfigDetailMessage }),
|
|
5686
|
+
isHistoryLoading && /* @__PURE__ */ jsx29("div", { className: "mb-4 rounded-lg border border-muted px-3 py-2 text-sm text-muted-foreground", children: t("chat.loadingThread") }),
|
|
5687
|
+
messages.length === 0 ? /* @__PURE__ */ jsx29(
|
|
4617
5688
|
StartScreen,
|
|
4618
5689
|
{
|
|
4619
5690
|
startScreen,
|
|
4620
5691
|
onPromptClick: handlePromptClick
|
|
4621
5692
|
}
|
|
4622
|
-
) : /* @__PURE__ */
|
|
5693
|
+
) : /* @__PURE__ */ jsxs18("div", { className: "space-y-4", children: [
|
|
4623
5694
|
messages.map((message, index) => {
|
|
4624
5695
|
const messageType = String(message.type);
|
|
4625
5696
|
const isAssistantMessage = messageType === "assistant" || messageType === "ai";
|
|
@@ -4646,7 +5717,7 @@ function Chat({
|
|
|
4646
5717
|
if (!isAssistantMessage && !hasPlainRenderableContent && !hasHumanAttachments && humanReferences.length === 0) {
|
|
4647
5718
|
return null;
|
|
4648
5719
|
}
|
|
4649
|
-
return /* @__PURE__ */
|
|
5720
|
+
return /* @__PURE__ */ jsx29(
|
|
4650
5721
|
"div",
|
|
4651
5722
|
{
|
|
4652
5723
|
className: cn(
|
|
@@ -4654,8 +5725,8 @@ function Chat({
|
|
|
4654
5725
|
message.type === "human" ? "justify-end" : "justify-start -ml-1"
|
|
4655
5726
|
// AI messages: slightly closer to left
|
|
4656
5727
|
),
|
|
4657
|
-
children: /* @__PURE__ */
|
|
4658
|
-
/* @__PURE__ */
|
|
5728
|
+
children: /* @__PURE__ */ jsxs18("div", { className: "flex flex-col px-3 overflow-hidden", children: [
|
|
5729
|
+
/* @__PURE__ */ jsx29(
|
|
4659
5730
|
"div",
|
|
4660
5731
|
{
|
|
4661
5732
|
...canQuoteMessage ? {
|
|
@@ -4667,7 +5738,7 @@ function Chat({
|
|
|
4667
5738
|
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"
|
|
4668
5739
|
// AI messages: use chat-specific foreground color
|
|
4669
5740
|
),
|
|
4670
|
-
children: isAssistantMessage ? /* @__PURE__ */
|
|
5741
|
+
children: isAssistantMessage ? /* @__PURE__ */ jsx29(
|
|
4671
5742
|
AssistantMessage,
|
|
4672
5743
|
{
|
|
4673
5744
|
message: {
|
|
@@ -4677,8 +5748,8 @@ function Chat({
|
|
|
4677
5748
|
isStreaming: isStreamingMessage,
|
|
4678
5749
|
streamingStatus
|
|
4679
5750
|
}
|
|
4680
|
-
) : /* @__PURE__ */
|
|
4681
|
-
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */
|
|
5751
|
+
) : /* @__PURE__ */ jsxs18(Fragment4, { children: [
|
|
5752
|
+
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ jsx29("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanReferences.map((reference) => /* @__PURE__ */ jsx29(
|
|
4682
5753
|
ReferenceChip,
|
|
4683
5754
|
{
|
|
4684
5755
|
reference,
|
|
@@ -4686,29 +5757,29 @@ function Chat({
|
|
|
4686
5757
|
},
|
|
4687
5758
|
getReferenceKey(reference)
|
|
4688
5759
|
)) }),
|
|
4689
|
-
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */
|
|
5760
|
+
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ jsx29("div", { className: "flex flex-wrap gap-1.5 mb-2", children: humanAttachments.map((file, fileIndex) => /* @__PURE__ */ jsxs18(
|
|
4690
5761
|
"div",
|
|
4691
5762
|
{
|
|
4692
5763
|
className: "flex items-center gap-1.5 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs",
|
|
4693
5764
|
children: [
|
|
4694
|
-
/* @__PURE__ */
|
|
4695
|
-
/* @__PURE__ */
|
|
5765
|
+
/* @__PURE__ */ jsx29(FileText2, { size: 12 }),
|
|
5766
|
+
/* @__PURE__ */ jsx29("span", { className: "max-w-[100px] truncate", children: file.originalName })
|
|
4696
5767
|
]
|
|
4697
5768
|
},
|
|
4698
5769
|
fileIndex
|
|
4699
5770
|
)) }),
|
|
4700
|
-
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */
|
|
5771
|
+
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ jsx29(
|
|
4701
5772
|
"p",
|
|
4702
5773
|
{
|
|
4703
5774
|
className: "wrap-break-word text-sm leading-relaxed",
|
|
4704
5775
|
children: formatMessageContent(part)
|
|
4705
5776
|
},
|
|
4706
5777
|
`${part.type}-${partIndex}`
|
|
4707
|
-
)) : /* @__PURE__ */
|
|
5778
|
+
)) : /* @__PURE__ */ jsx29("span", { className: "wrap-break-word text-sm leading-relaxed", children: formatMessageContent(message.content) })
|
|
4708
5779
|
] })
|
|
4709
5780
|
}
|
|
4710
5781
|
),
|
|
4711
|
-
/* @__PURE__ */
|
|
5782
|
+
/* @__PURE__ */ jsx29(
|
|
4712
5783
|
MessageActions,
|
|
4713
5784
|
{
|
|
4714
5785
|
content: messageContent,
|
|
@@ -4744,7 +5815,7 @@ function Chat({
|
|
|
4744
5815
|
stream.isLoading,
|
|
4745
5816
|
{ now: streamingNow }
|
|
4746
5817
|
);
|
|
4747
|
-
return /* @__PURE__ */
|
|
5818
|
+
return /* @__PURE__ */ jsx29("div", { className: "flex justify-start gap-3 -ml-2", children: /* @__PURE__ */ jsx29("div", { className: "max-w-full rounded-2xl py-2.5", children: /* @__PURE__ */ jsx29(
|
|
4748
5819
|
AssistantStreamingIndicator,
|
|
4749
5820
|
{
|
|
4750
5821
|
status: fallbackStreamingStatus ?? "loading"
|
|
@@ -4753,7 +5824,7 @@ function Chat({
|
|
|
4753
5824
|
})()
|
|
4754
5825
|
] })
|
|
4755
5826
|
] }),
|
|
4756
|
-
!isAtBottom && messages.length > 0 && /* @__PURE__ */
|
|
5827
|
+
!isAtBottom && messages.length > 0 && /* @__PURE__ */ jsx29("div", { className: "sticky bottom-20 z-20 flex justify-center px-4 pointer-events-none", children: /* @__PURE__ */ jsx29(
|
|
4757
5828
|
Button,
|
|
4758
5829
|
{
|
|
4759
5830
|
type: "button",
|
|
@@ -4766,10 +5837,10 @@ function Chat({
|
|
|
4766
5837
|
onClick: () => scrollToBottom(true, true),
|
|
4767
5838
|
"aria-label": t("chat.scrollToBottom"),
|
|
4768
5839
|
title: t("chat.scrollToBottom"),
|
|
4769
|
-
children: /* @__PURE__ */
|
|
5840
|
+
children: /* @__PURE__ */ jsx29(ArrowDown, { size: 16 })
|
|
4770
5841
|
}
|
|
4771
5842
|
) }),
|
|
4772
|
-
quoteSelection && /* @__PURE__ */
|
|
5843
|
+
quoteSelection && /* @__PURE__ */ jsx29(
|
|
4773
5844
|
"div",
|
|
4774
5845
|
{
|
|
4775
5846
|
className: "pointer-events-none fixed z-50",
|
|
@@ -4778,7 +5849,7 @@ function Chat({
|
|
|
4778
5849
|
left: `${quoteSelection.left}px`,
|
|
4779
5850
|
transform: "translateX(-50%)"
|
|
4780
5851
|
},
|
|
4781
|
-
children: /* @__PURE__ */
|
|
5852
|
+
children: /* @__PURE__ */ jsxs18(
|
|
4782
5853
|
Button,
|
|
4783
5854
|
{
|
|
4784
5855
|
type: "button",
|
|
@@ -4790,16 +5861,16 @@ function Chat({
|
|
|
4790
5861
|
"aria-label": t("composer.quoteSelection"),
|
|
4791
5862
|
title: t("composer.quoteSelection"),
|
|
4792
5863
|
children: [
|
|
4793
|
-
/* @__PURE__ */
|
|
5864
|
+
/* @__PURE__ */ jsx29(Quote, { size: 14 }),
|
|
4794
5865
|
t("composer.quoteSelection")
|
|
4795
5866
|
]
|
|
4796
5867
|
}
|
|
4797
5868
|
)
|
|
4798
5869
|
}
|
|
4799
5870
|
),
|
|
4800
|
-
/* @__PURE__ */
|
|
4801
|
-
threadErrorMessage && /* @__PURE__ */
|
|
4802
|
-
/* @__PURE__ */
|
|
5871
|
+
/* @__PURE__ */ jsxs18("div", { className: "p-2 sticky bottom-0 z-10 bg-background", children: [
|
|
5872
|
+
threadErrorMessage && /* @__PURE__ */ jsx29("div", { className: "mb-3 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive overflow-auto", children: threadErrorMessage }),
|
|
5873
|
+
/* @__PURE__ */ jsx29(
|
|
4803
5874
|
"input",
|
|
4804
5875
|
{
|
|
4805
5876
|
ref: fileInputRef,
|
|
@@ -4810,7 +5881,7 @@ function Chat({
|
|
|
4810
5881
|
className: "hidden"
|
|
4811
5882
|
}
|
|
4812
5883
|
),
|
|
4813
|
-
attachments.length > 0 && /* @__PURE__ */
|
|
5884
|
+
attachments.length > 0 && /* @__PURE__ */ jsx29("div", { className: "mb-3 flex flex-wrap gap-2", children: attachments.map((item) => /* @__PURE__ */ jsxs18(
|
|
4814
5885
|
"div",
|
|
4815
5886
|
{
|
|
4816
5887
|
className: cn(
|
|
@@ -4818,16 +5889,16 @@ function Chat({
|
|
|
4818
5889
|
item.status === "error" ? "bg-destructive/10 border border-destructive/30" : "bg-muted"
|
|
4819
5890
|
),
|
|
4820
5891
|
children: [
|
|
4821
|
-
item.status === "uploading" && /* @__PURE__ */
|
|
4822
|
-
|
|
5892
|
+
item.status === "uploading" && /* @__PURE__ */ jsx29(
|
|
5893
|
+
Loader23,
|
|
4823
5894
|
{
|
|
4824
5895
|
size: 14,
|
|
4825
5896
|
className: "animate-spin text-muted-foreground"
|
|
4826
5897
|
}
|
|
4827
5898
|
),
|
|
4828
|
-
item.status === "success" && /* @__PURE__ */
|
|
4829
|
-
item.status === "error" && /* @__PURE__ */
|
|
4830
|
-
/* @__PURE__ */
|
|
5899
|
+
item.status === "success" && /* @__PURE__ */ jsx29(FileText2, { size: 14, className: "text-muted-foreground" }),
|
|
5900
|
+
item.status === "error" && /* @__PURE__ */ jsx29(FileText2, { size: 14, className: "text-destructive" }),
|
|
5901
|
+
/* @__PURE__ */ jsx29(
|
|
4831
5902
|
"span",
|
|
4832
5903
|
{
|
|
4833
5904
|
className: cn(
|
|
@@ -4837,17 +5908,17 @@ function Chat({
|
|
|
4837
5908
|
children: item.file.name
|
|
4838
5909
|
}
|
|
4839
5910
|
),
|
|
4840
|
-
item.status === "error" && /* @__PURE__ */
|
|
5911
|
+
item.status === "error" && /* @__PURE__ */ jsx29(
|
|
4841
5912
|
"button",
|
|
4842
5913
|
{
|
|
4843
5914
|
type: "button",
|
|
4844
5915
|
onClick: () => handleRetryUpload(item.localId),
|
|
4845
5916
|
className: "ml-1 rounded-full p-0.5 text-destructive hover:bg-destructive/20",
|
|
4846
5917
|
title: t("chat.retryUpload"),
|
|
4847
|
-
children: /* @__PURE__ */
|
|
5918
|
+
children: /* @__PURE__ */ jsx29(RefreshCw2, { size: 12 })
|
|
4848
5919
|
}
|
|
4849
5920
|
),
|
|
4850
|
-
/* @__PURE__ */
|
|
5921
|
+
/* @__PURE__ */ jsx29(
|
|
4851
5922
|
"button",
|
|
4852
5923
|
{
|
|
4853
5924
|
type: "button",
|
|
@@ -4856,14 +5927,14 @@ function Chat({
|
|
|
4856
5927
|
"ml-1 rounded-full p-0.5",
|
|
4857
5928
|
item.status === "error" ? "text-destructive hover:bg-destructive/20" : "hover:bg-muted-foreground/20"
|
|
4858
5929
|
),
|
|
4859
|
-
children: /* @__PURE__ */
|
|
5930
|
+
children: /* @__PURE__ */ jsx29(X3, { size: 12 })
|
|
4860
5931
|
}
|
|
4861
5932
|
)
|
|
4862
5933
|
]
|
|
4863
5934
|
},
|
|
4864
5935
|
item.localId
|
|
4865
5936
|
)) }),
|
|
4866
|
-
references.length > 0 && /* @__PURE__ */
|
|
5937
|
+
references.length > 0 && /* @__PURE__ */ jsx29("div", { className: "mb-3 flex flex-wrap gap-2", children: references.map((reference) => /* @__PURE__ */ jsx29(
|
|
4867
5938
|
ReferenceChip,
|
|
4868
5939
|
{
|
|
4869
5940
|
reference,
|
|
@@ -4877,19 +5948,27 @@ function Chat({
|
|
|
4877
5948
|
},
|
|
4878
5949
|
getReferenceKey(reference)
|
|
4879
5950
|
)) }),
|
|
4880
|
-
selectedTool && /* @__PURE__ */
|
|
4881
|
-
/* @__PURE__ */
|
|
4882
|
-
/* @__PURE__ */
|
|
5951
|
+
selectedTool && /* @__PURE__ */ jsxs18("div", { className: "mb-2 flex items-center gap-2", children: [
|
|
5952
|
+
/* @__PURE__ */ jsx29("span", { className: "rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary", children: selectedTool.shortLabel ?? selectedTool.label }),
|
|
5953
|
+
/* @__PURE__ */ jsx29(
|
|
4883
5954
|
"button",
|
|
4884
5955
|
{
|
|
4885
5956
|
type: "button",
|
|
4886
5957
|
onClick: () => setSelectedTool(null),
|
|
4887
5958
|
className: "rounded-full p-0.5 text-muted-foreground hover:bg-muted",
|
|
4888
|
-
children: /* @__PURE__ */
|
|
5959
|
+
children: /* @__PURE__ */ jsx29(X3, { size: 12 })
|
|
4889
5960
|
}
|
|
4890
5961
|
)
|
|
4891
5962
|
] }),
|
|
4892
|
-
/* @__PURE__ */
|
|
5963
|
+
/* @__PURE__ */ jsx29(
|
|
5964
|
+
PendingTodos,
|
|
5965
|
+
{
|
|
5966
|
+
snapshot: stream.todos,
|
|
5967
|
+
attachToComposer: !hasPendingFollowUps,
|
|
5968
|
+
className: hasPendingFollowUps ? "mb-2" : void 0
|
|
5969
|
+
}
|
|
5970
|
+
),
|
|
5971
|
+
/* @__PURE__ */ jsx29(
|
|
4893
5972
|
PendingFollowUps,
|
|
4894
5973
|
{
|
|
4895
5974
|
items: pendingFollowUps,
|
|
@@ -4900,10 +5979,11 @@ function Chat({
|
|
|
4900
5979
|
canSendNow: stream.canSendPendingFollowUpNow,
|
|
4901
5980
|
onSendNow: (id) => stream.sendPendingFollowUpNow(id),
|
|
4902
5981
|
onEdit: handleEditPendingFollowUp,
|
|
4903
|
-
onRemove: stream.removePendingFollowUp
|
|
5982
|
+
onRemove: stream.removePendingFollowUp,
|
|
5983
|
+
attachToComposer: true
|
|
4904
5984
|
}
|
|
4905
5985
|
),
|
|
4906
|
-
/* @__PURE__ */
|
|
5986
|
+
/* @__PURE__ */ jsx29("form", { className: "flex items-end", onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs18(
|
|
4907
5987
|
"div",
|
|
4908
5988
|
{
|
|
4909
5989
|
className: cn(
|
|
@@ -4915,7 +5995,7 @@ function Chat({
|
|
|
4915
5995
|
getRoundedClass(theme.radius)
|
|
4916
5996
|
),
|
|
4917
5997
|
children: [
|
|
4918
|
-
/* @__PURE__ */
|
|
5998
|
+
/* @__PURE__ */ jsx29(
|
|
4919
5999
|
ComposerMenu,
|
|
4920
6000
|
{
|
|
4921
6001
|
composer,
|
|
@@ -4925,12 +6005,13 @@ function Chat({
|
|
|
4925
6005
|
disabled: missingConfig || isHistoryLoading
|
|
4926
6006
|
}
|
|
4927
6007
|
),
|
|
4928
|
-
/* @__PURE__ */
|
|
6008
|
+
/* @__PURE__ */ jsx29(
|
|
4929
6009
|
"textarea",
|
|
4930
6010
|
{
|
|
4931
6011
|
ref: composerInputRef,
|
|
4932
6012
|
value: draft,
|
|
4933
6013
|
onChange: (event) => setDraft(event.target.value),
|
|
6014
|
+
onPaste: handleComposerPaste,
|
|
4934
6015
|
onKeyDown: handleComposerKeyDown,
|
|
4935
6016
|
rows: 1,
|
|
4936
6017
|
placeholder: inputPlaceholder,
|
|
@@ -4942,7 +6023,7 @@ function Chat({
|
|
|
4942
6023
|
)
|
|
4943
6024
|
}
|
|
4944
6025
|
),
|
|
4945
|
-
/* @__PURE__ */
|
|
6026
|
+
/* @__PURE__ */ jsx29(
|
|
4946
6027
|
SendButton,
|
|
4947
6028
|
{
|
|
4948
6029
|
disabled: isSendDisabled,
|
|
@@ -4950,13 +6031,23 @@ function Chat({
|
|
|
4950
6031
|
showStop: stream.isLoading && !trimmedDraft,
|
|
4951
6032
|
onStop: () => stream.stop(),
|
|
4952
6033
|
stopLabel: t("chat.stop"),
|
|
4953
|
-
sendLabel: t("chat.send")
|
|
6034
|
+
sendLabel: t("chat.send"),
|
|
6035
|
+
shortcuts: stream.isLoading && trimmedDraft ? [
|
|
6036
|
+
{
|
|
6037
|
+
label: t("chat.followUps.steer"),
|
|
6038
|
+
keys: followUpShortcutLabels.steer
|
|
6039
|
+
},
|
|
6040
|
+
{
|
|
6041
|
+
label: t("chat.followUps.queue"),
|
|
6042
|
+
keys: followUpShortcutLabels.queue
|
|
6043
|
+
}
|
|
6044
|
+
] : void 0
|
|
4954
6045
|
}
|
|
4955
6046
|
)
|
|
4956
6047
|
]
|
|
4957
6048
|
}
|
|
4958
6049
|
) }),
|
|
4959
|
-
disclaimer?.text && /* @__PURE__ */
|
|
6050
|
+
disclaimer?.text && /* @__PURE__ */ jsx29(
|
|
4960
6051
|
"p",
|
|
4961
6052
|
{
|
|
4962
6053
|
className: cn(
|
|
@@ -4966,9 +6057,9 @@ function Chat({
|
|
|
4966
6057
|
children: disclaimer.text
|
|
4967
6058
|
}
|
|
4968
6059
|
),
|
|
4969
|
-
/* @__PURE__ */
|
|
4970
|
-
/* @__PURE__ */
|
|
4971
|
-
/* @__PURE__ */
|
|
6060
|
+
/* @__PURE__ */ jsxs18("div", { className: "mt-2 flex items-center justify-center gap-2 text-xs text-muted-foreground", children: [
|
|
6061
|
+
/* @__PURE__ */ jsx29("span", { children: t("chat.poweredBy") }),
|
|
6062
|
+
/* @__PURE__ */ jsx29(ContextUsageIndicator, { className: "absolute right-4" })
|
|
4972
6063
|
] })
|
|
4973
6064
|
] })
|
|
4974
6065
|
]
|
|
@@ -4977,11 +6068,11 @@ function Chat({
|
|
|
4977
6068
|
}
|
|
4978
6069
|
|
|
4979
6070
|
// src/components/ui/input.tsx
|
|
4980
|
-
import * as
|
|
4981
|
-
import { jsx as
|
|
4982
|
-
var Input =
|
|
6071
|
+
import * as React24 from "react";
|
|
6072
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
6073
|
+
var Input = React24.forwardRef(
|
|
4983
6074
|
({ className, type, ...props }, ref) => {
|
|
4984
|
-
return /* @__PURE__ */
|
|
6075
|
+
return /* @__PURE__ */ jsx30(
|
|
4985
6076
|
"input",
|
|
4986
6077
|
{
|
|
4987
6078
|
ref,
|
|
@@ -4998,10 +6089,10 @@ var Input = React22.forwardRef(
|
|
|
4998
6089
|
Input.displayName = "Input";
|
|
4999
6090
|
|
|
5000
6091
|
// src/components/ui/separator.tsx
|
|
5001
|
-
import * as
|
|
5002
|
-
import { jsx as
|
|
5003
|
-
var Separator =
|
|
5004
|
-
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */
|
|
6092
|
+
import * as React25 from "react";
|
|
6093
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
6094
|
+
var Separator = React25.forwardRef(
|
|
6095
|
+
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ jsx31(
|
|
5005
6096
|
"div",
|
|
5006
6097
|
{
|
|
5007
6098
|
ref,
|