@sveda-ai/vue 0.3.1 → 0.3.3

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.
Files changed (80) hide show
  1. package/README.md +1 -1
  2. package/dist/appearance.d.ts +4 -53
  3. package/dist/appearance.d.ts.map +1 -1
  4. package/dist/composables/useSvedaChat.d.ts +7 -149
  5. package/dist/composables/useSvedaChat.d.ts.map +1 -1
  6. package/dist/composables/useSvedaChatLayout.d.ts +1 -1
  7. package/dist/composables/useSvedaChatLayout.d.ts.map +1 -1
  8. package/dist/composables/useSvedaChatPage.d.ts +6 -91
  9. package/dist/composables/useSvedaChatPage.d.ts.map +1 -1
  10. package/dist/composables/useSvedaPrompts.d.ts +1 -1
  11. package/dist/composables/useSvedaPrompts.d.ts.map +1 -1
  12. package/dist/composables/useSvedaStreaming.d.ts +3 -6
  13. package/dist/composables/useSvedaStreaming.d.ts.map +1 -1
  14. package/dist/index.d.ts +3 -10
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +3035 -4437
  17. package/dist/plugin.d.ts.map +1 -1
  18. package/dist/styles.css +2 -1
  19. package/dist/ui/sheet/index.d.ts +1 -1
  20. package/dist/ui/toast/Toast.vue.d.ts +2 -2
  21. package/dist/vue.css +1 -1
  22. package/package.json +21 -29
  23. package/src/appearance.ts +44 -652
  24. package/src/components/chat/ChatMessageActivityBlock.vue +1 -1
  25. package/src/components/chat/ChatMessageItem.vue +3 -3
  26. package/src/components/chat/ChatMessageList.vue +1 -1
  27. package/src/components/shell/SvedaTabs.vue +1 -1
  28. package/src/composables/useSvedaChat.ts +53 -573
  29. package/src/composables/useSvedaChatLayout.ts +1 -1
  30. package/src/composables/useSvedaChatPage.ts +1 -1
  31. package/src/composables/useSvedaPrompts.ts +1 -1
  32. package/src/composables/useSvedaStreaming.ts +41 -368
  33. package/src/index.ts +14 -11
  34. package/src/plugin.ts +1 -3
  35. package/src/theme.test.mjs +5 -4
  36. package/dist/i18n/locales/en.d.ts +0 -4
  37. package/dist/i18n/locales/en.d.ts.map +0 -1
  38. package/dist/i18n/locales/ru.d.ts +0 -4
  39. package/dist/i18n/locales/ru.d.ts.map +0 -1
  40. package/dist/lib/assistantMessage.d.ts +0 -90
  41. package/dist/lib/assistantMessage.d.ts.map +0 -1
  42. package/dist/lib/chatHistoryMerge.d.ts +0 -20
  43. package/dist/lib/chatHistoryMerge.d.ts.map +0 -1
  44. package/dist/lib/chatI18nKeys.d.ts +0 -2
  45. package/dist/lib/chatI18nKeys.d.ts.map +0 -1
  46. package/dist/lib/chatMessageVisibility.d.ts +0 -6
  47. package/dist/lib/chatMessageVisibility.d.ts.map +0 -1
  48. package/dist/lib/chatResize.d.ts +0 -42
  49. package/dist/lib/chatResize.d.ts.map +0 -1
  50. package/dist/lib/chatTabs.d.ts +0 -9
  51. package/dist/lib/chatTabs.d.ts.map +0 -1
  52. package/dist/lib/chatTitle.d.ts +0 -3
  53. package/dist/lib/chatTitle.d.ts.map +0 -1
  54. package/dist/lib/chatUiStorage.d.ts +0 -6
  55. package/dist/lib/chatUiStorage.d.ts.map +0 -1
  56. package/dist/lib/finalizeMessages.d.ts +0 -21
  57. package/dist/lib/finalizeMessages.d.ts.map +0 -1
  58. package/dist/lib/markdown.d.ts +0 -8
  59. package/dist/lib/markdown.d.ts.map +0 -1
  60. package/dist/lib/modelLabels.d.ts +0 -3
  61. package/dist/lib/modelLabels.d.ts.map +0 -1
  62. package/dist/lib/toolConfirmation.d.ts +0 -11
  63. package/dist/lib/toolConfirmation.d.ts.map +0 -1
  64. package/dist/lib/userMessage.d.ts +0 -17
  65. package/dist/lib/userMessage.d.ts.map +0 -1
  66. package/src/i18n/locales/en.ts +0 -64
  67. package/src/i18n/locales/ru.ts +0 -65
  68. package/src/lib/assistantMessage.ts +0 -439
  69. package/src/lib/chatHistoryMerge.ts +0 -93
  70. package/src/lib/chatI18nKeys.ts +0 -64
  71. package/src/lib/chatMessageVisibility.ts +0 -92
  72. package/src/lib/chatResize.ts +0 -123
  73. package/src/lib/chatTabs.ts +0 -54
  74. package/src/lib/chatTitle.ts +0 -30
  75. package/src/lib/chatUiStorage.ts +0 -69
  76. package/src/lib/finalizeMessages.ts +0 -81
  77. package/src/lib/markdown.ts +0 -90
  78. package/src/lib/modelLabels.ts +0 -24
  79. package/src/lib/toolConfirmation.ts +0 -31
  80. package/src/lib/userMessage.ts +0 -55
@@ -1,123 +0,0 @@
1
- export const SVEDA_CHAT_LAYOUT_MIN_WIDTH = 320;
2
- export const SVEDA_CHAT_LAYOUT_MIN_HEIGHT = 400;
3
- export const SVEDA_CHAT_LAYOUT_MAX_WIDTH = 800;
4
- export const SVEDA_CHAT_LAYOUT_MAX_HEIGHT = 900;
5
- export const SVEDA_HISTORY_SIDEBAR_WIDTH = 320;
6
-
7
- export interface EmbedHostSize {
8
- width: number;
9
- height: number;
10
- immersive: boolean;
11
- fixed: boolean;
12
- }
13
-
14
- export const resolveEmbedHostSize = ({
15
- chatWidth,
16
- chatHeight,
17
- fixedWidth,
18
- historyOpen,
19
- viewMode,
20
- viewportWidth,
21
- viewportHeight,
22
- }: {
23
- chatWidth: number;
24
- chatHeight: number;
25
- fixedWidth: number;
26
- historyOpen: boolean;
27
- viewMode: 'floating' | 'fixed' | 'immersive';
28
- viewportWidth: number;
29
- viewportHeight: number;
30
- }): EmbedHostSize => {
31
- if (viewMode === 'immersive') {
32
- return {
33
- width: viewportWidth,
34
- height: viewportHeight,
35
- immersive: true,
36
- fixed: false,
37
- };
38
- }
39
-
40
- if (viewMode === 'fixed') {
41
- return {
42
- width: fixedWidth + (historyOpen ? SVEDA_HISTORY_SIDEBAR_WIDTH : 0),
43
- height: viewportHeight,
44
- immersive: false,
45
- fixed: true,
46
- };
47
- }
48
-
49
- return {
50
- width: chatWidth + (historyOpen ? SVEDA_HISTORY_SIDEBAR_WIDTH : 0),
51
- height: chatHeight,
52
- immersive: false,
53
- fixed: false,
54
- };
55
- };
56
-
57
- const clamp = (value: number, min: number, max: number): number =>
58
- Math.max(min, Math.min(max, value));
59
-
60
- export interface ChatBoxSize {
61
- width: number;
62
- height: number;
63
- }
64
-
65
- /**
66
- * Pointer deltas for window resize must use screen coordinates.
67
- *
68
- * Inside an iframe, `clientX`/`clientY` are relative to the iframe viewport.
69
- * Hosts pin the frame to the bottom-right, so growing the frame moves its origin
70
- * and the next `clientX` snaps back — the window jitters. `screenX`/`screenY`
71
- * stay stable across that origin shift (and still work for the in-page JS chat).
72
- */
73
- export const pointerScreenDelta = (
74
- event: Pick<MouseEvent, 'screenX' | 'screenY'>,
75
- startX: number,
76
- startY: number
77
- ): { deltaX: number; deltaY: number } => ({
78
- deltaX: event.screenX - startX,
79
- deltaY: event.screenY - startY,
80
- });
81
-
82
- export const applyFloatingResize = (
83
- direction: string,
84
- startWidth: number,
85
- startHeight: number,
86
- deltaX: number,
87
- deltaY: number
88
- ): ChatBoxSize => {
89
- let width = startWidth;
90
- let height = startHeight;
91
-
92
- if (direction.includes('right')) {
93
- width = clamp(startWidth + deltaX, SVEDA_CHAT_LAYOUT_MIN_WIDTH, SVEDA_CHAT_LAYOUT_MAX_WIDTH);
94
- }
95
- if (direction.includes('left')) {
96
- width = clamp(startWidth - deltaX, SVEDA_CHAT_LAYOUT_MIN_WIDTH, SVEDA_CHAT_LAYOUT_MAX_WIDTH);
97
- }
98
- if (direction.includes('bottom')) {
99
- height = clamp(startHeight + deltaY, SVEDA_CHAT_LAYOUT_MIN_HEIGHT, SVEDA_CHAT_LAYOUT_MAX_HEIGHT);
100
- }
101
- if (direction.includes('top')) {
102
- height = clamp(startHeight - deltaY, SVEDA_CHAT_LAYOUT_MIN_HEIGHT, SVEDA_CHAT_LAYOUT_MAX_HEIGHT);
103
- }
104
-
105
- return { width, height };
106
- };
107
-
108
- export const applyFixedLeftResize = (
109
- startWidth: number,
110
- deltaX: number,
111
- maxChat: number
112
- ): { width: number; enterImmersive: boolean } => {
113
- const next = startWidth - deltaX;
114
- if (next > maxChat && maxChat >= SVEDA_CHAT_LAYOUT_MIN_WIDTH) {
115
- return { width: maxChat, enterImmersive: true };
116
- }
117
-
118
- const upper = Math.max(SVEDA_CHAT_LAYOUT_MIN_WIDTH, maxChat);
119
- return {
120
- width: clamp(next, SVEDA_CHAT_LAYOUT_MIN_WIDTH, upper),
121
- enterImmersive: false,
122
- };
123
- };
@@ -1,54 +0,0 @@
1
- import { userMessageHasVisibleContent, type SvedaUserMessageLike } from './userMessage';
2
-
3
- export type SvedaTabChat = {
4
- id: string;
5
- title?: string;
6
- messages?: SvedaUserMessageLike[];
7
- };
8
-
9
- export const isNewChatPlaceholder = (chat: SvedaTabChat, newChatLabel: string): boolean => {
10
- const messages = chat.messages || [];
11
- if (messages.some(userMessageHasVisibleContent)) {
12
- return false;
13
- }
14
-
15
- const title = (chat.title || '').trim();
16
- if (!title || title === '__NEW_CHAT__' || title === 'New Chat') {
17
- return true;
18
- }
19
-
20
- if (title === newChatLabel) {
21
- return true;
22
- }
23
-
24
- if (title.startsWith(`${newChatLabel} `)) {
25
- const suffix = title.slice(newChatLabel.length).trim();
26
- return /^\d+$/.test(suffix);
27
- }
28
-
29
- return false;
30
- };
31
-
32
- export const buildChatTabTitleMap = (
33
- tabs: SvedaTabChat[],
34
- translate: (key: string, params?: Record<string, unknown>) => string
35
- ): Map<string, string> => {
36
- const newChatLabel = translate('newChat');
37
- const placeholderTabs = tabs.filter(tab => isNewChatPlaceholder(tab, newChatLabel));
38
- const titles = new Map<string, string>();
39
-
40
- tabs.forEach(tab => {
41
- if (!isNewChatPlaceholder(tab, newChatLabel)) {
42
- titles.set(tab.id, (tab.title || '').trim() || newChatLabel);
43
- return;
44
- }
45
-
46
- const index = placeholderTabs.findIndex(item => item.id === tab.id) + 1;
47
- titles.set(
48
- tab.id,
49
- placeholderTabs.length > 1 ? translate('newChatNumbered', { number: index }) : newChatLabel
50
- );
51
- });
52
-
53
- return titles;
54
- };
@@ -1,30 +0,0 @@
1
- export const isChatTitlePlaceholder = (title: string, newChatLabel: string): boolean => {
2
- const normalized = (title || '').trim();
3
- if (!normalized || normalized === '__NEW_CHAT__' || normalized === 'New Chat') {
4
- return true;
5
- }
6
-
7
- if (normalized === newChatLabel) {
8
- return true;
9
- }
10
-
11
- if (normalized.startsWith(`${newChatLabel} `)) {
12
- const suffix = normalized.slice(newChatLabel.length).trim();
13
- return /^\d+$/.test(suffix);
14
- }
15
-
16
- return false;
17
- };
18
-
19
- export const deriveProvisionalChatTitle = (userRequest: string): string => {
20
- const text = userRequest.replace(/\s+/g, ' ').trim();
21
- if (!text) {
22
- return '';
23
- }
24
-
25
- if (text.length > 80) {
26
- return text.slice(0, 80).trimEnd();
27
- }
28
-
29
- return text;
30
- };
@@ -1,69 +0,0 @@
1
- export const SVEDA_CHAT_MINIMIZED_STORAGE_KEY = 'sveda.chat-minimized';
2
-
3
- const readFlag = (storage: Storage | undefined): boolean | null => {
4
- if (!storage) {
5
- return null;
6
- }
7
-
8
- try {
9
- const saved = storage.getItem(SVEDA_CHAT_MINIMIZED_STORAGE_KEY);
10
- if (saved === 'true') {
11
- return true;
12
- }
13
- if (saved === 'false') {
14
- return false;
15
- }
16
- } catch {
17
- return null;
18
- }
19
-
20
- return null;
21
- };
22
-
23
- const storageOrNull = (read: () => Storage): Storage | undefined => {
24
- if (typeof window === 'undefined') {
25
- return undefined;
26
- }
27
-
28
- try {
29
- return read();
30
- } catch {
31
- return undefined;
32
- }
33
- };
34
-
35
- export const readPersistedMinimizedPreference = (): boolean | null => {
36
- const session = readFlag(storageOrNull(() => sessionStorage));
37
- if (session !== null) {
38
- return session;
39
- }
40
-
41
- return readFlag(storageOrNull(() => localStorage));
42
- };
43
-
44
- export const readPersistedMinimized = (): boolean => {
45
- return readPersistedMinimizedPreference() ?? true;
46
- };
47
-
48
- export const isPersistedSessionChatOpen = (): boolean => {
49
- return readFlag(storageOrNull(() => sessionStorage)) === false;
50
- };
51
-
52
- export const writePersistedMinimized = (isMinimized: boolean): void => {
53
- const value = isMinimized ? 'true' : 'false';
54
-
55
- for (const storage of [
56
- storageOrNull(() => sessionStorage),
57
- storageOrNull(() => localStorage),
58
- ]) {
59
- if (!storage) {
60
- continue;
61
- }
62
-
63
- try {
64
- storage.setItem(SVEDA_CHAT_MINIMIZED_STORAGE_KEY, value);
65
- } catch {
66
- continue;
67
- }
68
- }
69
- };
@@ -1,81 +0,0 @@
1
- export type SvedaFinalizableMessage = {
2
- parts?: Array<{
3
- type?: string;
4
- state?: string;
5
- output?: unknown;
6
- result?: unknown;
7
- [key: string]: unknown;
8
- }>;
9
- streaming?: boolean;
10
- activity?: {
11
- phase?: string;
12
- steps?: Array<{ status?: string; [key: string]: unknown }>;
13
- [key: string]: unknown;
14
- };
15
- [key: string]: unknown;
16
- };
17
-
18
- const TERMINAL_ACTIVITY_PHASES = new Set(['done', 'error', 'stopped']);
19
-
20
- const TOOL_COMPLETE_STATES = new Set([
21
- 'result',
22
- 'output-available',
23
- 'output-error',
24
- 'output-denied',
25
- 'done',
26
- ]);
27
-
28
- const isToolPart = (part: { type?: string } | undefined): boolean =>
29
- part?.type === 'dynamic-tool' ||
30
- (typeof part?.type === 'string' && part.type.startsWith('tool-'));
31
-
32
- function finalizeActivity<T extends SvedaFinalizableMessage>(message: T): T {
33
- if (!message.activity) {
34
- return message;
35
- }
36
-
37
- const activity = { ...message.activity };
38
- if (activity.phase && !TERMINAL_ACTIVITY_PHASES.has(activity.phase)) {
39
- activity.phase = 'done';
40
- }
41
-
42
- if (Array.isArray(activity.steps)) {
43
- activity.steps = activity.steps.map(step => ({
44
- ...step,
45
- status: step.status === 'running' ? 'success' : step.status,
46
- }));
47
- }
48
-
49
- return { ...message, activity };
50
- }
51
-
52
- function finalizeParts<T extends SvedaFinalizableMessage>(message: T): T {
53
- if (!Array.isArray(message.parts)) {
54
- if (message.streaming === true) {
55
- return { ...message, streaming: false };
56
- }
57
- return message;
58
- }
59
-
60
- const parts = message.parts.map(part => {
61
- if (part?.state === 'streaming') {
62
- return { ...part, state: 'done' };
63
- }
64
- if (isToolPart(part) && part.state && !TOOL_COMPLETE_STATES.has(part.state)) {
65
- if (part.output !== undefined || part.result !== undefined) {
66
- return { ...part, state: 'output-available' };
67
- }
68
- }
69
- return part;
70
- });
71
-
72
- return {
73
- ...message,
74
- parts,
75
- streaming: false,
76
- };
77
- }
78
-
79
- export function finalizeMessagesForDisplay<T extends SvedaFinalizableMessage>(messages: T[]): T[] {
80
- return messages.map(message => finalizeActivity(finalizeParts(message)));
81
- }
@@ -1,90 +0,0 @@
1
- import DOMPurify from 'dompurify';
2
- import hljs from 'highlight.js';
3
- import { Marked, Renderer } from 'marked';
4
- import type { SvedaResourceLink } from './assistantMessage.js';
5
-
6
- const escapeHtml = (value: string): string =>
7
- value
8
- .replace(/&/g, '&amp;')
9
- .replace(/</g, '&lt;')
10
- .replace(/>/g, '&gt;')
11
- .replace(/"/g, '&quot;');
12
-
13
- const renderer = new Renderer();
14
- renderer.code = ({ text, lang }): string => {
15
- const language = lang && hljs.getLanguage(lang) ? lang : '';
16
- const value = language ? hljs.highlight(text, { language }).value : escapeHtml(text);
17
- const className = language ? ` class="hljs language-${language}"` : '';
18
- return `<pre><code${className}>${value}</code></pre>`;
19
- };
20
-
21
- const markedInstance = new Marked({ gfm: true, breaks: true });
22
- markedInstance.use({ renderer });
23
-
24
- export function injectResourceLinks(html: string, resources: SvedaResourceLink[]): string {
25
- if (!Array.isArray(resources) || resources.length === 0) {
26
- return html;
27
- }
28
-
29
- const sorted = [...resources].sort((a, b) => b.label.length - a.label.length);
30
-
31
- for (const resource of sorted) {
32
- if (!resource.label || !resource.url) {
33
- continue;
34
- }
35
- const escaped = resource.label.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
36
- const pattern = new RegExp(
37
- `(?<=^|[^a-zA-Zа-яА-ЯёЁ])(«${escaped}»|„${escaped}"|"${escaped}"|«${escaped}|${escaped}»|${escaped})(?=$|[^a-zA-Zа-яА-ЯёЁ])`,
38
- 'gu'
39
- );
40
- const safeLink = resource.url.replace(/"/g, '&quot;');
41
- const icon =
42
- '<svg class="resource-link-icon" xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 7h10v10"/><path d="M7 17 17 7"/></svg>';
43
- html = html.replace(pattern, `<a href="${safeLink}" class="resource-inline-link">$1${icon}</a>`);
44
- }
45
-
46
- return html;
47
- }
48
-
49
- export interface SvedaMarkdownOptions {
50
- resources?: SvedaResourceLink[];
51
- injectResources?: boolean;
52
- }
53
-
54
- export function renderMarkdown(text: string, options: SvedaMarkdownOptions = {}): string {
55
- const body = text || '';
56
- if (!body.trim()) {
57
- return '';
58
- }
59
-
60
- const raw = markedInstance.parse(body, { async: false });
61
- let html = DOMPurify.sanitize(raw, {
62
- ALLOWED_TAGS: [
63
- 'p',
64
- 'br',
65
- 'strong',
66
- 'em',
67
- 'code',
68
- 'pre',
69
- 'ul',
70
- 'ol',
71
- 'li',
72
- 'h1',
73
- 'h2',
74
- 'h3',
75
- 'h4',
76
- 'a',
77
- 'blockquote',
78
- 'hr',
79
- 'span',
80
- 'img',
81
- ],
82
- ALLOWED_ATTR: ['href', 'src', 'alt', 'title', 'class', 'target', 'rel', 'loading'],
83
- });
84
-
85
- if (options.injectResources && Array.isArray(options.resources) && options.resources.length > 0) {
86
- html = injectResourceLinks(html, options.resources);
87
- }
88
-
89
- return html;
90
- }
@@ -1,24 +0,0 @@
1
- export function humanizeModelId(raw: string): string {
2
- const part = raw.includes('/') ? (raw.split('/').pop() as string) : raw;
3
- const cleaned = part.replace(/-preview$/i, '').replace(/_/g, '-');
4
- return cleaned
5
- .split('-')
6
- .map(seg => {
7
- if (/^\d+(\.\d+)?$/.test(seg)) {
8
- return seg;
9
- }
10
- if (seg.length === 0) {
11
- return '';
12
- }
13
- return seg[0].toUpperCase() + seg.slice(1).toLowerCase();
14
- })
15
- .join(' ');
16
- }
17
-
18
- export function getSvedaModelDisplayName(model: string | null | undefined): string {
19
- if (!model) {
20
- return '—';
21
- }
22
-
23
- return humanizeModelId(model);
24
- }
@@ -1,31 +0,0 @@
1
- type ToolPart = {
2
- type?: string;
3
- toolCallId?: string;
4
- confirmation?: string;
5
- };
6
-
7
- type ToolMessage = {
8
- parts?: ToolPart[];
9
- };
10
-
11
- export function hasPendingToolConfirmation(messages: ToolMessage[] | null | undefined): boolean {
12
- const resolved = new Set<string>();
13
- for (const message of messages ?? []) {
14
- for (const part of message.parts ?? []) {
15
- if (part.type === 'tool-result' && part.toolCallId) {
16
- resolved.add(part.toolCallId);
17
- }
18
- }
19
- }
20
-
21
- return (messages ?? []).some(message =>
22
- (message.parts ?? []).some(
23
- part =>
24
- part.type === 'tool-call' &&
25
- part.confirmation === 'required' &&
26
- typeof part.toolCallId === 'string' &&
27
- part.toolCallId !== '' &&
28
- !resolved.has(part.toolCallId)
29
- )
30
- );
31
- }
@@ -1,55 +0,0 @@
1
- export type SvedaUserMessageLike = {
2
- role?: string;
3
- content?: string;
4
- attachmentNames?: string[];
5
- metadata?: {
6
- attachmentNames?: string[];
7
- };
8
- parts?: Array<{
9
- type?: string;
10
- text?: string;
11
- name?: string;
12
- }>;
13
- };
14
-
15
- export const getUserMessageText = (message: SvedaUserMessageLike): string => {
16
- if (typeof message.content === 'string' && message.content.trim()) {
17
- return message.content.trim();
18
- }
19
-
20
- if (!Array.isArray(message.parts)) {
21
- return '';
22
- }
23
-
24
- return message.parts
25
- .filter(part => part?.type === 'text')
26
- .map(part => String(part.text || '').trim())
27
- .filter(Boolean)
28
- .join(' ');
29
- };
30
-
31
- export const getUserMessageAttachmentNames = (message: SvedaUserMessageLike): string[] => {
32
- const raw = message.attachmentNames ?? message.metadata?.attachmentNames;
33
- if (Array.isArray(raw)) {
34
- return raw.map(name => String(name).trim()).filter(Boolean);
35
- }
36
-
37
- if (!Array.isArray(message.parts)) {
38
- return [];
39
- }
40
-
41
- return message.parts
42
- .filter(part => part?.type === 'file')
43
- .map(part => String(part.name || '').trim())
44
- .filter(Boolean);
45
- };
46
-
47
- export const userMessageHasVisibleContent = (message: SvedaUserMessageLike): boolean => {
48
- if (message.role !== 'user') {
49
- return false;
50
- }
51
-
52
- return (
53
- getUserMessageText(message).length > 0 || getUserMessageAttachmentNames(message).length > 0
54
- );
55
- };