@meistrari/chat-nuxt 4.4.0-rc.3 → 4.4.0-rc.4
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/dist/module.json +1 -1
- package/dist/runtime/conversations/components/chat-new-conversation-modal.d.vue.ts +1 -1
- package/dist/runtime/conversations/components/chat-new-conversation-modal.vue.d.ts +1 -1
- package/dist/runtime/embed/components/chat-topbar.d.vue.ts +2 -2
- package/dist/runtime/embed/components/chat-topbar.vue.d.ts +2 -2
- package/dist/runtime/embed/components/mobile/chat-mobile-header.d.vue.ts +6 -6
- package/dist/runtime/embed/components/mobile/chat-mobile-header.vue.d.ts +6 -6
- package/dist/runtime/embed/components/mobile/chat-mobile-shell.d.vue.ts +9 -9
- package/dist/runtime/embed/components/mobile/chat-mobile-shell.vue.d.ts +9 -9
- package/dist/runtime/files/composables/file-drop.d.ts +2 -8
- package/dist/runtime/files/composables/file-drop.js +3 -31
- package/dist/runtime/files/composables/file-upload.js +46 -15
- package/dist/runtime/messages/components/chat-context-config.vue +4 -17
- package/dist/runtime/messages/components/chat-message-input.vue +7 -27
- package/dist/runtime/messages/components/widgets/chat-tool-section.d.vue.ts +1 -1
- package/dist/runtime/messages/components/widgets/chat-tool-section.vue.d.ts +1 -1
- package/package.json +1 -1
- package/dist/runtime/files/file-limits.d.ts +0 -2
- package/dist/runtime/files/file-limits.js +0 -2
package/dist/module.json
CHANGED
|
@@ -6,8 +6,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
6
6
|
} & {
|
|
7
7
|
create: (canvasTools: CanvasTool[]) => any;
|
|
8
8
|
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
9
|
-
onCreate?: ((canvasTools: CanvasTool[]) => any) | undefined;
|
|
10
9
|
"onUpdate:modelValue"?: ((value: boolean | undefined) => any) | undefined;
|
|
10
|
+
onCreate?: ((canvasTools: CanvasTool[]) => any) | undefined;
|
|
11
11
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
12
|
declare const _default: typeof __VLS_export;
|
|
13
13
|
export default _default;
|
|
@@ -6,8 +6,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
6
6
|
} & {
|
|
7
7
|
create: (canvasTools: CanvasTool[]) => any;
|
|
8
8
|
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
9
|
-
onCreate?: ((canvasTools: CanvasTool[]) => any) | undefined;
|
|
10
9
|
"onUpdate:modelValue"?: ((value: boolean | undefined) => any) | undefined;
|
|
10
|
+
onCreate?: ((canvasTools: CanvasTool[]) => any) | undefined;
|
|
11
11
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
12
|
declare const _default: typeof __VLS_export;
|
|
13
13
|
export default _default;
|
|
@@ -16,10 +16,10 @@ type __VLS_Props = {
|
|
|
16
16
|
};
|
|
17
17
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
18
18
|
delete: () => any;
|
|
19
|
-
copyLink: () => any;
|
|
20
19
|
rename: () => any;
|
|
21
20
|
duplicate: () => any;
|
|
22
21
|
export: () => any;
|
|
22
|
+
copyLink: () => any;
|
|
23
23
|
debug: () => any;
|
|
24
24
|
tabChange: (tab: TopbarTab) => any;
|
|
25
25
|
cancelEditing: () => any;
|
|
@@ -28,10 +28,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
28
28
|
"update:isEditing": (value: boolean) => any;
|
|
29
29
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
30
30
|
onDelete?: (() => any) | undefined;
|
|
31
|
-
onCopyLink?: (() => any) | undefined;
|
|
32
31
|
onRename?: (() => any) | undefined;
|
|
33
32
|
onDuplicate?: (() => any) | undefined;
|
|
34
33
|
onExport?: (() => any) | undefined;
|
|
34
|
+
onCopyLink?: (() => any) | undefined;
|
|
35
35
|
onDebug?: (() => any) | undefined;
|
|
36
36
|
onTabChange?: ((tab: TopbarTab) => any) | undefined;
|
|
37
37
|
onCancelEditing?: (() => any) | undefined;
|
|
@@ -16,10 +16,10 @@ type __VLS_Props = {
|
|
|
16
16
|
};
|
|
17
17
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
18
18
|
delete: () => any;
|
|
19
|
-
copyLink: () => any;
|
|
20
19
|
rename: () => any;
|
|
21
20
|
duplicate: () => any;
|
|
22
21
|
export: () => any;
|
|
22
|
+
copyLink: () => any;
|
|
23
23
|
debug: () => any;
|
|
24
24
|
tabChange: (tab: TopbarTab) => any;
|
|
25
25
|
cancelEditing: () => any;
|
|
@@ -28,10 +28,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
28
28
|
"update:isEditing": (value: boolean) => any;
|
|
29
29
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
30
30
|
onDelete?: (() => any) | undefined;
|
|
31
|
-
onCopyLink?: (() => any) | undefined;
|
|
32
31
|
onRename?: (() => any) | undefined;
|
|
33
32
|
onDuplicate?: (() => any) | undefined;
|
|
34
33
|
onExport?: (() => any) | undefined;
|
|
34
|
+
onCopyLink?: (() => any) | undefined;
|
|
35
35
|
onDebug?: (() => any) | undefined;
|
|
36
36
|
onTabChange?: ((tab: TopbarTab) => any) | undefined;
|
|
37
37
|
onCancelEditing?: (() => any) | undefined;
|
|
@@ -15,22 +15,22 @@ type __VLS_Props = {
|
|
|
15
15
|
};
|
|
16
16
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
17
17
|
delete: () => any;
|
|
18
|
-
openDrawer: () => any;
|
|
19
|
-
copyLink: () => any;
|
|
20
|
-
openOutdatedSettings: () => any;
|
|
21
18
|
rename: () => any;
|
|
22
19
|
duplicate: () => any;
|
|
23
20
|
export: () => any;
|
|
21
|
+
copyLink: () => any;
|
|
22
|
+
openDrawer: () => any;
|
|
23
|
+
openOutdatedSettings: () => any;
|
|
24
24
|
debug: () => any;
|
|
25
25
|
tabChange: (tab: TopbarTab) => any;
|
|
26
26
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
27
27
|
onDelete?: (() => any) | undefined;
|
|
28
|
-
onOpenDrawer?: (() => any) | undefined;
|
|
29
|
-
onCopyLink?: (() => any) | undefined;
|
|
30
|
-
onOpenOutdatedSettings?: (() => any) | undefined;
|
|
31
28
|
onRename?: (() => any) | undefined;
|
|
32
29
|
onDuplicate?: (() => any) | undefined;
|
|
33
30
|
onExport?: (() => any) | undefined;
|
|
31
|
+
onCopyLink?: (() => any) | undefined;
|
|
32
|
+
onOpenDrawer?: (() => any) | undefined;
|
|
33
|
+
onOpenOutdatedSettings?: (() => any) | undefined;
|
|
34
34
|
onDebug?: (() => any) | undefined;
|
|
35
35
|
onTabChange?: ((tab: TopbarTab) => any) | undefined;
|
|
36
36
|
}>, {
|
|
@@ -15,22 +15,22 @@ type __VLS_Props = {
|
|
|
15
15
|
};
|
|
16
16
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
17
17
|
delete: () => any;
|
|
18
|
-
openDrawer: () => any;
|
|
19
|
-
copyLink: () => any;
|
|
20
|
-
openOutdatedSettings: () => any;
|
|
21
18
|
rename: () => any;
|
|
22
19
|
duplicate: () => any;
|
|
23
20
|
export: () => any;
|
|
21
|
+
copyLink: () => any;
|
|
22
|
+
openDrawer: () => any;
|
|
23
|
+
openOutdatedSettings: () => any;
|
|
24
24
|
debug: () => any;
|
|
25
25
|
tabChange: (tab: TopbarTab) => any;
|
|
26
26
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
27
27
|
onDelete?: (() => any) | undefined;
|
|
28
|
-
onOpenDrawer?: (() => any) | undefined;
|
|
29
|
-
onCopyLink?: (() => any) | undefined;
|
|
30
|
-
onOpenOutdatedSettings?: (() => any) | undefined;
|
|
31
28
|
onRename?: (() => any) | undefined;
|
|
32
29
|
onDuplicate?: (() => any) | undefined;
|
|
33
30
|
onExport?: (() => any) | undefined;
|
|
31
|
+
onCopyLink?: (() => any) | undefined;
|
|
32
|
+
onOpenDrawer?: (() => any) | undefined;
|
|
33
|
+
onOpenOutdatedSettings?: (() => any) | undefined;
|
|
34
34
|
onDebug?: (() => any) | undefined;
|
|
35
35
|
onTabChange?: ((tab: TopbarTab) => any) | undefined;
|
|
36
36
|
}>, {
|
|
@@ -61,12 +61,13 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
61
61
|
} & {
|
|
62
62
|
delete: () => any;
|
|
63
63
|
cancel: () => any;
|
|
64
|
-
settings: () => any;
|
|
65
|
-
send: (content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any;
|
|
66
|
-
copyLink: () => any;
|
|
67
64
|
rename: () => any;
|
|
68
65
|
duplicate: () => any;
|
|
69
66
|
export: () => any;
|
|
67
|
+
copyLink: () => any;
|
|
68
|
+
selectConversation: (id: string) => any;
|
|
69
|
+
settings: () => any;
|
|
70
|
+
send: (content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any;
|
|
70
71
|
debug: () => any;
|
|
71
72
|
tabChange: (tab: TopbarTab) => any;
|
|
72
73
|
newConversation: (groupId?: string | null | undefined) => any;
|
|
@@ -75,21 +76,21 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
75
76
|
cancelEditing: () => any;
|
|
76
77
|
dismissOutdatedBanner: () => any;
|
|
77
78
|
saveTitle: () => any;
|
|
78
|
-
selectConversation: (id: string) => any;
|
|
79
79
|
"update:drawerOpen": (value: boolean) => any;
|
|
80
80
|
"update:editTitle": (value: string) => any;
|
|
81
81
|
"update:workspaceSheetOpen": (value: boolean) => any;
|
|
82
82
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
83
83
|
onDelete?: (() => any) | undefined;
|
|
84
84
|
onCancel?: (() => any) | undefined;
|
|
85
|
+
onRename?: (() => any) | undefined;
|
|
86
|
+
onDuplicate?: (() => any) | undefined;
|
|
87
|
+
onExport?: (() => any) | undefined;
|
|
88
|
+
onCopyLink?: (() => any) | undefined;
|
|
89
|
+
onSelectConversation?: ((id: string) => any) | undefined;
|
|
85
90
|
onSettings?: (() => any) | undefined;
|
|
86
91
|
onSend?: ((content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any) | undefined;
|
|
87
92
|
"onUpdate:selectedModel"?: ((value: string | null) => any) | undefined;
|
|
88
93
|
"onUpdate:selectedReasoningEffort"?: ((value: any) => any) | undefined;
|
|
89
|
-
onCopyLink?: (() => any) | undefined;
|
|
90
|
-
onRename?: (() => any) | undefined;
|
|
91
|
-
onDuplicate?: (() => any) | undefined;
|
|
92
|
-
onExport?: (() => any) | undefined;
|
|
93
94
|
onDebug?: (() => any) | undefined;
|
|
94
95
|
onTabChange?: ((tab: TopbarTab) => any) | undefined;
|
|
95
96
|
onNewConversation?: ((groupId?: string | null | undefined) => any) | undefined;
|
|
@@ -98,7 +99,6 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
98
99
|
onCancelEditing?: (() => any) | undefined;
|
|
99
100
|
onDismissOutdatedBanner?: (() => any) | undefined;
|
|
100
101
|
onSaveTitle?: (() => any) | undefined;
|
|
101
|
-
onSelectConversation?: ((id: string) => any) | undefined;
|
|
102
102
|
"onUpdate:drawerOpen"?: ((value: boolean) => any) | undefined;
|
|
103
103
|
"onUpdate:editTitle"?: ((value: string) => any) | undefined;
|
|
104
104
|
"onUpdate:workspaceSheetOpen"?: ((value: boolean) => any) | undefined;
|
|
@@ -61,12 +61,13 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
61
61
|
} & {
|
|
62
62
|
delete: () => any;
|
|
63
63
|
cancel: () => any;
|
|
64
|
-
settings: () => any;
|
|
65
|
-
send: (content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any;
|
|
66
|
-
copyLink: () => any;
|
|
67
64
|
rename: () => any;
|
|
68
65
|
duplicate: () => any;
|
|
69
66
|
export: () => any;
|
|
67
|
+
copyLink: () => any;
|
|
68
|
+
selectConversation: (id: string) => any;
|
|
69
|
+
settings: () => any;
|
|
70
|
+
send: (content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any;
|
|
70
71
|
debug: () => any;
|
|
71
72
|
tabChange: (tab: TopbarTab) => any;
|
|
72
73
|
newConversation: (groupId?: string | null | undefined) => any;
|
|
@@ -75,21 +76,21 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
75
76
|
cancelEditing: () => any;
|
|
76
77
|
dismissOutdatedBanner: () => any;
|
|
77
78
|
saveTitle: () => any;
|
|
78
|
-
selectConversation: (id: string) => any;
|
|
79
79
|
"update:drawerOpen": (value: boolean) => any;
|
|
80
80
|
"update:editTitle": (value: string) => any;
|
|
81
81
|
"update:workspaceSheetOpen": (value: boolean) => any;
|
|
82
82
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
83
83
|
onDelete?: (() => any) | undefined;
|
|
84
84
|
onCancel?: (() => any) | undefined;
|
|
85
|
+
onRename?: (() => any) | undefined;
|
|
86
|
+
onDuplicate?: (() => any) | undefined;
|
|
87
|
+
onExport?: (() => any) | undefined;
|
|
88
|
+
onCopyLink?: (() => any) | undefined;
|
|
89
|
+
onSelectConversation?: ((id: string) => any) | undefined;
|
|
85
90
|
onSettings?: (() => any) | undefined;
|
|
86
91
|
onSend?: ((content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any) | undefined;
|
|
87
92
|
"onUpdate:selectedModel"?: ((value: string | null) => any) | undefined;
|
|
88
93
|
"onUpdate:selectedReasoningEffort"?: ((value: any) => any) | undefined;
|
|
89
|
-
onCopyLink?: (() => any) | undefined;
|
|
90
|
-
onRename?: (() => any) | undefined;
|
|
91
|
-
onDuplicate?: (() => any) | undefined;
|
|
92
|
-
onExport?: (() => any) | undefined;
|
|
93
94
|
onDebug?: (() => any) | undefined;
|
|
94
95
|
onTabChange?: ((tab: TopbarTab) => any) | undefined;
|
|
95
96
|
onNewConversation?: ((groupId?: string | null | undefined) => any) | undefined;
|
|
@@ -98,7 +99,6 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
98
99
|
onCancelEditing?: (() => any) | undefined;
|
|
99
100
|
onDismissOutdatedBanner?: (() => any) | undefined;
|
|
100
101
|
onSaveTitle?: (() => any) | undefined;
|
|
101
|
-
onSelectConversation?: ((id: string) => any) | undefined;
|
|
102
102
|
"onUpdate:drawerOpen"?: ((value: boolean) => any) | undefined;
|
|
103
103
|
"onUpdate:editTitle"?: ((value: string) => any) | undefined;
|
|
104
104
|
"onUpdate:workspaceSheetOpen"?: ((value: boolean) => any) | undefined;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
1
2
|
export declare function useFileDrop(options?: {
|
|
2
|
-
maxFiles?: number;
|
|
3
|
-
maxFileSize?: number;
|
|
4
3
|
onDrop?: (files: File[]) => void;
|
|
5
|
-
onFilesRejected?: (rejectedFiles: {
|
|
6
|
-
file: File;
|
|
7
|
-
reason: 'size' | 'limit';
|
|
8
|
-
}[]) => void;
|
|
9
4
|
}): {
|
|
10
|
-
isDragging:
|
|
11
|
-
rejectedFiles: any;
|
|
5
|
+
isDragging: Readonly<Ref<boolean, boolean>>;
|
|
12
6
|
setupDropZone: (element: Ref<HTMLElement | null>) => void;
|
|
13
7
|
handleDragEnter: (e: DragEvent) => void;
|
|
14
8
|
handleDragLeave: (e: DragEvent) => void;
|
|
@@ -1,32 +1,8 @@
|
|
|
1
|
+
import { readonly, ref, watchEffect } from "vue";
|
|
1
2
|
export function useFileDrop(options = {}) {
|
|
2
|
-
const {
|
|
3
|
-
maxFiles = 5,
|
|
4
|
-
maxFileSize = 10 * 1024 * 1024,
|
|
5
|
-
onDrop,
|
|
6
|
-
onFilesRejected
|
|
7
|
-
} = options;
|
|
3
|
+
const { onDrop } = options;
|
|
8
4
|
const isDragging = ref(false);
|
|
9
5
|
const dragCounter = ref(0);
|
|
10
|
-
const rejectedFiles = ref([]);
|
|
11
|
-
function validateFiles(files) {
|
|
12
|
-
const rejected = [];
|
|
13
|
-
const valid = [];
|
|
14
|
-
for (const file of files) {
|
|
15
|
-
if (file.size > maxFileSize) {
|
|
16
|
-
console.warn(`File ${file.name} exceeds max size of ${maxFileSize} bytes`);
|
|
17
|
-
rejected.push({ file, reason: "size" });
|
|
18
|
-
} else if (valid.length >= maxFiles) {
|
|
19
|
-
rejected.push({ file, reason: "limit" });
|
|
20
|
-
} else {
|
|
21
|
-
valid.push(file);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
if (rejected.length > 0) {
|
|
25
|
-
rejectedFiles.value = rejected;
|
|
26
|
-
onFilesRejected?.(rejected);
|
|
27
|
-
}
|
|
28
|
-
return valid;
|
|
29
|
-
}
|
|
30
6
|
function handleDragEnter(e) {
|
|
31
7
|
e.preventDefault();
|
|
32
8
|
e.stopPropagation();
|
|
@@ -55,10 +31,7 @@ export function useFileDrop(options = {}) {
|
|
|
55
31
|
const files = Array.from(e.dataTransfer?.files ?? []);
|
|
56
32
|
if (files.length === 0)
|
|
57
33
|
return;
|
|
58
|
-
|
|
59
|
-
if (validFiles.length > 0 && onDrop) {
|
|
60
|
-
onDrop(validFiles);
|
|
61
|
-
}
|
|
34
|
+
onDrop?.(files);
|
|
62
35
|
}
|
|
63
36
|
function setupDropZone(element) {
|
|
64
37
|
watchEffect((onCleanup) => {
|
|
@@ -79,7 +52,6 @@ export function useFileDrop(options = {}) {
|
|
|
79
52
|
}
|
|
80
53
|
return {
|
|
81
54
|
isDragging: readonly(isDragging),
|
|
82
|
-
rejectedFiles: readonly(rejectedFiles),
|
|
83
55
|
setupDropZone,
|
|
84
56
|
handleDragEnter,
|
|
85
57
|
handleDragLeave,
|
|
@@ -1,33 +1,64 @@
|
|
|
1
1
|
export function useFileUpload() {
|
|
2
2
|
const uploading = ref(false);
|
|
3
3
|
const uploadError = ref(null);
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
const uploads = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
const waiting = [];
|
|
6
|
+
let activeUploads = 0;
|
|
7
|
+
let activeBatches = 0;
|
|
8
|
+
function uploadFile(file) {
|
|
9
|
+
const existing = uploads.get(file);
|
|
10
|
+
if (existing)
|
|
11
|
+
return existing;
|
|
12
|
+
const slot = new Promise((resolve) => {
|
|
13
|
+
if (activeUploads < 4) {
|
|
14
|
+
activeUploads++;
|
|
15
|
+
resolve();
|
|
16
|
+
} else {
|
|
17
|
+
waiting.push(resolve);
|
|
18
|
+
}
|
|
10
19
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
const upload = slot.then(async () => {
|
|
21
|
+
try {
|
|
22
|
+
const formData = new FormData();
|
|
23
|
+
formData.append("file", file);
|
|
24
|
+
const { vaultReference, url, mimeType, size } = await $fetch("/api/vault/upload", {
|
|
25
|
+
method: "POST",
|
|
26
|
+
body: formData
|
|
27
|
+
});
|
|
28
|
+
return { url, name: file.name, mimeType, vaultReference, size };
|
|
29
|
+
} finally {
|
|
30
|
+
const next = waiting.shift();
|
|
31
|
+
if (next)
|
|
32
|
+
next();
|
|
33
|
+
else
|
|
34
|
+
activeUploads--;
|
|
35
|
+
}
|
|
36
|
+
}).catch((error) => {
|
|
37
|
+
uploads.delete(file);
|
|
38
|
+
throw error;
|
|
39
|
+
});
|
|
40
|
+
uploads.set(file, upload);
|
|
41
|
+
return upload;
|
|
18
42
|
}
|
|
19
43
|
async function uploadFiles(files) {
|
|
20
44
|
if (files.length === 0)
|
|
21
45
|
return [];
|
|
46
|
+
activeBatches++;
|
|
22
47
|
uploading.value = true;
|
|
23
48
|
uploadError.value = null;
|
|
24
49
|
try {
|
|
25
|
-
|
|
50
|
+
const results = await Promise.allSettled(files.map((file) => uploadFile(file)));
|
|
51
|
+
return results.map((result) => {
|
|
52
|
+
if (result.status === "rejected")
|
|
53
|
+
throw result.reason;
|
|
54
|
+
return result.value;
|
|
55
|
+
});
|
|
26
56
|
} catch (err) {
|
|
27
57
|
uploadError.value = err instanceof Error ? err.message : "Erro ao fazer upload dos arquivos";
|
|
28
58
|
throw err;
|
|
29
59
|
} finally {
|
|
30
|
-
|
|
60
|
+
activeBatches--;
|
|
61
|
+
uploading.value = activeBatches > 0;
|
|
31
62
|
}
|
|
32
63
|
}
|
|
33
64
|
return {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { useFileUpload } from "../../files/composables/file-upload";
|
|
3
|
-
import { MAX_FILES, MAX_FILE_SIZE } from "../../files/file-limits";
|
|
4
3
|
import { formatFileSize } from "../../files/formatting";
|
|
5
4
|
import { useTela } from "../../shared/composables/tela";
|
|
6
5
|
const props = defineProps({
|
|
@@ -71,16 +70,11 @@ const displayCanvasTools = computed(
|
|
|
71
70
|
const displayKnowledgeSources = computed(
|
|
72
71
|
() => pendingKnowledgeSources.value !== null ? pendingKnowledgeSources.value : props.knowledgeSources
|
|
73
72
|
);
|
|
74
|
-
const currentFileCount = computed(
|
|
75
|
-
() => (props.contextFiles?.length ?? 0) + pendingFiles.value.length
|
|
76
|
-
);
|
|
77
73
|
watch(() => props.systemMessage, (newValue) => {
|
|
78
74
|
localSystemMessage.value = newValue ?? "";
|
|
79
75
|
});
|
|
80
76
|
function addFiles(files) {
|
|
81
|
-
|
|
82
|
-
const availableSlots = MAX_FILES - currentFileCount.value;
|
|
83
|
-
pendingFiles.value = [...pendingFiles.value, ...validFiles.slice(0, availableSlots)];
|
|
77
|
+
pendingFiles.value = [...pendingFiles.value, ...files];
|
|
84
78
|
}
|
|
85
79
|
defineExpose({ addFiles });
|
|
86
80
|
function openFileDialog() {
|
|
@@ -90,14 +84,7 @@ function handleFileSelect(event) {
|
|
|
90
84
|
const target = event.target;
|
|
91
85
|
if (!target.files)
|
|
92
86
|
return;
|
|
93
|
-
|
|
94
|
-
if (file.size > MAX_FILE_SIZE) {
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
return true;
|
|
98
|
-
});
|
|
99
|
-
const availableSlots = MAX_FILES - currentFileCount.value;
|
|
100
|
-
pendingFiles.value = [...pendingFiles.value, ...newFiles.slice(0, availableSlots)];
|
|
87
|
+
addFiles(Array.from(target.files));
|
|
101
88
|
target.value = "";
|
|
102
89
|
}
|
|
103
90
|
function removePendingFile(index) {
|
|
@@ -235,8 +222,8 @@ function handleCancelClearThread() {
|
|
|
235
222
|
<button
|
|
236
223
|
flex items-center gap-8px px-14px py-10px rounded-10px b="1px dashed gray-300" text-14px
|
|
237
224
|
text-gray-500 hover:bg-gray-50 hover:b-gray-400 transition cursor-pointer
|
|
238
|
-
:disabled="disabled
|
|
239
|
-
|
|
225
|
+
:disabled="disabled"
|
|
226
|
+
@click="openFileDialog"
|
|
240
227
|
>
|
|
241
228
|
<div i-ph-plus text-16px />
|
|
242
229
|
<span>Adicionar arquivo</span>
|
|
@@ -3,7 +3,6 @@ import ChatModelSelector from "./chat-model-selector.vue";
|
|
|
3
3
|
import { inject, unref } from "vue";
|
|
4
4
|
import { CHAT_COMPOSER_EXTENSION_KEY } from "../../types/composer";
|
|
5
5
|
import { useFileUpload } from "../../files/composables/file-upload";
|
|
6
|
-
import { MAX_FILE_SIZE, MAX_FILES } from "../../files/file-limits";
|
|
7
6
|
import { useInputHistory } from "../composables/input-history";
|
|
8
7
|
import { appendAttachmentMentions, useMentionAutocomplete } from "../composables/mention-autocomplete";
|
|
9
8
|
import { getAgentInputReadiness } from "../input-readiness";
|
|
@@ -157,13 +156,7 @@ function handleFileSelect(event) {
|
|
|
157
156
|
const target = event.target;
|
|
158
157
|
if (!target.files)
|
|
159
158
|
return;
|
|
160
|
-
|
|
161
|
-
if (file.size > MAX_FILE_SIZE) {
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
return true;
|
|
165
|
-
});
|
|
166
|
-
queueFiles(newFiles, selectedUploadInputName.value);
|
|
159
|
+
addFiles(Array.from(target.files), selectedUploadInputName.value);
|
|
167
160
|
selectedUploadInputName.value = void 0;
|
|
168
161
|
target.value = "";
|
|
169
162
|
}
|
|
@@ -183,14 +176,11 @@ function createUploadedPendingFile(file, inputName) {
|
|
|
183
176
|
inputName
|
|
184
177
|
};
|
|
185
178
|
}
|
|
186
|
-
function
|
|
187
|
-
const availableSlots = MAX_FILES - pendingFiles.value.length;
|
|
188
|
-
if (availableSlots <= 0)
|
|
189
|
-
return;
|
|
179
|
+
function addFiles(files, inputName) {
|
|
190
180
|
const mappedInputName = inputName ?? defaultFileInputName.value;
|
|
191
181
|
pendingFiles.value = [
|
|
192
182
|
...pendingFiles.value,
|
|
193
|
-
...files.
|
|
183
|
+
...files.map((file) => createPendingFile(file, mappedInputName))
|
|
194
184
|
];
|
|
195
185
|
}
|
|
196
186
|
function removeFile(id) {
|
|
@@ -469,15 +459,6 @@ function insertMentionFromMenu(item) {
|
|
|
469
459
|
editorRef.value?.focus();
|
|
470
460
|
});
|
|
471
461
|
}
|
|
472
|
-
function addFiles(files, inputName) {
|
|
473
|
-
const validFiles = files.filter((file) => {
|
|
474
|
-
if (file.size > MAX_FILE_SIZE) {
|
|
475
|
-
return false;
|
|
476
|
-
}
|
|
477
|
-
return true;
|
|
478
|
-
});
|
|
479
|
-
queueFiles(validFiles, inputName);
|
|
480
|
-
}
|
|
481
462
|
function restoreDraft(draft) {
|
|
482
463
|
setDraft(draft.content);
|
|
483
464
|
const textInputs = (draft.agentInputs ?? []).filter((input) => input.type === "text");
|
|
@@ -485,12 +466,11 @@ function restoreDraft(draft) {
|
|
|
485
466
|
...agentInputTexts.value,
|
|
486
467
|
...Object.fromEntries(textInputs.map((input) => [input.name, input.content]))
|
|
487
468
|
};
|
|
488
|
-
|
|
489
|
-
if (availableSlots <= 0 || !draft.files?.length)
|
|
469
|
+
if (!draft.files?.length)
|
|
490
470
|
return;
|
|
491
471
|
const fileInputs = (draft.agentInputs ?? []).filter((input) => input.type === "file");
|
|
492
472
|
const claimedInputs = /* @__PURE__ */ new Set();
|
|
493
|
-
const restoredFiles = draft.files.
|
|
473
|
+
const restoredFiles = draft.files.map((file) => {
|
|
494
474
|
const vaultRef = getVaultRef(file);
|
|
495
475
|
const inputIndex = fileInputs.findIndex(
|
|
496
476
|
(input, index) => !claimedInputs.has(index) && input.vaultRef === vaultRef
|
|
@@ -626,7 +606,7 @@ defineExpose({
|
|
|
626
606
|
color="secondary"
|
|
627
607
|
class="rounded-8px! p-4px!"
|
|
628
608
|
icon-class="text-gray-400 text-16px"
|
|
629
|
-
:disabled="isLocked
|
|
609
|
+
:disabled="isLocked"
|
|
630
610
|
@click.stop="openFileDialog(input.name)"
|
|
631
611
|
/>
|
|
632
612
|
</TelaTooltip>
|
|
@@ -727,7 +707,7 @@ defineExpose({
|
|
|
727
707
|
<TelaChatPromptInputActionMenuContent>
|
|
728
708
|
<TelaChatPromptInputActionMenuItem
|
|
729
709
|
icon="i-ph-paperclip"
|
|
730
|
-
:disabled="isLocked
|
|
710
|
+
:disabled="isLocked"
|
|
731
711
|
@click="openFileDialog()"
|
|
732
712
|
>
|
|
733
713
|
Adicionar arquivos ou fotos
|
|
@@ -10,8 +10,8 @@ type __VLS_Slots = {} & {
|
|
|
10
10
|
};
|
|
11
11
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
12
12
|
flush: boolean;
|
|
13
|
-
limit: "input" | "output" | "none";
|
|
14
13
|
tone: "mono" | "prose" | "error";
|
|
14
|
+
limit: "input" | "output" | "none";
|
|
15
15
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
16
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
17
17
|
declare const _default: typeof __VLS_export;
|
|
@@ -10,8 +10,8 @@ type __VLS_Slots = {} & {
|
|
|
10
10
|
};
|
|
11
11
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
12
12
|
flush: boolean;
|
|
13
|
-
limit: "input" | "output" | "none";
|
|
14
13
|
tone: "mono" | "prose" | "error";
|
|
14
|
+
limit: "input" | "output" | "none";
|
|
15
15
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
16
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
17
17
|
declare const _default: typeof __VLS_export;
|
package/package.json
CHANGED