mirror of
https://github.com/open-webui/open-webui
synced 2024-11-25 21:38:43 +00:00
feat: editable rag template frontend
This commit is contained in:
parent
082d1d15c3
commit
a31feccd64
@ -1,6 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { getDocs } from '$lib/apis/documents';
|
||||
import { getChunkParams, scanDocs, updateChunkParams } from '$lib/apis/rag';
|
||||
import {
|
||||
getChunkParams,
|
||||
getRAGTemplate,
|
||||
scanDocs,
|
||||
updateChunkParams,
|
||||
updateRAGTemplate
|
||||
} from '$lib/apis/rag';
|
||||
import { documents } from '$lib/stores';
|
||||
import { onMount } from 'svelte';
|
||||
import toast from 'svelte-french-toast';
|
||||
@ -12,6 +18,8 @@
|
||||
let chunkSize = 0;
|
||||
let chunkOverlap = 0;
|
||||
|
||||
let template = '';
|
||||
|
||||
const scanHandler = async () => {
|
||||
loading = true;
|
||||
const res = await scanDocs(localStorage.token);
|
||||
@ -25,6 +33,7 @@
|
||||
|
||||
const submitHandler = async () => {
|
||||
const res = await updateChunkParams(localStorage.token, chunkSize, chunkOverlap);
|
||||
await updateRAGTemplate(localStorage.token, template);
|
||||
};
|
||||
|
||||
onMount(async () => {
|
||||
@ -34,6 +43,8 @@
|
||||
chunkSize = res.chunk_size;
|
||||
chunkOverlap = res.chunk_overlap;
|
||||
}
|
||||
|
||||
template = await getRAGTemplate(localStorage.token);
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -144,6 +155,15 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class=" mb-2.5 text-sm font-medium">RAG Template</div>
|
||||
<textarea
|
||||
bind:value={template}
|
||||
class="w-full rounded p-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none resize-none"
|
||||
rows="4"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user