Commit 4002ead6 authored by Jun Siang Cheah's avatar Jun Siang Cheah
Browse files

feat: store model configs in the database

parent 1bacd5d9
......@@ -29,6 +29,7 @@
"Advanced Parameters": "Напредни параметри",
"all": "сви",
"All Documents": "Сви документи",
"All selected models do not support image input, removed images": "",
"All Users": "Сви корисници",
"Allow": "Дозволи",
"Allow Chat Deletion": "Дозволи брисање ћаскања",
......@@ -392,7 +393,7 @@
"Select a model": "Изабери модел",
"Select an Ollama instance": "Изабери Ollama инстанцу",
"Select model": "Изабери модел",
"Selected model does not support image inputs.": "",
"Selected models do not support image inputs": "",
"Send": "",
"Send a Message": "Пошаљи поруку",
"Send message": "Пошаљи поруку",
......
......@@ -29,6 +29,7 @@
"Advanced Parameters": "Avancerade parametrar",
"all": "alla",
"All Documents": "",
"All selected models do not support image input, removed images": "",
"All Users": "Alla användare",
"Allow": "Tillåt",
"Allow Chat Deletion": "Tillåt chattborttagning",
......@@ -392,7 +393,7 @@
"Select a model": "Välj en modell",
"Select an Ollama instance": "Välj en Ollama-instans",
"Select model": "",
"Selected model does not support image inputs.": "",
"Selected models do not support image inputs": "",
"Send": "",
"Send a Message": "Skicka ett meddelande",
"Send message": "Skicka meddelande",
......
......@@ -29,6 +29,7 @@
"Advanced Parameters": "Gelişmiş Parametreler",
"all": "tümü",
"All Documents": "Tüm Belgeler",
"All selected models do not support image input, removed images": "",
"All Users": "Tüm Kullanıcılar",
"Allow": "İzin ver",
"Allow Chat Deletion": "Sohbet Silmeye İzin Ver",
......@@ -392,7 +393,7 @@
"Select a model": "Bir model seç",
"Select an Ollama instance": "Bir Ollama örneği seçin",
"Select model": "Model seç",
"Selected model does not support image inputs.": "",
"Selected models do not support image inputs": "",
"Send": "",
"Send a Message": "Bir Mesaj Gönder",
"Send message": "Mesaj gönder",
......
......@@ -29,6 +29,7 @@
"Advanced Parameters": "Розширені параметри",
"all": "всі",
"All Documents": "Усі документи",
"All selected models do not support image input, removed images": "",
"All Users": "Всі користувачі",
"Allow": "Дозволити",
"Allow Chat Deletion": "Дозволити видалення чату",
......@@ -392,7 +393,7 @@
"Select a model": "Виберіть модель",
"Select an Ollama instance": "Виберіть екземпляр Ollama",
"Select model": "Вибрати модель",
"Selected model does not support image inputs.": "",
"Selected models do not support image inputs": "",
"Send": "",
"Send a Message": "Надіслати повідомлення",
"Send message": "Надіслати повідомлення",
......
......@@ -29,6 +29,7 @@
"Advanced Parameters": "Các tham số Nâng cao",
"all": "tất cả",
"All Documents": "",
"All selected models do not support image input, removed images": "",
"All Users": "Danh sách người sử dụng",
"Allow": "Cho phép",
"Allow Chat Deletion": "Cho phép Xóa nội dung chat",
......@@ -392,7 +393,7 @@
"Select a model": "Chọn mô hình",
"Select an Ollama instance": "Chọn một thực thể Ollama",
"Select model": "",
"Selected model does not support image inputs.": "",
"Selected models do not support image inputs": "",
"Send": "",
"Send a Message": "Gửi yêu cầu",
"Send message": "Gửi yêu cầu",
......
......@@ -29,6 +29,7 @@
"Advanced Parameters": "高级参数",
"all": "所有",
"All Documents": "所有文档",
"All selected models do not support image input, removed images": "",
"All Users": "所有用户",
"Allow": "允许",
"Allow Chat Deletion": "允许删除聊天记录",
......@@ -392,7 +393,7 @@
"Select a model": "选择一个模型",
"Select an Ollama instance": "选择一个 Ollama 实例",
"Select model": "选择模型",
"Selected model does not support image inputs.": "",
"Selected models do not support image inputs": "",
"Send": "发送",
"Send a Message": "发送消息",
"Send message": "发送消息",
......
......@@ -29,6 +29,7 @@
"Advanced Parameters": "進階參數",
"all": "所有",
"All Documents": "",
"All selected models do not support image input, removed images": "",
"All Users": "所有使用者",
"Allow": "允許",
"Allow Chat Deletion": "允許刪除聊天紀錄",
......@@ -392,7 +393,7 @@
"Select a model": "選擇一個模型",
"Select an Ollama instance": "選擇 Ollama 實例",
"Select model": "",
"Selected model does not support image inputs.": "",
"Selected models do not support image inputs": "",
"Send": "",
"Send a Message": "傳送訊息",
"Send message": "傳送訊息",
......
import { APP_NAME } from '$lib/constants';
import { type Writable, writable } from 'svelte/store';
import type { GlobalModelConfig, ModelConfig } from '$lib/apis';
// Backend
export const WEBUI_NAME = writable(APP_NAME);
......@@ -44,17 +45,10 @@ export const showChangelog = writable(false);
export type Model = OpenAIModel | OllamaModel;
type ModelCustomInfo = {
id?: string;
name?: string;
description?: string;
vision_capable?: boolean;
};
type BaseModel = {
id: string;
name: string;
custom_info?: ModelCustomInfo;
custom_info?: ModelConfig;
};
export interface OpenAIModel extends BaseModel {
......@@ -143,19 +137,6 @@ type Config = {
model_config?: GlobalModelConfig;
};
type GlobalModelConfig = {
ollama?: ModelConfig[];
litellm?: ModelConfig[];
openai?: ModelConfig[];
};
type ModelConfig = {
id?: string;
name?: string;
description?: string;
vision_capable?: boolean;
};
type PromptSuggestion = {
content: string;
title: [string, string];
......
......@@ -265,7 +265,7 @@
const hasImages = messages.some((message) =>
message.files?.some((file) => file.type === 'image')
);
if (hasImages && !(model.custom_info?.vision_capable ?? true)) {
if (hasImages && !(model.custom_info?.params.vision_capable ?? true)) {
toast.error(
$i18n.t('Model {{modelName}} is not vision capable', {
modelName: model.custom_info?.name ?? model.name ?? model.id
......@@ -949,6 +949,7 @@
bind:prompt
bind:autoScroll
bind:selectedModel={atSelectedModel}
{selectedModels}
{messages}
{submitPrompt}
{stopResponse}
......
......@@ -269,7 +269,7 @@
const hasImages = messages.some((message) =>
message.files?.some((file) => file.type === 'image')
);
if (hasImages && !(model.custom_info?.vision_capable ?? true)) {
if (hasImages && !(model.custom_info?.params.vision_capable ?? true)) {
toast.error(
$i18n.t('Model {{modelName}} is not vision capable', {
modelName: model.custom_info?.name ?? model.name ?? model.id
......@@ -963,6 +963,7 @@
bind:prompt
bind:autoScroll
bind:selectedModel={atSelectedModel}
{selectedModels}
{messages}
{submitPrompt}
{stopResponse}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment