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