feat: 로컬 LLM 채팅 기능 추가 (Ollama + vLLM, 스트리밍, MCP 도구 호출)
- OllamaController: Ollama/vLLM 프록시 API (채팅, 스트리밍, 모델 목록, 설정) - UI: 새 대화 탭, 세션 관리, Markdown 렌더링, 스트리밍 응답 - vLLM: OpenAI-compatible API 지원, MCP function calling 통합 - Fix: McpClient DI 팩토리 등록 (HttpClient BaseAddress 문제 해결) - Fix: llm-model.json 직렬화 JsonSerializer 사용 - Fix: nl2sql_worker KST 시간대 표시 (AT TIME ZONE Asia/Seoul) - Program.cs: Ollama/vLLM HttpClient 등록 (1800s timeout)
This commit is contained in:
@@ -86,7 +86,9 @@ builder.Services.AddHostedService<DigitalEventDetectorService>();
|
||||
// ── MCP Service ───────────────────────────────────────────────────────────────
|
||||
// Python MCP 서버 (localhost:5001)와 통신
|
||||
// McpClient: 저수준 HTTP 클라이언트 / McpService: IMcpService 구현 (McpClient 위임)
|
||||
builder.Services.AddSingleton<McpClient>();
|
||||
// NOTE: 팩토리 등록 — DI가 HttpClient를 주입하면 BaseAddress 미설정 상태가 되므로
|
||||
// 직접 생성자 호출하여 자체 HttpClient를 사용하도록 함
|
||||
builder.Services.AddSingleton<McpClient>(_ => new McpClient());
|
||||
builder.Services.AddSingleton<IMcpService, McpService>();
|
||||
builder.Services.AddHostedService<McpServerHostedService>();
|
||||
|
||||
@@ -117,6 +119,20 @@ builder.Services.AddSingleton<IPidGraphEventBroadcaster, PidGraphEventBroadcaste
|
||||
// ── FastTable Cleanup Service ─────────────────────────────────────────────────
|
||||
builder.Services.AddHostedService<ExperionFastCleanupService>();
|
||||
|
||||
// ── Ollama HttpClient ─────────────────────────────────────────────────────────
|
||||
builder.Services.AddHttpClient("Ollama", c =>
|
||||
{
|
||||
c.BaseAddress = new Uri("http://localhost:11434");
|
||||
c.Timeout = TimeSpan.FromSeconds(1800);
|
||||
}).SetHandlerLifetime(Timeout.InfiniteTimeSpan);
|
||||
|
||||
// ── vLLM HttpClient (OpenAI-compatible) ──────────────────────────────────────
|
||||
builder.Services.AddHttpClient("Vllm", c =>
|
||||
{
|
||||
c.BaseAddress = new Uri("http://localhost:8000");
|
||||
c.Timeout = TimeSpan.FromSeconds(1800);
|
||||
}).SetHandlerLifetime(Timeout.InfiniteTimeSpan);
|
||||
|
||||
// ── CORS ──────────────────────────────────────────────────────────────────────
|
||||
builder.Services.AddCors(opt =>
|
||||
opt.AddDefaultPolicy(p => p.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader()));
|
||||
|
||||
Reference in New Issue
Block a user