@agentuity/workbench 0.0.64 → 0.0.66
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/components/App.d.ts +6 -0
- package/dist/components/App.d.ts.map +1 -0
- package/dist/components/App.js +13 -0
- package/dist/components/App.js.map +1 -0
- package/dist/components/ConnectionStatus.d.ts +7 -0
- package/dist/components/ConnectionStatus.d.ts.map +1 -0
- package/dist/components/ConnectionStatus.js +52 -0
- package/dist/components/ConnectionStatus.js.map +1 -0
- package/dist/components/Inline.d.ts +10 -0
- package/dist/components/Inline.d.ts.map +1 -0
- package/dist/components/Inline.js +11 -0
- package/dist/components/Inline.js.map +1 -0
- package/dist/components/ai-elements/actions.d.ts +10 -0
- package/dist/components/ai-elements/actions.d.ts.map +1 -0
- package/dist/components/ai-elements/actions.js +14 -0
- package/dist/components/ai-elements/actions.js.map +1 -0
- package/dist/components/ai-elements/artifact.d.ts +24 -0
- package/dist/components/ai-elements/artifact.d.ts.map +1 -0
- package/dist/components/ai-elements/artifact.js +21 -0
- package/dist/components/ai-elements/artifact.js.map +1 -0
- package/dist/components/ai-elements/branch.d.ts +21 -0
- package/dist/components/ai-elements/branch.d.ts.map +1 -0
- package/dist/components/ai-elements/branch.js +71 -0
- package/dist/components/ai-elements/branch.js.map +1 -0
- package/dist/components/ai-elements/canvas.d.ts +9 -0
- package/dist/components/ai-elements/canvas.d.ts.map +1 -0
- package/dist/components/ai-elements/canvas.js +6 -0
- package/dist/components/ai-elements/canvas.js.map +1 -0
- package/dist/components/ai-elements/chain-of-thought.d.ts +30 -0
- package/dist/components/ai-elements/chain-of-thought.d.ts.map +1 -0
- package/dist/components/ai-elements/chain-of-thought.js +52 -0
- package/dist/components/ai-elements/chain-of-thought.js.map +1 -0
- package/dist/components/ai-elements/code-block.d.ts +18 -0
- package/dist/components/ai-elements/code-block.d.ts.map +1 -0
- package/dist/components/ai-elements/code-block.js +89 -0
- package/dist/components/ai-elements/code-block.js.map +1 -0
- package/dist/components/ai-elements/confirmation.d.ts +27 -0
- package/dist/components/ai-elements/confirmation.d.ts.map +1 -0
- package/dist/components/ai-elements/confirmation.js +57 -0
- package/dist/components/ai-elements/confirmation.js.map +1 -0
- package/dist/components/ai-elements/connection.d.ts +3 -0
- package/dist/components/ai-elements/connection.d.ts.map +1 -0
- package/dist/components/ai-elements/connection.js +4 -0
- package/dist/components/ai-elements/connection.js.map +1 -0
- package/dist/components/ai-elements/context.d.ts +33 -0
- package/dist/components/ai-elements/context.d.ts.map +1 -0
- package/dist/components/ai-elements/context.js +167 -0
- package/dist/components/ai-elements/context.js.map +1 -0
- package/dist/components/ai-elements/controls.d.ts +5 -0
- package/dist/components/ai-elements/controls.d.ts.map +1 -0
- package/dist/components/ai-elements/controls.js +6 -0
- package/dist/components/ai-elements/controls.js.map +1 -0
- package/dist/components/ai-elements/conversation.d.ts +16 -0
- package/dist/components/ai-elements/conversation.d.ts.map +1 -0
- package/dist/components/ai-elements/conversation.js +18 -0
- package/dist/components/ai-elements/conversation.js.map +1 -0
- package/dist/components/ai-elements/edge.d.ts +6 -0
- package/dist/components/ai-elements/edge.d.ts.map +1 -0
- package/dist/components/ai-elements/edge.js +83 -0
- package/dist/components/ai-elements/edge.js.map +1 -0
- package/dist/components/ai-elements/image.d.ts +7 -0
- package/dist/components/ai-elements/image.d.ts.map +1 -0
- package/dist/components/ai-elements/image.js +4 -0
- package/dist/components/ai-elements/image.js.map +1 -0
- package/dist/components/ai-elements/inline-citation.d.ts +39 -0
- package/dist/components/ai-elements/inline-citation.d.ts.map +1 -0
- package/dist/components/ai-elements/inline-citation.js +62 -0
- package/dist/components/ai-elements/inline-citation.js.map +1 -0
- package/dist/components/ai-elements/loader.d.ts +6 -0
- package/dist/components/ai-elements/loader.d.ts.map +1 -0
- package/dist/components/ai-elements/loader.js +5 -0
- package/dist/components/ai-elements/loader.js.map +1 -0
- package/dist/components/ai-elements/message.d.ts +20 -0
- package/dist/components/ai-elements/message.d.ts.map +1 -0
- package/dist/components/ai-elements/message.js +26 -0
- package/dist/components/ai-elements/message.js.map +1 -0
- package/dist/components/ai-elements/node.d.ts +22 -0
- package/dist/components/ai-elements/node.d.ts.map +1 -0
- package/dist/components/ai-elements/node.js +12 -0
- package/dist/components/ai-elements/node.js.map +1 -0
- package/dist/components/ai-elements/open-in-chat.d.ts +29 -0
- package/dist/components/ai-elements/open-in-chat.d.ts.map +1 -0
- package/dist/components/ai-elements/open-in-chat.js +97 -0
- package/dist/components/ai-elements/open-in-chat.js.map +1 -0
- package/dist/components/ai-elements/panel.d.ts +6 -0
- package/dist/components/ai-elements/panel.d.ts.map +1 -0
- package/dist/components/ai-elements/panel.js +5 -0
- package/dist/components/ai-elements/panel.js.map +1 -0
- package/dist/components/ai-elements/plan.d.ts +26 -0
- package/dist/components/ai-elements/plan.d.ts.map +1 -0
- package/dist/components/ai-elements/plan.js +32 -0
- package/dist/components/ai-elements/plan.js.map +1 -0
- package/dist/components/ai-elements/prompt-input.d.ts +187 -0
- package/dist/components/ai-elements/prompt-input.d.ts.map +1 -0
- package/dist/components/ai-elements/prompt-input.js +544 -0
- package/dist/components/ai-elements/prompt-input.js.map +1 -0
- package/dist/components/ai-elements/queue.d.ts +62 -0
- package/dist/components/ai-elements/queue.d.ts.map +1 -0
- package/dist/components/ai-elements/queue.js +25 -0
- package/dist/components/ai-elements/queue.js.map +1 -0
- package/dist/components/ai-elements/reasoning.d.ts +17 -0
- package/dist/components/ai-elements/reasoning.d.ts.map +1 -0
- package/dist/components/ai-elements/reasoning.js +77 -0
- package/dist/components/ai-elements/reasoning.js.map +1 -0
- package/dist/components/ai-elements/response.d.ts +6 -0
- package/dist/components/ai-elements/response.d.ts.map +1 -0
- package/dist/components/ai-elements/response.js +8 -0
- package/dist/components/ai-elements/response.js.map +1 -0
- package/dist/components/ai-elements/shimmer.d.ts +10 -0
- package/dist/components/ai-elements/shimmer.d.ts.map +1 -0
- package/dist/components/ai-elements/shimmer.js +19 -0
- package/dist/components/ai-elements/shimmer.js.map +1 -0
- package/dist/components/ai-elements/sources.d.ts +13 -0
- package/dist/components/ai-elements/sources.d.ts.map +1 -0
- package/dist/components/ai-elements/sources.js +10 -0
- package/dist/components/ai-elements/sources.js.map +1 -0
- package/dist/components/ai-elements/suggestion.d.ts +11 -0
- package/dist/components/ai-elements/suggestion.d.ts.map +1 -0
- package/dist/components/ai-elements/suggestion.js +13 -0
- package/dist/components/ai-elements/suggestion.js.map +1 -0
- package/dist/components/ai-elements/task.d.ts +15 -0
- package/dist/components/ai-elements/task.d.ts.map +1 -0
- package/dist/components/ai-elements/task.js +11 -0
- package/dist/components/ai-elements/task.js.map +1 -0
- package/dist/components/ai-elements/tool.d.ts +24 -0
- package/dist/components/ai-elements/tool.d.ts.map +1 -0
- package/dist/components/ai-elements/tool.js +47 -0
- package/dist/components/ai-elements/tool.js.map +1 -0
- package/dist/components/ai-elements/toolbar.d.ts +6 -0
- package/dist/components/ai-elements/toolbar.d.ts.map +1 -0
- package/dist/components/ai-elements/toolbar.js +5 -0
- package/dist/components/ai-elements/toolbar.js.map +1 -0
- package/dist/components/ai-elements/web-preview.d.ts +35 -0
- package/dist/components/ai-elements/web-preview.d.ts.map +1 -0
- package/dist/components/ai-elements/web-preview.js +63 -0
- package/dist/components/ai-elements/web-preview.js.map +1 -0
- package/dist/components/internal/Chat.d.ts +11 -0
- package/dist/components/internal/Chat.d.ts.map +1 -0
- package/dist/components/internal/Chat.js +52 -0
- package/dist/components/internal/Chat.js.map +1 -0
- package/dist/components/internal/Header.d.ts +10 -0
- package/dist/components/internal/Header.d.ts.map +1 -0
- package/dist/components/internal/Header.js +31 -0
- package/dist/components/internal/Header.js.map +1 -0
- package/dist/components/internal/InputSection.d.ts +14 -0
- package/dist/components/internal/InputSection.d.ts.map +1 -0
- package/dist/components/internal/InputSection.js +212 -0
- package/dist/components/internal/InputSection.js.map +1 -0
- package/dist/components/internal/Schema.d.ts +7 -0
- package/dist/components/internal/Schema.d.ts.map +1 -0
- package/dist/components/internal/Schema.js +14 -0
- package/dist/components/internal/Schema.js.map +1 -0
- package/dist/components/internal/WorkbenchProvider.d.ts +11 -0
- package/dist/components/internal/WorkbenchProvider.d.ts.map +1 -0
- package/dist/components/internal/WorkbenchProvider.js +224 -0
- package/dist/components/internal/WorkbenchProvider.js.map +1 -0
- package/dist/components/internal/logo.d.ts +2 -0
- package/dist/components/internal/logo.d.ts.map +1 -0
- package/dist/components/internal/logo.js +5 -0
- package/dist/components/internal/logo.js.map +1 -0
- package/dist/components/ui/alert.d.ts +10 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/alert.js +25 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/avatar.d.ts +7 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +14 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +23 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/button.d.ts +3 -4
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/card.d.ts +2 -1
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/card.js +4 -1
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/carousel.d.ts +20 -0
- package/dist/components/ui/carousel.d.ts.map +1 -0
- package/dist/components/ui/carousel.js +92 -0
- package/dist/components/ui/carousel.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +9 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +14 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/command.d.ts +19 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/command.js +34 -0
- package/dist/components/ui/command.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +16 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +36 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +26 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +52 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/field.d.ts +25 -0
- package/dist/components/ui/field.d.ts.map +1 -0
- package/dist/components/ui/field.js +74 -0
- package/dist/components/ui/field.js.map +1 -0
- package/dist/components/ui/form.d.ts +25 -0
- package/dist/components/ui/form.d.ts.map +1 -0
- package/dist/components/ui/form.js +58 -0
- package/dist/components/ui/form.js.map +1 -0
- package/dist/components/ui/hover-card.d.ts +7 -0
- package/dist/components/ui/hover-card.d.ts.map +1 -0
- package/dist/components/ui/hover-card.js +14 -0
- package/dist/components/ui/hover-card.js.map +1 -0
- package/dist/components/ui/input-group.d.ts +17 -0
- package/dist/components/ui/input-group.d.ts.map +1 -0
- package/dist/components/ui/input-group.js +64 -0
- package/dist/components/ui/input-group.js.map +1 -0
- package/dist/components/ui/input.d.ts +1 -2
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +3 -5
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/label.d.ts +5 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +9 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/components/ui/popover.d.ts +8 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +18 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/progress.d.ts +5 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/progress.js +9 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/resizable-provider.d.ts +15 -0
- package/dist/components/ui/resizable-provider.d.ts.map +1 -0
- package/dist/components/ui/resizable-provider.js +54 -0
- package/dist/components/ui/resizable-provider.js.map +1 -0
- package/dist/components/ui/resizable.d.ts +9 -0
- package/dist/components/ui/resizable.d.ts.map +1 -0
- package/dist/components/ui/resizable.js +16 -0
- package/dist/components/ui/resizable.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +6 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +11 -0
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/select.d.ts +16 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +39 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +9 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/switch.d.ts +5 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +8 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/tabs.d.ts +8 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +17 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/textarea.d.ts +4 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea.js +7 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/theme-provider.d.ts +14 -0
- package/dist/components/ui/theme-provider.d.ts.map +1 -0
- package/dist/components/ui/theme-provider.js +37 -0
- package/dist/components/ui/theme-provider.js.map +1 -0
- package/dist/components/ui/theme-toggle.d.ts +2 -0
- package/dist/components/ui/theme-toggle.d.ts.map +1 -0
- package/dist/components/ui/theme-toggle.js +10 -0
- package/dist/components/ui/theme-toggle.js.map +1 -0
- package/dist/components/ui/toggle.d.ts +10 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/toggle.js +26 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +8 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +17 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/components.d.ts +10 -6
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +11 -36
- package/dist/components.js.map +1 -1
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useAgentSchemas.d.ts +70 -0
- package/dist/hooks/useAgentSchemas.d.ts.map +1 -0
- package/dist/hooks/useAgentSchemas.js +90 -0
- package/dist/hooks/useAgentSchemas.js.map +1 -0
- package/dist/hooks/useWorkbenchSchemas.d.ts +56 -0
- package/dist/hooks/useWorkbenchSchemas.d.ts.map +1 -0
- package/dist/hooks/useWorkbenchSchemas.js +63 -0
- package/dist/hooks/useWorkbenchSchemas.js.map +1 -0
- package/dist/hooks/useWorkbenchWebsocket.d.ts +14 -0
- package/dist/hooks/useWorkbenchWebsocket.d.ts.map +1 -0
- package/dist/hooks/useWorkbenchWebsocket.js +163 -0
- package/dist/hooks/useWorkbenchWebsocket.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +5 -0
- package/dist/server.js.map +1 -0
- package/dist/styles.css +3423 -196
- package/dist/types/config.d.ts +29 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +2 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/workbench.d.ts +1 -2
- package/dist/workbench.d.ts.map +1 -1
- package/dist/workbench.js +0 -2
- package/dist/workbench.js.map +1 -1
- package/package.json +50 -7
- package/src/components/App.tsx +29 -0
- package/src/components/ConnectionStatus.tsx +67 -0
- package/src/components/Inline.tsx +16 -0
- package/src/components/ai-elements/actions.tsx +60 -0
- package/src/components/ai-elements/artifact.tsx +118 -0
- package/src/components/ai-elements/branch.tsx +187 -0
- package/src/components/ai-elements/canvas.tsx +24 -0
- package/src/components/ai-elements/chain-of-thought.tsx +198 -0
- package/src/components/ai-elements/code-block.tsx +175 -0
- package/src/components/ai-elements/confirmation.tsx +119 -0
- package/src/components/ai-elements/connection.tsx +16 -0
- package/src/components/ai-elements/context.tsx +357 -0
- package/src/components/ai-elements/controls.tsx +18 -0
- package/src/components/ai-elements/conversation.tsx +90 -0
- package/src/components/ai-elements/edge.tsx +131 -0
- package/src/components/ai-elements/image.tsx +16 -0
- package/src/components/ai-elements/inline-citation.tsx +246 -0
- package/src/components/ai-elements/loader.tsx +88 -0
- package/src/components/ai-elements/message.tsx +63 -0
- package/src/components/ai-elements/node.tsx +66 -0
- package/src/components/ai-elements/open-in-chat.tsx +333 -0
- package/src/components/ai-elements/panel.tsx +12 -0
- package/src/components/ai-elements/plan.tsx +123 -0
- package/src/components/ai-elements/prompt-input.tsx +1203 -0
- package/src/components/ai-elements/queue.tsx +231 -0
- package/src/components/ai-elements/reasoning.tsx +163 -0
- package/src/components/ai-elements/response.tsx +19 -0
- package/src/components/ai-elements/shimmer.tsx +53 -0
- package/src/components/ai-elements/sources.tsx +53 -0
- package/src/components/ai-elements/suggestion.tsx +47 -0
- package/src/components/ai-elements/task.tsx +64 -0
- package/src/components/ai-elements/tool.tsx +136 -0
- package/src/components/ai-elements/toolbar.tsx +13 -0
- package/src/components/ai-elements/web-preview.tsx +238 -0
- package/src/components/internal/Chat.tsx +183 -0
- package/src/components/internal/Header.tsx +77 -0
- package/src/components/internal/InputSection.tsx +427 -0
- package/src/components/internal/Schema.tsx +111 -0
- package/src/components/internal/WorkbenchProvider.tsx +265 -0
- package/src/components/internal/logo.tsx +11 -0
- package/src/components/ui/alert.tsx +60 -0
- package/src/components/ui/avatar.tsx +42 -0
- package/src/components/ui/badge.tsx +40 -0
- package/src/components/ui/button.tsx +10 -5
- package/src/components/ui/card.tsx +4 -1
- package/src/components/ui/carousel.tsx +234 -0
- package/src/components/ui/checkbox.tsx +27 -0
- package/src/components/ui/collapsible.tsx +21 -0
- package/src/components/ui/command.tsx +153 -0
- package/src/components/ui/dialog.tsx +127 -0
- package/src/components/ui/dropdown-menu.tsx +228 -0
- package/src/components/ui/field.tsx +234 -0
- package/src/components/ui/form.tsx +154 -0
- package/src/components/ui/hover-card.tsx +36 -0
- package/src/components/ui/input-group.tsx +158 -0
- package/src/components/ui/input.tsx +16 -18
- package/src/components/ui/label.tsx +21 -0
- package/src/components/ui/popover.tsx +42 -0
- package/src/components/ui/progress.tsx +28 -0
- package/src/components/ui/resizable-provider.tsx +83 -0
- package/src/components/ui/resizable.tsx +54 -0
- package/src/components/ui/scroll-area.tsx +54 -0
- package/src/components/ui/select.tsx +172 -0
- package/src/components/ui/separator.tsx +28 -0
- package/src/components/ui/switch.tsx +26 -0
- package/src/components/ui/tabs.tsx +52 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/components/ui/theme-provider.tsx +71 -0
- package/src/components/ui/theme-toggle.tsx +30 -0
- package/src/components/ui/toggle.tsx +44 -0
- package/src/components/ui/tooltip.tsx +55 -0
- package/src/components.tsx +28 -74
- package/src/hooks/index.ts +19 -0
- package/src/hooks/useAgentSchemas.ts +144 -0
- package/src/hooks/useWorkbenchSchemas.ts +69 -0
- package/src/hooks/useWorkbenchWebsocket.ts +220 -0
- package/src/index.ts +5 -11
- package/src/server.ts +6 -0
- package/src/styles.css +214 -59
- package/src/types/config.ts +34 -0
- package/src/types.ts +1 -1
- package/src/workbench.ts +1 -4
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Alert, AlertDescription } from '../ui/alert';
|
|
2
|
+
import { Button } from '../ui/button';
|
|
3
|
+
import { type ComponentProps, type ReactNode } from 'react';
|
|
4
|
+
export type ConfirmationProps = ComponentProps<typeof Alert> & {
|
|
5
|
+
approval?: any;
|
|
6
|
+
state: any;
|
|
7
|
+
};
|
|
8
|
+
export declare const Confirmation: ({ className, approval, state, ...props }: ConfirmationProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export type ConfirmationTitleProps = ComponentProps<typeof AlertDescription>;
|
|
10
|
+
export declare const ConfirmationTitle: ({ className, ...props }: ConfirmationTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export type ConfirmationRequestProps = {
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
};
|
|
14
|
+
export declare const ConfirmationRequest: ({ children }: ConfirmationRequestProps) => ReactNode;
|
|
15
|
+
export type ConfirmationAcceptedProps = {
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
};
|
|
18
|
+
export declare const ConfirmationAccepted: ({ children }: ConfirmationAcceptedProps) => ReactNode;
|
|
19
|
+
export type ConfirmationRejectedProps = {
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
};
|
|
22
|
+
export declare const ConfirmationRejected: ({ children }: ConfirmationRejectedProps) => ReactNode;
|
|
23
|
+
export type ConfirmationActionsProps = ComponentProps<'div'>;
|
|
24
|
+
export declare const ConfirmationActions: ({ className, ...props }: ConfirmationActionsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
25
|
+
export type ConfirmationActionProps = ComponentProps<typeof Button>;
|
|
26
|
+
export declare const ConfirmationAction: (props: ConfirmationActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
//# sourceMappingURL=confirmation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmation.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/confirmation.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACt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time";
|
|
3
|
+
import { Alert, AlertDescription } from '../ui/alert';
|
|
4
|
+
import { Button } from '../ui/button';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
import { createContext, useContext } from 'react';
|
|
7
|
+
const ConfirmationContext = createContext(null);
|
|
8
|
+
const useConfirmation = () => {
|
|
9
|
+
const context = useContext(ConfirmationContext);
|
|
10
|
+
if (!context) {
|
|
11
|
+
throw new Error('Confirmation components must be used within Confirmation');
|
|
12
|
+
}
|
|
13
|
+
return context;
|
|
14
|
+
};
|
|
15
|
+
export const Confirmation = ({ className, approval, state, ...props }) => {
|
|
16
|
+
if (!approval || state === 'input-streaming' || state === 'input-available') {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return (_jsx(ConfirmationContext.Provider, { value: { approval, state }, children: _jsx(Alert, { className: cn('flex flex-col gap-2', className), ...props }) }));
|
|
20
|
+
};
|
|
21
|
+
export const ConfirmationTitle = ({ className, ...props }) => (_jsx(AlertDescription, { className: cn('inline', className), ...props }));
|
|
22
|
+
export const ConfirmationRequest = ({ children }) => {
|
|
23
|
+
const { state } = useConfirmation();
|
|
24
|
+
// Only show when approval is requested
|
|
25
|
+
if (state !== 'approval-requested') {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return children;
|
|
29
|
+
};
|
|
30
|
+
export const ConfirmationAccepted = ({ children }) => {
|
|
31
|
+
const { approval, state } = useConfirmation();
|
|
32
|
+
// Only show when approved and in response states
|
|
33
|
+
if (!approval?.approved ||
|
|
34
|
+
(state !== 'approval-responded' && state !== 'output-denied' && state !== 'output-available')) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return children;
|
|
38
|
+
};
|
|
39
|
+
export const ConfirmationRejected = ({ children }) => {
|
|
40
|
+
const { approval, state } = useConfirmation();
|
|
41
|
+
// Only show when rejected and in response states
|
|
42
|
+
if (approval?.approved !== false ||
|
|
43
|
+
(state !== 'approval-responded' && state !== 'output-denied' && state !== 'output-available')) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return children;
|
|
47
|
+
};
|
|
48
|
+
export const ConfirmationActions = ({ className, ...props }) => {
|
|
49
|
+
const { state } = useConfirmation();
|
|
50
|
+
// Only show when approval is requested
|
|
51
|
+
if (state !== 'approval-requested') {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return (_jsx("div", { className: cn('flex items-center justify-end gap-2 self-end', className), ...props }));
|
|
55
|
+
};
|
|
56
|
+
export const ConfirmationAction = (props) => (_jsx(Button, { className: "h-8 px-3 text-sm", type: "button", ...props }));
|
|
57
|
+
//# sourceMappingURL=confirmation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmation.js","sourceRoot":"","sources":["../../../src/components/ai-elements/confirmation.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAuB,aAAa,EAAkB,UAAU,EAAE,MAAM,OAAO,CAAC;AAOvF,MAAM,mBAAmB,GAAG,aAAa,CAAkC,IAAI,CAAC,CAAC;AAEjF,MAAM,eAAe,GAAG,GAAG,EAAE;IAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAEhD,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAOF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAqB,EAAE,EAAE;IAC3F,IAAI,CAAC,QAAQ,IAAI,KAAK,KAAK,iBAAiB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,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,eAAe,EAAE,CAAC;IAE9C,iDAAiD;IACjD,IACC,QAAQ,EAAE,QAAQ,KAAK,KAAK;QAC5B,CAAC,KAAK,KAAK,oBAAoB,IAAI,KAAK,KAAK,eAAe,IAAI,KAAK,KAAK,kBAAkB,CAAC,EAC5F,CAAC;QACF,OAAO,IAAI,CAAC;IACb,CAAC;IAED,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AAIF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA4B,EAAE,EAAE;IACxF,MAAM,EAAE,KAAK,EAAE,GAAG,eAAe,EAAE,CAAC;IAEpC,uCAAuC;IACvC,IAAI,KAAK,KAAK,oBAAoB,EAAE,CAAC;QACpC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,OAAO,CACN,cAAK,SAAS,EAAE,EAAE,CAAC,8CAA8C,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAC5F,CAAC;AACH,CAAC,CAAC;AAIF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAA8B,EAAE,EAAE,CAAC,CACrE,KAAC,MAAM,IAAC,SAAS,EAAC,kBAAkB,EAAC,IAAI,EAAC,QAAQ,KAAK,KAAK,GAAI,CAChE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/connection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAI7D,eAAO,MAAM,UAAU,EAAE,uBAWxB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const HALF = 0.5;
|
|
3
|
+
export const Connection = ({ fromX, fromY, toX, toY }) => (_jsxs("g", { children: [_jsx("path", { className: "animated", d: `M${fromX},${fromY} C ${fromX + (toX - fromX) * HALF},${fromY} ${fromX + (toX - fromX) * HALF},${toY} ${toX},${toY}`, fill: "none", stroke: "var(--color-ring)", strokeWidth: 1 }), _jsx("circle", { cx: toX, cy: toY, fill: "#fff", r: 3, stroke: "var(--color-ring)", strokeWidth: 1 })] }));
|
|
4
|
+
//# sourceMappingURL=connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/components/ai-elements/connection.tsx"],"names":[],"mappings":";AAEA,MAAM,IAAI,GAAG,GAAG,CAAC;AAEjB,MAAM,CAAC,MAAM,UAAU,GAA4B,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAClF,wBACC,eACC,SAAS,EAAC,UAAU,EACpB,CAAC,EAAE,IAAI,KAAK,IAAI,KAAK,MAAM,KAAK,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,IAAI,KAAK,IAAI,KAAK,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,EAAE,EACvH,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,mBAAmB,EAC1B,WAAW,EAAE,CAAC,GACb,EACF,iBAAQ,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAC,MAAM,EAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAC,mBAAmB,EAAC,WAAW,EAAE,CAAC,GAAI,IACtF,CACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Button } from '../ui/button';
|
|
2
|
+
import { HoverCard, HoverCardContent } from '../ui/hover-card';
|
|
3
|
+
import type { LanguageModelUsage } from 'ai';
|
|
4
|
+
import { type ComponentProps } from 'react';
|
|
5
|
+
type ModelId = string;
|
|
6
|
+
type ContextSchema = {
|
|
7
|
+
usedTokens: number;
|
|
8
|
+
maxTokens: number;
|
|
9
|
+
usage?: LanguageModelUsage;
|
|
10
|
+
modelId?: ModelId;
|
|
11
|
+
};
|
|
12
|
+
export type ContextProps = ComponentProps<typeof HoverCard> & ContextSchema;
|
|
13
|
+
export declare const Context: ({ usedTokens, maxTokens, usage, modelId, ...props }: ContextProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export type ContextTriggerProps = ComponentProps<typeof Button>;
|
|
15
|
+
export declare const ContextTrigger: ({ children, ...props }: ContextTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export type ContextContentProps = ComponentProps<typeof HoverCardContent>;
|
|
17
|
+
export declare const ContextContent: ({ className, ...props }: ContextContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export type ContextContentHeaderProps = ComponentProps<'div'>;
|
|
19
|
+
export declare const ContextContentHeader: ({ children, className, ...props }: ContextContentHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export type ContextContentBodyProps = ComponentProps<'div'>;
|
|
21
|
+
export declare const ContextContentBody: ({ children, className, ...props }: ContextContentBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export type ContextContentFooterProps = ComponentProps<'div'>;
|
|
23
|
+
export declare const ContextContentFooter: ({ children, className, ...props }: ContextContentFooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export type ContextInputUsageProps = ComponentProps<'div'>;
|
|
25
|
+
export declare const ContextInputUsage: ({ className, children, ...props }: ContextInputUsageProps) => string | number | bigint | true | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | null;
|
|
26
|
+
export type ContextOutputUsageProps = ComponentProps<'div'>;
|
|
27
|
+
export declare const ContextOutputUsage: ({ className, children, ...props }: ContextOutputUsageProps) => string | number | bigint | true | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | null;
|
|
28
|
+
export type ContextReasoningUsageProps = ComponentProps<'div'>;
|
|
29
|
+
export declare const ContextReasoningUsage: ({ className, children, ...props }: ContextReasoningUsageProps) => string | number | bigint | true | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | null;
|
|
30
|
+
export type ContextCacheUsageProps = ComponentProps<'div'>;
|
|
31
|
+
export declare const ContextCacheUsage: ({ className, children, ...props }: ContextCacheUsageProps) => string | number | bigint | true | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | null;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/context.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAoB,MAAM,kBAAkB,CAAC;AAGjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,IAAI,CAAC;AAC7C,OAAO,EAAE,KAAK,cAAc,EAA6B,MAAM,OAAO,CAAC;AASvE,KAAK,OAAO,GAAG,MAAM,CAAC;AAEtB,KAAK,aAAa,GAAG;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B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AAM,sBAAsB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE3D,eAAO,MAAM,iBAAiB,GAAI,mCAAmC,sBAAsB,6VA6B1F,CAAC"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from '../ui/button';
|
|
4
|
+
import { HoverCard, HoverCardContent, HoverCardTrigger } from '../ui/hover-card';
|
|
5
|
+
import { Progress } from '../ui/progress';
|
|
6
|
+
import { cn } from '../../lib/utils';
|
|
7
|
+
import { createContext, useContext } from 'react';
|
|
8
|
+
import { getUsage } from 'tokenlens';
|
|
9
|
+
const PERCENT_MAX = 100;
|
|
10
|
+
const ICON_RADIUS = 10;
|
|
11
|
+
const ICON_VIEWBOX = 24;
|
|
12
|
+
const ICON_CENTER = 12;
|
|
13
|
+
const ICON_STROKE_WIDTH = 2;
|
|
14
|
+
const ContextContext = createContext(null);
|
|
15
|
+
const useContextValue = () => {
|
|
16
|
+
const context = useContext(ContextContext);
|
|
17
|
+
if (!context) {
|
|
18
|
+
throw new Error('Context components must be used within Context');
|
|
19
|
+
}
|
|
20
|
+
return context;
|
|
21
|
+
};
|
|
22
|
+
export const Context = ({ usedTokens, maxTokens, usage, modelId, ...props }) => (_jsx(ContextContext.Provider, { value: {
|
|
23
|
+
usedTokens,
|
|
24
|
+
maxTokens,
|
|
25
|
+
usage,
|
|
26
|
+
modelId,
|
|
27
|
+
}, children: _jsx(HoverCard, { closeDelay: 0, openDelay: 0, ...props }) }));
|
|
28
|
+
const ContextIcon = () => {
|
|
29
|
+
const { usedTokens, maxTokens } = useContextValue();
|
|
30
|
+
const circumference = 2 * Math.PI * ICON_RADIUS;
|
|
31
|
+
const usedPercent = usedTokens / maxTokens;
|
|
32
|
+
const dashOffset = circumference * (1 - usedPercent);
|
|
33
|
+
return (_jsxs("svg", { "aria-label": "Model context usage", height: "20", role: "img", style: { color: 'currentcolor' }, viewBox: `0 0 ${ICON_VIEWBOX} ${ICON_VIEWBOX}`, width: "20", children: [_jsx("circle", { cx: ICON_CENTER, cy: ICON_CENTER, fill: "none", opacity: "0.25", r: ICON_RADIUS, stroke: "currentColor", strokeWidth: ICON_STROKE_WIDTH }), _jsx("circle", { cx: ICON_CENTER, cy: ICON_CENTER, fill: "none", opacity: "0.7", r: ICON_RADIUS, stroke: "currentColor", strokeDasharray: `${circumference} ${circumference}`, strokeDashoffset: dashOffset, strokeLinecap: "round", strokeWidth: ICON_STROKE_WIDTH, style: { transformOrigin: 'center', transform: 'rotate(-90deg)' } })] }));
|
|
34
|
+
};
|
|
35
|
+
export const ContextTrigger = ({ children, ...props }) => {
|
|
36
|
+
const { usedTokens, maxTokens } = useContextValue();
|
|
37
|
+
const usedPercent = usedTokens / maxTokens;
|
|
38
|
+
const renderedPercent = new Intl.NumberFormat('en-US', {
|
|
39
|
+
style: 'percent',
|
|
40
|
+
maximumFractionDigits: 1,
|
|
41
|
+
}).format(usedPercent);
|
|
42
|
+
return (_jsx(HoverCardTrigger, { asChild: true, children: children ?? (_jsxs(Button, { type: "button", variant: "ghost", ...props, children: [_jsx("span", { className: "font-medium text-muted-foreground", children: renderedPercent }), _jsx(ContextIcon, {})] })) }));
|
|
43
|
+
};
|
|
44
|
+
export const ContextContent = ({ className, ...props }) => (_jsx(HoverCardContent, { className: cn('min-w-60 divide-y overflow-hidden p-0', className), ...props }));
|
|
45
|
+
export const ContextContentHeader = ({ children, className, ...props }) => {
|
|
46
|
+
const { usedTokens, maxTokens } = useContextValue();
|
|
47
|
+
const usedPercent = usedTokens / maxTokens;
|
|
48
|
+
const displayPct = new Intl.NumberFormat('en-US', {
|
|
49
|
+
style: 'percent',
|
|
50
|
+
maximumFractionDigits: 1,
|
|
51
|
+
}).format(usedPercent);
|
|
52
|
+
const used = new Intl.NumberFormat('en-US', {
|
|
53
|
+
notation: 'compact',
|
|
54
|
+
}).format(usedTokens);
|
|
55
|
+
const total = new Intl.NumberFormat('en-US', {
|
|
56
|
+
notation: 'compact',
|
|
57
|
+
}).format(maxTokens);
|
|
58
|
+
return (_jsx("div", { className: cn('w-full space-y-2 p-3', className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center justify-between gap-3 text-xs", children: [_jsx("p", { children: displayPct }), _jsxs("p", { className: "font-mono text-muted-foreground", children: [used, " / ", total] })] }), _jsx("div", { className: "space-y-2", children: _jsx(Progress, { className: "bg-muted", value: usedPercent * PERCENT_MAX }) })] })) }));
|
|
59
|
+
};
|
|
60
|
+
export const ContextContentBody = ({ children, className, ...props }) => (_jsx("div", { className: cn('w-full p-3', className), ...props, children: children }));
|
|
61
|
+
export const ContextContentFooter = ({ children, className, ...props }) => {
|
|
62
|
+
const { modelId, usage } = useContextValue();
|
|
63
|
+
const costUSD = modelId
|
|
64
|
+
? getUsage({
|
|
65
|
+
modelId,
|
|
66
|
+
usage: {
|
|
67
|
+
input: usage?.inputTokens ?? 0,
|
|
68
|
+
output: usage?.outputTokens ?? 0,
|
|
69
|
+
},
|
|
70
|
+
}).costUSD?.totalUSD
|
|
71
|
+
: undefined;
|
|
72
|
+
const totalCost = new Intl.NumberFormat('en-US', {
|
|
73
|
+
style: 'currency',
|
|
74
|
+
currency: 'USD',
|
|
75
|
+
}).format(costUSD ?? 0);
|
|
76
|
+
return (_jsx("div", { className: cn('flex w-full items-center justify-between gap-3 bg-secondary p-3 text-xs', className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-muted-foreground", children: "Total cost" }), _jsx("span", { children: totalCost })] })) }));
|
|
77
|
+
};
|
|
78
|
+
export const ContextInputUsage = ({ className, children, ...props }) => {
|
|
79
|
+
const { usage, modelId } = useContextValue();
|
|
80
|
+
const inputTokens = usage?.inputTokens ?? 0;
|
|
81
|
+
if (children) {
|
|
82
|
+
return children;
|
|
83
|
+
}
|
|
84
|
+
if (!inputTokens) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
const inputCost = modelId
|
|
88
|
+
? getUsage({
|
|
89
|
+
modelId,
|
|
90
|
+
usage: { input: inputTokens, output: 0 },
|
|
91
|
+
}).costUSD?.totalUSD
|
|
92
|
+
: undefined;
|
|
93
|
+
const inputCostText = new Intl.NumberFormat('en-US', {
|
|
94
|
+
style: 'currency',
|
|
95
|
+
currency: 'USD',
|
|
96
|
+
}).format(inputCost ?? 0);
|
|
97
|
+
return (_jsxs("div", { className: cn('flex items-center justify-between text-xs', className), ...props, children: [_jsx("span", { className: "text-muted-foreground", children: "Input" }), _jsx(TokensWithCost, { costText: inputCostText, tokens: inputTokens })] }));
|
|
98
|
+
};
|
|
99
|
+
export const ContextOutputUsage = ({ className, children, ...props }) => {
|
|
100
|
+
const { usage, modelId } = useContextValue();
|
|
101
|
+
const outputTokens = usage?.outputTokens ?? 0;
|
|
102
|
+
if (children) {
|
|
103
|
+
return children;
|
|
104
|
+
}
|
|
105
|
+
if (!outputTokens) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
const outputCost = modelId
|
|
109
|
+
? getUsage({
|
|
110
|
+
modelId,
|
|
111
|
+
usage: { input: 0, output: outputTokens },
|
|
112
|
+
}).costUSD?.totalUSD
|
|
113
|
+
: undefined;
|
|
114
|
+
const outputCostText = new Intl.NumberFormat('en-US', {
|
|
115
|
+
style: 'currency',
|
|
116
|
+
currency: 'USD',
|
|
117
|
+
}).format(outputCost ?? 0);
|
|
118
|
+
return (_jsxs("div", { className: cn('flex items-center justify-between text-xs', className), ...props, children: [_jsx("span", { className: "text-muted-foreground", children: "Output" }), _jsx(TokensWithCost, { costText: outputCostText, tokens: outputTokens })] }));
|
|
119
|
+
};
|
|
120
|
+
export const ContextReasoningUsage = ({ className, children, ...props }) => {
|
|
121
|
+
const { usage, modelId } = useContextValue();
|
|
122
|
+
const reasoningTokens = usage?.reasoningTokens ?? 0;
|
|
123
|
+
if (children) {
|
|
124
|
+
return children;
|
|
125
|
+
}
|
|
126
|
+
if (!reasoningTokens) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
const reasoningCost = modelId
|
|
130
|
+
? getUsage({
|
|
131
|
+
modelId,
|
|
132
|
+
usage: { reasoningTokens },
|
|
133
|
+
}).costUSD?.totalUSD
|
|
134
|
+
: undefined;
|
|
135
|
+
const reasoningCostText = new Intl.NumberFormat('en-US', {
|
|
136
|
+
style: 'currency',
|
|
137
|
+
currency: 'USD',
|
|
138
|
+
}).format(reasoningCost ?? 0);
|
|
139
|
+
return (_jsxs("div", { className: cn('flex items-center justify-between text-xs', className), ...props, children: [_jsx("span", { className: "text-muted-foreground", children: "Reasoning" }), _jsx(TokensWithCost, { costText: reasoningCostText, tokens: reasoningTokens })] }));
|
|
140
|
+
};
|
|
141
|
+
export const ContextCacheUsage = ({ className, children, ...props }) => {
|
|
142
|
+
const { usage, modelId } = useContextValue();
|
|
143
|
+
const cacheTokens = usage?.cachedInputTokens ?? 0;
|
|
144
|
+
if (children) {
|
|
145
|
+
return children;
|
|
146
|
+
}
|
|
147
|
+
if (!cacheTokens) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
const cacheCost = modelId
|
|
151
|
+
? getUsage({
|
|
152
|
+
modelId,
|
|
153
|
+
usage: { cacheReads: cacheTokens, input: 0, output: 0 },
|
|
154
|
+
}).costUSD?.totalUSD
|
|
155
|
+
: undefined;
|
|
156
|
+
const cacheCostText = new Intl.NumberFormat('en-US', {
|
|
157
|
+
style: 'currency',
|
|
158
|
+
currency: 'USD',
|
|
159
|
+
}).format(cacheCost ?? 0);
|
|
160
|
+
return (_jsxs("div", { className: cn('flex items-center justify-between text-xs', className), ...props, children: [_jsx("span", { className: "text-muted-foreground", children: "Cache" }), _jsx(TokensWithCost, { costText: cacheCostText, tokens: cacheTokens })] }));
|
|
161
|
+
};
|
|
162
|
+
const TokensWithCost = ({ tokens, costText }) => (_jsxs("span", { children: [tokens === undefined
|
|
163
|
+
? '—'
|
|
164
|
+
: new Intl.NumberFormat('en-US', {
|
|
165
|
+
notation: 'compact',
|
|
166
|
+
}).format(tokens), costText ? _jsxs("span", { className: "ml-2 text-muted-foreground", children: ["\u2022 ", costText] }) : null] }));
|
|
167
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/components/ai-elements/context.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAuB,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,MAAM,WAAW,GAAG,GAAG,CAAC;AACxB,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAW5B,MAAM,cAAc,GAAG,aAAa,CAAuB,IAAI,CAAC,CAAC;AAEjE,MAAM,eAAe,GAAG,GAAG,EAAE;IAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAE3C,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAIF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,KAAK,EAAgB,EAAE,EA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} from '@xyflow/react';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
export type ControlsProps = ComponentProps<typeof ControlsPrimitive>;
|
|
4
|
+
export declare const Controls: ({ className, ...props }: ControlsProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
//# sourceMappingURL=controls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/controls.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAErE,eAAO,MAAM,QAAQ,GAAI,yBAAyB,aAAa,4CAS9D,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
import { Controls as ControlsPrimitive } from '@xyflow/react';
|
|
5
|
+
export const Controls = ({ className, ...props }) => (_jsx(ControlsPrimitive, { className: cn('gap-px overflow-hidden rounded-md border bg-card p-1 shadow-none!', '[&>button]:rounded-md [&>button]:border-none! [&>button]:bg-transparent! [&>button]:hover:bg-secondary!', className), ...props }));
|
|
6
|
+
//# sourceMappingURL=controls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controls.js","sourceRoot":"","sources":["../../../src/components/ai-elements/controls.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAK9D,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAiB,EAAE,EAAE,CAAC,CACnE,KAAC,iBAAiB,IACjB,SAAS,EAAE,EAAE,CACZ,mEAAmE,EACnE,yGAAyG,EACzG,SAAS,CACT,KACG,KAAK,GACR,CACF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Button } from '../ui/button';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
import { StickToBottom } from 'use-stick-to-bottom';
|
|
4
|
+
export type ConversationProps = ComponentProps<typeof StickToBottom>;
|
|
5
|
+
export declare const Conversation: ({ className, ...props }: ConversationProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export type ConversationContentProps = ComponentProps<typeof StickToBottom.Content>;
|
|
7
|
+
export declare const ConversationContent: ({ className, ...props }: ConversationContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export type ConversationEmptyStateProps = ComponentProps<'div'> & {
|
|
9
|
+
title?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
export declare const ConversationEmptyState: ({ className, title, description, icon, children, ...props }: ConversationEmptyStateProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export type ConversationScrollButtonProps = ComponentProps<typeof Button>;
|
|
15
|
+
export declare const ConversationScrollButton: ({ className, ...props }: ConversationScrollButtonProps) => false | import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/conversation.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,aAAa,EAA2B,MAAM,qBAAqB,CAAC;AAE7E,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,OAAO,aAAa,CAAC,CAAC;AAErE,eAAO,MAAM,YAAY,GAAI,yBAAyB,iBAAiB,4CAQtE,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC;AAEpF,eAAO,MAAM,mBAAmB,GAAI,yBAAyB,wBAAwB,4CAEpF,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,6DAOpC,2BAA2B,4CAkB7B,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAE1E,eAAO,MAAM,wBAAwB,GAAI,yBAGtC,6BAA6B,oDAwB/B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from '../ui/button';
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
|
+
import { ArrowDownIcon } from 'lucide-react';
|
|
6
|
+
import { useCallback } from 'react';
|
|
7
|
+
import { StickToBottom, useStickToBottomContext } from 'use-stick-to-bottom';
|
|
8
|
+
export const Conversation = ({ className, ...props }) => (_jsx(StickToBottom, { className: cn('relative flex-1 overflow-y-auto', className), initial: "smooth", resize: "smooth", role: "log", ...props }));
|
|
9
|
+
export const ConversationContent = ({ className, ...props }) => (_jsx(StickToBottom.Content, { className: cn('p-4', className), ...props }));
|
|
10
|
+
export const ConversationEmptyState = ({ className, title = 'No messages yet', description = 'Start a conversation to see messages here', icon, children, ...props }) => (_jsx("div", { className: cn('flex size-full flex-col items-center justify-center gap-3 p-8 text-center', className), ...props, children: children ?? (_jsxs(_Fragment, { children: [icon && _jsx("div", { className: "text-muted-foreground", children: icon }), _jsxs("div", { className: "space-y-1", children: [_jsx("h3", { className: "font-medium text-sm", children: title }), description && _jsx("p", { className: "text-muted-foreground text-sm", children: description })] })] })) }));
|
|
11
|
+
export const ConversationScrollButton = ({ className, ...props }) => {
|
|
12
|
+
const { isAtBottom, scrollToBottom } = useStickToBottomContext();
|
|
13
|
+
const handleScrollToBottom = useCallback(() => {
|
|
14
|
+
scrollToBottom();
|
|
15
|
+
}, [scrollToBottom]);
|
|
16
|
+
return (!isAtBottom && (_jsx(Button, { className: cn('absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full', className), onClick: handleScrollToBottom, size: "icon", type: "button", variant: "outline", ...props, children: _jsx(ArrowDownIcon, { className: "size-4" }) })));
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=conversation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../../src/components/ai-elements/conversation.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAI7E,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAqB,EAAE,EAAE,CAAC,CAC3E,KAAC,aAAa,IACb,SAAS,EAAE,EAAE,CAAC,iCAAiC,EAAE,SAAS,CAAC,EAC3D,OAAO,EAAC,QAAQ,EAChB,MAAM,EAAC,QAAQ,EACf,IAAI,EAAC,KAAK,KACN,KAAK,GACR,CACF,CAAC;AAIF,M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Aa,IAAC,SAAS,EAAC,QAAQ,GAAG,GAC5B,CACT,CACD,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type EdgeProps } from '@xyflow/react';
|
|
2
|
+
export declare const Edge: {
|
|
3
|
+
Temporary: ({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, }: EdgeProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
Animated: ({ id, source, target, markerEnd, style }: EdgeProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=edge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/edge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,SAAS,EAOd,MAAM,eAAe,CAAC;AAsHvB,eAAO,MAAM,IAAI;6FA5Gd,SAAS;yDA+EgD,SAAS;CAgCpE,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BaseEdge, getBezierPath, getSimpleBezierPath, Position, useInternalNode, } from '@xyflow/react';
|
|
3
|
+
const Temporary = ({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, }) => {
|
|
4
|
+
const [edgePath] = getSimpleBezierPath({
|
|
5
|
+
sourceX,
|
|
6
|
+
sourceY,
|
|
7
|
+
sourcePosition,
|
|
8
|
+
targetX,
|
|
9
|
+
targetY,
|
|
10
|
+
targetPosition,
|
|
11
|
+
});
|
|
12
|
+
return (_jsx(BaseEdge, { className: "stroke-1 stroke-ring", id: id, path: edgePath, style: {
|
|
13
|
+
strokeDasharray: '5, 5',
|
|
14
|
+
} }));
|
|
15
|
+
};
|
|
16
|
+
const getHandleCoordsByPosition = (node, handlePosition) => {
|
|
17
|
+
// Choose the handle type based on position - Left is for target, Right is for source
|
|
18
|
+
const handleType = handlePosition === Position.Left ? 'target' : 'source';
|
|
19
|
+
const handle = node.internals.handleBounds?.[handleType]?.find((h) => h.position === handlePosition);
|
|
20
|
+
if (!handle) {
|
|
21
|
+
return [0, 0];
|
|
22
|
+
}
|
|
23
|
+
let offsetX = handle.width / 2;
|
|
24
|
+
let offsetY = handle.height / 2;
|
|
25
|
+
// this is a tiny detail to make the markerEnd of an edge visible.
|
|
26
|
+
// The handle position that gets calculated has the origin top-left, so depending which side we are using, we add a little offset
|
|
27
|
+
// when the handlePosition is Position.Right for example, we need to add an offset as big as the handle itself in order to get the correct position
|
|
28
|
+
switch (handlePosition) {
|
|
29
|
+
case Position.Left:
|
|
30
|
+
offsetX = 0;
|
|
31
|
+
break;
|
|
32
|
+
case Position.Right:
|
|
33
|
+
offsetX = handle.width;
|
|
34
|
+
break;
|
|
35
|
+
case Position.Top:
|
|
36
|
+
offsetY = 0;
|
|
37
|
+
break;
|
|
38
|
+
case Position.Bottom:
|
|
39
|
+
offsetY = handle.height;
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
42
|
+
throw new Error(`Invalid handle position: ${handlePosition}`);
|
|
43
|
+
}
|
|
44
|
+
const x = node.internals.positionAbsolute.x + handle.x + offsetX;
|
|
45
|
+
const y = node.internals.positionAbsolute.y + handle.y + offsetY;
|
|
46
|
+
return [x, y];
|
|
47
|
+
};
|
|
48
|
+
const getEdgeParams = (source, target) => {
|
|
49
|
+
const sourcePos = Position.Right;
|
|
50
|
+
const [sx, sy] = getHandleCoordsByPosition(source, sourcePos);
|
|
51
|
+
const targetPos = Position.Left;
|
|
52
|
+
const [tx, ty] = getHandleCoordsByPosition(target, targetPos);
|
|
53
|
+
return {
|
|
54
|
+
sx,
|
|
55
|
+
sy,
|
|
56
|
+
tx,
|
|
57
|
+
ty,
|
|
58
|
+
sourcePos,
|
|
59
|
+
targetPos,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
const Animated = ({ id, source, target, markerEnd, style }) => {
|
|
63
|
+
const sourceNode = useInternalNode(source);
|
|
64
|
+
const targetNode = useInternalNode(target);
|
|
65
|
+
if (!(sourceNode && targetNode)) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const { sx, sy, tx, ty, sourcePos, targetPos } = getEdgeParams(sourceNode, targetNode);
|
|
69
|
+
const [edgePath] = getBezierPath({
|
|
70
|
+
sourceX: sx,
|
|
71
|
+
sourceY: sy,
|
|
72
|
+
sourcePosition: sourcePos,
|
|
73
|
+
targetX: tx,
|
|
74
|
+
targetY: ty,
|
|
75
|
+
targetPosition: targetPos,
|
|
76
|
+
});
|
|
77
|
+
return (_jsxs(_Fragment, { children: [_jsx(BaseEdge, { id: id, markerEnd: markerEnd, path: edgePath, style: style }), _jsx("circle", { fill: "var(--primary)", r: "4", children: _jsx("animateMotion", { dur: "2s", path: edgePath, repeatCount: "indefinite" }) })] }));
|
|
78
|
+
};
|
|
79
|
+
export const Edge = {
|
|
80
|
+
Temporary,
|
|
81
|
+
Animated,
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=edge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge.js","sourceRoot":"","sources":["../../../src/components/ai-elements/edge.tsx"],"names":[],"mappings":";AAAA,OAAO,EACN,QAAQ,EAER,aAAa,EACb,mBAAmB,EAGnB,QAAQ,EACR,eAAe,GACf,MAAM,eAAe,CAAC;AAEvB,MAAM,SAAS,GAAG,CAAC,EAClB,EAAE,EACF,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,cAAc,EACd,cAAc,GACH,EAAE,EAAE;IACf,MAAM,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC;QACtC,OAAO;QACP,OAAO;QACP,cAAc;QACd,OAAO;QACP,OAAO;QACP,cAAc;KACd,CAAC,CAAC;IAEH,OAAO,CACN,KAAC,QAAQ,IACR,SAAS,EAAC,sBAAsB,EAChC,EAAE,EAAE,EA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AAS;QACzB,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,EAAE;QACX,cAAc,EAAE,SAAS;KACzB,CAAC,CAAC;IAEH,OAAO,CACN,8BACC,KAAC,QAAQ,IAAC,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,GAAI,EACxE,iBAAQ,IAAI,EAAC,gBAAgB,EAAC,CAAC,EAAC,GAAG,YAClC,wBAAe,GAAG,EAAC,IAAI,EAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAC,YAAY,GAAG,GAC3D,IACP,CACH,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG;IACnB,SAAS;IACT,QAAQ;CACR,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Experimental_GeneratedImage } from 'ai';
|
|
2
|
+
export type ImageProps = Experimental_GeneratedImage & {
|
|
3
|
+
className?: string;
|
|
4
|
+
alt?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const Image: ({ base64, uint8Array, mediaType, ...props }: ImageProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/image.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,IAAI,CAAC;AAEtD,MAAM,MAAM,UAAU,GAAG,2BAA2B,GAAG;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,6CAA6C,UAAU,4CAO5E,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../lib/utils';
|
|
3
|
+
export const Image = ({ base64, uint8Array, mediaType, ...props }) => (_jsx("img", { ...props, alt: props.alt, className: cn('h-auto max-w-full overflow-hidden rounded-md', props.className), src: `data:${mediaType};base64,${base64}` }));
|
|
4
|
+
//# sourceMappingURL=image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../src/components/ai-elements/image.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAQrC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,EAAc,EAAE,EAAE,CAAC,CACjF,iBACK,KAAK,EACT,GAAG,EAAE,KAAK,CAAC,GAAG,EACd,SAAS,EAAE,EAAE,CAAC,8CAA8C,EAAE,KAAK,CAAC,SAAS,CAAC,EAC9E,GAAG,EAAE,QAAQ,SAAS,WAAW,MAAM,EAAE,GACxC,CACF,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Badge } from '../ui/badge';
|
|
2
|
+
import { Carousel } from '../ui/carousel';
|
|
3
|
+
import { HoverCard } from '../ui/hover-card';
|
|
4
|
+
import { type ComponentProps } from 'react';
|
|
5
|
+
export type InlineCitationProps = ComponentProps<'span'>;
|
|
6
|
+
export declare const InlineCitation: ({ className, ...props }: InlineCitationProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export type InlineCitationTextProps = ComponentProps<'span'>;
|
|
8
|
+
export declare const InlineCitationText: ({ className, ...props }: InlineCitationTextProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export type InlineCitationCardProps = ComponentProps<typeof HoverCard>;
|
|
10
|
+
export declare const InlineCitationCard: (props: InlineCitationCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export type InlineCitationCardTriggerProps = ComponentProps<typeof Badge> & {
|
|
12
|
+
sources: string[];
|
|
13
|
+
};
|
|
14
|
+
export declare const InlineCitationCardTrigger: ({ sources, className, ...props }: InlineCitationCardTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export type InlineCitationCardBodyProps = ComponentProps<'div'>;
|
|
16
|
+
export declare const InlineCitationCardBody: ({ className, ...props }: InlineCitationCardBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export type InlineCitationCarouselProps = ComponentProps<typeof Carousel>;
|
|
18
|
+
export declare const InlineCitationCarousel: ({ className, children, ...props }: InlineCitationCarouselProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export type InlineCitationCarouselContentProps = ComponentProps<'div'>;
|
|
20
|
+
export declare const InlineCitationCarouselContent: (props: InlineCitationCarouselContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export type InlineCitationCarouselItemProps = ComponentProps<'div'>;
|
|
22
|
+
export declare const InlineCitationCarouselItem: ({ className, ...props }: InlineCitationCarouselItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export type InlineCitationCarouselHeaderProps = ComponentProps<'div'>;
|
|
24
|
+
export declare const InlineCitationCarouselHeader: ({ className, ...props }: InlineCitationCarouselHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export type InlineCitationCarouselIndexProps = ComponentProps<'div'>;
|
|
26
|
+
export declare const InlineCitationCarouselIndex: ({ children, className, ...props }: InlineCitationCarouselIndexProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export type InlineCitationCarouselPrevProps = ComponentProps<'button'>;
|
|
28
|
+
export declare const InlineCitationCarouselPrev: ({ className, ...props }: InlineCitationCarouselPrevProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export type InlineCitationCarouselNextProps = ComponentProps<'button'>;
|
|
30
|
+
export declare const InlineCitationCarouselNext: ({ className, ...props }: InlineCitationCarouselNextProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export type InlineCitationSourceProps = ComponentProps<'div'> & {
|
|
32
|
+
title?: string;
|
|
33
|
+
url?: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
};
|
|
36
|
+
export declare const InlineCitationSource: ({ title, url, description, className, children, ...props }: InlineCitationSourceProps) => import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export type InlineCitationQuoteProps = ComponentProps<'blockquote'>;
|
|
38
|
+
export declare const InlineCitationQuote: ({ children, className, ...props }: InlineCitationQuoteProps) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
//# sourceMappingURL=inline-citation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-citation.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/inline-citation.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAmD,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,SAAS,EAAsC,MAAM,kBAAkB,CAAC;AAGjF,OAAO,EACN,KAAK,cAAc,EAMnB,MAAM,OAAO,CAAC;AAEf,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;AAEzD,eAAO,MAAM,cAAc,GAAI,yBAAyB,mBAAmB,4CAE1E,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;AAE7D,eAAO,MAAM,kBAAkB,GAAI,yBAAyB,uBAAuB,4CAElF,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,CAAC;AAEvE,eAAO,MAAM,kBAAkB,GAAI,OAAO,uBAAuB,4CAEhE,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,cAAc,CAAC,OAAO,KAAK,CAAC,GAAG;IAC3E,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,kCAIvC,8BAA8B,4CAYhC,CAAC;AAEF,MAAM,MAAM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