|
@@ -305,7 +305,7 @@
|
|
|
<div class="w-full relative">
|
|
|
{#if atSelectedModel !== undefined || selectedToolIds.length > 0 || webSearchEnabled}
|
|
|
<div
|
|
|
- class="px-4 pb-0.5 pt-1.5 text-left w-full flex flex-col absolute bottom-0 left-0 right-0 bg-gradient-to-t from-white dark:from-gray-900 z-10"
|
|
|
+ class="px-3 pb-0.5 pt-1.5 text-left w-full flex flex-col absolute bottom-0 left-0 right-0 bg-gradient-to-t from-white dark:from-gray-900 z-10"
|
|
|
>
|
|
|
{#if selectedToolIds.length > 0}
|
|
|
<div class="flex items-center justify-between w-full">
|
|
@@ -462,7 +462,7 @@
|
|
|
}}
|
|
|
>
|
|
|
<div
|
|
|
- class="flex-1 flex flex-col relative w-full rounded-3xl px-1.5 bg-gray-50 dark:bg-gray-400/5 dark:text-gray-100"
|
|
|
+ class="flex-1 flex flex-col relative w-full rounded-3xl px-1 bg-gray-50 dark:bg-gray-400/5 dark:text-gray-100"
|
|
|
dir={$settings?.chatDirection ?? 'LTR'}
|
|
|
>
|
|
|
{#if files.length > 0}
|
|
@@ -967,12 +967,12 @@
|
|
|
/>
|
|
|
{/if}
|
|
|
|
|
|
- <div class="self-end mb-2 flex space-x-1 mr-1">
|
|
|
+ <div class="self-end mb-1.5 flex space-x-1 mr-1">
|
|
|
{#if !history?.currentId || history.messages[history.currentId]?.done == true}
|
|
|
<Tooltip content={$i18n.t('Record voice')}>
|
|
|
<button
|
|
|
id="voice-input-button"
|
|
|
- class=" text-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-850 transition rounded-full p-1.5 mr-0.5 self-center"
|
|
|
+ class=" text-gray-600 dark:text-gray-300 hover:text-gray-700 dark:hover:text-gray-200 transition rounded-full p-1.5 mr-0.5 self-center"
|
|
|
type="button"
|
|
|
on:click={async () => {
|
|
|
try {
|
|
@@ -1016,112 +1016,113 @@
|
|
|
</button>
|
|
|
</Tooltip>
|
|
|
{/if}
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="flex items-end w-10">
|
|
|
- {#if !history.currentId || history.messages[history.currentId]?.done == true}
|
|
|
- {#if prompt === ''}
|
|
|
- <div class=" flex items-center mb-1">
|
|
|
- <Tooltip content={$i18n.t('Call')}>
|
|
|
- <button
|
|
|
- class=" text-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-850 transition rounded-full p-2 self-center"
|
|
|
- type="button"
|
|
|
- on:click={async () => {
|
|
|
- if (selectedModels.length > 1) {
|
|
|
- toast.error($i18n.t('Select only one model to call'));
|
|
|
|
|
|
- return;
|
|
|
- }
|
|
|
+ {#if !history.currentId || history.messages[history.currentId]?.done == true}
|
|
|
+ {#if prompt === ''}
|
|
|
+ <div class=" flex items-center">
|
|
|
+ <Tooltip content={$i18n.t('Call')}>
|
|
|
+ <button
|
|
|
+ class=" bg-black text-white hover:bg-gray-900 dark:bg-white dark:text-black dark:hover:bg-gray-100 transition rounded-full p-2 self-center"
|
|
|
+ type="button"
|
|
|
+ on:click={async () => {
|
|
|
+ if (selectedModels.length > 1) {
|
|
|
+ toast.error($i18n.t('Select only one model to call'));
|
|
|
|
|
|
- if ($config.audio.stt.engine === 'web') {
|
|
|
- toast.error(
|
|
|
- $i18n.t('Call feature is not supported when using Web STT engine')
|
|
|
- );
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- return;
|
|
|
- }
|
|
|
- // check if user has access to getUserMedia
|
|
|
- try {
|
|
|
- let stream = await navigator.mediaDevices.getUserMedia({
|
|
|
- audio: true
|
|
|
- });
|
|
|
- // If the user grants the permission, proceed to show the call overlay
|
|
|
+ if ($config.audio.stt.engine === 'web') {
|
|
|
+ toast.error(
|
|
|
+ $i18n.t(
|
|
|
+ 'Call feature is not supported when using Web STT engine'
|
|
|
+ )
|
|
|
+ );
|
|
|
|
|
|
- if (stream) {
|
|
|
- const tracks = stream.getTracks();
|
|
|
- tracks.forEach((track) => track.stop());
|
|
|
- }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // check if user has access to getUserMedia
|
|
|
+ try {
|
|
|
+ let stream = await navigator.mediaDevices.getUserMedia({
|
|
|
+ audio: true
|
|
|
+ });
|
|
|
+ // If the user grants the permission, proceed to show the call overlay
|
|
|
|
|
|
- stream = null;
|
|
|
+ if (stream) {
|
|
|
+ const tracks = stream.getTracks();
|
|
|
+ tracks.forEach((track) => track.stop());
|
|
|
+ }
|
|
|
|
|
|
- showCallOverlay.set(true);
|
|
|
- showControls.set(true);
|
|
|
- } catch (err) {
|
|
|
- // If the user denies the permission or an error occurs, show an error message
|
|
|
- toast.error(
|
|
|
- $i18n.t('Permission denied when accessing media devices')
|
|
|
- );
|
|
|
- }
|
|
|
- }}
|
|
|
- aria-label="Call"
|
|
|
- >
|
|
|
- <Headphone className="size-6" />
|
|
|
- </button>
|
|
|
- </Tooltip>
|
|
|
- </div>
|
|
|
- {:else}
|
|
|
- <div class=" flex items-center mb-1">
|
|
|
- <Tooltip content={$i18n.t('Send message')}>
|
|
|
- <button
|
|
|
- id="send-message-button"
|
|
|
- class="{prompt !== ''
|
|
|
- ? 'bg-black text-white hover:bg-gray-900 dark:bg-white dark:text-black dark:hover:bg-gray-100 '
|
|
|
- : 'text-white bg-gray-200 dark:text-gray-900 dark:bg-gray-700 disabled'} transition rounded-full p-1.5 m-0.5 self-center"
|
|
|
- type="submit"
|
|
|
- disabled={prompt === ''}
|
|
|
- >
|
|
|
- <svg
|
|
|
- xmlns="http://www.w3.org/2000/svg"
|
|
|
- viewBox="0 0 16 16"
|
|
|
- fill="currentColor"
|
|
|
- class="size-6"
|
|
|
+ stream = null;
|
|
|
+
|
|
|
+ showCallOverlay.set(true);
|
|
|
+ showControls.set(true);
|
|
|
+ } catch (err) {
|
|
|
+ // If the user denies the permission or an error occurs, show an error message
|
|
|
+ toast.error(
|
|
|
+ $i18n.t('Permission denied when accessing media devices')
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ aria-label="Call"
|
|
|
+ >
|
|
|
+ <Headphone className="size-5" />
|
|
|
+ </button>
|
|
|
+ </Tooltip>
|
|
|
+ </div>
|
|
|
+ {:else}
|
|
|
+ <div class=" flex items-center">
|
|
|
+ <Tooltip content={$i18n.t('Send message')}>
|
|
|
+ <button
|
|
|
+ id="send-message-button"
|
|
|
+ class="{prompt !== ''
|
|
|
+ ? 'bg-black text-white hover:bg-gray-900 dark:bg-white dark:text-black dark:hover:bg-gray-100 '
|
|
|
+ : 'text-white bg-gray-200 dark:text-gray-900 dark:bg-gray-700 disabled'} transition rounded-full p-1.5 self-center"
|
|
|
+ type="submit"
|
|
|
+ disabled={prompt === ''}
|
|
|
+ >
|
|
|
+ <svg
|
|
|
+ xmlns="http://www.w3.org/2000/svg"
|
|
|
+ viewBox="0 0 16 16"
|
|
|
+ fill="currentColor"
|
|
|
+ class="size-6"
|
|
|
+ >
|
|
|
+ <path
|
|
|
+ fill-rule="evenodd"
|
|
|
+ d="M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z"
|
|
|
+ clip-rule="evenodd"
|
|
|
+ />
|
|
|
+ </svg>
|
|
|
+ </button>
|
|
|
+ </Tooltip>
|
|
|
+ </div>
|
|
|
+ {/if}
|
|
|
+ {:else}
|
|
|
+ <div class=" flex items-center">
|
|
|
+ <Tooltip content={$i18n.t('Stop')}>
|
|
|
+ <button
|
|
|
+ class="bg-white hover:bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-white dark:hover:bg-gray-800 transition rounded-full p-1.5"
|
|
|
+ on:click={() => {
|
|
|
+ stopResponse();
|
|
|
+ }}
|
|
|
>
|
|
|
- <path
|
|
|
- fill-rule="evenodd"
|
|
|
- d="M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z"
|
|
|
- clip-rule="evenodd"
|
|
|
- />
|
|
|
- </svg>
|
|
|
- </button>
|
|
|
- </Tooltip>
|
|
|
- </div>
|
|
|
- {/if}
|
|
|
- {:else}
|
|
|
- <div class=" flex items-center mb-1.5">
|
|
|
- <Tooltip content={$i18n.t('Stop')}>
|
|
|
- <button
|
|
|
- class="bg-white hover:bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-white dark:hover:bg-gray-800 transition rounded-full p-1.5"
|
|
|
- on:click={() => {
|
|
|
- stopResponse();
|
|
|
- }}
|
|
|
- >
|
|
|
- <svg
|
|
|
- xmlns="http://www.w3.org/2000/svg"
|
|
|
- viewBox="0 0 24 24"
|
|
|
- fill="currentColor"
|
|
|
- class="size-6"
|
|
|
- >
|
|
|
- <path
|
|
|
- fill-rule="evenodd"
|
|
|
- d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm6-2.438c0-.724.588-1.312 1.313-1.312h4.874c.725 0 1.313.588 1.313 1.313v4.874c0 .725-.588 1.313-1.313 1.313H9.564a1.312 1.312 0 01-1.313-1.313V9.564z"
|
|
|
- clip-rule="evenodd"
|
|
|
- />
|
|
|
- </svg>
|
|
|
- </button>
|
|
|
- </Tooltip>
|
|
|
+ <svg
|
|
|
+ xmlns="http://www.w3.org/2000/svg"
|
|
|
+ viewBox="0 0 24 24"
|
|
|
+ fill="currentColor"
|
|
|
+ class="size-6"
|
|
|
+ >
|
|
|
+ <path
|
|
|
+ fill-rule="evenodd"
|
|
|
+ d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm6-2.438c0-.724.588-1.312 1.313-1.312h4.874c.725 0 1.313.588 1.313 1.313v4.874c0 .725-.588 1.313-1.313 1.313H9.564a1.312 1.312 0 01-1.313-1.313V9.564z"
|
|
|
+ clip-rule="evenodd"
|
|
|
+ />
|
|
|
+ </svg>
|
|
|
+ </button>
|
|
|
+ </Tooltip>
|
|
|
+ </div>
|
|
|
+ {/if}
|
|
|
</div>
|
|
|
- {/if}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</form>
|
|
|
{/if}
|