@meistrari/chat-nuxt 1.1.2 → 1.2.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 +95 -11
- package/dist/module.d.mts +5 -0
- package/dist/module.json +2 -2
- package/dist/module.mjs +96 -23
- package/dist/runtime/components/chat/conversation-list.d.vue.ts +1 -0
- package/dist/runtime/components/chat/conversation-list.vue +22 -2
- package/dist/runtime/components/chat/conversation-list.vue.d.ts +1 -0
- package/dist/runtime/components/chat/message-list.d.vue.ts +1 -0
- package/dist/runtime/components/chat/message-list.vue +23 -2
- package/dist/runtime/components/chat/message-list.vue.d.ts +1 -0
- package/dist/runtime/composables/useChat.d.ts +2 -1
- package/dist/runtime/composables/useChat.js +32 -3
- package/dist/runtime/composables/useChatApi.js +2 -1
- package/dist/runtime/composables/useConversations.d.ts +3 -2
- package/dist/runtime/composables/useConversations.js +99 -11
- package/dist/runtime/composables/useEmbedConfig.d.ts +11 -6
- package/dist/runtime/composables/useEmbedConfig.js +35 -7
- package/dist/runtime/composables/useIDB.js +4 -0
- package/dist/runtime/composables/usePdf.d.ts +840 -1
- package/dist/runtime/composables/usePdf.js +21 -3
- package/dist/runtime/composables/useWorkspaceContextFiles.d.ts +3 -3
- package/dist/runtime/composables/useWorkspaceContextFiles.js +19 -10
- package/dist/runtime/composables/useWorkspaceCredentials.d.ts +3 -3
- package/dist/runtime/composables/useWorkspaceExternalSkills.d.ts +1 -1
- package/dist/runtime/composables/useWorkspaceExternalSkills.js +5 -6
- package/dist/runtime/composables/useWorkspacePersonalization.d.ts +1 -1
- package/dist/runtime/composables/useWorkspacePersonalization.js +4 -5
- package/dist/runtime/composables/useWorkspaceSettings.js +12 -9
- package/dist/runtime/embed/components/ChatConfigurationModal.d.vue.ts +25 -0
- package/dist/runtime/embed/components/ChatConfigurationModal.vue +373 -0
- package/dist/runtime/embed/components/ChatConfigurationModal.vue.d.ts +25 -0
- package/dist/runtime/embed/components/ChatEmbed.vue +12 -1
- package/dist/runtime/embed/components/ChatEmbedInner.vue +31 -16
- package/dist/runtime/embed/components/configuration/ChatConfigurationContextFilesTab.d.vue.ts +22 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationContextFilesTab.vue +133 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationContextFilesTab.vue.d.ts +22 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationCredentialsTab.d.vue.ts +10 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationCredentialsTab.vue +220 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationCredentialsTab.vue.d.ts +10 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationExternalSkillsTab.d.vue.ts +32 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationExternalSkillsTab.vue +222 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationExternalSkillsTab.vue.d.ts +32 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationKnowledgeSourcesTab.d.vue.ts +18 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationKnowledgeSourcesTab.vue +142 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationKnowledgeSourcesTab.vue.d.ts +18 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationPersonalizationTab.d.vue.ts +10 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationPersonalizationTab.vue +37 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationPersonalizationTab.vue.d.ts +10 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationTelaToolsTab.d.vue.ts +20 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationTelaToolsTab.vue +146 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationTelaToolsTab.vue.d.ts +20 -0
- package/dist/runtime/server/api/admin/trigger-usage-report.post.d.ts +4 -1
- package/dist/runtime/server/api/admin/trigger-usage-report.post.js +2 -0
- package/dist/runtime/server/api/chat/workspace/settings.get.d.ts +1 -1
- package/dist/runtime/server/api/chat/workspace/settings.get.js +1 -0
- package/dist/runtime/server/api/conversations/[id]/cancel.post.d.ts +4 -1
- package/dist/runtime/server/api/conversations/[id]/cancel.post.js +1 -0
- package/dist/runtime/server/api/conversations/[id]/clear.post.d.ts +1 -1
- package/dist/runtime/server/api/conversations/[id]/clear.post.js +1 -0
- package/dist/runtime/server/api/conversations/[id]/duplicate.post.d.ts +1 -1
- package/dist/runtime/server/api/conversations/[id]/duplicate.post.js +46 -12
- package/dist/runtime/server/api/conversations/[id]/files.get.d.ts +1 -1
- package/dist/runtime/server/api/conversations/[id]/files.get.js +2 -0
- package/dist/runtime/server/api/conversations/[id]/index.delete.d.ts +3 -1
- package/dist/runtime/server/api/conversations/[id]/index.delete.js +1 -0
- package/dist/runtime/server/api/conversations/[id]/index.get.d.ts +1 -1
- package/dist/runtime/server/api/conversations/[id]/index.get.js +1 -0
- package/dist/runtime/server/api/conversations/[id]/index.patch.d.ts +1 -1
- package/dist/runtime/server/api/conversations/[id]/index.patch.js +1 -0
- package/dist/runtime/server/api/conversations/[id]/messages/[messageId]/retry.post.d.ts +1 -1
- package/dist/runtime/server/api/conversations/[id]/messages/[messageId]/retry.post.js +2 -0
- package/dist/runtime/server/api/conversations/[id]/messages/index.get.d.ts +14 -1
- package/dist/runtime/server/api/conversations/[id]/messages/index.get.js +2 -0
- package/dist/runtime/server/api/conversations/[id]/messages/index.post.d.ts +4 -1
- package/dist/runtime/server/api/conversations/[id]/messages/index.post.js +2 -0
- package/dist/runtime/server/api/conversations/[id]/usage.get.d.ts +1 -1
- package/dist/runtime/server/api/conversations/[id]/usage.get.js +1 -0
- package/dist/runtime/server/api/conversations/generate-title.post.d.ts +3 -1
- package/dist/runtime/server/api/conversations/generate-title.post.js +2 -0
- package/dist/runtime/server/api/conversations/index.get.d.ts +1 -1
- package/dist/runtime/server/api/conversations/index.get.js +1 -0
- package/dist/runtime/server/api/conversations/index.post.d.ts +1 -1
- package/dist/runtime/server/api/conversations/index.post.js +1 -0
- package/dist/runtime/server/api/external-skills/discover.post.d.ts +1 -1
- package/dist/runtime/server/api/external-skills/discover.post.js +2 -0
- package/dist/runtime/server/api/github/disconnect.post.d.ts +3 -1
- package/dist/runtime/server/api/github/disconnect.post.js +2 -0
- package/dist/runtime/server/api/github/status.get.d.ts +1 -1
- package/dist/runtime/server/api/github/status.get.js +2 -0
- package/dist/runtime/server/api/tela/canvas.get.d.ts +1 -1
- package/dist/runtime/server/api/tela/canvas.get.js +1 -0
- package/dist/runtime/server/api/tela/projects.get.d.ts +1 -1
- package/dist/runtime/server/api/tela/projects.get.js +1 -0
- package/dist/runtime/server/api/tela/workspaces.get.d.ts +1 -1
- package/dist/runtime/server/api/tela/workspaces.get.js +1 -0
- package/dist/runtime/server/api/tela/workstations.get.d.ts +1 -1
- package/dist/runtime/server/api/tela/workstations.get.js +1 -0
- package/dist/runtime/server/api/vault/permalink-metadata.post.d.ts +5 -1
- package/dist/runtime/server/api/vault/permalink-metadata.post.js +2 -0
- package/dist/runtime/server/api/vault/resolve.post.d.ts +9 -1
- package/dist/runtime/server/api/vault/resolve.post.js +2 -0
- package/dist/runtime/server/api/vault/upload.post.d.ts +6 -1
- package/dist/runtime/server/api/vault/upload.post.js +2 -0
- package/dist/runtime/server/api/workspace/credentials/[id].delete.d.ts +3 -1
- package/dist/runtime/server/api/workspace/credentials/[id].delete.js +1 -0
- package/dist/runtime/server/api/workspace/credentials/[id].put.d.ts +1 -1
- package/dist/runtime/server/api/workspace/credentials/[id].put.js +1 -0
- package/dist/runtime/server/api/workspace/credentials/index.get.d.ts +1 -1
- package/dist/runtime/server/api/workspace/credentials/index.get.js +1 -0
- package/dist/runtime/server/api/workspace/credentials/index.post.d.ts +1 -1
- package/dist/runtime/server/api/workspace/credentials/index.post.js +1 -0
- package/dist/runtime/server/api/workspace/settings.get.d.ts +1 -1
- package/dist/runtime/server/api/workspace/settings.get.js +1 -0
- package/dist/runtime/server/api/workspace/settings.patch.d.ts +1 -1
- package/dist/runtime/server/api/workspace/settings.patch.js +1 -0
- package/dist/runtime/server/api/workspace/usage.get.d.ts +1 -1
- package/dist/runtime/server/api/workspace/usage.get.js +1 -0
- package/dist/runtime/server/db/index.js +1 -0
- package/dist/runtime/server/middleware/domain-validation.d.ts +1 -1
- package/dist/runtime/server/middleware/domain-validation.js +2 -0
- package/dist/runtime/server/middleware/request-logger.d.ts +1 -1
- package/dist/runtime/server/middleware/request-logger.js +1 -0
- package/dist/runtime/server/tasks/send-daily-usage-report.d.ts +1 -1
- package/dist/runtime/server/tasks/send-daily-usage-report.js +1 -0
- package/dist/runtime/server/utils/agent-api.d.ts +1 -1
- package/dist/runtime/server/utils/agent-api.js +2 -0
- package/dist/runtime/server/utils/auth-api.js +2 -0
- package/dist/runtime/server/utils/auth.d.ts +1 -1
- package/dist/runtime/server/utils/auth.js +1 -0
- package/dist/runtime/server/utils/tela-api.d.ts +1 -1
- package/dist/runtime/server/utils/tela-api.js +2 -0
- package/dist/runtime/server/utils/workspace.js +1 -0
- package/dist/runtime/types/chat.d.ts +2 -1
- package/dist/runtime/types/workspace-settings.d.ts +3 -0
- package/dist/runtime/types/workspace-settings.js +0 -0
- package/dist/runtime/utils/conversation-list-skeleton.d.ts +31 -0
- package/dist/runtime/utils/conversation-list-skeleton.js +12 -0
- package/dist/runtime/utils/file.js +42 -42
- package/dist/types.d.mts +2 -0
- package/package.json +24 -12
- package/dist/runtime/composables/PageNavigation.d.ts +0 -13
- package/dist/runtime/composables/PageNavigation.js +0 -18
- /package/dist/runtime/components/{TelaChat.d.vue.ts → MeistrariChatEmbed.d.vue.ts} +0 -0
- /package/dist/runtime/components/{TelaChat.vue → MeistrariChatEmbed.vue} +0 -0
- /package/dist/runtime/components/{TelaChat.vue.d.ts → MeistrariChatEmbed.vue.d.ts} +0 -0
- /package/dist/runtime/components/{pdf-preview.d.vue.ts → pdf-preview.client.d.vue.ts} +0 -0
- /package/dist/runtime/components/{pdf-preview.vue → pdf-preview.client.vue} +0 -0
- /package/dist/runtime/components/{pdf-preview.vue.d.ts → pdf-preview.client.vue.d.ts} +0 -0
- /package/dist/runtime/components/{pdf-viewer.d.vue.ts → pdf-viewer.client.d.vue.ts} +0 -0
- /package/dist/runtime/components/{pdf-viewer.vue → pdf-viewer.client.vue} +0 -0
- /package/dist/runtime/components/{pdf-viewer.vue.d.ts → pdf-viewer.client.vue.d.ts} +0 -0
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import * as Sentry from "@sentry/nuxt";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { markRaw, onUnmounted, reactive, watch } from "vue";
|
|
3
|
+
let pdfjsLibPromise = null;
|
|
4
|
+
async function loadPdfjs() {
|
|
5
|
+
if (!import.meta.client)
|
|
6
|
+
return null;
|
|
7
|
+
if (!pdfjsLibPromise) {
|
|
8
|
+
pdfjsLibPromise = import("pdfjs-dist").then((lib) => {
|
|
9
|
+
lib.GlobalWorkerOptions.workerSrc = `https://unpkg.com/pdfjs-dist@${lib.version}/build/pdf.worker.min.mjs`;
|
|
10
|
+
return lib;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return pdfjsLibPromise;
|
|
14
|
+
}
|
|
5
15
|
export function usePdf(url) {
|
|
6
16
|
const state = reactive({
|
|
7
17
|
pdfDoc: null,
|
|
@@ -13,6 +23,11 @@ export function usePdf(url) {
|
|
|
13
23
|
async function loadPdf() {
|
|
14
24
|
if (isUnmounted)
|
|
15
25
|
return null;
|
|
26
|
+
const pdfjsLib = await loadPdfjs();
|
|
27
|
+
if (!pdfjsLib) {
|
|
28
|
+
state.isLoading = false;
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
16
31
|
state.isLoading = true;
|
|
17
32
|
state.loadError = null;
|
|
18
33
|
try {
|
|
@@ -68,6 +83,9 @@ export function usePdf(url) {
|
|
|
68
83
|
async function renderTextLayer(page, viewport, textLayer, highlight, highlightPage, pageNum) {
|
|
69
84
|
if (isUnmounted)
|
|
70
85
|
return;
|
|
86
|
+
const pdfjsLib = await loadPdfjs();
|
|
87
|
+
if (!pdfjsLib)
|
|
88
|
+
return;
|
|
71
89
|
textLayer.innerHTML = "";
|
|
72
90
|
textLayer.style.width = `${viewport.width}px`;
|
|
73
91
|
textLayer.style.height = `${viewport.height}px`;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { ContextFile } from '../server/db/schema.js';
|
|
2
|
-
import type { WorkspaceSettings, WorkspaceSettingsUpdate } from './useWorkspaceSettings.js';
|
|
3
2
|
export declare const MAX_FILES = 10;
|
|
4
3
|
export declare const MAX_FILE_SIZE: number;
|
|
5
|
-
export declare function useWorkspaceContextFiles(searchQuery: Ref<string>, currentContextFiles: Ref<readonly ContextFile[] | null | undefined> | ComputedRef<readonly ContextFile[] | null | undefined
|
|
4
|
+
export declare function useWorkspaceContextFiles(searchQuery: Ref<string>, currentContextFiles: Ref<readonly ContextFile[] | null | undefined> | ComputedRef<readonly ContextFile[] | null | undefined>): {
|
|
6
5
|
pendingFiles: any;
|
|
7
6
|
filteredContextFiles: any;
|
|
8
7
|
filteredPendingFiles: any;
|
|
@@ -11,9 +10,10 @@ export declare function useWorkspaceContextFiles(searchQuery: Ref<string>, curre
|
|
|
11
10
|
maxFiles: number;
|
|
12
11
|
handleFileSelect: (event: Event) => void;
|
|
13
12
|
removePendingFile: (file: File) => void;
|
|
14
|
-
removeContextFile: (url: string) =>
|
|
13
|
+
removeContextFile: (url: string) => void;
|
|
15
14
|
getFileType: (fileName: string) => string;
|
|
16
15
|
initialize: () => void;
|
|
17
16
|
getPendingFiles: () => File[];
|
|
17
|
+
getKeptContextFiles: () => ContextFile[];
|
|
18
18
|
clearPendingFiles: () => void;
|
|
19
19
|
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
export const MAX_FILES = 10;
|
|
2
2
|
export const MAX_FILE_SIZE = 10 * 1024 * 1024;
|
|
3
|
-
export function useWorkspaceContextFiles(searchQuery, currentContextFiles
|
|
3
|
+
export function useWorkspaceContextFiles(searchQuery, currentContextFiles) {
|
|
4
4
|
const pendingFiles = ref([]);
|
|
5
|
+
const removedUrls = ref(/* @__PURE__ */ new Set());
|
|
6
|
+
const effectiveContextFiles = computed(
|
|
7
|
+
() => (currentContextFiles.value ?? []).filter((file) => !removedUrls.value.has(file.url))
|
|
8
|
+
);
|
|
5
9
|
const filteredContextFiles = computed(() => {
|
|
6
|
-
if (!currentContextFiles.value)
|
|
7
|
-
return [];
|
|
8
10
|
if (!searchQuery.value.trim())
|
|
9
|
-
return
|
|
11
|
+
return effectiveContextFiles.value;
|
|
10
12
|
const query = searchQuery.value.toLowerCase();
|
|
11
|
-
return
|
|
13
|
+
return effectiveContextFiles.value.filter(
|
|
12
14
|
(file) => file.name.toLowerCase().includes(query)
|
|
13
15
|
);
|
|
14
16
|
});
|
|
@@ -21,10 +23,10 @@ export function useWorkspaceContextFiles(searchQuery, currentContextFiles, updat
|
|
|
21
23
|
);
|
|
22
24
|
});
|
|
23
25
|
const currentFileCount = computed(
|
|
24
|
-
() =>
|
|
26
|
+
() => effectiveContextFiles.value.length + pendingFiles.value.length
|
|
25
27
|
);
|
|
26
28
|
const hasChanges = computed(
|
|
27
|
-
() => pendingFiles.value.length > 0
|
|
29
|
+
() => pendingFiles.value.length > 0 || removedUrls.value.size > 0
|
|
28
30
|
);
|
|
29
31
|
function handleFileSelect(event) {
|
|
30
32
|
const target = event.target;
|
|
@@ -40,21 +42,27 @@ export function useWorkspaceContextFiles(searchQuery, currentContextFiles, updat
|
|
|
40
42
|
if (idx !== -1)
|
|
41
43
|
pendingFiles.value = pendingFiles.value.filter((_, i) => i !== idx);
|
|
42
44
|
}
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
45
|
+
function removeContextFile(url) {
|
|
46
|
+
const next = new Set(removedUrls.value);
|
|
47
|
+
next.add(url);
|
|
48
|
+
removedUrls.value = next;
|
|
46
49
|
}
|
|
47
50
|
function getFileType(fileName) {
|
|
48
51
|
return fileName.split(".").pop()?.toUpperCase() ?? "";
|
|
49
52
|
}
|
|
50
53
|
function initialize() {
|
|
51
54
|
pendingFiles.value = [];
|
|
55
|
+
removedUrls.value = /* @__PURE__ */ new Set();
|
|
52
56
|
}
|
|
53
57
|
function getPendingFiles() {
|
|
54
58
|
return [...pendingFiles.value];
|
|
55
59
|
}
|
|
60
|
+
function getKeptContextFiles() {
|
|
61
|
+
return [...effectiveContextFiles.value];
|
|
62
|
+
}
|
|
56
63
|
function clearPendingFiles() {
|
|
57
64
|
pendingFiles.value = [];
|
|
65
|
+
removedUrls.value = /* @__PURE__ */ new Set();
|
|
58
66
|
}
|
|
59
67
|
return {
|
|
60
68
|
pendingFiles: readonly(pendingFiles),
|
|
@@ -69,6 +77,7 @@ export function useWorkspaceContextFiles(searchQuery, currentContextFiles, updat
|
|
|
69
77
|
getFileType,
|
|
70
78
|
initialize,
|
|
71
79
|
getPendingFiles,
|
|
80
|
+
getKeptContextFiles,
|
|
72
81
|
clearPendingFiles
|
|
73
82
|
};
|
|
74
83
|
}
|
|
@@ -2,14 +2,14 @@ import type { WorkspaceCredential } from '../types/credential.js';
|
|
|
2
2
|
export declare function useWorkspaceCredentials(searchQuery?: Ref<string>): {
|
|
3
3
|
credentials: any;
|
|
4
4
|
loading: any;
|
|
5
|
-
fetchCredentials: () => Promise<
|
|
5
|
+
fetchCredentials: () => Promise<WorkspaceCredential[]>;
|
|
6
6
|
createCredential: (payload: {
|
|
7
7
|
key: string;
|
|
8
8
|
value: string;
|
|
9
|
-
}) => Promise<
|
|
9
|
+
}) => Promise<WorkspaceCredential>;
|
|
10
10
|
updateCredential: (id: string, payload: {
|
|
11
11
|
value: string;
|
|
12
|
-
}) => Promise<
|
|
12
|
+
}) => Promise<WorkspaceCredential>;
|
|
13
13
|
deleteCredential: (id: string) => Promise<void>;
|
|
14
14
|
filteredCredentials: any;
|
|
15
15
|
credentialModalOpen: any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExternalSkill } from '../server/db/schema.js';
|
|
2
|
-
export declare function useWorkspaceExternalSkills(searchQuery?: Ref<string>): {
|
|
2
|
+
export declare function useWorkspaceExternalSkills(currentExternalSkills: Ref<readonly ExternalSkill[] | null | undefined> | ComputedRef<readonly ExternalSkill[] | null | undefined>, searchQuery?: Ref<string>): {
|
|
3
3
|
displayedSkills: any;
|
|
4
4
|
filteredSkills: any;
|
|
5
5
|
hasChanges: any;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
export function useWorkspaceExternalSkills(searchQuery) {
|
|
2
|
-
const { settings } = useWorkspaceSettings();
|
|
1
|
+
export function useWorkspaceExternalSkills(currentExternalSkills, searchQuery) {
|
|
3
2
|
const { user } = useTelaApplicationAuth();
|
|
4
3
|
const { connection: skillsConnection, fetchConnection: fetchGitHubConnection, connect: connectGitHub } = useGitHubSkills();
|
|
5
|
-
const pendingSkills =
|
|
6
|
-
const removedRefs =
|
|
4
|
+
const pendingSkills = ref([]);
|
|
5
|
+
const removedRefs = ref([]);
|
|
7
6
|
const skillModalOpen = ref(false);
|
|
8
7
|
const skillRefInput = ref("");
|
|
9
8
|
const skillError = ref("");
|
|
10
9
|
const discoveringSkills = ref(false);
|
|
11
10
|
const displayedSkills = computed(() => {
|
|
12
|
-
const current = (
|
|
11
|
+
const current = (currentExternalSkills.value ?? []).filter((s) => !removedRefs.value.includes(s.ref));
|
|
13
12
|
return [...current, ...pendingSkills.value];
|
|
14
13
|
});
|
|
15
14
|
const filteredSkills = computed(() => {
|
|
@@ -38,7 +37,7 @@ export function useWorkspaceExternalSkills(searchQuery) {
|
|
|
38
37
|
removedRefs.value = [...removedRefs.value, ref2];
|
|
39
38
|
}
|
|
40
39
|
function buildExternalSkills() {
|
|
41
|
-
const currentSkills = (
|
|
40
|
+
const currentSkills = (currentExternalSkills.value ?? []).filter((s) => !removedRefs.value.includes(s.ref)).map((s) => ({
|
|
42
41
|
...s,
|
|
43
42
|
allowedTools: [...s.allowedTools],
|
|
44
43
|
addedBy: { ...s.addedBy }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function useWorkspacePersonalization(): {
|
|
1
|
+
export declare function useWorkspacePersonalization(currentSystemMessage: Ref<string | null | undefined> | ComputedRef<string | null | undefined>): {
|
|
2
2
|
localSystemMessage: any;
|
|
3
3
|
hasChanges: any;
|
|
4
4
|
getSystemMessage: () => string | null;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
export function useWorkspacePersonalization() {
|
|
2
|
-
const
|
|
3
|
-
const localSystemMessage = useState("workspace-personalization-system-message", () => "");
|
|
1
|
+
export function useWorkspacePersonalization(currentSystemMessage) {
|
|
2
|
+
const localSystemMessage = ref("");
|
|
4
3
|
const hasChanges = computed(
|
|
5
|
-
() => localSystemMessage.value !== (
|
|
4
|
+
() => localSystemMessage.value !== (currentSystemMessage.value ?? "")
|
|
6
5
|
);
|
|
7
6
|
function getSystemMessage() {
|
|
8
7
|
return localSystemMessage.value.trim() || null;
|
|
9
8
|
}
|
|
10
9
|
function initialize() {
|
|
11
|
-
localSystemMessage.value =
|
|
10
|
+
localSystemMessage.value = currentSystemMessage.value ?? "";
|
|
12
11
|
}
|
|
13
12
|
return {
|
|
14
13
|
localSystemMessage,
|
|
@@ -2,7 +2,8 @@ import * as Sentry from "@sentry/nuxt";
|
|
|
2
2
|
export function useWorkspaceSettings() {
|
|
3
3
|
const chatApi = useChatApi();
|
|
4
4
|
const embedConfig = useEmbedConfig();
|
|
5
|
-
const
|
|
5
|
+
const { activeOrganization } = useTelaApplicationAuth();
|
|
6
|
+
const workspaceScope = computed(() => embedConfig?.workspaceId.value.trim() || activeOrganization.value?.id?.trim() || "default");
|
|
6
7
|
const settingsBuckets = useState("workspace-settings", () => ({}));
|
|
7
8
|
const loadingBuckets = useState("workspace-settings-loading", () => ({}));
|
|
8
9
|
const errorBuckets = useState("workspace-settings-error", () => ({}));
|
|
@@ -35,7 +36,8 @@ export function useWorkspaceSettings() {
|
|
|
35
36
|
});
|
|
36
37
|
const isModalOpen = useState("workspace-settings-modal-open", () => false);
|
|
37
38
|
const initialTab = useState("workspace-settings-initial-tab", () => null);
|
|
38
|
-
|
|
39
|
+
const hasWorkspaceSettingsOverride = computed(() => embedConfig?.workspaceSettings.value !== void 0);
|
|
40
|
+
if (embedConfig !== null && hasWorkspaceSettingsOverride.value) {
|
|
39
41
|
settings.value = embedConfig.workspaceSettings.value;
|
|
40
42
|
}
|
|
41
43
|
if (embedConfig !== null) {
|
|
@@ -64,7 +66,9 @@ export function useWorkspaceSettings() {
|
|
|
64
66
|
try {
|
|
65
67
|
const currentSettings = settings.value;
|
|
66
68
|
let data;
|
|
67
|
-
if (
|
|
69
|
+
if (hasWorkspaceSettingsOverride.value) {
|
|
70
|
+
return settings.value;
|
|
71
|
+
} else if (embedConfig !== null) {
|
|
68
72
|
data = await $fetch(
|
|
69
73
|
chatApi.path("/workspace/settings"),
|
|
70
74
|
chatApi.withChatHeaders()
|
|
@@ -88,7 +92,7 @@ export function useWorkspaceSettings() {
|
|
|
88
92
|
externalSkills: data.externalSkills
|
|
89
93
|
};
|
|
90
94
|
if (JSON.stringify(hydratedSettings) !== JSON.stringify(trustedSettings)) {
|
|
91
|
-
console.warn("[
|
|
95
|
+
console.warn("[MeistrariChatEmbed] Hydrated workspace settings differ from trusted server settings");
|
|
92
96
|
}
|
|
93
97
|
}
|
|
94
98
|
settings.value = data;
|
|
@@ -102,15 +106,14 @@ export function useWorkspaceSettings() {
|
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
108
|
async function updateSettings(updates) {
|
|
105
|
-
if (
|
|
109
|
+
if (hasWorkspaceSettingsOverride.value)
|
|
106
110
|
return settings.value;
|
|
107
111
|
loading.value = true;
|
|
108
112
|
error.value = null;
|
|
109
113
|
try {
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
});
|
|
114
|
+
const path = embedConfig !== null ? chatApi.path("/workspace/settings") : "/api/workspace/settings";
|
|
115
|
+
const options = embedConfig !== null ? chatApi.withChatHeaders({ method: "PATCH", body: updates }) : { method: "PATCH", body: updates };
|
|
116
|
+
const data = await $fetch(path, options);
|
|
114
117
|
settings.value = data;
|
|
115
118
|
return data;
|
|
116
119
|
} catch (e) {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DeepReadonly } from 'vue';
|
|
2
|
+
import type { WorkspaceSettings, WorkspaceSettingsUpdate } from '../../composables/useWorkspaceSettings.js';
|
|
3
|
+
export type ChatConfigurationTab = 'personalization' | 'context-files' | 'knowledge-sources' | 'tela-tools' | 'external-skills' | 'credentials';
|
|
4
|
+
export type ChatConfigurationSavePayload = {
|
|
5
|
+
updates: WorkspaceSettingsUpdate;
|
|
6
|
+
onSaved: () => void;
|
|
7
|
+
};
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
open: boolean;
|
|
10
|
+
settings?: DeepReadonly<WorkspaceSettings> | WorkspaceSettings | null;
|
|
11
|
+
initialTab?: ChatConfigurationTab;
|
|
12
|
+
saving?: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
15
|
+
save: (payload: ChatConfigurationSavePayload) => any;
|
|
16
|
+
"update:open": (value: boolean) => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
18
|
+
onSave?: ((payload: ChatConfigurationSavePayload) => any) | undefined;
|
|
19
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
20
|
+
}>, {
|
|
21
|
+
initialTab: ChatConfigurationTab;
|
|
22
|
+
saving: boolean;
|
|
23
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
declare const _default: typeof __VLS_export;
|
|
25
|
+
export default _default;
|