Files
gongxue-base/apps/server/src/ai-chat/dto/ai-chat.dto.ts
wangziqi 6a18fd264d feat(ai-chat): AI 导入确认流程完善并清理代码质量
- 新增导入确认/映射解析辅助,支持预检后生成导入向导
- 抽取 parseAttachmentArgs/beginImportToolRun 等重复逻辑
- 双重类型断言改为运行时守卫,消除 aislop 告警
2026-08-06 11:59:28 +08:00

140 lines
2.2 KiB
TypeScript

import { Type } from 'class-transformer';
import {
ArrayMaxSize,
IsArray,
IsIn,
IsInt,
IsNotEmpty,
IsObject,
IsOptional,
IsString,
IsUUID,
Max,
MaxLength,
Min,
} from 'class-validator';
import { REASONING_EFFORT_LEVELS } from '../../ai-config/dto/ai-config.dto';
export class CreateConversationDto {
@IsOptional()
@IsString()
@MaxLength(100)
title?: string;
@IsOptional()
@IsString()
@MaxLength(50)
lockedSkillKey?: string | null;
}
export class UpdateConversationDto {
@IsOptional()
@IsString()
@IsNotEmpty()
@MaxLength(100)
title?: string;
@IsOptional()
@IsString()
@MaxLength(50)
lockedSkillKey?: string | null;
}
export class SendMessageDto {
@IsString()
@IsNotEmpty()
@MaxLength(16000)
message: string;
@IsOptional()
@IsArray()
@ArrayMaxSize(5)
@IsInt({ each: true })
@Min(1, { each: true })
attachmentIds?: number[];
@IsOptional()
@IsString()
@MaxLength(50)
skillKey?: string | null;
@IsUUID()
clientRequestId: string;
@IsOptional()
@IsIn(REASONING_EFFORT_LEVELS)
reasoningEffort?: string | null;
}
export class RegenerateMessageDto {
@IsUUID()
clientRequestId: string;
@IsOptional()
@IsIn(REASONING_EFFORT_LEVELS)
reasoningEffort?: string | null;
}
export class EditMessageDto {
@IsString()
@IsNotEmpty()
@MaxLength(16000)
content: string;
@IsUUID()
clientRequestId: string;
@IsOptional()
@IsIn(REASONING_EFFORT_LEVELS)
reasoningEffort?: string | null;
}
export class SubmitFormDto {
@IsUUID()
clientRequestId: string;
@IsObject()
values: Record<string, unknown>;
@IsOptional()
@IsIn(REASONING_EFFORT_LEVELS)
reasoningEffort?: string | null;
}
export class SubmitReviewDto {
@IsUUID()
clientRequestId: string;
@IsOptional()
@IsIn(REASONING_EFFORT_LEVELS)
reasoningEffort?: string | null;
}
export class ResolveImportPreflightDto {
@IsUUID()
clientRequestId: string;
@IsOptional()
@IsObject()
mapping?: Record<string, unknown>;
@IsOptional()
@IsObject()
settings?: Record<string, unknown>;
}
export class MessagePageQueryDto {
@IsOptional()
@Type(() => Number)
@IsInt()
@Min(1)
page?: number;
@IsOptional()
@Type(() => Number)
@IsInt()
@Min(1)
@Max(100)
limit?: number;
}