@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,28 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { PanelPositionType } from '@vue-flow/core'
|
|
3
|
+
import type { HTMLAttributes } from 'vue'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
import { Panel as PanelPrimitive } from '@vue-flow/core'
|
|
6
|
+
import { reactiveOmit } from '@vueuse/core'
|
|
7
|
+
|
|
8
|
+
interface PanelProps {
|
|
9
|
+
class?: HTMLAttributes['class']
|
|
10
|
+
position?: PanelPositionType
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const props = withDefaults(defineProps<PanelProps>(), {
|
|
14
|
+
position: 'top-right',
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const delegatedProps = reactiveOmit(props, 'class')
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<PanelPrimitive
|
|
22
|
+
data-slot="panel"
|
|
23
|
+
v-bind="delegatedProps"
|
|
24
|
+
:class="cn('m-4 overflow-hidden rounded-md border bg-card p-1', props.class)"
|
|
25
|
+
>
|
|
26
|
+
<slot />
|
|
27
|
+
</PanelPrimitive>
|
|
28
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Panel } from './Panel.vue'
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { Card } from '@/components/ui/card'
|
|
4
|
+
import { Collapsible } from '@/components/ui/collapsible'
|
|
5
|
+
import { cn } from '@/lib/utils'
|
|
6
|
+
import { computed } from 'vue'
|
|
7
|
+
import { providePlan } from './context'
|
|
8
|
+
|
|
9
|
+
interface PlanProps {
|
|
10
|
+
isStreaming?: boolean
|
|
11
|
+
class?: HTMLAttributes['class']
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(
|
|
15
|
+
defineProps<PlanProps>(),
|
|
16
|
+
{
|
|
17
|
+
isStreaming: false,
|
|
18
|
+
},
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
providePlan({
|
|
22
|
+
isStreaming: computed(() => props.isStreaming),
|
|
23
|
+
})
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<Collapsible as-child data-slot="plan" v-bind="props">
|
|
28
|
+
<Card :class="cn('shadow-none', props.class)">
|
|
29
|
+
<slot />
|
|
30
|
+
</Card>
|
|
31
|
+
</Collapsible>
|
|
32
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { CardContent } from '@/components/ui/card'
|
|
3
|
+
import { CollapsibleContent } from '@/components/ui/collapsible'
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<template>
|
|
7
|
+
<CollapsibleContent as-child>
|
|
8
|
+
<CardContent data-slot="plan-content">
|
|
9
|
+
<slot />
|
|
10
|
+
</CardContent>
|
|
11
|
+
</CollapsibleContent>
|
|
12
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { CardDescription } from '@/components/ui/card'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
import { Shimmer } from '../shimmer'
|
|
6
|
+
import { usePlan } from './context'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
class?: HTMLAttributes['class']
|
|
10
|
+
}>()
|
|
11
|
+
|
|
12
|
+
const { isStreaming } = usePlan()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<CardDescription
|
|
17
|
+
:class="cn('text-balance', props.class)"
|
|
18
|
+
data-slot="plan-description"
|
|
19
|
+
>
|
|
20
|
+
<Shimmer v-if="isStreaming">
|
|
21
|
+
<slot />
|
|
22
|
+
</Shimmer>
|
|
23
|
+
<slot v-else />
|
|
24
|
+
</CardDescription>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { CardHeader } from '@/components/ui/card'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
class?: HTMLAttributes['class']
|
|
8
|
+
}>()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<CardHeader
|
|
13
|
+
:class="cn('flex flex-row items-start justify-between', props.class)"
|
|
14
|
+
data-slot="plan-header"
|
|
15
|
+
>
|
|
16
|
+
<slot />
|
|
17
|
+
</CardHeader>
|
|
18
|
+
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { CardTitle } from '@/components/ui/card'
|
|
3
|
+
import { Shimmer } from '../shimmer'
|
|
4
|
+
import { usePlan } from './context'
|
|
5
|
+
|
|
6
|
+
const { isStreaming } = usePlan()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<CardTitle data-slot="plan-title" v-bind="$attrs">
|
|
11
|
+
<Shimmer v-if="isStreaming">
|
|
12
|
+
<slot />
|
|
13
|
+
</Shimmer>
|
|
14
|
+
<slot v-else />
|
|
15
|
+
</CardTitle>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { Button } from '@/components/ui/button'
|
|
4
|
+
import { CollapsibleTrigger } from '@/components/ui/collapsible'
|
|
5
|
+
import { cn } from '@/lib/utils'
|
|
6
|
+
import { ChevronsUpDownIcon } from 'lucide-vue-next'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
class?: HTMLAttributes['class']
|
|
10
|
+
}>()
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<CollapsibleTrigger as-child>
|
|
15
|
+
<Button
|
|
16
|
+
:class="cn('size-8', props.class)"
|
|
17
|
+
data-slot="plan-trigger"
|
|
18
|
+
size="icon"
|
|
19
|
+
variant="ghost"
|
|
20
|
+
>
|
|
21
|
+
<ChevronsUpDownIcon class="size-4" />
|
|
22
|
+
<span class="sr-only">Toggle plan</span>
|
|
23
|
+
</Button>
|
|
24
|
+
</CollapsibleTrigger>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ComputedRef, InjectionKey } from 'vue'
|
|
2
|
+
import { inject, provide } from 'vue'
|
|
3
|
+
|
|
4
|
+
export interface PlanContextValue {
|
|
5
|
+
isStreaming: ComputedRef<boolean>
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const PlanKey: InjectionKey<PlanContextValue> = Symbol('PlanContext')
|
|
9
|
+
|
|
10
|
+
export function providePlan(value: PlanContextValue) {
|
|
11
|
+
provide(PlanKey, value)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function usePlan() {
|
|
15
|
+
const context = inject(PlanKey)
|
|
16
|
+
if (!context) {
|
|
17
|
+
throw new Error('Plan components must be used within a Plan component')
|
|
18
|
+
}
|
|
19
|
+
return context
|
|
20
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as Plan } from './Plan.vue'
|
|
2
|
+
export { default as PlanAction } from './PlanAction.vue'
|
|
3
|
+
export { default as PlanContent } from './PlanContent.vue'
|
|
4
|
+
export { default as PlanDescription } from './PlanDescription.vue'
|
|
5
|
+
export { default as PlanFooter } from './PlanFooter.vue'
|
|
6
|
+
export { default as PlanHeader } from './PlanHeader.vue'
|
|
7
|
+
export { default as PlanTitle } from './PlanTitle.vue'
|
|
8
|
+
export { default as PlanTrigger } from './PlanTrigger.vue'
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import type { PromptInputMessage } from './types'
|
|
4
|
+
import { InputGroup } from '@/components/ui/input-group'
|
|
5
|
+
import { cn } from '@/lib/utils'
|
|
6
|
+
import { inject, onMounted, onUnmounted, ref } from 'vue'
|
|
7
|
+
import { usePromptInputProvider } from './context'
|
|
8
|
+
import { PROMPT_INPUT_KEY } from './types'
|
|
9
|
+
|
|
10
|
+
const props = defineProps<{
|
|
11
|
+
class?: HTMLAttributes['class']
|
|
12
|
+
accept?: string
|
|
13
|
+
multiple?: boolean
|
|
14
|
+
globalDrop?: boolean
|
|
15
|
+
maxFiles?: number
|
|
16
|
+
maxFileSize?: number
|
|
17
|
+
initialInput?: string
|
|
18
|
+
}>()
|
|
19
|
+
|
|
20
|
+
const emit = defineEmits<{
|
|
21
|
+
(e: 'submit', payload: PromptInputMessage): void
|
|
22
|
+
(e: 'error', payload: { code: string, message: string }): void
|
|
23
|
+
}>()
|
|
24
|
+
|
|
25
|
+
const formRef = ref<HTMLFormElement | null>(null)
|
|
26
|
+
|
|
27
|
+
// --- Dual-mode context handling ---
|
|
28
|
+
const inheritedContext = inject(PROMPT_INPUT_KEY, null)
|
|
29
|
+
|
|
30
|
+
const localContext = inheritedContext
|
|
31
|
+
? null
|
|
32
|
+
: usePromptInputProvider({
|
|
33
|
+
initialInput: props.initialInput,
|
|
34
|
+
maxFiles: props.maxFiles,
|
|
35
|
+
maxFileSize: props.maxFileSize,
|
|
36
|
+
accept: props.accept,
|
|
37
|
+
onSubmit: msg => emit('submit', msg as any),
|
|
38
|
+
onError: err => emit('error', err),
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
const context = inheritedContext || localContext
|
|
42
|
+
|
|
43
|
+
if (!context) {
|
|
44
|
+
throw new Error('PromptInput context is missing.')
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const { fileInputRef, addFiles, submitForm } = context
|
|
48
|
+
|
|
49
|
+
function handleDragOver(e: DragEvent) {
|
|
50
|
+
if (e.dataTransfer?.types?.includes('Files')) {
|
|
51
|
+
e.preventDefault()
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function handleDrop(e: DragEvent) {
|
|
56
|
+
if (e.dataTransfer?.types?.includes('Files')) {
|
|
57
|
+
e.preventDefault()
|
|
58
|
+
}
|
|
59
|
+
if (e.dataTransfer?.files && e.dataTransfer.files.length > 0) {
|
|
60
|
+
addFiles(e.dataTransfer.files)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
onMounted(() => {
|
|
65
|
+
if (props.globalDrop) {
|
|
66
|
+
document.addEventListener('dragover', handleDragOver)
|
|
67
|
+
document.addEventListener('drop', handleDrop)
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
onUnmounted(() => {
|
|
72
|
+
if (props.globalDrop) {
|
|
73
|
+
document.removeEventListener('dragover', handleDragOver)
|
|
74
|
+
document.removeEventListener('drop', handleDrop)
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
function onFileChange(e: Event) {
|
|
79
|
+
const input = e.target as HTMLInputElement
|
|
80
|
+
console.log(input.files);
|
|
81
|
+
|
|
82
|
+
if (input.files) {
|
|
83
|
+
addFiles(input.files)
|
|
84
|
+
}
|
|
85
|
+
input.value = ''
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function onSubmit(e: Event) {
|
|
89
|
+
e.preventDefault()
|
|
90
|
+
submitForm()
|
|
91
|
+
}
|
|
92
|
+
</script>
|
|
93
|
+
|
|
94
|
+
<template>
|
|
95
|
+
<div>
|
|
96
|
+
<input
|
|
97
|
+
ref="fileInputRef"
|
|
98
|
+
type="file"
|
|
99
|
+
class="hidden"
|
|
100
|
+
:accept="accept"
|
|
101
|
+
:multiple="multiple"
|
|
102
|
+
@change="onFileChange"
|
|
103
|
+
>
|
|
104
|
+
<form
|
|
105
|
+
ref="formRef"
|
|
106
|
+
:class="cn('w-full', props.class)"
|
|
107
|
+
@submit="onSubmit"
|
|
108
|
+
@dragover.prevent="handleDragOver"
|
|
109
|
+
@drop.prevent="handleDrop"
|
|
110
|
+
>
|
|
111
|
+
<InputGroup class="overflow-hidden">
|
|
112
|
+
<slot />
|
|
113
|
+
</InputGroup>
|
|
114
|
+
</form>
|
|
115
|
+
</div>
|
|
116
|
+
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { DropdownMenuItem } from '@/components/ui/dropdown-menu'
|
|
3
|
+
import { ImageIcon } from 'lucide-vue-next'
|
|
4
|
+
import { usePromptInput } from './context'
|
|
5
|
+
|
|
6
|
+
type PromptInputActionAddAttachmentsProps = InstanceType<typeof DropdownMenuItem>['$props']
|
|
7
|
+
|
|
8
|
+
interface Props extends /* @vue-ignore */ PromptInputActionAddAttachmentsProps {
|
|
9
|
+
label?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const props = defineProps<Props>()
|
|
13
|
+
|
|
14
|
+
const { openFileDialog } = usePromptInput()
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<DropdownMenuItem @select.prevent="openFileDialog">
|
|
19
|
+
<ImageIcon class="mr-2 size-4" />
|
|
20
|
+
{{ props.label || 'Add photos or files' }}
|
|
21
|
+
</DropdownMenuItem>
|
|
22
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { DropdownMenu } from '@/components/ui/dropdown-menu'
|
|
3
|
+
|
|
4
|
+
type DropdownMenuProps = InstanceType<typeof DropdownMenu>['$props']
|
|
5
|
+
|
|
6
|
+
interface Props extends /* @vue-ignore */ DropdownMenuProps {}
|
|
7
|
+
|
|
8
|
+
const props = defineProps<Props>()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<DropdownMenu v-bind="props">
|
|
13
|
+
<slot />
|
|
14
|
+
</DropdownMenu>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { DropdownMenuContent } from '@/components/ui/dropdown-menu'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
type DropdownMenuContentProps = InstanceType<typeof DropdownMenuContent>['$props']
|
|
7
|
+
|
|
8
|
+
interface Props extends /* @vue-ignore */ DropdownMenuContentProps {
|
|
9
|
+
class?: HTMLAttributes['class']
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const props = defineProps<Props>()
|
|
13
|
+
|
|
14
|
+
const { align, class: _, ...restProps } = props
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<DropdownMenuContent align="start" :class="cn(props.class)" v-bind="restProps">
|
|
19
|
+
<slot />
|
|
20
|
+
</DropdownMenuContent>
|
|
21
|
+
</template>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { DropdownMenuItem } from '@/components/ui/dropdown-menu'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
type PromptInputActionMenuItemProps = InstanceType<typeof DropdownMenuItem>['$props']
|
|
7
|
+
|
|
8
|
+
interface Props extends /* @vue-ignore */ PromptInputActionMenuItemProps {
|
|
9
|
+
class?: HTMLAttributes['class']
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const props = defineProps<Props>()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<DropdownMenuItem :class="cn(props.class)">
|
|
17
|
+
<slot />
|
|
18
|
+
</DropdownMenuItem>
|
|
19
|
+
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { DropdownMenuTrigger } from '@/components/ui/dropdown-menu'
|
|
4
|
+
import { PlusIcon } from 'lucide-vue-next'
|
|
5
|
+
import PromptInputButton from './PromptInputButton.vue'
|
|
6
|
+
|
|
7
|
+
type DropdownMenuTriggerProps = InstanceType<typeof DropdownMenuTrigger>['$props']
|
|
8
|
+
|
|
9
|
+
interface Props extends /* @vue-ignore */ DropdownMenuTriggerProps {
|
|
10
|
+
class?: HTMLAttributes['class']
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const props = defineProps<Props>()
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<DropdownMenuTrigger as-child>
|
|
18
|
+
<PromptInputButton :class="props.class" v-bind="props">
|
|
19
|
+
<slot><PlusIcon class="size-4" /></slot>
|
|
20
|
+
</PromptInputButton>
|
|
21
|
+
</DropdownMenuTrigger>
|
|
22
|
+
</template>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import type { AttachmentFile } from './types'
|
|
4
|
+
import { Button } from '@/components/ui/button'
|
|
5
|
+
import {
|
|
6
|
+
HoverCard,
|
|
7
|
+
HoverCardContent,
|
|
8
|
+
HoverCardTrigger,
|
|
9
|
+
} from '@/components/ui/hover-card'
|
|
10
|
+
import { cn } from '@/lib/utils'
|
|
11
|
+
import { PaperclipIcon, XIcon } from 'lucide-vue-next'
|
|
12
|
+
import { computed } from 'vue'
|
|
13
|
+
import { usePromptInput } from './context'
|
|
14
|
+
|
|
15
|
+
const props = defineProps<{
|
|
16
|
+
file: AttachmentFile
|
|
17
|
+
class?: HTMLAttributes['class']
|
|
18
|
+
}>()
|
|
19
|
+
|
|
20
|
+
const { removeFile } = usePromptInput()
|
|
21
|
+
|
|
22
|
+
const filename = computed(() => props.file.filename || '')
|
|
23
|
+
const isImage = computed(() =>
|
|
24
|
+
props.file.mediaType?.startsWith('image/') && props.file.url,
|
|
25
|
+
)
|
|
26
|
+
const label = computed(() => filename.value || (isImage.value ? 'Image' : 'Attachment'))
|
|
27
|
+
|
|
28
|
+
function handleRemove(e: Event) {
|
|
29
|
+
e.stopPropagation()
|
|
30
|
+
removeFile(props.file.id)
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<HoverCard :open-delay="0" :close-delay="0">
|
|
36
|
+
<HoverCardTrigger as-child>
|
|
37
|
+
<div
|
|
38
|
+
:class="cn(
|
|
39
|
+
'group relative flex h-8 cursor-pointer select-none items-center gap-1.5 rounded-md border border-border px-1.5 font-medium text-sm transition-all hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
|
40
|
+
props.class,
|
|
41
|
+
)"
|
|
42
|
+
>
|
|
43
|
+
<div class="relative size-5 shrink-0">
|
|
44
|
+
<div class="absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded bg-background transition-opacity group-hover:opacity-0">
|
|
45
|
+
<img
|
|
46
|
+
v-if="isImage"
|
|
47
|
+
:src="file.url"
|
|
48
|
+
:alt="label"
|
|
49
|
+
class="size-5 object-cover"
|
|
50
|
+
>
|
|
51
|
+
<div v-else class="flex size-5 items-center justify-center text-muted-foreground">
|
|
52
|
+
<PaperclipIcon class="size-3" />
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<Button
|
|
57
|
+
type="button"
|
|
58
|
+
variant="ghost"
|
|
59
|
+
size="icon"
|
|
60
|
+
class="absolute inset-0 size-5 cursor-pointer rounded p-0 opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 [&>svg]:size-2.5"
|
|
61
|
+
@click="handleRemove"
|
|
62
|
+
>
|
|
63
|
+
<XIcon />
|
|
64
|
+
<span class="sr-only">Remove</span>
|
|
65
|
+
</Button>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<span class="flex-1 truncate max-w-[150px]">{{ label }}</span>
|
|
69
|
+
</div>
|
|
70
|
+
</HoverCardTrigger>
|
|
71
|
+
|
|
72
|
+
<HoverCardContent class="w-auto p-2" align="start">
|
|
73
|
+
<div class="w-auto space-y-3">
|
|
74
|
+
<div v-if="isImage" class="flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border">
|
|
75
|
+
<img
|
|
76
|
+
:src="file.url"
|
|
77
|
+
:alt="label"
|
|
78
|
+
class="max-h-full max-w-full object-contain"
|
|
79
|
+
>
|
|
80
|
+
</div>
|
|
81
|
+
<div class="flex items-center gap-2.5">
|
|
82
|
+
<div class="min-w-0 flex-1 space-y-1 px-0.5">
|
|
83
|
+
<h4 class="truncate font-semibold text-sm leading-none">
|
|
84
|
+
{{ label }}
|
|
85
|
+
</h4>
|
|
86
|
+
<p v-if="file.mediaType" class="truncate font-mono text-muted-foreground text-xs">
|
|
87
|
+
{{ file.mediaType }}
|
|
88
|
+
</p>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
</HoverCardContent>
|
|
93
|
+
</HoverCard>
|
|
94
|
+
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { usePromptInput } from './context'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
class?: HTMLAttributes['class']
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
const { files } = usePromptInput()
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<div
|
|
15
|
+
v-if="files.length > 0"
|
|
16
|
+
:class="cn('flex flex-wrap items-center gap-2 p-3 w-full', props.class)"
|
|
17
|
+
>
|
|
18
|
+
<template v-for="file in files" :key="file.id">
|
|
19
|
+
<slot :file="file" />
|
|
20
|
+
</template>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{ class?: HTMLAttributes['class'] }>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<div :class="cn('contents', props.class)" v-bind="props">
|
|
10
|
+
<slot />
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { InputGroupButton } from '@/components/ui/input-group'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
import { Comment, computed, Text, toRef, useSlots } from 'vue'
|
|
6
|
+
|
|
7
|
+
type InputGroupButtonProps = InstanceType<typeof InputGroupButton>['$props']
|
|
8
|
+
|
|
9
|
+
interface Props extends /* @vue-ignore */ InputGroupButtonProps {
|
|
10
|
+
class?: HTMLAttributes['class']
|
|
11
|
+
variant?: InputGroupButtonProps['variant']
|
|
12
|
+
size?: InputGroupButtonProps['size']
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
16
|
+
variant: 'ghost',
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const slots = useSlots()
|
|
20
|
+
|
|
21
|
+
const computedSize = computed(() => {
|
|
22
|
+
if (props.size)
|
|
23
|
+
return props.size
|
|
24
|
+
|
|
25
|
+
const slotNodes = slots.default?.()
|
|
26
|
+
|
|
27
|
+
if (!slotNodes)
|
|
28
|
+
return 'icon-sm'
|
|
29
|
+
|
|
30
|
+
const validChildren = slotNodes.filter((node) => {
|
|
31
|
+
if (node.type === Comment)
|
|
32
|
+
return false
|
|
33
|
+
if (node.type === Text && !node.children?.toString().trim())
|
|
34
|
+
return false
|
|
35
|
+
return true
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
return validChildren.length > 1 ? 'sm' : 'icon-sm'
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
const variant = toRef(props, 'variant')
|
|
42
|
+
|
|
43
|
+
const { size, variant: _, class: __, ...restProps } = props
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<template>
|
|
47
|
+
<InputGroupButton
|
|
48
|
+
type="button"
|
|
49
|
+
:size="computedSize"
|
|
50
|
+
:class="cn($props.class)"
|
|
51
|
+
:variant="variant"
|
|
52
|
+
v-bind="restProps"
|
|
53
|
+
>
|
|
54
|
+
<slot />
|
|
55
|
+
</InputGroupButton>
|
|
56
|
+
</template>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { Command } from '@/components/ui/command'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
type PromptInputCommandProps = InstanceType<typeof Command>['$props']
|
|
7
|
+
|
|
8
|
+
interface Props extends /* @vue-ignore */ PromptInputCommandProps {
|
|
9
|
+
class?: HTMLAttributes['class']
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const props = defineProps<Props>()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<Command :class="cn(props.class)" v-bind="props">
|
|
17
|
+
<slot />
|
|
18
|
+
</Command>
|
|
19
|
+
</template>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { CommandEmpty } from '@/components/ui/command'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
type PromptInputCommandEmptyProps = InstanceType<typeof CommandEmpty>['$props']
|
|
7
|
+
|
|
8
|
+
interface Props extends /* @vue-ignore */ PromptInputCommandEmptyProps {
|
|
9
|
+
class?: HTMLAttributes['class']
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const props = defineProps<Props>()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<CommandEmpty :class="cn(props.class)" v-bind="props">
|
|
17
|
+
<slot />
|
|
18
|
+
</CommandEmpty>
|
|
19
|
+
</template>
|