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
bf1936de
Commit
bf1936de
authored
Jun 11, 2024
by
Timothy J. Baek
Browse files
refac
parent
827dd1b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
backend/main.py
backend/main.py
+2
-0
src/routes/(app)/workspace/models/create/+page.svelte
src/routes/(app)/workspace/models/create/+page.svelte
+7
-5
No files found.
backend/main.py
View file @
bf1936de
...
@@ -299,6 +299,8 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
...
@@ -299,6 +299,8 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
context
+=
(
"
\n
"
if
context
!=
""
else
""
)
+
response
context
+=
(
"
\n
"
if
context
!=
""
else
""
)
+
response
del
data
[
"tool_ids"
]
del
data
[
"tool_ids"
]
print
(
context
)
# If docs field is present, generate RAG completions
# If docs field is present, generate RAG completions
if
"docs"
in
data
:
if
"docs"
in
data
:
data
=
{
**
data
}
data
=
{
**
data
}
...
...
src/routes/(app)/workspace/models/create/+page.svelte
View file @
bf1936de
...
@@ -60,10 +60,9 @@
...
@@ -60,10 +60,9 @@
id = name.replace(/\s+/g, '-').toLowerCase();
id = name.replace(/\s+/g, '-').toLowerCase();
}
}
let baseModel = null;
const addUsage = (base_model_id) => {
$: {
const baseModel = $models.find((m) => m.id === base_model_id);
baseModel = $models.find((m) => m.id === info.base_model_id);
console.log(baseModel);
if (baseModel) {
if (baseModel) {
if (baseModel.owned_by === 'openai') {
if (baseModel.owned_by === 'openai') {
capabilities.usage = baseModel.info?.meta?.capabilities?.usage ?? false;
capabilities.usage = baseModel.info?.meta?.capabilities?.usage ?? false;
...
@@ -72,7 +71,7 @@
...
@@ -72,7 +71,7 @@
}
}
capabilities = capabilities;
capabilities = capabilities;
}
}
}
}
;
const submitHandler = async () => {
const submitHandler = async () => {
loading = true;
loading = true;
...
@@ -360,6 +359,9 @@
...
@@ -360,6 +359,9 @@
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg"
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg"
placeholder="Select a base model (e.g. llama3, gpt-4o)"
placeholder="Select a base model (e.g. llama3, gpt-4o)"
bind:value={info.base_model_id}
bind:value={info.base_model_id}
on:change={(e) => {
addUsage(e.target.value);
}}
required
required
>
>
<option value={null} class=" text-gray-900">{$i18n.t('Select a base model')}</option>
<option value={null} class=" text-gray-900">{$i18n.t('Select a base model')}</option>
...
...
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