fix: terminals button ui

This commit is contained in:
Timothy Jaeryang Baek
2026-03-07 16:40:14 -06:00
parent c7d1d1e390
commit 70a31a9a57
+47 -45
View File
@@ -1803,59 +1803,61 @@
</Tooltip> </Tooltip>
{/if} {/if}
{#if (!history?.currentId || history.messages[history.currentId]?.done == true) && ($_user?.role === 'admin' || ($_user?.permissions?.chat?.stt ?? true))} {#if !history?.currentId || history.messages[history.currentId]?.done == true}
<!-- Terminal Server Selector --> <!-- Terminal Server Selector -->
{#if ($terminalServers ?? []).length > 0 || ($settings?.terminalServers ?? []).some((s) => s.url)} {#if ($terminalServers ?? []).length > 0 || ($settings?.terminalServers ?? []).some((s) => s.url)}
<TerminalMenu bind:show={showTerminalMenu} /> <TerminalMenu bind:show={showTerminalMenu} />
{/if} {/if}
<!-- {$i18n.t('Record voice')} --> {#if $_user?.role === 'admin' || ($_user?.permissions?.chat?.stt ?? true)}
<Tooltip content={$i18n.t('Dictate')}> <!-- {$i18n.t('Record voice')} -->
<button <Tooltip content={$i18n.t('Dictate')}>
id="voice-input-button" <button
class=" text-gray-600 dark:text-gray-300 hover:text-gray-700 dark:hover:text-gray-200 transition rounded-full p-1.5 self-center mr-0.5" id="voice-input-button"
type="button" class=" text-gray-600 dark:text-gray-300 hover:text-gray-700 dark:hover:text-gray-200 transition rounded-full p-1.5 self-center mr-0.5"
on:click={async () => { type="button"
try { on:click={async () => {
let stream = await navigator.mediaDevices try {
.getUserMedia({ audio: true }) let stream = await navigator.mediaDevices
.catch(function (err) { .getUserMedia({ audio: true })
toast.error( .catch(function (err) {
$i18n.t( toast.error(
`Permission denied when accessing microphone: {{error}}`, $i18n.t(
{ `Permission denied when accessing microphone: {{error}}`,
error: err {
} error: err
) }
); )
return null; );
}); return null;
});
if (stream) { if (stream) {
recording = true; recording = true;
const tracks = stream.getTracks(); const tracks = stream.getTracks();
tracks.forEach((track) => track.stop()); tracks.forEach((track) => track.stop());
}
stream = null;
} catch {
toast.error($i18n.t('Permission denied when accessing microphone'));
} }
stream = null; }}
} catch { aria-label="Voice Input"
toast.error($i18n.t('Permission denied when accessing microphone'));
}
}}
aria-label="Voice Input"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
class="size-5 translate-y-[0.5px]"
> >
<path d="M7 4a3 3 0 016 0v6a3 3 0 11-6 0V4z" /> <svg
<path xmlns="http://www.w3.org/2000/svg"
d="M5.5 9.643a.75.75 0 00-1.5 0V10c0 3.06 2.29 5.585 5.25 5.954V17.5h-1.5a.75.75 0 000 1.5h4.5a.75.75 0 000-1.5h-1.5v-1.546A6.001 6.001 0 0016 10v-.357a.75.75 0 00-1.5 0V10a4.5 4.5 0 01-9 0v-.357z" viewBox="0 0 20 20"
/> fill="currentColor"
</svg> class="size-5 translate-y-[0.5px]"
</button> >
</Tooltip> <path d="M7 4a3 3 0 016 0v6a3 3 0 11-6 0V4z" />
<path
d="M5.5 9.643a.75.75 0 00-1.5 0V10c0 3.06 2.29 5.585 5.25 5.954V17.5h-1.5a.75.75 0 000 1.5h4.5a.75.75 0 000-1.5h-1.5v-1.546A6.001 6.001 0 0016 10v-.357a.75.75 0 00-1.5 0V10a4.5 4.5 0 01-9 0v-.357z"
/>
</svg>
</button>
</Tooltip>
{/if}
{/if} {/if}
{#if prompt === '' && files.length === 0 && ($_user?.role === 'admin' || ($_user?.permissions?.chat?.call ?? true))} {#if prompt === '' && files.length === 0 && ($_user?.role === 'admin' || ($_user?.permissions?.chat?.call ?? true))}