mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
feat: detect artifacts toggle
This commit is contained in:
parent
d4297a3e3e
commit
d8780e4de2
@ -4,7 +4,7 @@
|
|||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
import Markdown from './Markdown.svelte';
|
import Markdown from './Markdown.svelte';
|
||||||
import { chatId, mobile, showArtifacts, showControls, showOverview } from '$lib/stores';
|
import { chatId, mobile, settings, showArtifacts, showControls, showOverview } from '$lib/stores';
|
||||||
import FloatingButtons from '../ContentRenderer/FloatingButtons.svelte';
|
import FloatingButtons from '../ContentRenderer/FloatingButtons.svelte';
|
||||||
import { createMessagesList } from '$lib/utils';
|
import { createMessagesList } from '$lib/utils';
|
||||||
|
|
||||||
@ -161,6 +161,7 @@
|
|||||||
const { lang, code } = e.detail;
|
const { lang, code } = e.detail;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
($settings?.detectArtifacts ?? true) &&
|
||||||
(['html', 'svg'].includes(lang) || (lang === 'xml' && code.includes('svg'))) &&
|
(['html', 'svg'].includes(lang) || (lang === 'xml' && code.includes('svg'))) &&
|
||||||
!$mobile &&
|
!$mobile &&
|
||||||
$chatId
|
$chatId
|
||||||
|
@ -32,6 +32,8 @@
|
|||||||
let showUsername = false;
|
let showUsername = false;
|
||||||
let notificationSound = true;
|
let notificationSound = true;
|
||||||
|
|
||||||
|
let detectArtifacts = true;
|
||||||
|
|
||||||
let richTextInput = true;
|
let richTextInput = true;
|
||||||
let promptAutocomplete = false;
|
let promptAutocomplete = false;
|
||||||
|
|
||||||
@ -176,6 +178,11 @@
|
|||||||
saveSettings({ autoTags });
|
saveSettings({ autoTags });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const toggleDetectArtifacts = async () => {
|
||||||
|
detectArtifacts = !detectArtifacts;
|
||||||
|
saveSettings({ detectArtifacts });
|
||||||
|
};
|
||||||
|
|
||||||
const toggleRichTextInput = async () => {
|
const toggleRichTextInput = async () => {
|
||||||
richTextInput = !richTextInput;
|
richTextInput = !richTextInput;
|
||||||
saveSettings({ richTextInput });
|
saveSettings({ richTextInput });
|
||||||
@ -242,6 +249,7 @@
|
|||||||
titleAutoGenerate = $settings?.title?.auto ?? true;
|
titleAutoGenerate = $settings?.title?.auto ?? true;
|
||||||
autoTags = $settings.autoTags ?? true;
|
autoTags = $settings.autoTags ?? true;
|
||||||
|
|
||||||
|
detectArtifacts = $settings.detectArtifacts ?? true;
|
||||||
responseAutoCopy = $settings.responseAutoCopy ?? false;
|
responseAutoCopy = $settings.responseAutoCopy ?? false;
|
||||||
|
|
||||||
showUsername = $settings.showUsername ?? false;
|
showUsername = $settings.showUsername ?? false;
|
||||||
@ -537,6 +545,28 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div class=" py-0.5 flex w-full justify-between">
|
||||||
|
<div class=" self-center text-xs">
|
||||||
|
{$i18n.t('Detect Artifacts Automatically')}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="p-1 px-3 text-xs flex rounded-sm transition"
|
||||||
|
on:click={() => {
|
||||||
|
toggleDetectArtifacts();
|
||||||
|
}}
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
{#if detectArtifacts === 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>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div class=" py-0.5 flex w-full justify-between">
|
<div class=" py-0.5 flex w-full justify-between">
|
||||||
<div class=" self-center text-xs">
|
<div class=" self-center text-xs">
|
||||||
|
Loading…
Reference in New Issue
Block a user