Merge pull request #4746 from 5E-324/fix-type-errors

chore: Fix type errors.
This commit is contained in:
Timothy Jaeryang Baek 2024-08-20 13:37:08 +02:00 committed by GitHub
commit 22d8f8f1ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 28 additions and 7 deletions

View File

@ -950,6 +950,7 @@ export interface ModelConfig {
export interface ModelMeta { export interface ModelMeta {
description?: string; description?: string;
capabilities?: object; capabilities?: object;
profile_image_url?: string;
} }
export interface ModelParams {} export interface ModelParams {}

View File

@ -396,7 +396,7 @@ export const deleteModel = async (token: string, tagName: string, urlIdx: string
return res; return res;
}; };
export const pullModel = async (token: string, tagName: string, urlIdx: string | null = null) => { export const pullModel = async (token: string, tagName: string, urlIdx: number | null = null) => {
let error = null; let error = null;
const controller = new AbortController(); const controller = new AbortController();

View File

@ -37,7 +37,7 @@
let ollamaEnabled = null; let ollamaEnabled = null;
let OLLAMA_URLS = []; let OLLAMA_URLS = [];
let selectedOllamaUrlIdx: string | null = null; let selectedOllamaUrlIdx: number | null = null;
let updateModelId = null; let updateModelId = null;
let updateProgress = null; let updateProgress = null;

View File

@ -12,7 +12,7 @@
import { deleteModel, getOllamaVersion, pullModel } from '$lib/apis/ollama'; import { deleteModel, getOllamaVersion, pullModel } from '$lib/apis/ollama';
import { user, MODEL_DOWNLOAD_POOL, models, mobile, temporaryChatEnabled } from '$lib/stores'; import { user, MODEL_DOWNLOAD_POOL, models, mobile, temporaryChatEnabled, Model } from '$lib/stores';
import { toast } from 'svelte-sonner'; import { toast } from 'svelte-sonner';
import { capitalizeFirstLetter, sanitizeResponseContent, splitStream } from '$lib/utils'; import { capitalizeFirstLetter, sanitizeResponseContent, splitStream } from '$lib/utils';
import { getModels } from '$lib/apis'; import { getModels } from '$lib/apis';
@ -35,9 +35,10 @@
export let items: { export let items: {
label: string; label: string;
value: string; value: string;
model: Model;
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any; [key: string]: any;
} = []; }[] = [];
export let className = 'w-[32rem]'; export let className = 'w-[32rem]';

View File

@ -17,7 +17,7 @@
let themes = ['dark', 'light', 'rose-pine dark', 'rose-pine-dawn light', 'oled-dark']; let themes = ['dark', 'light', 'rose-pine dark', 'rose-pine-dawn light', 'oled-dark'];
let selectedTheme = 'system'; let selectedTheme = 'system';
let languages = []; let languages: Awaited<ReturnType<typeof getLanguages>> = [];
let lang = $i18n.language; let lang = $i18n.language;
let notificationEnabled = false; let notificationEnabled = false;
let system = ''; let system = '';
@ -41,7 +41,7 @@
// Advanced // Advanced
let requestFormat = ''; let requestFormat = '';
let keepAlive = null; let keepAlive: string | null = null;
let params = { let params = {
// Advanced // Advanced

View File

@ -31,7 +31,7 @@
let ollamaEnabled = null; let ollamaEnabled = null;
let OLLAMA_URLS = []; let OLLAMA_URLS = [];
let selectedOllamaUrlIdx: string | null = null; let selectedOllamaUrlIdx: number | null = null;
let updateModelId = null; let updateModelId = null;
let updateProgress = null; let updateProgress = null;

View File

@ -52,20 +52,39 @@ type BaseModel = {
id: string; id: string;
name: string; name: string;
info?: ModelConfig; info?: ModelConfig;
owned_by: 'ollama' | 'openai';
}; };
export interface OpenAIModel extends BaseModel { export interface OpenAIModel extends BaseModel {
owned_by: 'openai';
external: boolean; external: boolean;
source?: string; source?: string;
} }
export interface OllamaModel extends BaseModel { export interface OllamaModel extends BaseModel {
owned_by: 'ollama';
details: OllamaModelDetails; details: OllamaModelDetails;
size: number; size: number;
description: string; description: string;
model: string; model: string;
modified_at: string; modified_at: string;
digest: string; digest: string;
ollama?: {
name?: string;
model?: string;
modified_at: string;
size?: number;
digest?: string;
details?: {
parent_model?: string;
format?: string;
family?: string;
families?: string[];
parameter_size?: string;
quantization_level?: string;
};
urls?: number[];
};
} }
type OllamaModelDetails = { type OllamaModelDetails = {