690524:1919 ADR-028-228-migration #04
This commit is contained in:
@@ -50,10 +50,10 @@ AI_N8N_AUTH_TOKEN=change-me-service-token
|
||||
QDRANT_URL=http://localhost:6333
|
||||
|
||||
# Ollama (Admin Desktop Desk-5439 — ADR-018 AI boundary)
|
||||
OLLAMA_MODEL_MAIN=gemma4:e4b
|
||||
OLLAMA_MODEL_MAIN=gemma4:e2b
|
||||
OLLAMA_MODEL_EMBED=nomic-embed-text
|
||||
OLLAMA_EMBED_MODEL=nomic-embed-text
|
||||
OLLAMA_RAG_MODEL=gemma4:e4b
|
||||
OLLAMA_RAG_MODEL=gemma4:e2b
|
||||
OLLAMA_URL=http://192.168.10.8:11434
|
||||
|
||||
# Qdrant (ADR-023A)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// File: src/modules/ai/ai-migration-checkpoint.service.ts
|
||||
// Change Log:
|
||||
// - 2026-05-23: สร้าง service จัดการ Migration Checkpoint, Queue และ Error log ผ่าน API (ADR-023A)
|
||||
// - 2026-05-24: เพิ่มฟังก์ชันค้นหาและแปลง UUID เป็นตัวเลข ID จริงใน upsertQueueRecord เพื่อป้องกันการเขียนทับด้วย undefined
|
||||
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
@@ -102,7 +103,19 @@ export class AiMigrationCheckpointService {
|
||||
|
||||
record.batchId = dto.batchId;
|
||||
record.originalFileName = dto.documentNumber;
|
||||
record.tempAttachmentId = dto.tempAttachmentId ?? undefined;
|
||||
if (dto.tempAttachmentId) {
|
||||
if (typeof dto.tempAttachmentId === 'number') {
|
||||
record.tempAttachmentId = dto.tempAttachmentId;
|
||||
} else {
|
||||
const rows = await this.dataSource.manager.query<{ id: number }[]>(
|
||||
'SELECT id FROM attachments WHERE uuid = ? LIMIT 1',
|
||||
[dto.tempAttachmentId]
|
||||
);
|
||||
if (rows && rows.length > 0) {
|
||||
record.tempAttachmentId = rows[0].id;
|
||||
}
|
||||
}
|
||||
}
|
||||
record.confidenceScore = dto.confidence ?? undefined;
|
||||
record.status =
|
||||
dto.status === 'PENDING_REVIEW'
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// File: src/modules/ai/dto/migration-checkpoint.dto.ts
|
||||
// Change Log:
|
||||
// - 2026-05-23: สร้าง DTOs สำหรับ Migration Checkpoint API endpoints (ADR-023A)
|
||||
// - 2026-05-24: ปรับปรุงประเภทข้อมูล tempAttachmentId ใน MigrationQueueRecordDto ให้รับได้ทั้ง string (UUID) และ number
|
||||
|
||||
import {
|
||||
IsEnum,
|
||||
@@ -47,9 +48,8 @@ export class MigrationQueueRecordDto {
|
||||
@IsOptional()
|
||||
originalSubject?: string;
|
||||
|
||||
@IsNumber()
|
||||
@IsOptional()
|
||||
tempAttachmentId?: number;
|
||||
tempAttachmentId?: string | number;
|
||||
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
|
||||
Reference in New Issue
Block a user