refac
This commit is contained in:
1 parent
212bb68a66
commit
bf4f44ee9c
9 files changed
+80
-20
No files matched your search
@@ -39,7 +39,9 @@
|
|||||||
let provider = '';
|
let provider = '';
|
||||||
$: azure =
|
$: azure =
|
||||||
provider === 'azure' ||
|
provider === 'azure' ||
|
||||||
((url.includes('azure.') || url.includes('cognitive.microsoft.com')) && !direct && provider === '');
|
((url.includes('azure.') || url.includes('cognitive.microsoft.com')) &&
|
||||||
|
!direct &&
|
||||||
|
provider === '');
|
||||||
|
|
||||||
let prefixId = '';
|
let prefixId = '';
|
||||||
let enable = true;
|
let enable = true;
|
||||||
|
|||||||
@@ -283,7 +283,9 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{#if entry.type === 'file' && entry.size !== undefined && !renaming}
|
{#if entry.type === 'file' && entry.size !== undefined && !renaming}
|
||||||
{#if showDate && entry.modified}
|
{#if showDate && entry.modified}
|
||||||
<span class="text-[10px] text-gray-400 shrink-0">{formatRelativeTime(entry.modified)}</span>
|
<span class="text-[10px] text-gray-400 shrink-0"
|
||||||
|
>{formatRelativeTime(entry.modified)}</span
|
||||||
|
>
|
||||||
{/if}
|
{/if}
|
||||||
<span class="text-xs text-gray-400 shrink-0">{formatFileSize(entry.size)}</span>
|
<span class="text-xs text-gray-400 shrink-0">{formatFileSize(entry.size)}</span>
|
||||||
{:else if entry.type === 'directory' && showDate && entry.modified && !renaming}
|
{:else if entry.type === 'directory' && showDate && entry.modified && !renaming}
|
||||||
|
|||||||
@@ -173,8 +173,15 @@
|
|||||||
class="shrink-0 p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800 transition text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400"
|
class="shrink-0 p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800 transition text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400"
|
||||||
aria-label={$i18n.t('Sort')}
|
aria-label={$i18n.t('Sort')}
|
||||||
>
|
>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-3.5">
|
<svg
|
||||||
<path d="M2 3.75A.75.75 0 0 1 2.75 3h11.5a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 3.75ZM2 7.5a.75.75 0 0 1 .75-.75h7.508a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 7.5ZM14 7a.75.75 0 0 1 .75.75v6.69l1.72-1.72a.75.75 0 1 1 1.06 1.06l-3 3a.75.75 0 0 1-1.06 0l-3-3a.75.75 0 1 1 1.06-1.06l1.72 1.72V7.75A.75.75 0 0 1 14 7ZM2 11.25a.75.75 0 0 1 .75-.75h4.562a.75.75 0 0 1 0 1.5H2.75a.75.75 0 0 1-.75-.75Z" />
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
fill="currentColor"
|
||||||
|
class="size-3.5"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M2 3.75A.75.75 0 0 1 2.75 3h11.5a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 3.75ZM2 7.5a.75.75 0 0 1 .75-.75h7.508a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 7.5ZM14 7a.75.75 0 0 1 .75.75v6.69l1.72-1.72a.75.75 0 1 1 1.06 1.06l-3 3a.75.75 0 0 1-1.06 0l-3-3a.75.75 0 1 1 1.06-1.06l1.72 1.72V7.75A.75.75 0 0 1 14 7ZM2 11.25a.75.75 0 0 1 .75-.75h4.562a.75.75 0 0 1 0 1.5H2.75a.75.75 0 0 1-.75-.75Z"
|
||||||
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
@@ -190,8 +197,19 @@
|
|||||||
>
|
>
|
||||||
<span class="flex-1 text-left">{$i18n.t('Name')}</span>
|
<span class="flex-1 text-left">{$i18n.t('Name')}</span>
|
||||||
{#if sortBy === 'name'}
|
{#if sortBy === 'name'}
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="size-3 text-gray-500 dark:text-gray-400 transition-transform {sortAsc ? '' : 'rotate-180'}">
|
<svg
|
||||||
<path fill-rule="evenodd" d="M11.78 9.78a.75.75 0 0 1-1.06 0L8 7.06 5.28 9.78a.75.75 0 0 1-1.06-1.06l3.25-3.25a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1 0 1.06Z" clip-rule="evenodd" />
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 16 16"
|
||||||
|
fill="currentColor"
|
||||||
|
class="size-3 text-gray-500 dark:text-gray-400 transition-transform {sortAsc
|
||||||
|
? ''
|
||||||
|
: 'rotate-180'}"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fill-rule="evenodd"
|
||||||
|
d="M11.78 9.78a.75.75 0 0 1-1.06 0L8 7.06 5.28 9.78a.75.75 0 0 1-1.06-1.06l3.25-3.25a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1 0 1.06Z"
|
||||||
|
clip-rule="evenodd"
|
||||||
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
@@ -202,8 +220,19 @@
|
|||||||
>
|
>
|
||||||
<span class="flex-1 text-left">{$i18n.t('Date Modified')}</span>
|
<span class="flex-1 text-left">{$i18n.t('Date Modified')}</span>
|
||||||
{#if sortBy === 'date'}
|
{#if sortBy === 'date'}
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="size-3 text-gray-500 dark:text-gray-400 transition-transform {sortAsc ? '' : 'rotate-180'}">
|
<svg
|
||||||
<path fill-rule="evenodd" d="M11.78 9.78a.75.75 0 0 1-1.06 0L8 7.06 5.28 9.78a.75.75 0 0 1-1.06-1.06l3.25-3.25a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1 0 1.06Z" clip-rule="evenodd" />
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 16 16"
|
||||||
|
fill="currentColor"
|
||||||
|
class="size-3 text-gray-500 dark:text-gray-400 transition-transform {sortAsc
|
||||||
|
? ''
|
||||||
|
: 'rotate-180'}"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fill-rule="evenodd"
|
||||||
|
d="M11.78 9.78a.75.75 0 0 1-1.06 0L8 7.06 5.28 9.78a.75.75 0 0 1-1.06-1.06l3.25-3.25a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1 0 1.06Z"
|
||||||
|
clip-rule="evenodd"
|
||||||
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -671,7 +671,11 @@
|
|||||||
// Only handle M key when not typing in an input/textarea
|
// Only handle M key when not typing in an input/textarea
|
||||||
if (e.key === 'm' || e.key === 'M') {
|
if (e.key === 'm' || e.key === 'M') {
|
||||||
const target = e.target as HTMLElement;
|
const target = e.target as HTMLElement;
|
||||||
if (target.tagName !== 'INPUT' && target.tagName !== 'TEXTAREA' && !target.isContentEditable) {
|
if (
|
||||||
|
target.tagName !== 'INPUT' &&
|
||||||
|
target.tagName !== 'TEXTAREA' &&
|
||||||
|
!target.isContentEditable
|
||||||
|
) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
toggleMute();
|
toggleMute();
|
||||||
}
|
}
|
||||||
@@ -1030,7 +1034,9 @@
|
|||||||
|
|
||||||
<Tooltip content={muted ? $i18n.t('Unmute') + ' (M)' : $i18n.t('Mute') + ' (M)'}>
|
<Tooltip content={muted ? $i18n.t('Unmute') + ' (M)' : $i18n.t('Mute') + ' (M)'}>
|
||||||
<button
|
<button
|
||||||
class="p-3 rounded-full transition-colors duration-200 {muted ? 'bg-red-500 text-white' : 'bg-gray-50 dark:bg-gray-900'}"
|
class="p-3 rounded-full transition-colors duration-200 {muted
|
||||||
|
? 'bg-red-500 text-white'
|
||||||
|
: 'bg-gray-50 dark:bg-gray-900'}"
|
||||||
type="button"
|
type="button"
|
||||||
aria-label={muted ? $i18n.t('Unmute') : $i18n.t('Mute')}
|
aria-label={muted ? $i18n.t('Unmute') : $i18n.t('Mute')}
|
||||||
on:click={toggleMute}
|
on:click={toggleMute}
|
||||||
@@ -1050,7 +1056,15 @@
|
|||||||
stroke-linejoin="round"
|
stroke-linejoin="round"
|
||||||
d="M12 18.75a6 6 0 0 0 6-6v-1.5m-6 7.5a6 6 0 0 1-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 0 1-3-3V4.5a3 3 0 1 1 6 0v8.25a3 3 0 0 1-3 3Z"
|
d="M12 18.75a6 6 0 0 0 6-6v-1.5m-6 7.5a6 6 0 0 1-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 0 1-3-3V4.5a3 3 0 1 1 6 0v8.25a3 3 0 0 1-3 3Z"
|
||||||
/>
|
/>
|
||||||
<line x1="3" y1="3" x2="21" y2="21" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
|
<line
|
||||||
|
x1="3"
|
||||||
|
y1="3"
|
||||||
|
x2="21"
|
||||||
|
y2="21"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="1.5"
|
||||||
|
stroke-linecap="round"
|
||||||
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
{:else}
|
{:else}
|
||||||
<!-- Mic On icon -->
|
<!-- Mic On icon -->
|
||||||
|
|||||||
@@ -238,7 +238,13 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const mineTypes = ['audio/webm; codecs=opus', 'audio/webm', 'audio/ogg; codecs=opus', 'audio/mp4', 'audio/wav'];
|
const mineTypes = [
|
||||||
|
'audio/webm; codecs=opus',
|
||||||
|
'audio/webm',
|
||||||
|
'audio/ogg; codecs=opus',
|
||||||
|
'audio/mp4',
|
||||||
|
'audio/wav'
|
||||||
|
];
|
||||||
|
|
||||||
mediaRecorder = new MediaRecorder(stream, {
|
mediaRecorder = new MediaRecorder(stream, {
|
||||||
mimeType: mineTypes.find((type) => MediaRecorder.isTypeSupported(type))
|
mimeType: mineTypes.find((type) => MediaRecorder.isTypeSupported(type))
|
||||||
|
|||||||
@@ -125,10 +125,11 @@
|
|||||||
{#if item.model.loaded}
|
{#if item.model.loaded}
|
||||||
<div class="flex items-center translate-y-[0.5px] px-0.5">
|
<div class="flex items-center translate-y-[0.5px] px-0.5">
|
||||||
<Tooltip
|
<Tooltip
|
||||||
content={item.model.ollama?.expires_at && new Date(item.model.ollama?.expires_at * 1000) > new Date()
|
content={item.model.ollama?.expires_at &&
|
||||||
|
new Date(item.model.ollama?.expires_at * 1000) > new Date()
|
||||||
? `${$i18n.t('Unloads {{FROM_NOW}}', {
|
? `${$i18n.t('Unloads {{FROM_NOW}}', {
|
||||||
FROM_NOW: dayjs(item.model.ollama?.expires_at * 1000).fromNow()
|
FROM_NOW: dayjs(item.model.ollama?.expires_at * 1000).fromNow()
|
||||||
})}`
|
})}`
|
||||||
: `${$i18n.t('Loaded')}`}
|
: `${$i18n.t('Loaded')}`}
|
||||||
className="self-end"
|
className="self-end"
|
||||||
>
|
>
|
||||||
@@ -236,7 +237,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ml-auto pl-2 pr-1 flex items-center gap-1.5 shrink-0">
|
<div class="ml-auto pl-2 pr-1 flex items-center gap-1.5 shrink-0">
|
||||||
{#if $user?.role === 'admin' && item.model.loaded}
|
{#if $user?.role === 'admin' && item.model.loaded}
|
||||||
<Tooltip
|
<Tooltip
|
||||||
content={`${$i18n.t('Eject')}`}
|
content={`${$i18n.t('Eject')}`}
|
||||||
className="flex-shrink-0 group-hover/item:opacity-100 opacity-0 "
|
className="flex-shrink-0 group-hover/item:opacity-100 opacity-0 "
|
||||||
|
|||||||
@@ -155,7 +155,12 @@
|
|||||||
|
|
||||||
{#if chat.share_id}
|
{#if chat.share_id}
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
<AccessControl bind:accessGrants accessRoles={['read']} sharePublic={$user?.permissions?.sharing?.public_chats || $user?.role === 'admin'} onChange={saveAccessGrants} />
|
<AccessControl
|
||||||
|
bind:accessGrants
|
||||||
|
accessRoles={['read']}
|
||||||
|
sharePublic={$user?.permissions?.sharing?.public_chats || $user?.role === 'admin'}
|
||||||
|
onChange={saveAccessGrants}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|||||||
@@ -324,7 +324,9 @@
|
|||||||
<button
|
<button
|
||||||
class="self-center"
|
class="self-center"
|
||||||
aria-label={$i18n.t('Close')}
|
aria-label={$i18n.t('Close')}
|
||||||
on:click={() => { showControls = false; }}
|
on:click={() => {
|
||||||
|
showControls = false;
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<XMark className="size-5" />
|
<XMark className="size-5" />
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -750,8 +750,7 @@ const convertOpenAIMessages = (convo) => {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const model =
|
const model = message['message']?.['metadata']?.['model_slug'] || 'gpt-3.5-turbo';
|
||||||
message['message']?.['metadata']?.['model_slug'] || 'gpt-3.5-turbo';
|
|
||||||
const timestamp = message['message']?.['create_time']
|
const timestamp = message['message']?.['create_time']
|
||||||
? Math.floor(message['message']['create_time'])
|
? Math.floor(message['message']['create_time'])
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|||||||
Reference in new issue
Block a user