@wzh-/ai-chat-example 1.0.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/.vscode/extensions.json +3 -0
- package/.vscode/settings.json +6 -0
- package/README.md +5 -0
- package/auto-imports.d.ts +73 -0
- package/components.d.ts +312 -0
- package/components.json +21 -0
- package/index.html +13 -0
- package/package.json +60 -0
- package/public/vite.svg +1 -0
- package/src/App.vue +68 -0
- package/src/components/ChatConversation/ChatConversation.vue +97 -0
- package/src/components/ChatConversation/index.ts +1 -0
- package/src/components/ChatPromptInputProvider/ChatPromptInputProvider.vue +47 -0
- package/src/components/ChatPromptInputProvider/index.ts +1 -0
- package/src/components/ai-elements/artifact/Artifact.vue +23 -0
- package/src/components/ai-elements/artifact/ArtifactAction.vue +72 -0
- package/src/components/ai-elements/artifact/ArtifactActions.vue +19 -0
- package/src/components/ai-elements/artifact/ArtifactClose.vue +39 -0
- package/src/components/ai-elements/artifact/ArtifactContent.vue +20 -0
- package/src/components/ai-elements/artifact/ArtifactDescription.vue +20 -0
- package/src/components/ai-elements/artifact/ArtifactHeader.vue +23 -0
- package/src/components/ai-elements/artifact/ArtifactTitle.vue +20 -0
- package/src/components/ai-elements/artifact/index.ts +8 -0
- package/src/components/ai-elements/canvas/Canvas.vue +37 -0
- package/src/components/ai-elements/canvas/index.ts +1 -0
- package/src/components/ai-elements/chain-of-thought/ChainOfThought.vue +41 -0
- package/src/components/ai-elements/chain-of-thought/ChainOfThoughtContent.vue +32 -0
- package/src/components/ai-elements/chain-of-thought/ChainOfThoughtHeader.vue +43 -0
- package/src/components/ai-elements/chain-of-thought/ChainOfThoughtImage.vue +25 -0
- package/src/components/ai-elements/chain-of-thought/ChainOfThoughtSearchResult.vue +24 -0
- package/src/components/ai-elements/chain-of-thought/ChainOfThoughtSearchResults.vue +17 -0
- package/src/components/ai-elements/chain-of-thought/ChainOfThoughtStep.vue +54 -0
- package/src/components/ai-elements/chain-of-thought/context.ts +22 -0
- package/src/components/ai-elements/chain-of-thought/index.ts +7 -0
- package/src/components/ai-elements/checkpoint/Checkpoint.vue +19 -0
- package/src/components/ai-elements/checkpoint/CheckpointIcon.vue +19 -0
- package/src/components/ai-elements/checkpoint/CheckpointTrigger.vue +46 -0
- package/src/components/ai-elements/checkpoint/index.ts +3 -0
- package/src/components/ai-elements/code-block/CodeBlock.vue +84 -0
- package/src/components/ai-elements/code-block/CodeBlockCopyButton.vue +84 -0
- package/src/components/ai-elements/code-block/context.ts +7 -0
- package/src/components/ai-elements/code-block/index.ts +2 -0
- package/src/components/ai-elements/code-block/utils.ts +46 -0
- package/src/components/ai-elements/confirmation/Confirmation.vue +30 -0
- package/src/components/ai-elements/confirmation/ConfirmationAccepted.vue +18 -0
- package/src/components/ai-elements/confirmation/ConfirmationAction.vue +9 -0
- package/src/components/ai-elements/confirmation/ConfirmationActions.vue +23 -0
- package/src/components/ai-elements/confirmation/ConfirmationRejected.vue +18 -0
- package/src/components/ai-elements/confirmation/ConfirmationRequest.vue +11 -0
- package/src/components/ai-elements/confirmation/ConfirmationTitle.vue +18 -0
- package/src/components/ai-elements/confirmation/context.ts +46 -0
- package/src/components/ai-elements/confirmation/index.ts +7 -0
- package/src/components/ai-elements/connection/Connection.vue +36 -0
- package/src/components/ai-elements/connection/index.ts +1 -0
- package/src/components/ai-elements/context/Context.vue +29 -0
- package/src/components/ai-elements/context/ContextCacheUsage.vue +45 -0
- package/src/components/ai-elements/context/ContextContent.vue +20 -0
- package/src/components/ai-elements/context/ContextContentBody.vue +14 -0
- package/src/components/ai-elements/context/ContextContentFooter.vue +49 -0
- package/src/components/ai-elements/context/ContextContentHeader.vue +49 -0
- package/src/components/ai-elements/context/ContextIcon.vue +62 -0
- package/src/components/ai-elements/context/ContextInputUsage.vue +46 -0
- package/src/components/ai-elements/context/ContextOutputUsage.vue +45 -0
- package/src/components/ai-elements/context/ContextReasoningUsage.vue +48 -0
- package/src/components/ai-elements/context/ContextTrigger.vue +32 -0
- package/src/components/ai-elements/context/TokensWithCost.vue +25 -0
- package/src/components/ai-elements/context/context.ts +23 -0
- package/src/components/ai-elements/context/index.ts +12 -0
- package/src/components/ai-elements/controls/Controls.vue +25 -0
- package/src/components/ai-elements/controls/index.ts +1 -0
- package/src/components/ai-elements/conversation/Conversation.vue +37 -0
- package/src/components/ai-elements/conversation/ConversationContent.vue +21 -0
- package/src/components/ai-elements/conversation/ConversationEmptyState.vue +40 -0
- package/src/components/ai-elements/conversation/ConversationScrollButton.vue +34 -0
- package/src/components/ai-elements/conversation/index.ts +4 -0
- package/src/components/ai-elements/edge/Animated.vue +91 -0
- package/src/components/ai-elements/edge/Temporary.vue +28 -0
- package/src/components/ai-elements/edge/index.ts +2 -0
- package/src/components/ai-elements/image/Image.vue +29 -0
- package/src/components/ai-elements/image/index.ts +1 -0
- package/src/components/ai-elements/inline-citation/InlineCitation.vue +14 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCard.vue +17 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCardBody.vue +15 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCardTrigger.vue +35 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCarousel.vue +15 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCarouselContent.vue +9 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCarouselHeader.vue +16 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCarouselIndex.vue +46 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCarouselItem.vue +15 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCarouselNext.vue +23 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCarouselPrev.vue +23 -0
- package/src/components/ai-elements/inline-citation/InlineCitationQuote.vue +16 -0
- package/src/components/ai-elements/inline-citation/InlineCitationSource.vue +26 -0
- package/src/components/ai-elements/inline-citation/InlineCitationText.vue +14 -0
- package/src/components/ai-elements/inline-citation/index.ts +14 -0
- package/src/components/ai-elements/loader/Loader.vue +23 -0
- package/src/components/ai-elements/loader/LoaderIcon.vue +38 -0
- package/src/components/ai-elements/loader/index.ts +2 -0
- package/src/components/ai-elements/message/Message.vue +27 -0
- package/src/components/ai-elements/message/MessageAction.vue +45 -0
- package/src/components/ai-elements/message/MessageActions.vue +19 -0
- package/src/components/ai-elements/message/MessageAttachment.vue +87 -0
- package/src/components/ai-elements/message/MessageAttachments.vue +25 -0
- package/src/components/ai-elements/message/MessageAvatar.vue +22 -0
- package/src/components/ai-elements/message/MessageBranch.vue +66 -0
- package/src/components/ai-elements/message/MessageBranchContent.vue +51 -0
- package/src/components/ai-elements/message/MessageBranchNext.vue +23 -0
- package/src/components/ai-elements/message/MessageBranchPage.vue +28 -0
- package/src/components/ai-elements/message/MessageBranchPrevious.vue +23 -0
- package/src/components/ai-elements/message/MessageBranchSelector.vue +23 -0
- package/src/components/ai-elements/message/MessageContent.vue +26 -0
- package/src/components/ai-elements/message/MessageResponse.vue +42 -0
- package/src/components/ai-elements/message/MessageToolbar.vue +24 -0
- package/src/components/ai-elements/message/context.ts +22 -0
- package/src/components/ai-elements/message/index.ts +15 -0
- package/src/components/ai-elements/model-selector/ModelSelector.vue +9 -0
- package/src/components/ai-elements/model-selector/ModelSelectorContent.vue +29 -0
- package/src/components/ai-elements/model-selector/ModelSelectorDialog.vue +9 -0
- package/src/components/ai-elements/model-selector/ModelSelectorEmpty.vue +9 -0
- package/src/components/ai-elements/model-selector/ModelSelectorGroup.vue +9 -0
- package/src/components/ai-elements/model-selector/ModelSelectorInput.vue +18 -0
- package/src/components/ai-elements/model-selector/ModelSelectorItem.vue +10 -0
- package/src/components/ai-elements/model-selector/ModelSelectorList.vue +9 -0
- package/src/components/ai-elements/model-selector/ModelSelectorLogo.vue +22 -0
- package/src/components/ai-elements/model-selector/ModelSelectorLogoGroup.vue +24 -0
- package/src/components/ai-elements/model-selector/ModelSelectorName.vue +19 -0
- package/src/components/ai-elements/model-selector/ModelSelectorSeparator.vue +7 -0
- package/src/components/ai-elements/model-selector/ModelSelectorShortcut.vue +9 -0
- package/src/components/ai-elements/model-selector/ModelSelectorTrigger.vue +9 -0
- package/src/components/ai-elements/model-selector/index.ts +14 -0
- package/src/components/ai-elements/node/Node.vue +31 -0
- package/src/components/ai-elements/node/NodeAction.vue +9 -0
- package/src/components/ai-elements/node/NodeContent.vue +15 -0
- package/src/components/ai-elements/node/NodeDescription.vue +9 -0
- package/src/components/ai-elements/node/NodeFooter.vue +15 -0
- package/src/components/ai-elements/node/NodeHeader.vue +15 -0
- package/src/components/ai-elements/node/NodeTitle.vue +9 -0
- package/src/components/ai-elements/node/index.ts +7 -0
- package/src/components/ai-elements/open-in-chat/OpenIn.vue +20 -0
- package/src/components/ai-elements/open-in-chat/OpenInContent.vue +25 -0
- package/src/components/ai-elements/open-in-chat/OpenInItemLink.vue +30 -0
- package/src/components/ai-elements/open-in-chat/OpenInTrigger.vue +16 -0
- package/src/components/ai-elements/open-in-chat/context.ts +20 -0
- package/src/components/ai-elements/open-in-chat/index.ts +9 -0
- package/src/components/ai-elements/open-in-chat/providers/icons/ChatGPT.vue +13 -0
- package/src/components/ai-elements/open-in-chat/providers/icons/Claude.vue +15 -0
- package/src/components/ai-elements/open-in-chat/providers/icons/Cursor.vue +13 -0
- package/src/components/ai-elements/open-in-chat/providers/icons/Github.vue +8 -0
- package/src/components/ai-elements/open-in-chat/providers/icons/Scira.vue +58 -0
- package/src/components/ai-elements/open-in-chat/providers/icons/V0.vue +15 -0
- package/src/components/ai-elements/open-in-chat/providers/icons/index.ts +6 -0
- package/src/components/ai-elements/open-in-chat/providers/index.ts +69 -0
- package/src/components/ai-elements/open-in-chat/providers/items/OpenInChatGPT.vue +18 -0
- package/src/components/ai-elements/open-in-chat/providers/items/OpenInClaude.vue +18 -0
- package/src/components/ai-elements/open-in-chat/providers/items/OpenInCursor.vue +18 -0
- package/src/components/ai-elements/open-in-chat/providers/items/OpenInScira.vue +18 -0
- package/src/components/ai-elements/open-in-chat/providers/items/OpenInT3.vue +18 -0
- package/src/components/ai-elements/open-in-chat/providers/items/OpenInv0.vue +18 -0
- package/src/components/ai-elements/panel/Panel.vue +28 -0
- package/src/components/ai-elements/panel/index.ts +1 -0
- package/src/components/ai-elements/plan/Plan.vue +32 -0
- package/src/components/ai-elements/plan/PlanAction.vue +9 -0
- package/src/components/ai-elements/plan/PlanContent.vue +12 -0
- package/src/components/ai-elements/plan/PlanDescription.vue +25 -0
- package/src/components/ai-elements/plan/PlanFooter.vue +9 -0
- package/src/components/ai-elements/plan/PlanHeader.vue +18 -0
- package/src/components/ai-elements/plan/PlanTitle.vue +16 -0
- package/src/components/ai-elements/plan/PlanTrigger.vue +25 -0
- package/src/components/ai-elements/plan/context.ts +20 -0
- package/src/components/ai-elements/plan/index.ts +8 -0
- package/src/components/ai-elements/prompt-input/PromptInput.vue +116 -0
- package/src/components/ai-elements/prompt-input/PromptInputActionAddAttachments.vue +22 -0
- package/src/components/ai-elements/prompt-input/PromptInputActionMenu.vue +15 -0
- package/src/components/ai-elements/prompt-input/PromptInputActionMenuContent.vue +21 -0
- package/src/components/ai-elements/prompt-input/PromptInputActionMenuItem.vue +19 -0
- package/src/components/ai-elements/prompt-input/PromptInputActionMenuTrigger.vue +22 -0
- package/src/components/ai-elements/prompt-input/PromptInputAttachment.vue +94 -0
- package/src/components/ai-elements/prompt-input/PromptInputAttachments.vue +22 -0
- package/src/components/ai-elements/prompt-input/PromptInputBody.vue +12 -0
- package/src/components/ai-elements/prompt-input/PromptInputButton.vue +56 -0
- package/src/components/ai-elements/prompt-input/PromptInputCommand.vue +19 -0
- package/src/components/ai-elements/prompt-input/PromptInputCommandEmpty.vue +19 -0
- package/src/components/ai-elements/prompt-input/PromptInputCommandGroup.vue +19 -0
- package/src/components/ai-elements/prompt-input/PromptInputCommandInput.vue +17 -0
- package/src/components/ai-elements/prompt-input/PromptInputCommandItem.vue +19 -0
- package/src/components/ai-elements/prompt-input/PromptInputCommandList.vue +17 -0
- package/src/components/ai-elements/prompt-input/PromptInputCommandSeparator.vue +16 -0
- package/src/components/ai-elements/prompt-input/PromptInputFooter.vue +23 -0
- package/src/components/ai-elements/prompt-input/PromptInputHeader.vue +23 -0
- package/src/components/ai-elements/prompt-input/PromptInputHoverCard.vue +23 -0
- package/src/components/ai-elements/prompt-input/PromptInputHoverCardContent.vue +19 -0
- package/src/components/ai-elements/prompt-input/PromptInputHoverCardTrigger.vue +15 -0
- package/src/components/ai-elements/prompt-input/PromptInputProvider.vue +32 -0
- package/src/components/ai-elements/prompt-input/PromptInputSelect.vue +15 -0
- package/src/components/ai-elements/prompt-input/PromptInputSelectContent.vue +19 -0
- package/src/components/ai-elements/prompt-input/PromptInputSelectItem.vue +19 -0
- package/src/components/ai-elements/prompt-input/PromptInputSelectTrigger.vue +26 -0
- package/src/components/ai-elements/prompt-input/PromptInputSelectValue.vue +19 -0
- package/src/components/ai-elements/prompt-input/PromptInputSpeechButton.vue +137 -0
- package/src/components/ai-elements/prompt-input/PromptInputSubmit.vue +60 -0
- package/src/components/ai-elements/prompt-input/PromptInputTab.vue +16 -0
- package/src/components/ai-elements/prompt-input/PromptInputTabBody.vue +16 -0
- package/src/components/ai-elements/prompt-input/PromptInputTabItem.vue +16 -0
- package/src/components/ai-elements/prompt-input/PromptInputTabLabel.vue +16 -0
- package/src/components/ai-elements/prompt-input/PromptInputTabsList.vue +16 -0
- package/src/components/ai-elements/prompt-input/PromptInputTextarea.vue +78 -0
- package/src/components/ai-elements/prompt-input/PromptInputTools.vue +12 -0
- package/src/components/ai-elements/prompt-input/context.ts +223 -0
- package/src/components/ai-elements/prompt-input/index.ts +39 -0
- package/src/components/ai-elements/prompt-input/types.ts +28 -0
- package/src/components/ai-elements/queue/Queue.vue +21 -0
- package/src/components/ai-elements/queue/QueueItem.vue +21 -0
- package/src/components/ai-elements/queue/QueueItemAction.vue +25 -0
- package/src/components/ai-elements/queue/QueueItemActions.vue +14 -0
- package/src/components/ai-elements/queue/QueueItemAttachment.vue +14 -0
- package/src/components/ai-elements/queue/QueueItemContent.vue +32 -0
- package/src/components/ai-elements/queue/QueueItemDescription.vue +32 -0
- package/src/components/ai-elements/queue/QueueItemFile.vue +25 -0
- package/src/components/ai-elements/queue/QueueItemImage.vue +18 -0
- package/src/components/ai-elements/queue/QueueItemIndicator.vue +30 -0
- package/src/components/ai-elements/queue/QueueList.vue +22 -0
- package/src/components/ai-elements/queue/QueueSection.vue +26 -0
- package/src/components/ai-elements/queue/QueueSectionContent.vue +15 -0
- package/src/components/ai-elements/queue/QueueSectionLabel.vue +26 -0
- package/src/components/ai-elements/queue/QueueSectionTrigger.vue +25 -0
- package/src/components/ai-elements/queue/index.ts +15 -0
- package/src/components/ai-elements/reasoning/Reasoning.vue +94 -0
- package/src/components/ai-elements/reasoning/ReasoningContent.vue +41 -0
- package/src/components/ai-elements/reasoning/ReasoningTrigger.vue +61 -0
- package/src/components/ai-elements/reasoning/context.ts +19 -0
- package/src/components/ai-elements/reasoning/index.ts +3 -0
- package/src/components/ai-elements/shimmer/Shimmer.vue +69 -0
- package/src/components/ai-elements/shimmer/index.ts +1 -0
- package/src/components/ai-elements/sources/Source.vue +26 -0
- package/src/components/ai-elements/sources/Sources.vue +17 -0
- package/src/components/ai-elements/sources/SourcesContent.vue +23 -0
- package/src/components/ai-elements/sources/SourcesTrigger.vue +24 -0
- package/src/components/ai-elements/sources/index.ts +4 -0
- package/src/components/ai-elements/suggestion/Suggestion.vue +38 -0
- package/src/components/ai-elements/suggestion/Suggestions.vue +20 -0
- package/src/components/ai-elements/suggestion/index.ts +2 -0
- package/src/components/ai-elements/task/Task.vue +32 -0
- package/src/components/ai-elements/task/TaskContent.vue +27 -0
- package/src/components/ai-elements/task/TaskItem.vue +16 -0
- package/src/components/ai-elements/task/TaskItemFile.vue +18 -0
- package/src/components/ai-elements/task/TaskTrigger.vue +33 -0
- package/src/components/ai-elements/task/index.ts +5 -0
- package/src/components/ai-elements/tool/Tool.vue +18 -0
- package/src/components/ai-elements/tool/ToolContent.vue +23 -0
- package/src/components/ai-elements/tool/ToolHeader.vue +38 -0
- package/src/components/ai-elements/tool/ToolInput.vue +32 -0
- package/src/components/ai-elements/tool/ToolOutput.vue +69 -0
- package/src/components/ai-elements/tool/ToolStatusBadge.vue +63 -0
- package/src/components/ai-elements/tool/index.ts +5 -0
- package/src/components/ai-elements/toolbar/Toolbar.vue +32 -0
- package/src/components/ai-elements/toolbar/index.ts +1 -0
- package/src/components/ai-elements/web-preview/WebPreview.vue +60 -0
- package/src/components/ai-elements/web-preview/WebPreviewBody.vue +34 -0
- package/src/components/ai-elements/web-preview/WebPreviewConsole.vue +92 -0
- package/src/components/ai-elements/web-preview/WebPreviewNavigation.vue +21 -0
- package/src/components/ai-elements/web-preview/WebPreviewNavigationButton.vue +45 -0
- package/src/components/ai-elements/web-preview/WebPreviewUrl.vue +43 -0
- package/src/components/ai-elements/web-preview/context.ts +25 -0
- package/src/components/ai-elements/web-preview/index.ts +7 -0
- package/src/components/ui/alert/Alert.vue +21 -0
- package/src/components/ui/alert/AlertDescription.vue +17 -0
- package/src/components/ui/alert/AlertTitle.vue +17 -0
- package/src/components/ui/alert/index.ts +24 -0
- package/src/components/ui/avatar/Avatar.vue +18 -0
- package/src/components/ui/avatar/AvatarFallback.vue +21 -0
- package/src/components/ui/avatar/AvatarImage.vue +16 -0
- package/src/components/ui/avatar/index.ts +3 -0
- package/src/components/ui/badge/Badge.vue +26 -0
- package/src/components/ui/badge/index.ts +26 -0
- package/src/components/ui/button/Button.vue +29 -0
- package/src/components/ui/button/index.ts +38 -0
- package/src/components/ui/button-group/ButtonGroup.vue +22 -0
- package/src/components/ui/button-group/ButtonGroupSeparator.vue +24 -0
- package/src/components/ui/button-group/ButtonGroupText.vue +29 -0
- package/src/components/ui/button-group/index.ts +25 -0
- package/src/components/ui/card/Card.vue +22 -0
- package/src/components/ui/card/CardAction.vue +17 -0
- package/src/components/ui/card/CardContent.vue +17 -0
- package/src/components/ui/card/CardDescription.vue +17 -0
- package/src/components/ui/card/CardFooter.vue +17 -0
- package/src/components/ui/card/CardHeader.vue +17 -0
- package/src/components/ui/card/CardTitle.vue +17 -0
- package/src/components/ui/card/index.ts +7 -0
- package/src/components/ui/carousel/Carousel.vue +53 -0
- package/src/components/ui/carousel/CarouselContent.vue +33 -0
- package/src/components/ui/carousel/CarouselItem.vue +24 -0
- package/src/components/ui/carousel/CarouselNext.vue +41 -0
- package/src/components/ui/carousel/CarouselPrevious.vue +41 -0
- package/src/components/ui/carousel/index.ts +10 -0
- package/src/components/ui/carousel/interface.ts +26 -0
- package/src/components/ui/carousel/useCarousel.ts +56 -0
- package/src/components/ui/collapsible/Collapsible.vue +19 -0
- package/src/components/ui/collapsible/CollapsibleContent.vue +15 -0
- package/src/components/ui/collapsible/CollapsibleTrigger.vue +15 -0
- package/src/components/ui/collapsible/index.ts +3 -0
- package/src/components/ui/command/Command.vue +87 -0
- package/src/components/ui/command/CommandDialog.vue +31 -0
- package/src/components/ui/command/CommandEmpty.vue +27 -0
- package/src/components/ui/command/CommandGroup.vue +45 -0
- package/src/components/ui/command/CommandInput.vue +39 -0
- package/src/components/ui/command/CommandItem.vue +76 -0
- package/src/components/ui/command/CommandList.vue +25 -0
- package/src/components/ui/command/CommandSeparator.vue +21 -0
- package/src/components/ui/command/CommandShortcut.vue +17 -0
- package/src/components/ui/command/index.ts +25 -0
- package/src/components/ui/dialog/Dialog.vue +19 -0
- package/src/components/ui/dialog/DialogClose.vue +15 -0
- package/src/components/ui/dialog/DialogContent.vue +53 -0
- package/src/components/ui/dialog/DialogDescription.vue +23 -0
- package/src/components/ui/dialog/DialogFooter.vue +15 -0
- package/src/components/ui/dialog/DialogHeader.vue +17 -0
- package/src/components/ui/dialog/DialogOverlay.vue +21 -0
- package/src/components/ui/dialog/DialogScrollContent.vue +59 -0
- package/src/components/ui/dialog/DialogTitle.vue +23 -0
- package/src/components/ui/dialog/DialogTrigger.vue +15 -0
- package/src/components/ui/dialog/index.ts +10 -0
- package/src/components/ui/dropdown-menu/DropdownMenu.vue +19 -0
- package/src/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +39 -0
- package/src/components/ui/dropdown-menu/DropdownMenuContent.vue +39 -0
- package/src/components/ui/dropdown-menu/DropdownMenuGroup.vue +15 -0
- package/src/components/ui/dropdown-menu/DropdownMenuItem.vue +31 -0
- package/src/components/ui/dropdown-menu/DropdownMenuLabel.vue +23 -0
- package/src/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue +21 -0
- package/src/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +40 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSeparator.vue +23 -0
- package/src/components/ui/dropdown-menu/DropdownMenuShortcut.vue +17 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSub.vue +18 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSubContent.vue +27 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +30 -0
- package/src/components/ui/dropdown-menu/DropdownMenuTrigger.vue +17 -0
- package/src/components/ui/dropdown-menu/index.ts +16 -0
- package/src/components/ui/hover-card/HoverCard.vue +19 -0
- package/src/components/ui/hover-card/HoverCardContent.vue +43 -0
- package/src/components/ui/hover-card/HoverCardTrigger.vue +15 -0
- package/src/components/ui/hover-card/index.ts +3 -0
- package/src/components/ui/input/Input.vue +33 -0
- package/src/components/ui/input/index.ts +1 -0
- package/src/components/ui/input-group/InputGroup.vue +37 -0
- package/src/components/ui/input-group/InputGroupAddon.vue +36 -0
- package/src/components/ui/input-group/InputGroupButton.vue +21 -0
- package/src/components/ui/input-group/InputGroupInput.vue +19 -0
- package/src/components/ui/input-group/InputGroupText.vue +19 -0
- package/src/components/ui/input-group/InputGroupTextarea.vue +19 -0
- package/src/components/ui/input-group/index.ts +59 -0
- package/src/components/ui/progress/Progress.vue +38 -0
- package/src/components/ui/progress/index.ts +1 -0
- package/src/components/ui/scroll-area/ScrollArea.vue +33 -0
- package/src/components/ui/scroll-area/ScrollBar.vue +32 -0
- package/src/components/ui/scroll-area/index.ts +2 -0
- package/src/components/ui/select/Select.vue +19 -0
- package/src/components/ui/select/SelectContent.vue +51 -0
- package/src/components/ui/select/SelectGroup.vue +15 -0
- package/src/components/ui/select/SelectItem.vue +44 -0
- package/src/components/ui/select/SelectItemText.vue +15 -0
- package/src/components/ui/select/SelectLabel.vue +17 -0
- package/src/components/ui/select/SelectScrollDownButton.vue +26 -0
- package/src/components/ui/select/SelectScrollUpButton.vue +26 -0
- package/src/components/ui/select/SelectSeparator.vue +19 -0
- package/src/components/ui/select/SelectTrigger.vue +33 -0
- package/src/components/ui/select/SelectValue.vue +15 -0
- package/src/components/ui/select/index.ts +11 -0
- package/src/components/ui/separator/Separator.vue +29 -0
- package/src/components/ui/separator/index.ts +1 -0
- package/src/components/ui/textarea/Textarea.vue +28 -0
- package/src/components/ui/textarea/index.ts +1 -0
- package/src/components/ui/tooltip/Tooltip.vue +19 -0
- package/src/components/ui/tooltip/TooltipContent.vue +34 -0
- package/src/components/ui/tooltip/TooltipProvider.vue +14 -0
- package/src/components/ui/tooltip/TooltipTrigger.vue +15 -0
- package/src/components/ui/tooltip/index.ts +4 -0
- package/src/composables/useChat.ts +46 -0
- package/src/index.ts +3 -0
- package/src/lib/utils.ts +7 -0
- package/src/main.ts +5 -0
- package/src/request/index.ts +41 -0
- package/src/style.css +120 -0
- package/tsconfig.app.json +25 -0
- package/tsconfig.json +13 -0
- package/tsconfig.node.json +26 -0
- package/vite.config.ts +26 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { FileUIPart } from 'ai'
|
|
3
|
+
import type { HTMLAttributes } from 'vue'
|
|
4
|
+
import { Button } from '@/components/ui/button'
|
|
5
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
|
|
6
|
+
import { cn } from '@/lib/utils'
|
|
7
|
+
import { PaperclipIcon, XIcon } from 'lucide-vue-next'
|
|
8
|
+
import { computed } from 'vue'
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
data: FileUIPart
|
|
12
|
+
class?: HTMLAttributes['class']
|
|
13
|
+
}
|
|
14
|
+
const props = defineProps<Props>()
|
|
15
|
+
|
|
16
|
+
const emits = defineEmits<{
|
|
17
|
+
(e: 'remove'): void
|
|
18
|
+
}>()
|
|
19
|
+
|
|
20
|
+
const filename = computed(() => props.data.filename || '')
|
|
21
|
+
const mediaType = computed(() =>
|
|
22
|
+
props.data.mediaType?.startsWith('image/') && props.data.url ? 'image' : 'file',
|
|
23
|
+
)
|
|
24
|
+
const isImage = computed(() => mediaType.value === 'image')
|
|
25
|
+
const attachmentLabel = computed(() =>
|
|
26
|
+
filename.value || (isImage.value ? 'Image' : 'Attachment'),
|
|
27
|
+
)
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<div
|
|
32
|
+
:class="
|
|
33
|
+
cn(
|
|
34
|
+
'group relative size-24 overflow-hidden rounded-lg',
|
|
35
|
+
props.class,
|
|
36
|
+
)
|
|
37
|
+
"
|
|
38
|
+
v-bind="$attrs"
|
|
39
|
+
>
|
|
40
|
+
<template v-if="isImage">
|
|
41
|
+
<img
|
|
42
|
+
:src="props.data.url"
|
|
43
|
+
:alt="filename || 'attachment'"
|
|
44
|
+
class="size-full object-cover"
|
|
45
|
+
height="100"
|
|
46
|
+
width="100"
|
|
47
|
+
>
|
|
48
|
+
<Button
|
|
49
|
+
aria-label="Remove attachment"
|
|
50
|
+
class="absolute top-2 right-2 size-6 rounded-full bg-background/80 p-0 opacity-0 backdrop-blur-sm transition-opacity hover:bg-background group-hover:opacity-100 [&>svg]:size-3"
|
|
51
|
+
type="button"
|
|
52
|
+
variant="ghost"
|
|
53
|
+
@click.stop="emits('remove')"
|
|
54
|
+
>
|
|
55
|
+
<XIcon />
|
|
56
|
+
<span class="sr-only">Remove</span>
|
|
57
|
+
</Button>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<template v-else>
|
|
61
|
+
<TooltipProvider>
|
|
62
|
+
<Tooltip>
|
|
63
|
+
<TooltipTrigger as-child>
|
|
64
|
+
<div
|
|
65
|
+
class="flex size-full shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground"
|
|
66
|
+
>
|
|
67
|
+
<PaperclipIcon class="size-4" />
|
|
68
|
+
</div>
|
|
69
|
+
</TooltipTrigger>
|
|
70
|
+
<TooltipContent>
|
|
71
|
+
<p>{{ attachmentLabel }}</p>
|
|
72
|
+
</TooltipContent>
|
|
73
|
+
</Tooltip>
|
|
74
|
+
</TooltipProvider>
|
|
75
|
+
<Button
|
|
76
|
+
aria-label="Remove attachment"
|
|
77
|
+
class="size-6 shrink-0 rounded-full p-0 opacity-0 transition-opacity hover:bg-accent group-hover:opacity-100 [&>svg]:size-3"
|
|
78
|
+
type="button"
|
|
79
|
+
variant="ghost"
|
|
80
|
+
@click.stop="emits('remove')"
|
|
81
|
+
>
|
|
82
|
+
<XIcon />
|
|
83
|
+
<span class="sr-only">Remove</span>
|
|
84
|
+
</Button>
|
|
85
|
+
</template>
|
|
86
|
+
</div>
|
|
87
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
class?: HTMLAttributes['class']
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const props = defineProps<Props>()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div
|
|
14
|
+
v-if="$slots.default"
|
|
15
|
+
:class="
|
|
16
|
+
cn(
|
|
17
|
+
'ml-auto flex w-fit flex-wrap items-start gap-2',
|
|
18
|
+
props.class,
|
|
19
|
+
)
|
|
20
|
+
"
|
|
21
|
+
v-bind="$attrs"
|
|
22
|
+
>
|
|
23
|
+
<slot />
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
src: string
|
|
8
|
+
name?: string
|
|
9
|
+
class?: HTMLAttributes['class']
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const props = defineProps<Props>()
|
|
13
|
+
|
|
14
|
+
const fallbackText = computed(() => props.name?.slice(0, 2) ?? 'ME')
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<Avatar class="size-8 ring-1 ring-border" :class="[props.class]" v-bind="$attrs">
|
|
19
|
+
<AvatarImage alt="" class="mt-0 mb-0" :src="props.src" />
|
|
20
|
+
<AvatarFallback>{{ fallbackText }}</AvatarFallback>
|
|
21
|
+
</Avatar>
|
|
22
|
+
</template>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes, VNode } from 'vue'
|
|
3
|
+
import type { MessageBranchContextType } from './context'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
import { provide, readonly, ref } from 'vue'
|
|
6
|
+
import { MessageBranchKey } from './context'
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
defaultBranch?: number
|
|
10
|
+
class?: HTMLAttributes['class']
|
|
11
|
+
}
|
|
12
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
13
|
+
defaultBranch: 0,
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const emits = defineEmits<{
|
|
17
|
+
(e: 'branchChange', branchIndex: number): void
|
|
18
|
+
}>()
|
|
19
|
+
|
|
20
|
+
const currentBranch = ref<number>(props.defaultBranch)
|
|
21
|
+
const branches = ref<VNode[]>([])
|
|
22
|
+
const totalBranches = ref<number>(0)
|
|
23
|
+
|
|
24
|
+
function handleBranchChange(index: number) {
|
|
25
|
+
currentBranch.value = index
|
|
26
|
+
emits('branchChange', index)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function goToPrevious() {
|
|
30
|
+
if (totalBranches.value === 0)
|
|
31
|
+
return
|
|
32
|
+
const next = currentBranch.value > 0 ? currentBranch.value - 1 : totalBranches.value - 1
|
|
33
|
+
handleBranchChange(next)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function goToNext() {
|
|
37
|
+
if (totalBranches.value === 0)
|
|
38
|
+
return
|
|
39
|
+
const next = currentBranch.value < totalBranches.value - 1 ? currentBranch.value + 1 : 0
|
|
40
|
+
handleBranchChange(next)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function setBranches(count: number) {
|
|
44
|
+
totalBranches.value = count
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const contextValue: MessageBranchContextType = {
|
|
48
|
+
currentBranch: readonly(currentBranch),
|
|
49
|
+
totalBranches: readonly(totalBranches),
|
|
50
|
+
goToPrevious,
|
|
51
|
+
goToNext,
|
|
52
|
+
branches,
|
|
53
|
+
setBranches,
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
provide(MessageBranchKey, contextValue)
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<template>
|
|
60
|
+
<div
|
|
61
|
+
:class="cn('grid w-full gap-2 [&>div]:pb-0', props.class)"
|
|
62
|
+
v-bind="$attrs"
|
|
63
|
+
>
|
|
64
|
+
<slot />
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { computed, Fragment, isVNode, onMounted, useSlots, watch } from 'vue'
|
|
5
|
+
import { useMessageBranchContext } from './context'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
class?: HTMLAttributes['class']
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const props = defineProps<Props>()
|
|
12
|
+
const slots = useSlots()
|
|
13
|
+
|
|
14
|
+
const { currentBranch, setBranches } = useMessageBranchContext()
|
|
15
|
+
|
|
16
|
+
const branchVNodes = computed(() => {
|
|
17
|
+
const nodes = slots.default?.() ?? []
|
|
18
|
+
|
|
19
|
+
const extractChildren = (node: any): any[] => {
|
|
20
|
+
if (isVNode(node) && node.type === Fragment) {
|
|
21
|
+
return Array.isArray(node.children) ? node.children : []
|
|
22
|
+
}
|
|
23
|
+
return [node]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const allNodes = nodes.flatMap(extractChildren)
|
|
27
|
+
|
|
28
|
+
return allNodes.filter((node) => {
|
|
29
|
+
if (!isVNode(node))
|
|
30
|
+
return false
|
|
31
|
+
return node.type && typeof node.type === 'object'
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const sync = () => setBranches(branchVNodes.value.length)
|
|
36
|
+
onMounted(sync)
|
|
37
|
+
watch(branchVNodes, sync)
|
|
38
|
+
|
|
39
|
+
const baseClasses = computed(() => cn('grid gap-2 overflow-hidden [&>div]:pb-0', props.class))
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<template v-for="(node, index) in branchVNodes" :key="(node.key as any) ?? index">
|
|
44
|
+
<div
|
|
45
|
+
:class="cn(baseClasses, index === currentBranch ? 'block' : 'hidden')"
|
|
46
|
+
v-bind="$attrs"
|
|
47
|
+
>
|
|
48
|
+
<component :is="node" />
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Button } from '@/components/ui/button'
|
|
3
|
+
import { ChevronRightIcon } from 'lucide-vue-next'
|
|
4
|
+
import { useMessageBranchContext } from './context'
|
|
5
|
+
|
|
6
|
+
const { goToNext, totalBranches } = useMessageBranchContext()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<Button
|
|
11
|
+
aria-label="Next branch"
|
|
12
|
+
:disabled="totalBranches <= 1"
|
|
13
|
+
size="icon-sm"
|
|
14
|
+
type="button"
|
|
15
|
+
variant="ghost"
|
|
16
|
+
v-bind="$attrs"
|
|
17
|
+
@click="goToNext"
|
|
18
|
+
>
|
|
19
|
+
<slot>
|
|
20
|
+
<ChevronRightIcon :size="14" />
|
|
21
|
+
</slot>
|
|
22
|
+
</Button>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { ButtonGroupText } from '@/components/ui/button-group'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
import { useMessageBranchContext } from './context'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
class?: HTMLAttributes['class']
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const props = defineProps<Props>()
|
|
12
|
+
|
|
13
|
+
const { currentBranch, totalBranches } = useMessageBranchContext()
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<ButtonGroupText
|
|
18
|
+
:class="
|
|
19
|
+
cn(
|
|
20
|
+
'border-none bg-transparent text-muted-foreground shadow-none',
|
|
21
|
+
props.class,
|
|
22
|
+
)
|
|
23
|
+
"
|
|
24
|
+
v-bind="$attrs"
|
|
25
|
+
>
|
|
26
|
+
{{ currentBranch + 1 }} of {{ totalBranches }}
|
|
27
|
+
</ButtonGroupText>
|
|
28
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Button } from '@/components/ui/button'
|
|
3
|
+
import { ChevronLeftIcon } from 'lucide-vue-next'
|
|
4
|
+
import { useMessageBranchContext } from './context'
|
|
5
|
+
|
|
6
|
+
const { goToPrevious, totalBranches } = useMessageBranchContext()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<Button
|
|
11
|
+
aria-label="Previous branch"
|
|
12
|
+
:disabled="totalBranches <= 1"
|
|
13
|
+
size="icon-sm"
|
|
14
|
+
type="button"
|
|
15
|
+
variant="ghost"
|
|
16
|
+
v-bind="$attrs"
|
|
17
|
+
@click="goToPrevious"
|
|
18
|
+
>
|
|
19
|
+
<slot>
|
|
20
|
+
<ChevronLeftIcon :size="14" />
|
|
21
|
+
</slot>
|
|
22
|
+
</Button>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { UIMessage } from 'ai'
|
|
3
|
+
import { ButtonGroup } from '@/components/ui/button-group'
|
|
4
|
+
import { useMessageBranchContext } from './context'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
from: UIMessage['role']
|
|
8
|
+
}
|
|
9
|
+
defineProps<Props>()
|
|
10
|
+
|
|
11
|
+
const { totalBranches } = useMessageBranchContext()
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<ButtonGroup
|
|
16
|
+
v-if="totalBranches > 1"
|
|
17
|
+
class="[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md"
|
|
18
|
+
orientation="horizontal"
|
|
19
|
+
v-bind="$attrs"
|
|
20
|
+
>
|
|
21
|
+
<slot />
|
|
22
|
+
</ButtonGroup>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
class?: HTMLAttributes['class']
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const props = defineProps<Props>()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div
|
|
14
|
+
:class="
|
|
15
|
+
cn(
|
|
16
|
+
'is-user:dark flex w-fit flex-col gap-2 overflow-hidden text-sm',
|
|
17
|
+
'group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground',
|
|
18
|
+
'group-[.is-assistant]:text-foreground',
|
|
19
|
+
props.class,
|
|
20
|
+
)
|
|
21
|
+
"
|
|
22
|
+
v-bind="$attrs"
|
|
23
|
+
>
|
|
24
|
+
<slot />
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { StreamMarkdown } from 'streamdown-vue'
|
|
5
|
+
import { computed, useSlots } from 'vue'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
content?: string
|
|
9
|
+
class?: HTMLAttributes['class']
|
|
10
|
+
}
|
|
11
|
+
const props = defineProps<Props>()
|
|
12
|
+
|
|
13
|
+
const slots = useSlots()
|
|
14
|
+
const slotContent = computed<string | undefined>(() => {
|
|
15
|
+
const nodes = slots.default?.() || []
|
|
16
|
+
let text = ''
|
|
17
|
+
for (const node of nodes) {
|
|
18
|
+
if (typeof node.children === 'string')
|
|
19
|
+
text += node.children
|
|
20
|
+
}
|
|
21
|
+
return text || undefined
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const md = computed(() => (slotContent.value ?? props.content ?? '') as string)
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<StreamMarkdown
|
|
29
|
+
:shiki-theme="{
|
|
30
|
+
light: 'github-light',
|
|
31
|
+
dark: 'github-dark',
|
|
32
|
+
}"
|
|
33
|
+
:content="md"
|
|
34
|
+
:class="
|
|
35
|
+
cn(
|
|
36
|
+
'size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0',
|
|
37
|
+
props.class,
|
|
38
|
+
)
|
|
39
|
+
"
|
|
40
|
+
v-bind="$attrs"
|
|
41
|
+
/>
|
|
42
|
+
</template>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
class?: HTMLAttributes['class']
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const props = defineProps<Props>()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div
|
|
14
|
+
:class="
|
|
15
|
+
cn(
|
|
16
|
+
'mt-4 flex w-full items-center justify-between gap-4',
|
|
17
|
+
props.class,
|
|
18
|
+
)
|
|
19
|
+
"
|
|
20
|
+
v-bind="$attrs"
|
|
21
|
+
>
|
|
22
|
+
<slot />
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { InjectionKey, Ref, VNode } from 'vue'
|
|
2
|
+
import { inject } from 'vue'
|
|
3
|
+
|
|
4
|
+
export interface MessageBranchContextType<T = VNode[]> {
|
|
5
|
+
currentBranch: Readonly<Ref<number>>
|
|
6
|
+
totalBranches: Readonly<Ref<number>>
|
|
7
|
+
goToPrevious: () => void
|
|
8
|
+
goToNext: () => void
|
|
9
|
+
branches: Ref<T>
|
|
10
|
+
setBranches: (count: number) => void
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const MessageBranchKey: InjectionKey<MessageBranchContextType>
|
|
14
|
+
= Symbol('MessageBranch')
|
|
15
|
+
|
|
16
|
+
export function useMessageBranchContext(): MessageBranchContextType {
|
|
17
|
+
const ctx = inject(MessageBranchKey)
|
|
18
|
+
if (!ctx) {
|
|
19
|
+
throw new Error('Message Branch components must be used within Message Branch')
|
|
20
|
+
}
|
|
21
|
+
return ctx
|
|
22
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { default as Message } from './Message.vue'
|
|
2
|
+
export { default as MessageAction } from './MessageAction.vue'
|
|
3
|
+
export { default as MessageActions } from './MessageActions.vue'
|
|
4
|
+
export { default as MessageAttachment } from './MessageAttachment.vue'
|
|
5
|
+
export { default as MessageAttachments } from './MessageAttachments.vue'
|
|
6
|
+
export { default as MessageAvatar } from './MessageAvatar.vue'
|
|
7
|
+
export { default as MessageBranch } from './MessageBranch.vue'
|
|
8
|
+
export { default as MessageBranchContent } from './MessageBranchContent.vue'
|
|
9
|
+
export { default as MessageBranchNext } from './MessageBranchNext.vue'
|
|
10
|
+
export { default as MessageBranchPage } from './MessageBranchPage.vue'
|
|
11
|
+
export { default as MessageBranchPrevious } from './MessageBranchPrevious.vue'
|
|
12
|
+
export { default as MessageBranchSelector } from './MessageBranchSelector.vue'
|
|
13
|
+
export { default as MessageContent } from './MessageContent.vue'
|
|
14
|
+
export { default as MessageResponse } from './MessageResponse.vue'
|
|
15
|
+
export { default as MessageToolbar } from './MessageToolbar.vue'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { Command } from '@/components/ui/command'
|
|
4
|
+
import { DialogContent, DialogTitle } from '@/components/ui/dialog'
|
|
5
|
+
import { cn } from '@/lib/utils'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
title?: string
|
|
9
|
+
class?: HTMLAttributes['class']
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
13
|
+
title: 'Model Selector',
|
|
14
|
+
})
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<DialogContent
|
|
19
|
+
:class="cn('p-0', props.class)"
|
|
20
|
+
v-bind="$attrs"
|
|
21
|
+
>
|
|
22
|
+
<DialogTitle class="sr-only">
|
|
23
|
+
{{ props.title }}
|
|
24
|
+
</DialogTitle>
|
|
25
|
+
<Command class="**:data-[slot=command-input-wrapper]:h-auto">
|
|
26
|
+
<slot />
|
|
27
|
+
</Command>
|
|
28
|
+
</DialogContent>
|
|
29
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { CommandInput } from '@/components/ui/command'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
class?: HTMLAttributes['class']
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const props = defineProps<Props>()
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<CommandInput
|
|
15
|
+
:class="cn('h-auto py-3.5', props.class)"
|
|
16
|
+
v-bind="$attrs"
|
|
17
|
+
/>
|
|
18
|
+
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
provider: string
|
|
7
|
+
class?: HTMLAttributes['class']
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const props = defineProps<Props>()
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<img
|
|
15
|
+
v-bind="$attrs"
|
|
16
|
+
:alt="`${props.provider} logo`"
|
|
17
|
+
:class="cn('size-3 dark:invert', props.class)"
|
|
18
|
+
height="12"
|
|
19
|
+
:src="`https://models.dev/logos/${props.provider}.svg`"
|
|
20
|
+
width="12"
|
|
21
|
+
>
|
|
22
|
+
</template>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
class?: HTMLAttributes['class']
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const props = defineProps<Props>()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div
|
|
14
|
+
:class="
|
|
15
|
+
cn(
|
|
16
|
+
'-space-x-1 flex shrink-0 items-center [&>img]:rounded-full [&>img]:bg-background [&>img]:p-px [&>img]:ring-1 dark:[&>img]:bg-foreground',
|
|
17
|
+
props.class,
|
|
18
|
+
)
|
|
19
|
+
"
|
|
20
|
+
v-bind="$attrs"
|
|
21
|
+
>
|
|
22
|
+
<slot />
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
class?: HTMLAttributes['class']
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const props = defineProps<Props>()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<span
|
|
14
|
+
:class="cn('flex-1 truncate text-left', props.class)"
|
|
15
|
+
v-bind="$attrs"
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</span>
|
|
19
|
+
</template>
|