Commit 98df30ec authored by mingyard's avatar mingyard

feat:限制tts 文本长度

parent 62bd095c
import { ApiProperty } from '@nestjs/swagger'; import { ApiProperty } from '@nestjs/swagger';
import { Expose } from 'class-transformer'; import { Expose } from 'class-transformer';
import { IsNotEmpty, IsNumber, IsOptional, IsString } from 'class-validator'; import {
IsNotEmpty,
IsNumber,
IsOptional,
IsString,
Length,
} from 'class-validator';
export class TextToSpeechReqDto { export class TextToSpeechReqDto {
@ApiProperty({ @ApiProperty({
...@@ -11,6 +17,7 @@ export class TextToSpeechReqDto { ...@@ -11,6 +17,7 @@ export class TextToSpeechReqDto {
@Expose() @Expose()
@IsNotEmpty() @IsNotEmpty()
@IsString() @IsString()
@Length(1, 200)
text: string; text: string;
@ApiProperty({ @ApiProperty({
......
import { SupportLanguages } from '@/common/utils/constants'; import { SupportLanguages } from '@/common/utils/constants';
import { ApiProperty } from '@nestjs/swagger'; import { ApiProperty } from '@nestjs/swagger';
import { Expose } from 'class-transformer'; import { Expose } from 'class-transformer';
import { IsEnum, IsNotEmpty, IsString, Length } from 'class-validator'; import { IsEnum, IsNotEmpty, IsString } from 'class-validator';
export class TranslateReqDto { export class TranslateReqDto {
@ApiProperty({ @ApiProperty({
...@@ -32,6 +32,5 @@ export class TranslateReqDto { ...@@ -32,6 +32,5 @@ export class TranslateReqDto {
@Expose() @Expose()
@IsNotEmpty() @IsNotEmpty()
@IsString() @IsString()
@Length(1, 200)
text: string; text: string;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment