690603:2041 ADR-034-134 #01
CI / CD Pipeline / build (push) Failing after 4m28s
CI / CD Pipeline / deploy (push) Has been skipped

This commit is contained in:
2026-06-03 20:41:42 +07:00
parent 754d609399
commit 3274dede7a
197 changed files with 1575 additions and 42 deletions
+13
View File
@@ -5,6 +5,7 @@
// - 2026-05-21: แก้ไข ESLint unsafe return error ใน getSystemHealth โดยใช้ interface SystemHealthResponse
// - 2026-05-29: เพิ่ม OcrService.checkHealth() เข้า getSystemHealth() เพื่อแสดงสถานะ OCR sidecar
// - 2026-06-02: ปรับปรุง activateAiModel ให้มีการโหลดและยืนยันโมเดลล่วงหน้าแบบ Synchronous (T008, ADR-033) และล้างโมเดลตัวเก่าออกเพื่อประหยัด VRAM (Suggestion 1)
// - 2026-06-03: ADR-034 — เพิ่ม activeModels field (เอา mainModel+ocrModel) ใน SystemHealthResponse
import { Injectable, Logger, Optional } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { HttpService } from '@nestjs/axios';
@@ -123,6 +124,10 @@ export interface AiJobStatusResult {
}
export interface SystemHealthResponse {
activeModels: {
main: string;
ocr: string;
};
ollama: {
status: string;
latencyMs: number;
@@ -867,6 +872,14 @@ export class AiService {
this.getQueueMetrics(this.aiBatchQueue),
]);
const health = {
activeModels: {
main: this.ollamaService
? this.ollamaService.getMainModelName()
: AiSettingsService.DEFAULT_MODEL,
ocr: this.ollamaService
? this.ollamaService.getOcrModelName()
: AiSettingsService.OCR_MODEL,
},
ollama,
qdrant,
ocr,