@sveda-ai/vue 0.1.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/LICENSE +21 -0
- package/README.md +9 -0
- package/dist/appearance.d.ts +52 -0
- package/dist/appearance.d.ts.map +1 -0
- package/dist/components/chat/AnimatedStreamBlock.vue.d.ts +16 -0
- package/dist/components/chat/AnimatedStreamBlock.vue.d.ts.map +1 -0
- package/dist/components/chat/ChatHistoryDropdown.vue.d.ts +17 -0
- package/dist/components/chat/ChatHistoryDropdown.vue.d.ts.map +1 -0
- package/dist/components/chat/ChatInput.vue.d.ts +30 -0
- package/dist/components/chat/ChatInput.vue.d.ts.map +1 -0
- package/dist/components/chat/ChatMessageActivityBlock.vue.d.ts +13 -0
- package/dist/components/chat/ChatMessageActivityBlock.vue.d.ts.map +1 -0
- package/dist/components/chat/ChatMessageItem.vue.d.ts +15 -0
- package/dist/components/chat/ChatMessageItem.vue.d.ts.map +1 -0
- package/dist/components/chat/ChatMessageList.vue.d.ts +31 -0
- package/dist/components/chat/ChatMessageList.vue.d.ts.map +1 -0
- package/dist/components/chat/ChatPendingIndicator.vue.d.ts +12 -0
- package/dist/components/chat/ChatPendingIndicator.vue.d.ts.map +1 -0
- package/dist/components/chat/ReasoningStream.vue.d.ts +11 -0
- package/dist/components/chat/ReasoningStream.vue.d.ts.map +1 -0
- package/dist/components/chat/index.d.ts +9 -0
- package/dist/components/chat/index.d.ts.map +1 -0
- package/dist/components/shell/SvedaAgentCompletedNotice.vue.d.ts +9 -0
- package/dist/components/shell/SvedaAgentCompletedNotice.vue.d.ts.map +1 -0
- package/dist/components/shell/SvedaAgentTasksPanel.vue.d.ts +12 -0
- package/dist/components/shell/SvedaAgentTasksPanel.vue.d.ts.map +1 -0
- package/dist/components/shell/SvedaChat.vue.d.ts +22 -0
- package/dist/components/shell/SvedaChat.vue.d.ts.map +1 -0
- package/dist/components/shell/SvedaContextUsageBar.vue.d.ts +10 -0
- package/dist/components/shell/SvedaContextUsageBar.vue.d.ts.map +1 -0
- package/dist/components/shell/SvedaHistorySheet.vue.d.ts +15 -0
- package/dist/components/shell/SvedaHistorySheet.vue.d.ts.map +1 -0
- package/dist/components/shell/SvedaHistorySidebar.vue.d.ts +15 -0
- package/dist/components/shell/SvedaHistorySidebar.vue.d.ts.map +1 -0
- package/dist/components/shell/SvedaInputSection.vue.d.ts +25 -0
- package/dist/components/shell/SvedaInputSection.vue.d.ts.map +1 -0
- package/dist/components/shell/SvedaLandingView.vue.d.ts +40 -0
- package/dist/components/shell/SvedaLandingView.vue.d.ts.map +1 -0
- package/dist/components/shell/SvedaMaxStepsNotice.vue.d.ts +13 -0
- package/dist/components/shell/SvedaMaxStepsNotice.vue.d.ts.map +1 -0
- package/dist/components/shell/SvedaMinimizedTrigger.vue.d.ts +15 -0
- package/dist/components/shell/SvedaMinimizedTrigger.vue.d.ts.map +1 -0
- package/dist/components/shell/SvedaModelControls.vue.d.ts +12 -0
- package/dist/components/shell/SvedaModelControls.vue.d.ts.map +1 -0
- package/dist/components/shell/SvedaModelSelect.vue.d.ts +10 -0
- package/dist/components/shell/SvedaModelSelect.vue.d.ts.map +1 -0
- package/dist/components/shell/SvedaQuickPrompts.vue.d.ts +13 -0
- package/dist/components/shell/SvedaQuickPrompts.vue.d.ts.map +1 -0
- package/dist/components/shell/SvedaResizeHandles.vue.d.ts +11 -0
- package/dist/components/shell/SvedaResizeHandles.vue.d.ts.map +1 -0
- package/dist/components/shell/SvedaTabs.vue.d.ts +17 -0
- package/dist/components/shell/SvedaTabs.vue.d.ts.map +1 -0
- package/dist/components/shell/SvedaToolbar.vue.d.ts +33 -0
- package/dist/components/shell/SvedaToolbar.vue.d.ts.map +1 -0
- package/dist/composables/useSvedaAgentTasks.d.ts +57 -0
- package/dist/composables/useSvedaAgentTasks.d.ts.map +1 -0
- package/dist/composables/useSvedaBootstrap.d.ts +18 -0
- package/dist/composables/useSvedaBootstrap.d.ts.map +1 -0
- package/dist/composables/useSvedaChat.d.ts +264 -0
- package/dist/composables/useSvedaChat.d.ts.map +1 -0
- package/dist/composables/useSvedaChatLayout.d.ts +39 -0
- package/dist/composables/useSvedaChatLayout.d.ts.map +1 -0
- package/dist/composables/useSvedaChatPage.d.ts +309 -0
- package/dist/composables/useSvedaChatPage.d.ts.map +1 -0
- package/dist/composables/useSvedaContextWindow.d.ts +10 -0
- package/dist/composables/useSvedaContextWindow.d.ts.map +1 -0
- package/dist/composables/useSvedaDocuments.d.ts +20 -0
- package/dist/composables/useSvedaDocuments.d.ts.map +1 -0
- package/dist/composables/useSvedaMaxStepsContinue.d.ts +12 -0
- package/dist/composables/useSvedaMaxStepsContinue.d.ts.map +1 -0
- package/dist/composables/useSvedaMessaging.d.ts +55 -0
- package/dist/composables/useSvedaMessaging.d.ts.map +1 -0
- package/dist/composables/useSvedaModel.d.ts +16 -0
- package/dist/composables/useSvedaModel.d.ts.map +1 -0
- package/dist/composables/useSvedaPrompts.d.ts +18 -0
- package/dist/composables/useSvedaPrompts.d.ts.map +1 -0
- package/dist/composables/useSvedaReadable.d.ts +3 -0
- package/dist/composables/useSvedaReadable.d.ts.map +1 -0
- package/dist/composables/useSvedaScroll.d.ts +19 -0
- package/dist/composables/useSvedaScroll.d.ts.map +1 -0
- package/dist/composables/useSvedaShell.d.ts +29 -0
- package/dist/composables/useSvedaShell.d.ts.map +1 -0
- package/dist/composables/useSvedaStreaming.d.ts +46 -0
- package/dist/composables/useSvedaStreaming.d.ts.map +1 -0
- package/dist/composables/useSvedaTool.d.ts +4 -0
- package/dist/composables/useSvedaTool.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +18 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/locales/en.d.ts +4 -0
- package/dist/i18n/locales/en.d.ts.map +1 -0
- package/dist/i18n/locales/ru.d.ts +4 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6612 -0
- package/dist/launcherIcons.d.ts +5 -0
- package/dist/launcherIcons.d.ts.map +1 -0
- package/dist/lib/assistantMessage.d.ts +89 -0
- package/dist/lib/assistantMessage.d.ts.map +1 -0
- package/dist/lib/chatHistoryMerge.d.ts +20 -0
- package/dist/lib/chatHistoryMerge.d.ts.map +1 -0
- package/dist/lib/chatI18nKeys.d.ts +2 -0
- package/dist/lib/chatI18nKeys.d.ts.map +1 -0
- package/dist/lib/chatMessageVisibility.d.ts +4 -0
- package/dist/lib/chatMessageVisibility.d.ts.map +1 -0
- package/dist/lib/chatTabs.d.ts +9 -0
- package/dist/lib/chatTabs.d.ts.map +1 -0
- package/dist/lib/chatTitle.d.ts +3 -0
- package/dist/lib/chatTitle.d.ts.map +1 -0
- package/dist/lib/chatUiStorage.d.ts +4 -0
- package/dist/lib/chatUiStorage.d.ts.map +1 -0
- package/dist/lib/finalizeMessages.d.ts +21 -0
- package/dist/lib/finalizeMessages.d.ts.map +1 -0
- package/dist/lib/markdown.d.ts +8 -0
- package/dist/lib/markdown.d.ts.map +1 -0
- package/dist/lib/modelLabels.d.ts +3 -0
- package/dist/lib/modelLabels.d.ts.map +1 -0
- package/dist/lib/pendingStatusRotation.d.ts +3 -0
- package/dist/lib/pendingStatusRotation.d.ts.map +1 -0
- package/dist/lib/useAnimatedText.d.ts +8 -0
- package/dist/lib/useAnimatedText.d.ts.map +1 -0
- package/dist/lib/userMessage.d.ts +17 -0
- package/dist/lib/userMessage.d.ts.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/plugin.d.ts +64 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/styles.css +5 -0
- package/dist/ui/alert-dialog/AlertDialog.vue.d.ts +18 -0
- package/dist/ui/alert-dialog/AlertDialog.vue.d.ts.map +1 -0
- package/dist/ui/alert-dialog/AlertDialogAction.vue.d.ts +18 -0
- package/dist/ui/alert-dialog/AlertDialogAction.vue.d.ts.map +1 -0
- package/dist/ui/alert-dialog/AlertDialogCancel.vue.d.ts +18 -0
- package/dist/ui/alert-dialog/AlertDialogCancel.vue.d.ts.map +1 -0
- package/dist/ui/alert-dialog/AlertDialogContent.vue.d.ts +32 -0
- package/dist/ui/alert-dialog/AlertDialogContent.vue.d.ts.map +1 -0
- package/dist/ui/alert-dialog/AlertDialogDescription.vue.d.ts +18 -0
- package/dist/ui/alert-dialog/AlertDialogDescription.vue.d.ts.map +1 -0
- package/dist/ui/alert-dialog/AlertDialogFooter.vue.d.ts +17 -0
- package/dist/ui/alert-dialog/AlertDialogFooter.vue.d.ts.map +1 -0
- package/dist/ui/alert-dialog/AlertDialogHeader.vue.d.ts +17 -0
- package/dist/ui/alert-dialog/AlertDialogHeader.vue.d.ts.map +1 -0
- package/dist/ui/alert-dialog/AlertDialogTitle.vue.d.ts +18 -0
- package/dist/ui/alert-dialog/AlertDialogTitle.vue.d.ts.map +1 -0
- package/dist/ui/alert-dialog/AlertDialogTrigger.vue.d.ts +14 -0
- package/dist/ui/alert-dialog/AlertDialogTrigger.vue.d.ts.map +1 -0
- package/dist/ui/alert-dialog/index.d.ts +10 -0
- package/dist/ui/alert-dialog/index.d.ts.map +1 -0
- package/dist/ui/badge/Badge.vue.d.ts +19 -0
- package/dist/ui/badge/Badge.vue.d.ts.map +1 -0
- package/dist/ui/badge/index.d.ts +7 -0
- package/dist/ui/badge/index.d.ts.map +1 -0
- package/dist/ui/button/Button.vue.d.ts +23 -0
- package/dist/ui/button/Button.vue.d.ts.map +1 -0
- package/dist/ui/button/index.d.ts +9 -0
- package/dist/ui/button/index.d.ts.map +1 -0
- package/dist/ui/card/Card.vue.d.ts +17 -0
- package/dist/ui/card/Card.vue.d.ts.map +1 -0
- package/dist/ui/card/CardContent.vue.d.ts +17 -0
- package/dist/ui/card/CardContent.vue.d.ts.map +1 -0
- package/dist/ui/card/CardDescription.vue.d.ts +17 -0
- package/dist/ui/card/CardDescription.vue.d.ts.map +1 -0
- package/dist/ui/card/CardFooter.vue.d.ts +17 -0
- package/dist/ui/card/CardFooter.vue.d.ts.map +1 -0
- package/dist/ui/card/CardHeader.vue.d.ts +17 -0
- package/dist/ui/card/CardHeader.vue.d.ts.map +1 -0
- package/dist/ui/card/CardTitle.vue.d.ts +17 -0
- package/dist/ui/card/CardTitle.vue.d.ts.map +1 -0
- package/dist/ui/card/index.d.ts +7 -0
- package/dist/ui/card/index.d.ts.map +1 -0
- package/dist/ui/checkbox/Checkbox.vue.d.ts +30 -0
- package/dist/ui/checkbox/Checkbox.vue.d.ts.map +1 -0
- package/dist/ui/checkbox/index.d.ts +2 -0
- package/dist/ui/checkbox/index.d.ts.map +1 -0
- package/dist/ui/dialog/Dialog.vue.d.ts +18 -0
- package/dist/ui/dialog/Dialog.vue.d.ts.map +1 -0
- package/dist/ui/dialog/DialogClose.vue.d.ts +14 -0
- package/dist/ui/dialog/DialogClose.vue.d.ts.map +1 -0
- package/dist/ui/dialog/DialogContent.vue.d.ts +32 -0
- package/dist/ui/dialog/DialogContent.vue.d.ts.map +1 -0
- package/dist/ui/dialog/DialogDescription.vue.d.ts +18 -0
- package/dist/ui/dialog/DialogDescription.vue.d.ts.map +1 -0
- package/dist/ui/dialog/DialogFooter.vue.d.ts +17 -0
- package/dist/ui/dialog/DialogFooter.vue.d.ts.map +1 -0
- package/dist/ui/dialog/DialogHeader.vue.d.ts +17 -0
- package/dist/ui/dialog/DialogHeader.vue.d.ts.map +1 -0
- package/dist/ui/dialog/DialogScrollContent.vue.d.ts +32 -0
- package/dist/ui/dialog/DialogScrollContent.vue.d.ts.map +1 -0
- package/dist/ui/dialog/DialogTitle.vue.d.ts +18 -0
- package/dist/ui/dialog/DialogTitle.vue.d.ts.map +1 -0
- package/dist/ui/dialog/DialogTrigger.vue.d.ts +14 -0
- package/dist/ui/dialog/DialogTrigger.vue.d.ts.map +1 -0
- package/dist/ui/dialog/index.d.ts +10 -0
- package/dist/ui/dialog/index.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/DropdownMenu.vue.d.ts +18 -0
- package/dist/ui/dropdown-menu/DropdownMenu.vue.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/DropdownMenuCheckboxItem.vue.d.ts +24 -0
- package/dist/ui/dropdown-menu/DropdownMenuCheckboxItem.vue.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/DropdownMenuContent.vue.d.ts +32 -0
- package/dist/ui/dropdown-menu/DropdownMenuContent.vue.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/DropdownMenuGroup.vue.d.ts +14 -0
- package/dist/ui/dropdown-menu/DropdownMenuGroup.vue.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/DropdownMenuItem.vue.d.ts +19 -0
- package/dist/ui/dropdown-menu/DropdownMenuItem.vue.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/DropdownMenuLabel.vue.d.ts +19 -0
- package/dist/ui/dropdown-menu/DropdownMenuLabel.vue.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/DropdownMenuRadioGroup.vue.d.ts +18 -0
- package/dist/ui/dropdown-menu/DropdownMenuRadioGroup.vue.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/DropdownMenuRadioItem.vue.d.ts +22 -0
- package/dist/ui/dropdown-menu/DropdownMenuRadioItem.vue.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/DropdownMenuSeparator.vue.d.ts +8 -0
- package/dist/ui/dropdown-menu/DropdownMenuSeparator.vue.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/DropdownMenuShortcut.vue.d.ts +17 -0
- package/dist/ui/dropdown-menu/DropdownMenuShortcut.vue.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/DropdownMenuSub.vue.d.ts +18 -0
- package/dist/ui/dropdown-menu/DropdownMenuSub.vue.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/DropdownMenuSubContent.vue.d.ts +34 -0
- package/dist/ui/dropdown-menu/DropdownMenuSubContent.vue.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/DropdownMenuSubTrigger.vue.d.ts +18 -0
- package/dist/ui/dropdown-menu/DropdownMenuSubTrigger.vue.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/DropdownMenuTrigger.vue.d.ts +14 -0
- package/dist/ui/dropdown-menu/DropdownMenuTrigger.vue.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/index.d.ts +16 -0
- package/dist/ui/dropdown-menu/index.d.ts.map +1 -0
- package/dist/ui/input/Input.vue.d.ts +13 -0
- package/dist/ui/input/Input.vue.d.ts.map +1 -0
- package/dist/ui/input/index.d.ts +2 -0
- package/dist/ui/input/index.d.ts.map +1 -0
- package/dist/ui/label/Label.vue.d.ts +18 -0
- package/dist/ui/label/Label.vue.d.ts.map +1 -0
- package/dist/ui/label/index.d.ts +2 -0
- package/dist/ui/label/index.d.ts.map +1 -0
- package/dist/ui/responsive-dialog/ResponsiveDialog.vue.d.ts +32 -0
- package/dist/ui/responsive-dialog/ResponsiveDialog.vue.d.ts.map +1 -0
- package/dist/ui/responsive-dialog/index.d.ts +2 -0
- package/dist/ui/responsive-dialog/index.d.ts.map +1 -0
- package/dist/ui/scroll-area/ScrollArea.vue.d.ts +18 -0
- package/dist/ui/scroll-area/ScrollArea.vue.d.ts.map +1 -0
- package/dist/ui/scroll-area/ScrollBar.vue.d.ts +10 -0
- package/dist/ui/scroll-area/ScrollBar.vue.d.ts.map +1 -0
- package/dist/ui/scroll-area/index.d.ts +3 -0
- package/dist/ui/scroll-area/index.d.ts.map +1 -0
- package/dist/ui/select/Select.vue.d.ts +21 -0
- package/dist/ui/select/Select.vue.d.ts.map +1 -0
- package/dist/ui/select/SelectContent.vue.d.ts +28 -0
- package/dist/ui/select/SelectContent.vue.d.ts.map +1 -0
- package/dist/ui/select/SelectGroup.vue.d.ts +18 -0
- package/dist/ui/select/SelectGroup.vue.d.ts.map +1 -0
- package/dist/ui/select/SelectItem.vue.d.ts +18 -0
- package/dist/ui/select/SelectItem.vue.d.ts.map +1 -0
- package/dist/ui/select/SelectItemText.vue.d.ts +14 -0
- package/dist/ui/select/SelectItemText.vue.d.ts.map +1 -0
- package/dist/ui/select/SelectLabel.vue.d.ts +18 -0
- package/dist/ui/select/SelectLabel.vue.d.ts.map +1 -0
- package/dist/ui/select/SelectScrollDownButton.vue.d.ts +18 -0
- package/dist/ui/select/SelectScrollDownButton.vue.d.ts.map +1 -0
- package/dist/ui/select/SelectScrollUpButton.vue.d.ts +18 -0
- package/dist/ui/select/SelectScrollUpButton.vue.d.ts.map +1 -0
- package/dist/ui/select/SelectSeparator.vue.d.ts +8 -0
- package/dist/ui/select/SelectSeparator.vue.d.ts.map +1 -0
- package/dist/ui/select/SelectTrigger.vue.d.ts +18 -0
- package/dist/ui/select/SelectTrigger.vue.d.ts.map +1 -0
- package/dist/ui/select/SelectValue.vue.d.ts +14 -0
- package/dist/ui/select/SelectValue.vue.d.ts.map +1 -0
- package/dist/ui/select/index.d.ts +12 -0
- package/dist/ui/select/index.d.ts.map +1 -0
- package/dist/ui/sheet/Sheet.vue.d.ts +18 -0
- package/dist/ui/sheet/Sheet.vue.d.ts.map +1 -0
- package/dist/ui/sheet/SheetClose.vue.d.ts +14 -0
- package/dist/ui/sheet/SheetClose.vue.d.ts.map +1 -0
- package/dist/ui/sheet/SheetContent.vue.d.ts +34 -0
- package/dist/ui/sheet/SheetContent.vue.d.ts.map +1 -0
- package/dist/ui/sheet/SheetDescription.vue.d.ts +18 -0
- package/dist/ui/sheet/SheetDescription.vue.d.ts.map +1 -0
- package/dist/ui/sheet/SheetFooter.vue.d.ts +17 -0
- package/dist/ui/sheet/SheetFooter.vue.d.ts.map +1 -0
- package/dist/ui/sheet/SheetHeader.vue.d.ts +17 -0
- package/dist/ui/sheet/SheetHeader.vue.d.ts.map +1 -0
- package/dist/ui/sheet/SheetTitle.vue.d.ts +18 -0
- package/dist/ui/sheet/SheetTitle.vue.d.ts.map +1 -0
- package/dist/ui/sheet/SheetTrigger.vue.d.ts +14 -0
- package/dist/ui/sheet/SheetTrigger.vue.d.ts.map +1 -0
- package/dist/ui/sheet/index.d.ts +14 -0
- package/dist/ui/sheet/index.d.ts.map +1 -0
- package/dist/ui/switch/Switch.vue.d.ts +23 -0
- package/dist/ui/switch/Switch.vue.d.ts.map +1 -0
- package/dist/ui/switch/index.d.ts +2 -0
- package/dist/ui/switch/index.d.ts.map +1 -0
- package/dist/ui/textarea/Textarea.vue.d.ts +13 -0
- package/dist/ui/textarea/Textarea.vue.d.ts.map +1 -0
- package/dist/ui/textarea/index.d.ts +2 -0
- package/dist/ui/textarea/index.d.ts.map +1 -0
- package/dist/ui/toast/Toast.vue.d.ts +96 -0
- package/dist/ui/toast/Toast.vue.d.ts.map +1 -0
- package/dist/ui/toast/ToastAction.vue.d.ts +18 -0
- package/dist/ui/toast/ToastAction.vue.d.ts.map +1 -0
- package/dist/ui/toast/ToastClose.vue.d.ts +8 -0
- package/dist/ui/toast/ToastClose.vue.d.ts.map +1 -0
- package/dist/ui/toast/ToastDescription.vue.d.ts +18 -0
- package/dist/ui/toast/ToastDescription.vue.d.ts.map +1 -0
- package/dist/ui/toast/ToastProvider.vue.d.ts +14 -0
- package/dist/ui/toast/ToastProvider.vue.d.ts.map +1 -0
- package/dist/ui/toast/ToastTitle.vue.d.ts +18 -0
- package/dist/ui/toast/ToastTitle.vue.d.ts.map +1 -0
- package/dist/ui/toast/ToastViewport.vue.d.ts +8 -0
- package/dist/ui/toast/ToastViewport.vue.d.ts.map +1 -0
- package/dist/ui/toast/Toaster.vue.d.ts +3 -0
- package/dist/ui/toast/Toaster.vue.d.ts.map +1 -0
- package/dist/ui/toast/index.d.ts +23 -0
- package/dist/ui/toast/index.d.ts.map +1 -0
- package/dist/ui/toast/use-toast.d.ts +23 -0
- package/dist/ui/toast/use-toast.d.ts.map +1 -0
- package/dist/ui/tooltip/Tooltip.vue.d.ts +18 -0
- package/dist/ui/tooltip/Tooltip.vue.d.ts.map +1 -0
- package/dist/ui/tooltip/TooltipContent.vue.d.ts +26 -0
- package/dist/ui/tooltip/TooltipContent.vue.d.ts.map +1 -0
- package/dist/ui/tooltip/TooltipProvider.vue.d.ts +14 -0
- package/dist/ui/tooltip/TooltipProvider.vue.d.ts.map +1 -0
- package/dist/ui/tooltip/TooltipTrigger.vue.d.ts +14 -0
- package/dist/ui/tooltip/TooltipTrigger.vue.d.ts.map +1 -0
- package/dist/ui/tooltip/index.d.ts +5 -0
- package/dist/ui/tooltip/index.d.ts.map +1 -0
- package/dist/ui/utils.d.ts +2 -0
- package/dist/ui/utils.d.ts.map +1 -0
- package/dist/vue.css +1 -0
- package/package.json +64 -0
- package/src/appearance.ts +568 -0
- package/src/components/chat/AnimatedStreamBlock.vue +94 -0
- package/src/components/chat/ChatHistoryDropdown.vue +226 -0
- package/src/components/chat/ChatInput.vue +571 -0
- package/src/components/chat/ChatMessageActivityBlock.vue +447 -0
- package/src/components/chat/ChatMessageItem.vue +357 -0
- package/src/components/chat/ChatMessageList.vue +178 -0
- package/src/components/chat/ChatPendingIndicator.vue +163 -0
- package/src/components/chat/ReasoningStream.vue +112 -0
- package/src/components/chat/index.ts +8 -0
- package/src/components/shell/SvedaAgentCompletedNotice.vue +25 -0
- package/src/components/shell/SvedaAgentTasksPanel.vue +146 -0
- package/src/components/shell/SvedaChat.vue +514 -0
- package/src/components/shell/SvedaContextUsageBar.vue +33 -0
- package/src/components/shell/SvedaHistorySheet.vue +52 -0
- package/src/components/shell/SvedaHistorySidebar.vue +41 -0
- package/src/components/shell/SvedaInputSection.vue +53 -0
- package/src/components/shell/SvedaLandingView.vue +93 -0
- package/src/components/shell/SvedaMaxStepsNotice.vue +33 -0
- package/src/components/shell/SvedaMinimizedTrigger.vue +43 -0
- package/src/components/shell/SvedaModelControls.vue +47 -0
- package/src/components/shell/SvedaModelSelect.vue +32 -0
- package/src/components/shell/SvedaQuickPrompts.vue +44 -0
- package/src/components/shell/SvedaResizeHandles.vue +31 -0
- package/src/components/shell/SvedaTabs.vue +123 -0
- package/src/components/shell/SvedaToolbar.vue +171 -0
- package/src/composables/useSvedaAgentTasks.ts +93 -0
- package/src/composables/useSvedaBootstrap.ts +36 -0
- package/src/composables/useSvedaChat.ts +593 -0
- package/src/composables/useSvedaChatLayout.ts +539 -0
- package/src/composables/useSvedaChatPage.ts +339 -0
- package/src/composables/useSvedaContextWindow.ts +31 -0
- package/src/composables/useSvedaDocuments.ts +115 -0
- package/src/composables/useSvedaMaxStepsContinue.ts +68 -0
- package/src/composables/useSvedaMessaging.ts +99 -0
- package/src/composables/useSvedaModel.ts +85 -0
- package/src/composables/useSvedaPrompts.ts +59 -0
- package/src/composables/useSvedaReadable.ts +33 -0
- package/src/composables/useSvedaScroll.ts +93 -0
- package/src/composables/useSvedaShell.ts +91 -0
- package/src/composables/useSvedaStreaming.ts +408 -0
- package/src/composables/useSvedaTool.ts +18 -0
- package/src/i18n/index.ts +72 -0
- package/src/i18n/locales/en.ts +58 -0
- package/src/i18n/locales/ru.ts +59 -0
- package/src/index.ts +141 -0
- package/src/launcherIcons.ts +39 -0
- package/src/lib/assistantMessage.ts +437 -0
- package/src/lib/chatHistoryMerge.ts +93 -0
- package/src/lib/chatI18nKeys.ts +62 -0
- package/src/lib/chatMessageVisibility.ts +50 -0
- package/src/lib/chatTabs.ts +54 -0
- package/src/lib/chatTitle.ts +30 -0
- package/src/lib/chatUiStorage.ts +33 -0
- package/src/lib/finalizeMessages.ts +81 -0
- package/src/lib/markdown.ts +90 -0
- package/src/lib/modelLabels.ts +24 -0
- package/src/lib/pendingStatusRotation.ts +26 -0
- package/src/lib/shims-vue.d.ts +6 -0
- package/src/lib/useAnimatedText.ts +78 -0
- package/src/lib/userMessage.ts +55 -0
- package/src/lib/utils.ts +6 -0
- package/src/plugin.ts +164 -0
- package/src/styles.css +5 -0
- package/src/theme.css +95 -0
- package/src/theme.test.mjs +80 -0
- package/src/ui/alert-dialog/AlertDialog.vue +14 -0
- package/src/ui/alert-dialog/AlertDialogAction.vue +17 -0
- package/src/ui/alert-dialog/AlertDialogCancel.vue +24 -0
- package/src/ui/alert-dialog/AlertDialogContent.vue +39 -0
- package/src/ui/alert-dialog/AlertDialogDescription.vue +22 -0
- package/src/ui/alert-dialog/AlertDialogFooter.vue +21 -0
- package/src/ui/alert-dialog/AlertDialogHeader.vue +16 -0
- package/src/ui/alert-dialog/AlertDialogTitle.vue +19 -0
- package/src/ui/alert-dialog/AlertDialogTrigger.vue +11 -0
- package/src/ui/alert-dialog/index.ts +9 -0
- package/src/ui/badge/Badge.vue +16 -0
- package/src/ui/badge/index.ts +27 -0
- package/src/ui/button/Button.vue +56 -0
- package/src/ui/button/index.ts +50 -0
- package/src/ui/card/Card.vue +14 -0
- package/src/ui/card/CardContent.vue +14 -0
- package/src/ui/card/CardDescription.vue +14 -0
- package/src/ui/card/CardFooter.vue +14 -0
- package/src/ui/card/CardHeader.vue +14 -0
- package/src/ui/card/CardTitle.vue +14 -0
- package/src/ui/card/index.ts +6 -0
- package/src/ui/checkbox/Checkbox.vue +41 -0
- package/src/ui/checkbox/index.ts +1 -0
- package/src/ui/dialog/Dialog.vue +14 -0
- package/src/ui/dialog/DialogClose.vue +11 -0
- package/src/ui/dialog/DialogContent.vue +50 -0
- package/src/ui/dialog/DialogDescription.vue +24 -0
- package/src/ui/dialog/DialogFooter.vue +19 -0
- package/src/ui/dialog/DialogHeader.vue +16 -0
- package/src/ui/dialog/DialogScrollContent.vue +59 -0
- package/src/ui/dialog/DialogTitle.vue +29 -0
- package/src/ui/dialog/DialogTrigger.vue +11 -0
- package/src/ui/dialog/index.ts +9 -0
- package/src/ui/dropdown-menu/DropdownMenu.vue +14 -0
- package/src/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +42 -0
- package/src/ui/dropdown-menu/DropdownMenuContent.vue +40 -0
- package/src/ui/dropdown-menu/DropdownMenuGroup.vue +11 -0
- package/src/ui/dropdown-menu/DropdownMenuItem.vue +30 -0
- package/src/ui/dropdown-menu/DropdownMenuLabel.vue +21 -0
- package/src/ui/dropdown-menu/DropdownMenuRadioGroup.vue +14 -0
- package/src/ui/dropdown-menu/DropdownMenuRadioItem.vue +43 -0
- package/src/ui/dropdown-menu/DropdownMenuSeparator.vue +21 -0
- package/src/ui/dropdown-menu/DropdownMenuShortcut.vue +14 -0
- package/src/ui/dropdown-menu/DropdownMenuSub.vue +14 -0
- package/src/ui/dropdown-menu/DropdownMenuSubContent.vue +30 -0
- package/src/ui/dropdown-menu/DropdownMenuSubTrigger.vue +31 -0
- package/src/ui/dropdown-menu/DropdownMenuTrigger.vue +13 -0
- package/src/ui/dropdown-menu/index.ts +16 -0
- package/src/ui/input/Input.vue +32 -0
- package/src/ui/input/index.ts +1 -0
- package/src/ui/label/Label.vue +22 -0
- package/src/ui/label/index.ts +1 -0
- package/src/ui/responsive-dialog/ResponsiveDialog.vue +55 -0
- package/src/ui/responsive-dialog/index.ts +1 -0
- package/src/ui/scroll-area/ScrollArea.vue +29 -0
- package/src/ui/scroll-area/ScrollBar.vue +30 -0
- package/src/ui/scroll-area/index.ts +2 -0
- package/src/ui/select/Select.vue +15 -0
- package/src/ui/select/SelectContent.vue +53 -0
- package/src/ui/select/SelectGroup.vue +19 -0
- package/src/ui/select/SelectItem.vue +44 -0
- package/src/ui/select/SelectItemText.vue +11 -0
- package/src/ui/select/SelectLabel.vue +13 -0
- package/src/ui/select/SelectScrollDownButton.vue +24 -0
- package/src/ui/select/SelectScrollUpButton.vue +24 -0
- package/src/ui/select/SelectSeparator.vue +17 -0
- package/src/ui/select/SelectTrigger.vue +31 -0
- package/src/ui/select/SelectValue.vue +11 -0
- package/src/ui/select/index.ts +11 -0
- package/src/ui/sheet/Sheet.vue +14 -0
- package/src/ui/sheet/SheetClose.vue +11 -0
- package/src/ui/sheet/SheetContent.vue +53 -0
- package/src/ui/sheet/SheetDescription.vue +19 -0
- package/src/ui/sheet/SheetFooter.vue +12 -0
- package/src/ui/sheet/SheetHeader.vue +12 -0
- package/src/ui/sheet/SheetTitle.vue +19 -0
- package/src/ui/sheet/SheetTrigger.vue +11 -0
- package/src/ui/sheet/index.ts +29 -0
- package/src/ui/switch/Switch.vue +55 -0
- package/src/ui/switch/index.ts +1 -0
- package/src/ui/textarea/Textarea.vue +24 -0
- package/src/ui/textarea/index.ts +1 -0
- package/src/ui/toast/Toast.vue +28 -0
- package/src/ui/toast/ToastAction.vue +19 -0
- package/src/ui/toast/ToastClose.vue +22 -0
- package/src/ui/toast/ToastDescription.vue +19 -0
- package/src/ui/toast/ToastProvider.vue +11 -0
- package/src/ui/toast/ToastTitle.vue +19 -0
- package/src/ui/toast/ToastViewport.vue +17 -0
- package/src/ui/toast/Toaster.vue +48 -0
- package/src/ui/toast/index.ts +39 -0
- package/src/ui/toast/use-toast.ts +109 -0
- package/src/ui/tooltip/Tooltip.vue +14 -0
- package/src/ui/tooltip/TooltipContent.vue +39 -0
- package/src/ui/tooltip/TooltipProvider.vue +11 -0
- package/src/ui/tooltip/TooltipTrigger.vue +11 -0
- package/src/ui/tooltip/index.ts +4 -0
- package/src/ui/utils.ts +1 -0
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SvedaChatSession,
|
|
3
|
+
SvedaClient,
|
|
4
|
+
SvedaDisplayMessage,
|
|
5
|
+
SvedaMessagePart,
|
|
6
|
+
SvedaSendOptions,
|
|
7
|
+
SvedaSessionStatus,
|
|
8
|
+
} from '@sveda-ai/core';
|
|
9
|
+
import type { SvedaContextUsageEvent, SvedaMaxStepsEvent, SvedaToolProgressEvent } from '@sveda-ai/protocol';
|
|
10
|
+
import { computed, inject, nextTick, onUnmounted, ref, watch, type Ref } from 'vue';
|
|
11
|
+
import { useSvedaT } from '../i18n/index';
|
|
12
|
+
import { deriveProvisionalChatTitle, isChatTitlePlaceholder } from '../lib/chatTitle';
|
|
13
|
+
import { SvedaClientKey } from '../plugin';
|
|
14
|
+
|
|
15
|
+
export interface SvedaStreamingStore {
|
|
16
|
+
currentChat: Ref<{
|
|
17
|
+
id: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
messages?: SvedaDisplayMessage[];
|
|
20
|
+
} | null>;
|
|
21
|
+
setChatMessages: (chatId: string, messages: SvedaDisplayMessage[]) => void;
|
|
22
|
+
setChatTitle: (chatId: string, title: string) => void;
|
|
23
|
+
refreshChatTitleFromServer: (chatId: string) => Promise<string | null>;
|
|
24
|
+
incrementChatTokens: (chatId: string, tokens: number) => void;
|
|
25
|
+
setChatContextWindowTokens: (chatId: string, tokens: number) => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface SvedaStreamingOptions {
|
|
29
|
+
newChatLabel?: () => string;
|
|
30
|
+
resolveSendOptions?: () => Pick<SvedaSendOptions, 'model' | 'provider' | 'options'>;
|
|
31
|
+
onMaxStepsReached?: (chatId: string, data: { maxSteps: number }) => void;
|
|
32
|
+
onToolProgress?: (chatId: string, event: SvedaToolProgressEvent) => void;
|
|
33
|
+
onContextUsage?: (chatId: string, event: SvedaContextUsageEvent) => void;
|
|
34
|
+
onError?: (chatId: string, error: unknown) => void;
|
|
35
|
+
onDone?: (chatId: string) => void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type SvedaSendPayload =
|
|
39
|
+
| string
|
|
40
|
+
| {
|
|
41
|
+
displayText: string;
|
|
42
|
+
promptText: string;
|
|
43
|
+
attachmentNames?: string[];
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export function useSvedaStreaming(
|
|
47
|
+
store: SvedaStreamingStore,
|
|
48
|
+
scrollToBottom: (options?: { behavior?: string; onlyIfNearBottom?: boolean }) => void,
|
|
49
|
+
options: SvedaStreamingOptions = {}
|
|
50
|
+
) {
|
|
51
|
+
const t = useSvedaT();
|
|
52
|
+
const client = inject(SvedaClientKey, null) as SvedaClient | null;
|
|
53
|
+
if (!client) {
|
|
54
|
+
throw new Error('[sveda] useSvedaStreaming requires the Sveda plugin to be installed.');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const isThinking = ref(false);
|
|
58
|
+
const thinkingMessage = ref('');
|
|
59
|
+
const streamingChatIds = ref(new Set<string>());
|
|
60
|
+
const unreadChatIds = ref(new Set<string>());
|
|
61
|
+
const statusByChatId = ref<Record<string, SvedaSessionStatus>>({});
|
|
62
|
+
|
|
63
|
+
const subscriptions = new Map<string, Array<() => void>>();
|
|
64
|
+
const displayTextOverrides = new Map<string, Map<string, string>>();
|
|
65
|
+
|
|
66
|
+
const setChatStreaming = (chatId: string, streaming: boolean) => {
|
|
67
|
+
const next = new Set(streamingChatIds.value);
|
|
68
|
+
if (streaming) {
|
|
69
|
+
next.add(chatId);
|
|
70
|
+
} else {
|
|
71
|
+
next.delete(chatId);
|
|
72
|
+
}
|
|
73
|
+
streamingChatIds.value = next;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const clearChatUnread = (chatId?: string | null) => {
|
|
77
|
+
if (!chatId) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const next = new Set(unreadChatIds.value);
|
|
81
|
+
next.delete(chatId);
|
|
82
|
+
unreadChatIds.value = next;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const resolveNewChatLabel = () => {
|
|
86
|
+
if (typeof options.newChatLabel === 'function') {
|
|
87
|
+
return options.newChatLabel();
|
|
88
|
+
}
|
|
89
|
+
return t('newChat');
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const applyProvisionalChatTitle = (chatId: string, userRequest: string) => {
|
|
93
|
+
if (!store.currentChat.value || store.currentChat.value.id !== chatId) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const newChatLabel = resolveNewChatLabel();
|
|
98
|
+
if (!isChatTitlePlaceholder((store.currentChat.value.title || '').trim(), newChatLabel)) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const provisionalTitle = deriveProvisionalChatTitle(userRequest);
|
|
103
|
+
if (provisionalTitle) {
|
|
104
|
+
store.setChatTitle(chatId, provisionalTitle);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const scheduleChatTitleRefresh = (chatId: string) => {
|
|
109
|
+
const newChatLabel = resolveNewChatLabel();
|
|
110
|
+
const delays = [800, 2500, 6000];
|
|
111
|
+
|
|
112
|
+
delays.forEach(delay => {
|
|
113
|
+
setTimeout(async () => {
|
|
114
|
+
const title = await store.refreshChatTitleFromServer(chatId);
|
|
115
|
+
if (!title || isChatTitlePlaceholder(title, newChatLabel)) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
store.setChatTitle(chatId, title);
|
|
119
|
+
}, delay);
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const setChatStatus = (chatId: string, status: SvedaSessionStatus) => {
|
|
124
|
+
const previous = statusByChatId.value[chatId];
|
|
125
|
+
statusByChatId.value = {
|
|
126
|
+
...statusByChatId.value,
|
|
127
|
+
[chatId]: status,
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const wasStreaming = previous === 'streaming' || previous === 'submitted';
|
|
131
|
+
const isStreamingNow = status === 'streaming' || status === 'submitted';
|
|
132
|
+
setChatStreaming(chatId, isStreamingNow);
|
|
133
|
+
|
|
134
|
+
if (wasStreaming && !isStreamingNow && store.currentChat.value?.id !== chatId) {
|
|
135
|
+
const next = new Set(unreadChatIds.value);
|
|
136
|
+
next.add(chatId);
|
|
137
|
+
unreadChatIds.value = next;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (isStreamingNow) {
|
|
141
|
+
clearChatUnread(chatId);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const applyDisplayOverrides = (
|
|
146
|
+
chatId: string,
|
|
147
|
+
messages: SvedaDisplayMessage[]
|
|
148
|
+
): SvedaDisplayMessage[] => {
|
|
149
|
+
const overrides = displayTextOverrides.get(chatId);
|
|
150
|
+
if (!overrides || overrides.size === 0) {
|
|
151
|
+
return messages;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return messages.map(message => {
|
|
155
|
+
const override = overrides.get(message.id);
|
|
156
|
+
if (override === undefined || message.role !== 'user') {
|
|
157
|
+
return message;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const fileParts = message.parts.filter(part => part.type === 'file');
|
|
161
|
+
const parts: SvedaMessagePart[] = [
|
|
162
|
+
...(override ? [{ type: 'text', text: override } as SvedaMessagePart] : []),
|
|
163
|
+
...fileParts,
|
|
164
|
+
];
|
|
165
|
+
|
|
166
|
+
return { ...message, parts };
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const ensureSession = (chatId: string): SvedaChatSession => {
|
|
171
|
+
const session = client.session(chatId);
|
|
172
|
+
if (subscriptions.has(chatId)) {
|
|
173
|
+
return session;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const offMessages = session.on('messages', () => {
|
|
177
|
+
store.setChatMessages(chatId, applyDisplayOverrides(chatId, session.messages));
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
const offStatus = session.on('status', payload => {
|
|
181
|
+
setChatStatus(chatId, payload as SvedaSessionStatus);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
const offTitle = session.on('title', payload => {
|
|
185
|
+
if (typeof payload === 'string' && payload.trim()) {
|
|
186
|
+
store.setChatTitle(chatId, payload);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
const offMaxSteps = session.on('maxSteps', payload => {
|
|
191
|
+
const event = payload as SvedaMaxStepsEvent | undefined;
|
|
192
|
+
options.onMaxStepsReached?.(chatId, {
|
|
193
|
+
maxSteps: typeof event?.maxSteps === 'number' ? event.maxSteps : 0,
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
const offContextUsage = session.on('contextUsage', payload => {
|
|
198
|
+
const event = payload as SvedaContextUsageEvent | undefined;
|
|
199
|
+
if (event && typeof event.usedTokens === 'number') {
|
|
200
|
+
store.setChatContextWindowTokens(chatId, event.usedTokens);
|
|
201
|
+
}
|
|
202
|
+
if (event) {
|
|
203
|
+
options.onContextUsage?.(chatId, event);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
const offToolProgress = session.on('toolProgress', payload => {
|
|
208
|
+
options.onToolProgress?.(chatId, payload as SvedaToolProgressEvent);
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
const offFinish = session.on('finish', payload => {
|
|
212
|
+
const event = payload as
|
|
213
|
+
| { usage?: { totalTokens?: number; promptTokens?: number } }
|
|
214
|
+
| undefined;
|
|
215
|
+
if (event?.usage) {
|
|
216
|
+
if (typeof event.usage.totalTokens === 'number') {
|
|
217
|
+
store.incrementChatTokens(chatId, event.usage.totalTokens);
|
|
218
|
+
}
|
|
219
|
+
if (typeof event.usage.promptTokens === 'number') {
|
|
220
|
+
store.setChatContextWindowTokens(chatId, event.usage.promptTokens);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
void nextTick(() => {
|
|
224
|
+
options.onDone?.(chatId);
|
|
225
|
+
scheduleChatTitleRefresh(chatId);
|
|
226
|
+
if (store.currentChat.value?.id === chatId) {
|
|
227
|
+
scrollToBottom();
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
const offError = session.on('error', payload => {
|
|
233
|
+
options.onError?.(chatId, payload);
|
|
234
|
+
void nextTick(() => {
|
|
235
|
+
options.onDone?.(chatId);
|
|
236
|
+
if (store.currentChat.value?.id === chatId) {
|
|
237
|
+
scrollToBottom();
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
subscriptions.set(chatId, [
|
|
243
|
+
offMessages,
|
|
244
|
+
offStatus,
|
|
245
|
+
offTitle,
|
|
246
|
+
offMaxSteps,
|
|
247
|
+
offContextUsage,
|
|
248
|
+
offToolProgress,
|
|
249
|
+
offFinish,
|
|
250
|
+
offError,
|
|
251
|
+
]);
|
|
252
|
+
setChatStatus(chatId, session.status);
|
|
253
|
+
|
|
254
|
+
return session;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
watch(
|
|
258
|
+
() => store.currentChat.value?.id,
|
|
259
|
+
(newId, oldId) => {
|
|
260
|
+
if (!newId || newId === oldId || !subscriptions.has(newId)) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const session = client.session(newId);
|
|
265
|
+
if (session.isStreaming) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
session.setMessages(store.currentChat.value?.messages ?? []);
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
|
|
273
|
+
watch(
|
|
274
|
+
() => statusByChatId.value[store.currentChat.value?.id ?? ''],
|
|
275
|
+
status => {
|
|
276
|
+
if (status === 'streaming' || status === 'submitted') {
|
|
277
|
+
isThinking.value = true;
|
|
278
|
+
thinkingMessage.value = t('analyzingRequest');
|
|
279
|
+
} else {
|
|
280
|
+
isThinking.value = false;
|
|
281
|
+
thinkingMessage.value = '';
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
{ immediate: true }
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
const isStreaming = computed(() =>
|
|
288
|
+
streamingChatIds.value.has(store.currentChat.value?.id ?? '')
|
|
289
|
+
);
|
|
290
|
+
|
|
291
|
+
const stopStreaming = (chatId: string | null | undefined = store.currentChat.value?.id) => {
|
|
292
|
+
if (!chatId || !subscriptions.has(chatId)) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
client.session(chatId).stop();
|
|
296
|
+
setChatStreaming(chatId, false);
|
|
297
|
+
isThinking.value = false;
|
|
298
|
+
thinkingMessage.value = '';
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
const resolveSendOptions = (): SvedaSendOptions => ({
|
|
302
|
+
...(options.resolveSendOptions?.() ?? {}),
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
const sendMessage = async (
|
|
306
|
+
userPayload: SvedaSendPayload,
|
|
307
|
+
pageContext: Record<string, unknown> = {}
|
|
308
|
+
) => {
|
|
309
|
+
let displayText = '';
|
|
310
|
+
let promptText = '';
|
|
311
|
+
let attachmentNames: string[] = [];
|
|
312
|
+
|
|
313
|
+
if (typeof userPayload === 'string') {
|
|
314
|
+
displayText = userPayload.trim();
|
|
315
|
+
promptText = displayText;
|
|
316
|
+
} else if (userPayload && typeof userPayload === 'object') {
|
|
317
|
+
displayText = String(userPayload.displayText ?? '').trim();
|
|
318
|
+
promptText = String(userPayload.promptText ?? '').trim();
|
|
319
|
+
attachmentNames = Array.isArray(userPayload.attachmentNames)
|
|
320
|
+
? userPayload.attachmentNames.map(name => String(name).trim()).filter(Boolean)
|
|
321
|
+
: [];
|
|
322
|
+
} else {
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (!promptText || !store.currentChat.value) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
const chatId = store.currentChat.value.id;
|
|
331
|
+
applyProvisionalChatTitle(chatId, promptText || displayText);
|
|
332
|
+
const session = ensureSession(chatId);
|
|
333
|
+
session.setMessages(store.currentChat.value.messages ?? []);
|
|
334
|
+
|
|
335
|
+
const sendOptions: SvedaSendOptions = {
|
|
336
|
+
...resolveSendOptions(),
|
|
337
|
+
context: { ...pageContext },
|
|
338
|
+
...(attachmentNames.length > 0
|
|
339
|
+
? { files: attachmentNames.map(name => ({ name })) }
|
|
340
|
+
: {}),
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
const sendPromise = session.send(promptText, sendOptions);
|
|
344
|
+
|
|
345
|
+
if (displayText !== promptText) {
|
|
346
|
+
const userMessage = [...session.messages].reverse().find(message => message.role === 'user');
|
|
347
|
+
if (userMessage) {
|
|
348
|
+
if (!displayTextOverrides.has(chatId)) {
|
|
349
|
+
displayTextOverrides.set(chatId, new Map());
|
|
350
|
+
}
|
|
351
|
+
displayTextOverrides.get(chatId)!.set(userMessage.id, displayText);
|
|
352
|
+
store.setChatMessages(chatId, applyDisplayOverrides(chatId, session.messages));
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
try {
|
|
357
|
+
await sendPromise;
|
|
358
|
+
} catch {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
scrollToBottom();
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
const continueAfterMaxSteps = async (pageContext: Record<string, unknown> = {}) => {
|
|
366
|
+
const chatId = store.currentChat.value?.id;
|
|
367
|
+
if (!chatId) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
const session = ensureSession(chatId);
|
|
372
|
+
if (session.messages.length === 0) {
|
|
373
|
+
session.setMessages(store.currentChat.value?.messages ?? []);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
try {
|
|
377
|
+
await session.continueAfterMaxSteps({
|
|
378
|
+
...resolveSendOptions(),
|
|
379
|
+
context: { ...pageContext },
|
|
380
|
+
});
|
|
381
|
+
} catch {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
scrollToBottom();
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
onUnmounted(() => {
|
|
389
|
+
for (const [chatId, unsubscribes] of subscriptions.entries()) {
|
|
390
|
+
client.session(chatId).stop();
|
|
391
|
+
unsubscribes.forEach(off => off());
|
|
392
|
+
}
|
|
393
|
+
subscriptions.clear();
|
|
394
|
+
displayTextOverrides.clear();
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
return {
|
|
398
|
+
sendMessage,
|
|
399
|
+
continueAfterMaxSteps,
|
|
400
|
+
isStreaming,
|
|
401
|
+
isThinking,
|
|
402
|
+
thinkingMessage,
|
|
403
|
+
stopStreaming,
|
|
404
|
+
streamingChatIds,
|
|
405
|
+
unreadChatIds,
|
|
406
|
+
clearChatUnread,
|
|
407
|
+
};
|
|
408
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SvedaFrontendTool } from '@sveda-ai/core';
|
|
2
|
+
import { inject, onUnmounted } from 'vue';
|
|
3
|
+
import { SvedaClientKey } from '../plugin';
|
|
4
|
+
|
|
5
|
+
export type UseSvedaToolOptions = SvedaFrontendTool;
|
|
6
|
+
|
|
7
|
+
export function useSvedaTool(tool: UseSvedaToolOptions): void {
|
|
8
|
+
const client = inject(SvedaClientKey, null);
|
|
9
|
+
if (!client) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const unregister = client.toolRegistry.register(tool);
|
|
14
|
+
|
|
15
|
+
onUnmounted(() => {
|
|
16
|
+
unregister();
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { inject, reactive, type App, type InjectionKey } from 'vue';
|
|
2
|
+
|
|
3
|
+
export type SvedaMessages = Record<string, string>;
|
|
4
|
+
|
|
5
|
+
export interface SvedaI18n {
|
|
6
|
+
readonly locale: string;
|
|
7
|
+
t(key: string, params?: Record<string, unknown>): string;
|
|
8
|
+
setLocale(locale: string): void;
|
|
9
|
+
extend(locale: string, messages: SvedaMessages): void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface SvedaI18nOptions {
|
|
13
|
+
locale?: string;
|
|
14
|
+
fallbackLocale?: string;
|
|
15
|
+
messages?: Record<string, SvedaMessages>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const SvedaI18nKey: InjectionKey<SvedaI18n> = Symbol('sveda-i18n');
|
|
19
|
+
|
|
20
|
+
export function createSvedaI18n(options: SvedaI18nOptions = {}): SvedaI18n {
|
|
21
|
+
const state = reactive({
|
|
22
|
+
locale: options.locale ?? 'en',
|
|
23
|
+
fallbackLocale: options.fallbackLocale ?? 'en',
|
|
24
|
+
messages: { ...(options.messages ?? {}) } as Record<string, SvedaMessages>,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const interpolate = (template: string, params?: Record<string, unknown>): string => {
|
|
28
|
+
if (!params) {
|
|
29
|
+
return template;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return template.replace(/\{(\w+)\}/g, (match, name: string) =>
|
|
33
|
+
params[name] === undefined || params[name] === null ? match : String(params[name])
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
get locale() {
|
|
39
|
+
return state.locale;
|
|
40
|
+
},
|
|
41
|
+
t(key: string, params?: Record<string, unknown>): string {
|
|
42
|
+
const message =
|
|
43
|
+
state.messages[state.locale]?.[key] ?? state.messages[state.fallbackLocale]?.[key];
|
|
44
|
+
|
|
45
|
+
if (message === undefined) {
|
|
46
|
+
return key;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return interpolate(message, params);
|
|
50
|
+
},
|
|
51
|
+
setLocale(locale: string): void {
|
|
52
|
+
state.locale = locale;
|
|
53
|
+
},
|
|
54
|
+
extend(locale: string, messages: SvedaMessages): void {
|
|
55
|
+
state.messages[locale] = { ...(state.messages[locale] ?? {}), ...messages };
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function installSvedaI18n(app: App, i18n: SvedaI18n): void {
|
|
61
|
+
app.provide(SvedaI18nKey, i18n);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function useSvedaT(): (key: string, params?: Record<string, unknown>) => string {
|
|
65
|
+
const i18n = inject(SvedaI18nKey);
|
|
66
|
+
|
|
67
|
+
if (!i18n) {
|
|
68
|
+
return (key: string) => key;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return (key, params) => i18n.t(key, params);
|
|
72
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { SvedaMessages } from '../index';
|
|
2
|
+
|
|
3
|
+
const en: SvedaMessages = {
|
|
4
|
+
chatTitle: 'AI Assistant',
|
|
5
|
+
welcomeMessage: "Hi! I'm your AI assistant. How can I help you today?",
|
|
6
|
+
newChat: 'New Chat',
|
|
7
|
+
newChatNumbered: 'New Chat {number}',
|
|
8
|
+
chatHistory: 'Chat History',
|
|
9
|
+
closeChatTab: 'Close chat tab',
|
|
10
|
+
chatTabRunning: 'Agent is working',
|
|
11
|
+
chatTabUnread: 'New response ready',
|
|
12
|
+
quickPromptsTitle: 'Ask me anything',
|
|
13
|
+
confirmDeleteChat: 'Are you sure you want to delete this chat?',
|
|
14
|
+
renameChat: 'Rename chat',
|
|
15
|
+
renameChatPlaceholder: 'Enter chat name',
|
|
16
|
+
analyzingRequest: 'Analyzing your request...',
|
|
17
|
+
errorSendingMessage: 'Failed to send message. Please try again.',
|
|
18
|
+
agentFinishedNotice: 'Agent finished',
|
|
19
|
+
maxStepsReachedNotice:
|
|
20
|
+
'The agent reached the step limit for this request ({limit}). Press Continue to resume in this chat.',
|
|
21
|
+
maxStepsContinue: 'Continue',
|
|
22
|
+
maxStepsContinuePrompt:
|
|
23
|
+
'Continue from where you stopped. Briefly summarize what you already found, then keep working on the task.',
|
|
24
|
+
viewModeFixed: 'Switch to fixed view',
|
|
25
|
+
viewModeFloating: 'Switch to floating view',
|
|
26
|
+
immersiveModeEnter: 'Immersive mode',
|
|
27
|
+
immersiveModeExit: 'Exit immersive mode',
|
|
28
|
+
toolbarMinimize: 'Minimize',
|
|
29
|
+
modelSelectPlaceholder: 'Model',
|
|
30
|
+
thinkingTooltip:
|
|
31
|
+
'Chain-of-thought reasoning before the answer. Improves accuracy; responses may take longer.',
|
|
32
|
+
assistantLogoAlt: 'AI assistant',
|
|
33
|
+
contextWindowUsage: 'Context window usage',
|
|
34
|
+
contextWindowPercent: 'Used: {percent}%',
|
|
35
|
+
chatDocumentsExtracting: 'Extracting text from documents…',
|
|
36
|
+
chatDocumentsHeader: 'Attached document content:',
|
|
37
|
+
chatDocumentTruncatedNotice: '[Truncated: reached extracted-text limit for this message.]',
|
|
38
|
+
chatDocumentErrorReadFailed: 'Could not read the file.',
|
|
39
|
+
chatDocumentErrorEmpty: 'Could not extract text from the file.',
|
|
40
|
+
chatDocumentErrorQuotaExceeded: '[Skipped: overall extracted-text limit reached.]',
|
|
41
|
+
chatDocumentErrorUnknown: 'Could not extract text from this file.',
|
|
42
|
+
chatDocumentsExtractFailed: 'Could not process attachments. Please try again.',
|
|
43
|
+
chatAttachmentOnlyPlaceholder: 'Documents: {names}',
|
|
44
|
+
agentTasksTitle: 'Parallel agents',
|
|
45
|
+
agentTasksSpawnPhase: 'Batch agent run',
|
|
46
|
+
phaseSearchSubagents: 'Search scouts',
|
|
47
|
+
phaseToolCalling: 'Using tools',
|
|
48
|
+
agentTaskStatusPending: 'Pending',
|
|
49
|
+
agentTaskStatusRunning: 'Running',
|
|
50
|
+
agentTaskStatusCompleted: 'Done',
|
|
51
|
+
agentTaskStatusFailed: 'Error',
|
|
52
|
+
commonDelete: 'Delete',
|
|
53
|
+
commonCancel: 'Cancel',
|
|
54
|
+
commonSave: 'Save',
|
|
55
|
+
commonError: 'Error',
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default en;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { SvedaMessages } from '../index';
|
|
2
|
+
|
|
3
|
+
const ru: SvedaMessages = {
|
|
4
|
+
chatTitle: 'AI Ассистент',
|
|
5
|
+
welcomeMessage: 'Привет! Я ваш AI-ассистент. Чем могу помочь?',
|
|
6
|
+
newChat: 'Новый чат',
|
|
7
|
+
newChatNumbered: 'Новый чат {number}',
|
|
8
|
+
chatHistory: 'История чатов',
|
|
9
|
+
closeChatTab: 'Закрыть вкладку чата',
|
|
10
|
+
chatTabRunning: 'Агент работает',
|
|
11
|
+
chatTabUnread: 'Есть новый ответ',
|
|
12
|
+
quickPromptsTitle: 'Спросите меня о чём угодно',
|
|
13
|
+
confirmDeleteChat: 'Вы уверены, что хотите удалить этот чат?',
|
|
14
|
+
renameChat: 'Переименовать чат',
|
|
15
|
+
renameChatPlaceholder: 'Введите название чата',
|
|
16
|
+
analyzingRequest: 'Анализирую ваш запрос...',
|
|
17
|
+
errorSendingMessage: 'Не удалось отправить сообщение. Попробуйте ещё раз.',
|
|
18
|
+
agentFinishedNotice: 'Агент закончил работу',
|
|
19
|
+
maxStepsReachedNotice:
|
|
20
|
+
'Агент достиг лимита шагов за этот запрос ({limit}). Нажмите «Продолжить», чтобы продолжить в этом чате.',
|
|
21
|
+
maxStepsContinue: 'Продолжить',
|
|
22
|
+
maxStepsContinuePrompt:
|
|
23
|
+
'Продолжи с того места, где остановился. Кратко резюмируй, что уже выяснил, и продолжай задачу.',
|
|
24
|
+
viewModeFixed: 'Переключить на фиксированный вид',
|
|
25
|
+
viewModeFloating: 'Переключить на плавающий вид',
|
|
26
|
+
immersiveModeEnter: 'Иммерсивный режим',
|
|
27
|
+
immersiveModeExit: 'Выйти из иммерсивного режима',
|
|
28
|
+
toolbarMinimize: 'Свернуть',
|
|
29
|
+
modelSelectPlaceholder: 'Модель',
|
|
30
|
+
thinkingTooltip:
|
|
31
|
+
'Пошаговое рассуждение перед ответом. Повышает точность, но ответ может занять больше времени.',
|
|
32
|
+
assistantLogoAlt: 'AI ассистент',
|
|
33
|
+
contextWindowUsage: 'Использование контекстного окна',
|
|
34
|
+
contextWindowPercent: 'Использовано: {percent}%',
|
|
35
|
+
chatDocumentsExtracting: 'Извлекаем текст из документов…',
|
|
36
|
+
chatDocumentsHeader: 'Содержимое вложённых документов:',
|
|
37
|
+
chatDocumentTruncatedNotice: '[Текст усечён: достигнут лимит символов для сообщения.]',
|
|
38
|
+
chatDocumentErrorReadFailed: 'Не удалось прочитать файл.',
|
|
39
|
+
chatDocumentErrorEmpty: 'Текст из файла извлечь не удалось.',
|
|
40
|
+
chatDocumentErrorQuotaExceeded:
|
|
41
|
+
'[Файл пропущен: превышен общий лимит объёма извлекаемого текста.]',
|
|
42
|
+
chatDocumentErrorUnknown: 'Не удалось извлечь текст из файла.',
|
|
43
|
+
chatDocumentsExtractFailed: 'Не удалось распознать вложения. Попробуйте ещё раз.',
|
|
44
|
+
chatAttachmentOnlyPlaceholder: 'Документы: {names}',
|
|
45
|
+
agentTasksTitle: 'Параллельные агенты',
|
|
46
|
+
agentTasksSpawnPhase: 'Пакетный запуск агентов',
|
|
47
|
+
phaseSearchSubagents: 'Поисковые скауты',
|
|
48
|
+
phaseToolCalling: 'Вызов инструментов',
|
|
49
|
+
agentTaskStatusPending: 'Ожидание',
|
|
50
|
+
agentTaskStatusRunning: 'Выполняется',
|
|
51
|
+
agentTaskStatusCompleted: 'Готово',
|
|
52
|
+
agentTaskStatusFailed: 'Ошибка',
|
|
53
|
+
commonDelete: 'Удалить',
|
|
54
|
+
commonCancel: 'Отмена',
|
|
55
|
+
commonSave: 'Сохранить',
|
|
56
|
+
commonError: 'Ошибка',
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default ru;
|