@btst/stack 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -37
- package/dist/node_modules/.pnpm/{@radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.2_@types_react@19.2.2__@types_ec789942cd38340bd7362c09e7d34384 → @radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.3_@types_react@19.2.6__@types_4f58c757aa677e233cf96d60fda2f1da}/node_modules/@radix-ui/react-alert-dialog/dist/index.cjs +2 -2
- package/dist/node_modules/.pnpm/{@radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.2_@types_react@19.2.2__@types_ec789942cd38340bd7362c09e7d34384 → @radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.3_@types_react@19.2.6__@types_4f58c757aa677e233cf96d60fda2f1da}/node_modules/@radix-ui/react-alert-dialog/dist/index.mjs +2 -2
- package/dist/node_modules/.pnpm/{@radix-ui_react-arrow@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@1_9e04309f365863673e44407648bb0cb6 → @radix-ui_react-arrow@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@1_35df44f6d87656c1401686c91d770dbb}/node_modules/@radix-ui/react-arrow/dist/index.cjs +1 -1
- package/dist/node_modules/.pnpm/{@radix-ui_react-arrow@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@1_9e04309f365863673e44407648bb0cb6 → @radix-ui_react-arrow@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@1_35df44f6d87656c1401686c91d770dbb}/node_modules/@radix-ui/react-arrow/dist/index.mjs +1 -1
- package/dist/node_modules/.pnpm/{@radix-ui_react-collection@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_re_6d7c277722b3619c9ee7e64e9a822c45 → @radix-ui_react-collection@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_re_59aa5e150e70a3e7bfb1567148b021b5}/node_modules/@radix-ui/react-collection/dist/index.cjs +2 -2
- package/dist/node_modules/.pnpm/{@radix-ui_react-collection@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_re_6d7c277722b3619c9ee7e64e9a822c45 → @radix-ui_react-collection@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_re_59aa5e150e70a3e7bfb1567148b021b5}/node_modules/@radix-ui/react-collection/dist/index.mjs +2 -2
- package/dist/node_modules/.pnpm/{@radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.2_@types_react@19.2.2__@_ca5522e5d45d4722cb9eb5ce53defa61 → @radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@_9ee1db7daf927866cf505b31d40047ad}/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs +4 -4
- package/dist/node_modules/.pnpm/{@radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.2_@types_react@19.2.2__@_ca5522e5d45d4722cb9eb5ce53defa61 → @radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@_9ee1db7daf927866cf505b31d40047ad}/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs +4 -4
- package/dist/node_modules/.pnpm/@radix-ui_react-dropdown-menu@2.1.16_@types_react-dom@19.2.3_@types_react@19.2.6__@type_a50051c7210b6fbd5be09388bda08578/node_modules/@radix-ui/react-dropdown-menu/dist/index.cjs +282 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-dropdown-menu@2.1.16_@types_react-dom@19.2.3_@types_react@19.2.6__@type_a50051c7210b6fbd5be09388bda08578/node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs +247 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_r_93de389b3f622f9f764acc8e59ec80c0 → @radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_r_0a31b7f987af9482d13505312e1a1be9}/node_modules/@radix-ui/react-focus-scope/dist/index.cjs +3 -3
- package/dist/node_modules/.pnpm/{@radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_r_93de389b3f622f9f764acc8e59ec80c0 → @radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_r_0a31b7f987af9482d13505312e1a1be9}/node_modules/@radix-ui/react-focus-scope/dist/index.mjs +3 -3
- package/dist/node_modules/.pnpm/{@radix-ui_react-id@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-id@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-id/dist/index.cjs +1 -1
- package/dist/node_modules/.pnpm/{@radix-ui_react-id@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-id@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-id/dist/index.mjs +1 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-menu@2.1.16_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@1_82ed1fcd848b6984d9291a784d477cf4/node_modules/@radix-ui/react-menu/dist/index.cjs +845 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-menu@2.1.16_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@1_82ed1fcd848b6984d9291a784d477cf4/node_modules/@radix-ui/react-menu/dist/index.mjs +799 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-popper@1.2.8_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_d6285b8269ea5d6b59b300f5be279a0c → @radix-ui_react-popper@1.2.8_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_7ac2caae1e39f9ba93d5015614525161}/node_modules/@radix-ui/react-popper/dist/index.cjs +7 -7
- package/dist/node_modules/.pnpm/{@radix-ui_react-popper@1.2.8_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_d6285b8269ea5d6b59b300f5be279a0c → @radix-ui_react-popper@1.2.8_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_7ac2caae1e39f9ba93d5015614525161}/node_modules/@radix-ui/react-popper/dist/index.mjs +7 -7
- package/dist/node_modules/.pnpm/{@radix-ui_react-portal@1.1.9_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_478b3d5dd4afab1a3dcce7ed1748cb95 → @radix-ui_react-portal@1.1.9_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_1bb4e0f97f86496802d28a2e74e2a8b9}/node_modules/@radix-ui/react-portal/dist/index.cjs +2 -2
- package/dist/node_modules/.pnpm/{@radix-ui_react-portal@1.1.9_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_478b3d5dd4afab1a3dcce7ed1748cb95 → @radix-ui_react-portal@1.1.9_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_1bb4e0f97f86496802d28a2e74e2a8b9}/node_modules/@radix-ui/react-portal/dist/index.mjs +2 -2
- package/dist/node_modules/.pnpm/@radix-ui_react-presence@1.1.5_@types_react-dom@19.2.3_@types_react@19.2.6__@types_reac_90f8e5c12233caef3399d5fd66452a13/node_modules/@radix-ui/react-presence/dist/index.cjs +147 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-presence@1.1.5_@types_react-dom@19.2.3_@types_react@19.2.6__@types_reac_90f8e5c12233caef3399d5fd66452a13/node_modules/@radix-ui/react-presence/dist/index.mjs +131 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-roving-focus@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@types_fe1151d1f393bbc1072b24a86dff3a23/node_modules/@radix-ui/react-roving-focus/dist/index.cjs +244 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-roving-focus@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@types_fe1151d1f393bbc1072b24a86dff3a23/node_modules/@radix-ui/react-roving-focus/dist/index.mjs +224 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-scroll-area@1.2.10_@types_react-dom@19.2.3_@types_react@19.2.6__@types__e3f7735e9b444a10b3bbfd9fe97d44d0/node_modules/@radix-ui/react-scroll-area/dist/index.cjs +742 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-scroll-area@1.2.10_@types_react-dom@19.2.3_@types_react@19.2.6__@types__e3f7735e9b444a10b3bbfd9fe97d44d0/node_modules/@radix-ui/react-scroll-area/dist/index.mjs +719 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-select@2.2.6_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_802c3d414c85063bee785fcc98a39c07 → @radix-ui_react-select@2.2.6_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_38dc681bb1f2bcfeb5249d8ca2bc01f5}/node_modules/@radix-ui/react-select/dist/index.cjs +17 -17
- package/dist/node_modules/.pnpm/{@radix-ui_react-select@2.2.6_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_802c3d414c85063bee785fcc98a39c07 → @radix-ui_react-select@2.2.6_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_38dc681bb1f2bcfeb5249d8ca2bc01f5}/node_modules/@radix-ui/react-select/dist/index.mjs +17 -17
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs +1 -1
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs +1 -1
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-escape-keydown/dist/index.cjs +1 -1
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs +1 -1
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-size@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-size@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-size/dist/index.cjs +1 -1
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-size@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-size@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-size/dist/index.mjs +1 -1
- package/dist/node_modules/.pnpm/{@radix-ui_react-visually-hidden@1.2.3_@types_react-dom@19.2.2_@types_react@19.2.2__@typ_a84e98a44624c31e835a98d4b8b0c30d → @radix-ui_react-visually-hidden@1.2.3_@types_react-dom@19.2.3_@types_react@19.2.6__@typ_f453379bbd5a4932ec515167f81be42a}/node_modules/@radix-ui/react-visually-hidden/dist/index.cjs +1 -1
- package/dist/node_modules/.pnpm/{@radix-ui_react-visually-hidden@1.2.3_@types_react-dom@19.2.2_@types_react@19.2.2__@typ_a84e98a44624c31e835a98d4b8b0c30d → @radix-ui_react-visually-hidden@1.2.3_@types_react-dom@19.2.3_@types_react@19.2.6__@typ_f453379bbd5a4932ec515167f81be42a}/node_modules/@radix-ui/react-visually-hidden/dist/index.mjs +1 -1
- package/dist/node_modules/.pnpm/{react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0 → react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll-bar/dist/es2015/component.cjs +1 -1
- package/dist/node_modules/.pnpm/{react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0 → react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll-bar/dist/es2015/component.mjs +1 -1
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs +2 -2
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/SideEffect.mjs +2 -2
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/UI.cjs +2 -2
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/UI.mjs +2 -2
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/medium.cjs +1 -1
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/medium.mjs +1 -1
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/sidecar.cjs +9 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/sidecar.mjs +1 -1
- package/dist/packages/better-stack/src/plugins/ai-chat/api/plugin.cjs +610 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/api/plugin.mjs +608 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-input.cjs +221 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-input.mjs +219 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-interface.cjs +315 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-interface.mjs +313 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-layout.cjs +122 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-layout.mjs +120 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-message.cjs +397 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-message.mjs +391 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-sidebar.cjs +227 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-sidebar.mjs +225 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/loading/chat-page-skeleton.cjs +31 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/loading/chat-page-skeleton.mjs +29 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/loading/index.cjs +11 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/loading/index.mjs +8 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/404-page.cjs +18 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/404-page.mjs +16 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/chat-page.cjs +39 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/chat-page.internal.cjs +22 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/chat-page.internal.mjs +20 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/chat-page.mjs +37 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/shared/default-error.cjs +18 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/shared/default-error.mjs +16 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/shared/error-placeholder.cjs +26 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/shared/error-placeholder.mjs +24 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/hooks/chat-hooks.cjs +199 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/hooks/chat-hooks.mjs +191 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/localization/index.cjs +63 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/localization/index.mjs +61 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/overrides.cjs +14 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/overrides.mjs +11 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/plugin.cjs +241 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/plugin.mjs +239 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/db.cjs +65 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/db.mjs +63 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/schemas.cjs +42 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/schemas.mjs +38 -0
- package/dist/packages/better-stack/src/plugins/blog/client/components/shared/markdown-content.cjs +12 -309
- package/dist/packages/better-stack/src/plugins/blog/client/components/shared/markdown-content.mjs +13 -303
- package/dist/packages/better-stack/src/plugins/blog/client/components/shared/page-wrapper.cjs +2 -2
- package/dist/packages/better-stack/src/plugins/blog/client/components/shared/page-wrapper.mjs +2 -2
- package/dist/packages/ui/src/components/alert-dialog.cjs +1 -1
- package/dist/packages/ui/src/components/alert-dialog.mjs +1 -1
- package/dist/packages/{better-stack/src/plugins/blog/client/components/shared/better-blog-attribution.cjs → ui/src/components/better-stack-attribution.cjs} +3 -3
- package/dist/packages/{better-stack/src/plugins/blog/client/components/shared/better-blog-attribution.mjs → ui/src/components/better-stack-attribution.mjs} +3 -3
- package/dist/packages/ui/src/components/dialog.cjs +14 -0
- package/dist/packages/ui/src/components/dialog.mjs +14 -1
- package/dist/packages/ui/src/components/dropdown-menu.cjs +67 -0
- package/dist/packages/ui/src/components/dropdown-menu.mjs +62 -0
- package/dist/packages/ui/src/components/markdown-content.cjs +306 -0
- package/dist/packages/ui/src/components/markdown-content.mjs +297 -0
- package/dist/packages/ui/src/components/scroll-area.cjs +63 -0
- package/dist/packages/ui/src/components/scroll-area.mjs +60 -0
- package/dist/packages/ui/src/components/select.cjs +1 -1
- package/dist/packages/ui/src/components/select.mjs +1 -1
- package/dist/packages/ui/src/components/sheet.cjs +87 -0
- package/dist/packages/ui/src/components/sheet.mjs +69 -0
- package/dist/plugins/ai-chat/api/index.cjs +9 -0
- package/dist/plugins/ai-chat/api/index.d.cts +9 -0
- package/dist/plugins/ai-chat/api/index.d.mts +9 -0
- package/dist/plugins/ai-chat/api/index.d.ts +9 -0
- package/dist/plugins/ai-chat/api/index.mjs +2 -0
- package/dist/plugins/ai-chat/client/components/index.cjs +27 -0
- package/dist/plugins/ai-chat/client/components/index.d.cts +30 -0
- package/dist/plugins/ai-chat/client/components/index.d.mts +30 -0
- package/dist/plugins/ai-chat/client/components/index.d.ts +30 -0
- package/dist/plugins/ai-chat/client/components/index.mjs +11 -0
- package/dist/plugins/ai-chat/client/hooks/index.cjs +13 -0
- package/dist/plugins/ai-chat/client/hooks/index.d.cts +98 -0
- package/dist/plugins/ai-chat/client/hooks/index.d.mts +98 -0
- package/dist/plugins/ai-chat/client/hooks/index.d.ts +98 -0
- package/dist/plugins/ai-chat/client/hooks/index.mjs +1 -0
- package/dist/plugins/ai-chat/client/index.cjs +19 -0
- package/dist/plugins/ai-chat/client/index.d.cts +327 -0
- package/dist/plugins/ai-chat/client/index.d.mts +327 -0
- package/dist/plugins/ai-chat/client/index.d.ts +327 -0
- package/dist/plugins/ai-chat/client/index.mjs +7 -0
- package/dist/plugins/ai-chat/client.css +6 -0
- package/dist/plugins/ai-chat/query-keys.cjs +60 -0
- package/dist/plugins/ai-chat/query-keys.d.cts +478 -0
- package/dist/plugins/ai-chat/query-keys.d.mts +478 -0
- package/dist/plugins/ai-chat/query-keys.d.ts +478 -0
- package/dist/plugins/ai-chat/query-keys.mjs +58 -0
- package/dist/plugins/ai-chat/style.css +19 -0
- package/dist/plugins/blog/api/index.d.cts +1 -1
- package/dist/plugins/blog/api/index.d.mts +1 -1
- package/dist/plugins/blog/api/index.d.ts +1 -1
- package/dist/plugins/blog/client/components/shared/markdown-content-styles.css +85 -62
- package/dist/plugins/blog/client/hooks/index.d.cts +4 -4
- package/dist/plugins/blog/client/hooks/index.d.mts +4 -4
- package/dist/plugins/blog/client/hooks/index.d.ts +4 -4
- package/dist/plugins/blog/client/index.d.cts +1 -1
- package/dist/plugins/blog/client/index.d.mts +1 -1
- package/dist/plugins/blog/client/index.d.ts +1 -1
- package/dist/plugins/blog/query-keys.d.cts +7 -7
- package/dist/plugins/blog/query-keys.d.mts +7 -7
- package/dist/plugins/blog/query-keys.d.ts +7 -7
- package/dist/shared/stack.Be1QIHEn.d.cts +23 -0
- package/dist/shared/stack.Be1QIHEn.d.mts +23 -0
- package/dist/shared/stack.Be1QIHEn.d.ts +23 -0
- package/dist/shared/stack.DorMi9CZ.d.cts +80 -0
- package/dist/shared/stack.DorMi9CZ.d.mts +80 -0
- package/dist/shared/stack.DorMi9CZ.d.ts +80 -0
- package/package.json +59 -1
- package/src/plugins/ai-chat/api/index.ts +2 -0
- package/src/plugins/ai-chat/api/plugin.ts +1083 -0
- package/src/plugins/ai-chat/client/components/chat-input.tsx +295 -0
- package/src/plugins/ai-chat/client/components/chat-interface.tsx +455 -0
- package/src/plugins/ai-chat/client/components/chat-layout.tsx +160 -0
- package/src/plugins/ai-chat/client/components/chat-message.tsx +505 -0
- package/src/plugins/ai-chat/client/components/chat-sidebar.tsx +296 -0
- package/src/plugins/ai-chat/client/components/index.ts +16 -0
- package/src/plugins/ai-chat/client/components/loading/chat-page-skeleton.tsx +57 -0
- package/src/plugins/ai-chat/client/components/loading/index.tsx +11 -0
- package/src/plugins/ai-chat/client/components/pages/404-page.tsx +27 -0
- package/src/plugins/ai-chat/client/components/pages/chat-page.internal.tsx +31 -0
- package/src/plugins/ai-chat/client/components/pages/chat-page.tsx +46 -0
- package/src/plugins/ai-chat/client/components/shared/default-error.tsx +28 -0
- package/src/plugins/ai-chat/client/components/shared/error-placeholder.tsx +22 -0
- package/src/plugins/ai-chat/client/hooks/chat-hooks.tsx +349 -0
- package/src/plugins/ai-chat/client/hooks/index.tsx +1 -0
- package/src/plugins/ai-chat/client/index.ts +14 -0
- package/src/plugins/ai-chat/client/localization/index.ts +156 -0
- package/src/plugins/ai-chat/client/overrides.ts +170 -0
- package/src/plugins/ai-chat/client/plugin.tsx +449 -0
- package/src/plugins/ai-chat/client.css +6 -0
- package/src/plugins/ai-chat/db.ts +65 -0
- package/src/plugins/ai-chat/query-keys.ts +87 -0
- package/src/plugins/ai-chat/schemas.ts +40 -0
- package/src/plugins/ai-chat/style.css +19 -0
- package/src/plugins/ai-chat/types.ts +29 -0
- package/src/plugins/blog/client/components/shared/markdown-content-styles.css +85 -62
- package/src/plugins/blog/client/components/shared/markdown-content.tsx +19 -427
- package/src/plugins/blog/client/components/shared/page-wrapper.tsx +2 -2
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/sidecar.cjs +0 -9
- package/src/plugins/blog/client/components/shared/better-blog-attribution.tsx +0 -19
- package/dist/node_modules/.pnpm/{@radix-ui_react-compose-refs@1.1.2_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-compose-refs@1.1.2_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-compose-refs@1.1.2_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-compose-refs@1.1.2_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-compose-refs/dist/index.mjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-context@1.1.2_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-context@1.1.2_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-context/dist/index.cjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-context@1.1.2_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-context@1.1.2_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-context/dist/index.mjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-direction@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-direction@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-direction/dist/index.cjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-direction@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-direction@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-direction/dist/index.mjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-focus-guards@1.1.3_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-focus-guards@1.1.3_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-focus-guards/dist/index.cjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-focus-guards@1.1.3_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-focus-guards@1.1.3_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-focus-guards/dist/index.mjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.2_@types_react@19.2.2__@types_rea_bdc15f10281778271ffcbe8dd3cd491e → @radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_rea_a92a69cb1cb39305138539e4fa72f596}/node_modules/@radix-ui/react-primitive/dist/index.cjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.2_@types_react@19.2.2__@types_rea_bdc15f10281778271ffcbe8dd3cd491e → @radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_rea_a92a69cb1cb39305138539e4fa72f596}/node_modules/@radix-ui/react-primitive/dist/index.mjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-previous@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-previous@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-previous/dist/index.cjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-previous@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-previous@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-previous/dist/index.mjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0 → react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll-bar/dist/es2015/constants.cjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0 → react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll-bar/dist/es2015/constants.mjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0 → react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll-bar/dist/es2015/utils.cjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0 → react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll-bar/dist/es2015/utils.mjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/Combination.cjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/Combination.mjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.cjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.mjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/handleScroll.cjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/handleScroll.mjs +0 -0
- package/dist/node_modules/.pnpm/{react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0 → react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0}/node_modules/react-style-singleton/dist/es2015/component.cjs +0 -0
- package/dist/node_modules/.pnpm/{react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0 → react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0}/node_modules/react-style-singleton/dist/es2015/component.mjs +0 -0
- package/dist/node_modules/.pnpm/{react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0 → react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0}/node_modules/react-style-singleton/dist/es2015/hook.cjs +0 -0
- package/dist/node_modules/.pnpm/{react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0 → react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0}/node_modules/react-style-singleton/dist/es2015/hook.mjs +0 -0
- package/dist/node_modules/.pnpm/{react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0 → react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0}/node_modules/react-style-singleton/dist/es2015/singleton.cjs +0 -0
- package/dist/node_modules/.pnpm/{react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0 → react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0}/node_modules/react-style-singleton/dist/es2015/singleton.mjs +0 -0
- package/dist/node_modules/.pnpm/{use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0 → use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-callback-ref/dist/es2015/assignRef.cjs +0 -0
- package/dist/node_modules/.pnpm/{use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0 → use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-callback-ref/dist/es2015/assignRef.mjs +0 -0
- package/dist/node_modules/.pnpm/{use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0 → use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-callback-ref/dist/es2015/useMergeRef.cjs +0 -0
- package/dist/node_modules/.pnpm/{use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0 → use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-callback-ref/dist/es2015/useMergeRef.mjs +0 -0
- package/dist/node_modules/.pnpm/{use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0 → use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-callback-ref/dist/es2015/useRef.cjs +0 -0
- package/dist/node_modules/.pnpm/{use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0 → use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-callback-ref/dist/es2015/useRef.mjs +0 -0
- package/dist/node_modules/.pnpm/{use-sidecar@1.1.3_@types_react@19.2.2_react@19.2.0 → use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-sidecar/dist/es2015/exports.cjs +0 -0
- package/dist/node_modules/.pnpm/{use-sidecar@1.1.3_@types_react@19.2.2_react@19.2.0 → use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-sidecar/dist/es2015/exports.mjs +0 -0
- package/dist/node_modules/.pnpm/{use-sidecar@1.1.3_@types_react@19.2.2_react@19.2.0 → use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-sidecar/dist/es2015/medium.cjs +0 -0
- package/dist/node_modules/.pnpm/{use-sidecar@1.1.3_@types_react@19.2.2_react@19.2.0 → use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-sidecar/dist/es2015/medium.mjs +0 -0
- package/dist/shared/{stack.CbuN2zVV.d.ts → stack.CcI4sYJP.d.cts} +3 -3
- package/dist/shared/{stack.CbuN2zVV.d.cts → stack.CcI4sYJP.d.mts} +3 -3
- package/dist/shared/{stack.CbuN2zVV.d.mts → stack.CcI4sYJP.d.ts} +3 -3
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
const React = require('react');
|
|
6
|
+
const button = require('../../../../../../ui/src/components/button.cjs');
|
|
7
|
+
const sheet = require('../../../../../../ui/src/components/sheet.cjs');
|
|
8
|
+
const lucideReact = require('lucide-react');
|
|
9
|
+
const utils = require('../../../../../../ui/src/lib/utils.cjs');
|
|
10
|
+
const chatSidebar = require('./chat-sidebar.cjs');
|
|
11
|
+
const chatInterface = require('./chat-interface.cjs');
|
|
12
|
+
|
|
13
|
+
function ChatLayout({
|
|
14
|
+
apiBaseURL,
|
|
15
|
+
apiBasePath,
|
|
16
|
+
conversationId,
|
|
17
|
+
layout = "full",
|
|
18
|
+
className,
|
|
19
|
+
showSidebar = true,
|
|
20
|
+
widgetHeight = "600px"
|
|
21
|
+
}) {
|
|
22
|
+
const [sidebarOpen, setSidebarOpen] = React.useState(true);
|
|
23
|
+
const [mobileSidebarOpen, setMobileSidebarOpen] = React.useState(false);
|
|
24
|
+
const [chatResetKey, setChatResetKey] = React.useState(0);
|
|
25
|
+
const apiPath = `${apiBaseURL}${apiBasePath}/chat`;
|
|
26
|
+
const handleNewChat = React.useCallback(() => {
|
|
27
|
+
if (!conversationId) {
|
|
28
|
+
setChatResetKey((prev) => prev + 1);
|
|
29
|
+
}
|
|
30
|
+
}, [conversationId]);
|
|
31
|
+
if (layout === "widget") {
|
|
32
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
className: utils.cn(
|
|
36
|
+
"flex flex-col w-full border rounded-xl overflow-hidden bg-background shadow-sm",
|
|
37
|
+
className
|
|
38
|
+
),
|
|
39
|
+
style: { height: widgetHeight },
|
|
40
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(chatInterface.ChatInterface, { apiPath, id: conversationId, variant: "widget" })
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
className: utils.cn(
|
|
48
|
+
"flex h-[calc(100vh-4rem)] w-full overflow-hidden",
|
|
49
|
+
className
|
|
50
|
+
),
|
|
51
|
+
"data-testid": "chat-layout",
|
|
52
|
+
children: [
|
|
53
|
+
showSidebar && /* @__PURE__ */ jsxRuntime.jsx(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
className: utils.cn(
|
|
57
|
+
"hidden md:flex transition-all duration-300 ease-in-out",
|
|
58
|
+
sidebarOpen ? "w-72" : "w-0"
|
|
59
|
+
),
|
|
60
|
+
children: sidebarOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
61
|
+
chatSidebar.ChatSidebar,
|
|
62
|
+
{
|
|
63
|
+
currentConversationId: conversationId,
|
|
64
|
+
onNewChat: handleNewChat,
|
|
65
|
+
className: "w-72"
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
71
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 p-2 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60", children: [
|
|
72
|
+
showSidebar && /* @__PURE__ */ jsxRuntime.jsxs(sheet.Sheet, { open: mobileSidebarOpen, onOpenChange: setMobileSidebarOpen, children: [
|
|
73
|
+
/* @__PURE__ */ jsxRuntime.jsx(sheet.SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
74
|
+
button.Button,
|
|
75
|
+
{
|
|
76
|
+
variant: "ghost",
|
|
77
|
+
size: "icon",
|
|
78
|
+
className: "md:hidden",
|
|
79
|
+
"aria-label": "Open menu",
|
|
80
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Menu, { className: "h-5 w-5" })
|
|
81
|
+
}
|
|
82
|
+
) }),
|
|
83
|
+
/* @__PURE__ */ jsxRuntime.jsx(sheet.SheetContent, { side: "left", className: "p-0 w-72", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
84
|
+
chatSidebar.ChatSidebar,
|
|
85
|
+
{
|
|
86
|
+
currentConversationId: conversationId,
|
|
87
|
+
onNewChat: () => {
|
|
88
|
+
handleNewChat();
|
|
89
|
+
setMobileSidebarOpen(false);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
) })
|
|
93
|
+
] }),
|
|
94
|
+
showSidebar && /* @__PURE__ */ jsxRuntime.jsx(
|
|
95
|
+
button.Button,
|
|
96
|
+
{
|
|
97
|
+
variant: "ghost",
|
|
98
|
+
size: "icon",
|
|
99
|
+
className: "hidden md:flex",
|
|
100
|
+
onClick: () => setSidebarOpen(!sidebarOpen),
|
|
101
|
+
"aria-label": sidebarOpen ? "Close sidebar" : "Open sidebar",
|
|
102
|
+
children: sidebarOpen ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelLeftClose, { className: "h-5 w-5" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelLeft, { className: "h-5 w-5" })
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1" })
|
|
106
|
+
] }),
|
|
107
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
108
|
+
chatInterface.ChatInterface,
|
|
109
|
+
{
|
|
110
|
+
apiPath,
|
|
111
|
+
id: conversationId,
|
|
112
|
+
variant: "full"
|
|
113
|
+
},
|
|
114
|
+
`chat-${conversationId ?? "new"}-${chatResetKey}`
|
|
115
|
+
)
|
|
116
|
+
] })
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
exports.ChatLayout = ChatLayout;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useCallback } from 'react';
|
|
4
|
+
import { Button } from '../../../../../../ui/src/components/button.mjs';
|
|
5
|
+
import { Sheet, SheetTrigger, SheetContent } from '../../../../../../ui/src/components/sheet.mjs';
|
|
6
|
+
import { Menu, PanelLeftClose, PanelLeft } from 'lucide-react';
|
|
7
|
+
import { cn } from '../../../../../../ui/src/lib/utils.mjs';
|
|
8
|
+
import { ChatSidebar } from './chat-sidebar.mjs';
|
|
9
|
+
import { ChatInterface } from './chat-interface.mjs';
|
|
10
|
+
|
|
11
|
+
function ChatLayout({
|
|
12
|
+
apiBaseURL,
|
|
13
|
+
apiBasePath,
|
|
14
|
+
conversationId,
|
|
15
|
+
layout = "full",
|
|
16
|
+
className,
|
|
17
|
+
showSidebar = true,
|
|
18
|
+
widgetHeight = "600px"
|
|
19
|
+
}) {
|
|
20
|
+
const [sidebarOpen, setSidebarOpen] = useState(true);
|
|
21
|
+
const [mobileSidebarOpen, setMobileSidebarOpen] = useState(false);
|
|
22
|
+
const [chatResetKey, setChatResetKey] = useState(0);
|
|
23
|
+
const apiPath = `${apiBaseURL}${apiBasePath}/chat`;
|
|
24
|
+
const handleNewChat = useCallback(() => {
|
|
25
|
+
if (!conversationId) {
|
|
26
|
+
setChatResetKey((prev) => prev + 1);
|
|
27
|
+
}
|
|
28
|
+
}, [conversationId]);
|
|
29
|
+
if (layout === "widget") {
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
className: cn(
|
|
34
|
+
"flex flex-col w-full border rounded-xl overflow-hidden bg-background shadow-sm",
|
|
35
|
+
className
|
|
36
|
+
),
|
|
37
|
+
style: { height: widgetHeight },
|
|
38
|
+
children: /* @__PURE__ */ jsx(ChatInterface, { apiPath, id: conversationId, variant: "widget" })
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
return /* @__PURE__ */ jsxs(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
className: cn(
|
|
46
|
+
"flex h-[calc(100vh-4rem)] w-full overflow-hidden",
|
|
47
|
+
className
|
|
48
|
+
),
|
|
49
|
+
"data-testid": "chat-layout",
|
|
50
|
+
children: [
|
|
51
|
+
showSidebar && /* @__PURE__ */ jsx(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
className: cn(
|
|
55
|
+
"hidden md:flex transition-all duration-300 ease-in-out",
|
|
56
|
+
sidebarOpen ? "w-72" : "w-0"
|
|
57
|
+
),
|
|
58
|
+
children: sidebarOpen && /* @__PURE__ */ jsx(
|
|
59
|
+
ChatSidebar,
|
|
60
|
+
{
|
|
61
|
+
currentConversationId: conversationId,
|
|
62
|
+
onNewChat: handleNewChat,
|
|
63
|
+
className: "w-72"
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
69
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-2 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60", children: [
|
|
70
|
+
showSidebar && /* @__PURE__ */ jsxs(Sheet, { open: mobileSidebarOpen, onOpenChange: setMobileSidebarOpen, children: [
|
|
71
|
+
/* @__PURE__ */ jsx(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
72
|
+
Button,
|
|
73
|
+
{
|
|
74
|
+
variant: "ghost",
|
|
75
|
+
size: "icon",
|
|
76
|
+
className: "md:hidden",
|
|
77
|
+
"aria-label": "Open menu",
|
|
78
|
+
children: /* @__PURE__ */ jsx(Menu, { className: "h-5 w-5" })
|
|
79
|
+
}
|
|
80
|
+
) }),
|
|
81
|
+
/* @__PURE__ */ jsx(SheetContent, { side: "left", className: "p-0 w-72", children: /* @__PURE__ */ jsx(
|
|
82
|
+
ChatSidebar,
|
|
83
|
+
{
|
|
84
|
+
currentConversationId: conversationId,
|
|
85
|
+
onNewChat: () => {
|
|
86
|
+
handleNewChat();
|
|
87
|
+
setMobileSidebarOpen(false);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
) })
|
|
91
|
+
] }),
|
|
92
|
+
showSidebar && /* @__PURE__ */ jsx(
|
|
93
|
+
Button,
|
|
94
|
+
{
|
|
95
|
+
variant: "ghost",
|
|
96
|
+
size: "icon",
|
|
97
|
+
className: "hidden md:flex",
|
|
98
|
+
onClick: () => setSidebarOpen(!sidebarOpen),
|
|
99
|
+
"aria-label": sidebarOpen ? "Close sidebar" : "Open sidebar",
|
|
100
|
+
children: sidebarOpen ? /* @__PURE__ */ jsx(PanelLeftClose, { className: "h-5 w-5" }) : /* @__PURE__ */ jsx(PanelLeft, { className: "h-5 w-5" })
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1" })
|
|
104
|
+
] }),
|
|
105
|
+
/* @__PURE__ */ jsx(
|
|
106
|
+
ChatInterface,
|
|
107
|
+
{
|
|
108
|
+
apiPath,
|
|
109
|
+
id: conversationId,
|
|
110
|
+
variant: "full"
|
|
111
|
+
},
|
|
112
|
+
`chat-${conversationId ?? "new"}-${chatResetKey}`
|
|
113
|
+
)
|
|
114
|
+
] })
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export { ChatLayout };
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
const utils = require('../../../../../../ui/src/lib/utils.cjs');
|
|
6
|
+
const markdownContent = require('../../../../../../ui/src/components/markdown-content.cjs');
|
|
7
|
+
const button = require('../../../../../../ui/src/components/button.cjs');
|
|
8
|
+
const dialog = require('../../../../../../ui/src/components/dialog.cjs');
|
|
9
|
+
const lucideReact = require('lucide-react');
|
|
10
|
+
const React = require('react');
|
|
11
|
+
const context = require('@btst/stack/context');
|
|
12
|
+
const index = require('../localization/index.cjs');
|
|
13
|
+
require('highlight.js/styles/panda-syntax-light.css');
|
|
14
|
+
const completeMarkdown = require('remend');
|
|
15
|
+
|
|
16
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
17
|
+
|
|
18
|
+
const completeMarkdown__default = /*#__PURE__*/_interopDefaultCompat(completeMarkdown);
|
|
19
|
+
|
|
20
|
+
const DefaultLink = (props) => /* @__PURE__ */ jsxRuntime.jsx("a", { ...props });
|
|
21
|
+
const DefaultImage = (props) => /* @__PURE__ */ jsxRuntime.jsx("img", { ...props });
|
|
22
|
+
function ClickableImage({
|
|
23
|
+
src,
|
|
24
|
+
alt,
|
|
25
|
+
width = 200,
|
|
26
|
+
height = 200,
|
|
27
|
+
className,
|
|
28
|
+
ImageComponent
|
|
29
|
+
}) {
|
|
30
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
31
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
32
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
33
|
+
"button",
|
|
34
|
+
{
|
|
35
|
+
type: "button",
|
|
36
|
+
onClick: () => setIsOpen(true),
|
|
37
|
+
className: "cursor-zoom-in focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded-md overflow-hidden",
|
|
38
|
+
style: { width, height },
|
|
39
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
40
|
+
ImageComponent,
|
|
41
|
+
{
|
|
42
|
+
src,
|
|
43
|
+
alt,
|
|
44
|
+
width,
|
|
45
|
+
height,
|
|
46
|
+
className: utils.cn(
|
|
47
|
+
"object-cover hover:opacity-90 transition-opacity",
|
|
48
|
+
className
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
/* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open: isOpen, onOpenChange: setIsOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
55
|
+
dialog.DialogContent,
|
|
56
|
+
{
|
|
57
|
+
className: "max-w-[90vw] max-h-[90vh] p-2 sm:max-w-[90vw]",
|
|
58
|
+
showCloseButton: true,
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ jsxRuntime.jsx(dialog.DialogTitle, { className: "sr-only", children: alt }),
|
|
61
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
62
|
+
"img",
|
|
63
|
+
{
|
|
64
|
+
src,
|
|
65
|
+
alt,
|
|
66
|
+
className: "max-w-full max-h-[85vh] object-contain rounded-md"
|
|
67
|
+
}
|
|
68
|
+
) })
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
) })
|
|
72
|
+
] });
|
|
73
|
+
}
|
|
74
|
+
function ChatMessage({
|
|
75
|
+
message,
|
|
76
|
+
isStreaming = false,
|
|
77
|
+
variant = "default",
|
|
78
|
+
onRetry,
|
|
79
|
+
onEdit,
|
|
80
|
+
isRetrying = false
|
|
81
|
+
}) {
|
|
82
|
+
const isUser = message.role === "user";
|
|
83
|
+
const {
|
|
84
|
+
Link,
|
|
85
|
+
Image,
|
|
86
|
+
localization: customLocalization
|
|
87
|
+
} = context.usePluginOverrides(
|
|
88
|
+
"ai-chat",
|
|
89
|
+
{}
|
|
90
|
+
);
|
|
91
|
+
const localization = { ...index.AI_CHAT_LOCALIZATION, ...customLocalization };
|
|
92
|
+
const ImageComponent = Image ?? DefaultImage;
|
|
93
|
+
const [copied, setCopied] = React.useState(false);
|
|
94
|
+
const [isEditing, setIsEditing] = React.useState(false);
|
|
95
|
+
const [editText, setEditText] = React.useState("");
|
|
96
|
+
const editTextareaRef = React.useRef(null);
|
|
97
|
+
React.useEffect(() => {
|
|
98
|
+
if (isEditing && editTextareaRef.current) {
|
|
99
|
+
editTextareaRef.current.style.height = "auto";
|
|
100
|
+
editTextareaRef.current.style.height = `${editTextareaRef.current.scrollHeight}px`;
|
|
101
|
+
editTextareaRef.current.focus();
|
|
102
|
+
}
|
|
103
|
+
}, [isEditing, editText]);
|
|
104
|
+
const handleCopy = async () => {
|
|
105
|
+
try {
|
|
106
|
+
await navigator.clipboard.writeText(textContent);
|
|
107
|
+
setCopied(true);
|
|
108
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
109
|
+
} catch (err) {
|
|
110
|
+
console.error("Failed to copy text:", err);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const handleStartEdit = () => {
|
|
114
|
+
setEditText(textContent);
|
|
115
|
+
setIsEditing(true);
|
|
116
|
+
};
|
|
117
|
+
const handleCancelEdit = () => {
|
|
118
|
+
setIsEditing(false);
|
|
119
|
+
setEditText("");
|
|
120
|
+
};
|
|
121
|
+
const handleSaveEdit = () => {
|
|
122
|
+
if (editText.trim() && onEdit) {
|
|
123
|
+
onEdit(editText.trim());
|
|
124
|
+
setIsEditing(false);
|
|
125
|
+
setEditText("");
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const handleEditKeyDown = (e) => {
|
|
129
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
130
|
+
e.preventDefault();
|
|
131
|
+
handleSaveEdit();
|
|
132
|
+
} else if (e.key === "Escape") {
|
|
133
|
+
handleCancelEdit();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const textContent = React.useMemo(() => {
|
|
137
|
+
if (message.parts && Array.isArray(message.parts)) {
|
|
138
|
+
return message.parts.filter((part) => part.type === "text").map((part) => part.text).join("");
|
|
139
|
+
}
|
|
140
|
+
return "";
|
|
141
|
+
}, [message.parts]);
|
|
142
|
+
const imageParts = React.useMemo(() => {
|
|
143
|
+
if (message.parts && Array.isArray(message.parts)) {
|
|
144
|
+
return message.parts.filter(
|
|
145
|
+
(part) => part.type === "file" && part.mediaType?.startsWith("image/")
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
return [];
|
|
149
|
+
}, [message.parts]);
|
|
150
|
+
const fileParts = React.useMemo(() => {
|
|
151
|
+
if (message.parts && Array.isArray(message.parts)) {
|
|
152
|
+
return message.parts.filter(
|
|
153
|
+
(part) => part.type === "file" && !part.mediaType?.startsWith("image/")
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
return [];
|
|
157
|
+
}, [message.parts]);
|
|
158
|
+
const displayContent = React.useMemo(() => {
|
|
159
|
+
if (!textContent) return "";
|
|
160
|
+
if (isStreaming && !isUser) {
|
|
161
|
+
return completeMarkdown__default(textContent);
|
|
162
|
+
}
|
|
163
|
+
return textContent;
|
|
164
|
+
}, [textContent, isStreaming, isUser]);
|
|
165
|
+
const isCompact = variant === "compact";
|
|
166
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
167
|
+
"div",
|
|
168
|
+
{
|
|
169
|
+
className: utils.cn(
|
|
170
|
+
"flex gap-3 w-full",
|
|
171
|
+
isCompact ? "mb-3" : "mb-4",
|
|
172
|
+
isUser ? "justify-end" : "justify-start"
|
|
173
|
+
),
|
|
174
|
+
"aria-label": isUser ? localization.A11Y_USER_MESSAGE : localization.A11Y_ASSISTANT_MESSAGE,
|
|
175
|
+
children: [
|
|
176
|
+
!isUser && /* @__PURE__ */ jsxRuntime.jsx(
|
|
177
|
+
"div",
|
|
178
|
+
{
|
|
179
|
+
className: utils.cn(
|
|
180
|
+
"rounded-full bg-muted flex items-center justify-center shrink-0",
|
|
181
|
+
isCompact ? "w-7 h-7" : "w-8 h-8"
|
|
182
|
+
),
|
|
183
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bot, { className: utils.cn(isCompact ? "w-4 h-4" : "w-5 h-5") })
|
|
184
|
+
}
|
|
185
|
+
),
|
|
186
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 max-w-[80%] group", children: [
|
|
187
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
188
|
+
"div",
|
|
189
|
+
{
|
|
190
|
+
className: utils.cn(
|
|
191
|
+
"rounded-lg",
|
|
192
|
+
isCompact ? "px-3 py-2" : "px-4 py-3",
|
|
193
|
+
isUser ? "bg-primary text-primary-foreground" : "bg-muted"
|
|
194
|
+
),
|
|
195
|
+
children: isUser ? (
|
|
196
|
+
// User messages: files + images + text (or edit mode)
|
|
197
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
198
|
+
fileParts.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: fileParts.map((part, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
199
|
+
"a",
|
|
200
|
+
{
|
|
201
|
+
href: part.url,
|
|
202
|
+
target: "_blank",
|
|
203
|
+
rel: "noopener noreferrer",
|
|
204
|
+
className: "flex items-center gap-2 px-3 py-2 rounded-md bg-primary-foreground/10 hover:bg-primary-foreground/20 transition-colors",
|
|
205
|
+
children: [
|
|
206
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "h-4 w-4 shrink-0" }),
|
|
207
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs truncate max-w-[150px]", children: part.filename || "File" })
|
|
208
|
+
]
|
|
209
|
+
},
|
|
210
|
+
index
|
|
211
|
+
)) }),
|
|
212
|
+
imageParts.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: imageParts.map((part, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
213
|
+
ClickableImage,
|
|
214
|
+
{
|
|
215
|
+
src: part.url,
|
|
216
|
+
alt: part.filename || `Attached image ${index + 1}`,
|
|
217
|
+
width: 150,
|
|
218
|
+
height: 150,
|
|
219
|
+
className: "rounded-md",
|
|
220
|
+
ImageComponent
|
|
221
|
+
},
|
|
222
|
+
index
|
|
223
|
+
)) }),
|
|
224
|
+
isEditing ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
225
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
226
|
+
"textarea",
|
|
227
|
+
{
|
|
228
|
+
ref: editTextareaRef,
|
|
229
|
+
value: editText,
|
|
230
|
+
onChange: (e) => setEditText(e.target.value),
|
|
231
|
+
onKeyDown: handleEditKeyDown,
|
|
232
|
+
className: utils.cn(
|
|
233
|
+
"w-full min-w-[200px] resize-none rounded-md border-0 bg-primary-foreground/10 p-2 text-sm",
|
|
234
|
+
"focus:outline-none focus:ring-1 focus:ring-primary-foreground/30",
|
|
235
|
+
"text-primary-foreground placeholder:text-primary-foreground/50"
|
|
236
|
+
),
|
|
237
|
+
rows: 1
|
|
238
|
+
}
|
|
239
|
+
),
|
|
240
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-2", children: [
|
|
241
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
242
|
+
button.Button,
|
|
243
|
+
{
|
|
244
|
+
type: "button",
|
|
245
|
+
size: "icon-sm",
|
|
246
|
+
variant: "ghost",
|
|
247
|
+
onClick: handleCancelEdit,
|
|
248
|
+
className: "h-7 w-7 text-primary-foreground hover:bg-primary-foreground/20",
|
|
249
|
+
title: localization.MESSAGE_CANCEL,
|
|
250
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" })
|
|
251
|
+
}
|
|
252
|
+
),
|
|
253
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
254
|
+
button.Button,
|
|
255
|
+
{
|
|
256
|
+
type: "button",
|
|
257
|
+
size: "icon-sm",
|
|
258
|
+
variant: "ghost",
|
|
259
|
+
onClick: handleSaveEdit,
|
|
260
|
+
disabled: !editText.trim(),
|
|
261
|
+
className: "h-7 w-7 text-primary-foreground hover:bg-primary-foreground/20 disabled:opacity-50",
|
|
262
|
+
title: localization.MESSAGE_SAVE,
|
|
263
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Send, { className: "h-4 w-4" })
|
|
264
|
+
}
|
|
265
|
+
)
|
|
266
|
+
] })
|
|
267
|
+
] }) : textContent && /* @__PURE__ */ jsxRuntime.jsx(
|
|
268
|
+
"p",
|
|
269
|
+
{
|
|
270
|
+
className: utils.cn(
|
|
271
|
+
"whitespace-pre-wrap wrap-break-word",
|
|
272
|
+
isCompact ? "text-sm" : "text-sm"
|
|
273
|
+
),
|
|
274
|
+
children: textContent
|
|
275
|
+
}
|
|
276
|
+
)
|
|
277
|
+
] })
|
|
278
|
+
) : (
|
|
279
|
+
// Assistant messages: rendered markdown + files + images
|
|
280
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "wrap-break-word space-y-2", children: [
|
|
281
|
+
fileParts.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: fileParts.map((part, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
282
|
+
"a",
|
|
283
|
+
{
|
|
284
|
+
href: part.url,
|
|
285
|
+
target: "_blank",
|
|
286
|
+
rel: "noopener noreferrer",
|
|
287
|
+
className: "flex items-center gap-2 px-3 py-2 rounded-md bg-muted-foreground/10 hover:bg-muted-foreground/20 transition-colors border",
|
|
288
|
+
children: [
|
|
289
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
290
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs truncate max-w-[150px]", children: part.filename || "File" })
|
|
291
|
+
]
|
|
292
|
+
},
|
|
293
|
+
index
|
|
294
|
+
)) }),
|
|
295
|
+
imageParts.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: imageParts.map((part, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
296
|
+
ClickableImage,
|
|
297
|
+
{
|
|
298
|
+
src: part.url,
|
|
299
|
+
alt: part.filename || `Image ${index + 1}`,
|
|
300
|
+
width: 200,
|
|
301
|
+
height: 200,
|
|
302
|
+
className: "rounded-md",
|
|
303
|
+
ImageComponent
|
|
304
|
+
},
|
|
305
|
+
index
|
|
306
|
+
)) }),
|
|
307
|
+
displayContent ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
308
|
+
markdownContent.MarkdownContent,
|
|
309
|
+
{
|
|
310
|
+
markdown: displayContent,
|
|
311
|
+
variant: "chat",
|
|
312
|
+
LinkComponent: Link ?? DefaultLink,
|
|
313
|
+
ImageComponent
|
|
314
|
+
}
|
|
315
|
+
) : imageParts.length === 0 && fileParts.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "..." }) : null
|
|
316
|
+
] })
|
|
317
|
+
)
|
|
318
|
+
}
|
|
319
|
+
),
|
|
320
|
+
!isStreaming && !isEditing && /* @__PURE__ */ jsxRuntime.jsx(
|
|
321
|
+
"div",
|
|
322
|
+
{
|
|
323
|
+
className: utils.cn(
|
|
324
|
+
"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
325
|
+
isUser ? "justify-end" : "justify-start"
|
|
326
|
+
),
|
|
327
|
+
children: isUser ? (
|
|
328
|
+
// User message actions: Edit
|
|
329
|
+
onEdit && /* @__PURE__ */ jsxRuntime.jsx(
|
|
330
|
+
button.Button,
|
|
331
|
+
{
|
|
332
|
+
type: "button",
|
|
333
|
+
size: "icon-sm",
|
|
334
|
+
variant: "ghost",
|
|
335
|
+
onClick: handleStartEdit,
|
|
336
|
+
className: "h-7 w-7 bg-transparent text-muted-foreground hover:text-foreground hover:bg-muted/50",
|
|
337
|
+
title: localization.MESSAGE_EDIT,
|
|
338
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "h-3.5 w-3.5" })
|
|
339
|
+
}
|
|
340
|
+
)
|
|
341
|
+
) : (
|
|
342
|
+
// Assistant message actions: Copy and Retry
|
|
343
|
+
/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
344
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
345
|
+
button.Button,
|
|
346
|
+
{
|
|
347
|
+
type: "button",
|
|
348
|
+
size: "icon-sm",
|
|
349
|
+
variant: "ghost",
|
|
350
|
+
onClick: handleCopy,
|
|
351
|
+
className: "h-7 w-7 bg-transparent text-muted-foreground hover:text-foreground hover:bg-muted/50",
|
|
352
|
+
title: copied ? localization.MESSAGE_COPIED : localization.MESSAGE_COPY,
|
|
353
|
+
children: copied ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { className: "h-3.5 w-3.5" })
|
|
354
|
+
}
|
|
355
|
+
),
|
|
356
|
+
onRetry && /* @__PURE__ */ jsxRuntime.jsx(
|
|
357
|
+
button.Button,
|
|
358
|
+
{
|
|
359
|
+
type: "button",
|
|
360
|
+
size: "icon-sm",
|
|
361
|
+
variant: "ghost",
|
|
362
|
+
onClick: onRetry,
|
|
363
|
+
disabled: isRetrying,
|
|
364
|
+
className: "h-7 w-7 bg-transparent text-muted-foreground hover:text-foreground hover:bg-muted/50 disabled:opacity-50",
|
|
365
|
+
title: localization.MESSAGE_RETRY,
|
|
366
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
367
|
+
lucideReact.RefreshCw,
|
|
368
|
+
{
|
|
369
|
+
className: utils.cn(
|
|
370
|
+
"h-3.5 w-3.5",
|
|
371
|
+
isRetrying && "animate-spin"
|
|
372
|
+
)
|
|
373
|
+
}
|
|
374
|
+
)
|
|
375
|
+
}
|
|
376
|
+
)
|
|
377
|
+
] })
|
|
378
|
+
)
|
|
379
|
+
}
|
|
380
|
+
)
|
|
381
|
+
] }),
|
|
382
|
+
isUser && /* @__PURE__ */ jsxRuntime.jsx(
|
|
383
|
+
"div",
|
|
384
|
+
{
|
|
385
|
+
className: utils.cn(
|
|
386
|
+
"rounded-full bg-primary flex items-center justify-center shrink-0 text-primary-foreground",
|
|
387
|
+
isCompact ? "w-7 h-7" : "w-8 h-8"
|
|
388
|
+
),
|
|
389
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.User, { className: utils.cn(isCompact ? "w-4 h-4" : "w-5 h-5") })
|
|
390
|
+
}
|
|
391
|
+
)
|
|
392
|
+
]
|
|
393
|
+
}
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
exports.ChatMessage = ChatMessage;
|