mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
fix: models
This commit is contained in:
@@ -63,7 +63,10 @@ export const getModelInfos = async (token: string = '') => {
|
||||
export const getModelById = async (token: string, id: string) => {
|
||||
let error = null;
|
||||
|
||||
const res = await fetch(`${WEBUI_API_BASE_URL}/models/${id}`, {
|
||||
const url = new URL(`${WEBUI_API_BASE_URL}/models`);
|
||||
url.searchParams.append('id', id);
|
||||
|
||||
const res = await fetch(url.toString(), {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
@@ -95,7 +98,10 @@ export const getModelById = async (token: string, id: string) => {
|
||||
export const updateModelById = async (token: string, id: string, model: object) => {
|
||||
let error = null;
|
||||
|
||||
const res = await fetch(`${WEBUI_API_BASE_URL}/models/${id}/update`, {
|
||||
const url = new URL(`${WEBUI_API_BASE_URL}/models/update`);
|
||||
url.searchParams.append('id', id);
|
||||
|
||||
const res = await fetch(url.toString(), {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
@@ -128,7 +134,10 @@ export const updateModelById = async (token: string, id: string, model: object)
|
||||
export const deleteModelById = async (token: string, id: string) => {
|
||||
let error = null;
|
||||
|
||||
const res = await fetch(`${WEBUI_API_BASE_URL}/models/${id}/delete`, {
|
||||
const url = new URL(`${WEBUI_API_BASE_URL}/models/delete`);
|
||||
url.searchParams.append('id', id);
|
||||
|
||||
const res = await fetch(url.toString(), {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
|
||||
@@ -302,7 +302,7 @@
|
||||
system: system !== '' ? system : undefined,
|
||||
params: {
|
||||
seed: (params.seed !== 0 ? params.seed : undefined) ?? undefined,
|
||||
stop: params.stop !== null ? params.stop.split(',').filter((e) => e) : undefined,
|
||||
stop: params.stop ? params.stop.split(',').filter((e) => e) : undefined,
|
||||
temperature: params.temperature !== '' ? params.temperature : undefined,
|
||||
frequency_penalty:
|
||||
params.frequency_penalty !== '' ? params.frequency_penalty : undefined,
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
info.id = id;
|
||||
info.name = name;
|
||||
info.meta.capabilities = capabilities;
|
||||
info.params.stop = params.stop !== null ? params.stop.split(',').filter((s) => s.trim()) : null;
|
||||
info.params.stop = params.stop ? params.stop.split(',').filter((s) => s.trim()) : null;
|
||||
|
||||
if ($models.find((m) => m.id === info.id)) {
|
||||
toast.error(
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
info.id = id;
|
||||
info.name = name;
|
||||
info.meta.capabilities = capabilities;
|
||||
info.params.stop = params.stop !== null ? params.stop.split(',').filter((s) => s.trim()) : null;
|
||||
info.params.stop = params.stop ? params.stop.split(',').filter((s) => s.trim()) : null;
|
||||
|
||||
const res = await updateModelById(localStorage.token, info.id, info);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user