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
32cb5f3c
Commit
32cb5f3c
authored
Mar 25, 2024
by
Timothy J. Baek
Browse files
feat: external model info
parent
eb004ccf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
21 deletions
+27
-21
src/lib/apis/litellm/index.ts
src/lib/apis/litellm/index.ts
+1
-1
src/lib/components/chat/ModelSelector/Selector.svelte
src/lib/components/chat/ModelSelector/Selector.svelte
+22
-20
src/lib/utils/index.ts
src/lib/utils/index.ts
+4
-0
No files found.
src/lib/apis/litellm/index.ts
View file @
32cb5f3c
...
@@ -33,7 +33,7 @@ export const getLiteLLMModels = async (token: string = '') => {
...
@@ -33,7 +33,7 @@ export const getLiteLLMModels = async (token: string = '') => {
id
:
model
.
id
,
id
:
model
.
id
,
name
:
model
.
name
??
model
.
id
,
name
:
model
.
name
??
model
.
id
,
external
:
true
,
external
:
true
,
source
:
'
l
ite
llm
'
source
:
'
L
ite
LLM
'
}))
}))
.
sort
((
a
,
b
)
=>
{
.
sort
((
a
,
b
)
=>
{
return
a
.
name
.
localeCompare
(
b
.
name
);
return
a
.
name
.
localeCompare
(
b
.
name
);
...
...
src/lib/components/chat/ModelSelector/Selector.svelte
View file @
32cb5f3c
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
import { user, MODEL_DOWNLOAD_POOL, models } from '$lib/stores';
import { user, MODEL_DOWNLOAD_POOL, models } from '$lib/stores';
import { toast } from 'svelte-sonner';
import { toast } from 'svelte-sonner';
import { getModels, splitStream } from '$lib/utils';
import {
capitalizeFirstLetter,
getModels, splitStream } from '$lib/utils';
import Tooltip from '$lib/components/common/Tooltip.svelte';
import Tooltip from '$lib/components/common/Tooltip.svelte';
const i18n = getContext('i18n');
const i18n = getContext('i18n');
...
@@ -225,25 +225,27 @@
...
@@ -225,25 +225,27 @@
</div>
</div>
{#if item.info.external}
{#if item.info.external}
<div class=" mr-2">
<Tooltip content={item.info?.source ?? 'External'}>
<svg
<div class=" mr-2">
xmlns="http://www.w3.org/2000/svg"
<svg
viewBox="0 0 16 16"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
viewBox="0 0 16 16"
class="w-4 h-4"
fill="currentColor"
>
class="w-4 h-4"
<path
>
fill-rule="evenodd"
<path
d="M8.914 6.025a.75.75 0 0 1 1.06 0 3.5 3.5 0 0 1 0 4.95l-2 2a3.5 3.5 0 0 1-5.396-4.402.75.75 0 0 1 1.251.827 2 2 0 0 0 3.085 2.514l2-2a2 2 0 0 0 0-2.828.75.75 0 0 1 0-1.06Z"
fill-rule="evenodd"
clip-rule="evenodd"
d="M8.914 6.025a.75.75 0 0 1 1.06 0 3.5 3.5 0 0 1 0 4.95l-2 2a3.5 3.5 0 0 1-5.396-4.402.75.75 0 0 1 1.251.827 2 2 0 0 0 3.085 2.514l2-2a2 2 0 0 0 0-2.828.75.75 0 0 1 0-1.06Z"
/>
clip-rule="evenodd"
<path
/>
fill-rule="evenodd"
<path
d="M7.086 9.975a.75.75 0 0 1-1.06 0 3.5 3.5 0 0 1 0-4.95l2-2a3.5 3.5 0 0 1 5.396 4.402.75.75 0 0 1-1.251-.827 2 2 0 0 0-3.085-2.514l-2 2a2 2 0 0 0 0 2.828.75.75 0 0 1 0 1.06Z"
fill-rule="evenodd"
clip-rule="evenodd"
d="M7.086 9.975a.75.75 0 0 1-1.06 0 3.5 3.5 0 0 1 0-4.95l2-2a3.5 3.5 0 0 1 5.396 4.402.75.75 0 0 1-1.251-.827 2 2 0 0 0-3.085-2.514l-2 2a2 2 0 0 0 0 2.828.75.75 0 0 1 0 1.06Z"
/>
clip-rule="evenodd"
</svg>
/>
</div>
</svg>
</div>
</Tooltip>
{/if}
{/if}
</div>
</div>
...
...
src/lib/utils/index.ts
View file @
32cb5f3c
...
@@ -31,6 +31,10 @@ export const getModels = async (token: string) => {
...
@@ -31,6 +31,10 @@ export const getModels = async (token: string) => {
// Helper functions
// Helper functions
//////////////////////////
//////////////////////////
export
const
capitalizeFirstLetter
=
(
string
)
=>
{
return
string
.
charAt
(
0
).
toUpperCase
()
+
string
.
slice
(
1
);
};
export
const
splitStream
=
(
splitOn
)
=>
{
export
const
splitStream
=
(
splitOn
)
=>
{
let
buffer
=
''
;
let
buffer
=
''
;
return
new
TransformStream
({
return
new
TransformStream
({
...
...
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