Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
09534dad
Unverified
Commit
09534dad
authored
Jan 29, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Jan 29, 2024
Browse files
Merge branch 'main' into patch-1
parents
c4dd20b0
b5c10ff1
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
395 additions
and
246 deletions
+395
-246
src/lib/components/chat/Settings/Account.svelte
src/lib/components/chat/Settings/Account.svelte
+179
-0
src/lib/components/chat/Settings/Account/UpdatePassword.svelte
...ib/components/chat/Settings/Account/UpdatePassword.svelte
+106
-0
src/lib/components/chat/SettingsModal.svelte
src/lib/components/chat/SettingsModal.svelte
+52
-211
src/lib/components/layout/Sidebar.svelte
src/lib/components/layout/Sidebar.svelte
+2
-1
src/lib/constants.ts
src/lib/constants.ts
+1
-1
src/lib/stores/index.ts
src/lib/stores/index.ts
+1
-0
src/lib/utils/index.ts
src/lib/utils/index.ts
+52
-31
src/routes/(app)/+page.svelte
src/routes/(app)/+page.svelte
+1
-1
src/routes/(app)/c/[id]/+page.svelte
src/routes/(app)/c/[id]/+page.svelte
+1
-1
No files found.
src/lib/components/chat/Settings/Account.svelte
0 → 100644
View file @
09534dad
<script lang="ts">
import toast from 'svelte-french-toast';
import { onMount } from 'svelte';
import { user } from '$lib/stores';
import { updateUserProfile } from '$lib/apis/auths';
import UpdatePassword from './Account/UpdatePassword.svelte';
import { getGravatarUrl } from '$lib/apis/utils';
export let saveHandler: Function;
let profileImageUrl = '';
let name = '';
const submitHandler = async () => {
const updatedUser = await updateUserProfile(localStorage.token, name, profileImageUrl).catch(
(error) => {
toast.error(error);
}
);
if (updatedUser) {
await user.set(updatedUser);
return true;
}
return false;
};
onMount(() => {
name = $user.name;
profileImageUrl = $user.profile_image_url;
});
</script>
<div class="flex flex-col h-full justify-between text-sm">
<div class=" space-y-3 pr-1.5 overflow-y-scroll max-h-80">
<input
id="profile-image-input"
type="file"
hidden
accept="image/*"
on:change={(e) => {
const files = e?.target?.files ?? [];
let reader = new FileReader();
reader.onload = (event) => {
let originalImageUrl = `${event.target.result}`;
const img = new Image();
img.src = originalImageUrl;
img.onload = function () {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
// Calculate the aspect ratio of the image
const aspectRatio = img.width / img.height;
// Calculate the new width and height to fit within 100x100
let newWidth, newHeight;
if (aspectRatio > 1) {
newWidth = 100 * aspectRatio;
newHeight = 100;
} else {
newWidth = 100;
newHeight = 100 / aspectRatio;
}
// Set the canvas size
canvas.width = 100;
canvas.height = 100;
// Calculate the position to center the image
const offsetX = (100 - newWidth) / 2;
const offsetY = (100 - newHeight) / 2;
// Draw the image on the canvas
ctx.drawImage(img, offsetX, offsetY, newWidth, newHeight);
// Get the base64 representation of the compressed image
const compressedSrc = canvas.toDataURL('image/jpeg');
// Display the compressed image
profileImageUrl = compressedSrc;
e.target.files = null;
};
};
if (
files.length > 0 &&
['image/gif', 'image/jpeg', 'image/png'].includes(files[0]['type'])
) {
reader.readAsDataURL(files[0]);
}
}}
/>
<div class=" mb-2.5 text-sm font-medium">Profile</div>
<div class="flex space-x-5">
<div class="flex flex-col">
<div class="self-center">
<button
class="relative rounded-full dark:bg-gray-700"
type="button"
on:click={() => {
document.getElementById('profile-image-input')?.click();
}}
>
<img
src={profileImageUrl !== '' ? profileImageUrl : '/user.png'}
alt="profile"
class=" rounded-full w-16 h-16 object-cover"
/>
<div
class="absolute flex justify-center rounded-full bottom-0 left-0 right-0 top-0 h-full w-full overflow-hidden bg-gray-700 bg-fixed opacity-0 transition duration-300 ease-in-out hover:opacity-50"
>
<div class="my-auto text-gray-100">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
class="w-5 h-5"
>
<path
d="m2.695 14.762-1.262 3.155a.5.5 0 0 0 .65.65l3.155-1.262a4 4 0 0 0 1.343-.886L17.5 5.501a2.121 2.121 0 0 0-3-3L3.58 13.419a4 4 0 0 0-.885 1.343Z"
/>
</svg>
</div>
</div>
</button>
</div>
<button
class=" text-xs text-gray-600"
on:click={async () => {
const url = await getGravatarUrl($user.email);
profileImageUrl = url;
}}>Use Gravatar</button
>
</div>
<div class="flex-1">
<div class="flex flex-col w-full">
<div class=" mb-1 text-xs text-gray-500">Name</div>
<div class="flex-1">
<input
class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none"
type="text"
bind:value={name}
required
/>
</div>
</div>
</div>
</div>
<hr class=" dark:border-gray-700 my-4" />
<UpdatePassword />
</div>
<div class="flex justify-end pt-3 text-sm font-medium">
<button
class=" px-4 py-2 bg-emerald-600 hover:bg-emerald-700 text-gray-100 transition rounded"
on:click={async () => {
const res = await submitHandler();
if (res) {
saveHandler();
}
}}
>
Save
</button>
</div>
</div>
src/lib/components/chat/Settings/Account/UpdatePassword.svelte
0 → 100644
View file @
09534dad
<script lang="ts">
import toast from 'svelte-french-toast';
import { updateUserPassword } from '$lib/apis/auths';
let show = false;
let currentPassword = '';
let newPassword = '';
let newPasswordConfirm = '';
const updatePasswordHandler = async () => {
if (newPassword === newPasswordConfirm) {
const res = await updateUserPassword(localStorage.token, currentPassword, newPassword).catch(
(error) => {
toast.error(error);
return null;
}
);
if (res) {
toast.success('Successfully updated.');
}
currentPassword = '';
newPassword = '';
newPasswordConfirm = '';
} else {
toast.error(
`The passwords you entered don't quite match. Please double-check and try again.`
);
newPassword = '';
newPasswordConfirm = '';
}
};
</script>
<form
class="flex flex-col text-sm"
on:submit|preventDefault={() => {
updatePasswordHandler();
}}
>
<div class="flex justify-between mb-2.5 items-center text-sm">
<div class=" font-medium">Change Password</div>
<button
class=" text-xs font-medium text-gray-500"
type="button"
on:click={() => {
show = !show;
}}>{show ? 'Hide' : 'Show'}</button
>
</div>
{#if show}
<div class=" space-y-1.5">
<div class="flex flex-col w-full">
<div class=" mb-1 text-xs text-gray-500">Current Password</div>
<div class="flex-1">
<input
class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none"
type="password"
bind:value={currentPassword}
autocomplete="current-password"
required
/>
</div>
</div>
<div class="flex flex-col w-full">
<div class=" mb-1 text-xs text-gray-500">New Password</div>
<div class="flex-1">
<input
class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none"
type="password"
bind:value={newPassword}
autocomplete="new-password"
required
/>
</div>
</div>
<div class="flex flex-col w-full">
<div class=" mb-1 text-xs text-gray-500">Confirm Password</div>
<div class="flex-1">
<input
class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none"
type="password"
bind:value={newPasswordConfirm}
autocomplete="off"
required
/>
</div>
</div>
</div>
<div class="mt-3 flex justify-end">
<button
class=" px-4 py-2 text-xs bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-800 text-gray-100 transition rounded-md font-medium"
>
Update password
</button>
</div>
{/if}
</form>
src/lib/components/chat/SettingsModal.svelte
View file @
09534dad
...
...
@@ -20,7 +20,7 @@
import { createNewChat, deleteAllChats, getAllChats, getChatList } from '$lib/apis/chats';
import { WEB_UI_VERSION, WEBUI_API_BASE_URL } from '$lib/constants';
import { config, models, settings, user, chats } from '$lib/stores';
import { config, models,
voices,
settings, user, chats } from '$lib/stores';
import { splitStream, getGravatarURL, getImportOrigin, convertOpenAIChats } from '$lib/utils';
import Advanced from './Settings/Advanced.svelte';
...
...
@@ -36,6 +36,8 @@
import { resetVectorDB } from '$lib/apis/rag';
import { setDefaultPromptSuggestions } from '$lib/apis/configs';
import { getBackendConfig } from '$lib/apis';
import UpdatePassword from './Settings/Account/UpdatePassword.svelte';
import Account from './Settings/Account.svelte';
export let show = false;
...
...
@@ -112,6 +114,9 @@
let gravatarEmail = '';
let titleAutoGenerateModel = '';
// Voice
let speakVoice = '';
// Chats
let saveChatHistory = true;
let importFiles;
...
...
@@ -123,6 +128,7 @@
let authContent = '';
// Account
let profileImageUrl = '';
let currentPassword = '';
let newPassword = '';
let newPasswordConfirm = '';
...
...
@@ -556,31 +562,6 @@
return models;
};
const updatePasswordHandler = async () => {
if (newPassword === newPasswordConfirm) {
const res = await updateUserPassword(localStorage.token, currentPassword, newPassword).catch(
(error) => {
toast.error(error);
return null;
}
);
if (res) {
toast.success('Successfully updated.');
}
currentPassword = '';
newPassword = '';
newPasswordConfirm = '';
} else {
toast.error(
`The passwords you entered don't quite match. Please double-check and try again.`
);
newPassword = '';
newPasswordConfirm = '';
}
};
onMount(async () => {
console.log('settings', $user.role === 'admin');
if ($user.role === 'admin') {
...
...
@@ -613,14 +594,19 @@
responseAutoCopy = settings.responseAutoCopy ?? false;
titleAutoGenerateModel = settings.titleAutoGenerateModel ?? '';
gravatarEmail = settings.gravatarEmail ?? '';
speakVoice = settings.speakVoice ?? '';
saveChatHistory = settings.saveChatHistory ?? true;
const getVoicesLoop = setInterval(async () => {
const _voices = await speechSynthesis.getVoices();
await voices.set(_voices);
authEnabled = settings.authHeader !== undefined ? true : false;
if (authEnabled) {
authType = settings.authHeader.split(' ')[0];
authContent = settings.authHeader.split(' ')[1];
}
// do your loop
if (_voices.length > 0) {
clearInterval(getVoicesLoop);
}
}, 100);
saveChatHistory = settings.saveChatHistory ?? true;
ollamaVersion = await getOllamaVersion(localStorage.token).catch((error) => {
return '';
...
...
@@ -901,7 +887,7 @@
toggleTheme();
}}
>
</button> -->
<div class="flex items-center relative">
...
...
@@ -1602,6 +1588,9 @@
<form
class="flex flex-col h-full justify-between space-y-3 text-sm"
on:submit|preventDefault={() => {
saveSettings({
speakVoice: speakVoice !== '' ? speakVoice : undefined
});
show = false;
}}
>
...
...
@@ -1683,7 +1672,7 @@
bind:value={titleAutoGenerateModel}
placeholder="Select a model"
>
<option value="" selected>
Default
</option>
<option value="" selected>
Current Model
</option>
{#each $models.filter((m) => m.size != null) as model}
<option value={model.name} class="bg-gray-100 dark:bg-gray-700"
>{model.name +
...
...
@@ -1720,7 +1709,31 @@
</div>
</div>
<!-- <hr class=" dark:border-gray-700" />
<hr class=" dark:border-gray-700" />
<div class=" space-y-3">
<div>
<div class=" mb-2.5 text-sm font-medium">Set Default Voice</div>
<div class="flex w-full">
<div class="flex-1">
<select
class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none"
bind:value={speakVoice}
placeholder="Select a voice"
>
<option value="" selected>Default</option>
{#each $voices.filter((v) => v.localService === true) as voice}
<option value={voice.name} class="bg-gray-100 dark:bg-gray-700"
>{voice.name}</option
>
{/each}
</select>
</div>
</div>
</div>
</div>
<!--
<div>
<div class=" mb-2.5 text-sm font-medium">
Gravatar Email <span class=" text-gray-400 text-sm">(optional)</span>
...
...
@@ -1998,184 +2011,12 @@
{/if}
</div>
</div>
{:else if selectedTab === 'auth'}
<form
class="flex flex-col h-full justify-between space-y-3 text-sm"
on:submit|preventDefault={() => {
console.log('auth save');
saveSettings({
authHeader: authEnabled ? `${authType} ${authContent}` : undefined
});
show = false;
}}
>
<div class=" space-y-3">
<div>
<div class=" py-1 flex w-full justify-between">
<div class=" self-center text-sm font-medium">Authorization Header</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
toggleAuthHeader();
}}
>
{#if authEnabled === true}
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
class="w-4 h-4"
>
<path
fill-rule="evenodd"
d="M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z"
clip-rule="evenodd"
/>
</svg>
<span class="ml-2 self-center"> On </span>
{:else}
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
class="w-4 h-4"
>
<path
d="M18 1.5c2.9 0 5.25 2.35 5.25 5.25v3.75a.75.75 0 01-1.5 0V6.75a3.75 3.75 0 10-7.5 0v3a3 3 0 013 3v6.75a3 3 0 01-3 3H3.75a3 3 0 01-3-3v-6.75a3 3 0 013-3h9v-3c0-2.9 2.35-5.25 5.25-5.25z"
/>
</svg>
<span class="ml-2 self-center">Off</span>
{/if}
</button>
</div>
</div>
{#if authEnabled}
<hr class=" dark:border-gray-700" />
<div class="mt-2">
<div class=" py-1 flex w-full space-x-2">
<button
class=" py-1 font-semibold flex rounded transition"
on:click={() => {
authType = authType === 'Basic' ? 'Bearer' : 'Basic';
}}
type="button"
>
{#if authType === 'Basic'}
<span class="self-center mr-2">Basic</span>
{:else if authType === 'Bearer'}
<span class="self-center mr-2">Bearer</span>
{/if}
</button>
<div class="flex-1">
<input
class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none"
placeholder="Enter Authorization Header Content"
bind:value={authContent}
/>
</div>
</div>
<div class="mt-2 text-xs text-gray-400 dark:text-gray-500">
Toggle between <span class=" text-gray-500 dark:text-gray-300 font-medium"
>'Basic'</span
>
and <span class=" text-gray-500 dark:text-gray-300 font-medium">'Bearer'</span> by
clicking on the label next to the input.
</div>
</div>
<hr class=" dark:border-gray-700" />
<div>
<div class=" mb-2.5 text-sm font-medium">Preview Authorization Header</div>
<textarea
value={JSON.stringify({
Authorization: `${authType} ${authContent}`
})}
class="w-full rounded p-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none resize-none"
rows="2"
disabled
/>
</div>
{/if}
</div>
<div class="flex justify-end pt-3 text-sm font-medium">
<button
class=" px-4 py-2 bg-emerald-600 hover:bg-emerald-700 text-gray-100 transition rounded"
type="submit"
>
Save
</button>
</div>
</form>
{:else if selectedTab === 'account'}
<form
class="flex flex-col h-full text-sm"
on:submit|preventDefault={() => {
updatePasswordHandler();
<Account
saveHandler={() => {
show = false;
}}
>
<div class=" mb-2.5 font-medium">Change Password</div>
<div class=" space-y-1.5">
<div class="flex flex-col w-full">
<div class=" mb-1 text-xs text-gray-500">Current Password</div>
<div class="flex-1">
<input
class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none"
type="password"
bind:value={currentPassword}
autocomplete="current-password"
required
/>
</div>
</div>
<div class="flex flex-col w-full">
<div class=" mb-1 text-xs text-gray-500">New Password</div>
<div class="flex-1">
<input
class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none"
type="password"
bind:value={newPassword}
autocomplete="new-password"
required
/>
</div>
</div>
<div class="flex flex-col w-full">
<div class=" mb-1 text-xs text-gray-500">Confirm Password</div>
<div class="flex-1">
<input
class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none"
type="password"
bind:value={newPasswordConfirm}
autocomplete="off"
required
/>
</div>
</div>
</div>
<div class="mt-3 flex justify-end">
<button
class=" px-4 py-2 text-xs bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-800 text-gray-100 transition rounded-md font-medium"
>
Update password
</button>
</div>
</form>
/>
{:else if selectedTab === 'about'}
<div class="flex flex-col h-full justify-between space-y-3 text-sm mb-6">
<div class=" space-y-3">
...
...
src/lib/components/layout/Sidebar.svelte
View file @
09534dad
...
...
@@ -321,8 +321,9 @@
return true;
} else {
let title = chat.title.toLowerCase();
const query = search.toLowerCase();
if (title.includes(
search
)) {
if (title.includes(
query
)) {
return true;
} else {
return false;
...
...
src/lib/constants.ts
View file @
09534dad
...
...
@@ -31,7 +31,7 @@ export const SUPPORTED_FILE_EXTENSIONS = [
'
pl
'
,
'
pm
'
,
'
r
'
,
'
dart
'
,
'
dockerfile
'
,
'
env
'
,
'
php
'
,
'
hs
'
,
'
hsc
'
,
'
lua
'
,
'
nginxconf
'
,
'
conf
'
,
'
m
'
,
'
mm
'
,
'
plsql
'
,
'
perl
'
,
'
rb
'
,
'
rs
'
,
'
db2
'
,
'
scala
'
,
'
bash
'
,
'
swift
'
,
'
vue
'
,
'
svelte
'
,
'
doc
'
,
'
docx
'
,
'
pdf
'
,
'
csv
'
,
'
txt
'
'
doc
'
,
'
docx
'
,
'
pdf
'
,
'
csv
'
,
'
txt
'
,
'
xls
'
,
'
xlsx
'
];
// Source: https://kit.svelte.dev/docs/modules#$env-static-public
...
...
src/lib/stores/index.ts
View file @
09534dad
...
...
@@ -12,6 +12,7 @@ export const chatId = writable('');
export
const
chats
=
writable
([]);
export
const
tags
=
writable
([]);
export
const
models
=
writable
([]);
export
const
voices
=
writable
([]);
export
const
modelfiles
=
writable
([]);
export
const
prompts
=
writable
([]);
...
...
src/lib/utils/index.ts
View file @
09534dad
...
...
@@ -212,8 +212,12 @@ const convertOpenAIMessages = (convo) => {
const
message
=
mapping
[
message_id
];
currentId
=
message_id
;
try
{
if
(
messages
.
length
==
0
&&
(
message
[
'
message
'
]
==
null
||
(
message
[
'
message
'
][
'
content
'
][
'
parts
'
]?.[
0
]
==
''
&&
message
[
'
message
'
][
'
content
'
][
'
text
'
]
==
null
)))
{
if
(
messages
.
length
==
0
&&
(
message
[
'
message
'
]
==
null
||
(
message
[
'
message
'
][
'
content
'
][
'
parts
'
]?.[
0
]
==
''
&&
message
[
'
message
'
][
'
content
'
][
'
text
'
]
==
null
))
)
{
// Skip chat messages with no content
continue
;
}
else
{
...
...
@@ -222,7 +226,10 @@ const convertOpenAIMessages = (convo) => {
parentId
:
lastId
,
childrenIds
:
message
[
'
children
'
]
||
[],
role
:
message
[
'
message
'
]?.[
'
author
'
]?.[
'
role
'
]
!==
'
user
'
?
'
assistant
'
:
'
user
'
,
content
:
message
[
'
message
'
]?.[
'
content
'
]?.[
'
parts
'
]?.[
0
]
||
message
[
'
message
'
]?.[
'
content
'
]?.[
'
text
'
]
||
''
,
content
:
message
[
'
message
'
]?.[
'
content
'
]?.[
'
parts
'
]?.[
0
]
||
message
[
'
message
'
]?.[
'
content
'
]?.[
'
text
'
]
||
''
,
model
:
'
gpt-3.5-turbo
'
,
done
:
true
,
context
:
null
...
...
@@ -231,7 +238,7 @@ const convertOpenAIMessages = (convo) => {
lastId
=
currentId
;
}
}
catch
(
error
)
{
console
.
log
(
"
Error with
"
,
message
,
"
\n
Error:
"
,
error
);
console
.
log
(
'
Error with
'
,
message
,
'
\n
Error:
'
,
error
);
}
}
...
...
@@ -256,31 +263,31 @@ const validateChat = (chat) => {
// Because ChatGPT sometimes has features we can't use like DALL-E or migh have corrupted messages, need to validate
const
messages
=
chat
.
messages
;
// Check if messages array is empty
if
(
messages
.
length
===
0
)
{
return
false
;
}
// Last message's children should be an empty array
const
lastMessage
=
messages
[
messages
.
length
-
1
];
if
(
lastMessage
.
childrenIds
.
length
!==
0
)
{
return
false
;
}
// First message's parent should be null
const
firstMessage
=
messages
[
0
];
if
(
firstMessage
.
parentId
!==
null
)
{
return
false
;
}
// Every message's content should be a string
for
(
let
message
of
messages
)
{
if
(
typeof
message
.
content
!==
'
string
'
)
{
return
false
;
}
}
return
true
;
// Check if messages array is empty
if
(
messages
.
length
===
0
)
{
return
false
;
}
// Last message's children should be an empty array
const
lastMessage
=
messages
[
messages
.
length
-
1
];
if
(
lastMessage
.
childrenIds
.
length
!==
0
)
{
return
false
;
}
// First message's parent should be null
const
firstMessage
=
messages
[
0
];
if
(
firstMessage
.
parentId
!==
null
)
{
return
false
;
}
// Every message's content should be a string
for
(
let
message
of
messages
)
{
if
(
typeof
message
.
content
!==
'
string
'
)
{
return
false
;
}
}
return
true
;
};
export
const
convertOpenAIChats
=
(
_chats
)
=>
{
...
...
@@ -298,8 +305,22 @@ export const convertOpenAIChats = (_chats) => {
chat
:
chat
,
timestamp
:
convo
[
'
timestamp
'
]
});
}
else
{
failed
++
}
}
else
{
failed
++
;
}
}
console
.
log
(
failed
,
"
Conversations could not be imported
"
);
console
.
log
(
failed
,
'
Conversations could not be imported
'
);
return
chats
;
};
export
const
isValidHttpUrl
=
(
string
)
=>
{
let
url
;
try
{
url
=
new
URL
(
string
);
}
catch
(
_
)
{
return
false
;
}
return
url
.
protocol
===
'
http:
'
||
url
.
protocol
===
'
https:
'
;
};
src/routes/(app)/+page.svelte
View file @
09534dad
...
...
@@ -519,7 +519,7 @@
.filter((message) => message)
.map((message, idx, arr) => ({
role: message.role,
...(message.files
...(message.files
?.filter((file) => file.type === 'image').length > 0 ?? false
? {
content: [
{
...
...
src/routes/(app)/c/[id]/+page.svelte
View file @
09534dad
...
...
@@ -530,7 +530,7 @@
.filter((message) => message)
.map((message, idx, arr) => ({
role: message.role,
...(message.files
...(message.files
?.filter((file) => file.type === 'image').length > 0 ?? false
? {
content: [
{
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment