Skip to content

Commit

Permalink
Merge pull request stackblitz-labs#44 from TarekS93/main
Browse files Browse the repository at this point in the history
Enhance Ollama Model Integration and Type Definitions
  • Loading branch information
coleam00 authored Oct 24, 2024
2 parents 5d70255 + f706523 commit 65cf12d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -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}`;
Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion app/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface OllamaModelDetails {
quantization_level: string;
}

interface OllamaModel {
export interface OllamaModel {
name: string;
model: string;
modified_at: string;
Expand Down

0 comments on commit 65cf12d

Please sign in to comment.