feat(#127): refactor LlmService to use provider pattern

Refactor LlmService to delegate to LlmManagerService instead of using
Ollama directly. This enables multiple provider support and user-specific
provider configuration.

Changes:
- Remove direct Ollama client from LlmService
- Delegate all LLM operations to provider via LlmManagerService
- Update health status to use provider-agnostic interface
- Add PrismaModule to LlmModule for manager service
- Maintain backward compatibility with existing API
- Achieve 89.74% test coverage

Fixes #127

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-31 12:33:56 -06:00
parent be6c15116d
commit 1f97e6de40
5 changed files with 433 additions and 133 deletions

View File

@@ -1,11 +1,15 @@
import { Controller, Post, Get, Body, Res, HttpCode, HttpStatus } from "@nestjs/common";
import { Response } from "express";
import { LlmService, OllamaHealthStatus } from "./llm.service";
import { LlmService } from "./llm.service";
import { ChatRequestDto, ChatResponseDto, EmbedRequestDto, EmbedResponseDto } from "./dto";
import type { LlmProviderHealthStatus } from "./providers/llm-provider.interface";
@Controller("llm")
export class LlmController {
constructor(private readonly llmService: LlmService) {}
@Get("health") async health(): Promise<OllamaHealthStatus> {
@Get("health")
async health(): Promise<LlmProviderHealthStatus> {
return this.llmService.checkHealth();
}
@Get("models") async listModels(): Promise<{ models: string[] }> {