refac: always on web search
This commit is contained in:
@@ -52,7 +52,7 @@
|
||||
let voiceInterruption = false;
|
||||
let hapticFeedback = false;
|
||||
|
||||
let alwaysOnWebSearch = false;
|
||||
let webSearch = null;
|
||||
|
||||
const toggleSplitLargeChunks = async () => {
|
||||
splitLargeChunks = !splitLargeChunks;
|
||||
@@ -200,9 +200,9 @@
|
||||
});
|
||||
};
|
||||
|
||||
const toggleAlwaysOnWebSearch = async () => {
|
||||
alwaysOnWebSearch = !alwaysOnWebSearch;
|
||||
saveSettings({ alwaysOnWebSearch });
|
||||
const toggleWebSearch = async () => {
|
||||
webSearch = webSearch === null ? 'always' : null;
|
||||
saveSettings({ webSearch: webSearch });
|
||||
};
|
||||
|
||||
onMount(async () => {
|
||||
@@ -242,8 +242,7 @@
|
||||
}
|
||||
|
||||
backgroundImageUrl = $settings.backgroundImageUrl ?? null;
|
||||
|
||||
alwaysOnWebSearch = $settings.alwaysOnWebSearch ?? false;
|
||||
webSearch = $settings.webSearch ?? null;
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -677,19 +676,19 @@
|
||||
|
||||
<div>
|
||||
<div class=" py-0.5 flex w-full justify-between">
|
||||
<div class=" self-center text-xs">{$i18n.t('Always-On Web Search')}</div>
|
||||
<div class=" self-center text-xs">{$i18n.t('Web Search in Chat')}</div>
|
||||
|
||||
<button
|
||||
class="p-1 px-3 text-xs flex rounded transition"
|
||||
on:click={() => {
|
||||
toggleAlwaysOnWebSearch();
|
||||
toggleWebSearch();
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
{#if alwaysOnWebSearch === true}
|
||||
<span class="ml-2 self-center">{$i18n.t('On')}</span>
|
||||
{#if webSearch === 'always'}
|
||||
<span class="ml-2 self-center">{$i18n.t('Always')}</span>
|
||||
{:else}
|
||||
<span class="ml-2 self-center">{$i18n.t('Off')}</span>
|
||||
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user