feat(ai-runtime): complete ai runtime policy refactor (ADR-035)
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
// File: src/modules/ai/entities/ai-audit-log.entity.ts
|
||||
// File: backend/src/modules/ai/entities/ai-audit-log.entity.ts
|
||||
// Change Log
|
||||
// - 2026-05-14: เพิ่ม ADR-023 feedback fields โดยคง legacy audit fields ไว้ช่วงเปลี่ยนผ่าน.
|
||||
// - 2026-05-30: เพิ่ม modelType, vramUsageMB, cacheHit สำหรับ Typhoon OCR integration (T008, ADR-032).
|
||||
// - 2026-06-11: เปลี่ยน Record<string, any> เป็น Record<string, unknown> เพื่อแก้ปัญหา ESLint
|
||||
// Entity สำหรับตาราง ai_audit_logs — บันทึก AI Interaction และ feedback ตาม ADR-023
|
||||
|
||||
import {
|
||||
@@ -100,6 +101,25 @@ export class AiAuditLog extends UuidBaseEntity {
|
||||
@Column({ name: 'error_message', type: 'text', nullable: true })
|
||||
errorMessage?: string;
|
||||
|
||||
@Column({
|
||||
name: 'effective_profile',
|
||||
type: 'varchar',
|
||||
length: 50,
|
||||
nullable: true,
|
||||
})
|
||||
effectiveProfile?: string;
|
||||
|
||||
@Column({
|
||||
name: 'canonical_model',
|
||||
type: 'varchar',
|
||||
length: 50,
|
||||
nullable: true,
|
||||
})
|
||||
canonicalModel?: string;
|
||||
|
||||
@Column({ name: 'snapshot_params_json', type: 'json', nullable: true })
|
||||
snapshotParamsJson?: Record<string, unknown>;
|
||||
|
||||
@CreateDateColumn({ name: 'created_at' })
|
||||
createdAt!: Date;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
// File: backend/src/modules/ai/entities/ai-execution-profile.entity.ts
|
||||
// Change Log:
|
||||
// - 2026-06-11: Initial creation of AiExecutionProfile entity for AI execution profiles
|
||||
|
||||
import {
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
/** Entity สำหรับเก็บข้อมูลโปรไฟล์การทำงานของโมเดล AI (Execution Profile) */
|
||||
@Entity('ai_execution_profiles')
|
||||
export class AiExecutionProfile {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column({ name: 'profile_name', unique: true, length: 50 })
|
||||
profileName!: string;
|
||||
|
||||
@Column({ type: 'decimal', precision: 4, scale: 3 })
|
||||
temperature!: number;
|
||||
|
||||
@Column({ name: 'top_p', type: 'decimal', precision: 4, scale: 3 })
|
||||
topP!: number;
|
||||
|
||||
@Column({ name: 'max_tokens', type: 'int' })
|
||||
maxTokens!: number;
|
||||
|
||||
@Column({ name: 'num_ctx', type: 'int' })
|
||||
numCtx!: number;
|
||||
|
||||
@Column({ name: 'repeat_penalty', type: 'decimal', precision: 5, scale: 3 })
|
||||
repeatPenalty!: number;
|
||||
|
||||
@Column({ name: 'keep_alive_seconds', type: 'int' })
|
||||
keepAliveSeconds!: number;
|
||||
|
||||
@Column({ name: 'is_active', type: 'boolean', default: true })
|
||||
isActive!: boolean;
|
||||
|
||||
@Column({ name: 'updated_by', type: 'int', nullable: true })
|
||||
updatedBy?: number;
|
||||
|
||||
@CreateDateColumn({ name: 'created_at' })
|
||||
createdAt!: Date;
|
||||
|
||||
@UpdateDateColumn({ name: 'updated_at' })
|
||||
updatedAt!: Date;
|
||||
}
|
||||
Reference in New Issue
Block a user