+
diff --git a/src/lib/utils/rag/index.ts b/src/lib/utils/rag/index.ts
index 6b219ef20..ba1f29f88 100644
--- a/src/lib/utils/rag/index.ts
+++ b/src/lib/utils/rag/index.ts
@@ -1,17 +1,21 @@
-export const RAGTemplate = (context: string, query: string) => {
- let template = `Use the following context as your learned knowledge, inside XML tags.
-
- [context]
-
-
- When answer to user:
- - If you don't know, just say that you don't know.
- - If you don't know when you are not sure, ask for clarification.
- Avoid mentioning that you obtained the information from the context.
- And answer according to the language of the user's question.
-
- Given the context information, answer the query.
- Query: [query]`;
+import { getRAGTemplate } from '$lib/apis/rag';
+
+export const RAGTemplate = async (token: string, context: string, query: string) => {
+ let template = await getRAGTemplate(token).catch(() => {
+ return `Use the following context as your learned knowledge, inside XML tags.
+
+ [context]
+
+
+ When answer to user:
+ - If you don't know, just say that you don't know.
+ - If you don't know when you are not sure, ask for clarification.
+ Avoid mentioning that you obtained the information from the context.
+ And answer according to the language of the user's question.
+
+ Given the context information, answer the query.
+ Query: [query]`;
+ });
template = template.replace(/\[context\]/g, context);
template = template.replace(/\[query\]/g, query);
diff --git a/src/routes/(app)/+page.svelte b/src/routes/(app)/+page.svelte
index 604cb544d..1d91a6144 100644
--- a/src/routes/(app)/+page.svelte
+++ b/src/routes/(app)/+page.svelte
@@ -266,7 +266,11 @@
console.log(contextString);
- history.messages[parentId].raContent = RAGTemplate(contextString, query);
+ history.messages[parentId].raContent = await RAGTemplate(
+ localStorage.token,
+ contextString,
+ query
+ );
history.messages[parentId].contexts = relevantContexts;
await tick();
processing = '';
diff --git a/src/routes/(app)/admin/+page.svelte b/src/routes/(app)/admin/+page.svelte
index 797fdc1ff..8b002da85 100644
--- a/src/routes/(app)/admin/+page.svelte
+++ b/src/routes/(app)/admin/+page.svelte
@@ -79,14 +79,20 @@
>
{#if loaded}
-
+
-
Users ({users.length})
+
+ All Users
+
+ {users.length}
+
-
- Click on the user role cell in the table to change a user's role.
+
+ ⓘ Click on the user role button to change a user's role.
-
+
-
Name
-
Email
-
Role
-
Action
+
Role
+
Name
+
Email
+
Action
{#each users as user}
-
-
-
-
-
-
{user.name}
-
-
-
{user.email}
-
+
+
+
+ {user.role}
-
-
+
+
+
-
+
+
+
{user.email}
+
+
+
+
+
+
+
+
+
{/each}
diff --git a/src/routes/(app)/c/[id]/+page.svelte b/src/routes/(app)/c/[id]/+page.svelte
index aab03d74f..b719ebf2b 100644
--- a/src/routes/(app)/c/[id]/+page.svelte
+++ b/src/routes/(app)/c/[id]/+page.svelte
@@ -280,7 +280,11 @@
console.log(contextString);
- history.messages[parentId].raContent = RAGTemplate(contextString, query);
+ history.messages[parentId].raContent = await RAGTemplate(
+ localStorage.token,
+ contextString,
+ query
+ );
history.messages[parentId].contexts = relevantContexts;
await tick();
processing = '';
diff --git a/src/routes/(app)/documents/+page.svelte b/src/routes/(app)/documents/+page.svelte
index a5653483e..efa9d63fd 100644
--- a/src/routes/(app)/documents/+page.svelte
+++ b/src/routes/(app)/documents/+page.svelte
@@ -13,6 +13,7 @@
import EditDocModal from '$lib/components/documents/EditDocModal.svelte';
import AddFilesPlaceholder from '$lib/components/AddFilesPlaceholder.svelte';
+ import SettingsModal from '$lib/components/documents/SettingsModal.svelte';
let importFiles = '';
let inputFiles = '';
@@ -20,6 +21,7 @@
let tags = [];
+ let showSettingsModal = false;
let showEditDocModal = false;
let selectedDoc;
let selectedTag = '';
@@ -179,11 +181,43 @@
}}
/>
+
+
-
+
-
-
My Documents
+
+
+
My Documents
+
+
+
+
+
+
+ ⓘ Use '#' in the prompt input to load and select your documents.
+