feat: Add auto-mic setting
This commit is contained in:
parent
6b7c0a5090
commit
69503aa519
|
|
@ -9,6 +9,7 @@
|
||||||
import { FileTypeCategory } from '$lib/enums/files';
|
import { FileTypeCategory } from '$lib/enums/files';
|
||||||
import { getFileTypeCategory } from '$lib/utils/file-type';
|
import { getFileTypeCategory } from '$lib/utils/file-type';
|
||||||
import { supportsAudio } from '$lib/stores/server.svelte';
|
import { supportsAudio } from '$lib/stores/server.svelte';
|
||||||
|
import { config } from '$lib/stores/settings.svelte';
|
||||||
import type { ChatUploadedFile } from '$lib/types/chat';
|
import type { ChatUploadedFile } from '$lib/types/chat';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|
@ -37,11 +38,14 @@
|
||||||
onStop
|
onStop
|
||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
|
|
||||||
|
let currentConfig = $derived(config());
|
||||||
let hasAudioModality = $derived(supportsAudio());
|
let hasAudioModality = $derived(supportsAudio());
|
||||||
let hasAudioAttachments = $derived(
|
let hasAudioAttachments = $derived(
|
||||||
uploadedFiles.some((file) => getFileTypeCategory(file.type) === FileTypeCategory.AUDIO)
|
uploadedFiles.some((file) => getFileTypeCategory(file.type) === FileTypeCategory.AUDIO)
|
||||||
);
|
);
|
||||||
let shouldShowRecordButton = $derived(hasAudioModality && !hasText && !hasAudioAttachments);
|
let shouldShowRecordButton = $derived(
|
||||||
|
hasAudioModality && !hasText && !hasAudioAttachments && currentConfig.autoMicOnEmpty
|
||||||
|
);
|
||||||
let shouldShowSubmitButton = $derived(!shouldShowRecordButton || hasAudioAttachments);
|
let shouldShowSubmitButton = $derived(!shouldShowRecordButton || hasAudioAttachments);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,12 +78,6 @@
|
||||||
label: 'Show model information',
|
label: 'Show model information',
|
||||||
type: 'checkbox'
|
type: 'checkbox'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: 'enableContinueGeneration',
|
|
||||||
label: 'Enable "Continue" button',
|
|
||||||
type: 'checkbox',
|
|
||||||
isExperimental: true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'pdfAsImage',
|
key: 'pdfAsImage',
|
||||||
label: 'Parse PDF as image',
|
label: 'Parse PDF as image',
|
||||||
|
|
@ -94,6 +88,18 @@
|
||||||
label: 'Render user content as Markdown',
|
label: 'Render user content as Markdown',
|
||||||
type: 'checkbox'
|
type: 'checkbox'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'autoMicOnEmpty',
|
||||||
|
label: 'Show microphone on empty input',
|
||||||
|
type: 'checkbox',
|
||||||
|
isExperimental: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'enableContinueGeneration',
|
||||||
|
label: 'Enable "Continue" button',
|
||||||
|
type: 'checkbox',
|
||||||
|
isExperimental: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: 'askForTitleConfirmation',
|
key: 'askForTitleConfirmation',
|
||||||
label: 'Ask for confirmation before changing conversation title',
|
label: 'Ask for confirmation before changing conversation title',
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ export const SETTING_CONFIG_DEFAULT: Record<string, string | number | boolean> =
|
||||||
showModelInfo: false,
|
showModelInfo: false,
|
||||||
renderUserContentAsMarkdown: false,
|
renderUserContentAsMarkdown: false,
|
||||||
modelSelectorEnabled: false,
|
modelSelectorEnabled: false,
|
||||||
|
autoMicOnEmpty: false,
|
||||||
// make sure these default values are in sync with `common.h`
|
// make sure these default values are in sync with `common.h`
|
||||||
samplers: 'top_k;typ_p;top_p;min_p;temperature',
|
samplers: 'top_k;typ_p;top_p;min_p;temperature',
|
||||||
temperature: 0.8,
|
temperature: 0.8,
|
||||||
|
|
@ -96,6 +97,8 @@ export const SETTING_CONFIG_INFO: Record<string, string> = {
|
||||||
renderUserContentAsMarkdown: 'Render user messages using markdown formatting in the chat.',
|
renderUserContentAsMarkdown: 'Render user messages using markdown formatting in the chat.',
|
||||||
modelSelectorEnabled:
|
modelSelectorEnabled:
|
||||||
'Enable the model selector in the chat input to choose the inference model. Sends the associated model field in API requests.',
|
'Enable the model selector in the chat input to choose the inference model. Sends the associated model field in API requests.',
|
||||||
|
autoMicOnEmpty:
|
||||||
|
'Automatically show microphone button instead of send button when textarea is empty for models with audio modality support.',
|
||||||
pyInterpreterEnabled:
|
pyInterpreterEnabled:
|
||||||
'Enable Python interpreter using Pyodide. Allows running Python code in markdown code blocks.',
|
'Enable Python interpreter using Pyodide. Allows running Python code in markdown code blocks.',
|
||||||
enableContinueGeneration:
|
enableContinueGeneration:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue