mirror of
https://github.com/stackblitz/bolt.new
synced 2025-02-06 04:48:04 +00:00
Merge pull request #44 from TarekS93/main
Enhance Ollama Model Integration and Type Definitions
This commit is contained in:
commit
65cf12dca0
@ -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_NAME = 'project';
|
||||||
export const WORK_DIR = `/home/${WORK_DIR_NAME}`;
|
export const WORK_DIR = `/home/${WORK_DIR_NAME}`;
|
||||||
@ -48,9 +48,9 @@ export let MODEL_LIST: ModelInfo[] = [...staticModels];
|
|||||||
async function getOllamaModels(): Promise<ModelInfo[]> {
|
async function getOllamaModels(): Promise<ModelInfo[]> {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`http://localhost:11434/api/tags`);
|
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,
|
name: model.name,
|
||||||
label: `${model.name} (${model.details.parameter_size})`,
|
label: `${model.name} (${model.details.parameter_size})`,
|
||||||
provider: 'Ollama',
|
provider: 'Ollama',
|
||||||
|
@ -8,7 +8,7 @@ interface OllamaModelDetails {
|
|||||||
quantization_level: string;
|
quantization_level: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OllamaModel {
|
export interface OllamaModel {
|
||||||
name: string;
|
name: string;
|
||||||
model: string;
|
model: string;
|
||||||
modified_at: string;
|
modified_at: string;
|
||||||
|
Loading…
Reference in New Issue
Block a user