refactor: Cleanup

This commit is contained in:
Aleksander Grygier 2025-11-23 22:27:25 +01:00
parent 49c8062db1
commit d5a6671b81
1 changed files with 13 additions and 18 deletions

View File

@ -16,7 +16,7 @@
interface Props { interface Props {
canSend?: boolean; canSend?: boolean;
className?: string; class?: string;
disabled?: boolean; disabled?: boolean;
isLoading?: boolean; isLoading?: boolean;
isRecording?: boolean; isRecording?: boolean;
@ -29,7 +29,7 @@
let { let {
canSend = false, canSend = false,
className = '', class: className = '',
disabled = false, disabled = false,
isLoading = false, isLoading = false,
isRecording = false, isRecording = false,
@ -48,7 +48,6 @@
let shouldShowRecordButton = $derived( let shouldShowRecordButton = $derived(
hasAudioModality && !hasText && !hasAudioAttachments && currentConfig.autoMicOnEmpty hasAudioModality && !hasText && !hasAudioAttachments && currentConfig.autoMicOnEmpty
); );
let shouldShowSubmitButton = $derived(!shouldShowRecordButton || hasAudioAttachments);
let isSelectedModelInCache = $derived.by(() => { let isSelectedModelInCache = $derived.by(() => {
const currentModelId = selectedModelId(); const currentModelId = selectedModelId();
@ -73,21 +72,17 @@
<span class="sr-only">Stop</span> <span class="sr-only">Stop</span>
<Square class="h-8 w-8 fill-destructive stroke-destructive" /> <Square class="h-8 w-8 fill-destructive stroke-destructive" />
</Button> </Button>
{:else if shouldShowRecordButton}
<ChatFormActionRecord {disabled} {isLoading} {isRecording} {onMicClick} />
{:else} {:else}
{#if shouldShowRecordButton} <ChatFormActionSubmit
<ChatFormActionRecord {disabled} {isLoading} {isRecording} {onMicClick} /> {canSend}
{/if} {disabled}
{isLoading}
{#if shouldShowSubmitButton} tooltipLabel={isSelectedModelInCache
<ChatFormActionSubmit ? ''
{canSend} : 'Selected model is not available, please select another'}
{disabled} isModelAvailable={isSelectedModelInCache}
{isLoading} />
tooltipLabel={isSelectedModelInCache
? ''
: 'Selected model is not available, please select another'}
isModelAvailable={isSelectedModelInCache}
/>
{/if}
{/if} {/if}
</div> </div>