Update constants.ts

This commit is contained in:
TarekS93 2024-10-22 11:19:08 +02:00 committed by GitHub
parent 34ead80f62
commit f70652305d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,4 @@
import type { ModelInfo } from './types';
import type { ModelInfo, OllamaApiResponse, OllamaModel } from './types';
export const WORK_DIR_NAME = 'project';
export const WORK_DIR = `/home/${WORK_DIR_NAME}`;
@ -37,9 +37,9 @@ export let MODEL_LIST: ModelInfo[] = [...staticModels];
async function getOllamaModels(): Promise<ModelInfo[]> {
try {
const response = await fetch(`http://localhost:11434/api/tags`);
const data = await response.json();
const data = await response.json() as OllamaApiResponse;
return data.models.map((model: any) => ({
return data.models.map((model: OllamaModel) => ({
name: model.name,
label: `${model.name} (${model.details.parameter_size})`,
provider: 'Ollama',