| 1 | /* |
| 2 | * @Author: nevin |
| 3 | * @Date: 2024-08-19 15:58:47 |
| 4 | * @LastEditTime: 2024-10-17 19:07:10 |
| 5 | * @LastEditors: nevin |
| 6 | * @Description: AI工具 |
| 7 | */ |
| 8 | import { ApiProperty } from '@nestjs/swagger'; |
| 9 | import { Expose, Type } from 'class-transformer'; |
| 10 | import { |
| 11 | IsEnum, |
| 12 | IsNumber, |
| 13 | IsOptional, |
| 14 | IsString, |
| 15 | Max, |
| 16 | Min, |
| 17 | } from 'class-validator'; |
| 18 | import { FireflycardTempTypes } from '../ai.service'; |
| 19 | |
| 20 | export class AdminFireflycardDto { |
| 21 | @ApiProperty({ title: '内容', required: true }) |
| 22 | @IsString({ message: '内容' }) |
| 23 | @Expose() |
| 24 | readonly content: string; |
| 25 | |
| 26 | @ApiProperty({ description: '模板', enum: FireflycardTempTypes }) |
| 27 | @IsEnum(FireflycardTempTypes) |
| 28 | @Expose() |
| 29 | temp: FireflycardTempTypes; |
| 30 | |
| 31 | @ApiProperty({ title: '标题', required: false }) |
| 32 | @IsString({ message: '标题' }) |
| 33 | @IsOptional() |
| 34 | @Expose() |
| 35 | readonly title?: string; |
| 36 | } |
| 37 | |
| 38 | export class AdminAiMarkdownDto { |
| 39 | @ApiProperty({ title: '系统提示词', required: true }) |
| 40 | @IsString({ message: '系统提示词' }) |
| 41 | @Expose() |
| 42 | readonly prompt: string; |
| 43 | |
| 44 | @ApiProperty({ title: '内容', required: true }) |
| 45 | @IsString({ message: '内容' }) |
| 46 | @Expose() |
| 47 | readonly content: string; |
| 48 | } |
| 49 | |
| 50 | export class AdminJmTaskDto { |
| 51 | @IsString({ message: '提示词' }) |
| 52 | @Expose() |
| 53 | readonly prompt: string; |
| 54 | |
| 55 | @Min(520, { message: '最小520' }) |
| 56 | @Max(1300, { message: '最大1300' }) |
| 57 | @IsNumber( |
| 58 | { |
| 59 | allowNaN: false, |
| 60 | }, |
| 61 | { message: '宽度' }, |
| 62 | ) |
| 63 | @Type(() => Number) |
| 64 | @Expose() |
| 65 | readonly width: number; |
| 66 | |
| 67 | @Min(520, { message: '最小520' }) |
| 68 | @Max(1300, { message: '最大1300' }) |
| 69 | @IsNumber( |
| 70 | { |
| 71 | allowNaN: false, |
| 72 | }, |
| 73 | { message: '高度' }, |
| 74 | ) |
| 75 | @Type(() => Number) |
| 76 | @Expose() |
| 77 | readonly height: number; |
| 78 | |
| 79 | @IsString({ each: true, message: 'sessionIds' }) |
| 80 | @Expose() |
| 81 | readonly sessionIds: string[]; |
| 82 | } |
| 83 | |
| 84 | export class AdminAiIdDto { |
| 85 | @ApiProperty({ title: 'ID', required: true }) |
| 86 | @IsString({ message: 'ID' }) |
| 87 | @Expose() |
| 88 | readonly id: string; |
| 89 | } |
| 90 |