feat(ai): ADR-032 Typhoon OCR integration - models, processors, cache, VRAM monitor, sandbox UI
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
// File: src/modules/ai/dto/activate-ai-model.dto.ts
|
||||
// Change Log
|
||||
// - 2026-05-30: สร้าง ActivateAiModelDto สำหรับตั้งค่าโมเดล AI หลักที่ต้องการเปิดใช้งาน (T026, US2)
|
||||
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString } from 'class-validator';
|
||||
|
||||
/** DTO สำหรับส่งรหัสของโมเดล AI ที่ต้องการเปิดใช้งาน */
|
||||
export class ActivateAiModelDto {
|
||||
@ApiProperty({
|
||||
description: 'รหัสโมเดล AI (UUIDv7) หรือชื่อโมเดล AI ที่ต้องการเปิดใช้งาน',
|
||||
})
|
||||
@IsString()
|
||||
modelId!: string;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
// File: src/modules/ai/dto/add-ai-model.dto.ts
|
||||
// Change Log
|
||||
// - 2026-05-30: สร้าง AddAiModelDto สำหรับเพิ่มโมเดล AI ใหม่เข้าระบบ (T025, US2)
|
||||
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import {
|
||||
IsString,
|
||||
IsEnum,
|
||||
IsNumber,
|
||||
IsArray,
|
||||
IsOptional,
|
||||
} from 'class-validator';
|
||||
import { AiModelType } from '../entities/ai-model-configuration.entity';
|
||||
|
||||
/** DTO สำหรับเพิ่มโมเดล AI ใหม่ */
|
||||
export class AddAiModelDto {
|
||||
@ApiProperty({
|
||||
description: 'ชื่อของโมเดล AI (เช่น gemma4:e4b, typhoon2.1-gemma3-4b)',
|
||||
})
|
||||
@IsString()
|
||||
modelName!: string;
|
||||
|
||||
@ApiProperty({ description: 'ประเภทของโมเดล AI', enum: AiModelType })
|
||||
@IsEnum(AiModelType)
|
||||
modelType!: AiModelType;
|
||||
|
||||
@ApiProperty({ description: 'ชื่อโมเดลใน Ollama Registry' })
|
||||
@IsString()
|
||||
ollamaModelName!: string;
|
||||
|
||||
@ApiProperty({ description: 'ความต้องการ VRAM ในการประมวลผล (MB)' })
|
||||
@IsNumber()
|
||||
vramRequirementMB!: number;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'กรณีการใช้งานที่รองรับ (Use Cases)',
|
||||
type: [String],
|
||||
})
|
||||
@IsArray()
|
||||
@IsString({ each: true })
|
||||
useCases!: string[];
|
||||
|
||||
@ApiProperty({
|
||||
description: 'ประเภท Quantization (เช่น Q3_K_M)',
|
||||
required: false,
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
quantization?: string;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// File: src/modules/ai/dto/ocr-engine-response.dto.ts
|
||||
// Change Log
|
||||
// - 2026-05-30: สร้าง OcrEngineResponseDto สำหรับส่งข้อมูลผลลัพธ์ OCR Engine (T012, US1)
|
||||
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { OcrEngineType } from '../entities/ocr-engine-configuration.entity';
|
||||
|
||||
/** DTO สำหรับส่งรายการ OCR Engine กลับไปยังไคลเอนต์ */
|
||||
export class OcrEngineResponseDto {
|
||||
@ApiProperty({ description: 'รหัสประจำตัว OCR Engine (UUIDv7)' })
|
||||
engineId!: string;
|
||||
|
||||
@ApiProperty({ description: 'ชื่อของ OCR Engine' })
|
||||
engineName!: string;
|
||||
|
||||
@ApiProperty({ description: 'ประเภทของ OCR Engine', enum: OcrEngineType })
|
||||
engineType!: OcrEngineType;
|
||||
|
||||
@ApiProperty({ description: 'สถานะเปิดใช้งาน' })
|
||||
isActive!: boolean;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'ระบุว่าเป็น Engine ที่ใช้งานอยู่ปัจจุบันหรือไม่',
|
||||
})
|
||||
isCurrentActive!: boolean;
|
||||
|
||||
@ApiProperty({ description: 'ความต้องการ VRAM ในการประมวลผล (MB)' })
|
||||
vramRequirementMB!: number;
|
||||
|
||||
@ApiProperty({ description: 'จำกัดเวลาในการประมวลผลสูงสุดต่อหน้า (วินาที)' })
|
||||
processingTimeLimitSeconds!: number;
|
||||
|
||||
@ApiProperty({ description: 'จำกัดการประมวลผลพร้อมกัน' })
|
||||
concurrentLimit!: number;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'รหัสประจำตัว OCR Engine สำรองกรณีขัดข้อง',
|
||||
nullable: true,
|
||||
})
|
||||
fallbackEngineId?: string | null;
|
||||
|
||||
@ApiProperty({ description: 'เวลาที่สร้างข้อมูล' })
|
||||
createdAt!: Date;
|
||||
|
||||
@ApiProperty({ description: 'เวลาที่อัปเดตข้อมูลล่าสุด' })
|
||||
updatedAt!: Date;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// File: src/modules/ai/dto/ocr-engine-selection.dto.ts
|
||||
// Change Log
|
||||
// - 2026-05-30: สร้าง OcrEngineSelectionDto สำหรับการเลือก OCR Engine (T011, US1)
|
||||
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsBoolean, IsOptional } from 'class-validator';
|
||||
|
||||
/** DTO สำหรับการเลือกหรือตั้งค่าการทำงานของ OCR Engine */
|
||||
export class OcrEngineSelectionDto {
|
||||
@ApiProperty({
|
||||
description: 'เปิดใช้งานหรือปิดใช้งาน Engine นี้',
|
||||
required: false,
|
||||
})
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
isActive?: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user