@xpert-ai/chatkit-ui 0.1.0 → 0.1.1
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-p9H3Gzep.js +1 -0
- package/dist/app/assets/abap-bJX3iBqH.js +1 -0
- package/dist/app/assets/abnf-BoiZ35EE.js +1 -0
- package/dist/app/assets/actionscript-D-H9vZ8b.js +1 -0
- package/dist/app/assets/ada-Bne3WpOl.js +1 -0
- package/dist/app/assets/agda-C938cagi.js +1 -0
- package/dist/app/assets/al-Dcxw3Vj0.js +1 -0
- package/dist/app/assets/antlr4-uTm2QqyV.js +1 -0
- package/dist/app/assets/apacheconf-D52D513G.js +1 -0
- package/dist/app/assets/apex-B76H7J4g.js +1 -0
- package/dist/app/assets/apl-CzLk42pF.js +1 -0
- package/dist/app/assets/applescript-Dx8Ig-Eo.js +1 -0
- package/dist/app/assets/aql-wjx32tAU.js +1 -0
- package/dist/app/assets/arc-B32_yhh0.js +1 -0
- package/dist/app/assets/architectureDiagram-Q4EWVU46-Ba-C8DAI.js +36 -0
- package/dist/app/assets/arduino-BwKDxTSS.js +1 -0
- package/dist/app/assets/arff-DrkRViyY.js +1 -0
- package/dist/app/assets/asciidoc-BGLZq9v8.js +1 -0
- package/dist/app/assets/asm6502-MsEWIyJj.js +1 -0
- package/dist/app/assets/asmatmel-CeHxqS5T.js +1 -0
- package/dist/app/assets/aspnet-CmsQfR5a.js +1 -0
- package/dist/app/assets/autohotkey-Cusm-zTm.js +1 -0
- package/dist/app/assets/autoit-Da8gsEm-.js +1 -0
- package/dist/app/assets/avisynth-C46xLzyo.js +1 -0
- package/dist/app/assets/avro-idl-D2WmoYBG.js +1 -0
- package/dist/app/assets/{basic-B4YxRCle.js → bash-BrsKn3za.js} +1 -1
- package/dist/app/assets/basic-Dt5oGQ8B.js +1 -0
- package/dist/app/assets/batch-DtrIlfXi.js +1 -0
- package/dist/app/assets/bbcode-BWYlAYoE.js +1 -0
- package/dist/app/assets/bicep-C4sxks0f.js +1 -0
- package/dist/app/assets/birb-gYyyIZ-F.js +1 -0
- package/dist/app/assets/bison-or-umhj6.js +1 -0
- package/dist/app/assets/blockDiagram-DXYQGD6D-5oqbPp8P.js +132 -0
- package/dist/app/assets/bnf-BQR7hfk2.js +1 -0
- package/dist/app/assets/brainfuck-DkQqhNHv.js +1 -0
- package/dist/app/assets/brightscript-rGhg0HBT.js +1 -0
- package/dist/app/assets/bro-CIgtBg0f.js +1 -0
- package/dist/app/assets/bsl-C4geIkQv.js +1 -0
- package/dist/app/assets/c-Cw5181Rv.js +1 -0
- package/dist/app/assets/c4Diagram-AHTNJAMY-BKyN5n0Y.js +10 -0
- package/dist/app/assets/cfscript-DHPNMvWS.js +1 -0
- package/dist/app/assets/chaiscript-Cd8c0hJ8.js +1 -0
- package/dist/app/assets/channel-Cx11sSAI.js +1 -0
- package/dist/app/assets/chunk-4BX2VUAB-CfLubn_X.js +1 -0
- package/dist/app/assets/chunk-4TB4RGXK-Bhehm3S4.js +206 -0
- package/dist/app/assets/chunk-55IACEB6-D0Zgi2qX.js +1 -0
- package/dist/app/assets/chunk-EDXVE4YY-DzMULs0l.js +1 -0
- package/dist/app/assets/chunk-FMBD7UC4-CEU9agAN.js +15 -0
- package/dist/app/assets/chunk-OYMX7WX6-C-avxOs6.js +231 -0
- package/dist/app/assets/chunk-QZHKN3VN-C66xsvBW.js +1 -0
- package/dist/app/assets/chunk-YZCP3GAM-DZlwMcoL.js +1 -0
- package/dist/app/assets/cil-L3oWT8Nl.js +1 -0
- package/dist/app/assets/classDiagram-6PBFFD2Q-BQrwJXsB.js +1 -0
- package/dist/app/assets/classDiagram-v2-HSJHXN6E-BQrwJXsB.js +1 -0
- package/dist/app/assets/clike-CHF9NJQa.js +1 -0
- package/dist/app/assets/clojure-YgRWUbgr.js +1 -0
- package/dist/app/assets/clone-DHPdZQ_6.js +1 -0
- package/dist/app/assets/cmake-TK-Cvlxu.js +1 -0
- package/dist/app/assets/cobol-XSbSVVcZ.js +1 -0
- package/dist/app/assets/coffeescript-HxNd9-Ob.js +1 -0
- package/dist/app/assets/concurnas-DK3wUjjD.js +1 -0
- package/dist/app/assets/coq-B9Rq7NUE.js +1 -0
- package/dist/app/assets/core-B1vWjEfj.js +1 -0
- package/dist/app/assets/cose-bilkent-S5V4N54A-4PebjqsX.js +1 -0
- package/dist/app/assets/cpp-DUWMh-8O.js +1 -0
- package/dist/app/assets/crystal-rYgGF4lS.js +1 -0
- package/dist/app/assets/csharp-eqTMyksU.js +1 -0
- package/dist/app/assets/cshtml-DSv9-mpk.js +1 -0
- package/dist/app/assets/csp-DyZfVzvb.js +1 -0
- package/dist/app/assets/css-DYXyUyJe.js +1 -0
- package/dist/app/assets/css-extras-FP15zHq8.js +1 -0
- package/dist/app/assets/csv-Bp1iUR7c.js +1 -0
- package/dist/app/assets/cypher-BjXgs7Y3.js +1 -0
- package/dist/app/assets/cytoscape.esm-DkOyvmE4.js +321 -0
- package/dist/app/assets/d-Bquc1S6a.js +1 -0
- package/dist/app/assets/dagre-KV5264BT-D9OICDLb.js +4 -0
- package/dist/app/assets/dart-DrKyO7TC.js +1 -0
- package/dist/app/assets/dataweave-BgpsWzO7.js +1 -0
- package/dist/app/assets/dax-BwP1SyCZ.js +1 -0
- package/dist/app/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/dist/app/assets/dhall-BA5nXB8V.js +1 -0
- package/dist/app/assets/diagram-5BDNPKRD-BIFTIy6n.js +10 -0
- package/dist/app/assets/diagram-G4DWMVQ6-BCVIBrZ2.js +24 -0
- package/dist/app/assets/diagram-MMDJMWI5-43z4NaFN.js +43 -0
- package/dist/app/assets/diagram-TYMM5635-BDZjM1c_.js +24 -0
- package/dist/app/assets/diff-Yc6a7YOT.js +3 -0
- package/dist/app/assets/django-B61BBi1t.js +1 -0
- package/dist/app/assets/dns-zone-file-DtXhOJHq.js +1 -0
- package/dist/app/assets/docker-BLh9n10i.js +1 -0
- package/dist/app/assets/dot-BbSnn0Ap.js +1 -0
- package/dist/app/assets/ebnf-D_ljHBdb.js +1 -0
- package/dist/app/assets/editorconfig-BQXrLGC5.js +1 -0
- package/dist/app/assets/eiffel-Cm3FUI5X.js +1 -0
- package/dist/app/assets/ejs-CIp2UdDw.js +1 -0
- package/dist/app/assets/elixir-DXlWBe5R.js +1 -0
- package/dist/app/assets/elm-ECxjLCR-.js +1 -0
- package/dist/app/assets/erDiagram-SMLLAGMA-B9I89ndp.js +85 -0
- package/dist/app/assets/erb-FzgX8ydn.js +1 -0
- package/dist/app/assets/erlang-CzvdSvoz.js +1 -0
- package/dist/app/assets/etlua-C3Zsz3RA.js +1 -0
- package/dist/app/assets/excel-formula-Cua38PQJ.js +1 -0
- package/dist/app/assets/factor-CSAzXoQb.js +1 -0
- package/dist/app/assets/false-NSFMCUjP.js +1 -0
- package/dist/app/assets/firestore-security-rules-BjNYwvNe.js +1 -0
- package/dist/app/assets/flow-BuZaM8y6.js +1 -0
- package/dist/app/assets/flowDiagram-DWJPFMVM-CWmW_muY.js +162 -0
- package/dist/app/assets/fortran-Cc_f_mSH.js +1 -0
- package/dist/app/assets/fsharp-IelQ4Z-Z.js +1 -0
- package/dist/app/assets/ftl-Ddl9DDyG.js +1 -0
- package/dist/app/assets/ganttDiagram-T4ZO3ILL-CuR1J7dx.js +292 -0
- package/dist/app/assets/gap-D3W6p-Jp.js +1 -0
- package/dist/app/assets/gcode-Bn8O4UOx.js +1 -0
- package/dist/app/assets/gdscript-B4nck3Az.js +1 -0
- package/dist/app/assets/gedcom-BCTZRsxn.js +1 -0
- package/dist/app/assets/gherkin-CFCJQug9.js +1 -0
- package/dist/app/assets/git-Dd2t83_l.js +1 -0
- package/dist/app/assets/gitGraphDiagram-UUTBAWPF-DzscVnaS.js +106 -0
- package/dist/app/assets/glsl-NXGZDuA9.js +1 -0
- package/dist/app/assets/gml-DtS9_99j.js +1 -0
- package/dist/app/assets/gn-C6VmNt4U.js +1 -0
- package/dist/app/assets/go-module-CmBM8SA1.js +1 -0
- package/dist/app/assets/go-otK-v_nb.js +1 -0
- package/dist/app/assets/graph-BelNBDAZ.js +1 -0
- package/dist/app/assets/graphql-JPlPKrhh.js +1 -0
- package/dist/app/assets/groovy-CkMUqzIt.js +1 -0
- package/dist/app/assets/haml-DwaIQOGd.js +1 -0
- package/dist/app/assets/handlebars-Ck6RB1iw.js +1 -0
- package/dist/app/assets/haskell-BxYLBxBa.js +1 -0
- package/dist/app/assets/haxe-C4OMV9zJ.js +1 -0
- package/dist/app/assets/hcl-DVznmODf.js +1 -0
- package/dist/app/assets/hlsl-Z_ySkish.js +1 -0
- package/dist/app/assets/hoon-UWT3k4H8.js +1 -0
- package/dist/app/assets/hpkp-CXa39f7J.js +1 -0
- package/dist/app/assets/hsts-CJF4yNvU.js +1 -0
- package/dist/app/assets/http-BxOKxlr4.js +1 -0
- package/dist/app/assets/ichigojam-Csb66zY2.js +1 -0
- package/dist/app/assets/icon-DxphTQI9.js +1 -0
- package/dist/app/assets/icu-message-format-CSZfssuP.js +1 -0
- package/dist/app/assets/idris-BmXANiaa.js +1 -0
- package/dist/app/assets/iecst-FfznJdjL.js +1 -0
- package/dist/app/assets/ignore-C3IKkXMi.js +1 -0
- package/dist/app/assets/index-D972kqET.css +1 -0
- package/dist/app/assets/index-DmMWBDJR.js +747 -0
- package/dist/app/assets/infoDiagram-42DDH7IO-rTeQPEt4.js +2 -0
- package/dist/app/assets/inform7-Dk4gPo4b.js +1 -0
- package/dist/app/assets/ini-CClGKGMe.js +1 -0
- package/dist/app/assets/init-Gi6I4Gst.js +1 -0
- package/dist/app/assets/io-6YtqLtET.js +1 -0
- package/dist/app/assets/ishikawaDiagram-UXIWVN3A-BBnJ9iuN.js +70 -0
- package/dist/app/assets/j-DBPrIcAG.js +1 -0
- package/dist/app/assets/java-CopGP3Lu.js +1 -0
- package/dist/app/assets/javadoc-C8F3ifW2.js +1 -0
- package/dist/app/assets/javadoclike-BNVFpoJC.js +1 -0
- package/dist/app/assets/javascript-BMkkas2q.js +1 -0
- package/dist/app/assets/javastacktrace-DuykBujE.js +1 -0
- package/dist/app/assets/jexl-BSWOm8s5.js +1 -0
- package/dist/app/assets/jolie-CdkOmKFM.js +1 -0
- package/dist/app/assets/journeyDiagram-VCZTEJTY-CRDpL_1T.js +139 -0
- package/dist/app/assets/jq-Nr0Kxpxc.js +1 -0
- package/dist/app/assets/js-extras-CA8iZ_E5.js +1 -0
- package/dist/app/assets/js-templates-BoqcQW67.js +1 -0
- package/dist/app/assets/jsdoc-CeMFl6xP.js +1 -0
- package/dist/app/assets/json-CrSHUueM.js +1 -0
- package/dist/app/assets/json5-BBfX460l.js +1 -0
- package/dist/app/assets/jsonp-DHEqmGWL.js +1 -0
- package/dist/app/assets/jsstacktrace-BK3SuvsS.js +1 -0
- package/dist/app/assets/jsx-CjR3dp14.js +1 -0
- package/dist/app/assets/julia-BJJ6LUnI.js +1 -0
- package/dist/app/assets/kanban-definition-6JOO6SKY-Dztk4Auy.js +89 -0
- package/dist/app/assets/keepalived-CjGUJvsk.js +1 -0
- package/dist/app/assets/keyman-Bogz-7f0.js +1 -0
- package/dist/app/assets/kotlin-DGdetcAk.js +1 -0
- package/dist/app/assets/kumir-Czhml4-j.js +1 -0
- package/dist/app/assets/kusto-BuL9qwXk.js +1 -0
- package/dist/app/assets/latex-BAc_zS_4.js +1 -0
- package/dist/app/assets/latte-BzZFX_wH.js +1 -0
- package/dist/app/assets/layout-DOHRtR3x.js +1 -0
- package/dist/app/assets/less-DATW_Ot3.js +1 -0
- package/dist/app/assets/lilypond-DSmAdE7B.js +1 -0
- package/dist/app/assets/linear-rr7FzlEM.js +1 -0
- package/dist/app/assets/liquid-CF8lqz9m.js +1 -0
- package/dist/app/assets/lisp-BUPAsWUh.js +1 -0
- package/dist/app/assets/livescript-B8CIEQDH.js +1 -0
- package/dist/app/assets/llvm-DGaRc9w0.js +1 -0
- package/dist/app/assets/log-XuE3Wqn5.js +1 -0
- package/dist/app/assets/lolcode-Clk-p_j2.js +1 -0
- package/dist/app/assets/{java-DvhwWZfy.js → lua-BLczZbJa.js} +1 -1
- package/dist/app/assets/magma-DTO3ftgF.js +1 -0
- package/dist/app/assets/makefile-OSVaZHmV.js +1 -0
- package/dist/app/assets/markdown-InD7dXs9.js +1 -0
- package/dist/app/assets/markup-BN6MlRZT.js +1 -0
- package/dist/app/assets/markup-templating-DRXAmI1c.js +1 -0
- package/dist/app/assets/matlab-CV_q70_G.js +1 -0
- package/dist/app/assets/maxscript-Ck_8H__C.js +1 -0
- package/dist/app/assets/mel-D9MU0rZa.js +1 -0
- package/dist/app/assets/mermaid-DshECBS6.js +1 -0
- package/dist/app/assets/min-CfLzpwyh.js +1 -0
- package/dist/app/assets/mindmap-definition-QFDTVHPH-C7XGlydX.js +96 -0
- package/dist/app/assets/mizar-WBJ-SwIG.js +1 -0
- package/dist/app/assets/mongodb-CmzRTKBq.js +1 -0
- package/dist/app/assets/monkey-W1yB--1T.js +1 -0
- package/dist/app/assets/moonscript-BD5hlCXn.js +1 -0
- package/dist/app/assets/n1ql-CwugAEoM.js +1 -0
- package/dist/app/assets/n4js-tFC-Lsvd.js +1 -0
- package/dist/app/assets/nand2tetris-hdl-hzvfBJxH.js +1 -0
- package/dist/app/assets/naniscript-DUtjoUL1.js +1 -0
- package/dist/app/assets/nasm-Dcckq6ib.js +1 -0
- package/dist/app/assets/neon-DeVv09BE.js +1 -0
- package/dist/app/assets/nevod-CAq9Kfwt.js +1 -0
- package/dist/app/assets/nginx-C8GHDEqt.js +1 -0
- package/dist/app/assets/nim-BqdyUedD.js +1 -0
- package/dist/app/assets/nix-514mCcjs.js +1 -0
- package/dist/app/assets/nsis-CdKqXn3g.js +1 -0
- package/dist/app/assets/objectivec-uPp8iMUn.js +1 -0
- package/dist/app/assets/ocaml-D4EB6rFL.js +1 -0
- package/dist/app/assets/opencl-BN8tmrp-.js +1 -0
- package/dist/app/assets/openqasm-CZT9yVLH.js +1 -0
- package/dist/app/assets/ordinal-Cboi1Yqb.js +1 -0
- package/dist/app/assets/oz-xEnzbfGI.js +1 -0
- package/dist/app/assets/parigp-PN33G_ZS.js +1 -0
- package/dist/app/assets/parser-YigtK2Gn.js +1 -0
- package/dist/app/assets/pascal-BSQHqJO2.js +1 -0
- package/dist/app/assets/pascaligo-B3om_nlX.js +1 -0
- package/dist/app/assets/pcaxis-B_qwjIH4.js +1 -0
- package/dist/app/assets/peoplecode-G3CTxh8q.js +1 -0
- package/dist/app/assets/perl-CBvGMSZZ.js +1 -0
- package/dist/app/assets/php-DewJLtev.js +1 -0
- package/dist/app/assets/php-extras-BT2DdjGn.js +1 -0
- package/dist/app/assets/phpdoc-DiQXOd9D.js +1 -0
- package/dist/app/assets/pieDiagram-DEJITSTG-CYXmqIpD.js +30 -0
- package/dist/app/assets/plsql-BzUO3h3t.js +1 -0
- package/dist/app/assets/powerquery-D_713gdU.js +1 -0
- package/dist/app/assets/powershell-D7IGyPyT.js +1 -0
- package/dist/app/assets/processing-CULfTuKk.js +1 -0
- package/dist/app/assets/prolog-DI8sHw_1.js +1 -0
- package/dist/app/assets/promql-DdWPpZzX.js +1 -0
- package/dist/app/assets/properties-UUBptvjg.js +1 -0
- package/dist/app/assets/protobuf-Yh4lBroy.js +1 -0
- package/dist/app/assets/psl-CKuqp255.js +1 -0
- package/dist/app/assets/pug-Duz4hJlP.js +1 -0
- package/dist/app/assets/puppet-Tenfq4aE.js +1 -0
- package/dist/app/assets/pure-CTE3YKFb.js +1 -0
- package/dist/app/assets/purebasic-BzV6ZqWW.js +1 -0
- package/dist/app/assets/purescript-CjSCYtGb.js +1 -0
- package/dist/app/assets/q-BTX8RKFy.js +1 -0
- package/dist/app/assets/qml-CGjBjP81.js +1 -0
- package/dist/app/assets/qore-5Gggmt2I.js +1 -0
- package/dist/app/assets/qsharp-DhqE1FPx.js +1 -0
- package/dist/app/assets/quadrantDiagram-34T5L4WZ-BbnPMKp-.js +7 -0
- package/dist/app/assets/r-Dr0jr5tD.js +1 -0
- package/dist/app/assets/racket-NVUa01EO.js +1 -0
- package/dist/app/assets/reason-Bx5CI0l0.js +1 -0
- package/dist/app/assets/regex-12879jLK.js +1 -0
- package/dist/app/assets/rego-w2Fhvb_N.js +1 -0
- package/dist/app/assets/renpy-gPxX0z3Q.js +1 -0
- package/dist/app/assets/requirementDiagram-MS252O5E-BhOU7uOd.js +84 -0
- package/dist/app/assets/rest-C39bU2b1.js +1 -0
- package/dist/app/assets/rip-RLtTVF0Y.js +1 -0
- package/dist/app/assets/roboconf-BJckt4oD.js +1 -0
- package/dist/app/assets/robotframework-DCR96jiT.js +1 -0
- package/dist/app/assets/ruby-CRs8uxXB.js +1 -0
- package/dist/app/assets/rust-C0bGL254.js +1 -0
- package/dist/app/assets/sankeyDiagram-XADWPNL6-CFgkd6GO.js +10 -0
- package/dist/app/assets/sas-CkLtpL1M.js +1 -0
- package/dist/app/assets/sass-FNfCYuQd.js +1 -0
- package/dist/app/assets/scala-Dy5lip5O.js +1 -0
- package/dist/app/assets/scheme-pkKED5As.js +1 -0
- package/dist/app/assets/scss-DrZ4F_S5.js +1 -0
- package/dist/app/assets/sequenceDiagram-FGHM5R23-t5z2WRg9.js +157 -0
- package/dist/app/assets/shell-session-tfqRzQ64.js +1 -0
- package/dist/app/assets/smali-D9oJJF_a.js +1 -0
- package/dist/app/assets/smalltalk-FhicZwdZ.js +1 -0
- package/dist/app/assets/smarty-RTVkhvGe.js +1 -0
- package/dist/app/assets/sml-8jU1U62j.js +1 -0
- package/dist/app/assets/solidity-DLvpuywG.js +1 -0
- package/dist/app/assets/solution-file-BOwCbL9x.js +1 -0
- package/dist/app/assets/soy-Dye6FppK.js +1 -0
- package/dist/app/assets/sparql-BRIOTA6e.js +1 -0
- package/dist/app/assets/splunk-spl-xjEKSM5T.js +1 -0
- package/dist/app/assets/sqf-BTXRZqz9.js +1 -0
- package/dist/app/assets/sql-LIGcsz7H.js +1 -0
- package/dist/app/assets/squirrel-D1i-yP9F.js +1 -0
- package/dist/app/assets/stan-Bz-MTQlG.js +1 -0
- package/dist/app/assets/stateDiagram-FHFEXIEX-INV79XkW.js +1 -0
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-DkwGLXRp.js +1 -0
- package/dist/app/assets/stylus-CPcHbGGR.js +1 -0
- package/dist/app/assets/swift-CMnIAhC_.js +1 -0
- package/dist/app/assets/systemd-CnQ86vtn.js +2 -0
- package/dist/app/assets/t4-cs-ClADD8kZ.js +1 -0
- package/dist/app/assets/t4-templating-BxEXIn9V.js +1 -0
- package/dist/app/assets/t4-vb-BuQFrDQM.js +1 -0
- package/dist/app/assets/tap-D-OeTv7J.js +1 -0
- package/dist/app/assets/tcl-D4EWmvqA.js +1 -0
- package/dist/app/assets/textile-vCa5WeBr.js +1 -0
- package/dist/app/assets/timeline-definition-GMOUNBTQ-CZVpkWZR.js +120 -0
- package/dist/app/assets/toml-CyQfWyMg.js +1 -0
- package/dist/app/assets/tremor-DTpakXR3.js +1 -0
- package/dist/app/assets/tt2-I3k-jzpY.js +1 -0
- package/dist/app/assets/turtle-BjS87MX7.js +1 -0
- package/dist/app/assets/twig-BYK2hDMY.js +1 -0
- package/dist/app/assets/typescript-DNEOvUVG.js +1 -0
- package/dist/app/assets/typoscript-hqzFge6d.js +1 -0
- package/dist/app/assets/unrealscript-_-NzaZj0.js +1 -0
- package/dist/app/assets/uorazor-BMR9qMW5.js +1 -0
- package/dist/app/assets/uri-BSGWfMxZ.js +1 -0
- package/dist/app/assets/v-CLtdeXIK.js +1 -0
- package/dist/app/assets/vala-wzCcqtKA.js +1 -0
- package/dist/app/assets/{turtle-BtZWKoZ_.js → vbnet-DGCLmXdC.js} +1 -1
- package/dist/app/assets/velocity-DX_5gTOq.js +1 -0
- package/dist/app/assets/vennDiagram-DHZGUBPP-Dq1FXdcO.js +34 -0
- package/dist/app/assets/verilog-DeAFTKrK.js +1 -0
- package/dist/app/assets/vhdl-CgPp3m3I.js +1 -0
- package/dist/app/assets/vim-ZY6C4NgO.js +1 -0
- package/dist/app/assets/visual-basic-DmV7laqn.js +1 -0
- package/dist/app/assets/wardley-RL74JXVD-OqiGOeix.js +162 -0
- package/dist/app/assets/wardleyDiagram-NUSXRM2D-XXEOUAR6.js +20 -0
- package/dist/app/assets/warpscript-CST9Acbf.js +1 -0
- package/dist/app/assets/wasm-D44TvCcf.js +1 -0
- package/dist/app/assets/web-idl-CUAX3ogm.js +1 -0
- package/dist/app/assets/wiki-KNEqZQWK.js +1 -0
- package/dist/app/assets/wolfram-CZdD1bRd.js +1 -0
- package/dist/app/assets/wren-PITvEkQ4.js +1 -0
- package/dist/app/assets/xeora-BM_ABt9y.js +1 -0
- package/dist/app/assets/xml-doc-249eg8mF.js +1 -0
- package/dist/app/assets/xojo-M3SASV_b.js +1 -0
- package/dist/app/assets/xquery-BWv2VkcM.js +1 -0
- package/dist/app/assets/xychartDiagram-5P7HB3ND-CvXT15VO.js +7 -0
- package/dist/app/assets/yaml-B70AwQ7Y.js +1 -0
- package/dist/app/assets/yang-DffrsIpd.js +1 -0
- package/dist/app/assets/zig-C9vlYfKL.js +1 -0
- package/dist/app/index.html +2 -2
- package/dist/index.cjs +1315 -485
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1342 -501
- 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 React22 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;
|
|
269
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;
|
|
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);
|
|
307
359
|
}
|
|
308
|
-
if (
|
|
309
|
-
return
|
|
360
|
+
if (isQuoteReferenceCandidate(candidate)) {
|
|
361
|
+
return toQuoteReference(candidate);
|
|
362
|
+
}
|
|
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,17 @@ 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
|
+
|
|
804
929
|
// src/providers/Stream.tsx
|
|
805
930
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
806
931
|
var StreamContext = createContext2(void 0);
|
|
@@ -1003,7 +1128,16 @@ var en_US_default = {
|
|
|
1003
1128
|
close: "Close"
|
|
1004
1129
|
},
|
|
1005
1130
|
markdown: {
|
|
1006
|
-
copy: "Copy"
|
|
1131
|
+
copy: "Copy",
|
|
1132
|
+
mermaid: {
|
|
1133
|
+
title: "Mermaid",
|
|
1134
|
+
diagram: "Diagram",
|
|
1135
|
+
code: "Code",
|
|
1136
|
+
download: "Download SVG",
|
|
1137
|
+
fullScreen: "Open full screen",
|
|
1138
|
+
rendering: "Rendering diagram",
|
|
1139
|
+
failed: "Failed to render diagram"
|
|
1140
|
+
}
|
|
1007
1141
|
},
|
|
1008
1142
|
thread: {
|
|
1009
1143
|
errorToast: "An error occurred. Please try again.",
|
|
@@ -1049,7 +1183,7 @@ var zh_CN_default = {
|
|
|
1049
1183
|
pending: "\u5F85\u5904\u7406 Follow-up",
|
|
1050
1184
|
queue: "\u6392\u961F",
|
|
1051
1185
|
steer: "\u5F15\u5BFC",
|
|
1052
|
-
steerAction: "
|
|
1186
|
+
steerAction: "\u5F15\u5BFC",
|
|
1053
1187
|
promoteToSteer: "\u8F6C\u4E3A\u5F15\u5BFC",
|
|
1054
1188
|
sendNow: "\u7ACB\u5373\u53D1\u9001",
|
|
1055
1189
|
remove: "\u79FB\u9664\u6B64\u5F85\u5904\u7406 Follow-up",
|
|
@@ -1098,7 +1232,16 @@ var zh_CN_default = {
|
|
|
1098
1232
|
close: "\u5173\u95ED"
|
|
1099
1233
|
},
|
|
1100
1234
|
markdown: {
|
|
1101
|
-
copy: "\u590D\u5236"
|
|
1235
|
+
copy: "\u590D\u5236",
|
|
1236
|
+
mermaid: {
|
|
1237
|
+
title: "Mermaid",
|
|
1238
|
+
diagram: "\u56FE\u8868",
|
|
1239
|
+
code: "\u4EE3\u7801",
|
|
1240
|
+
download: "\u4E0B\u8F7D SVG",
|
|
1241
|
+
fullScreen: "\u5168\u5C4F\u67E5\u770B",
|
|
1242
|
+
rendering: "\u6B63\u5728\u6E32\u67D3\u56FE\u8868",
|
|
1243
|
+
failed: "\u56FE\u8868\u6E32\u67D3\u5931\u8D25"
|
|
1244
|
+
}
|
|
1102
1245
|
},
|
|
1103
1246
|
thread: {
|
|
1104
1247
|
errorToast: "\u53D1\u751F\u9519\u8BEF\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
@@ -1631,19 +1774,86 @@ function ComposerMenu({
|
|
|
1631
1774
|
|
|
1632
1775
|
// src/components/composer/SendButton.tsx
|
|
1633
1776
|
import { ArrowUp, Square } from "lucide-react";
|
|
1634
|
-
|
|
1777
|
+
|
|
1778
|
+
// src/components/ui/tooltip.tsx
|
|
1779
|
+
import "react";
|
|
1780
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
1781
|
+
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1782
|
+
function TooltipProvider({
|
|
1783
|
+
delayDuration = 0,
|
|
1784
|
+
...props
|
|
1785
|
+
}) {
|
|
1786
|
+
return /* @__PURE__ */ jsx7(
|
|
1787
|
+
TooltipPrimitive.Provider,
|
|
1788
|
+
{
|
|
1789
|
+
"data-slot": "tooltip-provider",
|
|
1790
|
+
delayDuration,
|
|
1791
|
+
...props
|
|
1792
|
+
}
|
|
1793
|
+
);
|
|
1794
|
+
}
|
|
1795
|
+
function Tooltip({
|
|
1796
|
+
...props
|
|
1797
|
+
}) {
|
|
1798
|
+
return /* @__PURE__ */ jsx7(TooltipProvider, { children: /* @__PURE__ */ jsx7(
|
|
1799
|
+
TooltipPrimitive.Root,
|
|
1800
|
+
{
|
|
1801
|
+
"data-slot": "tooltip",
|
|
1802
|
+
...props
|
|
1803
|
+
}
|
|
1804
|
+
) });
|
|
1805
|
+
}
|
|
1806
|
+
function TooltipTrigger({
|
|
1807
|
+
...props
|
|
1808
|
+
}) {
|
|
1809
|
+
return /* @__PURE__ */ jsx7(
|
|
1810
|
+
TooltipPrimitive.Trigger,
|
|
1811
|
+
{
|
|
1812
|
+
"data-slot": "tooltip-trigger",
|
|
1813
|
+
...props
|
|
1814
|
+
}
|
|
1815
|
+
);
|
|
1816
|
+
}
|
|
1817
|
+
function TooltipContent({
|
|
1818
|
+
className,
|
|
1819
|
+
sideOffset = 0,
|
|
1820
|
+
hideArrow = false,
|
|
1821
|
+
children,
|
|
1822
|
+
...props
|
|
1823
|
+
}) {
|
|
1824
|
+
return /* @__PURE__ */ jsx7(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs2(
|
|
1825
|
+
TooltipPrimitive.Content,
|
|
1826
|
+
{
|
|
1827
|
+
"data-slot": "tooltip-content",
|
|
1828
|
+
sideOffset,
|
|
1829
|
+
className: cn(
|
|
1830
|
+
"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",
|
|
1831
|
+
className
|
|
1832
|
+
),
|
|
1833
|
+
...props,
|
|
1834
|
+
children: [
|
|
1835
|
+
children,
|
|
1836
|
+
!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
|
|
1837
|
+
]
|
|
1838
|
+
}
|
|
1839
|
+
) });
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
// src/components/composer/SendButton.tsx
|
|
1843
|
+
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1635
1844
|
function SendButton({
|
|
1636
1845
|
disabled = false,
|
|
1637
1846
|
isLoading = false,
|
|
1638
1847
|
showStop = isLoading,
|
|
1639
1848
|
onStop,
|
|
1640
1849
|
stopLabel = "Stop",
|
|
1641
|
-
sendLabel = "Send"
|
|
1850
|
+
sendLabel = "Send",
|
|
1851
|
+
shortcuts
|
|
1642
1852
|
}) {
|
|
1643
1853
|
const { theme } = useTheme();
|
|
1644
1854
|
const roundedClass = getRoundedClass(theme.radius);
|
|
1645
1855
|
if (showStop) {
|
|
1646
|
-
return /* @__PURE__ */
|
|
1856
|
+
return /* @__PURE__ */ jsx8(
|
|
1647
1857
|
"button",
|
|
1648
1858
|
{
|
|
1649
1859
|
type: "button",
|
|
@@ -1656,11 +1866,11 @@ function SendButton({
|
|
|
1656
1866
|
"hover:scale-105 active:scale-95"
|
|
1657
1867
|
),
|
|
1658
1868
|
"aria-label": stopLabel,
|
|
1659
|
-
children: /* @__PURE__ */
|
|
1869
|
+
children: /* @__PURE__ */ jsx8(Square, { size: 14, fill: "currentColor", stroke: "currentColor", strokeWidth: 0 })
|
|
1660
1870
|
}
|
|
1661
1871
|
);
|
|
1662
1872
|
}
|
|
1663
|
-
|
|
1873
|
+
const button = /* @__PURE__ */ jsx8(
|
|
1664
1874
|
"button",
|
|
1665
1875
|
{
|
|
1666
1876
|
type: "submit",
|
|
@@ -1674,34 +1884,63 @@ function SendButton({
|
|
|
1674
1884
|
"disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:scale-100"
|
|
1675
1885
|
),
|
|
1676
1886
|
"aria-label": sendLabel,
|
|
1677
|
-
children: /* @__PURE__ */
|
|
1887
|
+
children: /* @__PURE__ */ jsx8(ArrowUp, { size: 18, strokeWidth: 2.5 })
|
|
1678
1888
|
}
|
|
1679
1889
|
);
|
|
1890
|
+
if (!shortcuts?.length || disabled) {
|
|
1891
|
+
return button;
|
|
1892
|
+
}
|
|
1893
|
+
return /* @__PURE__ */ jsxs3(Tooltip, { children: [
|
|
1894
|
+
/* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: button }),
|
|
1895
|
+
/* @__PURE__ */ jsx8(
|
|
1896
|
+
TooltipContent,
|
|
1897
|
+
{
|
|
1898
|
+
side: "top",
|
|
1899
|
+
sideOffset: 10,
|
|
1900
|
+
hideArrow: true,
|
|
1901
|
+
className: cn(
|
|
1902
|
+
"min-w-36 border border-border/70 bg-background px-3 py-2 text-foreground shadow-lg",
|
|
1903
|
+
roundedClass
|
|
1904
|
+
),
|
|
1905
|
+
children: /* @__PURE__ */ jsx8("div", { className: "space-y-1", children: shortcuts.map((shortcut) => /* @__PURE__ */ jsxs3(
|
|
1906
|
+
"div",
|
|
1907
|
+
{
|
|
1908
|
+
className: "flex items-center justify-between gap-4 text-sm",
|
|
1909
|
+
children: [
|
|
1910
|
+
/* @__PURE__ */ jsx8("span", { className: "font-medium", children: shortcut.label }),
|
|
1911
|
+
/* @__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 })
|
|
1912
|
+
]
|
|
1913
|
+
},
|
|
1914
|
+
`${shortcut.label}-${shortcut.keys}`
|
|
1915
|
+
)) })
|
|
1916
|
+
}
|
|
1917
|
+
)
|
|
1918
|
+
] });
|
|
1680
1919
|
}
|
|
1681
1920
|
|
|
1682
1921
|
// src/components/history/HistorySidebar.tsx
|
|
1683
|
-
import * as
|
|
1922
|
+
import * as React9 from "react";
|
|
1684
1923
|
import { History, MessageSquare, PlusCircle, Trash2 } from "lucide-react";
|
|
1685
1924
|
|
|
1686
1925
|
// src/components/ui/scroll-area.tsx
|
|
1687
|
-
import * as
|
|
1926
|
+
import * as React7 from "react";
|
|
1688
1927
|
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
1689
|
-
import { jsx as
|
|
1690
|
-
var ScrollArea =
|
|
1928
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1929
|
+
var ScrollArea = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs4(
|
|
1691
1930
|
ScrollAreaPrimitive.Root,
|
|
1692
1931
|
{
|
|
1693
1932
|
ref,
|
|
1694
1933
|
className: cn("relative overflow-hidden", className),
|
|
1695
1934
|
...props,
|
|
1696
1935
|
children: [
|
|
1697
|
-
/* @__PURE__ */
|
|
1698
|
-
/* @__PURE__ */
|
|
1699
|
-
/* @__PURE__ */
|
|
1936
|
+
/* @__PURE__ */ jsx9(ScrollAreaPrimitive.Viewport, { className: "h-full w-full rounded-[inherit]", children }),
|
|
1937
|
+
/* @__PURE__ */ jsx9(ScrollBar, {}),
|
|
1938
|
+
/* @__PURE__ */ jsx9(ScrollAreaPrimitive.Corner, {})
|
|
1700
1939
|
]
|
|
1701
1940
|
}
|
|
1702
1941
|
));
|
|
1703
1942
|
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
1704
|
-
var ScrollBar =
|
|
1943
|
+
var ScrollBar = React7.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx9(
|
|
1705
1944
|
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
1706
1945
|
{
|
|
1707
1946
|
ref,
|
|
@@ -1713,7 +1952,7 @@ var ScrollBar = React6.forwardRef(({ className, orientation = "vertical", ...pro
|
|
|
1713
1952
|
className
|
|
1714
1953
|
),
|
|
1715
1954
|
...props,
|
|
1716
|
-
children: /* @__PURE__ */
|
|
1955
|
+
children: /* @__PURE__ */ jsx9(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
|
|
1717
1956
|
}
|
|
1718
1957
|
));
|
|
1719
1958
|
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
@@ -1722,21 +1961,21 @@ ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
|
1722
1961
|
import "react";
|
|
1723
1962
|
import { X } from "lucide-react";
|
|
1724
1963
|
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
1725
|
-
import { jsx as
|
|
1964
|
+
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1726
1965
|
function Sheet({ ...props }) {
|
|
1727
|
-
return /* @__PURE__ */
|
|
1966
|
+
return /* @__PURE__ */ jsx10(SheetPrimitive.Root, { ...props });
|
|
1728
1967
|
}
|
|
1729
1968
|
function SheetTrigger({ ...props }) {
|
|
1730
|
-
return /* @__PURE__ */
|
|
1969
|
+
return /* @__PURE__ */ jsx10(SheetPrimitive.Trigger, { ...props });
|
|
1731
1970
|
}
|
|
1732
1971
|
function SheetPortal({ ...props }) {
|
|
1733
|
-
return /* @__PURE__ */
|
|
1972
|
+
return /* @__PURE__ */ jsx10(SheetPrimitive.Portal, { ...props });
|
|
1734
1973
|
}
|
|
1735
1974
|
function SheetOverlay({
|
|
1736
1975
|
className,
|
|
1737
1976
|
...props
|
|
1738
1977
|
}) {
|
|
1739
|
-
return /* @__PURE__ */
|
|
1978
|
+
return /* @__PURE__ */ jsx10(
|
|
1740
1979
|
SheetPrimitive.Overlay,
|
|
1741
1980
|
{
|
|
1742
1981
|
className: cn(
|
|
@@ -1760,9 +1999,9 @@ function SheetContent({
|
|
|
1760
1999
|
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
2000
|
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
2001
|
};
|
|
1763
|
-
return /* @__PURE__ */
|
|
1764
|
-
/* @__PURE__ */
|
|
1765
|
-
/* @__PURE__ */
|
|
2002
|
+
return /* @__PURE__ */ jsxs5(SheetPortal, { children: [
|
|
2003
|
+
/* @__PURE__ */ jsx10(SheetOverlay, {}),
|
|
2004
|
+
/* @__PURE__ */ jsxs5(
|
|
1766
2005
|
SheetPrimitive.Content,
|
|
1767
2006
|
{
|
|
1768
2007
|
className: cn(
|
|
@@ -1773,9 +2012,9 @@ function SheetContent({
|
|
|
1773
2012
|
...props,
|
|
1774
2013
|
children: [
|
|
1775
2014
|
children,
|
|
1776
|
-
/* @__PURE__ */
|
|
1777
|
-
/* @__PURE__ */
|
|
1778
|
-
/* @__PURE__ */
|
|
2015
|
+
/* @__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: [
|
|
2016
|
+
/* @__PURE__ */ jsx10(X, { size: 16 }),
|
|
2017
|
+
/* @__PURE__ */ jsx10("span", { className: "sr-only", children: t("sheet.close") })
|
|
1779
2018
|
] })
|
|
1780
2019
|
]
|
|
1781
2020
|
}
|
|
@@ -1786,7 +2025,7 @@ function SheetHeader({
|
|
|
1786
2025
|
className,
|
|
1787
2026
|
...props
|
|
1788
2027
|
}) {
|
|
1789
|
-
return /* @__PURE__ */
|
|
2028
|
+
return /* @__PURE__ */ jsx10(
|
|
1790
2029
|
"div",
|
|
1791
2030
|
{
|
|
1792
2031
|
className: cn(
|
|
@@ -1801,7 +2040,7 @@ function SheetTitle({
|
|
|
1801
2040
|
className,
|
|
1802
2041
|
...props
|
|
1803
2042
|
}) {
|
|
1804
|
-
return /* @__PURE__ */
|
|
2043
|
+
return /* @__PURE__ */ jsx10(
|
|
1805
2044
|
SheetPrimitive.Title,
|
|
1806
2045
|
{
|
|
1807
2046
|
className: cn("text-lg font-semibold text-foreground", className),
|
|
@@ -1811,7 +2050,7 @@ function SheetTitle({
|
|
|
1811
2050
|
}
|
|
1812
2051
|
|
|
1813
2052
|
// src/components/history/HistorySidebar.tsx
|
|
1814
|
-
import { jsx as
|
|
2053
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1815
2054
|
function HistorySidebar({
|
|
1816
2055
|
threads = [],
|
|
1817
2056
|
currentThreadId,
|
|
@@ -1822,7 +2061,7 @@ function HistorySidebar({
|
|
|
1822
2061
|
disabled = false
|
|
1823
2062
|
}) {
|
|
1824
2063
|
const { t } = useChatkitTranslation();
|
|
1825
|
-
const [open, setOpen] =
|
|
2064
|
+
const [open, setOpen] = React9.useState(false);
|
|
1826
2065
|
const handleNewThread = () => {
|
|
1827
2066
|
onNewThread?.();
|
|
1828
2067
|
setOpen(false);
|
|
@@ -1831,8 +2070,8 @@ function HistorySidebar({
|
|
|
1831
2070
|
onSelectThread?.(id);
|
|
1832
2071
|
setOpen(false);
|
|
1833
2072
|
};
|
|
1834
|
-
return /* @__PURE__ */
|
|
1835
|
-
/* @__PURE__ */
|
|
2073
|
+
return /* @__PURE__ */ jsxs6(Sheet, { open, onOpenChange: setOpen, children: [
|
|
2074
|
+
/* @__PURE__ */ jsx11(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsxs6(
|
|
1836
2075
|
Button,
|
|
1837
2076
|
{
|
|
1838
2077
|
variant: "ghost",
|
|
@@ -1840,26 +2079,26 @@ function HistorySidebar({
|
|
|
1840
2079
|
disabled,
|
|
1841
2080
|
className: "h-8 w-8 cursor-pointer",
|
|
1842
2081
|
children: [
|
|
1843
|
-
/* @__PURE__ */
|
|
1844
|
-
/* @__PURE__ */
|
|
2082
|
+
/* @__PURE__ */ jsx11(History, { size: 16 }),
|
|
2083
|
+
/* @__PURE__ */ jsx11("span", { className: "sr-only", children: t("history.threadHistory") })
|
|
1845
2084
|
]
|
|
1846
2085
|
}
|
|
1847
2086
|
) }),
|
|
1848
|
-
/* @__PURE__ */
|
|
1849
|
-
/* @__PURE__ */
|
|
1850
|
-
/* @__PURE__ */
|
|
2087
|
+
/* @__PURE__ */ jsxs6(SheetContent, { side: "right", className: "w-80 p-0", children: [
|
|
2088
|
+
/* @__PURE__ */ jsx11(SheetHeader, { className: "border-b p-4", children: /* @__PURE__ */ jsx11(SheetTitle, { children: t("history.title") }) }),
|
|
2089
|
+
/* @__PURE__ */ jsx11("div", { className: "p-4", children: /* @__PURE__ */ jsxs6(
|
|
1851
2090
|
Button,
|
|
1852
2091
|
{
|
|
1853
2092
|
onClick: handleNewThread,
|
|
1854
2093
|
className: "w-full justify-start gap-2",
|
|
1855
2094
|
variant: "secondary",
|
|
1856
2095
|
children: [
|
|
1857
|
-
/* @__PURE__ */
|
|
2096
|
+
/* @__PURE__ */ jsx11(PlusCircle, { size: 16 }),
|
|
1858
2097
|
t("history.newThread")
|
|
1859
2098
|
]
|
|
1860
2099
|
}
|
|
1861
2100
|
) }),
|
|
1862
|
-
/* @__PURE__ */
|
|
2101
|
+
/* @__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
2102
|
"div",
|
|
1864
2103
|
{
|
|
1865
2104
|
className: cn(
|
|
@@ -1869,9 +2108,9 @@ function HistorySidebar({
|
|
|
1869
2108
|
),
|
|
1870
2109
|
onClick: () => handleSelectThread(thread.id),
|
|
1871
2110
|
children: [
|
|
1872
|
-
/* @__PURE__ */
|
|
1873
|
-
/* @__PURE__ */
|
|
1874
|
-
showDelete && onDeleteThread && /* @__PURE__ */
|
|
2111
|
+
/* @__PURE__ */ jsx11("span", { className: "text-muted-foreground", children: /* @__PURE__ */ jsx11(MessageSquare, { size: 16 }) }),
|
|
2112
|
+
/* @__PURE__ */ jsx11("span", { className: "flex-1 truncate", children: thread.title }),
|
|
2113
|
+
showDelete && onDeleteThread && /* @__PURE__ */ jsx11(
|
|
1875
2114
|
"button",
|
|
1876
2115
|
{
|
|
1877
2116
|
type: "button",
|
|
@@ -1880,7 +2119,7 @@ function HistorySidebar({
|
|
|
1880
2119
|
onDeleteThread(thread.id);
|
|
1881
2120
|
},
|
|
1882
2121
|
className: "opacity-0 group-hover:opacity-100 p-1 rounded hover:bg-destructive/10 hover:text-destructive transition-all",
|
|
1883
|
-
children: /* @__PURE__ */
|
|
2122
|
+
children: /* @__PURE__ */ jsx11(Trash2, { size: 14 })
|
|
1884
2123
|
}
|
|
1885
2124
|
)
|
|
1886
2125
|
]
|
|
@@ -1901,72 +2140,7 @@ import {
|
|
|
1901
2140
|
SlidersHorizontal as SlidersHorizontal2,
|
|
1902
2141
|
Trash2 as Trash22
|
|
1903
2142
|
} 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";
|
|
2143
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1970
2144
|
function getPendingFollowUpText(item, referencedContentFallback) {
|
|
1971
2145
|
const text = item.request?.input?.input?.trim() ?? "";
|
|
1972
2146
|
if (text) {
|
|
@@ -2031,11 +2205,11 @@ function PendingFollowUps({
|
|
|
2031
2205
|
rounded.top,
|
|
2032
2206
|
className
|
|
2033
2207
|
),
|
|
2034
|
-
children: /* @__PURE__ */
|
|
2035
|
-
/* @__PURE__ */
|
|
2208
|
+
children: /* @__PURE__ */ jsxs7("div", { className: "space-y-1", children: [
|
|
2209
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between gap-3", children: [
|
|
2036
2210
|
/* @__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__ */
|
|
2211
|
+
/* @__PURE__ */ jsxs7(Tooltip, { children: [
|
|
2212
|
+
/* @__PURE__ */ jsx12(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs7(
|
|
2039
2213
|
"button",
|
|
2040
2214
|
{
|
|
2041
2215
|
type: "button",
|
|
@@ -2065,8 +2239,8 @@ function PendingFollowUps({
|
|
|
2065
2239
|
"border border-border/70 bg-muted/20 px-3 py-2",
|
|
2066
2240
|
rounded.panel
|
|
2067
2241
|
),
|
|
2068
|
-
children: /* @__PURE__ */
|
|
2069
|
-
/* @__PURE__ */
|
|
2242
|
+
children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between gap-3", children: [
|
|
2243
|
+
/* @__PURE__ */ jsxs7("div", { className: "min-w-0", children: [
|
|
2070
2244
|
/* @__PURE__ */ jsx12("div", { className: "text-xs font-medium text-foreground", children: t("chat.followUps.label") }),
|
|
2071
2245
|
/* @__PURE__ */ jsx12("div", { className: "text-[11px] text-muted-foreground", children: isLoading ? t("chat.followUps.activeHint") : t("chat.followUps.idleHint") })
|
|
2072
2246
|
] }),
|
|
@@ -2077,7 +2251,7 @@ function PendingFollowUps({
|
|
|
2077
2251
|
"inline-flex shrink-0 border border-border bg-background p-1",
|
|
2078
2252
|
rounded.control
|
|
2079
2253
|
),
|
|
2080
|
-
children: ["queue", "steer"].map((behavior) => /* @__PURE__ */
|
|
2254
|
+
children: ["queue", "steer"].map((behavior) => /* @__PURE__ */ jsxs7(Tooltip, { children: [
|
|
2081
2255
|
/* @__PURE__ */ jsx12(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx12(
|
|
2082
2256
|
"button",
|
|
2083
2257
|
{
|
|
@@ -2110,10 +2284,10 @@ function PendingFollowUps({
|
|
|
2110
2284
|
"border border-border/50 bg-muted/15 px-2 py-1",
|
|
2111
2285
|
rounded.panel
|
|
2112
2286
|
),
|
|
2113
|
-
children: /* @__PURE__ */
|
|
2287
|
+
children: /* @__PURE__ */ jsxs7("div", { className: "flex items-start gap-2.5", children: [
|
|
2114
2288
|
/* @__PURE__ */ jsx12(CornerDownLeft, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
2115
|
-
/* @__PURE__ */
|
|
2116
|
-
/* @__PURE__ */
|
|
2289
|
+
/* @__PURE__ */ jsxs7("div", { className: "min-w-0 flex-1", children: [
|
|
2290
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-start gap-2", children: [
|
|
2117
2291
|
/* @__PURE__ */ jsx12("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx12(
|
|
2118
2292
|
"div",
|
|
2119
2293
|
{
|
|
@@ -2128,7 +2302,7 @@ function PendingFollowUps({
|
|
|
2128
2302
|
)
|
|
2129
2303
|
}
|
|
2130
2304
|
) }),
|
|
2131
|
-
/* @__PURE__ */
|
|
2305
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
2132
2306
|
item.mode === "queue" && isLoading && /* @__PURE__ */ jsx12(
|
|
2133
2307
|
"button",
|
|
2134
2308
|
{
|
|
@@ -2171,7 +2345,7 @@ function PendingFollowUps({
|
|
|
2171
2345
|
children: /* @__PURE__ */ jsx12(Trash22, { size: 13 })
|
|
2172
2346
|
}
|
|
2173
2347
|
),
|
|
2174
|
-
item.mode === "queue" && /* @__PURE__ */
|
|
2348
|
+
item.mode === "queue" && /* @__PURE__ */ jsxs7(
|
|
2175
2349
|
Popover,
|
|
2176
2350
|
{
|
|
2177
2351
|
open: openMenuId === item.id,
|
|
@@ -2199,8 +2373,8 @@ function PendingFollowUps({
|
|
|
2199
2373
|
"w-52 border-border/70 bg-background p-1.5",
|
|
2200
2374
|
rounded.panel
|
|
2201
2375
|
),
|
|
2202
|
-
children: /* @__PURE__ */
|
|
2203
|
-
/* @__PURE__ */
|
|
2376
|
+
children: /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-1", children: [
|
|
2377
|
+
/* @__PURE__ */ jsxs7(
|
|
2204
2378
|
"button",
|
|
2205
2379
|
{
|
|
2206
2380
|
type: "button",
|
|
@@ -2218,7 +2392,7 @@ function PendingFollowUps({
|
|
|
2218
2392
|
]
|
|
2219
2393
|
}
|
|
2220
2394
|
),
|
|
2221
|
-
/* @__PURE__ */
|
|
2395
|
+
/* @__PURE__ */ jsxs7(
|
|
2222
2396
|
"button",
|
|
2223
2397
|
{
|
|
2224
2398
|
type: "button",
|
|
@@ -2244,7 +2418,7 @@ function PendingFollowUps({
|
|
|
2244
2418
|
)
|
|
2245
2419
|
] })
|
|
2246
2420
|
] }),
|
|
2247
|
-
/* @__PURE__ */
|
|
2421
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-1.5 text-[10px] leading-4 text-muted-foreground", children: [
|
|
2248
2422
|
/* @__PURE__ */ jsx12(Info, { className: "h-3 w-3 shrink-0" }),
|
|
2249
2423
|
/* @__PURE__ */ jsx12("span", { className: "truncate", children: item.mode === "queue" ? canSendItemNow ? t("chat.followUps.manualQueueHint") : t("chat.followUps.queueHint") : t("chat.followUps.steerHint") })
|
|
2250
2424
|
] })
|
|
@@ -2260,8 +2434,8 @@ function PendingFollowUps({
|
|
|
2260
2434
|
}
|
|
2261
2435
|
|
|
2262
2436
|
// src/components/thread/messages/ai.tsx
|
|
2263
|
-
import * as
|
|
2264
|
-
import { ChevronDown, CheckCircle2, XCircle, Loader2 } from "lucide-react";
|
|
2437
|
+
import * as React15 from "react";
|
|
2438
|
+
import { ChevronDown, CheckCircle2, XCircle, Loader2 as Loader22 } from "lucide-react";
|
|
2265
2439
|
|
|
2266
2440
|
// src/components/ui/badge.tsx
|
|
2267
2441
|
import * as React11 from "react";
|
|
@@ -2339,7 +2513,7 @@ var TabsList = React13.forwardRef(
|
|
|
2339
2513
|
{
|
|
2340
2514
|
ref,
|
|
2341
2515
|
className: cn(
|
|
2342
|
-
"inline-flex
|
|
2516
|
+
"inline-flex items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
|
|
2343
2517
|
className
|
|
2344
2518
|
),
|
|
2345
2519
|
role: "tablist",
|
|
@@ -2364,7 +2538,7 @@ var TabsTrigger = React13.forwardRef(
|
|
|
2364
2538
|
"aria-selected": isActive,
|
|
2365
2539
|
"data-state": isActive ? "active" : "inactive",
|
|
2366
2540
|
className: cn(
|
|
2367
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-
|
|
2541
|
+
"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
2542
|
className
|
|
2369
2543
|
),
|
|
2370
2544
|
onClick: (event) => {
|
|
@@ -2407,10 +2581,11 @@ import rehypeKatex from "rehype-katex";
|
|
|
2407
2581
|
import remarkMath from "remark-math";
|
|
2408
2582
|
import {
|
|
2409
2583
|
Children,
|
|
2584
|
+
isValidElement,
|
|
2410
2585
|
memo,
|
|
2411
|
-
useState as
|
|
2586
|
+
useState as useState7
|
|
2412
2587
|
} from "react";
|
|
2413
|
-
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
2588
|
+
import { CheckIcon as CheckIcon2, CopyIcon as CopyIcon2 } from "lucide-react";
|
|
2414
2589
|
|
|
2415
2590
|
// src/components/thread/syntax-highlighter.tsx
|
|
2416
2591
|
import { PrismAsyncLight as SyntaxHighlighterPrism } from "react-syntax-highlighter";
|
|
@@ -2446,12 +2621,27 @@ var SyntaxHighlighter = ({
|
|
|
2446
2621
|
);
|
|
2447
2622
|
};
|
|
2448
2623
|
|
|
2624
|
+
// src/components/thread/mermaid-block.tsx
|
|
2625
|
+
import * as Dialog from "@radix-ui/react-dialog";
|
|
2626
|
+
import mermaid from "mermaid";
|
|
2627
|
+
import {
|
|
2628
|
+
CheckIcon,
|
|
2629
|
+
Code2Icon,
|
|
2630
|
+
CopyIcon,
|
|
2631
|
+
DownloadIcon,
|
|
2632
|
+
ExpandIcon,
|
|
2633
|
+
Loader2,
|
|
2634
|
+
TriangleAlert,
|
|
2635
|
+
X as X2
|
|
2636
|
+
} from "lucide-react";
|
|
2637
|
+
import * as React14 from "react";
|
|
2638
|
+
|
|
2449
2639
|
// src/components/thread/tooltip-icon-button.tsx
|
|
2450
2640
|
import { forwardRef as forwardRef5 } from "react";
|
|
2451
|
-
import { jsx as jsx17, jsxs as
|
|
2641
|
+
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2452
2642
|
var TooltipIconButton = forwardRef5(({ children, tooltip, side = "bottom", className, ...rest }, ref) => {
|
|
2453
|
-
return /* @__PURE__ */ jsx17(TooltipProvider, { children: /* @__PURE__ */
|
|
2454
|
-
/* @__PURE__ */ jsx17(TooltipTrigger, { asChild: true, children: /* @__PURE__ */
|
|
2643
|
+
return /* @__PURE__ */ jsx17(TooltipProvider, { children: /* @__PURE__ */ jsxs8(Tooltip, { children: [
|
|
2644
|
+
/* @__PURE__ */ jsx17(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs8(
|
|
2455
2645
|
Button,
|
|
2456
2646
|
{
|
|
2457
2647
|
variant: "ghost",
|
|
@@ -2470,19 +2660,510 @@ var TooltipIconButton = forwardRef5(({ children, tooltip, side = "bottom", class
|
|
|
2470
2660
|
});
|
|
2471
2661
|
TooltipIconButton.displayName = "TooltipIconButton";
|
|
2472
2662
|
|
|
2663
|
+
// src/components/thread/mermaid-block.tsx
|
|
2664
|
+
import { Fragment as Fragment2, jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2665
|
+
var HEX_COLOR_PATTERN = /^#([\da-f]{3,8})$/i;
|
|
2666
|
+
var MERMAID_DIRECTIVE_PATTERN = /%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
|
|
2667
|
+
var MERMAID_FRONTMATTER_PATTERN = /^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s;
|
|
2668
|
+
var OKLCH_COLOR_PATTERN = /^oklch\((.+)\)$/i;
|
|
2669
|
+
var RGB_COLOR_PATTERN = /^rgba?\((.+)\)$/i;
|
|
2670
|
+
var MERMAID_SECURE_KEYS = [
|
|
2671
|
+
"fontFamily",
|
|
2672
|
+
"maxEdges",
|
|
2673
|
+
"maxTextSize",
|
|
2674
|
+
"securityLevel",
|
|
2675
|
+
"secure",
|
|
2676
|
+
"startOnLoad",
|
|
2677
|
+
"suppressErrorRendering",
|
|
2678
|
+
"theme",
|
|
2679
|
+
"themeVariables"
|
|
2680
|
+
];
|
|
2681
|
+
function clamp(value, min, max) {
|
|
2682
|
+
return Math.min(max, Math.max(min, value));
|
|
2683
|
+
}
|
|
2684
|
+
function normalizeMermaidCode(code) {
|
|
2685
|
+
return code.replace(MERMAID_FRONTMATTER_PATTERN, "").replace(MERMAID_DIRECTIVE_PATTERN, "").trim();
|
|
2686
|
+
}
|
|
2687
|
+
function parseAlpha(value) {
|
|
2688
|
+
if (!value) return 1;
|
|
2689
|
+
const normalized = value.trim();
|
|
2690
|
+
if (!normalized) return 1;
|
|
2691
|
+
if (normalized.endsWith("%")) {
|
|
2692
|
+
return clamp(Number.parseFloat(normalized) / 100, 0, 1);
|
|
2693
|
+
}
|
|
2694
|
+
return clamp(Number.parseFloat(normalized), 0, 1);
|
|
2695
|
+
}
|
|
2696
|
+
function parseHexColor(value) {
|
|
2697
|
+
const match = value.trim().match(HEX_COLOR_PATTERN);
|
|
2698
|
+
if (!match) return null;
|
|
2699
|
+
const hex = match[1];
|
|
2700
|
+
if (hex.length === 3 || hex.length === 4) {
|
|
2701
|
+
const [r, g, b, a = "f"] = hex.split("");
|
|
2702
|
+
return {
|
|
2703
|
+
r: Number.parseInt(r + r, 16),
|
|
2704
|
+
g: Number.parseInt(g + g, 16),
|
|
2705
|
+
b: Number.parseInt(b + b, 16),
|
|
2706
|
+
a: Number.parseInt(a + a, 16) / 255
|
|
2707
|
+
};
|
|
2708
|
+
}
|
|
2709
|
+
if (hex.length === 6 || hex.length === 8) {
|
|
2710
|
+
const alphaHex = hex.length === 8 ? hex.slice(6, 8) : "ff";
|
|
2711
|
+
return {
|
|
2712
|
+
r: Number.parseInt(hex.slice(0, 2), 16),
|
|
2713
|
+
g: Number.parseInt(hex.slice(2, 4), 16),
|
|
2714
|
+
b: Number.parseInt(hex.slice(4, 6), 16),
|
|
2715
|
+
a: Number.parseInt(alphaHex, 16) / 255
|
|
2716
|
+
};
|
|
2717
|
+
}
|
|
2718
|
+
return null;
|
|
2719
|
+
}
|
|
2720
|
+
function parseRgbChannel(value) {
|
|
2721
|
+
const normalized = value.trim();
|
|
2722
|
+
if (normalized.endsWith("%")) {
|
|
2723
|
+
return clamp(Math.round(Number.parseFloat(normalized) / 100 * 255), 0, 255);
|
|
2724
|
+
}
|
|
2725
|
+
return clamp(Math.round(Number.parseFloat(normalized)), 0, 255);
|
|
2726
|
+
}
|
|
2727
|
+
function parseRgbColor(value) {
|
|
2728
|
+
const match = value.trim().match(RGB_COLOR_PATTERN);
|
|
2729
|
+
if (!match) return null;
|
|
2730
|
+
const parts = match[1].split(/[,\s/]+/).map((part) => part.trim()).filter(Boolean);
|
|
2731
|
+
if (parts.length < 3) return null;
|
|
2732
|
+
return {
|
|
2733
|
+
r: parseRgbChannel(parts[0]),
|
|
2734
|
+
g: parseRgbChannel(parts[1]),
|
|
2735
|
+
b: parseRgbChannel(parts[2]),
|
|
2736
|
+
a: parseAlpha(parts[3])
|
|
2737
|
+
};
|
|
2738
|
+
}
|
|
2739
|
+
function parseOklchLightness(value) {
|
|
2740
|
+
const normalized = value.trim();
|
|
2741
|
+
if (normalized.endsWith("%")) {
|
|
2742
|
+
return clamp(Number.parseFloat(normalized) / 100, 0, 1);
|
|
2743
|
+
}
|
|
2744
|
+
return clamp(Number.parseFloat(normalized), 0, 1);
|
|
2745
|
+
}
|
|
2746
|
+
function parseHue(value) {
|
|
2747
|
+
const normalized = value.trim().toLowerCase();
|
|
2748
|
+
const numeric = Number.parseFloat(normalized);
|
|
2749
|
+
if (Number.isNaN(numeric)) return 0;
|
|
2750
|
+
if (normalized.endsWith("turn")) return numeric * 360;
|
|
2751
|
+
if (normalized.endsWith("rad")) return numeric * (180 / Math.PI);
|
|
2752
|
+
if (normalized.endsWith("grad")) return numeric * 0.9;
|
|
2753
|
+
return numeric;
|
|
2754
|
+
}
|
|
2755
|
+
function linearToSrgb(linear) {
|
|
2756
|
+
if (linear <= 31308e-7) {
|
|
2757
|
+
return 12.92 * linear;
|
|
2758
|
+
}
|
|
2759
|
+
return 1.055 * Math.pow(linear, 1 / 2.4) - 0.055;
|
|
2760
|
+
}
|
|
2761
|
+
function parseOklchColor(value) {
|
|
2762
|
+
const match = value.trim().match(OKLCH_COLOR_PATTERN);
|
|
2763
|
+
if (!match) return null;
|
|
2764
|
+
const [base2, alphaSegment] = match[1].split("/");
|
|
2765
|
+
const parts = base2.trim().split(/\s+/).map((part) => part.trim()).filter(Boolean);
|
|
2766
|
+
if (parts.length < 3) return null;
|
|
2767
|
+
const lightness = parseOklchLightness(parts[0]);
|
|
2768
|
+
const chroma = Number.parseFloat(parts[1]);
|
|
2769
|
+
const hueRadians = parseHue(parts[2]) * Math.PI / 180;
|
|
2770
|
+
const alpha = parseAlpha(alphaSegment);
|
|
2771
|
+
const a = chroma * Math.cos(hueRadians);
|
|
2772
|
+
const b = chroma * Math.sin(hueRadians);
|
|
2773
|
+
const l_ = lightness + 0.3963377774 * a + 0.2158037573 * b;
|
|
2774
|
+
const m_ = lightness - 0.1055613458 * a - 0.0638541728 * b;
|
|
2775
|
+
const s_ = lightness - 0.0894841775 * a - 1.291485548 * b;
|
|
2776
|
+
const l = l_ * l_ * l_;
|
|
2777
|
+
const m = m_ * m_ * m_;
|
|
2778
|
+
const s = s_ * s_ * s_;
|
|
2779
|
+
const linearR = 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s;
|
|
2780
|
+
const linearG = -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s;
|
|
2781
|
+
const linearB = -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s;
|
|
2782
|
+
return {
|
|
2783
|
+
r: clamp(Math.round(linearToSrgb(linearR) * 255), 0, 255),
|
|
2784
|
+
g: clamp(Math.round(linearToSrgb(linearG) * 255), 0, 255),
|
|
2785
|
+
b: clamp(Math.round(linearToSrgb(linearB) * 255), 0, 255),
|
|
2786
|
+
a: alpha
|
|
2787
|
+
};
|
|
2788
|
+
}
|
|
2789
|
+
function parseCssColor(value) {
|
|
2790
|
+
const normalized = value.trim();
|
|
2791
|
+
if (!normalized) return null;
|
|
2792
|
+
return parseHexColor(normalized) ?? parseRgbColor(normalized) ?? parseOklchColor(normalized);
|
|
2793
|
+
}
|
|
2794
|
+
function compositeColor(foreground, background) {
|
|
2795
|
+
const alpha = foreground.a + background.a * (1 - foreground.a);
|
|
2796
|
+
if (alpha <= 0) {
|
|
2797
|
+
return { r: 0, g: 0, b: 0, a: 0 };
|
|
2798
|
+
}
|
|
2799
|
+
const r = (foreground.r * foreground.a + background.r * background.a * (1 - foreground.a)) / alpha;
|
|
2800
|
+
const g = (foreground.g * foreground.a + background.g * background.a * (1 - foreground.a)) / alpha;
|
|
2801
|
+
const b = (foreground.b * foreground.a + background.b * background.a * (1 - foreground.a)) / alpha;
|
|
2802
|
+
return {
|
|
2803
|
+
r: clamp(Math.round(r), 0, 255),
|
|
2804
|
+
g: clamp(Math.round(g), 0, 255),
|
|
2805
|
+
b: clamp(Math.round(b), 0, 255),
|
|
2806
|
+
a: clamp(alpha, 0, 1)
|
|
2807
|
+
};
|
|
2808
|
+
}
|
|
2809
|
+
function toHexChannel(value) {
|
|
2810
|
+
return value.toString(16).padStart(2, "0");
|
|
2811
|
+
}
|
|
2812
|
+
function rgbaToHex(value) {
|
|
2813
|
+
return `#${toHexChannel(value.r)}${toHexChannel(value.g)}${toHexChannel(value.b)}`;
|
|
2814
|
+
}
|
|
2815
|
+
function getFallbackPalette(isDarkMode) {
|
|
2816
|
+
if (isDarkMode) {
|
|
2817
|
+
return {
|
|
2818
|
+
background: "#171717",
|
|
2819
|
+
border: "#52525b",
|
|
2820
|
+
fontFamily: "Inter Variable, sans-serif",
|
|
2821
|
+
line: "#a1a1aa",
|
|
2822
|
+
surface: "#262626",
|
|
2823
|
+
surfaceAlt: "#3f3f46",
|
|
2824
|
+
text: "#fafafa"
|
|
2825
|
+
};
|
|
2826
|
+
}
|
|
2827
|
+
return {
|
|
2828
|
+
background: "#ffffff",
|
|
2829
|
+
border: "#e4e4e7",
|
|
2830
|
+
fontFamily: "Inter Variable, sans-serif",
|
|
2831
|
+
line: "#71717a",
|
|
2832
|
+
surface: "#ffffff",
|
|
2833
|
+
surfaceAlt: "#f4f4f5",
|
|
2834
|
+
text: "#18181b"
|
|
2835
|
+
};
|
|
2836
|
+
}
|
|
2837
|
+
function resolveColor(styles, property, fallback, background) {
|
|
2838
|
+
const parsed = parseCssColor(styles.getPropertyValue(property));
|
|
2839
|
+
if (!parsed) return fallback;
|
|
2840
|
+
if (parsed.a < 1 && background) {
|
|
2841
|
+
return rgbaToHex(compositeColor(parsed, background));
|
|
2842
|
+
}
|
|
2843
|
+
return rgbaToHex(parsed);
|
|
2844
|
+
}
|
|
2845
|
+
function resolvePalette(element, isDarkMode) {
|
|
2846
|
+
const fallback = getFallbackPalette(isDarkMode);
|
|
2847
|
+
const styles = window.getComputedStyle(element);
|
|
2848
|
+
const backgroundColor = parseCssColor(styles.getPropertyValue("--card")) ?? parseCssColor(styles.getPropertyValue("--background")) ?? parseCssColor(fallback.surface);
|
|
2849
|
+
return {
|
|
2850
|
+
background: resolveColor(styles, "--background", fallback.background, backgroundColor),
|
|
2851
|
+
border: resolveColor(styles, "--border", fallback.border, backgroundColor),
|
|
2852
|
+
fontFamily: styles.getPropertyValue("font-family").trim() || fallback.fontFamily,
|
|
2853
|
+
line: resolveColor(styles, "--muted-foreground", fallback.line, backgroundColor),
|
|
2854
|
+
surface: resolveColor(styles, "--card", fallback.surface, backgroundColor),
|
|
2855
|
+
surfaceAlt: resolveColor(styles, "--muted", fallback.surfaceAlt, backgroundColor),
|
|
2856
|
+
text: resolveColor(styles, "--foreground", fallback.text, backgroundColor)
|
|
2857
|
+
};
|
|
2858
|
+
}
|
|
2859
|
+
function buildThemeVariables(palette) {
|
|
2860
|
+
return {
|
|
2861
|
+
background: palette.background,
|
|
2862
|
+
clusterBkg: palette.surfaceAlt,
|
|
2863
|
+
clusterBorder: palette.border,
|
|
2864
|
+
edgeLabelBackground: palette.surface,
|
|
2865
|
+
fontFamily: palette.fontFamily,
|
|
2866
|
+
lineColor: palette.line,
|
|
2867
|
+
mainBkg: palette.surface,
|
|
2868
|
+
nodeBorder: palette.border,
|
|
2869
|
+
nodeTextColor: palette.text,
|
|
2870
|
+
primaryBorderColor: palette.border,
|
|
2871
|
+
primaryColor: palette.surfaceAlt,
|
|
2872
|
+
primaryTextColor: palette.text,
|
|
2873
|
+
secondaryBorderColor: palette.border,
|
|
2874
|
+
secondaryColor: palette.surface,
|
|
2875
|
+
secondaryTextColor: palette.text,
|
|
2876
|
+
tertiaryBorderColor: palette.border,
|
|
2877
|
+
tertiaryColor: palette.surface,
|
|
2878
|
+
tertiaryTextColor: palette.text,
|
|
2879
|
+
textColor: palette.text
|
|
2880
|
+
};
|
|
2881
|
+
}
|
|
2882
|
+
async function renderMermaidDiagram({
|
|
2883
|
+
code,
|
|
2884
|
+
host,
|
|
2885
|
+
id,
|
|
2886
|
+
palette
|
|
2887
|
+
}) {
|
|
2888
|
+
host.innerHTML = "";
|
|
2889
|
+
mermaid.initialize({
|
|
2890
|
+
flowchart: {
|
|
2891
|
+
htmlLabels: false,
|
|
2892
|
+
useMaxWidth: true
|
|
2893
|
+
},
|
|
2894
|
+
fontFamily: palette.fontFamily,
|
|
2895
|
+
secure: [...MERMAID_SECURE_KEYS],
|
|
2896
|
+
securityLevel: "strict",
|
|
2897
|
+
startOnLoad: false,
|
|
2898
|
+
theme: "base",
|
|
2899
|
+
themeVariables: buildThemeVariables(palette)
|
|
2900
|
+
});
|
|
2901
|
+
const { svg } = await mermaid.render(id, code, host);
|
|
2902
|
+
host.innerHTML = "";
|
|
2903
|
+
return svg;
|
|
2904
|
+
}
|
|
2905
|
+
function MermaidPreviewDialog({
|
|
2906
|
+
closeLabel,
|
|
2907
|
+
onOpenChange,
|
|
2908
|
+
open,
|
|
2909
|
+
svgMarkup,
|
|
2910
|
+
title
|
|
2911
|
+
}) {
|
|
2912
|
+
return /* @__PURE__ */ jsx18(Dialog.Root, { open, onOpenChange, children: /* @__PURE__ */ jsxs9(Dialog.Portal, { children: [
|
|
2913
|
+
/* @__PURE__ */ jsx18(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" }),
|
|
2914
|
+
/* @__PURE__ */ jsxs9(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: [
|
|
2915
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between gap-4 border-b border-border px-5 py-4", children: [
|
|
2916
|
+
/* @__PURE__ */ jsx18(Dialog.Title, { className: "text-base font-semibold text-foreground", children: title }),
|
|
2917
|
+
/* @__PURE__ */ jsx18(Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsxs9(
|
|
2918
|
+
"button",
|
|
2919
|
+
{
|
|
2920
|
+
type: "button",
|
|
2921
|
+
className: "inline-flex size-10 items-center justify-center rounded-full border border-border bg-card text-muted-foreground transition-colors hover:text-foreground",
|
|
2922
|
+
children: [
|
|
2923
|
+
/* @__PURE__ */ jsx18(X2, { className: "size-4" }),
|
|
2924
|
+
/* @__PURE__ */ jsx18("span", { className: "sr-only", children: closeLabel })
|
|
2925
|
+
]
|
|
2926
|
+
}
|
|
2927
|
+
) })
|
|
2928
|
+
] }),
|
|
2929
|
+
/* @__PURE__ */ jsx18("div", { className: "flex-1 overflow-auto bg-card p-6", children: /* @__PURE__ */ jsx18(
|
|
2930
|
+
"div",
|
|
2931
|
+
{
|
|
2932
|
+
"data-slot": "mermaid-preview",
|
|
2933
|
+
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",
|
|
2934
|
+
dangerouslySetInnerHTML: { __html: svgMarkup }
|
|
2935
|
+
}
|
|
2936
|
+
) })
|
|
2937
|
+
] })
|
|
2938
|
+
] }) });
|
|
2939
|
+
}
|
|
2940
|
+
function MermaidBlock({ code }) {
|
|
2941
|
+
const { t } = useChatkitTranslation();
|
|
2942
|
+
const { theme, isDarkMode } = useTheme();
|
|
2943
|
+
const containerRef = React14.useRef(null);
|
|
2944
|
+
const renderHostRef = React14.useRef(null);
|
|
2945
|
+
const renderSequenceRef = React14.useRef(0);
|
|
2946
|
+
const copyResetTimeoutRef = React14.useRef(null);
|
|
2947
|
+
const diagramId = React14.useId().replace(/:/g, "");
|
|
2948
|
+
const [activeTab, setActiveTab] = React14.useState("diagram");
|
|
2949
|
+
const [isCopied, setIsCopied] = React14.useState(false);
|
|
2950
|
+
const [isPreviewOpen, setIsPreviewOpen] = React14.useState(false);
|
|
2951
|
+
const [isRendering, setIsRendering] = React14.useState(true);
|
|
2952
|
+
const [renderError, setRenderError] = React14.useState(null);
|
|
2953
|
+
const [svgMarkup, setSvgMarkup] = React14.useState(null);
|
|
2954
|
+
const normalizedCode = React14.useMemo(() => normalizeMermaidCode(code), [code]);
|
|
2955
|
+
const clearCopyResetTimeout = React14.useCallback(() => {
|
|
2956
|
+
if (copyResetTimeoutRef.current === null) return;
|
|
2957
|
+
window.clearTimeout(copyResetTimeoutRef.current);
|
|
2958
|
+
copyResetTimeoutRef.current = null;
|
|
2959
|
+
}, []);
|
|
2960
|
+
React14.useEffect(() => {
|
|
2961
|
+
let isActive = true;
|
|
2962
|
+
async function runRender() {
|
|
2963
|
+
const container = containerRef.current;
|
|
2964
|
+
const renderHost = renderHostRef.current;
|
|
2965
|
+
if (!container || !renderHost) return;
|
|
2966
|
+
setIsRendering(true);
|
|
2967
|
+
setRenderError(null);
|
|
2968
|
+
try {
|
|
2969
|
+
renderSequenceRef.current += 1;
|
|
2970
|
+
const svg = await renderMermaidDiagram({
|
|
2971
|
+
code: normalizedCode,
|
|
2972
|
+
host: renderHost,
|
|
2973
|
+
id: `mermaid-${diagramId}-${renderSequenceRef.current}`,
|
|
2974
|
+
palette: resolvePalette(container, isDarkMode)
|
|
2975
|
+
});
|
|
2976
|
+
if (!isActive) return;
|
|
2977
|
+
setSvgMarkup(svg);
|
|
2978
|
+
} catch (error) {
|
|
2979
|
+
if (!isActive) return;
|
|
2980
|
+
setSvgMarkup(null);
|
|
2981
|
+
setRenderError(error instanceof Error ? error.message : "render_failed");
|
|
2982
|
+
setActiveTab((currentTab) => currentTab === "diagram" ? "code" : currentTab);
|
|
2983
|
+
} finally {
|
|
2984
|
+
if (isActive) {
|
|
2985
|
+
setIsRendering(false);
|
|
2986
|
+
renderHost.innerHTML = "";
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2990
|
+
void runRender();
|
|
2991
|
+
return () => {
|
|
2992
|
+
isActive = false;
|
|
2993
|
+
if (renderHostRef.current) {
|
|
2994
|
+
renderHostRef.current.innerHTML = "";
|
|
2995
|
+
}
|
|
2996
|
+
};
|
|
2997
|
+
}, [diagramId, isDarkMode, normalizedCode, theme]);
|
|
2998
|
+
React14.useEffect(() => {
|
|
2999
|
+
clearCopyResetTimeout();
|
|
3000
|
+
setIsCopied(false);
|
|
3001
|
+
}, [activeTab, clearCopyResetTimeout, code]);
|
|
3002
|
+
React14.useEffect(
|
|
3003
|
+
() => () => {
|
|
3004
|
+
clearCopyResetTimeout();
|
|
3005
|
+
},
|
|
3006
|
+
[clearCopyResetTimeout]
|
|
3007
|
+
);
|
|
3008
|
+
const handleDownload = React14.useCallback(() => {
|
|
3009
|
+
if (!svgMarkup) return;
|
|
3010
|
+
const blob = new Blob([svgMarkup], {
|
|
3011
|
+
type: "image/svg+xml;charset=utf-8"
|
|
3012
|
+
});
|
|
3013
|
+
const url = window.URL.createObjectURL(blob);
|
|
3014
|
+
const anchor = document.createElement("a");
|
|
3015
|
+
anchor.href = url;
|
|
3016
|
+
anchor.download = `mermaid-diagram-${diagramId}.svg`;
|
|
3017
|
+
document.body.append(anchor);
|
|
3018
|
+
anchor.click();
|
|
3019
|
+
anchor.remove();
|
|
3020
|
+
window.URL.revokeObjectURL(url);
|
|
3021
|
+
}, [diagramId, svgMarkup]);
|
|
3022
|
+
const handleCopyCode = React14.useCallback(() => {
|
|
3023
|
+
if (!code || isCopied) return;
|
|
3024
|
+
navigator.clipboard.writeText(code).then(() => {
|
|
3025
|
+
setIsCopied(true);
|
|
3026
|
+
clearCopyResetTimeout();
|
|
3027
|
+
copyResetTimeoutRef.current = window.setTimeout(() => {
|
|
3028
|
+
setIsCopied(false);
|
|
3029
|
+
copyResetTimeoutRef.current = null;
|
|
3030
|
+
}, 3e3);
|
|
3031
|
+
}).catch(() => {
|
|
3032
|
+
});
|
|
3033
|
+
}, [clearCopyResetTimeout, code, isCopied]);
|
|
3034
|
+
const hasRenderedDiagram = svgMarkup !== null && !renderError;
|
|
3035
|
+
const statusMessage = isRendering ? t("markdown.mermaid.rendering") : t("markdown.mermaid.failed");
|
|
3036
|
+
return /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
3037
|
+
/* @__PURE__ */ jsx18(
|
|
3038
|
+
Tabs,
|
|
3039
|
+
{
|
|
3040
|
+
className: "w-full",
|
|
3041
|
+
onValueChange: (value) => setActiveTab(value),
|
|
3042
|
+
value: activeTab,
|
|
3043
|
+
children: /* @__PURE__ */ jsxs9(
|
|
3044
|
+
"div",
|
|
3045
|
+
{
|
|
3046
|
+
ref: containerRef,
|
|
3047
|
+
"data-slot": "mermaid-block",
|
|
3048
|
+
className: "relative overflow-hidden text-card-foreground",
|
|
3049
|
+
children: [
|
|
3050
|
+
/* @__PURE__ */ jsx18(
|
|
3051
|
+
"div",
|
|
3052
|
+
{
|
|
3053
|
+
ref: renderHostRef,
|
|
3054
|
+
"aria-hidden": "true",
|
|
3055
|
+
className: "pointer-events-none absolute inset-0 -z-10 overflow-hidden opacity-0",
|
|
3056
|
+
"data-slot": "mermaid-render-host"
|
|
3057
|
+
}
|
|
3058
|
+
),
|
|
3059
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center justify-between gap-3 px-4 py-3", children: [
|
|
3060
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
3061
|
+
/* @__PURE__ */ jsx18("span", { className: "inline-flex size-9 shrink-0 items-center justify-center rounded-full bg-muted text-foreground", children: /* @__PURE__ */ jsx18(Code2Icon, { className: "size-4" }) }),
|
|
3062
|
+
/* @__PURE__ */ jsx18("span", { className: "truncate text-base font-semibold text-foreground", children: t("markdown.mermaid.title") })
|
|
3063
|
+
] }),
|
|
3064
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex shrink-0 items-center gap-2", children: [
|
|
3065
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
|
|
3066
|
+
activeTab === "diagram" && hasRenderedDiagram ? /* @__PURE__ */ jsx18(
|
|
3067
|
+
TooltipIconButton,
|
|
3068
|
+
{
|
|
3069
|
+
onClick: handleDownload,
|
|
3070
|
+
tooltip: t("markdown.mermaid.download"),
|
|
3071
|
+
children: /* @__PURE__ */ jsx18(DownloadIcon, { className: "size-4" })
|
|
3072
|
+
}
|
|
3073
|
+
) : null,
|
|
3074
|
+
activeTab === "diagram" && hasRenderedDiagram ? /* @__PURE__ */ jsx18(
|
|
3075
|
+
TooltipIconButton,
|
|
3076
|
+
{
|
|
3077
|
+
onClick: () => setIsPreviewOpen(true),
|
|
3078
|
+
tooltip: t("markdown.mermaid.fullScreen"),
|
|
3079
|
+
children: /* @__PURE__ */ jsx18(ExpandIcon, { className: "size-4" })
|
|
3080
|
+
}
|
|
3081
|
+
) : null,
|
|
3082
|
+
activeTab === "code" ? /* @__PURE__ */ jsx18(
|
|
3083
|
+
TooltipIconButton,
|
|
3084
|
+
{
|
|
3085
|
+
onClick: handleCopyCode,
|
|
3086
|
+
tooltip: t("markdown.copy"),
|
|
3087
|
+
children: isCopied ? /* @__PURE__ */ jsx18(CheckIcon, { className: "size-4" }) : /* @__PURE__ */ jsx18(CopyIcon, { className: "size-4" })
|
|
3088
|
+
}
|
|
3089
|
+
) : null
|
|
3090
|
+
] }),
|
|
3091
|
+
/* @__PURE__ */ jsxs9(TabsList, { children: [
|
|
3092
|
+
/* @__PURE__ */ jsx18(TabsTrigger, { value: "diagram", children: t("markdown.mermaid.diagram") }),
|
|
3093
|
+
/* @__PURE__ */ jsx18(TabsTrigger, { value: "code", children: t("markdown.mermaid.code") })
|
|
3094
|
+
] })
|
|
3095
|
+
] })
|
|
3096
|
+
] }),
|
|
3097
|
+
/* @__PURE__ */ jsxs9("div", { className: "border-t border-border pt-4", children: [
|
|
3098
|
+
renderError ? /* @__PURE__ */ jsx18("p", { role: "alert", className: "mb-4 text-sm font-medium text-destructive", children: t("markdown.mermaid.failed") }) : null,
|
|
3099
|
+
/* @__PURE__ */ jsx18(TabsContent, { value: "diagram", className: "mt-0 space-y-4", children: /* @__PURE__ */ jsx18(
|
|
3100
|
+
"div",
|
|
3101
|
+
{
|
|
3102
|
+
className: cn(
|
|
3103
|
+
"relative overflow-auto rounded-[calc(var(--radius)+0.5rem)] border border-border bg-background p-4",
|
|
3104
|
+
hasRenderedDiagram ? "[&_svg]:mx-auto [&_svg]:h-auto [&_svg]:w-full [&_svg]:max-w-none" : "min-h-[14rem]"
|
|
3105
|
+
),
|
|
3106
|
+
children: hasRenderedDiagram ? /* @__PURE__ */ jsx18(
|
|
3107
|
+
"div",
|
|
3108
|
+
{
|
|
3109
|
+
"data-slot": "mermaid-diagram",
|
|
3110
|
+
dangerouslySetInnerHTML: { __html: svgMarkup }
|
|
3111
|
+
}
|
|
3112
|
+
) : /* @__PURE__ */ jsxs9("div", { className: "flex min-h-[12rem] flex-col items-center justify-center gap-3 text-center text-muted-foreground", children: [
|
|
3113
|
+
isRendering ? /* @__PURE__ */ jsx18(Loader2, { className: "size-5 animate-spin" }) : /* @__PURE__ */ jsx18(TriangleAlert, { className: "size-5 text-destructive" }),
|
|
3114
|
+
/* @__PURE__ */ jsx18(
|
|
3115
|
+
"p",
|
|
3116
|
+
{
|
|
3117
|
+
className: cn("text-sm font-medium", !isRendering && "text-destructive"),
|
|
3118
|
+
role: renderError ? "alert" : void 0,
|
|
3119
|
+
children: statusMessage
|
|
3120
|
+
}
|
|
3121
|
+
)
|
|
3122
|
+
] })
|
|
3123
|
+
}
|
|
3124
|
+
) }),
|
|
3125
|
+
/* @__PURE__ */ jsx18(TabsContent, { value: "code", className: "mt-0", children: /* @__PURE__ */ jsx18(
|
|
3126
|
+
"pre",
|
|
3127
|
+
{
|
|
3128
|
+
"data-slot": "mermaid-code",
|
|
3129
|
+
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",
|
|
3130
|
+
children: /* @__PURE__ */ jsx18("code", { className: "block whitespace-pre font-mono", children: code })
|
|
3131
|
+
}
|
|
3132
|
+
) })
|
|
3133
|
+
] })
|
|
3134
|
+
]
|
|
3135
|
+
}
|
|
3136
|
+
)
|
|
3137
|
+
}
|
|
3138
|
+
),
|
|
3139
|
+
svgMarkup ? /* @__PURE__ */ jsx18(
|
|
3140
|
+
MermaidPreviewDialog,
|
|
3141
|
+
{
|
|
3142
|
+
closeLabel: t("sheet.close"),
|
|
3143
|
+
onOpenChange: setIsPreviewOpen,
|
|
3144
|
+
open: isPreviewOpen,
|
|
3145
|
+
svgMarkup,
|
|
3146
|
+
title: t("markdown.mermaid.title")
|
|
3147
|
+
}
|
|
3148
|
+
) : null
|
|
3149
|
+
] });
|
|
3150
|
+
}
|
|
3151
|
+
|
|
2473
3152
|
// src/components/thread/markdown-text.tsx
|
|
2474
3153
|
import "katex/dist/katex.min.css";
|
|
2475
|
-
import { Fragment as
|
|
3154
|
+
import { Fragment as Fragment3, jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2476
3155
|
var getTextContent = (children) => Children.toArray(children).map((child) => {
|
|
2477
3156
|
if (typeof child === "string" || typeof child === "number") {
|
|
2478
3157
|
return String(child);
|
|
2479
3158
|
}
|
|
2480
3159
|
return "";
|
|
2481
3160
|
}).join("");
|
|
3161
|
+
var isMermaidBlockChild = (child) => isValidElement(child) && child.type === MermaidBlock;
|
|
3162
|
+
var isMermaidCodeElement = (child) => isValidElement(child) && typeof child.props.className === "string" && child.props.className.includes("language-mermaid");
|
|
2482
3163
|
var useCopyToClipboard = ({
|
|
2483
3164
|
copiedDuration = 3e3
|
|
2484
3165
|
} = {}) => {
|
|
2485
|
-
const [isCopied, setIsCopied] =
|
|
3166
|
+
const [isCopied, setIsCopied] = useState7(false);
|
|
2486
3167
|
const copyToClipboard = (value) => {
|
|
2487
3168
|
if (!value) return;
|
|
2488
3169
|
navigator.clipboard.writeText(value).then(() => {
|
|
@@ -2499,23 +3180,23 @@ var CodeHeader = ({ language, code }) => {
|
|
|
2499
3180
|
if (!code || isCopied) return;
|
|
2500
3181
|
copyToClipboard(code);
|
|
2501
3182
|
};
|
|
2502
|
-
return /* @__PURE__ */
|
|
2503
|
-
/* @__PURE__ */
|
|
2504
|
-
/* @__PURE__ */
|
|
3183
|
+
return /* @__PURE__ */ jsxs10("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: [
|
|
3184
|
+
/* @__PURE__ */ jsx19("span", { className: "lowercase [&>span]:text-xs", children: language }),
|
|
3185
|
+
/* @__PURE__ */ jsxs10(
|
|
2505
3186
|
TooltipIconButton,
|
|
2506
3187
|
{
|
|
2507
3188
|
tooltip: t("markdown.copy"),
|
|
2508
3189
|
onClick: onCopy,
|
|
2509
3190
|
children: [
|
|
2510
|
-
!isCopied && /* @__PURE__ */
|
|
2511
|
-
isCopied && /* @__PURE__ */
|
|
3191
|
+
!isCopied && /* @__PURE__ */ jsx19(CopyIcon2, {}),
|
|
3192
|
+
isCopied && /* @__PURE__ */ jsx19(CheckIcon2, {})
|
|
2512
3193
|
]
|
|
2513
3194
|
}
|
|
2514
3195
|
)
|
|
2515
3196
|
] });
|
|
2516
3197
|
};
|
|
2517
3198
|
var defaultComponents = {
|
|
2518
|
-
h1: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3199
|
+
h1: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx19(
|
|
2519
3200
|
"h1",
|
|
2520
3201
|
{
|
|
2521
3202
|
className: cn(
|
|
@@ -2525,7 +3206,7 @@ var defaultComponents = {
|
|
|
2525
3206
|
...props
|
|
2526
3207
|
}
|
|
2527
3208
|
),
|
|
2528
|
-
h2: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3209
|
+
h2: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx19(
|
|
2529
3210
|
"h2",
|
|
2530
3211
|
{
|
|
2531
3212
|
className: cn(
|
|
@@ -2535,7 +3216,7 @@ var defaultComponents = {
|
|
|
2535
3216
|
...props
|
|
2536
3217
|
}
|
|
2537
3218
|
),
|
|
2538
|
-
h3: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3219
|
+
h3: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx19(
|
|
2539
3220
|
"h3",
|
|
2540
3221
|
{
|
|
2541
3222
|
className: cn(
|
|
@@ -2545,7 +3226,7 @@ var defaultComponents = {
|
|
|
2545
3226
|
...props
|
|
2546
3227
|
}
|
|
2547
3228
|
),
|
|
2548
|
-
h4: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3229
|
+
h4: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx19(
|
|
2549
3230
|
"h4",
|
|
2550
3231
|
{
|
|
2551
3232
|
className: cn(
|
|
@@ -2555,7 +3236,7 @@ var defaultComponents = {
|
|
|
2555
3236
|
...props
|
|
2556
3237
|
}
|
|
2557
3238
|
),
|
|
2558
|
-
h5: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3239
|
+
h5: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx19(
|
|
2559
3240
|
"h5",
|
|
2560
3241
|
{
|
|
2561
3242
|
className: cn(
|
|
@@ -2565,21 +3246,21 @@ var defaultComponents = {
|
|
|
2565
3246
|
...props
|
|
2566
3247
|
}
|
|
2567
3248
|
),
|
|
2568
|
-
h6: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3249
|
+
h6: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx19(
|
|
2569
3250
|
"h6",
|
|
2570
3251
|
{
|
|
2571
3252
|
className: cn("my-4 font-semibold first:mt-0 last:mb-0", className),
|
|
2572
3253
|
...props
|
|
2573
3254
|
}
|
|
2574
3255
|
),
|
|
2575
|
-
p: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3256
|
+
p: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx19(
|
|
2576
3257
|
"p",
|
|
2577
3258
|
{
|
|
2578
3259
|
className: cn("mt-5 mb-5 leading-7 first:mt-0 last:mb-0", className),
|
|
2579
3260
|
...props
|
|
2580
3261
|
}
|
|
2581
3262
|
),
|
|
2582
|
-
a: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3263
|
+
a: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx19(
|
|
2583
3264
|
"a",
|
|
2584
3265
|
{
|
|
2585
3266
|
className: cn(
|
|
@@ -2595,7 +3276,7 @@ var defaultComponents = {
|
|
|
2595
3276
|
className,
|
|
2596
3277
|
node: _node,
|
|
2597
3278
|
...props
|
|
2598
|
-
}) => /* @__PURE__ */
|
|
3279
|
+
}) => /* @__PURE__ */ jsx19(
|
|
2599
3280
|
"blockquote",
|
|
2600
3281
|
{
|
|
2601
3282
|
className: cn(
|
|
@@ -2605,21 +3286,21 @@ var defaultComponents = {
|
|
|
2605
3286
|
...props
|
|
2606
3287
|
}
|
|
2607
3288
|
),
|
|
2608
|
-
ul: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3289
|
+
ul: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx19(
|
|
2609
3290
|
"ul",
|
|
2610
3291
|
{
|
|
2611
3292
|
className: cn("my-5 list-outside list-disc pl-6 [&>li]:mt-2", className),
|
|
2612
3293
|
...props
|
|
2613
3294
|
}
|
|
2614
3295
|
),
|
|
2615
|
-
ol: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3296
|
+
ol: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx19(
|
|
2616
3297
|
"ol",
|
|
2617
3298
|
{
|
|
2618
3299
|
className: cn("my-5 list-outside list-decimal pl-8 [&>li]:mt-2", className),
|
|
2619
3300
|
...props
|
|
2620
3301
|
}
|
|
2621
3302
|
),
|
|
2622
|
-
hr: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3303
|
+
hr: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx19(
|
|
2623
3304
|
"hr",
|
|
2624
3305
|
{
|
|
2625
3306
|
className: cn("my-5 border-b", className),
|
|
@@ -2630,7 +3311,7 @@ var defaultComponents = {
|
|
|
2630
3311
|
className,
|
|
2631
3312
|
node: _node,
|
|
2632
3313
|
...props
|
|
2633
|
-
}) => /* @__PURE__ */
|
|
3314
|
+
}) => /* @__PURE__ */ jsx19(
|
|
2634
3315
|
"table",
|
|
2635
3316
|
{
|
|
2636
3317
|
className: cn(
|
|
@@ -2640,7 +3321,7 @@ var defaultComponents = {
|
|
|
2640
3321
|
...props
|
|
2641
3322
|
}
|
|
2642
3323
|
),
|
|
2643
|
-
th: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3324
|
+
th: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx19(
|
|
2644
3325
|
"th",
|
|
2645
3326
|
{
|
|
2646
3327
|
className: cn(
|
|
@@ -2650,7 +3331,7 @@ var defaultComponents = {
|
|
|
2650
3331
|
...props
|
|
2651
3332
|
}
|
|
2652
3333
|
),
|
|
2653
|
-
td: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3334
|
+
td: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx19(
|
|
2654
3335
|
"td",
|
|
2655
3336
|
{
|
|
2656
3337
|
className: cn(
|
|
@@ -2660,7 +3341,7 @@ var defaultComponents = {
|
|
|
2660
3341
|
...props
|
|
2661
3342
|
}
|
|
2662
3343
|
),
|
|
2663
|
-
tr: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3344
|
+
tr: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx19(
|
|
2664
3345
|
"tr",
|
|
2665
3346
|
{
|
|
2666
3347
|
className: cn(
|
|
@@ -2670,21 +3351,21 @@ var defaultComponents = {
|
|
|
2670
3351
|
...props
|
|
2671
3352
|
}
|
|
2672
3353
|
),
|
|
2673
|
-
sup: ({ className, node: _node, ...props }) => /* @__PURE__ */
|
|
3354
|
+
sup: ({ className, node: _node, ...props }) => /* @__PURE__ */ jsx19(
|
|
2674
3355
|
"sup",
|
|
2675
3356
|
{
|
|
2676
3357
|
className: cn("[&>a]:text-xs [&>a]:no-underline", className),
|
|
2677
3358
|
...props
|
|
2678
3359
|
}
|
|
2679
3360
|
),
|
|
2680
|
-
pre: ({ className, node: _node,
|
|
3361
|
+
pre: ({ className, children, node: _node }) => Children.toArray(children).length === 1 && (isMermaidBlockChild(Children.toArray(children)[0]) || isMermaidCodeElement(Children.toArray(children)[0])) ? /* @__PURE__ */ jsx19(Fragment3, { children }) : /* @__PURE__ */ jsx19(
|
|
2681
3362
|
"div",
|
|
2682
3363
|
{
|
|
2683
3364
|
className: cn(
|
|
2684
3365
|
"max-w-4xl overflow-x-auto rounded-lg text-sm bg-black text-white dark:bg-zinc-800",
|
|
2685
3366
|
className
|
|
2686
3367
|
),
|
|
2687
|
-
|
|
3368
|
+
children
|
|
2688
3369
|
}
|
|
2689
3370
|
),
|
|
2690
3371
|
code: ({
|
|
@@ -2693,21 +3374,24 @@ var defaultComponents = {
|
|
|
2693
3374
|
node: _node,
|
|
2694
3375
|
...props
|
|
2695
3376
|
}) => {
|
|
2696
|
-
const match = /language-(\w+)/.exec(className || "");
|
|
3377
|
+
const match = /language-([\w-]+)/.exec(className || "");
|
|
2697
3378
|
const code = getTextContent(children);
|
|
2698
3379
|
const isBlockCode = code.includes("\n");
|
|
2699
3380
|
if (match) {
|
|
2700
3381
|
const language = match[1];
|
|
2701
3382
|
const normalizedCode = code.replace(/\n$/, "");
|
|
2702
|
-
|
|
2703
|
-
/* @__PURE__ */
|
|
3383
|
+
if (language === "mermaid") {
|
|
3384
|
+
return /* @__PURE__ */ jsx19(MermaidBlock, { code: normalizedCode });
|
|
3385
|
+
}
|
|
3386
|
+
return /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
3387
|
+
/* @__PURE__ */ jsx19(
|
|
2704
3388
|
CodeHeader,
|
|
2705
3389
|
{
|
|
2706
3390
|
language,
|
|
2707
3391
|
code: normalizedCode
|
|
2708
3392
|
}
|
|
2709
3393
|
),
|
|
2710
|
-
/* @__PURE__ */
|
|
3394
|
+
/* @__PURE__ */ jsx19(
|
|
2711
3395
|
SyntaxHighlighter,
|
|
2712
3396
|
{
|
|
2713
3397
|
language,
|
|
@@ -2718,7 +3402,7 @@ var defaultComponents = {
|
|
|
2718
3402
|
] });
|
|
2719
3403
|
}
|
|
2720
3404
|
if (isBlockCode) {
|
|
2721
|
-
return /* @__PURE__ */
|
|
3405
|
+
return /* @__PURE__ */ jsx19(
|
|
2722
3406
|
"code",
|
|
2723
3407
|
{
|
|
2724
3408
|
className: cn(
|
|
@@ -2730,7 +3414,7 @@ var defaultComponents = {
|
|
|
2730
3414
|
}
|
|
2731
3415
|
);
|
|
2732
3416
|
}
|
|
2733
|
-
return /* @__PURE__ */
|
|
3417
|
+
return /* @__PURE__ */ jsx19(
|
|
2734
3418
|
"code",
|
|
2735
3419
|
{
|
|
2736
3420
|
className: cn(
|
|
@@ -2744,7 +3428,7 @@ var defaultComponents = {
|
|
|
2744
3428
|
}
|
|
2745
3429
|
};
|
|
2746
3430
|
var MarkdownTextImpl = ({ children }) => {
|
|
2747
|
-
return /* @__PURE__ */
|
|
3431
|
+
return /* @__PURE__ */ jsx19("div", { className: "markdown-content", children: /* @__PURE__ */ jsx19(
|
|
2748
3432
|
ReactMarkdown,
|
|
2749
3433
|
{
|
|
2750
3434
|
remarkPlugins: [remarkGfm, remarkMath],
|
|
@@ -2758,18 +3442,18 @@ var MarkdownText = memo(MarkdownTextImpl);
|
|
|
2758
3442
|
|
|
2759
3443
|
// src/components/thread/messages/widget.tsx
|
|
2760
3444
|
import { SurfaceRenderer } from "@xpert-ai/a2ui-react";
|
|
2761
|
-
import { jsx as
|
|
3445
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
2762
3446
|
function WidgetMessage({ messageId, data }) {
|
|
2763
3447
|
const widgets = Array.isArray(data.widgets) ? data.widgets : [];
|
|
2764
3448
|
if (widgets.length === 0) return null;
|
|
2765
3449
|
const baseSurfaceId = `widget-${messageId}`;
|
|
2766
|
-
return /* @__PURE__ */
|
|
3450
|
+
return /* @__PURE__ */ jsx20("div", { className: "space-y-3", children: widgets.map((widget, index) => {
|
|
2767
3451
|
const config = widget?.config;
|
|
2768
3452
|
if (!config || typeof config !== "object") {
|
|
2769
3453
|
return null;
|
|
2770
3454
|
}
|
|
2771
3455
|
const surfaceId = widgets.length > 1 ? `${baseSurfaceId}-${index}` : baseSurfaceId;
|
|
2772
|
-
return /* @__PURE__ */
|
|
3456
|
+
return /* @__PURE__ */ jsx20(
|
|
2773
3457
|
SurfaceRenderer,
|
|
2774
3458
|
{
|
|
2775
3459
|
surfaceId,
|
|
@@ -2781,7 +3465,7 @@ function WidgetMessage({ messageId, data }) {
|
|
|
2781
3465
|
}
|
|
2782
3466
|
|
|
2783
3467
|
// src/components/thread/messages/ai.tsx
|
|
2784
|
-
import { jsx as
|
|
3468
|
+
import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2785
3469
|
function isTextContent(content) {
|
|
2786
3470
|
return content.type === "text";
|
|
2787
3471
|
}
|
|
@@ -2805,7 +3489,7 @@ var statusConfig = {
|
|
|
2805
3489
|
},
|
|
2806
3490
|
running: {
|
|
2807
3491
|
iconClass: "border-blue-500 text-blue-700",
|
|
2808
|
-
icon:
|
|
3492
|
+
icon: Loader22
|
|
2809
3493
|
}
|
|
2810
3494
|
};
|
|
2811
3495
|
function isWidgetComponent(content) {
|
|
@@ -2822,14 +3506,17 @@ function safeJson(value) {
|
|
|
2822
3506
|
return String(value);
|
|
2823
3507
|
}
|
|
2824
3508
|
}
|
|
3509
|
+
function formatDisplayValue(value) {
|
|
3510
|
+
return typeof value === "string" ? value : safeJson(value);
|
|
3511
|
+
}
|
|
2825
3512
|
function ReasoningBlock({ reasoning }) {
|
|
2826
3513
|
const blocks = reasoning.filter((item) => item.text?.trim());
|
|
2827
3514
|
if (blocks.length === 0) return null;
|
|
2828
|
-
return /* @__PURE__ */
|
|
3515
|
+
return /* @__PURE__ */ jsx21("div", { className: "space-y-2", children: blocks.map((item, index) => /* @__PURE__ */ jsx21(
|
|
2829
3516
|
"div",
|
|
2830
3517
|
{
|
|
2831
3518
|
className: "rounded-lg border bg-muted/40 p-3 text-xs text-muted-foreground",
|
|
2832
|
-
children: /* @__PURE__ */
|
|
3519
|
+
children: /* @__PURE__ */ jsx21("p", { className: "whitespace-pre-wrap wrap-break-word leading-relaxed", children: item.text })
|
|
2833
3520
|
},
|
|
2834
3521
|
item.id ?? `reasoning-${index}`
|
|
2835
3522
|
)) });
|
|
@@ -2837,27 +3524,27 @@ function ReasoningBlock({ reasoning }) {
|
|
|
2837
3524
|
function ImageBlock({ content }) {
|
|
2838
3525
|
const imageUrl = typeof content.image_url === "string" ? content.image_url : typeof content.image_url?.url === "string" ? content.image_url.url : null;
|
|
2839
3526
|
if (!imageUrl) {
|
|
2840
|
-
return /* @__PURE__ */
|
|
2841
|
-
/* @__PURE__ */
|
|
2842
|
-
/* @__PURE__ */
|
|
3527
|
+
return /* @__PURE__ */ jsxs11(Card, { children: [
|
|
3528
|
+
/* @__PURE__ */ jsx21(CardHeader, { className: "space-y-1", children: /* @__PURE__ */ jsx21(CardTitle, { className: "text-sm", children: "Image" }) }),
|
|
3529
|
+
/* @__PURE__ */ jsx21(CardContent, { className: "text-xs text-muted-foreground", children: safeJson(content) })
|
|
2843
3530
|
] });
|
|
2844
3531
|
}
|
|
2845
|
-
return /* @__PURE__ */
|
|
3532
|
+
return /* @__PURE__ */ jsx21("figure", { className: "overflow-hidden rounded-lg border bg-background", children: /* @__PURE__ */ jsx21("img", { src: imageUrl, alt: "Assistant output", className: "h-auto w-full object-cover" }) });
|
|
2846
3533
|
}
|
|
2847
3534
|
function MemoryBlock({ content }) {
|
|
2848
|
-
return /* @__PURE__ */
|
|
2849
|
-
/* @__PURE__ */
|
|
2850
|
-
/* @__PURE__ */
|
|
2851
|
-
/* @__PURE__ */
|
|
3535
|
+
return /* @__PURE__ */ jsxs11(Card, { children: [
|
|
3536
|
+
/* @__PURE__ */ jsxs11(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
3537
|
+
/* @__PURE__ */ jsx21(CardTitle, { className: "text-sm", children: "Memory" }),
|
|
3538
|
+
/* @__PURE__ */ jsx21(Badge, { variant: "secondary", children: "Memory" })
|
|
2852
3539
|
] }),
|
|
2853
|
-
/* @__PURE__ */
|
|
3540
|
+
/* @__PURE__ */ jsx21(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ jsx21("pre", { className: "whitespace-pre-wrap wrap-break-word", children: safeJson(content.data ?? []) }) })
|
|
2854
3541
|
] });
|
|
2855
3542
|
}
|
|
2856
3543
|
function ComponentBlock({ content }) {
|
|
2857
|
-
const [isExpanded, setIsExpanded] =
|
|
2858
|
-
const contentRef =
|
|
2859
|
-
const shouldAutoScrollRef =
|
|
2860
|
-
const previousScrollTopRef =
|
|
3544
|
+
const [isExpanded, setIsExpanded] = React15.useState(false);
|
|
3545
|
+
const contentRef = React15.useRef(null);
|
|
3546
|
+
const shouldAutoScrollRef = React15.useRef(true);
|
|
3547
|
+
const previousScrollTopRef = React15.useRef(0);
|
|
2861
3548
|
const data = content.data ?? {};
|
|
2862
3549
|
const category = data.category ?? "Component";
|
|
2863
3550
|
const title = data.tool && category === "Tool" ? data.tool : data.title ?? data.type ?? "Component";
|
|
@@ -2865,12 +3552,12 @@ function ComponentBlock({ content }) {
|
|
|
2865
3552
|
const message = data.message ?? null;
|
|
2866
3553
|
const output = data.output ?? null;
|
|
2867
3554
|
const error = data.error ?? null;
|
|
2868
|
-
const fallback = message ?? output ??
|
|
3555
|
+
const fallback = message ?? output ?? data.data ?? data;
|
|
2869
3556
|
const hasOutput = message !== null || output !== null;
|
|
2870
|
-
|
|
3557
|
+
React15.useEffect(() => {
|
|
2871
3558
|
if (status === "running" && output !== null) setIsExpanded(true);
|
|
2872
3559
|
}, [status, output]);
|
|
2873
|
-
|
|
3560
|
+
React15.useEffect(() => {
|
|
2874
3561
|
const element = contentRef.current;
|
|
2875
3562
|
if (!element) return;
|
|
2876
3563
|
previousScrollTopRef.current = element.scrollTop;
|
|
@@ -2890,7 +3577,7 @@ function ComponentBlock({ content }) {
|
|
|
2890
3577
|
element.removeEventListener("scroll", updateAutoScrollState);
|
|
2891
3578
|
};
|
|
2892
3579
|
}, [isExpanded]);
|
|
2893
|
-
|
|
3580
|
+
React15.useEffect(() => {
|
|
2894
3581
|
if (status !== "running") {
|
|
2895
3582
|
shouldAutoScrollRef.current = true;
|
|
2896
3583
|
return;
|
|
@@ -2903,20 +3590,20 @@ function ComponentBlock({ content }) {
|
|
|
2903
3590
|
}, [isExpanded, output, status]);
|
|
2904
3591
|
const config = status ? statusConfig[status] : null;
|
|
2905
3592
|
const StatusIcon = config?.icon;
|
|
2906
|
-
return /* @__PURE__ */
|
|
2907
|
-
/* @__PURE__ */
|
|
2908
|
-
/* @__PURE__ */
|
|
2909
|
-
status && StatusIcon && /* @__PURE__ */
|
|
2910
|
-
/* @__PURE__ */
|
|
3593
|
+
return /* @__PURE__ */ jsxs11(Card, { children: [
|
|
3594
|
+
/* @__PURE__ */ jsxs11(CardHeader, { className: "flex flex-row items-center justify-between gap-2 px-2 py-1 cursor-pointer", onClick: () => setIsExpanded(!isExpanded), children: [
|
|
3595
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center space-x-1 flex-1 min-w-0", children: [
|
|
3596
|
+
status && StatusIcon && /* @__PURE__ */ jsx21(StatusIcon, { className: cn("h-4 w-4", config?.iconClass, status === "running" && "animate-spin") }),
|
|
3597
|
+
/* @__PURE__ */ jsx21(CardTitle, { className: "text-sm truncate", children: title })
|
|
2911
3598
|
] }),
|
|
2912
|
-
/* @__PURE__ */
|
|
2913
|
-
/* @__PURE__ */
|
|
2914
|
-
/* @__PURE__ */
|
|
3599
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center gap-2 shrink-0", children: [
|
|
3600
|
+
/* @__PURE__ */ jsx21(Badge, { variant: "secondary", className: "rounded-lg px-1.5", children: category }),
|
|
3601
|
+
/* @__PURE__ */ jsx21(
|
|
2915
3602
|
"button",
|
|
2916
3603
|
{
|
|
2917
3604
|
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
2918
3605
|
"aria-label": isExpanded ? "Collapse" : "Expand",
|
|
2919
|
-
children: /* @__PURE__ */
|
|
3606
|
+
children: /* @__PURE__ */ jsx21(
|
|
2920
3607
|
ChevronDown,
|
|
2921
3608
|
{
|
|
2922
3609
|
className: cn("h-4 w-4 transition-transform", isExpanded && "rotate-180")
|
|
@@ -2926,55 +3613,55 @@ function ComponentBlock({ content }) {
|
|
|
2926
3613
|
)
|
|
2927
3614
|
] })
|
|
2928
3615
|
] }),
|
|
2929
|
-
isExpanded && /* @__PURE__ */
|
|
2930
|
-
data.input && /* @__PURE__ */
|
|
2931
|
-
error ? /* @__PURE__ */
|
|
3616
|
+
isExpanded && /* @__PURE__ */ jsxs11(CardContent, { ref: contentRef, className: "text-xs text-muted-foreground max-h-60 overflow-auto", children: [
|
|
3617
|
+
data.input && /* @__PURE__ */ jsx21("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue(data.input) }),
|
|
3618
|
+
error ? /* @__PURE__ */ jsx21("pre", { className: "whitespace-pre-wrap wrap-break-word text-destructive", children: formatDisplayValue(error) }) : hasOutput && /* @__PURE__ */ jsx21("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue(fallback) })
|
|
2932
3619
|
] })
|
|
2933
3620
|
] });
|
|
2934
3621
|
}
|
|
2935
3622
|
function UnknownBlock({ content }) {
|
|
2936
|
-
return /* @__PURE__ */
|
|
2937
|
-
/* @__PURE__ */
|
|
2938
|
-
/* @__PURE__ */
|
|
2939
|
-
/* @__PURE__ */
|
|
3623
|
+
return /* @__PURE__ */ jsxs11(Card, { children: [
|
|
3624
|
+
/* @__PURE__ */ jsxs11(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
3625
|
+
/* @__PURE__ */ jsx21(CardTitle, { className: "text-sm", children: "Assistant Content" }),
|
|
3626
|
+
/* @__PURE__ */ jsx21(Badge, { variant: "outline", children: content.type ?? "unknown" })
|
|
2940
3627
|
] }),
|
|
2941
|
-
/* @__PURE__ */
|
|
3628
|
+
/* @__PURE__ */ jsx21(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ jsx21("pre", { className: "whitespace-pre-wrap break-words", children: safeJson(content) }) })
|
|
2942
3629
|
] });
|
|
2943
3630
|
}
|
|
2944
3631
|
function renderContentItem(content, index, messageId) {
|
|
2945
3632
|
if (typeof content === "string") {
|
|
2946
|
-
return /* @__PURE__ */
|
|
2947
|
-
/* @__PURE__ */
|
|
3633
|
+
return /* @__PURE__ */ jsxs11("div", { children: [
|
|
3634
|
+
/* @__PURE__ */ jsx21(MarkdownText, { children: content }),
|
|
2948
3635
|
";"
|
|
2949
3636
|
] }, `text-${index}`);
|
|
2950
3637
|
}
|
|
2951
3638
|
if (isTextContent(content)) {
|
|
2952
|
-
return /* @__PURE__ */
|
|
3639
|
+
return /* @__PURE__ */ jsx21("div", { children: /* @__PURE__ */ jsx21(MarkdownText, { children: content.text }) }, content.id ?? `text-${index}`);
|
|
2953
3640
|
}
|
|
2954
3641
|
if (isReasoningContent(content)) {
|
|
2955
|
-
return /* @__PURE__ */
|
|
3642
|
+
return /* @__PURE__ */ jsx21("div", { children: /* @__PURE__ */ jsx21(ReasoningBlock, { reasoning: [content] }) }, content.id ?? `reasoning-${index}`);
|
|
2956
3643
|
}
|
|
2957
3644
|
if (isImageContent(content)) {
|
|
2958
|
-
return /* @__PURE__ */
|
|
3645
|
+
return /* @__PURE__ */ jsx21("div", { children: /* @__PURE__ */ jsx21(ImageBlock, { content }) }, content.id ?? `image-${index}`);
|
|
2959
3646
|
}
|
|
2960
3647
|
if (isComponentContent(content)) {
|
|
2961
3648
|
if (isWidgetComponent(content)) {
|
|
2962
|
-
return /* @__PURE__ */
|
|
3649
|
+
return /* @__PURE__ */ jsx21("div", { children: /* @__PURE__ */ jsx21(WidgetMessage, { messageId, data: content.data }) }, content.id ?? `widget-${index}`);
|
|
2963
3650
|
}
|
|
2964
|
-
return /* @__PURE__ */
|
|
3651
|
+
return /* @__PURE__ */ jsx21("div", { children: /* @__PURE__ */ jsx21(ComponentBlock, { content }) }, content.id ?? `component-${index}`);
|
|
2965
3652
|
}
|
|
2966
3653
|
if (isMemoryContent(content)) {
|
|
2967
|
-
return /* @__PURE__ */
|
|
3654
|
+
return /* @__PURE__ */ jsx21("div", { children: /* @__PURE__ */ jsx21(MemoryBlock, { content }) }, content.id ?? `memory-${index}`);
|
|
2968
3655
|
}
|
|
2969
|
-
return /* @__PURE__ */
|
|
3656
|
+
return /* @__PURE__ */ jsx21("div", { children: /* @__PURE__ */ jsx21(UnknownBlock, { content }) }, content.id ?? `unknown-${index}`);
|
|
2970
3657
|
}
|
|
2971
3658
|
function renderContent(content, messageId) {
|
|
2972
3659
|
if (typeof content === "string") {
|
|
2973
3660
|
if (!content.trim()) return null;
|
|
2974
|
-
return /* @__PURE__ */
|
|
3661
|
+
return /* @__PURE__ */ jsx21(MarkdownText, { children: content });
|
|
2975
3662
|
}
|
|
2976
3663
|
if (!Array.isArray(content) || content.length === 0) return null;
|
|
2977
|
-
return /* @__PURE__ */
|
|
3664
|
+
return /* @__PURE__ */ jsx21("div", { className: "space-y-3", children: content.map((item, index) => renderContentItem(item, index, messageId)) });
|
|
2978
3665
|
}
|
|
2979
3666
|
function AssistantStreamingIndicator({
|
|
2980
3667
|
status,
|
|
@@ -2986,19 +3673,19 @@ function AssistantStreamingIndicator({
|
|
|
2986
3673
|
thinking: t("message.thinking"),
|
|
2987
3674
|
answering: t("message.answering")
|
|
2988
3675
|
};
|
|
2989
|
-
return /* @__PURE__ */
|
|
2990
|
-
status === "loading" && /* @__PURE__ */
|
|
2991
|
-
status === "thinking" && /* @__PURE__ */
|
|
2992
|
-
/* @__PURE__ */
|
|
2993
|
-
/* @__PURE__ */
|
|
2994
|
-
/* @__PURE__ */
|
|
3676
|
+
return /* @__PURE__ */ jsxs11("div", { className: cn("flex items-center gap-2 text-xs text-muted-foreground", className), children: [
|
|
3677
|
+
status === "loading" && /* @__PURE__ */ jsx21(Loader22, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
3678
|
+
status === "thinking" && /* @__PURE__ */ jsxs11("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
3679
|
+
/* @__PURE__ */ jsx21("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.3s]" }),
|
|
3680
|
+
/* @__PURE__ */ jsx21("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.15s]" }),
|
|
3681
|
+
/* @__PURE__ */ jsx21("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce" })
|
|
2995
3682
|
] }),
|
|
2996
|
-
status === "answering" && /* @__PURE__ */
|
|
2997
|
-
/* @__PURE__ */
|
|
2998
|
-
/* @__PURE__ */
|
|
2999
|
-
/* @__PURE__ */
|
|
3683
|
+
status === "answering" && /* @__PURE__ */ jsxs11("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
3684
|
+
/* @__PURE__ */ jsx21("span", { className: "h-2 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.25s]" }),
|
|
3685
|
+
/* @__PURE__ */ jsx21("span", { className: "h-3 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.1s]" }),
|
|
3686
|
+
/* @__PURE__ */ jsx21("span", { className: "h-2.5 w-0.5 rounded-full bg-current animate-pulse" })
|
|
3000
3687
|
] }),
|
|
3001
|
-
/* @__PURE__ */
|
|
3688
|
+
/* @__PURE__ */ jsx21("span", { children: labelMap[status] })
|
|
3002
3689
|
] });
|
|
3003
3690
|
}
|
|
3004
3691
|
function AssistantMessage({
|
|
@@ -3012,42 +3699,42 @@ function AssistantMessage({
|
|
|
3012
3699
|
const hasReasoning = hasRenderableReasoning(message.reasoning);
|
|
3013
3700
|
const resolvedStreamingStatus = streamingStatus ?? getAssistantStreamingStatus(message, isStreaming);
|
|
3014
3701
|
const answerNode = renderContent(message.content, message.id);
|
|
3015
|
-
const reasoningNode = hasReasoning ? /* @__PURE__ */
|
|
3702
|
+
const reasoningNode = hasReasoning ? /* @__PURE__ */ jsx21(ReasoningBlock, { reasoning: message.reasoning ?? [] }) : null;
|
|
3016
3703
|
if (!hasRenderableAssistantMessage(message) && !resolvedStreamingStatus) return null;
|
|
3017
3704
|
const streamingClass = isStreaming ? "streaming-active" : "";
|
|
3018
3705
|
if (!hasRenderableAssistantMessage(message) && resolvedStreamingStatus) {
|
|
3019
|
-
return /* @__PURE__ */
|
|
3706
|
+
return /* @__PURE__ */ jsx21("div", { className: cn("space-y-3", streamingClass, className), children: /* @__PURE__ */ jsx21(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) });
|
|
3020
3707
|
}
|
|
3021
3708
|
if (hasContent && hasReasoning) {
|
|
3022
|
-
return /* @__PURE__ */
|
|
3023
|
-
/* @__PURE__ */
|
|
3709
|
+
return /* @__PURE__ */ jsxs11("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
3710
|
+
/* @__PURE__ */ jsxs11(
|
|
3024
3711
|
Tabs,
|
|
3025
3712
|
{
|
|
3026
3713
|
defaultValue: message.status === "reasoning" ? "reasoning" : "answer",
|
|
3027
3714
|
className: "w-full",
|
|
3028
3715
|
children: [
|
|
3029
|
-
/* @__PURE__ */
|
|
3030
|
-
/* @__PURE__ */
|
|
3031
|
-
/* @__PURE__ */
|
|
3716
|
+
/* @__PURE__ */ jsxs11(TabsList, { className: "", children: [
|
|
3717
|
+
/* @__PURE__ */ jsx21(TabsTrigger, { value: "answer", children: t("message.answer") }),
|
|
3718
|
+
/* @__PURE__ */ jsx21(TabsTrigger, { value: "reasoning", children: t("message.reasoning") })
|
|
3032
3719
|
] }),
|
|
3033
|
-
/* @__PURE__ */
|
|
3034
|
-
/* @__PURE__ */
|
|
3720
|
+
/* @__PURE__ */ jsx21(TabsContent, { value: "answer", className: "space-y-3", children: answerNode }),
|
|
3721
|
+
/* @__PURE__ */ jsx21(TabsContent, { value: "reasoning", className: "space-y-3", children: reasoningNode })
|
|
3035
3722
|
]
|
|
3036
3723
|
}
|
|
3037
3724
|
),
|
|
3038
|
-
resolvedStreamingStatus ? /* @__PURE__ */
|
|
3725
|
+
resolvedStreamingStatus ? /* @__PURE__ */ jsx21(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
3039
3726
|
] });
|
|
3040
3727
|
}
|
|
3041
|
-
return /* @__PURE__ */
|
|
3728
|
+
return /* @__PURE__ */ jsxs11("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
3042
3729
|
hasReasoning ? reasoningNode : answerNode,
|
|
3043
|
-
resolvedStreamingStatus ? /* @__PURE__ */
|
|
3730
|
+
resolvedStreamingStatus ? /* @__PURE__ */ jsx21(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
3044
3731
|
] });
|
|
3045
3732
|
}
|
|
3046
3733
|
|
|
3047
3734
|
// src/components/thread/MessageActions.tsx
|
|
3048
|
-
import * as
|
|
3735
|
+
import * as React16 from "react";
|
|
3049
3736
|
import { Check, Copy, RefreshCw } from "lucide-react";
|
|
3050
|
-
import { jsx as
|
|
3737
|
+
import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3051
3738
|
function MessageActions({
|
|
3052
3739
|
content,
|
|
3053
3740
|
isAssistant = false,
|
|
@@ -3056,7 +3743,7 @@ function MessageActions({
|
|
|
3056
3743
|
className
|
|
3057
3744
|
}) {
|
|
3058
3745
|
const { t } = useChatkitTranslation();
|
|
3059
|
-
const [copied, setCopied] =
|
|
3746
|
+
const [copied, setCopied] = React16.useState(false);
|
|
3060
3747
|
const handleCopy = async () => {
|
|
3061
3748
|
try {
|
|
3062
3749
|
await navigator.clipboard.writeText(content);
|
|
@@ -3069,7 +3756,7 @@ function MessageActions({
|
|
|
3069
3756
|
if (isStreaming) {
|
|
3070
3757
|
return null;
|
|
3071
3758
|
}
|
|
3072
|
-
return /* @__PURE__ */
|
|
3759
|
+
return /* @__PURE__ */ jsxs12(
|
|
3073
3760
|
"div",
|
|
3074
3761
|
{
|
|
3075
3762
|
className: cn(
|
|
@@ -3077,7 +3764,7 @@ function MessageActions({
|
|
|
3077
3764
|
className
|
|
3078
3765
|
),
|
|
3079
3766
|
children: [
|
|
3080
|
-
/* @__PURE__ */
|
|
3767
|
+
/* @__PURE__ */ jsx22(
|
|
3081
3768
|
"button",
|
|
3082
3769
|
{
|
|
3083
3770
|
type: "button",
|
|
@@ -3087,17 +3774,17 @@ function MessageActions({
|
|
|
3087
3774
|
copied && "text-green-500"
|
|
3088
3775
|
),
|
|
3089
3776
|
title: copied ? t("messageActions.copied") : t("messageActions.copy"),
|
|
3090
|
-
children: copied ? /* @__PURE__ */
|
|
3777
|
+
children: copied ? /* @__PURE__ */ jsx22(Check, { size: 14 }) : /* @__PURE__ */ jsx22(Copy, { size: 14 })
|
|
3091
3778
|
}
|
|
3092
3779
|
),
|
|
3093
|
-
isAssistant && onRetry && /* @__PURE__ */
|
|
3780
|
+
isAssistant && onRetry && /* @__PURE__ */ jsx22(
|
|
3094
3781
|
"button",
|
|
3095
3782
|
{
|
|
3096
3783
|
type: "button",
|
|
3097
3784
|
onClick: onRetry,
|
|
3098
3785
|
className: "p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",
|
|
3099
3786
|
title: t("messageActions.regenerate"),
|
|
3100
|
-
children: /* @__PURE__ */
|
|
3787
|
+
children: /* @__PURE__ */ jsx22(RefreshCw, { size: 14 })
|
|
3101
3788
|
}
|
|
3102
3789
|
)
|
|
3103
3790
|
]
|
|
@@ -3118,18 +3805,18 @@ import {
|
|
|
3118
3805
|
Sparkles as Sparkles2,
|
|
3119
3806
|
Zap
|
|
3120
3807
|
} from "lucide-react";
|
|
3121
|
-
import { jsx as
|
|
3808
|
+
import { jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3122
3809
|
function getIconComponent2(icon) {
|
|
3123
3810
|
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__ */
|
|
3811
|
+
"circle-question": /* @__PURE__ */ jsx23(HelpCircle, { size: 20 }),
|
|
3812
|
+
"lightbulb": /* @__PURE__ */ jsx23(Lightbulb2, { size: 20 }),
|
|
3813
|
+
"sparkle": /* @__PURE__ */ jsx23(Sparkles2, { size: 20 }),
|
|
3814
|
+
"write": /* @__PURE__ */ jsx23(Pencil2, { size: 20 }),
|
|
3815
|
+
"search": /* @__PURE__ */ jsx23(Search2, { size: 20 }),
|
|
3816
|
+
"globe": /* @__PURE__ */ jsx23(Globe2, { size: 20 }),
|
|
3817
|
+
"book-open": /* @__PURE__ */ jsx23(BookOpen, { size: 20 }),
|
|
3818
|
+
"compass": /* @__PURE__ */ jsx23(Compass, { size: 20 }),
|
|
3819
|
+
"bolt": /* @__PURE__ */ jsx23(Zap, { size: 20 })
|
|
3133
3820
|
};
|
|
3134
3821
|
return icon ? iconMap[icon] || iconMap["sparkle"] : iconMap["sparkle"];
|
|
3135
3822
|
}
|
|
@@ -3137,9 +3824,9 @@ function StartScreen({ startScreen, onPromptClick, className }) {
|
|
|
3137
3824
|
const { t } = useChatkitTranslation();
|
|
3138
3825
|
const greeting = startScreen?.greeting ?? t("startScreen.greeting");
|
|
3139
3826
|
const prompts = startScreen?.prompts ?? [];
|
|
3140
|
-
return /* @__PURE__ */
|
|
3141
|
-
/* @__PURE__ */
|
|
3142
|
-
prompts.length > 0 && /* @__PURE__ */
|
|
3827
|
+
return /* @__PURE__ */ jsxs13("div", { className: cn("flex flex-col items-center justify-center py-12 px-4", className), children: [
|
|
3828
|
+
/* @__PURE__ */ jsx23("div", { className: "mb-8 text-center", children: /* @__PURE__ */ jsx23("h2", { className: "text-2xl font-semibold text-foreground mb-2", children: greeting }) }),
|
|
3829
|
+
prompts.length > 0 && /* @__PURE__ */ jsx23("div", { className: "w-full max-w-2xl", children: /* @__PURE__ */ jsx23("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: prompts.map((item, index) => /* @__PURE__ */ jsxs13(
|
|
3143
3830
|
"button",
|
|
3144
3831
|
{
|
|
3145
3832
|
type: "button",
|
|
@@ -3150,8 +3837,8 @@ function StartScreen({ startScreen, onPromptClick, className }) {
|
|
|
3150
3837
|
"focus:outline-none focus:ring-2 focus:ring-primary/20"
|
|
3151
3838
|
),
|
|
3152
3839
|
children: [
|
|
3153
|
-
/* @__PURE__ */
|
|
3154
|
-
/* @__PURE__ */
|
|
3840
|
+
/* @__PURE__ */ jsx23("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: getIconComponent2(item.icon) }),
|
|
3841
|
+
/* @__PURE__ */ jsx23("span", { className: "text-sm font-medium text-foreground", children: item.label })
|
|
3155
3842
|
]
|
|
3156
3843
|
},
|
|
3157
3844
|
`prompt-${index}`
|
|
@@ -3163,10 +3850,10 @@ function StartScreen({ startScreen, onPromptClick, className }) {
|
|
|
3163
3850
|
import "react";
|
|
3164
3851
|
|
|
3165
3852
|
// src/components/ui/avatar.tsx
|
|
3166
|
-
import * as
|
|
3853
|
+
import * as React18 from "react";
|
|
3167
3854
|
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
3168
|
-
import { jsx as
|
|
3169
|
-
var Avatar =
|
|
3855
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
3856
|
+
var Avatar = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
3170
3857
|
AvatarPrimitive.Root,
|
|
3171
3858
|
{
|
|
3172
3859
|
ref,
|
|
@@ -3178,7 +3865,7 @@ var Avatar = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
3178
3865
|
}
|
|
3179
3866
|
));
|
|
3180
3867
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
3181
|
-
var AvatarImage =
|
|
3868
|
+
var AvatarImage = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
3182
3869
|
AvatarPrimitive.Image,
|
|
3183
3870
|
{
|
|
3184
3871
|
ref,
|
|
@@ -3187,7 +3874,7 @@ var AvatarImage = React17.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
3187
3874
|
}
|
|
3188
3875
|
));
|
|
3189
3876
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
3190
|
-
var AvatarFallback =
|
|
3877
|
+
var AvatarFallback = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
3191
3878
|
AvatarPrimitive.Fallback,
|
|
3192
3879
|
{
|
|
3193
3880
|
ref,
|
|
@@ -3201,7 +3888,7 @@ var AvatarFallback = React17.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
3201
3888
|
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
3202
3889
|
|
|
3203
3890
|
// src/components/ui/chatkit-avatar.tsx
|
|
3204
|
-
import { jsx as
|
|
3891
|
+
import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3205
3892
|
function asRecord(value) {
|
|
3206
3893
|
return value && typeof value === "object" ? value : null;
|
|
3207
3894
|
}
|
|
@@ -3274,21 +3961,21 @@ function ChatkitAvatar({
|
|
|
3274
3961
|
const fallbackStyle = {
|
|
3275
3962
|
...avatar?.background ? { background: avatar.background } : {}
|
|
3276
3963
|
};
|
|
3277
|
-
return /* @__PURE__ */
|
|
3278
|
-
avatar?.url ? /* @__PURE__ */
|
|
3279
|
-
/* @__PURE__ */
|
|
3964
|
+
return /* @__PURE__ */ jsxs14(Avatar, { className: cn(roundedClass, className), style, ...props, children: [
|
|
3965
|
+
avatar?.url ? /* @__PURE__ */ jsx25(AvatarImage, { className: imageClassName, src: avatar.url, alt: label }) : null,
|
|
3966
|
+
/* @__PURE__ */ jsx25(
|
|
3280
3967
|
AvatarFallback,
|
|
3281
3968
|
{
|
|
3282
3969
|
className: cn(roundedClass, "text-sm font-medium text-foreground", fallbackClassName),
|
|
3283
3970
|
style: fallbackStyle,
|
|
3284
|
-
children: emojiCharacter ? /* @__PURE__ */
|
|
3971
|
+
children: emojiCharacter ? /* @__PURE__ */ jsx25("span", { className: "text-[1.1em] leading-none", style: emojiStyle, children: emojiCharacter }) : fallbackText
|
|
3285
3972
|
}
|
|
3286
3973
|
)
|
|
3287
3974
|
] });
|
|
3288
3975
|
}
|
|
3289
3976
|
|
|
3290
3977
|
// src/hooks/useThreads.ts
|
|
3291
|
-
import * as
|
|
3978
|
+
import * as React20 from "react";
|
|
3292
3979
|
var DEFAULT_LIMIT = 50;
|
|
3293
3980
|
var getThreadTitle = (threadRecord) => {
|
|
3294
3981
|
const title = threadRecord.title?.trim();
|
|
@@ -3326,16 +4013,16 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
3326
4013
|
isReady,
|
|
3327
4014
|
isLoading: isStreamLoading
|
|
3328
4015
|
} = useStreamContext();
|
|
3329
|
-
const [threadRecords, setThreadRecords] =
|
|
3330
|
-
const [isLoading, setIsLoading] =
|
|
3331
|
-
const [error, setError] =
|
|
3332
|
-
const upsertThreadRecord =
|
|
4016
|
+
const [threadRecords, setThreadRecords] = React20.useState([]);
|
|
4017
|
+
const [isLoading, setIsLoading] = React20.useState(false);
|
|
4018
|
+
const [error, setError] = React20.useState(null);
|
|
4019
|
+
const upsertThreadRecord = React20.useCallback((threadRecord) => {
|
|
3333
4020
|
setThreadRecords((prev) => {
|
|
3334
4021
|
const next = prev.filter((item) => item.id !== threadRecord.id);
|
|
3335
4022
|
return sortThreadRecords([threadRecord, ...next]);
|
|
3336
4023
|
});
|
|
3337
4024
|
}, []);
|
|
3338
|
-
const refreshThreads =
|
|
4025
|
+
const refreshThreads = React20.useCallback(async () => {
|
|
3339
4026
|
setIsLoading(true);
|
|
3340
4027
|
setError(null);
|
|
3341
4028
|
try {
|
|
@@ -3351,7 +4038,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
3351
4038
|
setIsLoading(false);
|
|
3352
4039
|
}
|
|
3353
4040
|
}, [client, limit, assistantId]);
|
|
3354
|
-
const createThread =
|
|
4041
|
+
const createThread = React20.useCallback(
|
|
3355
4042
|
async (input) => {
|
|
3356
4043
|
setError(null);
|
|
3357
4044
|
const payload = {};
|
|
@@ -3365,7 +4052,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
3365
4052
|
},
|
|
3366
4053
|
[client, upsertThreadRecord]
|
|
3367
4054
|
);
|
|
3368
|
-
const updateThread =
|
|
4055
|
+
const updateThread = React20.useCallback(
|
|
3369
4056
|
async (recordId, payload) => {
|
|
3370
4057
|
setError(null);
|
|
3371
4058
|
const updated = await client.conversations.update(recordId, payload);
|
|
@@ -3374,7 +4061,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
3374
4061
|
},
|
|
3375
4062
|
[client, upsertThreadRecord]
|
|
3376
4063
|
);
|
|
3377
|
-
const deleteThread =
|
|
4064
|
+
const deleteThread = React20.useCallback(
|
|
3378
4065
|
async (recordId) => {
|
|
3379
4066
|
setError(null);
|
|
3380
4067
|
await client.conversations.delete(recordId);
|
|
@@ -3382,23 +4069,24 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
3382
4069
|
},
|
|
3383
4070
|
[client]
|
|
3384
4071
|
);
|
|
3385
|
-
|
|
4072
|
+
React20.useEffect(() => {
|
|
3386
4073
|
if (!isReady) return;
|
|
3387
4074
|
void refreshThreads();
|
|
3388
4075
|
}, [refreshThreads, isReady]);
|
|
3389
|
-
|
|
4076
|
+
React20.useEffect(() => {
|
|
3390
4077
|
if (!threadId || !isStreamLoading) return;
|
|
3391
4078
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4079
|
+
const busyStatus = "busy";
|
|
3392
4080
|
setThreadRecords((prev) => {
|
|
3393
4081
|
let changed = false;
|
|
3394
4082
|
const next = prev.map((item) => {
|
|
3395
4083
|
const isCurrentThread = item.threadId === threadId || item.id === threadId;
|
|
3396
4084
|
if (!isCurrentThread) return item;
|
|
3397
|
-
if (item.status ===
|
|
4085
|
+
if (item.status === busyStatus && !item.error) return item;
|
|
3398
4086
|
changed = true;
|
|
3399
4087
|
return {
|
|
3400
4088
|
...item,
|
|
3401
|
-
status:
|
|
4089
|
+
status: busyStatus,
|
|
3402
4090
|
error: void 0,
|
|
3403
4091
|
updatedAt: now
|
|
3404
4092
|
};
|
|
@@ -3406,7 +4094,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
3406
4094
|
return changed ? sortThreadRecords(next) : prev;
|
|
3407
4095
|
});
|
|
3408
4096
|
}, [threadId, isStreamLoading]);
|
|
3409
|
-
|
|
4097
|
+
React20.useEffect(() => {
|
|
3410
4098
|
if (!isReady || !threadId || isStreamLoading) return;
|
|
3411
4099
|
let cancelled = false;
|
|
3412
4100
|
void client.conversations.search({ where: { threadId }, limit: 1 }).then((result) => {
|
|
@@ -3420,7 +4108,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
3420
4108
|
cancelled = true;
|
|
3421
4109
|
};
|
|
3422
4110
|
}, [client, threadId, upsertThreadRecord, isReady, isStreamLoading]);
|
|
3423
|
-
const threads =
|
|
4111
|
+
const threads = React20.useMemo(
|
|
3424
4112
|
() => threadRecords.map((threadRecord) => toThreadItem(threadRecord)),
|
|
3425
4113
|
[threadRecords]
|
|
3426
4114
|
);
|
|
@@ -3437,18 +4125,18 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
3437
4125
|
}
|
|
3438
4126
|
|
|
3439
4127
|
// src/components/thread/context-usage-indicator.tsx
|
|
3440
|
-
import * as
|
|
4128
|
+
import * as React21 from "react";
|
|
3441
4129
|
|
|
3442
4130
|
// src/components/ui/progress-circle.tsx
|
|
3443
|
-
import { jsx as
|
|
3444
|
-
function
|
|
4131
|
+
import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4132
|
+
function clamp2(input, a, b) {
|
|
3445
4133
|
return Math.max(Math.min(input, Math.max(a, b)), Math.min(a, b));
|
|
3446
4134
|
}
|
|
3447
4135
|
var size = 24;
|
|
3448
4136
|
var strokeWidth = 4;
|
|
3449
4137
|
var total = 100;
|
|
3450
4138
|
var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
3451
|
-
const normalizedValue =
|
|
4139
|
+
const normalizedValue = clamp2(value, 0, total);
|
|
3452
4140
|
const radius = (size - strokeWidth) / 2;
|
|
3453
4141
|
const circumference = 2 * Math.PI * radius;
|
|
3454
4142
|
const progress = normalizedValue / total * circumference;
|
|
@@ -3463,7 +4151,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
3463
4151
|
return (
|
|
3464
4152
|
// biome-ignore lint/a11y/useFocusableInteractive: false positive (progress + progressbar are not focusable interactives)
|
|
3465
4153
|
// biome-ignore lint/nursery/useAriaPropsSupportedByRole: biome rule at odds with mdn docs (presumed nursary bug with rule)
|
|
3466
|
-
/* @__PURE__ */
|
|
4154
|
+
/* @__PURE__ */ jsxs15(
|
|
3467
4155
|
"svg",
|
|
3468
4156
|
{
|
|
3469
4157
|
role: "progressbar",
|
|
@@ -3474,8 +4162,8 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
3474
4162
|
"aria-valuemax": 100,
|
|
3475
4163
|
...restSvgProps,
|
|
3476
4164
|
children: [
|
|
3477
|
-
/* @__PURE__ */
|
|
3478
|
-
/* @__PURE__ */
|
|
4165
|
+
/* @__PURE__ */ jsx26("circle", { ...commonParams, className: "stroke-current/25" }),
|
|
4166
|
+
/* @__PURE__ */ jsx26(
|
|
3479
4167
|
"circle",
|
|
3480
4168
|
{
|
|
3481
4169
|
...commonParams,
|
|
@@ -3494,7 +4182,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
3494
4182
|
};
|
|
3495
4183
|
|
|
3496
4184
|
// src/components/thread/context-usage-indicator.tsx
|
|
3497
|
-
import { jsx as
|
|
4185
|
+
import { jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3498
4186
|
var kNumberFormatter = new Intl.NumberFormat("en-US", {
|
|
3499
4187
|
minimumFractionDigits: 0,
|
|
3500
4188
|
maximumFractionDigits: 1
|
|
@@ -3527,20 +4215,20 @@ function ContextUsageIndicator({
|
|
|
3527
4215
|
}) {
|
|
3528
4216
|
const { t } = useChatkitTranslation();
|
|
3529
4217
|
const stream = useStreamContext();
|
|
3530
|
-
const [maxContextSize, setMaxContextSize] =
|
|
3531
|
-
const [usedContextSize, setUsedContextSize] =
|
|
3532
|
-
const [assistantAgentKey, setAssistantAgentKey] =
|
|
3533
|
-
const latestRealtimeUsageRef =
|
|
4218
|
+
const [maxContextSize, setMaxContextSize] = React21.useState(null);
|
|
4219
|
+
const [usedContextSize, setUsedContextSize] = React21.useState(null);
|
|
4220
|
+
const [assistantAgentKey, setAssistantAgentKey] = React21.useState(null);
|
|
4221
|
+
const latestRealtimeUsageRef = React21.useRef({
|
|
3534
4222
|
threadId: null,
|
|
3535
4223
|
agentKey: null,
|
|
3536
4224
|
usedTokens: null
|
|
3537
4225
|
});
|
|
3538
|
-
const realtimeUsage =
|
|
4226
|
+
const realtimeUsage = React21.useMemo(
|
|
3539
4227
|
() => getThreadContextUsage(stream.contextUsageByAgentKey, assistantAgentKey),
|
|
3540
4228
|
[assistantAgentKey, stream.contextUsageByAgentKey]
|
|
3541
4229
|
);
|
|
3542
4230
|
const realtimeUsedContextSize = getThreadContextUsageTotalTokens(realtimeUsage);
|
|
3543
|
-
|
|
4231
|
+
React21.useEffect(() => {
|
|
3544
4232
|
if (!stream.client || !stream.assistantId) {
|
|
3545
4233
|
setMaxContextSize(null);
|
|
3546
4234
|
setAssistantAgentKey(null);
|
|
@@ -3560,18 +4248,18 @@ function ContextUsageIndicator({
|
|
|
3560
4248
|
cancelled = true;
|
|
3561
4249
|
};
|
|
3562
4250
|
}, [stream.client, stream.assistantId]);
|
|
3563
|
-
|
|
4251
|
+
React21.useEffect(() => {
|
|
3564
4252
|
latestRealtimeUsageRef.current = {
|
|
3565
4253
|
threadId: stream.threadId ?? null,
|
|
3566
4254
|
agentKey: assistantAgentKey,
|
|
3567
4255
|
usedTokens: realtimeUsedContextSize
|
|
3568
4256
|
};
|
|
3569
4257
|
}, [assistantAgentKey, realtimeUsedContextSize, stream.threadId]);
|
|
3570
|
-
|
|
4258
|
+
React21.useEffect(() => {
|
|
3571
4259
|
if (realtimeUsedContextSize == null) return;
|
|
3572
4260
|
setUsedContextSize(realtimeUsedContextSize);
|
|
3573
4261
|
}, [realtimeUsedContextSize]);
|
|
3574
|
-
|
|
4262
|
+
React21.useEffect(() => {
|
|
3575
4263
|
if (!stream.client) {
|
|
3576
4264
|
setUsedContextSize(null);
|
|
3577
4265
|
return;
|
|
@@ -3636,8 +4324,8 @@ function ContextUsageIndicator({
|
|
|
3636
4324
|
});
|
|
3637
4325
|
const usageLabelWithSuffix = usageLabel.endsWith(":") ? usageLabel : `${usageLabel}:`;
|
|
3638
4326
|
const progressClassName = percent >= 90 ? "text-destructive" : percent >= 75 ? "text-amber-500" : "text-primary dark:text-zinc-300";
|
|
3639
|
-
return /* @__PURE__ */
|
|
3640
|
-
/* @__PURE__ */
|
|
4327
|
+
return /* @__PURE__ */ jsxs16(Tooltip, { children: [
|
|
4328
|
+
/* @__PURE__ */ jsx27(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx27(
|
|
3641
4329
|
"button",
|
|
3642
4330
|
{
|
|
3643
4331
|
type: "button",
|
|
@@ -3646,21 +4334,73 @@ function ContextUsageIndicator({
|
|
|
3646
4334
|
className
|
|
3647
4335
|
),
|
|
3648
4336
|
"aria-label": `${usageLabelWithSuffix} ${usageFullLabel}. ${usageTokensLabel}`,
|
|
3649
|
-
children: /* @__PURE__ */
|
|
4337
|
+
children: /* @__PURE__ */ jsx27(ProgressCircle, { value: percent, className: cn("size-3.5", progressClassName) })
|
|
3650
4338
|
}
|
|
3651
4339
|
) }),
|
|
3652
|
-
/* @__PURE__ */
|
|
3653
|
-
/* @__PURE__ */
|
|
3654
|
-
/* @__PURE__ */
|
|
3655
|
-
/* @__PURE__ */
|
|
4340
|
+
/* @__PURE__ */ jsxs16(TooltipContent, { side: "top", sideOffset: 6, className: "space-y-0.5 px-3 py-2 text-center", children: [
|
|
4341
|
+
/* @__PURE__ */ jsx27("div", { className: "text-primary-foreground/70", children: usageLabelWithSuffix }),
|
|
4342
|
+
/* @__PURE__ */ jsx27("div", { className: "font-medium text-primary-foreground/80", children: usageFullLabel }),
|
|
4343
|
+
/* @__PURE__ */ jsx27("div", { className: "text-sm font-semibold", children: usageTokensLabel })
|
|
3656
4344
|
] })
|
|
3657
4345
|
] });
|
|
3658
4346
|
}
|
|
3659
4347
|
|
|
3660
4348
|
// src/components/chat.tsx
|
|
3661
|
-
import { Fragment as
|
|
4349
|
+
import { Fragment as Fragment4, jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3662
4350
|
var defaultApiUrl2 = import.meta.env.VITE_XPERTAI_API_URL;
|
|
3663
4351
|
var COMPOSER_INPUT_MAX_HEIGHT = 128;
|
|
4352
|
+
var LONG_TEXT_REFERENCE_THRESHOLD = 5e3;
|
|
4353
|
+
async function readImageDimensions(file) {
|
|
4354
|
+
if (typeof window === "undefined" || typeof URL === "undefined") {
|
|
4355
|
+
return {};
|
|
4356
|
+
}
|
|
4357
|
+
return new Promise((resolve) => {
|
|
4358
|
+
const objectUrl = URL.createObjectURL(file);
|
|
4359
|
+
const image = new window.Image();
|
|
4360
|
+
const cleanup = () => {
|
|
4361
|
+
URL.revokeObjectURL(objectUrl);
|
|
4362
|
+
};
|
|
4363
|
+
image.onload = () => {
|
|
4364
|
+
resolve({
|
|
4365
|
+
width: image.naturalWidth || void 0,
|
|
4366
|
+
height: image.naturalHeight || void 0
|
|
4367
|
+
});
|
|
4368
|
+
cleanup();
|
|
4369
|
+
};
|
|
4370
|
+
image.onerror = () => {
|
|
4371
|
+
resolve({});
|
|
4372
|
+
cleanup();
|
|
4373
|
+
};
|
|
4374
|
+
image.src = objectUrl;
|
|
4375
|
+
});
|
|
4376
|
+
}
|
|
4377
|
+
function getStorageFileUrl(file) {
|
|
4378
|
+
return file.url ?? file.fileUrl ?? file.thumbUrl;
|
|
4379
|
+
}
|
|
4380
|
+
function buildPastedImageReference(file, storageFile, dimensions) {
|
|
4381
|
+
const name = storageFile.originalName?.trim() || file.name.trim() || "Pasted image";
|
|
4382
|
+
const mimeType = storageFile.mimetype?.trim() || file.type.trim() || "image/*";
|
|
4383
|
+
const size2 = storageFile.size ?? file.size;
|
|
4384
|
+
const width = dimensions?.width;
|
|
4385
|
+
const height = dimensions?.height;
|
|
4386
|
+
const metaParts = [
|
|
4387
|
+
mimeType,
|
|
4388
|
+
width && height ? `${width}x${height}` : null,
|
|
4389
|
+
typeof size2 === "number" ? `${size2} bytes` : null
|
|
4390
|
+
].filter((part) => Boolean(part));
|
|
4391
|
+
return {
|
|
4392
|
+
type: "image",
|
|
4393
|
+
id: storageFile.id,
|
|
4394
|
+
fileId: storageFile.id,
|
|
4395
|
+
url: getStorageFileUrl(storageFile),
|
|
4396
|
+
mimeType,
|
|
4397
|
+
name,
|
|
4398
|
+
...typeof size2 === "number" ? { size: size2 } : {},
|
|
4399
|
+
...width ? { width } : {},
|
|
4400
|
+
...height ? { height } : {},
|
|
4401
|
+
text: `Pasted image${metaParts.length ? ` (${metaParts.join(", ")})` : ""}: ${name}`
|
|
4402
|
+
};
|
|
4403
|
+
}
|
|
3664
4404
|
function formatMessageContent(content) {
|
|
3665
4405
|
if (typeof content === "string") {
|
|
3666
4406
|
return content;
|
|
@@ -3697,8 +4437,8 @@ function ReferenceChip({
|
|
|
3697
4437
|
}) {
|
|
3698
4438
|
const metaLine = getReferenceMetaLine(reference);
|
|
3699
4439
|
const isComposer = variant === "composer";
|
|
3700
|
-
const Icon = reference.type === "quote" ? Quote : FileText2;
|
|
3701
|
-
return /* @__PURE__ */
|
|
4440
|
+
const Icon = reference.type === "quote" ? Quote : reference.type === "image" ? ImageIcon : FileText2;
|
|
4441
|
+
return /* @__PURE__ */ jsxs17(
|
|
3702
4442
|
"div",
|
|
3703
4443
|
{
|
|
3704
4444
|
className: cn(
|
|
@@ -3707,7 +4447,7 @@ function ReferenceChip({
|
|
|
3707
4447
|
),
|
|
3708
4448
|
title: getReferenceTitle(reference),
|
|
3709
4449
|
children: [
|
|
3710
|
-
/* @__PURE__ */
|
|
4450
|
+
/* @__PURE__ */ jsx28(
|
|
3711
4451
|
Icon,
|
|
3712
4452
|
{
|
|
3713
4453
|
size: isComposer ? 14 : 12,
|
|
@@ -3717,29 +4457,29 @@ function ReferenceChip({
|
|
|
3717
4457
|
)
|
|
3718
4458
|
}
|
|
3719
4459
|
),
|
|
3720
|
-
/* @__PURE__ */
|
|
3721
|
-
/* @__PURE__ */
|
|
4460
|
+
/* @__PURE__ */ jsxs17("div", { className: "min-w-0 flex-1", children: [
|
|
4461
|
+
/* @__PURE__ */ jsx28(
|
|
3722
4462
|
"div",
|
|
3723
4463
|
{
|
|
3724
4464
|
className: cn(
|
|
3725
|
-
"truncate",
|
|
4465
|
+
"truncate whitespace-pre-wrap",
|
|
3726
4466
|
isComposer ? "text-sm" : "text-xs font-medium"
|
|
3727
4467
|
),
|
|
3728
4468
|
children: getReferenceLabel(reference)
|
|
3729
4469
|
}
|
|
3730
4470
|
),
|
|
3731
|
-
metaLine && /* @__PURE__ */
|
|
4471
|
+
metaLine && /* @__PURE__ */ jsx28(
|
|
3732
4472
|
"div",
|
|
3733
4473
|
{
|
|
3734
4474
|
className: cn(
|
|
3735
|
-
"truncate",
|
|
4475
|
+
"truncate whitespace-pre-wrap",
|
|
3736
4476
|
isComposer ? "text-xs text-muted-foreground" : "text-[10px] text-primary-foreground/75"
|
|
3737
4477
|
),
|
|
3738
4478
|
children: metaLine
|
|
3739
4479
|
}
|
|
3740
4480
|
)
|
|
3741
4481
|
] }),
|
|
3742
|
-
onRemove && removeLabel && /* @__PURE__ */
|
|
4482
|
+
onRemove && removeLabel && /* @__PURE__ */ jsx28(
|
|
3743
4483
|
"button",
|
|
3744
4484
|
{
|
|
3745
4485
|
type: "button",
|
|
@@ -3750,7 +4490,7 @@ function ReferenceChip({
|
|
|
3750
4490
|
),
|
|
3751
4491
|
title: removeLabel,
|
|
3752
4492
|
"aria-label": removeLabel,
|
|
3753
|
-
children: /* @__PURE__ */
|
|
4493
|
+
children: /* @__PURE__ */ jsx28(X3, { size: 12 })
|
|
3754
4494
|
}
|
|
3755
4495
|
)
|
|
3756
4496
|
]
|
|
@@ -3774,20 +4514,20 @@ function Chat({
|
|
|
3774
4514
|
const { setStream } = useStreamManager();
|
|
3775
4515
|
const stream = useStreamContext();
|
|
3776
4516
|
const { theme } = useTheme();
|
|
3777
|
-
const [isHistoryLoading, setIsHistoryLoading] =
|
|
3778
|
-
const [historyError, setHistoryError] =
|
|
3779
|
-
const [assistantName, setAssistantName] =
|
|
3780
|
-
const [assistantAvatar, setAssistantAvatar] =
|
|
4517
|
+
const [isHistoryLoading, setIsHistoryLoading] = React22.useState(false);
|
|
4518
|
+
const [historyError, setHistoryError] = React22.useState(null);
|
|
4519
|
+
const [assistantName, setAssistantName] = React22.useState(null);
|
|
4520
|
+
const [assistantAvatar, setAssistantAvatar] = React22.useState(null);
|
|
3781
4521
|
const LOADING_DOTS_MIN_DURATION = 800;
|
|
3782
4522
|
const STREAMING_STATUS_REFRESH_MS = 250;
|
|
3783
|
-
const [showLoadingDots, setShowLoadingDots] =
|
|
3784
|
-
const [streamingNow, setStreamingNow] =
|
|
3785
|
-
const loadingStartTimeRef =
|
|
3786
|
-
const lastStreamOutputAtRef =
|
|
3787
|
-
|
|
4523
|
+
const [showLoadingDots, setShowLoadingDots] = React22.useState(false);
|
|
4524
|
+
const [streamingNow, setStreamingNow] = React22.useState(() => Date.now());
|
|
4525
|
+
const loadingStartTimeRef = React22.useRef(null);
|
|
4526
|
+
const lastStreamOutputAtRef = React22.useRef(null);
|
|
4527
|
+
React22.useEffect(() => {
|
|
3788
4528
|
setStream(stream);
|
|
3789
4529
|
}, [setStream, stream]);
|
|
3790
|
-
|
|
4530
|
+
React22.useEffect(() => {
|
|
3791
4531
|
if (stream.isLoading) {
|
|
3792
4532
|
if (!loadingStartTimeRef.current) {
|
|
3793
4533
|
loadingStartTimeRef.current = Date.now();
|
|
@@ -3810,7 +4550,7 @@ function Chat({
|
|
|
3810
4550
|
}
|
|
3811
4551
|
}
|
|
3812
4552
|
}, [stream.isLoading]);
|
|
3813
|
-
|
|
4553
|
+
React22.useEffect(() => {
|
|
3814
4554
|
if (!stream.isLoading) {
|
|
3815
4555
|
lastStreamOutputAtRef.current = null;
|
|
3816
4556
|
setStreamingNow(Date.now());
|
|
@@ -3820,7 +4560,7 @@ function Chat({
|
|
|
3820
4560
|
lastStreamOutputAtRef.current = now;
|
|
3821
4561
|
setStreamingNow(now);
|
|
3822
4562
|
}, [stream.messages, stream.isLoading]);
|
|
3823
|
-
|
|
4563
|
+
React22.useEffect(() => {
|
|
3824
4564
|
if (!stream.isLoading) {
|
|
3825
4565
|
return;
|
|
3826
4566
|
}
|
|
@@ -3829,51 +4569,52 @@ function Chat({
|
|
|
3829
4569
|
}, STREAMING_STATUS_REFRESH_MS);
|
|
3830
4570
|
return () => window.clearInterval(timer);
|
|
3831
4571
|
}, [stream.isLoading]);
|
|
3832
|
-
const [draft, setDraft] =
|
|
3833
|
-
const [selectedTool, setSelectedTool] =
|
|
4572
|
+
const [draft, setDraft] = React22.useState("");
|
|
4573
|
+
const [selectedTool, setSelectedTool] = React22.useState(
|
|
3834
4574
|
null
|
|
3835
4575
|
);
|
|
3836
|
-
const [attachments, setAttachments] =
|
|
3837
|
-
const [references, setReferences] =
|
|
3838
|
-
const [
|
|
3839
|
-
const [
|
|
3840
|
-
const [
|
|
4576
|
+
const [attachments, setAttachments] = React22.useState([]);
|
|
4577
|
+
const [references, setReferences] = React22.useState([]);
|
|
4578
|
+
const [isUploadingReferenceImages, setIsUploadingReferenceImages] = React22.useState(false);
|
|
4579
|
+
const [quoteSelection, setQuoteSelection] = React22.useState(null);
|
|
4580
|
+
const [isAtBottom, setIsAtBottom] = React22.useState(true);
|
|
4581
|
+
const [hasUpdatesBelow, setHasUpdatesBelow] = React22.useState(false);
|
|
3841
4582
|
const {
|
|
3842
4583
|
threads,
|
|
3843
4584
|
deleteThread,
|
|
3844
4585
|
refreshThreads,
|
|
3845
4586
|
isLoading: isThreadsLoading
|
|
3846
4587
|
} = 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 =
|
|
4588
|
+
const viewportRef = React22.useRef(null);
|
|
4589
|
+
const fileInputRef = React22.useRef(null);
|
|
4590
|
+
const composerInputRef = React22.useRef(null);
|
|
4591
|
+
const shouldAutoScrollRef = React22.useRef(true);
|
|
4592
|
+
const forceFollowRef = React22.useRef(false);
|
|
4593
|
+
const previousMessageCountRef = React22.useRef(0);
|
|
4594
|
+
const previousScrollTopRef = React22.useRef(0);
|
|
4595
|
+
const autoScrollFrameRef = React22.useRef(null);
|
|
4596
|
+
const isPointerDownRef = React22.useRef(false);
|
|
4597
|
+
const lastTouchYRef = React22.useRef(null);
|
|
3857
4598
|
const resolvedTitle = title ?? t("chat.title");
|
|
3858
4599
|
const resolvedPlaceholder = placeholder ?? t("chat.placeholder");
|
|
3859
4600
|
const inputPlaceholder = selectedTool?.placeholderOverride ?? composer?.placeholder ?? resolvedPlaceholder;
|
|
3860
|
-
const messages =
|
|
4601
|
+
const messages = React22.useMemo(
|
|
3861
4602
|
() => stream.messages ?? [],
|
|
3862
4603
|
[stream.messages]
|
|
3863
4604
|
);
|
|
3864
4605
|
const trimmedDraft = draft.trim();
|
|
3865
4606
|
const hasReferences = references.length > 0;
|
|
3866
|
-
const pendingFollowUps =
|
|
4607
|
+
const pendingFollowUps = React22.useMemo(
|
|
3867
4608
|
() => [...stream.pendingFollowUps ?? []].sort(
|
|
3868
4609
|
(a, b) => a.createdAt - b.createdAt
|
|
3869
4610
|
),
|
|
3870
4611
|
[stream.pendingFollowUps]
|
|
3871
4612
|
);
|
|
3872
|
-
const clearQuoteSelection =
|
|
4613
|
+
const clearQuoteSelection = React22.useCallback(() => {
|
|
3873
4614
|
setQuoteSelection(null);
|
|
3874
4615
|
}, []);
|
|
3875
4616
|
useParentMessenger({
|
|
3876
|
-
onSetComposerValue:
|
|
4617
|
+
onSetComposerValue: React22.useCallback(
|
|
3877
4618
|
(payload) => {
|
|
3878
4619
|
if (!payload) {
|
|
3879
4620
|
return;
|
|
@@ -3896,11 +4637,11 @@ function Chat({
|
|
|
3896
4637
|
},
|
|
3897
4638
|
[composer?.tools]
|
|
3898
4639
|
),
|
|
3899
|
-
onFocusComposer:
|
|
4640
|
+
onFocusComposer: React22.useCallback(() => {
|
|
3900
4641
|
composerInputRef.current?.focus();
|
|
3901
4642
|
}, [])
|
|
3902
4643
|
});
|
|
3903
|
-
const syncQuoteSelection =
|
|
4644
|
+
const syncQuoteSelection = React22.useCallback(() => {
|
|
3904
4645
|
if (typeof window === "undefined") {
|
|
3905
4646
|
clearQuoteSelection();
|
|
3906
4647
|
return;
|
|
@@ -3945,23 +4686,23 @@ function Chat({
|
|
|
3945
4686
|
left
|
|
3946
4687
|
});
|
|
3947
4688
|
}, [clearQuoteSelection]);
|
|
3948
|
-
const cancelPendingAutoScroll =
|
|
4689
|
+
const cancelPendingAutoScroll = React22.useCallback(() => {
|
|
3949
4690
|
if (autoScrollFrameRef.current !== null) {
|
|
3950
4691
|
cancelAnimationFrame(autoScrollFrameRef.current);
|
|
3951
4692
|
autoScrollFrameRef.current = null;
|
|
3952
4693
|
}
|
|
3953
4694
|
}, []);
|
|
3954
|
-
const disableAutoFollow =
|
|
4695
|
+
const disableAutoFollow = React22.useCallback(() => {
|
|
3955
4696
|
forceFollowRef.current = false;
|
|
3956
4697
|
shouldAutoScrollRef.current = false;
|
|
3957
4698
|
cancelPendingAutoScroll();
|
|
3958
4699
|
}, [cancelPendingAutoScroll]);
|
|
3959
|
-
const enableAutoFollow =
|
|
4700
|
+
const enableAutoFollow = React22.useCallback(() => {
|
|
3960
4701
|
forceFollowRef.current = true;
|
|
3961
4702
|
shouldAutoScrollRef.current = true;
|
|
3962
4703
|
setHasUpdatesBelow(false);
|
|
3963
4704
|
}, []);
|
|
3964
|
-
const scrollToBottom =
|
|
4705
|
+
const scrollToBottom = React22.useCallback(
|
|
3965
4706
|
(smooth = false, force = false) => {
|
|
3966
4707
|
if (force) {
|
|
3967
4708
|
enableAutoFollow();
|
|
@@ -3983,7 +4724,7 @@ function Chat({
|
|
|
3983
4724
|
},
|
|
3984
4725
|
[cancelPendingAutoScroll, enableAutoFollow]
|
|
3985
4726
|
);
|
|
3986
|
-
|
|
4727
|
+
React22.useEffect(() => {
|
|
3987
4728
|
const viewport = viewportRef.current;
|
|
3988
4729
|
if (!viewport) return;
|
|
3989
4730
|
previousScrollTopRef.current = viewport.scrollTop;
|
|
@@ -4064,14 +4805,14 @@ function Chat({
|
|
|
4064
4805
|
window.removeEventListener("pointercancel", stopPointerTracking);
|
|
4065
4806
|
};
|
|
4066
4807
|
}, [cancelPendingAutoScroll, disableAutoFollow]);
|
|
4067
|
-
|
|
4808
|
+
React22.useEffect(() => {
|
|
4068
4809
|
shouldAutoScrollRef.current = true;
|
|
4069
4810
|
forceFollowRef.current = false;
|
|
4070
4811
|
previousScrollTopRef.current = 0;
|
|
4071
4812
|
setIsAtBottom(true);
|
|
4072
4813
|
setHasUpdatesBelow(false);
|
|
4073
4814
|
}, [stream.threadId]);
|
|
4074
|
-
|
|
4815
|
+
React22.useEffect(() => {
|
|
4075
4816
|
const messageCountChanged = messages.length !== previousMessageCountRef.current;
|
|
4076
4817
|
previousMessageCountRef.current = messages.length;
|
|
4077
4818
|
if (!shouldAutoScrollRef.current) {
|
|
@@ -4090,7 +4831,7 @@ function Chat({
|
|
|
4090
4831
|
clientSecret: effectiveClientSecret
|
|
4091
4832
|
});
|
|
4092
4833
|
const missingConfig = Boolean(missingConfigKind);
|
|
4093
|
-
const missingConfigShortMessage =
|
|
4834
|
+
const missingConfigShortMessage = React22.useMemo(() => {
|
|
4094
4835
|
switch (missingConfigKind) {
|
|
4095
4836
|
case "apiUrl":
|
|
4096
4837
|
return t("chat.missingApiUrlShort");
|
|
@@ -4102,7 +4843,7 @@ function Chat({
|
|
|
4102
4843
|
return t("chat.missingConfigShort");
|
|
4103
4844
|
}
|
|
4104
4845
|
}, [missingConfigKind, t]);
|
|
4105
|
-
const missingConfigDetailMessage =
|
|
4846
|
+
const missingConfigDetailMessage = React22.useMemo(() => {
|
|
4106
4847
|
switch (missingConfigKind) {
|
|
4107
4848
|
case "apiUrl":
|
|
4108
4849
|
return t("chat.missingApiUrlDetail");
|
|
@@ -4116,8 +4857,8 @@ function Chat({
|
|
|
4116
4857
|
}, [missingConfigKind, t]);
|
|
4117
4858
|
const showMissingConfig = !isClientSecretInitializing && missingConfig;
|
|
4118
4859
|
const hasUploadingFiles = attachments.some((a) => a.status === "uploading");
|
|
4119
|
-
const isSendDisabled = !trimmedDraft && !hasReferences || missingConfig || isHistoryLoading || hasUploadingFiles;
|
|
4120
|
-
const resizeComposerInput =
|
|
4860
|
+
const isSendDisabled = !trimmedDraft && !hasReferences || missingConfig || isHistoryLoading || hasUploadingFiles || isUploadingReferenceImages;
|
|
4861
|
+
const resizeComposerInput = React22.useCallback(() => {
|
|
4121
4862
|
const textarea = composerInputRef.current;
|
|
4122
4863
|
if (!textarea) {
|
|
4123
4864
|
return;
|
|
@@ -4130,16 +4871,16 @@ function Chat({
|
|
|
4130
4871
|
textarea.style.height = `${nextHeight}px`;
|
|
4131
4872
|
textarea.style.overflowY = textarea.scrollHeight > COMPOSER_INPUT_MAX_HEIGHT ? "auto" : "hidden";
|
|
4132
4873
|
}, []);
|
|
4133
|
-
|
|
4874
|
+
React22.useEffect(() => {
|
|
4134
4875
|
resizeComposerInput();
|
|
4135
4876
|
}, [draft, resizeComposerInput]);
|
|
4136
|
-
|
|
4877
|
+
React22.useEffect(() => {
|
|
4137
4878
|
document.addEventListener("selectionchange", syncQuoteSelection);
|
|
4138
4879
|
return () => {
|
|
4139
4880
|
document.removeEventListener("selectionchange", syncQuoteSelection);
|
|
4140
4881
|
};
|
|
4141
4882
|
}, [syncQuoteSelection]);
|
|
4142
|
-
|
|
4883
|
+
React22.useEffect(() => {
|
|
4143
4884
|
const viewport = viewportRef.current;
|
|
4144
4885
|
if (!viewport) {
|
|
4145
4886
|
return;
|
|
@@ -4156,14 +4897,14 @@ function Chat({
|
|
|
4156
4897
|
window.removeEventListener("resize", handleViewportScroll);
|
|
4157
4898
|
};
|
|
4158
4899
|
}, [clearQuoteSelection]);
|
|
4159
|
-
|
|
4900
|
+
React22.useEffect(() => {
|
|
4160
4901
|
clearQuoteSelection();
|
|
4161
4902
|
}, [messages.length, stream.threadId, clearQuoteSelection]);
|
|
4162
|
-
|
|
4903
|
+
React22.useEffect(() => {
|
|
4163
4904
|
if (missingConfig) return;
|
|
4164
4905
|
void refreshThreads();
|
|
4165
4906
|
}, [missingConfig, refreshThreads]);
|
|
4166
|
-
|
|
4907
|
+
React22.useEffect(() => {
|
|
4167
4908
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
4168
4909
|
setAssistantName(null);
|
|
4169
4910
|
setAssistantAvatar(null);
|
|
@@ -4194,7 +4935,7 @@ function Chat({
|
|
|
4194
4935
|
mimetype: a.storageFile?.mimetype ?? a.file.type,
|
|
4195
4936
|
size: a.storageFile?.size ?? a.file.size
|
|
4196
4937
|
}));
|
|
4197
|
-
const submitDraft =
|
|
4938
|
+
const submitDraft = React22.useCallback(
|
|
4198
4939
|
(followUpOverride) => {
|
|
4199
4940
|
if (isSendDisabled) return;
|
|
4200
4941
|
const filesToSend = uploadedFiles.length > 0 ? [...uploadedFiles] : void 0;
|
|
@@ -4268,7 +5009,7 @@ function Chat({
|
|
|
4268
5009
|
event.preventDefault();
|
|
4269
5010
|
submitDraft();
|
|
4270
5011
|
};
|
|
4271
|
-
const handleEditPendingFollowUp =
|
|
5012
|
+
const handleEditPendingFollowUp = React22.useCallback(
|
|
4272
5013
|
(id) => {
|
|
4273
5014
|
const item = pendingFollowUps.find(
|
|
4274
5015
|
(entry) => entry.id === id && entry.mode === "queue"
|
|
@@ -4295,7 +5036,7 @@ function Chat({
|
|
|
4295
5036
|
},
|
|
4296
5037
|
[pendingFollowUps, stream]
|
|
4297
5038
|
);
|
|
4298
|
-
const handleQuoteSelection =
|
|
5039
|
+
const handleQuoteSelection = React22.useCallback(() => {
|
|
4299
5040
|
if (!quoteSelection) {
|
|
4300
5041
|
return;
|
|
4301
5042
|
}
|
|
@@ -4311,21 +5052,14 @@ function Chat({
|
|
|
4311
5052
|
const handleAttachmentClick = () => {
|
|
4312
5053
|
fileInputRef.current?.click();
|
|
4313
5054
|
};
|
|
5055
|
+
const uploadContextFile = React22.useCallback(
|
|
5056
|
+
(file) => stream.client.contexts.uploadFile(file),
|
|
5057
|
+
[stream.client]
|
|
5058
|
+
);
|
|
4314
5059
|
const handleComposerKeyDown = (event) => {
|
|
4315
5060
|
if (event.key !== "Enter") {
|
|
4316
5061
|
return;
|
|
4317
5062
|
}
|
|
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
5063
|
if (event.shiftKey) {
|
|
4330
5064
|
return;
|
|
4331
5065
|
}
|
|
@@ -4336,12 +5070,108 @@ function Chat({
|
|
|
4336
5070
|
if (isSendDisabled) {
|
|
4337
5071
|
return;
|
|
4338
5072
|
}
|
|
5073
|
+
if (stream.isLoading) {
|
|
5074
|
+
submitDraft(
|
|
5075
|
+
getBusyComposerShortcutFollowUpMode(event.metaKey || event.ctrlKey)
|
|
5076
|
+
);
|
|
5077
|
+
return;
|
|
5078
|
+
}
|
|
4339
5079
|
submitDraft();
|
|
4340
5080
|
};
|
|
4341
|
-
const
|
|
5081
|
+
const handleComposerPaste = React22.useCallback(
|
|
5082
|
+
(event) => {
|
|
5083
|
+
const clipboardData = event.clipboardData;
|
|
5084
|
+
if (!clipboardData) {
|
|
5085
|
+
return;
|
|
5086
|
+
}
|
|
5087
|
+
const imageFiles = Array.from(clipboardData.items).filter(
|
|
5088
|
+
(item) => item.kind === "file" && item.type.startsWith("image/")
|
|
5089
|
+
).map((item) => item.getAsFile()).filter((item) => Boolean(item));
|
|
5090
|
+
if (imageFiles.length > 0) {
|
|
5091
|
+
event.preventDefault();
|
|
5092
|
+
const maxCount = composer?.attachments?.maxCount ?? 10;
|
|
5093
|
+
const maxSize = composer?.attachments?.maxSize ?? 100 * 1024 * 1024;
|
|
5094
|
+
const currentImageReferenceCount = references.filter(
|
|
5095
|
+
(reference) => reference.type === "image"
|
|
5096
|
+
).length;
|
|
5097
|
+
const availableSlots = Math.max(
|
|
5098
|
+
0,
|
|
5099
|
+
maxCount - currentImageReferenceCount
|
|
5100
|
+
);
|
|
5101
|
+
const nextFiles = imageFiles.filter((file) => file.size <= maxSize).slice(0, availableSlots);
|
|
5102
|
+
if (nextFiles.length === 0) {
|
|
5103
|
+
return;
|
|
5104
|
+
}
|
|
5105
|
+
setIsUploadingReferenceImages(true);
|
|
5106
|
+
void Promise.allSettled(
|
|
5107
|
+
nextFiles.map(async (file) => {
|
|
5108
|
+
const [dimensions, storageFile] = await Promise.all([
|
|
5109
|
+
readImageDimensions(file),
|
|
5110
|
+
uploadContextFile(file)
|
|
5111
|
+
]);
|
|
5112
|
+
return buildPastedImageReference(file, storageFile, dimensions);
|
|
5113
|
+
})
|
|
5114
|
+
).then((results) => {
|
|
5115
|
+
const nextReferences = results.filter(
|
|
5116
|
+
(result) => result.status === "fulfilled"
|
|
5117
|
+
).map((result) => result.value);
|
|
5118
|
+
if (nextReferences.length > 0) {
|
|
5119
|
+
setReferences(
|
|
5120
|
+
(previous) => mergeReferences(previous, nextReferences)
|
|
5121
|
+
);
|
|
5122
|
+
composerInputRef.current?.focus();
|
|
5123
|
+
}
|
|
5124
|
+
results.filter(
|
|
5125
|
+
(result) => result.status === "rejected"
|
|
5126
|
+
).forEach((result) => {
|
|
5127
|
+
console.warn(
|
|
5128
|
+
"[Chat] Failed to upload pasted image reference:",
|
|
5129
|
+
result.reason
|
|
5130
|
+
);
|
|
5131
|
+
});
|
|
5132
|
+
}).finally(() => {
|
|
5133
|
+
setIsUploadingReferenceImages(false);
|
|
5134
|
+
});
|
|
5135
|
+
return;
|
|
5136
|
+
}
|
|
5137
|
+
const pastedText = clipboardData.getData("text/plain");
|
|
5138
|
+
if (pastedText.trim().length <= LONG_TEXT_REFERENCE_THRESHOLD) {
|
|
5139
|
+
return;
|
|
5140
|
+
}
|
|
5141
|
+
event.preventDefault();
|
|
5142
|
+
setReferences(
|
|
5143
|
+
(previous) => mergeReferences(previous, [
|
|
5144
|
+
{
|
|
5145
|
+
type: "quote",
|
|
5146
|
+
source: "Pasted text",
|
|
5147
|
+
text: pastedText
|
|
5148
|
+
}
|
|
5149
|
+
])
|
|
5150
|
+
);
|
|
5151
|
+
composerInputRef.current?.focus();
|
|
5152
|
+
},
|
|
5153
|
+
[
|
|
5154
|
+
composer?.attachments?.maxCount,
|
|
5155
|
+
composer?.attachments?.maxSize,
|
|
5156
|
+
references,
|
|
5157
|
+
uploadContextFile
|
|
5158
|
+
]
|
|
5159
|
+
);
|
|
5160
|
+
const alternateFollowUpShortcutLabel = React22.useMemo(() => {
|
|
5161
|
+
if (typeof navigator === "undefined") {
|
|
5162
|
+
return "\u2318Enter";
|
|
5163
|
+
}
|
|
5164
|
+
const platform = navigator.platform || navigator.userAgent;
|
|
5165
|
+
return /Mac|iPhone|iPad|iPod/i.test(platform) ? "\u2318Enter" : "Ctrl+Enter";
|
|
5166
|
+
}, []);
|
|
5167
|
+
const followUpShortcutLabels = React22.useMemo(
|
|
5168
|
+
() => getComposerFollowUpShortcutLabels(alternateFollowUpShortcutLabel),
|
|
5169
|
+
[alternateFollowUpShortcutLabel]
|
|
5170
|
+
);
|
|
5171
|
+
const uploadFile = React22.useCallback(
|
|
4342
5172
|
async (localId, file) => {
|
|
4343
5173
|
try {
|
|
4344
|
-
const result = await
|
|
5174
|
+
const result = await uploadContextFile(file);
|
|
4345
5175
|
setAttachments(
|
|
4346
5176
|
(prev) => prev.map(
|
|
4347
5177
|
(item) => item.localId === localId ? { ...item, status: "success", storageFile: result } : item
|
|
@@ -4359,9 +5189,9 @@ function Chat({
|
|
|
4359
5189
|
);
|
|
4360
5190
|
}
|
|
4361
5191
|
},
|
|
4362
|
-
[
|
|
5192
|
+
[uploadContextFile]
|
|
4363
5193
|
);
|
|
4364
|
-
const handleRetryUpload =
|
|
5194
|
+
const handleRetryUpload = React22.useCallback(
|
|
4365
5195
|
(localId) => {
|
|
4366
5196
|
const attachment = attachments.find((a) => a.localId === localId);
|
|
4367
5197
|
if (!attachment || attachment.status !== "error") return;
|
|
@@ -4446,7 +5276,7 @@ function Chat({
|
|
|
4446
5276
|
);
|
|
4447
5277
|
scrollToBottom(true, true);
|
|
4448
5278
|
};
|
|
4449
|
-
const loadConversationMessages =
|
|
5279
|
+
const loadConversationMessages = React22.useCallback(
|
|
4450
5280
|
async (recordId) => {
|
|
4451
5281
|
if (missingConfig) {
|
|
4452
5282
|
setHistoryError(missingConfigShortMessage);
|
|
@@ -4532,18 +5362,18 @@ function Chat({
|
|
|
4532
5362
|
}
|
|
4533
5363
|
};
|
|
4534
5364
|
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 =
|
|
5365
|
+
const currentThread = React22.useMemo(
|
|
4536
5366
|
() => threads.find((item) => item.id === stream.threadId),
|
|
4537
5367
|
[threads, stream.threadId]
|
|
4538
5368
|
);
|
|
4539
5369
|
const errorMessage = stream.error instanceof Error ? stream.error.message : void 0;
|
|
4540
|
-
const threadErrorMessage =
|
|
5370
|
+
const threadErrorMessage = React22.useMemo(() => {
|
|
4541
5371
|
if (currentThread?.status !== "error") return void 0;
|
|
4542
5372
|
const message = currentThread.error?.trim();
|
|
4543
5373
|
return message || t("thread.errorToast");
|
|
4544
5374
|
}, [currentThread, t]);
|
|
4545
5375
|
const assistantTitle = assistantName || resolvedTitle;
|
|
4546
|
-
return /* @__PURE__ */
|
|
5376
|
+
return /* @__PURE__ */ jsxs17(
|
|
4547
5377
|
"div",
|
|
4548
5378
|
{
|
|
4549
5379
|
ref: viewportRef,
|
|
@@ -4552,10 +5382,10 @@ function Chat({
|
|
|
4552
5382
|
className
|
|
4553
5383
|
),
|
|
4554
5384
|
children: [
|
|
4555
|
-
/* @__PURE__ */
|
|
4556
|
-
/* @__PURE__ */
|
|
4557
|
-
/* @__PURE__ */
|
|
4558
|
-
/* @__PURE__ */
|
|
5385
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between border-b p-2 sticky top-0 z-10 bg-background", children: [
|
|
5386
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-3 overflow-hidden", children: [
|
|
5387
|
+
/* @__PURE__ */ jsxs17("div", { className: "relative shrink-0", children: [
|
|
5388
|
+
/* @__PURE__ */ jsx28(
|
|
4559
5389
|
ChatkitAvatar,
|
|
4560
5390
|
{
|
|
4561
5391
|
avatar: assistantAvatar,
|
|
@@ -4563,10 +5393,10 @@ function Chat({
|
|
|
4563
5393
|
label: assistantTitle
|
|
4564
5394
|
}
|
|
4565
5395
|
),
|
|
4566
|
-
/* @__PURE__ */
|
|
5396
|
+
/* @__PURE__ */ jsx28("span", { className: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-green-500" })
|
|
4567
5397
|
] }),
|
|
4568
|
-
/* @__PURE__ */
|
|
4569
|
-
/* @__PURE__ */
|
|
5398
|
+
/* @__PURE__ */ jsxs17("div", { className: "truncate", children: [
|
|
5399
|
+
/* @__PURE__ */ jsx28(
|
|
4570
5400
|
"h2",
|
|
4571
5401
|
{
|
|
4572
5402
|
className: "text-lg font-semibold truncate",
|
|
@@ -4574,11 +5404,11 @@ function Chat({
|
|
|
4574
5404
|
children: assistantTitle
|
|
4575
5405
|
}
|
|
4576
5406
|
),
|
|
4577
|
-
/* @__PURE__ */
|
|
5407
|
+
/* @__PURE__ */ jsx28("p", { className: "text-xs text-muted-foreground", children: t("chat.statusOnline") })
|
|
4578
5408
|
] })
|
|
4579
5409
|
] }),
|
|
4580
|
-
history?.enabled !== false && /* @__PURE__ */
|
|
4581
|
-
/* @__PURE__ */
|
|
5410
|
+
history?.enabled !== false && /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1", children: [
|
|
5411
|
+
/* @__PURE__ */ jsx28(
|
|
4582
5412
|
"button",
|
|
4583
5413
|
{
|
|
4584
5414
|
type: "button",
|
|
@@ -4591,10 +5421,10 @@ function Chat({
|
|
|
4591
5421
|
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
4592
5422
|
),
|
|
4593
5423
|
title: t("history.newThread"),
|
|
4594
|
-
children: /* @__PURE__ */
|
|
5424
|
+
children: /* @__PURE__ */ jsx28(Pencil3, { size: 16 })
|
|
4595
5425
|
}
|
|
4596
5426
|
),
|
|
4597
|
-
/* @__PURE__ */
|
|
5427
|
+
/* @__PURE__ */ jsx28(
|
|
4598
5428
|
HistorySidebar,
|
|
4599
5429
|
{
|
|
4600
5430
|
threads,
|
|
@@ -4608,18 +5438,18 @@ function Chat({
|
|
|
4608
5438
|
)
|
|
4609
5439
|
] })
|
|
4610
5440
|
] }),
|
|
4611
|
-
/* @__PURE__ */
|
|
4612
|
-
errorMessage && /* @__PURE__ */
|
|
4613
|
-
historyError && /* @__PURE__ */
|
|
4614
|
-
showMissingConfig && /* @__PURE__ */
|
|
4615
|
-
isHistoryLoading && /* @__PURE__ */
|
|
4616
|
-
messages.length === 0 ? /* @__PURE__ */
|
|
5441
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex-1 p-4", children: [
|
|
5442
|
+
errorMessage && /* @__PURE__ */ jsx28("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: errorMessage }),
|
|
5443
|
+
historyError && /* @__PURE__ */ jsx28("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: historyError }),
|
|
5444
|
+
showMissingConfig && /* @__PURE__ */ jsx28("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: missingConfigDetailMessage }),
|
|
5445
|
+
isHistoryLoading && /* @__PURE__ */ jsx28("div", { className: "mb-4 rounded-lg border border-muted px-3 py-2 text-sm text-muted-foreground", children: t("chat.loadingThread") }),
|
|
5446
|
+
messages.length === 0 ? /* @__PURE__ */ jsx28(
|
|
4617
5447
|
StartScreen,
|
|
4618
5448
|
{
|
|
4619
5449
|
startScreen,
|
|
4620
5450
|
onPromptClick: handlePromptClick
|
|
4621
5451
|
}
|
|
4622
|
-
) : /* @__PURE__ */
|
|
5452
|
+
) : /* @__PURE__ */ jsxs17("div", { className: "space-y-4", children: [
|
|
4623
5453
|
messages.map((message, index) => {
|
|
4624
5454
|
const messageType = String(message.type);
|
|
4625
5455
|
const isAssistantMessage = messageType === "assistant" || messageType === "ai";
|
|
@@ -4646,7 +5476,7 @@ function Chat({
|
|
|
4646
5476
|
if (!isAssistantMessage && !hasPlainRenderableContent && !hasHumanAttachments && humanReferences.length === 0) {
|
|
4647
5477
|
return null;
|
|
4648
5478
|
}
|
|
4649
|
-
return /* @__PURE__ */
|
|
5479
|
+
return /* @__PURE__ */ jsx28(
|
|
4650
5480
|
"div",
|
|
4651
5481
|
{
|
|
4652
5482
|
className: cn(
|
|
@@ -4654,8 +5484,8 @@ function Chat({
|
|
|
4654
5484
|
message.type === "human" ? "justify-end" : "justify-start -ml-1"
|
|
4655
5485
|
// AI messages: slightly closer to left
|
|
4656
5486
|
),
|
|
4657
|
-
children: /* @__PURE__ */
|
|
4658
|
-
/* @__PURE__ */
|
|
5487
|
+
children: /* @__PURE__ */ jsxs17("div", { className: "flex flex-col px-3 overflow-hidden", children: [
|
|
5488
|
+
/* @__PURE__ */ jsx28(
|
|
4659
5489
|
"div",
|
|
4660
5490
|
{
|
|
4661
5491
|
...canQuoteMessage ? {
|
|
@@ -4667,7 +5497,7 @@ function Chat({
|
|
|
4667
5497
|
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
5498
|
// AI messages: use chat-specific foreground color
|
|
4669
5499
|
),
|
|
4670
|
-
children: isAssistantMessage ? /* @__PURE__ */
|
|
5500
|
+
children: isAssistantMessage ? /* @__PURE__ */ jsx28(
|
|
4671
5501
|
AssistantMessage,
|
|
4672
5502
|
{
|
|
4673
5503
|
message: {
|
|
@@ -4677,8 +5507,8 @@ function Chat({
|
|
|
4677
5507
|
isStreaming: isStreamingMessage,
|
|
4678
5508
|
streamingStatus
|
|
4679
5509
|
}
|
|
4680
|
-
) : /* @__PURE__ */
|
|
4681
|
-
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */
|
|
5510
|
+
) : /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
5511
|
+
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ jsx28("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanReferences.map((reference) => /* @__PURE__ */ jsx28(
|
|
4682
5512
|
ReferenceChip,
|
|
4683
5513
|
{
|
|
4684
5514
|
reference,
|
|
@@ -4686,29 +5516,29 @@ function Chat({
|
|
|
4686
5516
|
},
|
|
4687
5517
|
getReferenceKey(reference)
|
|
4688
5518
|
)) }),
|
|
4689
|
-
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */
|
|
5519
|
+
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ jsx28("div", { className: "flex flex-wrap gap-1.5 mb-2", children: humanAttachments.map((file, fileIndex) => /* @__PURE__ */ jsxs17(
|
|
4690
5520
|
"div",
|
|
4691
5521
|
{
|
|
4692
5522
|
className: "flex items-center gap-1.5 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs",
|
|
4693
5523
|
children: [
|
|
4694
|
-
/* @__PURE__ */
|
|
4695
|
-
/* @__PURE__ */
|
|
5524
|
+
/* @__PURE__ */ jsx28(FileText2, { size: 12 }),
|
|
5525
|
+
/* @__PURE__ */ jsx28("span", { className: "max-w-[100px] truncate", children: file.originalName })
|
|
4696
5526
|
]
|
|
4697
5527
|
},
|
|
4698
5528
|
fileIndex
|
|
4699
5529
|
)) }),
|
|
4700
|
-
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */
|
|
5530
|
+
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ jsx28(
|
|
4701
5531
|
"p",
|
|
4702
5532
|
{
|
|
4703
5533
|
className: "wrap-break-word text-sm leading-relaxed",
|
|
4704
5534
|
children: formatMessageContent(part)
|
|
4705
5535
|
},
|
|
4706
5536
|
`${part.type}-${partIndex}`
|
|
4707
|
-
)) : /* @__PURE__ */
|
|
5537
|
+
)) : /* @__PURE__ */ jsx28("span", { className: "wrap-break-word text-sm leading-relaxed", children: formatMessageContent(message.content) })
|
|
4708
5538
|
] })
|
|
4709
5539
|
}
|
|
4710
5540
|
),
|
|
4711
|
-
/* @__PURE__ */
|
|
5541
|
+
/* @__PURE__ */ jsx28(
|
|
4712
5542
|
MessageActions,
|
|
4713
5543
|
{
|
|
4714
5544
|
content: messageContent,
|
|
@@ -4744,7 +5574,7 @@ function Chat({
|
|
|
4744
5574
|
stream.isLoading,
|
|
4745
5575
|
{ now: streamingNow }
|
|
4746
5576
|
);
|
|
4747
|
-
return /* @__PURE__ */
|
|
5577
|
+
return /* @__PURE__ */ jsx28("div", { className: "flex justify-start gap-3 -ml-2", children: /* @__PURE__ */ jsx28("div", { className: "max-w-full rounded-2xl py-2.5", children: /* @__PURE__ */ jsx28(
|
|
4748
5578
|
AssistantStreamingIndicator,
|
|
4749
5579
|
{
|
|
4750
5580
|
status: fallbackStreamingStatus ?? "loading"
|
|
@@ -4753,7 +5583,7 @@ function Chat({
|
|
|
4753
5583
|
})()
|
|
4754
5584
|
] })
|
|
4755
5585
|
] }),
|
|
4756
|
-
!isAtBottom && messages.length > 0 && /* @__PURE__ */
|
|
5586
|
+
!isAtBottom && messages.length > 0 && /* @__PURE__ */ jsx28("div", { className: "sticky bottom-20 z-20 flex justify-center px-4 pointer-events-none", children: /* @__PURE__ */ jsx28(
|
|
4757
5587
|
Button,
|
|
4758
5588
|
{
|
|
4759
5589
|
type: "button",
|
|
@@ -4766,10 +5596,10 @@ function Chat({
|
|
|
4766
5596
|
onClick: () => scrollToBottom(true, true),
|
|
4767
5597
|
"aria-label": t("chat.scrollToBottom"),
|
|
4768
5598
|
title: t("chat.scrollToBottom"),
|
|
4769
|
-
children: /* @__PURE__ */
|
|
5599
|
+
children: /* @__PURE__ */ jsx28(ArrowDown, { size: 16 })
|
|
4770
5600
|
}
|
|
4771
5601
|
) }),
|
|
4772
|
-
quoteSelection && /* @__PURE__ */
|
|
5602
|
+
quoteSelection && /* @__PURE__ */ jsx28(
|
|
4773
5603
|
"div",
|
|
4774
5604
|
{
|
|
4775
5605
|
className: "pointer-events-none fixed z-50",
|
|
@@ -4778,7 +5608,7 @@ function Chat({
|
|
|
4778
5608
|
left: `${quoteSelection.left}px`,
|
|
4779
5609
|
transform: "translateX(-50%)"
|
|
4780
5610
|
},
|
|
4781
|
-
children: /* @__PURE__ */
|
|
5611
|
+
children: /* @__PURE__ */ jsxs17(
|
|
4782
5612
|
Button,
|
|
4783
5613
|
{
|
|
4784
5614
|
type: "button",
|
|
@@ -4790,16 +5620,16 @@ function Chat({
|
|
|
4790
5620
|
"aria-label": t("composer.quoteSelection"),
|
|
4791
5621
|
title: t("composer.quoteSelection"),
|
|
4792
5622
|
children: [
|
|
4793
|
-
/* @__PURE__ */
|
|
5623
|
+
/* @__PURE__ */ jsx28(Quote, { size: 14 }),
|
|
4794
5624
|
t("composer.quoteSelection")
|
|
4795
5625
|
]
|
|
4796
5626
|
}
|
|
4797
5627
|
)
|
|
4798
5628
|
}
|
|
4799
5629
|
),
|
|
4800
|
-
/* @__PURE__ */
|
|
4801
|
-
threadErrorMessage && /* @__PURE__ */
|
|
4802
|
-
/* @__PURE__ */
|
|
5630
|
+
/* @__PURE__ */ jsxs17("div", { className: "p-2 sticky bottom-0 z-10 bg-background", children: [
|
|
5631
|
+
threadErrorMessage && /* @__PURE__ */ jsx28("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 }),
|
|
5632
|
+
/* @__PURE__ */ jsx28(
|
|
4803
5633
|
"input",
|
|
4804
5634
|
{
|
|
4805
5635
|
ref: fileInputRef,
|
|
@@ -4810,7 +5640,7 @@ function Chat({
|
|
|
4810
5640
|
className: "hidden"
|
|
4811
5641
|
}
|
|
4812
5642
|
),
|
|
4813
|
-
attachments.length > 0 && /* @__PURE__ */
|
|
5643
|
+
attachments.length > 0 && /* @__PURE__ */ jsx28("div", { className: "mb-3 flex flex-wrap gap-2", children: attachments.map((item) => /* @__PURE__ */ jsxs17(
|
|
4814
5644
|
"div",
|
|
4815
5645
|
{
|
|
4816
5646
|
className: cn(
|
|
@@ -4818,16 +5648,16 @@ function Chat({
|
|
|
4818
5648
|
item.status === "error" ? "bg-destructive/10 border border-destructive/30" : "bg-muted"
|
|
4819
5649
|
),
|
|
4820
5650
|
children: [
|
|
4821
|
-
item.status === "uploading" && /* @__PURE__ */
|
|
4822
|
-
|
|
5651
|
+
item.status === "uploading" && /* @__PURE__ */ jsx28(
|
|
5652
|
+
Loader23,
|
|
4823
5653
|
{
|
|
4824
5654
|
size: 14,
|
|
4825
5655
|
className: "animate-spin text-muted-foreground"
|
|
4826
5656
|
}
|
|
4827
5657
|
),
|
|
4828
|
-
item.status === "success" && /* @__PURE__ */
|
|
4829
|
-
item.status === "error" && /* @__PURE__ */
|
|
4830
|
-
/* @__PURE__ */
|
|
5658
|
+
item.status === "success" && /* @__PURE__ */ jsx28(FileText2, { size: 14, className: "text-muted-foreground" }),
|
|
5659
|
+
item.status === "error" && /* @__PURE__ */ jsx28(FileText2, { size: 14, className: "text-destructive" }),
|
|
5660
|
+
/* @__PURE__ */ jsx28(
|
|
4831
5661
|
"span",
|
|
4832
5662
|
{
|
|
4833
5663
|
className: cn(
|
|
@@ -4837,17 +5667,17 @@ function Chat({
|
|
|
4837
5667
|
children: item.file.name
|
|
4838
5668
|
}
|
|
4839
5669
|
),
|
|
4840
|
-
item.status === "error" && /* @__PURE__ */
|
|
5670
|
+
item.status === "error" && /* @__PURE__ */ jsx28(
|
|
4841
5671
|
"button",
|
|
4842
5672
|
{
|
|
4843
5673
|
type: "button",
|
|
4844
5674
|
onClick: () => handleRetryUpload(item.localId),
|
|
4845
5675
|
className: "ml-1 rounded-full p-0.5 text-destructive hover:bg-destructive/20",
|
|
4846
5676
|
title: t("chat.retryUpload"),
|
|
4847
|
-
children: /* @__PURE__ */
|
|
5677
|
+
children: /* @__PURE__ */ jsx28(RefreshCw2, { size: 12 })
|
|
4848
5678
|
}
|
|
4849
5679
|
),
|
|
4850
|
-
/* @__PURE__ */
|
|
5680
|
+
/* @__PURE__ */ jsx28(
|
|
4851
5681
|
"button",
|
|
4852
5682
|
{
|
|
4853
5683
|
type: "button",
|
|
@@ -4856,14 +5686,14 @@ function Chat({
|
|
|
4856
5686
|
"ml-1 rounded-full p-0.5",
|
|
4857
5687
|
item.status === "error" ? "text-destructive hover:bg-destructive/20" : "hover:bg-muted-foreground/20"
|
|
4858
5688
|
),
|
|
4859
|
-
children: /* @__PURE__ */
|
|
5689
|
+
children: /* @__PURE__ */ jsx28(X3, { size: 12 })
|
|
4860
5690
|
}
|
|
4861
5691
|
)
|
|
4862
5692
|
]
|
|
4863
5693
|
},
|
|
4864
5694
|
item.localId
|
|
4865
5695
|
)) }),
|
|
4866
|
-
references.length > 0 && /* @__PURE__ */
|
|
5696
|
+
references.length > 0 && /* @__PURE__ */ jsx28("div", { className: "mb-3 flex flex-wrap gap-2", children: references.map((reference) => /* @__PURE__ */ jsx28(
|
|
4867
5697
|
ReferenceChip,
|
|
4868
5698
|
{
|
|
4869
5699
|
reference,
|
|
@@ -4877,19 +5707,19 @@ function Chat({
|
|
|
4877
5707
|
},
|
|
4878
5708
|
getReferenceKey(reference)
|
|
4879
5709
|
)) }),
|
|
4880
|
-
selectedTool && /* @__PURE__ */
|
|
4881
|
-
/* @__PURE__ */
|
|
4882
|
-
/* @__PURE__ */
|
|
5710
|
+
selectedTool && /* @__PURE__ */ jsxs17("div", { className: "mb-2 flex items-center gap-2", children: [
|
|
5711
|
+
/* @__PURE__ */ jsx28("span", { className: "rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary", children: selectedTool.shortLabel ?? selectedTool.label }),
|
|
5712
|
+
/* @__PURE__ */ jsx28(
|
|
4883
5713
|
"button",
|
|
4884
5714
|
{
|
|
4885
5715
|
type: "button",
|
|
4886
5716
|
onClick: () => setSelectedTool(null),
|
|
4887
5717
|
className: "rounded-full p-0.5 text-muted-foreground hover:bg-muted",
|
|
4888
|
-
children: /* @__PURE__ */
|
|
5718
|
+
children: /* @__PURE__ */ jsx28(X3, { size: 12 })
|
|
4889
5719
|
}
|
|
4890
5720
|
)
|
|
4891
5721
|
] }),
|
|
4892
|
-
/* @__PURE__ */
|
|
5722
|
+
/* @__PURE__ */ jsx28(
|
|
4893
5723
|
PendingFollowUps,
|
|
4894
5724
|
{
|
|
4895
5725
|
items: pendingFollowUps,
|
|
@@ -4903,7 +5733,7 @@ function Chat({
|
|
|
4903
5733
|
onRemove: stream.removePendingFollowUp
|
|
4904
5734
|
}
|
|
4905
5735
|
),
|
|
4906
|
-
/* @__PURE__ */
|
|
5736
|
+
/* @__PURE__ */ jsx28("form", { className: "flex items-end", onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs17(
|
|
4907
5737
|
"div",
|
|
4908
5738
|
{
|
|
4909
5739
|
className: cn(
|
|
@@ -4915,7 +5745,7 @@ function Chat({
|
|
|
4915
5745
|
getRoundedClass(theme.radius)
|
|
4916
5746
|
),
|
|
4917
5747
|
children: [
|
|
4918
|
-
/* @__PURE__ */
|
|
5748
|
+
/* @__PURE__ */ jsx28(
|
|
4919
5749
|
ComposerMenu,
|
|
4920
5750
|
{
|
|
4921
5751
|
composer,
|
|
@@ -4925,12 +5755,13 @@ function Chat({
|
|
|
4925
5755
|
disabled: missingConfig || isHistoryLoading
|
|
4926
5756
|
}
|
|
4927
5757
|
),
|
|
4928
|
-
/* @__PURE__ */
|
|
5758
|
+
/* @__PURE__ */ jsx28(
|
|
4929
5759
|
"textarea",
|
|
4930
5760
|
{
|
|
4931
5761
|
ref: composerInputRef,
|
|
4932
5762
|
value: draft,
|
|
4933
5763
|
onChange: (event) => setDraft(event.target.value),
|
|
5764
|
+
onPaste: handleComposerPaste,
|
|
4934
5765
|
onKeyDown: handleComposerKeyDown,
|
|
4935
5766
|
rows: 1,
|
|
4936
5767
|
placeholder: inputPlaceholder,
|
|
@@ -4942,7 +5773,7 @@ function Chat({
|
|
|
4942
5773
|
)
|
|
4943
5774
|
}
|
|
4944
5775
|
),
|
|
4945
|
-
/* @__PURE__ */
|
|
5776
|
+
/* @__PURE__ */ jsx28(
|
|
4946
5777
|
SendButton,
|
|
4947
5778
|
{
|
|
4948
5779
|
disabled: isSendDisabled,
|
|
@@ -4950,13 +5781,23 @@ function Chat({
|
|
|
4950
5781
|
showStop: stream.isLoading && !trimmedDraft,
|
|
4951
5782
|
onStop: () => stream.stop(),
|
|
4952
5783
|
stopLabel: t("chat.stop"),
|
|
4953
|
-
sendLabel: t("chat.send")
|
|
5784
|
+
sendLabel: t("chat.send"),
|
|
5785
|
+
shortcuts: stream.isLoading && trimmedDraft ? [
|
|
5786
|
+
{
|
|
5787
|
+
label: t("chat.followUps.steer"),
|
|
5788
|
+
keys: followUpShortcutLabels.steer
|
|
5789
|
+
},
|
|
5790
|
+
{
|
|
5791
|
+
label: t("chat.followUps.queue"),
|
|
5792
|
+
keys: followUpShortcutLabels.queue
|
|
5793
|
+
}
|
|
5794
|
+
] : void 0
|
|
4954
5795
|
}
|
|
4955
5796
|
)
|
|
4956
5797
|
]
|
|
4957
5798
|
}
|
|
4958
5799
|
) }),
|
|
4959
|
-
disclaimer?.text && /* @__PURE__ */
|
|
5800
|
+
disclaimer?.text && /* @__PURE__ */ jsx28(
|
|
4960
5801
|
"p",
|
|
4961
5802
|
{
|
|
4962
5803
|
className: cn(
|
|
@@ -4966,9 +5807,9 @@ function Chat({
|
|
|
4966
5807
|
children: disclaimer.text
|
|
4967
5808
|
}
|
|
4968
5809
|
),
|
|
4969
|
-
/* @__PURE__ */
|
|
4970
|
-
/* @__PURE__ */
|
|
4971
|
-
/* @__PURE__ */
|
|
5810
|
+
/* @__PURE__ */ jsxs17("div", { className: "mt-2 flex items-center justify-center gap-2 text-xs text-muted-foreground", children: [
|
|
5811
|
+
/* @__PURE__ */ jsx28("span", { children: t("chat.poweredBy") }),
|
|
5812
|
+
/* @__PURE__ */ jsx28(ContextUsageIndicator, { className: "absolute right-4" })
|
|
4972
5813
|
] })
|
|
4973
5814
|
] })
|
|
4974
5815
|
]
|
|
@@ -4977,11 +5818,11 @@ function Chat({
|
|
|
4977
5818
|
}
|
|
4978
5819
|
|
|
4979
5820
|
// src/components/ui/input.tsx
|
|
4980
|
-
import * as
|
|
4981
|
-
import { jsx as
|
|
4982
|
-
var Input =
|
|
5821
|
+
import * as React23 from "react";
|
|
5822
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
5823
|
+
var Input = React23.forwardRef(
|
|
4983
5824
|
({ className, type, ...props }, ref) => {
|
|
4984
|
-
return /* @__PURE__ */
|
|
5825
|
+
return /* @__PURE__ */ jsx29(
|
|
4985
5826
|
"input",
|
|
4986
5827
|
{
|
|
4987
5828
|
ref,
|
|
@@ -4998,10 +5839,10 @@ var Input = React22.forwardRef(
|
|
|
4998
5839
|
Input.displayName = "Input";
|
|
4999
5840
|
|
|
5000
5841
|
// src/components/ui/separator.tsx
|
|
5001
|
-
import * as
|
|
5002
|
-
import { jsx as
|
|
5003
|
-
var Separator =
|
|
5004
|
-
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */
|
|
5842
|
+
import * as React24 from "react";
|
|
5843
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
5844
|
+
var Separator = React24.forwardRef(
|
|
5845
|
+
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ jsx30(
|
|
5005
5846
|
"div",
|
|
5006
5847
|
{
|
|
5007
5848
|
ref,
|