@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,97 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Conversation class="mb-4">
|
|
3
|
+
<ConversationContent>
|
|
4
|
+
<Message v-for="(message, messageIndex) in messages" :key="message.id" :from="message.role">
|
|
5
|
+
<MessageContent>
|
|
6
|
+
<template v-for="(part, partIndex) in message.parts" :key="`${message.id}-${part.type}-${partIndex}`">
|
|
7
|
+
<template v-if="part.type === 'text'">
|
|
8
|
+
<MessageResponse :content="part.text" />
|
|
9
|
+
</template>
|
|
10
|
+
<template v-else-if="part.type === 'reasoning'">
|
|
11
|
+
<Reasoning class="w-full" :is-streaming="isStreamingPart(messageIndex, partIndex)">
|
|
12
|
+
<ReasoningTrigger />
|
|
13
|
+
<ReasoningContent :content="part.text" />
|
|
14
|
+
</Reasoning>
|
|
15
|
+
</template>
|
|
16
|
+
<template v-else-if="part.type === 'file'">
|
|
17
|
+
<img v-if="part.mediaType.startsWith('image/')" :alt="part.filename" :src="part.url" />
|
|
18
|
+
<div v-else>{{ part.filename }}</div>
|
|
19
|
+
</template>
|
|
20
|
+
<template v-else-if="part.type === 'source-document'">
|
|
21
|
+
<div>{{ part.title }}</div>
|
|
22
|
+
</template>
|
|
23
|
+
<template v-else-if="part.type === 'source-url'">
|
|
24
|
+
<Sources>
|
|
25
|
+
<SourcesContent>
|
|
26
|
+
<Source :href="part.url" :title="part.title ?? part.url" />
|
|
27
|
+
</SourcesContent>
|
|
28
|
+
</Sources>
|
|
29
|
+
</template>
|
|
30
|
+
<template v-else-if="part.type === 'step-start'"></template>
|
|
31
|
+
<template v-else-if="isDataPart(part.type)">
|
|
32
|
+
<CodeBlock :code="JSON.stringify(dataPart(part).data ?? {}, null, 2)" language="json" />
|
|
33
|
+
</template>
|
|
34
|
+
<template v-else-if="part.type === 'dynamic-tool'">
|
|
35
|
+
<Tool default-open>
|
|
36
|
+
<ToolHeader :state="part.state" :title="part.toolName" type="tool-dynamic-tool" />
|
|
37
|
+
<ToolContent>
|
|
38
|
+
<ToolInput :input="part.input" />
|
|
39
|
+
<ToolOutput :output="part.output" :error-text="part.errorText" />
|
|
40
|
+
</ToolContent>
|
|
41
|
+
</Tool>
|
|
42
|
+
</template>
|
|
43
|
+
<template v-else-if="isToolPart(part.type)">
|
|
44
|
+
<!-- 这里可以根据 part.type 来决定使用什么组件, 可以自定义 -->
|
|
45
|
+
<Tool class="w-full" :default-open="false">
|
|
46
|
+
<ToolHeader :state="toolPart(part).state" :type="part.type" />
|
|
47
|
+
<ToolContent>
|
|
48
|
+
<ToolInput :input="toolPart(part).input" />
|
|
49
|
+
<ToolOutput :output="toolPart(part).output" :error-text="toolPart(part).errorText" />
|
|
50
|
+
</ToolContent>
|
|
51
|
+
</Tool>
|
|
52
|
+
</template>
|
|
53
|
+
</template>
|
|
54
|
+
</MessageContent>
|
|
55
|
+
</Message>
|
|
56
|
+
<Loader v-if="status === 'submitted'" />
|
|
57
|
+
</ConversationContent>
|
|
58
|
+
<ConversationScrollButton />
|
|
59
|
+
</Conversation>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<script setup lang='ts'>
|
|
63
|
+
import type { DataUIPart, ToolUIPart, UIDataTypes, UIMessagePart, UITools ,UIMessage,ChatStatus} from "ai";
|
|
64
|
+
|
|
65
|
+
const props = defineProps<{messages:UIMessage[],status:ChatStatus}>();
|
|
66
|
+
|
|
67
|
+
const messages = computed(() => props.messages);
|
|
68
|
+
const status = computed(() => props.status);
|
|
69
|
+
|
|
70
|
+
function isStreamingPart(messageIndex: number, partIndex: number) {
|
|
71
|
+
const lastMsg = messages.value[messages.value.length - 1];
|
|
72
|
+
const msg = messages.value[messageIndex];
|
|
73
|
+
|
|
74
|
+
if (!lastMsg || msg?.id !== lastMsg.id) return false;
|
|
75
|
+
|
|
76
|
+
const isLastPart =
|
|
77
|
+
msg?.parts?.length > 0 && partIndex === msg?.parts?.length - 1;
|
|
78
|
+
return status.value === "streaming" && isLastPart;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function isToolPart(partType: string): partType is `tool-${string}` {
|
|
82
|
+
return partType.startsWith("tool-");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function isDataPart(partType: string): partType is `data-${string}` {
|
|
86
|
+
return partType.startsWith("data-");
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function toolPart(part: UIMessagePart<UIDataTypes, UITools>) {
|
|
90
|
+
return part as ToolUIPart<UITools>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function dataPart(part: UIMessagePart<UIDataTypes, UITools>) {
|
|
94
|
+
return part as DataUIPart<UIDataTypes>;
|
|
95
|
+
}
|
|
96
|
+
</script>
|
|
97
|
+
<style scoped lang='scss'></style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ChatConversation } from "./ChatConversation.vue";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<PromptInputProvider @submit="handleSubmit" :uploadImages="uploadImages">
|
|
3
|
+
<PromptInput multiple global-drop class="w-full">
|
|
4
|
+
<PromptInputAttachments>
|
|
5
|
+
<template #default="{ file }">
|
|
6
|
+
<PromptInputAttachment :file="file" />
|
|
7
|
+
</template>
|
|
8
|
+
</PromptInputAttachments>
|
|
9
|
+
|
|
10
|
+
<PromptInputBody>
|
|
11
|
+
<PromptInputTextarea placeholder="你想知道什么?" />
|
|
12
|
+
</PromptInputBody>
|
|
13
|
+
|
|
14
|
+
<PromptInputFooter>
|
|
15
|
+
<PromptInputTools>
|
|
16
|
+
<PromptInputActionMenu>
|
|
17
|
+
<!-- icon -->
|
|
18
|
+
<PromptInputActionMenuTrigger />
|
|
19
|
+
<PromptInputActionMenuContent>
|
|
20
|
+
<PromptInputActionAddAttachments />
|
|
21
|
+
</PromptInputActionMenuContent>
|
|
22
|
+
</PromptInputActionMenu>
|
|
23
|
+
</PromptInputTools>
|
|
24
|
+
|
|
25
|
+
<PromptInputSubmit :status="status" />
|
|
26
|
+
</PromptInputFooter>
|
|
27
|
+
</PromptInput>
|
|
28
|
+
</PromptInputProvider>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script setup lang='ts'>
|
|
32
|
+
import type { ChatStatus } from "ai";
|
|
33
|
+
|
|
34
|
+
const props = defineProps<{
|
|
35
|
+
status: ChatStatus,
|
|
36
|
+
uploadImages?: (files: File[]) => { name: string; path: string }[] | Promise<{ name: string; path: string }[]>
|
|
37
|
+
}>();
|
|
38
|
+
|
|
39
|
+
const status = computed(() => props.status);
|
|
40
|
+
|
|
41
|
+
const emits = defineEmits(['submit']);
|
|
42
|
+
|
|
43
|
+
const handleSubmit = (msg: { text: string; files: any[]; }) => {
|
|
44
|
+
emits('submit', msg);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ChatPromptInputProvider } from "./ChatPromptInputProvider.vue";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
class?: HTMLAttributes['class']
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
const classes = computed(() => cn(
|
|
11
|
+
'flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm',
|
|
12
|
+
props.class,
|
|
13
|
+
))
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div
|
|
18
|
+
:class="classes"
|
|
19
|
+
v-bind="$attrs"
|
|
20
|
+
>
|
|
21
|
+
<slot />
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ButtonVariants } from '@/components/ui/button'
|
|
3
|
+
import type { LucideIcon } from 'lucide-vue-next'
|
|
4
|
+
import type { HTMLAttributes } from 'vue'
|
|
5
|
+
import { Button } from '@/components/ui/button'
|
|
6
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
|
|
7
|
+
import { cn } from '@/lib/utils'
|
|
8
|
+
import { computed } from 'vue'
|
|
9
|
+
|
|
10
|
+
interface ArtifactActionProps {
|
|
11
|
+
class?: HTMLAttributes['class']
|
|
12
|
+
tooltip?: string
|
|
13
|
+
label?: string
|
|
14
|
+
variant?: ButtonVariants['variant']
|
|
15
|
+
size?: ButtonVariants['size']
|
|
16
|
+
icon?: LucideIcon
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const props = withDefaults(defineProps<ArtifactActionProps>(), {
|
|
20
|
+
variant: 'ghost',
|
|
21
|
+
size: 'sm',
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const classes = computed(() => cn(
|
|
25
|
+
'size-8 p-0 text-muted-foreground hover:text-foreground',
|
|
26
|
+
props.class,
|
|
27
|
+
))
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<TooltipProvider v-if="props.tooltip">
|
|
32
|
+
<Tooltip>
|
|
33
|
+
<TooltipTrigger as-child>
|
|
34
|
+
<Button
|
|
35
|
+
type="button"
|
|
36
|
+
v-bind="{
|
|
37
|
+
...props,
|
|
38
|
+
class: classes,
|
|
39
|
+
}"
|
|
40
|
+
>
|
|
41
|
+
<component
|
|
42
|
+
:is="props.icon"
|
|
43
|
+
v-if="props.icon"
|
|
44
|
+
class="size-4"
|
|
45
|
+
/>
|
|
46
|
+
<slot v-else />
|
|
47
|
+
<span class="sr-only">{{ props.label || props.tooltip }}</span>
|
|
48
|
+
</Button>
|
|
49
|
+
</TooltipTrigger>
|
|
50
|
+
<TooltipContent>
|
|
51
|
+
<p>{{ props.tooltip }}</p>
|
|
52
|
+
</TooltipContent>
|
|
53
|
+
</Tooltip>
|
|
54
|
+
</TooltipProvider>
|
|
55
|
+
|
|
56
|
+
<Button
|
|
57
|
+
v-else
|
|
58
|
+
type="button"
|
|
59
|
+
v-bind="{
|
|
60
|
+
...props,
|
|
61
|
+
class: classes,
|
|
62
|
+
}"
|
|
63
|
+
>
|
|
64
|
+
<component
|
|
65
|
+
:is="props.icon"
|
|
66
|
+
v-if="props.icon"
|
|
67
|
+
class="size-4"
|
|
68
|
+
/>
|
|
69
|
+
<slot v-else />
|
|
70
|
+
<span class="sr-only">{{ props.label || props.tooltip }}</span>
|
|
71
|
+
</Button>
|
|
72
|
+
</template>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
class?: HTMLAttributes['class']
|
|
8
|
+
}>()
|
|
9
|
+
const classes = computed(() => cn('flex items-center gap-1', props.class))
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div
|
|
14
|
+
:class="classes"
|
|
15
|
+
v-bind="$attrs"
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ButtonVariants } from '@/components/ui/button'
|
|
3
|
+
import type { HTMLAttributes } from 'vue'
|
|
4
|
+
import { Button } from '@/components/ui/button'
|
|
5
|
+
import { cn } from '@/lib/utils'
|
|
6
|
+
import { X } from 'lucide-vue-next'
|
|
7
|
+
import { computed } from 'vue'
|
|
8
|
+
|
|
9
|
+
interface ArtifactCloseProps {
|
|
10
|
+
class?: HTMLAttributes['class']
|
|
11
|
+
variant?: ButtonVariants['variant']
|
|
12
|
+
size?: ButtonVariants['size']
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const props = withDefaults(defineProps<ArtifactCloseProps>(), {
|
|
16
|
+
variant: 'ghost',
|
|
17
|
+
size: 'sm',
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const classes = computed(() => cn(
|
|
21
|
+
'size-8 p-0 text-muted-foreground hover:text-foreground',
|
|
22
|
+
props.class,
|
|
23
|
+
))
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<Button
|
|
28
|
+
type="button"
|
|
29
|
+
v-bind="{
|
|
30
|
+
...props,
|
|
31
|
+
class: classes,
|
|
32
|
+
}"
|
|
33
|
+
>
|
|
34
|
+
<slot>
|
|
35
|
+
<X class="size-4" />
|
|
36
|
+
</slot>
|
|
37
|
+
<span class="sr-only">Close</span>
|
|
38
|
+
</Button>
|
|
39
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
class?: HTMLAttributes['class']
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
const classes = computed(() => cn('flex-1 overflow-auto p-4', props.class))
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<div
|
|
15
|
+
:class="classes"
|
|
16
|
+
v-bind="$attrs"
|
|
17
|
+
>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
class?: HTMLAttributes['class']
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
const classes = computed(() => cn('text-muted-foreground text-sm', props.class))
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<p
|
|
15
|
+
:class="classes"
|
|
16
|
+
v-bind="$attrs"
|
|
17
|
+
>
|
|
18
|
+
<slot />
|
|
19
|
+
</p>
|
|
20
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
class?: HTMLAttributes['class']
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
const classes = computed(() => cn(
|
|
11
|
+
'flex items-center justify-between border-b bg-muted/50 px-4 py-3',
|
|
12
|
+
props.class,
|
|
13
|
+
))
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div
|
|
18
|
+
:class="classes"
|
|
19
|
+
v-bind="$attrs"
|
|
20
|
+
>
|
|
21
|
+
<slot />
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
class?: HTMLAttributes['class']
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
const classes = computed(() => cn('font-medium text-foreground text-sm', props.class))
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<p
|
|
15
|
+
v-bind="$attrs"
|
|
16
|
+
:class="classes"
|
|
17
|
+
>
|
|
18
|
+
<slot />
|
|
19
|
+
</p>
|
|
20
|
+
</template>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as Artifact } from './Artifact.vue'
|
|
2
|
+
export { default as ArtifactAction } from './ArtifactAction.vue'
|
|
3
|
+
export { default as ArtifactActions } from './ArtifactActions.vue'
|
|
4
|
+
export { default as ArtifactClose } from './ArtifactClose.vue'
|
|
5
|
+
export { default as ArtifactContent } from './ArtifactContent.vue'
|
|
6
|
+
export { default as ArtifactDescription } from './ArtifactDescription.vue'
|
|
7
|
+
export { default as ArtifactHeader } from './ArtifactHeader.vue'
|
|
8
|
+
export { default as ArtifactTitle } from './ArtifactTitle.vue'
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { FlowEmits, FlowProps, FlowSlots } from '@vue-flow/core'
|
|
3
|
+
import { Background } from '@vue-flow/background'
|
|
4
|
+
import { VueFlow } from '@vue-flow/core'
|
|
5
|
+
import { useForwardPropsEmits } from 'reka-ui'
|
|
6
|
+
import '@vue-flow/core/dist/style.css'
|
|
7
|
+
import '@vue-flow/core/dist/theme-default.css'
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(defineProps<FlowProps>(), {
|
|
10
|
+
deleteKeyCode: () => ['Backspace', 'Delete'],
|
|
11
|
+
fitViewOnInit: true,
|
|
12
|
+
panOnDrag: false,
|
|
13
|
+
panOnScroll: true,
|
|
14
|
+
selectNodesOnDrag: true,
|
|
15
|
+
zoomOnDoubleClick: false,
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const emits = defineEmits<FlowEmits>()
|
|
19
|
+
const slots = defineSlots<FlowSlots>()
|
|
20
|
+
const forwarded = useForwardPropsEmits(props, emits)
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<VueFlow data-slot="canvas" v-bind="forwarded">
|
|
25
|
+
<Background />
|
|
26
|
+
|
|
27
|
+
<template v-if="slots['connection-line']" #connection-line="connectionLineProps">
|
|
28
|
+
<slot name="connection-line" v-bind="connectionLineProps" />
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<template v-if="slots['zoom-pane']" #zoom-pane>
|
|
32
|
+
<slot name="zoom-pane" />
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<slot />
|
|
36
|
+
</VueFlow>
|
|
37
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Canvas } from './Canvas.vue'
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes, Ref } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { useVModel } from '@vueuse/core'
|
|
5
|
+
import { provide } from 'vue'
|
|
6
|
+
import { ChainOfThoughtContextKey } from './context'
|
|
7
|
+
|
|
8
|
+
interface ChainOfThoughtProps {
|
|
9
|
+
modelValue?: boolean
|
|
10
|
+
defaultOpen?: boolean
|
|
11
|
+
class?: HTMLAttributes['class']
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(
|
|
15
|
+
defineProps<ChainOfThoughtProps>(),
|
|
16
|
+
{
|
|
17
|
+
defaultOpen: false,
|
|
18
|
+
modelValue: undefined,
|
|
19
|
+
},
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
const emit = defineEmits<{
|
|
23
|
+
(e: 'update:modelValue', value: boolean): void
|
|
24
|
+
}>()
|
|
25
|
+
|
|
26
|
+
const isOpen = useVModel(props, 'modelValue', emit, {
|
|
27
|
+
defaultValue: props.defaultOpen,
|
|
28
|
+
passive: true,
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
provide(ChainOfThoughtContextKey, isOpen as Ref<boolean>)
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<div
|
|
36
|
+
:class="cn('not-prose max-w-prose space-y-4', props.class)"
|
|
37
|
+
v-bind="$attrs"
|
|
38
|
+
>
|
|
39
|
+
<slot />
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import {
|
|
4
|
+
Collapsible,
|
|
5
|
+
CollapsibleContent,
|
|
6
|
+
} from '@/components/ui/collapsible'
|
|
7
|
+
import { cn } from '@/lib/utils'
|
|
8
|
+
import { useChainOfThought } from './context'
|
|
9
|
+
|
|
10
|
+
const props = defineProps<{
|
|
11
|
+
class?: HTMLAttributes['class']
|
|
12
|
+
}>()
|
|
13
|
+
|
|
14
|
+
const { isOpen } = useChainOfThought()
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<Collapsible :open="isOpen">
|
|
19
|
+
<CollapsibleContent
|
|
20
|
+
:class="
|
|
21
|
+
cn(
|
|
22
|
+
'mt-2 space-y-3',
|
|
23
|
+
'data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in',
|
|
24
|
+
props.class,
|
|
25
|
+
)
|
|
26
|
+
"
|
|
27
|
+
v-bind="$attrs"
|
|
28
|
+
>
|
|
29
|
+
<slot />
|
|
30
|
+
</CollapsibleContent>
|
|
31
|
+
</Collapsible>
|
|
32
|
+
</template>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HtmlHTMLAttributes } from 'vue'
|
|
3
|
+
import {
|
|
4
|
+
Collapsible,
|
|
5
|
+
CollapsibleTrigger,
|
|
6
|
+
} from '@/components/ui/collapsible'
|
|
7
|
+
import { cn } from '@/lib/utils'
|
|
8
|
+
import { BrainIcon, ChevronDownIcon } from 'lucide-vue-next'
|
|
9
|
+
import { useChainOfThought } from './context'
|
|
10
|
+
|
|
11
|
+
const props = defineProps<{
|
|
12
|
+
class?: HtmlHTMLAttributes['class']
|
|
13
|
+
}>()
|
|
14
|
+
|
|
15
|
+
const { isOpen, setIsOpen } = useChainOfThought()
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<Collapsible :open="isOpen" @update:open="setIsOpen">
|
|
20
|
+
<CollapsibleTrigger
|
|
21
|
+
:class="
|
|
22
|
+
cn(
|
|
23
|
+
'flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground',
|
|
24
|
+
props.class,
|
|
25
|
+
)
|
|
26
|
+
"
|
|
27
|
+
v-bind="$attrs"
|
|
28
|
+
>
|
|
29
|
+
<BrainIcon class="size-4" />
|
|
30
|
+
<span class="flex-1 text-left">
|
|
31
|
+
<slot>Chain of Thought</slot>
|
|
32
|
+
</span>
|
|
33
|
+
<ChevronDownIcon
|
|
34
|
+
:class="
|
|
35
|
+
cn(
|
|
36
|
+
'size-4 transition-transform',
|
|
37
|
+
isOpen ? 'rotate-180' : 'rotate-0',
|
|
38
|
+
)
|
|
39
|
+
"
|
|
40
|
+
/>
|
|
41
|
+
</CollapsibleTrigger>
|
|
42
|
+
</Collapsible>
|
|
43
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
caption?: string
|
|
7
|
+
class?: HTMLAttributes['class']
|
|
8
|
+
}>()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<div
|
|
13
|
+
:class="cn('mt-2 space-y-2', props.class)"
|
|
14
|
+
v-bind="$attrs"
|
|
15
|
+
>
|
|
16
|
+
<div
|
|
17
|
+
class="relative flex max-h-[22rem] items-center justify-center overflow-hidden rounded-lg bg-muted p-3"
|
|
18
|
+
>
|
|
19
|
+
<slot />
|
|
20
|
+
</div>
|
|
21
|
+
<p v-if="caption" class="text-muted-foreground text-xs">
|
|
22
|
+
{{ props.caption }}
|
|
23
|
+
</p>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { Badge } from '@/components/ui/badge'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
class?: HTMLAttributes['class']
|
|
8
|
+
}>()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<Badge
|
|
13
|
+
:class="
|
|
14
|
+
cn(
|
|
15
|
+
'gap-1 px-2 py-0.5 font-normal text-xs',
|
|
16
|
+
props.class,
|
|
17
|
+
)
|
|
18
|
+
"
|
|
19
|
+
variant="secondary"
|
|
20
|
+
v-bind="$attrs"
|
|
21
|
+
>
|
|
22
|
+
<slot />
|
|
23
|
+
</Badge>
|
|
24
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HtmlHTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
class?: HtmlHTMLAttributes['class']
|
|
7
|
+
}>()
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<div
|
|
12
|
+
:class="cn('flex items-center gap-2', props.class)"
|
|
13
|
+
v-bind="$attrs"
|
|
14
|
+
>
|
|
15
|
+
<slot />
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|