feat: add default file upload mode user setting (#20900)
* 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. * i18n: sync locale catalogs for the new upload mode strings Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore: re-trigger CI (previous run hit the pre-existing Node heap OOM, see #27254) * fix: apply the default upload mode at upload time so the payload carries it The previous approach only pre-set the modal toggle's visual state on mount; item.context is written solely by the Switch's on:change, so the sent files kept context: undefined and the backend never saw 'full'. It also showed a misleading ON state for legacy context-less files, since FileItemModal mounts with every FileItem chip render. Stamp context on the fileItem in uploadFileHandler instead (before ...itemData, so callers passing an explicit context still win) and revert the FileItemModal hunk — the modal already renders from item.context alone. --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -769,6 +769,9 @@
|
||||
size: file.size,
|
||||
error: '',
|
||||
itemId: tempItemId,
|
||||
// Stamp the user's default upload mode so the sent payload carries it;
|
||||
// the per-file toggle in FileItemModal can still override it afterwards.
|
||||
...($settings?.defaultUploadContext === 'full' ? { context: 'full' } : {}),
|
||||
...itemData
|
||||
};
|
||||
|
||||
|
||||
@@ -91,6 +91,9 @@
|
||||
let showUpdateToast = true;
|
||||
let showChangelog = true;
|
||||
|
||||
// File
|
||||
let defaultUploadContext: 'full' | 'focused' = 'focused';
|
||||
|
||||
let showEmojiInCall = false;
|
||||
let voiceInterruption = false;
|
||||
let hapticFeedback = false;
|
||||
@@ -283,6 +286,8 @@
|
||||
webSearch = $settings?.webSearch ?? null;
|
||||
|
||||
textScale = $settings?.textScale ?? null;
|
||||
|
||||
defaultUploadContext = $settings?.defaultUploadContext ?? 'focused';
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1512,6 +1517,33 @@
|
||||
|
||||
<div class={sectionHeadingClass}>{$i18n.t('File')}</div>
|
||||
|
||||
<div>
|
||||
<div class={settingRowClass}>
|
||||
<div id="default-upload-mode-label" class={settingLabelClass}>
|
||||
{$i18n.t('Default Upload Mode')}
|
||||
</div>
|
||||
|
||||
<button
|
||||
aria-labelledby="default-upload-mode-label default-upload-mode-state"
|
||||
class={actionButtonClass}
|
||||
on:click={() => {
|
||||
defaultUploadContext = defaultUploadContext === 'full' ? 'focused' : 'full';
|
||||
saveSettings({ defaultUploadContext });
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
<span id="default-upload-mode-state">
|
||||
{defaultUploadContext === 'full'
|
||||
? $i18n.t('Using Entire Document')
|
||||
: $i18n.t('Using Focused Retrieval')}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<p class={settingDescriptionClass}>
|
||||
{$i18n.t('Attach files with full content or focused retrieval by default.')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class={settingRowClass}>
|
||||
<div id="image-compression-label" class={settingLabelClass}>
|
||||
|
||||
Reference in New Issue
Block a user