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 {
description?: string;
capabilities?: object;
profile_image_url?: string;
}
export interface ModelParams {}

View File

@ -396,7 +396,7 @@ export const deleteModel = async (token: string, tagName: string, urlIdx: string
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;
const controller = new AbortController();

View File

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

View File

@ -12,7 +12,7 @@
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 { capitalizeFirstLetter, sanitizeResponseContent, splitStream } from '$lib/utils';
import { getModels } from '$lib/apis';
@ -35,9 +35,10 @@
export let items: {
label: string;
value: string;
model: Model;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
} = [];
}[] = [];
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 selectedTheme = 'system';
let languages = [];
let languages: Awaited<ReturnType<typeof getLanguages>> = [];
let lang = $i18n.language;
let notificationEnabled = false;
let system = '';
@ -41,7 +41,7 @@
// Advanced
let requestFormat = '';
let keepAlive = null;
let keepAlive: string | null = null;
let params = {
// Advanced

View File

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

View File

@ -52,20 +52,39 @@ type BaseModel = {
id: string;
name: string;
info?: ModelConfig;
owned_by: 'ollama' | 'openai';
};
export interface OpenAIModel extends BaseModel {
owned_by: 'openai';
external: boolean;
source?: string;
}
export interface OllamaModel extends BaseModel {
owned_by: 'ollama';
details: OllamaModelDetails;
size: number;
description: string;
model: string;
modified_at: 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 = {