feat: add default upload mode setting

Add user setting to configure the default upload mode for files, allowing users to choose between "Using Entire Document" (full context) and "Using Focused Retrieval" (RAG processing) as the default behavior.
This commit is contained in:
silentoplayz 2026-01-23 10:53:06 -05:00
parent 0dc74a8a2e
commit 428a943644
4 changed files with 35 additions and 0 deletions

View file

@ -88,6 +88,9 @@
let showUpdateToast = true;
let showChangelog = true;
// File
let defaultUploadContext: 'full' | 'focused' = 'focused';
let showEmojiInCall = false;
let voiceInterruption = false;
let hapticFeedback = false;
@ -269,6 +272,8 @@
webSearch = $settings?.webSearch ?? null;
textScale = $settings?.textScale ?? null;
defaultUploadContext = $settings?.defaultUploadContext ?? 'focused';
});
</script>
@ -1278,6 +1283,30 @@
<div class=" my-2 text-sm font-medium">{$i18n.t('File')}</div>
<div>
<div class=" py-0.5 flex w-full justify-between">
<div id="default-upload-mode-label" class=" self-center text-xs">
{$i18n.t('Default Upload Mode')}
</div>
<button
aria-labelledby="default-upload-mode-label default-upload-mode-state"
class="p-1 px-3 text-xs flex rounded transition"
on:click={() => {
defaultUploadContext = defaultUploadContext === 'full' ? 'focused' : 'full';
saveSettings({ defaultUploadContext });
}}
type="button"
>
<span class="ml-2 self-center" id="default-upload-mode-state"
>{defaultUploadContext === 'full'
? $i18n.t('Using Entire Document')
: $i18n.t('Using Focused Retrieval')}</span
>
</button>
</div>
</div>
<div>
<div class=" py-0.5 flex w-full justify-between">
<div id="image-compression-label" class=" self-center text-xs">

View file

@ -5,6 +5,7 @@
import { formatFileSize, getLineCount } from '$lib/utils';
import { WEBUI_API_BASE_URL } from '$lib/constants';
import { settings } from '$lib/stores';
import { getKnowledgeById } from '$lib/apis/knowledge';
import { getFileById, getFileContentById } from '$lib/apis/files';
@ -174,6 +175,8 @@
console.log(item);
if (item?.context === 'full') {
enableFullContent = true;
} else if (item?.context === undefined && $settings?.defaultUploadContext === 'full') {
enableFullContent = true;
}
});
</script>

View file

@ -411,6 +411,7 @@
"Decrease UI Scale": "",
"Deepgram": "",
"Default": "",
"Default Upload Mode": "",
"Default (Open AI)": "",
"Default (SentenceTransformers)": "",
"Default action buttons will be used.": "",

View file

@ -204,6 +204,8 @@ type Settings = {
chatDirection?: 'LTR' | 'RTL' | 'auto';
ctrlEnterToSend?: boolean;
defaultUploadContext?: 'full' | 'focused';
system?: string;
seed?: number;
temperature?: string;