Merge pull request #44 from TarekS93/main

Enhance Ollama Model Integration and Type Definitions
This commit is contained in:
Cole Medin
2024-10-24 08:07:34 -05:00
committed by GitHub
2 changed files with 4 additions and 4 deletions

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}`;
@@ -48,9 +48,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',

View File

@@ -8,7 +8,7 @@ interface OllamaModelDetails {
quantization_level: string;
}
interface OllamaModel {
export interface OllamaModel {
name: string;
model: string;
modified_at: string;