mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-15 05:45:19 +00:00
enh: image compression in channels
This commit is contained in:
parent
2f349b5979
commit
80dbd76d92
2 changed files with 33 additions and 1 deletions
|
|
@ -327,7 +327,9 @@
|
||||||
let imageUrl = event.target.result;
|
let imageUrl = event.target.result;
|
||||||
|
|
||||||
// Compress the image if settings or config require it
|
// Compress the image if settings or config require it
|
||||||
imageUrl = await compressImageHandler(imageUrl, $settings, $config);
|
if ($settings?.imageCompression && $settings?.imageCompressionInChannels) {
|
||||||
|
imageUrl = await compressImageHandler(imageUrl, $settings, $config);
|
||||||
|
}
|
||||||
|
|
||||||
files = [
|
files = [
|
||||||
...files,
|
...files,
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@
|
||||||
width: '',
|
width: '',
|
||||||
height: ''
|
height: ''
|
||||||
};
|
};
|
||||||
|
let imageCompressionInChannels = true;
|
||||||
|
|
||||||
// chat export
|
// chat export
|
||||||
let stylizedPdfExport = true;
|
let stylizedPdfExport = true;
|
||||||
|
|
@ -164,6 +165,11 @@
|
||||||
saveSettings({ imageCompression });
|
saveSettings({ imageCompression });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const toggleImageCompressionInChannels = async () => {
|
||||||
|
imageCompressionInChannels = !imageCompressionInChannels;
|
||||||
|
saveSettings({ imageCompressionInChannels });
|
||||||
|
};
|
||||||
|
|
||||||
const toggleChatFadeStreamingText = async () => {
|
const toggleChatFadeStreamingText = async () => {
|
||||||
chatFadeStreamingText = !chatFadeStreamingText;
|
chatFadeStreamingText = !chatFadeStreamingText;
|
||||||
saveSettings({ chatFadeStreamingText: chatFadeStreamingText });
|
saveSettings({ chatFadeStreamingText: chatFadeStreamingText });
|
||||||
|
|
@ -375,6 +381,7 @@
|
||||||
|
|
||||||
imageCompression = $settings?.imageCompression ?? false;
|
imageCompression = $settings?.imageCompression ?? false;
|
||||||
imageCompressionSize = $settings?.imageCompressionSize ?? { width: '', height: '' };
|
imageCompressionSize = $settings?.imageCompressionSize ?? { width: '', height: '' };
|
||||||
|
imageCompressionInChannels = $settings?.imageCompressionInChannels ?? true;
|
||||||
|
|
||||||
defaultModelId = $settings?.models?.at(0) ?? '';
|
defaultModelId = $settings?.models?.at(0) ?? '';
|
||||||
if ($config?.default_models) {
|
if ($config?.default_models) {
|
||||||
|
|
@ -1369,6 +1376,29 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div class=" py-0.5 flex w-full justify-between">
|
||||||
|
<div id="image-compression-label" class=" self-center text-xs">
|
||||||
|
{$i18n.t('Compress Images in Channels')}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button
|
||||||
|
aria-labelledby="image-compression-label"
|
||||||
|
class="p-1 px-3 text-xs flex rounded-sm transition"
|
||||||
|
on:click={() => {
|
||||||
|
toggleImageCompressionInChannels();
|
||||||
|
}}
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
{#if imageCompressionInChannels === true}
|
||||||
|
<span class="ml-2 self-center">{$i18n.t('On')}</span>
|
||||||
|
{:else}
|
||||||
|
<span class="ml-2 self-center">{$i18n.t('Off')}</span>
|
||||||
|
{/if}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue