@meistrari/chat-nuxt 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/README.md +274 -0
- package/dist/module.d.mts +3 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +250 -0
- package/dist/runtime/assets/css/code-theme.css +1 -0
- package/dist/runtime/assets/css/markstream.css +1 -0
- package/dist/runtime/components/AppStatusToast.d.vue.ts +3 -0
- package/dist/runtime/components/AppStatusToast.vue +42 -0
- package/dist/runtime/components/AppStatusToast.vue.d.ts +3 -0
- package/dist/runtime/components/TelaChat.d.vue.ts +19 -0
- package/dist/runtime/components/TelaChat.vue +25 -0
- package/dist/runtime/components/TelaChat.vue.d.ts +19 -0
- package/dist/runtime/components/app-markdown-render.d.vue.ts +15 -0
- package/dist/runtime/components/app-markdown-render.vue +45 -0
- package/dist/runtime/components/app-markdown-render.vue.d.ts +15 -0
- package/dist/runtime/components/application-card.d.vue.ts +9 -0
- package/dist/runtime/components/application-card.vue +52 -0
- package/dist/runtime/components/application-card.vue.d.ts +9 -0
- package/dist/runtime/components/audio-preview.d.vue.ts +14 -0
- package/dist/runtime/components/audio-preview.vue +52 -0
- package/dist/runtime/components/audio-preview.vue.d.ts +14 -0
- package/dist/runtime/components/chat/bash-widget.d.vue.ts +9 -0
- package/dist/runtime/components/chat/bash-widget.vue +86 -0
- package/dist/runtime/components/chat/bash-widget.vue.d.ts +9 -0
- package/dist/runtime/components/chat/canvas-selector-modal.d.vue.ts +14 -0
- package/dist/runtime/components/chat/canvas-selector-modal.vue +290 -0
- package/dist/runtime/components/chat/canvas-selector-modal.vue.d.ts +14 -0
- package/dist/runtime/components/chat/context-config.d.vue.ts +30 -0
- package/dist/runtime/components/chat/context-config.vue +423 -0
- package/dist/runtime/components/chat/context-config.vue.d.ts +30 -0
- package/dist/runtime/components/chat/conversation-item.d.vue.ts +20 -0
- package/dist/runtime/components/chat/conversation-item.vue +184 -0
- package/dist/runtime/components/chat/conversation-item.vue.d.ts +20 -0
- package/dist/runtime/components/chat/conversation-list.d.vue.ts +10 -0
- package/dist/runtime/components/chat/conversation-list.vue +78 -0
- package/dist/runtime/components/chat/conversation-list.vue.d.ts +10 -0
- package/dist/runtime/components/chat/doc-sdk-widget.d.vue.ts +9 -0
- package/dist/runtime/components/chat/doc-sdk-widget.vue +74 -0
- package/dist/runtime/components/chat/doc-sdk-widget.vue.d.ts +9 -0
- package/dist/runtime/components/chat/file-preview.d.vue.ts +7 -0
- package/dist/runtime/components/chat/file-preview.vue +313 -0
- package/dist/runtime/components/chat/file-preview.vue.d.ts +7 -0
- package/dist/runtime/components/chat/files-view.d.vue.ts +6 -0
- package/dist/runtime/components/chat/files-view.vue +399 -0
- package/dist/runtime/components/chat/files-view.vue.d.ts +6 -0
- package/dist/runtime/components/chat/generic-tool-widget.d.vue.ts +9 -0
- package/dist/runtime/components/chat/generic-tool-widget.vue +334 -0
- package/dist/runtime/components/chat/generic-tool-widget.vue.d.ts +9 -0
- package/dist/runtime/components/chat/grep-widget.d.vue.ts +9 -0
- package/dist/runtime/components/chat/grep-widget.vue +259 -0
- package/dist/runtime/components/chat/grep-widget.vue.d.ts +9 -0
- package/dist/runtime/components/chat/mention-dropdown.d.vue.ts +14 -0
- package/dist/runtime/components/chat/mention-dropdown.vue +90 -0
- package/dist/runtime/components/chat/mention-dropdown.vue.d.ts +14 -0
- package/dist/runtime/components/chat/message-bubble.d.vue.ts +11 -0
- package/dist/runtime/components/chat/message-bubble.vue +288 -0
- package/dist/runtime/components/chat/message-bubble.vue.d.ts +11 -0
- package/dist/runtime/components/chat/message-input.d.vue.ts +34 -0
- package/dist/runtime/components/chat/message-input.vue +428 -0
- package/dist/runtime/components/chat/message-input.vue.d.ts +34 -0
- package/dist/runtime/components/chat/message-list.d.vue.ts +11 -0
- package/dist/runtime/components/chat/message-list.vue +36 -0
- package/dist/runtime/components/chat/message-list.vue.d.ts +11 -0
- package/dist/runtime/components/chat/model-selector.d.vue.ts +15 -0
- package/dist/runtime/components/chat/model-selector.vue +35 -0
- package/dist/runtime/components/chat/model-selector.vue.d.ts +15 -0
- package/dist/runtime/components/chat/new-conversation-modal.d.vue.ts +14 -0
- package/dist/runtime/components/chat/new-conversation-modal.vue +271 -0
- package/dist/runtime/components/chat/new-conversation-modal.vue.d.ts +14 -0
- package/dist/runtime/components/chat/read-widget.d.vue.ts +9 -0
- package/dist/runtime/components/chat/read-widget.vue +195 -0
- package/dist/runtime/components/chat/read-widget.vue.d.ts +9 -0
- package/dist/runtime/components/chat/reasoning-message.d.vue.ts +13 -0
- package/dist/runtime/components/chat/reasoning-message.vue +341 -0
- package/dist/runtime/components/chat/reasoning-message.vue.d.ts +13 -0
- package/dist/runtime/components/chat/reasoning-step-item.d.vue.ts +37 -0
- package/dist/runtime/components/chat/reasoning-step-item.vue +125 -0
- package/dist/runtime/components/chat/reasoning-step-item.vue.d.ts +37 -0
- package/dist/runtime/components/chat/reasoning-steps.d.vue.ts +12 -0
- package/dist/runtime/components/chat/reasoning-steps.vue +47 -0
- package/dist/runtime/components/chat/reasoning-steps.vue.d.ts +12 -0
- package/dist/runtime/components/chat/reasoning-thought.d.vue.ts +11 -0
- package/dist/runtime/components/chat/reasoning-thought.vue +287 -0
- package/dist/runtime/components/chat/reasoning-thought.vue.d.ts +11 -0
- package/dist/runtime/components/chat/tela-skill-widget.d.vue.ts +9 -0
- package/dist/runtime/components/chat/tela-skill-widget.vue +94 -0
- package/dist/runtime/components/chat/tela-skill-widget.vue.d.ts +9 -0
- package/dist/runtime/components/chat/thinking-indicator.d.vue.ts +3 -0
- package/dist/runtime/components/chat/thinking-indicator.vue +52 -0
- package/dist/runtime/components/chat/thinking-indicator.vue.d.ts +3 -0
- package/dist/runtime/components/chat/thinking-widget.d.vue.ts +8 -0
- package/dist/runtime/components/chat/thinking-widget.vue +53 -0
- package/dist/runtime/components/chat/thinking-widget.vue.d.ts +8 -0
- package/dist/runtime/components/chat/topbar.d.vue.ts +43 -0
- package/dist/runtime/components/chat/topbar.vue +223 -0
- package/dist/runtime/components/chat/topbar.vue.d.ts +43 -0
- package/dist/runtime/components/chat/usage-view.d.vue.ts +8 -0
- package/dist/runtime/components/chat/usage-view.vue +393 -0
- package/dist/runtime/components/chat/usage-view.vue.d.ts +8 -0
- package/dist/runtime/components/chat/vault-link.d.vue.ts +20 -0
- package/dist/runtime/components/chat/vault-link.vue +34 -0
- package/dist/runtime/components/chat/vault-link.vue.d.ts +20 -0
- package/dist/runtime/components/chat/web-search-widget.d.vue.ts +9 -0
- package/dist/runtime/components/chat/web-search-widget.vue +121 -0
- package/dist/runtime/components/chat/web-search-widget.vue.d.ts +9 -0
- package/dist/runtime/components/chat/workstation-query-widget.d.vue.ts +10 -0
- package/dist/runtime/components/chat/workstation-query-widget.vue +552 -0
- package/dist/runtime/components/chat/workstation-query-widget.vue.d.ts +10 -0
- package/dist/runtime/components/chat/workstation-selector-modal.d.vue.ts +14 -0
- package/dist/runtime/components/chat/workstation-selector-modal.vue +272 -0
- package/dist/runtime/components/chat/workstation-selector-modal.vue.d.ts +14 -0
- package/dist/runtime/components/chat/write-widget.d.vue.ts +9 -0
- package/dist/runtime/components/chat/write-widget.vue +165 -0
- package/dist/runtime/components/chat/write-widget.vue.d.ts +9 -0
- package/dist/runtime/components/conversation-files-panel.d.vue.ts +3 -0
- package/dist/runtime/components/conversation-files-panel.vue +252 -0
- package/dist/runtime/components/conversation-files-panel.vue.d.ts +3 -0
- package/dist/runtime/components/csv-preview.d.vue.ts +20 -0
- package/dist/runtime/components/csv-preview.vue +157 -0
- package/dist/runtime/components/csv-preview.vue.d.ts +20 -0
- package/dist/runtime/components/file-preview-panel.d.vue.ts +3 -0
- package/dist/runtime/components/file-preview-panel.vue +185 -0
- package/dist/runtime/components/file-preview-panel.vue.d.ts +3 -0
- package/dist/runtime/components/file-uploader.d.vue.ts +16 -0
- package/dist/runtime/components/file-uploader.vue +136 -0
- package/dist/runtime/components/file-uploader.vue.d.ts +16 -0
- package/dist/runtime/components/icons/anthropic.d.vue.ts +3 -0
- package/dist/runtime/components/icons/anthropic.vue +5 -0
- package/dist/runtime/components/icons/anthropic.vue.d.ts +3 -0
- package/dist/runtime/components/image-preview.d.vue.ts +14 -0
- package/dist/runtime/components/image-preview.vue +54 -0
- package/dist/runtime/components/image-preview.vue.d.ts +14 -0
- package/dist/runtime/components/json-tree-node.d.vue.ts +9 -0
- package/dist/runtime/components/json-tree-node.vue +109 -0
- package/dist/runtime/components/json-tree-node.vue.d.ts +9 -0
- package/dist/runtime/components/json-viewer.d.vue.ts +6 -0
- package/dist/runtime/components/json-viewer.vue +88 -0
- package/dist/runtime/components/json-viewer.vue.d.ts +6 -0
- package/dist/runtime/components/pdf-preview.d.vue.ts +20 -0
- package/dist/runtime/components/pdf-preview.vue +89 -0
- package/dist/runtime/components/pdf-preview.vue.d.ts +20 -0
- package/dist/runtime/components/pdf-viewer.d.vue.ts +10 -0
- package/dist/runtime/components/pdf-viewer.vue +265 -0
- package/dist/runtime/components/pdf-viewer.vue.d.ts +10 -0
- package/dist/runtime/components/powered-by-tela.d.vue.ts +3 -0
- package/dist/runtime/components/powered-by-tela.vue +14 -0
- package/dist/runtime/components/powered-by-tela.vue.d.ts +3 -0
- package/dist/runtime/components/renderers/artifact-display.d.vue.ts +15 -0
- package/dist/runtime/components/renderers/artifact-display.vue +105 -0
- package/dist/runtime/components/renderers/artifact-display.vue.d.ts +15 -0
- package/dist/runtime/components/renderers/audio-renderer.d.vue.ts +7 -0
- package/dist/runtime/components/renderers/audio-renderer.vue +52 -0
- package/dist/runtime/components/renderers/audio-renderer.vue.d.ts +7 -0
- package/dist/runtime/components/renderers/csv-renderer.d.vue.ts +6 -0
- package/dist/runtime/components/renderers/csv-renderer.vue +203 -0
- package/dist/runtime/components/renderers/csv-renderer.vue.d.ts +6 -0
- package/dist/runtime/components/renderers/image-renderer.d.vue.ts +7 -0
- package/dist/runtime/components/renderers/image-renderer.vue +44 -0
- package/dist/runtime/components/renderers/image-renderer.vue.d.ts +7 -0
- package/dist/runtime/components/renderers/markdown-renderer.d.vue.ts +6 -0
- package/dist/runtime/components/renderers/markdown-renderer.vue +66 -0
- package/dist/runtime/components/renderers/markdown-renderer.vue.d.ts +6 -0
- package/dist/runtime/components/renderers/mermaid-diagram.d.vue.ts +7 -0
- package/dist/runtime/components/renderers/mermaid-diagram.vue +165 -0
- package/dist/runtime/components/renderers/mermaid-diagram.vue.d.ts +7 -0
- package/dist/runtime/components/renderers/text-renderer.d.vue.ts +7 -0
- package/dist/runtime/components/renderers/text-renderer.vue +70 -0
- package/dist/runtime/components/renderers/text-renderer.vue.d.ts +7 -0
- package/dist/runtime/components/renderers/video-renderer.d.vue.ts +6 -0
- package/dist/runtime/components/renderers/video-renderer.vue +43 -0
- package/dist/runtime/components/renderers/video-renderer.vue.d.ts +6 -0
- package/dist/runtime/components/text-preview.d.vue.ts +19 -0
- package/dist/runtime/components/text-preview.vue +105 -0
- package/dist/runtime/components/text-preview.vue.d.ts +19 -0
- package/dist/runtime/components/video-preview.d.vue.ts +14 -0
- package/dist/runtime/components/video-preview.vue +55 -0
- package/dist/runtime/components/video-preview.vue.d.ts +14 -0
- package/dist/runtime/composables/PageNavigation.d.ts +13 -0
- package/dist/runtime/composables/PageNavigation.js +18 -0
- package/dist/runtime/composables/useChat.d.ts +25 -0
- package/dist/runtime/composables/useChat.js +512 -0
- package/dist/runtime/composables/useChatApi.d.ts +6 -0
- package/dist/runtime/composables/useChatApi.js +28 -0
- package/dist/runtime/composables/useConversationFiles.d.ts +13 -0
- package/dist/runtime/composables/useConversationFiles.js +98 -0
- package/dist/runtime/composables/useConversationFilesPanel.d.ts +11 -0
- package/dist/runtime/composables/useConversationFilesPanel.js +35 -0
- package/dist/runtime/composables/useConversations.d.ts +15 -0
- package/dist/runtime/composables/useConversations.js +191 -0
- package/dist/runtime/composables/useDiagramExport.d.ts +11 -0
- package/dist/runtime/composables/useDiagramExport.js +186 -0
- package/dist/runtime/composables/useEmbedConfig.d.ts +13 -0
- package/dist/runtime/composables/useEmbedConfig.js +11 -0
- package/dist/runtime/composables/useFeatureFlags.d.ts +19 -0
- package/dist/runtime/composables/useFeatureFlags.js +67 -0
- package/dist/runtime/composables/useFileDrop.d.ts +17 -0
- package/dist/runtime/composables/useFileDrop.js +89 -0
- package/dist/runtime/composables/useFilePreviewPanel.d.ts +30 -0
- package/dist/runtime/composables/useFilePreviewPanel.js +42 -0
- package/dist/runtime/composables/useFileUpload.d.ts +7 -0
- package/dist/runtime/composables/useFileUpload.js +39 -0
- package/dist/runtime/composables/useGitHubSkills.d.ts +6 -0
- package/dist/runtime/composables/useGitHubSkills.js +68 -0
- package/dist/runtime/composables/useGitHubSkillsCallback.d.ts +5 -0
- package/dist/runtime/composables/useGitHubSkillsCallback.js +42 -0
- package/dist/runtime/composables/useIDB.d.ts +11 -0
- package/dist/runtime/composables/useIDB.js +57 -0
- package/dist/runtime/composables/useInputHistory.d.ts +7 -0
- package/dist/runtime/composables/useInputHistory.js +36 -0
- package/dist/runtime/composables/useKnowledgeSources.d.ts +6 -0
- package/dist/runtime/composables/useKnowledgeSources.js +15 -0
- package/dist/runtime/composables/useMediaCache.d.ts +13 -0
- package/dist/runtime/composables/useMediaCache.js +92 -0
- package/dist/runtime/composables/useMentionAutocomplete.d.ts +10 -0
- package/dist/runtime/composables/useMentionAutocomplete.js +272 -0
- package/dist/runtime/composables/useMermaidRenderer.d.ts +5 -0
- package/dist/runtime/composables/useMermaidRenderer.js +121 -0
- package/dist/runtime/composables/usePdf.d.ts +21 -0
- package/dist/runtime/composables/usePdf.js +138 -0
- package/dist/runtime/composables/usePolling.d.ts +12 -0
- package/dist/runtime/composables/usePolling.js +55 -0
- package/dist/runtime/composables/useSelectedModel.d.ts +4 -0
- package/dist/runtime/composables/useSelectedModel.js +46 -0
- package/dist/runtime/composables/useSplashScreen.d.ts +3 -0
- package/dist/runtime/composables/useSplashScreen.js +4 -0
- package/dist/runtime/composables/useStatusToast.d.ts +22 -0
- package/dist/runtime/composables/useStatusToast.js +40 -0
- package/dist/runtime/composables/useTela.d.ts +12 -0
- package/dist/runtime/composables/useTela.js +47 -0
- package/dist/runtime/composables/useToolFormatting.d.ts +5 -0
- package/dist/runtime/composables/useToolFormatting.js +61 -0
- package/dist/runtime/composables/useVault.d.ts +13 -0
- package/dist/runtime/composables/useVault.js +35 -0
- package/dist/runtime/composables/useVerbConjugation.d.ts +6 -0
- package/dist/runtime/composables/useVerbConjugation.js +256 -0
- package/dist/runtime/composables/useWorkspaceContextFiles.d.ts +19 -0
- package/dist/runtime/composables/useWorkspaceContextFiles.js +74 -0
- package/dist/runtime/composables/useWorkspaceCredentials.d.ts +34 -0
- package/dist/runtime/composables/useWorkspaceCredentials.js +175 -0
- package/dist/runtime/composables/useWorkspaceExternalSkills.d.ts +22 -0
- package/dist/runtime/composables/useWorkspaceExternalSkills.js +135 -0
- package/dist/runtime/composables/useWorkspaceKnowledgeSources.d.ts +11 -0
- package/dist/runtime/composables/useWorkspaceKnowledgeSources.js +88 -0
- package/dist/runtime/composables/useWorkspaceMembers.d.ts +13 -0
- package/dist/runtime/composables/useWorkspaceMembers.js +37 -0
- package/dist/runtime/composables/useWorkspacePersonalization.d.ts +6 -0
- package/dist/runtime/composables/useWorkspacePersonalization.js +19 -0
- package/dist/runtime/composables/useWorkspaceSettings.d.ts +30 -0
- package/dist/runtime/composables/useWorkspaceSettings.js +135 -0
- package/dist/runtime/composables/useWorkspaceTelaTools.d.ts +13 -0
- package/dist/runtime/composables/useWorkspaceTelaTools.js +91 -0
- package/dist/runtime/composables/useWorkspaces.d.ts +5 -0
- package/dist/runtime/composables/useWorkspaces.js +14 -0
- package/dist/runtime/composables/useZoomPan.d.ts +18 -0
- package/dist/runtime/composables/useZoomPan.js +130 -0
- package/dist/runtime/embed/components/ChatEmbed.d.vue.ts +23 -0
- package/dist/runtime/embed/components/ChatEmbed.vue +27 -0
- package/dist/runtime/embed/components/ChatEmbed.vue.d.ts +23 -0
- package/dist/runtime/embed/components/ChatEmbedInner.d.vue.ts +19 -0
- package/dist/runtime/embed/components/ChatEmbedInner.vue +604 -0
- package/dist/runtime/embed/components/ChatEmbedInner.vue.d.ts +19 -0
- package/dist/runtime/public/favicon.svg +4 -0
- package/dist/runtime/public/files/archive.svg +9 -0
- package/dist/runtime/public/files/audio.svg +4 -0
- package/dist/runtime/public/files/c.svg +4 -0
- package/dist/runtime/public/files/cpp.svg +6 -0
- package/dist/runtime/public/files/css.svg +4 -0
- package/dist/runtime/public/files/doc.svg +5 -0
- package/dist/runtime/public/files/generic.svg +7 -0
- package/dist/runtime/public/files/go.svg +6 -0
- package/dist/runtime/public/files/html.svg +4 -0
- package/dist/runtime/public/files/image.svg +3 -0
- package/dist/runtime/public/files/java.svg +7 -0
- package/dist/runtime/public/files/javascript.svg +4 -0
- package/dist/runtime/public/files/json.svg +5 -0
- package/dist/runtime/public/files/markdown.svg +5 -0
- package/dist/runtime/public/files/pdf.svg +5 -0
- package/dist/runtime/public/files/presentation.svg +5 -0
- package/dist/runtime/public/files/python.svg +5 -0
- package/dist/runtime/public/files/ruby.svg +5 -0
- package/dist/runtime/public/files/rust.svg +13 -0
- package/dist/runtime/public/files/sheet.svg +9 -0
- package/dist/runtime/public/files/shell.svg +5 -0
- package/dist/runtime/public/files/sql.svg +6 -0
- package/dist/runtime/public/files/typescript.svg +5 -0
- package/dist/runtime/public/files/video.svg +5 -0
- package/dist/runtime/public/files/yaml.svg +7 -0
- package/dist/runtime/public/github.svg +3 -0
- package/dist/runtime/public/robots.txt +1 -0
- package/dist/runtime/server/api/admin/trigger-usage-report.post.d.ts +2 -0
- package/dist/runtime/server/api/admin/trigger-usage-report.post.js +15 -0
- package/dist/runtime/server/api/chat/conversations/[id]/cancel.post.d.ts +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/cancel.post.js +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/clear.post.d.ts +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/clear.post.js +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/duplicate.post.d.ts +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/duplicate.post.js +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/files.get.d.ts +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/files.get.js +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/index.delete.d.ts +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/index.delete.js +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/index.get.d.ts +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/index.get.js +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/index.patch.d.ts +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/index.patch.js +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/messages/[messageId]/retry.post.d.ts +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/messages/[messageId]/retry.post.js +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/messages/index.get.d.ts +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/messages/index.get.js +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/messages/index.post.d.ts +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/messages/index.post.js +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/usage.get.d.ts +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/usage.get.js +1 -0
- package/dist/runtime/server/api/chat/conversations/generate-title.post.d.ts +1 -0
- package/dist/runtime/server/api/chat/conversations/generate-title.post.js +1 -0
- package/dist/runtime/server/api/chat/conversations/index.get.d.ts +1 -0
- package/dist/runtime/server/api/chat/conversations/index.get.js +1 -0
- package/dist/runtime/server/api/chat/conversations/index.post.d.ts +1 -0
- package/dist/runtime/server/api/chat/conversations/index.post.js +1 -0
- package/dist/runtime/server/api/chat/workspace/settings.get.d.ts +2 -0
- package/dist/runtime/server/api/chat/workspace/settings.get.js +14 -0
- package/dist/runtime/server/api/conversations/[id]/cancel.post.d.ts +2 -0
- package/dist/runtime/server/api/conversations/[id]/cancel.post.js +58 -0
- package/dist/runtime/server/api/conversations/[id]/clear.post.d.ts +2 -0
- package/dist/runtime/server/api/conversations/[id]/clear.post.js +38 -0
- package/dist/runtime/server/api/conversations/[id]/duplicate.post.d.ts +2 -0
- package/dist/runtime/server/api/conversations/[id]/duplicate.post.js +41 -0
- package/dist/runtime/server/api/conversations/[id]/files.get.d.ts +2 -0
- package/dist/runtime/server/api/conversations/[id]/files.get.js +131 -0
- package/dist/runtime/server/api/conversations/[id]/index.delete.d.ts +2 -0
- package/dist/runtime/server/api/conversations/[id]/index.delete.js +35 -0
- package/dist/runtime/server/api/conversations/[id]/index.get.d.ts +2 -0
- package/dist/runtime/server/api/conversations/[id]/index.get.js +34 -0
- package/dist/runtime/server/api/conversations/[id]/index.patch.d.ts +2 -0
- package/dist/runtime/server/api/conversations/[id]/index.patch.js +54 -0
- package/dist/runtime/server/api/conversations/[id]/messages/[messageId]/retry.post.d.ts +2 -0
- package/dist/runtime/server/api/conversations/[id]/messages/[messageId]/retry.post.js +168 -0
- package/dist/runtime/server/api/conversations/[id]/messages/index.get.d.ts +2 -0
- package/dist/runtime/server/api/conversations/[id]/messages/index.get.js +220 -0
- package/dist/runtime/server/api/conversations/[id]/messages/index.post.d.ts +2 -0
- package/dist/runtime/server/api/conversations/[id]/messages/index.post.js +181 -0
- package/dist/runtime/server/api/conversations/[id]/usage.get.d.ts +8 -0
- package/dist/runtime/server/api/conversations/[id]/usage.get.js +96 -0
- package/dist/runtime/server/api/conversations/generate-title.post.d.ts +2 -0
- package/dist/runtime/server/api/conversations/generate-title.post.js +49 -0
- package/dist/runtime/server/api/conversations/index.get.d.ts +2 -0
- package/dist/runtime/server/api/conversations/index.get.js +11 -0
- package/dist/runtime/server/api/conversations/index.post.d.ts +2 -0
- package/dist/runtime/server/api/conversations/index.post.js +41 -0
- package/dist/runtime/server/api/external-skills/discover.post.d.ts +2 -0
- package/dist/runtime/server/api/external-skills/discover.post.js +65 -0
- package/dist/runtime/server/api/github/disconnect.post.d.ts +2 -0
- package/dist/runtime/server/api/github/disconnect.post.js +21 -0
- package/dist/runtime/server/api/github/status.get.d.ts +2 -0
- package/dist/runtime/server/api/github/status.get.js +23 -0
- package/dist/runtime/server/api/tela/canvas.get.d.ts +2 -0
- package/dist/runtime/server/api/tela/canvas.get.js +18 -0
- package/dist/runtime/server/api/tela/projects.get.d.ts +2 -0
- package/dist/runtime/server/api/tela/projects.get.js +9 -0
- package/dist/runtime/server/api/tela/workspaces.get.d.ts +2 -0
- package/dist/runtime/server/api/tela/workspaces.get.js +9 -0
- package/dist/runtime/server/api/tela/workstations.get.d.ts +2 -0
- package/dist/runtime/server/api/tela/workstations.get.js +24 -0
- package/dist/runtime/server/api/vault/permalink-metadata.post.d.ts +2 -0
- package/dist/runtime/server/api/vault/permalink-metadata.post.js +77 -0
- package/dist/runtime/server/api/vault/resolve.post.d.ts +2 -0
- package/dist/runtime/server/api/vault/resolve.post.js +82 -0
- package/dist/runtime/server/api/vault/upload.post.d.ts +2 -0
- package/dist/runtime/server/api/vault/upload.post.js +55 -0
- package/dist/runtime/server/api/workspace/credentials/[id].delete.d.ts +2 -0
- package/dist/runtime/server/api/workspace/credentials/[id].delete.js +18 -0
- package/dist/runtime/server/api/workspace/credentials/[id].put.d.ts +2 -0
- package/dist/runtime/server/api/workspace/credentials/[id].put.js +28 -0
- package/dist/runtime/server/api/workspace/credentials/index.get.d.ts +2 -0
- package/dist/runtime/server/api/workspace/credentials/index.get.js +10 -0
- package/dist/runtime/server/api/workspace/credentials/index.post.d.ts +2 -0
- package/dist/runtime/server/api/workspace/credentials/index.post.js +33 -0
- package/dist/runtime/server/api/workspace/settings.get.d.ts +2 -0
- package/dist/runtime/server/api/workspace/settings.get.js +27 -0
- package/dist/runtime/server/api/workspace/settings.patch.d.ts +2 -0
- package/dist/runtime/server/api/workspace/settings.patch.js +86 -0
- package/dist/runtime/server/api/workspace/usage.get.d.ts +48 -0
- package/dist/runtime/server/api/workspace/usage.get.js +186 -0
- package/dist/runtime/server/db/index.d.ts +6 -0
- package/dist/runtime/server/db/index.js +19 -0
- package/dist/runtime/server/db/schema/conversation-usage.d.ts +438 -0
- package/dist/runtime/server/db/schema/conversation-usage.js +34 -0
- package/dist/runtime/server/db/schema/conversations.d.ts +197 -0
- package/dist/runtime/server/db/schema/conversations.js +18 -0
- package/dist/runtime/server/db/schema/external-skills.d.ts +235 -0
- package/dist/runtime/server/db/schema/external-skills.js +26 -0
- package/dist/runtime/server/db/schema/index.d.ts +5 -0
- package/dist/runtime/server/db/schema/index.js +5 -0
- package/dist/runtime/server/db/schema/messages.d.ts +221 -0
- package/dist/runtime/server/db/schema/messages.js +19 -0
- package/dist/runtime/server/db/schema/workspace-settings.d.ts +164 -0
- package/dist/runtime/server/db/schema/workspace-settings.js +15 -0
- package/dist/runtime/server/db/schema.d.ts +1 -0
- package/dist/runtime/server/db/schema.js +1 -0
- package/dist/runtime/server/middleware/domain-validation.d.ts +2 -0
- package/dist/runtime/server/middleware/domain-validation.js +22 -0
- package/dist/runtime/server/middleware/request-logger.d.ts +2 -0
- package/dist/runtime/server/middleware/request-logger.js +15 -0
- package/dist/runtime/server/prompts/base-system.d.ts +2 -0
- package/dist/runtime/server/prompts/base-system.js +100 -0
- package/dist/runtime/server/prompts/base-system.md +99 -0
- package/dist/runtime/server/prompts/knowledge-sources.d.ts +2 -0
- package/dist/runtime/server/prompts/knowledge-sources.js +37 -0
- package/dist/runtime/server/prompts/knowledge-sources.md +36 -0
- package/dist/runtime/server/tasks/send-daily-usage-report.d.ts +2 -0
- package/dist/runtime/server/tasks/send-daily-usage-report.js +73 -0
- package/dist/runtime/server/tsconfig.json +21 -0
- package/dist/runtime/server/utils/agent-api.d.ts +39 -0
- package/dist/runtime/server/utils/agent-api.js +169 -0
- package/dist/runtime/server/utils/auth-api.d.ts +1 -0
- package/dist/runtime/server/utils/auth-api.js +25 -0
- package/dist/runtime/server/utils/auth.d.ts +17 -0
- package/dist/runtime/server/utils/auth.js +28 -0
- package/dist/runtime/server/utils/billing.d.ts +37 -0
- package/dist/runtime/server/utils/billing.js +68 -0
- package/dist/runtime/server/utils/chat-context.d.ts +9 -0
- package/dist/runtime/server/utils/chat-context.js +24 -0
- package/dist/runtime/server/utils/chat-message-builder.d.ts +4 -0
- package/dist/runtime/server/utils/chat-message-builder.js +39 -0
- package/dist/runtime/server/utils/chat-prompts.d.ts +7 -0
- package/dist/runtime/server/utils/chat-prompts.js +9 -0
- package/dist/runtime/server/utils/chat-workspace-settings.d.ts +16 -0
- package/dist/runtime/server/utils/chat-workspace-settings.js +115 -0
- package/dist/runtime/server/utils/external-skills.d.ts +2 -0
- package/dist/runtime/server/utils/external-skills.js +15 -0
- package/dist/runtime/server/utils/logger.d.ts +2 -0
- package/dist/runtime/server/utils/logger.js +12 -0
- package/dist/runtime/server/utils/slack.d.ts +32 -0
- package/dist/runtime/server/utils/slack.js +102 -0
- package/dist/runtime/server/utils/tela-api.d.ts +2 -0
- package/dist/runtime/server/utils/tela-api.js +29 -0
- package/dist/runtime/server/utils/vault.d.ts +3 -0
- package/dist/runtime/server/utils/vault.js +52 -0
- package/dist/runtime/server/utils/workspace-settings-resolver.stub.d.ts +2 -0
- package/dist/runtime/server/utils/workspace-settings-resolver.stub.js +1 -0
- package/dist/runtime/server/utils/workspace.d.ts +4 -0
- package/dist/runtime/server/utils/workspace.js +21 -0
- package/dist/runtime/types/agent.d.ts +168 -0
- package/dist/runtime/types/agent.js +95 -0
- package/dist/runtime/types/chat-workspace-settings-resolver.d.ts +4 -0
- package/dist/runtime/types/chat.d.ts +81 -0
- package/dist/runtime/types/chat.js +12 -0
- package/dist/runtime/types/credential.d.ts +8 -0
- package/dist/runtime/types/credential.js +0 -0
- package/dist/runtime/types/csv.d.ts +4 -0
- package/dist/runtime/types/csv.js +0 -0
- package/dist/runtime/types/external-skills.d.ts +8 -0
- package/dist/runtime/types/external-skills.js +0 -0
- package/dist/runtime/types/feature-flags.d.ts +7 -0
- package/dist/runtime/types/feature-flags.js +6 -0
- package/dist/runtime/types/reasoning.d.ts +17 -0
- package/dist/runtime/types/reasoning.js +0 -0
- package/dist/runtime/types/tela.d.ts +46 -0
- package/dist/runtime/types/tela.js +0 -0
- package/dist/runtime/types/workspace.d.ts +20 -0
- package/dist/runtime/types/workspace.js +0 -0
- package/dist/runtime/utils/calculate-usage.d.ts +48 -0
- package/dist/runtime/utils/calculate-usage.js +63 -0
- package/dist/runtime/utils/code-detection.d.ts +1 -0
- package/dist/runtime/utils/code-detection.js +24 -0
- package/dist/runtime/utils/export-conversation.d.ts +2 -0
- package/dist/runtime/utils/export-conversation.js +43 -0
- package/dist/runtime/utils/file.d.ts +46 -0
- package/dist/runtime/utils/file.js +500 -0
- package/dist/runtime/utils/format-time.d.ts +22 -0
- package/dist/runtime/utils/format-time.js +96 -0
- package/dist/runtime/utils/markdown-nodes.d.ts +22 -0
- package/dist/runtime/utils/markdown-nodes.js +40 -0
- package/dist/runtime/utils/string.d.ts +4 -0
- package/dist/runtime/utils/string.js +5 -0
- package/dist/runtime/utils/tela-chat.d.ts +19 -0
- package/dist/runtime/utils/tela-chat.js +20 -0
- package/dist/types.d.mts +7 -0
- package/package.json +72 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export function exportConversationToMarkdown(conversation) {
|
|
2
|
+
const formatDate = (date) => {
|
|
3
|
+
const d = new Date(date);
|
|
4
|
+
return d.toLocaleDateString("pt-BR", {
|
|
5
|
+
day: "2-digit",
|
|
6
|
+
month: "2-digit",
|
|
7
|
+
year: "numeric",
|
|
8
|
+
hour: "2-digit",
|
|
9
|
+
minute: "2-digit"
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
const lines = [
|
|
13
|
+
`# ${conversation.title}`,
|
|
14
|
+
"",
|
|
15
|
+
`**Criada por:** ${conversation.createdBy ?? "Desconhecido"}`,
|
|
16
|
+
`**Criada em:** ${formatDate(conversation.createdAt)}`,
|
|
17
|
+
"",
|
|
18
|
+
"---",
|
|
19
|
+
""
|
|
20
|
+
];
|
|
21
|
+
for (const msg of conversation.messages) {
|
|
22
|
+
const role = msg.role === "user" ? msg.createdBy ?? "Usu\xE1rio" : "Assistente";
|
|
23
|
+
const time = formatDate(msg.createdAt);
|
|
24
|
+
const ttft = msg.ttft ? ` | TTFT: ${msg.ttft}ms` : "";
|
|
25
|
+
lines.push(`**${role}** | ${time}${ttft}`);
|
|
26
|
+
lines.push("");
|
|
27
|
+
lines.push(msg.content);
|
|
28
|
+
lines.push("");
|
|
29
|
+
lines.push("---");
|
|
30
|
+
lines.push("");
|
|
31
|
+
}
|
|
32
|
+
const content = lines.join("\n");
|
|
33
|
+
const sanitizedTitle = conversation.title.replace(/[<>:"/\\|?*]/g, "_");
|
|
34
|
+
const blob = new Blob([content], { type: "text/markdown;charset=utf-8" });
|
|
35
|
+
const url = URL.createObjectURL(blob);
|
|
36
|
+
const link = document.createElement("a");
|
|
37
|
+
link.href = url;
|
|
38
|
+
link.download = `${sanitizedTitle}.md`;
|
|
39
|
+
document.body.appendChild(link);
|
|
40
|
+
link.click();
|
|
41
|
+
document.body.removeChild(link);
|
|
42
|
+
URL.revokeObjectURL(url);
|
|
43
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
type VaultHashParams = {
|
|
2
|
+
filename?: string;
|
|
3
|
+
pageNumber?: number;
|
|
4
|
+
};
|
|
5
|
+
type DetectedFile = {
|
|
6
|
+
type: 'vault' | 'url';
|
|
7
|
+
reference: string;
|
|
8
|
+
name: string;
|
|
9
|
+
mimeType: string;
|
|
10
|
+
hashParams?: VaultHashParams;
|
|
11
|
+
};
|
|
12
|
+
type ContentSegment = {
|
|
13
|
+
type: 'text';
|
|
14
|
+
content: string;
|
|
15
|
+
} | {
|
|
16
|
+
type: 'file';
|
|
17
|
+
file: DetectedFile;
|
|
18
|
+
};
|
|
19
|
+
declare const VAULT_PATTERN: RegExp;
|
|
20
|
+
declare const VAULT_PERMALINK_PATTERN: RegExp;
|
|
21
|
+
declare const MIME_TO_EXTENSION: Record<string, string>;
|
|
22
|
+
declare const FILE_ICONS: Record<string, string>;
|
|
23
|
+
declare function normalizeMimeType(mimeType: string): string;
|
|
24
|
+
declare function getFileIcon(mimeType: string): string;
|
|
25
|
+
declare function getFileTypeLabel(mimeType: string): string;
|
|
26
|
+
declare function formatUploadDate(date?: Date): string;
|
|
27
|
+
export declare function formatFileSize(bytes?: number): string;
|
|
28
|
+
export declare function generateFileId(url: string): string;
|
|
29
|
+
declare function stripTrailingPunctuation(url: string): string;
|
|
30
|
+
declare function getMimeTypeFromExtension(ext: string): string;
|
|
31
|
+
declare function normalizeVaultPermalinkUrl(url: string): string;
|
|
32
|
+
declare function isVaultPermalink(url: string): boolean;
|
|
33
|
+
declare function parseVaultHashParams(url: string): VaultHashParams | undefined;
|
|
34
|
+
declare function detectFilesInText(text: string): DetectedFile[];
|
|
35
|
+
declare function parseContentWithFiles(text: string): ContentSegment[];
|
|
36
|
+
declare function detectFileFromUrl(url: string): DetectedFile | null;
|
|
37
|
+
export declare function mergeFileUrls(contextFiles: {
|
|
38
|
+
vaultReference?: string | null;
|
|
39
|
+
url: string;
|
|
40
|
+
}[] | null | undefined, messageFiles: {
|
|
41
|
+
vaultReference?: string | null;
|
|
42
|
+
url: string;
|
|
43
|
+
}[] | null | undefined): string[] | undefined;
|
|
44
|
+
declare function getMimeIcon(mimeType?: string): string;
|
|
45
|
+
declare function getMimeLabel(mimeType?: string): string;
|
|
46
|
+
export { type ContentSegment, type DetectedFile, detectFileFromUrl, detectFilesInText, FILE_ICONS, formatUploadDate, getFileIcon, getFileTypeLabel, getMimeIcon, getMimeLabel, getMimeTypeFromExtension, isVaultPermalink, MIME_TO_EXTENSION, normalizeMimeType, normalizeVaultPermalinkUrl, parseContentWithFiles, parseVaultHashParams, stripTrailingPunctuation, VAULT_PATTERN, VAULT_PERMALINK_PATTERN, type VaultHashParams, };
|
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
const URL_CHAR_CLASS = "[^\\s\"'<>`\\[\\]()*_~]+";
|
|
2
|
+
const VAULT_REGEX = /(?<!\]\()vault:\/\/[^\s"'<>`\[\]()*_~]+/gi;
|
|
3
|
+
const URL_REGEX = /https?:\/\/[^\s"'<>`\[\]()*_~]+/gi;
|
|
4
|
+
const VAULT_PATTERN = new RegExp(`vault://${URL_CHAR_CLASS}`, "gi");
|
|
5
|
+
const VAULT_PERMALINK_PATTERN = new RegExp(`https://(?:[a-z0-9-]+\\.)*(?:vault|api)\\.tela(?:staging)?\\.com/(?:[a-z0-9_-]+/)*permalinks/${URL_CHAR_CLASS}`, "gi");
|
|
6
|
+
const FILE_EXTENSIONS = {
|
|
7
|
+
pdf: "application/pdf",
|
|
8
|
+
doc: "application/msword",
|
|
9
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
10
|
+
xls: "application/vnd.ms-excel",
|
|
11
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
12
|
+
ppt: "application/vnd.ms-powerpoint",
|
|
13
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
14
|
+
png: "image/png",
|
|
15
|
+
jpg: "image/jpeg",
|
|
16
|
+
jpeg: "image/jpeg",
|
|
17
|
+
gif: "image/gif",
|
|
18
|
+
webp: "image/webp",
|
|
19
|
+
svg: "image/svg+xml",
|
|
20
|
+
csv: "text/csv",
|
|
21
|
+
txt: "text/plain",
|
|
22
|
+
md: "text/markdown",
|
|
23
|
+
json: "application/json",
|
|
24
|
+
xml: "application/xml",
|
|
25
|
+
zip: "application/zip",
|
|
26
|
+
rar: "application/x-rar-compressed",
|
|
27
|
+
tar: "application/x-tar",
|
|
28
|
+
gz: "application/gzip",
|
|
29
|
+
tgz: "application/gzip",
|
|
30
|
+
mp4: "video/mp4",
|
|
31
|
+
webm: "video/webm",
|
|
32
|
+
mp3: "audio/mpeg",
|
|
33
|
+
wav: "audio/wav",
|
|
34
|
+
ogg: "audio/ogg",
|
|
35
|
+
py: "text/x-python",
|
|
36
|
+
js: "text/javascript",
|
|
37
|
+
ts: "text/typescript",
|
|
38
|
+
jsx: "text/javascript",
|
|
39
|
+
tsx: "text/typescript",
|
|
40
|
+
html: "text/html",
|
|
41
|
+
css: "text/css",
|
|
42
|
+
sql: "text/sql",
|
|
43
|
+
yaml: "text/yaml",
|
|
44
|
+
yml: "text/yaml",
|
|
45
|
+
go: "text/x-go",
|
|
46
|
+
rs: "text/x-rust",
|
|
47
|
+
rb: "text/x-ruby",
|
|
48
|
+
java: "text/x-java",
|
|
49
|
+
sh: "text/x-shellscript",
|
|
50
|
+
bash: "text/x-shellscript",
|
|
51
|
+
zsh: "text/x-shellscript",
|
|
52
|
+
c: "text/x-c",
|
|
53
|
+
h: "text/x-c",
|
|
54
|
+
cpp: "text/x-cpp",
|
|
55
|
+
cc: "text/x-cpp",
|
|
56
|
+
cxx: "text/x-cpp",
|
|
57
|
+
hpp: "text/x-cpp"
|
|
58
|
+
};
|
|
59
|
+
const MIME_TO_EXTENSION = (() => {
|
|
60
|
+
const map = {};
|
|
61
|
+
for (const [ext, mime] of Object.entries(FILE_EXTENSIONS)) {
|
|
62
|
+
if (!(mime in map))
|
|
63
|
+
map[mime] = ext;
|
|
64
|
+
}
|
|
65
|
+
return map;
|
|
66
|
+
})();
|
|
67
|
+
const FILE_ICONS = {
|
|
68
|
+
"application/pdf": "/files/pdf.svg",
|
|
69
|
+
"application/msword": "/files/doc.svg",
|
|
70
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "/files/doc.svg",
|
|
71
|
+
"application/vnd.ms-excel": "/files/sheet.svg",
|
|
72
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "/files/sheet.svg",
|
|
73
|
+
"application/vnd.ms-powerpoint": "/files/presentation.svg",
|
|
74
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation": "/files/presentation.svg",
|
|
75
|
+
"text/csv": "/files/sheet.svg",
|
|
76
|
+
"text/plain": "/files/generic.svg",
|
|
77
|
+
"text/markdown": "/files/markdown.svg",
|
|
78
|
+
"application/json": "/files/json.svg",
|
|
79
|
+
"application/xml": "/files/generic.svg",
|
|
80
|
+
"application/zip": "/files/archive.svg",
|
|
81
|
+
"application/x-rar-compressed": "/files/archive.svg",
|
|
82
|
+
"application/x-tar": "/files/archive.svg",
|
|
83
|
+
"application/gzip": "/files/archive.svg",
|
|
84
|
+
"image/jpeg": "/files/image.svg",
|
|
85
|
+
"image/png": "/files/image.svg",
|
|
86
|
+
"image/gif": "/files/image.svg",
|
|
87
|
+
"image/webp": "/files/image.svg",
|
|
88
|
+
"image/svg+xml": "/files/image.svg",
|
|
89
|
+
"video/mp4": "/files/video.svg",
|
|
90
|
+
"video/webm": "/files/video.svg",
|
|
91
|
+
"audio/mpeg": "/files/audio.svg",
|
|
92
|
+
"audio/wav": "/files/audio.svg",
|
|
93
|
+
"audio/ogg": "/files/audio.svg",
|
|
94
|
+
"text/x-python": "/files/python.svg",
|
|
95
|
+
"text/javascript": "/files/javascript.svg",
|
|
96
|
+
"text/typescript": "/files/typescript.svg",
|
|
97
|
+
"text/html": "/files/html.svg",
|
|
98
|
+
"text/css": "/files/css.svg",
|
|
99
|
+
"text/sql": "/files/sql.svg",
|
|
100
|
+
"text/yaml": "/files/yaml.svg",
|
|
101
|
+
"text/x-go": "/files/go.svg",
|
|
102
|
+
"text/x-rust": "/files/rust.svg",
|
|
103
|
+
"text/x-ruby": "/files/ruby.svg",
|
|
104
|
+
"text/x-java": "/files/java.svg",
|
|
105
|
+
"text/x-shellscript": "/files/shell.svg",
|
|
106
|
+
"text/x-c": "/files/c.svg",
|
|
107
|
+
"text/x-cpp": "/files/cpp.svg",
|
|
108
|
+
"unknown": "/files/generic.svg"
|
|
109
|
+
};
|
|
110
|
+
function normalizeMimeType(mimeType) {
|
|
111
|
+
return mimeType.split(";")[0]?.trim() ?? mimeType;
|
|
112
|
+
}
|
|
113
|
+
function getFileIcon(mimeType) {
|
|
114
|
+
return FILE_ICONS[mimeType] ?? "/files/generic.svg";
|
|
115
|
+
}
|
|
116
|
+
function getFileTypeLabel(mimeType) {
|
|
117
|
+
if (mimeType.includes("pdf"))
|
|
118
|
+
return "PDF";
|
|
119
|
+
if (mimeType.includes("word") || mimeType.includes("document"))
|
|
120
|
+
return "DOC";
|
|
121
|
+
if (mimeType.includes("excel") || mimeType.includes("spreadsheet") || mimeType.includes("csv"))
|
|
122
|
+
return "Planilha";
|
|
123
|
+
if (mimeType.includes("powerpoint") || mimeType.includes("presentation"))
|
|
124
|
+
return "Apresenta\xE7\xE3o";
|
|
125
|
+
if (mimeType.startsWith("image/"))
|
|
126
|
+
return "Imagem";
|
|
127
|
+
if (mimeType.startsWith("video/"))
|
|
128
|
+
return "V\xEDdeo";
|
|
129
|
+
if (mimeType.startsWith("audio/"))
|
|
130
|
+
return "\xC1udio";
|
|
131
|
+
if (mimeType.includes("json"))
|
|
132
|
+
return "JSON";
|
|
133
|
+
if (mimeType.includes("text"))
|
|
134
|
+
return "Texto";
|
|
135
|
+
return "Arquivo";
|
|
136
|
+
}
|
|
137
|
+
function formatUploadDate(date) {
|
|
138
|
+
if (!date)
|
|
139
|
+
return "-";
|
|
140
|
+
const now = /* @__PURE__ */ new Date();
|
|
141
|
+
const d = new Date(date);
|
|
142
|
+
const isToday = d.toDateString() === now.toDateString();
|
|
143
|
+
if (isToday) {
|
|
144
|
+
return `Hoje \xE0s ${d.toLocaleTimeString("pt-BR", { hour: "2-digit", minute: "2-digit" })}`;
|
|
145
|
+
}
|
|
146
|
+
const yesterday = new Date(now);
|
|
147
|
+
yesterday.setDate(yesterday.getDate() - 1);
|
|
148
|
+
if (d.toDateString() === yesterday.toDateString()) {
|
|
149
|
+
return `Ontem \xE0s ${d.toLocaleTimeString("pt-BR", { hour: "2-digit", minute: "2-digit" })}`;
|
|
150
|
+
}
|
|
151
|
+
return d.toLocaleDateString("pt-BR", { day: "2-digit", month: "short", year: "numeric" });
|
|
152
|
+
}
|
|
153
|
+
export function formatFileSize(bytes) {
|
|
154
|
+
if (bytes == null)
|
|
155
|
+
return "-";
|
|
156
|
+
if (bytes === 0)
|
|
157
|
+
return "0 B";
|
|
158
|
+
const units = ["B", "KB", "MB", "GB"];
|
|
159
|
+
const base = 1024;
|
|
160
|
+
const unitIndex = Math.min(Math.floor(Math.log(bytes) / Math.log(base)), units.length - 1);
|
|
161
|
+
const value = bytes / base ** unitIndex;
|
|
162
|
+
return `${value.toFixed(unitIndex === 0 ? 0 : 1)} ${units[unitIndex]}`;
|
|
163
|
+
}
|
|
164
|
+
export function generateFileId(url) {
|
|
165
|
+
let hash = 0;
|
|
166
|
+
for (let i = 0; i < url.length; i++) {
|
|
167
|
+
const char = url.charCodeAt(i);
|
|
168
|
+
hash = (hash << 5) - hash + char;
|
|
169
|
+
hash = hash & hash;
|
|
170
|
+
}
|
|
171
|
+
return Math.abs(hash).toString(36);
|
|
172
|
+
}
|
|
173
|
+
function stripTrailingPunctuation(url) {
|
|
174
|
+
return url.replace(/[.,:;!?]+$/, "");
|
|
175
|
+
}
|
|
176
|
+
function sanitizeFilename(filename) {
|
|
177
|
+
return filename.replace(/\.\./g, "").replace(/[/\\]/g, "-").replace(/^\.+/, "").replace(/[\x00-\x1F<>:"|?*]/g, "").replace(/^-+/, "").replace(/-+/g, "-").trim();
|
|
178
|
+
}
|
|
179
|
+
function getExtensionFromUrl(url) {
|
|
180
|
+
const cleanUrl = url.split("?")[0]?.split("#")[0];
|
|
181
|
+
if (!cleanUrl)
|
|
182
|
+
return void 0;
|
|
183
|
+
const match = cleanUrl.match(/\.([a-zA-Z0-9]+)$/);
|
|
184
|
+
return match?.[1]?.toLowerCase();
|
|
185
|
+
}
|
|
186
|
+
function getMimeTypeFromExtension(ext) {
|
|
187
|
+
return FILE_EXTENSIONS[ext] ?? "unknown";
|
|
188
|
+
}
|
|
189
|
+
function getNameFromUrl(url) {
|
|
190
|
+
const cleanUrl = url.split("?")[0]?.split("#")[0];
|
|
191
|
+
if (!cleanUrl)
|
|
192
|
+
return url;
|
|
193
|
+
const parts = cleanUrl.split("/");
|
|
194
|
+
return parts[parts.length - 1] ?? url;
|
|
195
|
+
}
|
|
196
|
+
function getNameFromVaultReference(reference) {
|
|
197
|
+
const parts = reference.replace("vault://", "").split("/");
|
|
198
|
+
return parts[parts.length - 1] || "Arquivo";
|
|
199
|
+
}
|
|
200
|
+
function isFileUrl(url) {
|
|
201
|
+
const ext = getExtensionFromUrl(url);
|
|
202
|
+
return ext !== void 0 && ext in FILE_EXTENSIONS;
|
|
203
|
+
}
|
|
204
|
+
function isVaultS3Url(url) {
|
|
205
|
+
return url.includes("vault-staging-permanentstorage.s3") || url.includes("vault-prod-permanentstorage.s3");
|
|
206
|
+
}
|
|
207
|
+
function normalizeVaultPermalinkUrl(url) {
|
|
208
|
+
return url.replace(
|
|
209
|
+
/^(https:\/\/(?:[a-z0-9-]+\.)*api\.tela(?:staging)?\.com)\/(permalinks\/)/,
|
|
210
|
+
"$1/_services/vault/$2"
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
function isVaultPermalink(url) {
|
|
214
|
+
try {
|
|
215
|
+
const parsed = new URL(url);
|
|
216
|
+
const host = parsed.host;
|
|
217
|
+
const isTelaHost = host === "vault.tela.com" || host.endsWith(".vault.tela.com") || host === "api.tela.com" || host.endsWith(".api.tela.com") || host === "api.telastaging.com" || host.endsWith(".api.telastaging.com");
|
|
218
|
+
return isTelaHost && /(?:^|\/)permalinks\//.test(parsed.pathname);
|
|
219
|
+
} catch {
|
|
220
|
+
return /^https:\/\/(?:[a-z0-9-]+\.)*(?:vault|api)\.tela(?:staging)?\.com\/(?:[a-z0-9_-]+\/)*permalinks\//.test(url);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function getFileInfoFromVaultS3Url(url) {
|
|
224
|
+
const filenameMatch = url.match(/filename%3D%22([^%]+)%22/);
|
|
225
|
+
if (filenameMatch?.[1]) {
|
|
226
|
+
const name = decodeURIComponent(filenameMatch[1]);
|
|
227
|
+
const ext = name.split(".").pop()?.toLowerCase();
|
|
228
|
+
return {
|
|
229
|
+
name,
|
|
230
|
+
mimeType: ext ? getMimeTypeFromExtension(ext) : "unknown"
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
return { name: "Arquivo", mimeType: "unknown" };
|
|
234
|
+
}
|
|
235
|
+
function parseVaultHashParams(url) {
|
|
236
|
+
const hashIndex = url.indexOf("#");
|
|
237
|
+
if (hashIndex === -1)
|
|
238
|
+
return void 0;
|
|
239
|
+
const hashPart = url.slice(hashIndex + 1);
|
|
240
|
+
const params = new URLSearchParams(hashPart);
|
|
241
|
+
const result = {};
|
|
242
|
+
const filename = params.get("filename");
|
|
243
|
+
if (filename) {
|
|
244
|
+
const sanitized = sanitizeFilename(filename);
|
|
245
|
+
if (sanitized)
|
|
246
|
+
result.filename = sanitized;
|
|
247
|
+
}
|
|
248
|
+
const pageNumber = params.get("page_number");
|
|
249
|
+
if (pageNumber) {
|
|
250
|
+
const parsed = Number.parseInt(pageNumber, 10);
|
|
251
|
+
if (!Number.isNaN(parsed) && parsed > 0)
|
|
252
|
+
result.pageNumber = parsed;
|
|
253
|
+
}
|
|
254
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
255
|
+
}
|
|
256
|
+
function getPermalinkId(url) {
|
|
257
|
+
const match = url.match(/permalinks\/([a-f0-9-]+)/);
|
|
258
|
+
return match?.[1] ?? "Arquivo";
|
|
259
|
+
}
|
|
260
|
+
function detectFilesInText(text) {
|
|
261
|
+
const files = [];
|
|
262
|
+
const seen = /* @__PURE__ */ new Set();
|
|
263
|
+
const vaultMatches = text.match(VAULT_REGEX) ?? [];
|
|
264
|
+
for (const rawMatch of vaultMatches) {
|
|
265
|
+
const match = stripTrailingPunctuation(rawMatch);
|
|
266
|
+
if (seen.has(match))
|
|
267
|
+
continue;
|
|
268
|
+
seen.add(match);
|
|
269
|
+
const hashParams = parseVaultHashParams(match);
|
|
270
|
+
const filenameExt = hashParams?.filename?.split(".").pop()?.toLowerCase();
|
|
271
|
+
const urlExt = getExtensionFromUrl(match);
|
|
272
|
+
const ext = filenameExt ?? urlExt;
|
|
273
|
+
files.push({
|
|
274
|
+
type: "vault",
|
|
275
|
+
reference: match,
|
|
276
|
+
name: hashParams?.filename ?? getNameFromVaultReference(match),
|
|
277
|
+
mimeType: ext ? getMimeTypeFromExtension(ext) : "unknown",
|
|
278
|
+
hashParams
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
const urlMatches = text.match(URL_REGEX) ?? [];
|
|
282
|
+
for (const rawMatch of urlMatches) {
|
|
283
|
+
const match = stripTrailingPunctuation(rawMatch);
|
|
284
|
+
if (seen.has(match))
|
|
285
|
+
continue;
|
|
286
|
+
if (isVaultS3Url(match)) {
|
|
287
|
+
seen.add(match);
|
|
288
|
+
const { name, mimeType } = getFileInfoFromVaultS3Url(match);
|
|
289
|
+
files.push({
|
|
290
|
+
type: "url",
|
|
291
|
+
reference: match,
|
|
292
|
+
name,
|
|
293
|
+
mimeType
|
|
294
|
+
});
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
if (isVaultPermalink(match)) {
|
|
298
|
+
const normalized = normalizeVaultPermalinkUrl(match);
|
|
299
|
+
seen.add(match);
|
|
300
|
+
files.push({
|
|
301
|
+
type: "url",
|
|
302
|
+
reference: normalized,
|
|
303
|
+
name: "Arquivo",
|
|
304
|
+
mimeType: "unknown"
|
|
305
|
+
});
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
if (!isFileUrl(match))
|
|
309
|
+
continue;
|
|
310
|
+
seen.add(match);
|
|
311
|
+
const ext = getExtensionFromUrl(match);
|
|
312
|
+
files.push({
|
|
313
|
+
type: "url",
|
|
314
|
+
reference: match,
|
|
315
|
+
name: getNameFromUrl(match),
|
|
316
|
+
mimeType: ext ? getMimeTypeFromExtension(ext) : "unknown"
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
return files;
|
|
320
|
+
}
|
|
321
|
+
function parseContentWithFiles(text) {
|
|
322
|
+
const segments = [];
|
|
323
|
+
const fileMatches = [];
|
|
324
|
+
for (const match of text.matchAll(VAULT_REGEX)) {
|
|
325
|
+
const rawUrl = match[0];
|
|
326
|
+
const url = stripTrailingPunctuation(rawUrl);
|
|
327
|
+
const hashParams = parseVaultHashParams(url);
|
|
328
|
+
const filenameExt = hashParams?.filename?.split(".").pop()?.toLowerCase();
|
|
329
|
+
const urlExt = getExtensionFromUrl(url);
|
|
330
|
+
const ext = filenameExt ?? urlExt;
|
|
331
|
+
fileMatches.push({
|
|
332
|
+
start: match.index,
|
|
333
|
+
end: match.index + url.length,
|
|
334
|
+
file: {
|
|
335
|
+
type: "vault",
|
|
336
|
+
reference: url,
|
|
337
|
+
name: hashParams?.filename ?? getNameFromVaultReference(url),
|
|
338
|
+
mimeType: ext ? getMimeTypeFromExtension(ext) : "unknown",
|
|
339
|
+
hashParams
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
for (const match of text.matchAll(URL_REGEX)) {
|
|
344
|
+
const rawUrl = match[0];
|
|
345
|
+
const url = stripTrailingPunctuation(rawUrl);
|
|
346
|
+
if (isVaultS3Url(url)) {
|
|
347
|
+
const { name, mimeType } = getFileInfoFromVaultS3Url(url);
|
|
348
|
+
fileMatches.push({
|
|
349
|
+
start: match.index,
|
|
350
|
+
end: match.index + url.length,
|
|
351
|
+
file: {
|
|
352
|
+
type: "url",
|
|
353
|
+
reference: url,
|
|
354
|
+
name,
|
|
355
|
+
mimeType
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
if (isVaultPermalink(url)) {
|
|
361
|
+
fileMatches.push({
|
|
362
|
+
start: match.index,
|
|
363
|
+
end: match.index + url.length,
|
|
364
|
+
file: {
|
|
365
|
+
type: "url",
|
|
366
|
+
reference: normalizeVaultPermalinkUrl(url),
|
|
367
|
+
name: "Arquivo",
|
|
368
|
+
mimeType: "unknown"
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
373
|
+
if (isFileUrl(url)) {
|
|
374
|
+
const ext = getExtensionFromUrl(url);
|
|
375
|
+
fileMatches.push({
|
|
376
|
+
start: match.index,
|
|
377
|
+
end: match.index + url.length,
|
|
378
|
+
file: {
|
|
379
|
+
type: "url",
|
|
380
|
+
reference: url,
|
|
381
|
+
name: getNameFromUrl(url),
|
|
382
|
+
mimeType: ext ? getMimeTypeFromExtension(ext) : "unknown"
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
if (fileMatches.length === 0)
|
|
388
|
+
return [{ type: "text", content: text }];
|
|
389
|
+
fileMatches.sort((a, b) => a.start - b.start);
|
|
390
|
+
let lastEnd = 0;
|
|
391
|
+
for (const fm of fileMatches) {
|
|
392
|
+
if (fm.start > lastEnd) {
|
|
393
|
+
const textContent = text.slice(lastEnd, fm.start);
|
|
394
|
+
if (textContent)
|
|
395
|
+
segments.push({ type: "text", content: textContent });
|
|
396
|
+
}
|
|
397
|
+
segments.push({ type: "file", file: fm.file });
|
|
398
|
+
lastEnd = fm.end;
|
|
399
|
+
}
|
|
400
|
+
if (lastEnd < text.length) {
|
|
401
|
+
const textContent = text.slice(lastEnd);
|
|
402
|
+
if (textContent)
|
|
403
|
+
segments.push({ type: "text", content: textContent });
|
|
404
|
+
}
|
|
405
|
+
return segments;
|
|
406
|
+
}
|
|
407
|
+
function detectFileFromUrl(url) {
|
|
408
|
+
if (url.toLowerCase().startsWith("vault://")) {
|
|
409
|
+
const cleaned = stripTrailingPunctuation(url);
|
|
410
|
+
const hashParams = parseVaultHashParams(cleaned);
|
|
411
|
+
const filenameExt = hashParams?.filename?.split(".").pop()?.toLowerCase();
|
|
412
|
+
const urlExt = getExtensionFromUrl(cleaned);
|
|
413
|
+
const ext = filenameExt ?? urlExt;
|
|
414
|
+
return {
|
|
415
|
+
type: "vault",
|
|
416
|
+
reference: cleaned,
|
|
417
|
+
name: hashParams?.filename ?? getNameFromVaultReference(cleaned),
|
|
418
|
+
mimeType: ext ? getMimeTypeFromExtension(ext) : "unknown",
|
|
419
|
+
hashParams
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
if (isVaultPermalink(url)) {
|
|
423
|
+
const cleaned = normalizeVaultPermalinkUrl(stripTrailingPunctuation(url));
|
|
424
|
+
const hashParams = parseVaultHashParams(cleaned);
|
|
425
|
+
return {
|
|
426
|
+
type: "url",
|
|
427
|
+
reference: cleaned,
|
|
428
|
+
name: hashParams?.filename ?? getPermalinkId(cleaned),
|
|
429
|
+
mimeType: "unknown",
|
|
430
|
+
hashParams
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
if (isVaultS3Url(url)) {
|
|
434
|
+
const cleaned = stripTrailingPunctuation(url);
|
|
435
|
+
const { name, mimeType } = getFileInfoFromVaultS3Url(cleaned);
|
|
436
|
+
return {
|
|
437
|
+
type: "url",
|
|
438
|
+
reference: cleaned,
|
|
439
|
+
name,
|
|
440
|
+
mimeType
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
return null;
|
|
444
|
+
}
|
|
445
|
+
export function mergeFileUrls(contextFiles, messageFiles) {
|
|
446
|
+
const contextFileUrls = contextFiles?.map((f) => f.vaultReference || f.url) ?? [];
|
|
447
|
+
const messageFileUrls = messageFiles?.map((f) => f.vaultReference || f.url) ?? [];
|
|
448
|
+
const allFileUrls = [...contextFileUrls, ...messageFileUrls];
|
|
449
|
+
return allFileUrls.length > 0 ? allFileUrls : void 0;
|
|
450
|
+
}
|
|
451
|
+
function getMimeIcon(mimeType) {
|
|
452
|
+
if (!mimeType)
|
|
453
|
+
return "i-ph-file";
|
|
454
|
+
if (mimeType.includes("pdf"))
|
|
455
|
+
return "i-ph-file-pdf";
|
|
456
|
+
if (mimeType.startsWith("image/"))
|
|
457
|
+
return "i-ph-file-image";
|
|
458
|
+
if (mimeType.includes("spreadsheet") || mimeType.includes("excel"))
|
|
459
|
+
return "i-ph-file-xls";
|
|
460
|
+
if (mimeType.includes("document") || mimeType.includes("word"))
|
|
461
|
+
return "i-ph-file-doc";
|
|
462
|
+
if (mimeType.startsWith("text/"))
|
|
463
|
+
return "i-ph-file-text";
|
|
464
|
+
return "i-ph-file";
|
|
465
|
+
}
|
|
466
|
+
function getMimeLabel(mimeType) {
|
|
467
|
+
if (!mimeType)
|
|
468
|
+
return "Arquivo";
|
|
469
|
+
if (mimeType.includes("pdf"))
|
|
470
|
+
return "PDF";
|
|
471
|
+
if (mimeType.startsWith("image/"))
|
|
472
|
+
return "Imagem";
|
|
473
|
+
if (mimeType.includes("spreadsheet") || mimeType.includes("excel"))
|
|
474
|
+
return "Planilha";
|
|
475
|
+
if (mimeType.includes("document") || mimeType.includes("word"))
|
|
476
|
+
return "Documento";
|
|
477
|
+
if (mimeType.startsWith("text/"))
|
|
478
|
+
return "Texto";
|
|
479
|
+
return "Arquivo";
|
|
480
|
+
}
|
|
481
|
+
export {
|
|
482
|
+
detectFileFromUrl,
|
|
483
|
+
detectFilesInText,
|
|
484
|
+
FILE_ICONS,
|
|
485
|
+
formatUploadDate,
|
|
486
|
+
getFileIcon,
|
|
487
|
+
getFileTypeLabel,
|
|
488
|
+
getMimeIcon,
|
|
489
|
+
getMimeLabel,
|
|
490
|
+
getMimeTypeFromExtension,
|
|
491
|
+
isVaultPermalink,
|
|
492
|
+
MIME_TO_EXTENSION,
|
|
493
|
+
normalizeMimeType,
|
|
494
|
+
normalizeVaultPermalinkUrl,
|
|
495
|
+
parseContentWithFiles,
|
|
496
|
+
parseVaultHashParams,
|
|
497
|
+
stripTrailingPunctuation,
|
|
498
|
+
VAULT_PATTERN,
|
|
499
|
+
VAULT_PERMALINK_PATTERN
|
|
500
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats a date to a relative or absolute string based on how old it is.
|
|
3
|
+
* - Today: "agora", "há 2 min", "há 3 horas"
|
|
4
|
+
* - Older: "18 de Dez." or "10/10/2024"
|
|
5
|
+
*/
|
|
6
|
+
export declare function formatRelativeTime(dateInput: Date | string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Groups a list of objects by a date field into chronological categories.
|
|
9
|
+
*/
|
|
10
|
+
export declare function groupConversationsByDate<T extends {
|
|
11
|
+
updatedAt: Date | string;
|
|
12
|
+
}>(items: readonly T[]): {
|
|
13
|
+
title: string;
|
|
14
|
+
items: T[];
|
|
15
|
+
}[];
|
|
16
|
+
export declare function formatAbsoluteDate(dateInput: Date | string): string;
|
|
17
|
+
export declare function formatDateWithTime(date?: string | Date): string;
|
|
18
|
+
export declare function formatShortDate(dateStr: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Legacy formatTime for backward compatibility if needed
|
|
21
|
+
*/
|
|
22
|
+
export declare function formatTime(time: string): string;
|