feat(client): 短信登录、JWT、Redis 与 Spug 短信及流式 Chat
- 新增客户端认证:短信发送/登录、access/refresh JWT、Guard/Strategy\n- Redis 存验证码;可配置 SMS_CODE_TTL_SECONDS;失败时回滚与明确错误\n- 短信改为 Spug 推送助手(code/targets/number/name),移除 UniSMS\n- Chat SSE 接口与 DTO;AppModule 挂载 RedisModule\n- 更新 README 与 project-solution 环境变量说明 Made-with: Cursor
This commit is contained in:
38
src/apps/client-app/chat/dto/stream-chat.dto.ts
Normal file
38
src/apps/client-app/chat/dto/stream-chat.dto.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
import { IsArray, IsIn, IsOptional, IsString, ValidateNested } from 'class-validator';
|
||||
import { StreamChatRequest } from '@shared/ai-gateway/types/chat.types';
|
||||
|
||||
class ChatMessageDto {
|
||||
@ApiProperty({ enum: ['system', 'user', 'assistant'] })
|
||||
@IsString()
|
||||
@IsIn(['system', 'user', 'assistant'])
|
||||
role!: 'system' | 'user' | 'assistant';
|
||||
|
||||
@ApiProperty({ description: '消息内容', example: '你是谁' })
|
||||
@IsString()
|
||||
content!: string;
|
||||
}
|
||||
|
||||
export class StreamChatBodyDto implements StreamChatRequest {
|
||||
@ApiPropertyOptional({ description: '模型名', example: 'qwen-plus' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
model?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: '指定平台,不传或 auto 由路由自动选择',
|
||||
enum: ['auto', 'qwen', 'deepseek', 'volc'],
|
||||
example: 'qwen',
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
platform?: string;
|
||||
|
||||
@ApiProperty({ type: [ChatMessageDto] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => ChatMessageDto)
|
||||
messages!: ChatMessageDto[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user