nexus/ui/src/api/ollama.ts
Nexus Dev 076c42c8ba feat(28-02): create ollamaApi client and Hermes Ollama model dropdown
- Add ui/src/api/ollama.ts with ollamaApi.status() and ollamaApi.models()
- Replace free-text Model input with hybrid dropdown/fallback in HermesLocalConfigFields
- Dropdown shows pulled Ollama models with * prefix for recommended entries
- Install callout shown when Ollama is absent (with link to installUrl)
- Edit mode: selecting an Ollama model atomically sets model + provider:custom + base_url
- Manual entry fallback via "Other (manual entry)..." option or when Ollama absent
- Uses useCompany() hook for companyId (consistent with AgentConfigForm pattern)
2026-04-02 17:03:00 +00:00

31 lines
736 B
TypeScript

import { api } from "./client";
export interface OllamaStatus {
installed: boolean;
version: string | null;
installUrl: string;
}
export interface OllamaModel {
name: string;
parameterSize: string;
quantization: string;
sizeBytes: number;
family: string;
recommended: boolean;
recommendationReason: string | null;
}
export interface OllamaModelsResponse {
models: OllamaModel[];
ramGb: number;
}
export const ollamaApi = {
status(companyId: string): Promise<OllamaStatus> {
return api.get<OllamaStatus>(`/companies/${companyId}/ollama/status`);
},
models(companyId: string): Promise<OllamaModelsResponse> {
return api.get<OllamaModelsResponse>(`/companies/${companyId}/ollama/models`);
},
};