Files
chat-one-service/src/apps/client-app/chat/dto/stream-chat.dto.ts
alboped 132f51705e feat: 增强 Chat 能力并补充单机部署方案
完善会话消息删除、Qwen 联网搜索/深度思考参数与 SSE 来源事件,同时增加请求体日志与 TS6 配置兼容调整,并新增 Ubuntu+PM2+Nginx 的部署文档与脚本以支持可回滚发布。

Made-with: Cursor
2026-04-23 22:31:18 +08:00

82 lines
1.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import {
IsArray,
IsBoolean,
IsIn,
IsOptional,
IsString,
ValidateNested,
} from 'class-validator';
import { StreamChatRequest } from '@shared/ai-gateway/types/chat.types';
export class ChatMessageDto {
@ApiProperty({
type: String,
enum: ['system', 'user', 'assistant'],
description: '消息角色',
example: 'user',
})
@IsString()
@IsIn(['system', 'user', 'assistant'])
role!: 'system' | 'user' | 'assistant';
@ApiProperty({ type: String, description: '消息内容', example: '你是谁' })
@IsString()
content!: string;
}
export class StreamChatBodyDto implements StreamChatRequest {
@ApiPropertyOptional({ type: String, description: '模型名', example: 'qwen-plus' })
@IsOptional()
@IsString()
model?: string;
@ApiProperty({
type: String,
description: '会话 ID数字字符串需先调用创建会话接口获取',
example: '1',
})
@IsString()
sessionId!: string;
@ApiPropertyOptional({
type: String,
description: '指定平台,不传或 auto 由路由自动选择',
enum: ['auto', 'qwen', 'deepseek', 'volc'],
example: 'qwen',
})
@IsOptional()
@IsString()
platform?: string;
@ApiPropertyOptional({
type: Boolean,
description: '是否启用联网搜索(当前仅 qwen 平台生效)',
example: true,
})
@IsOptional()
@IsBoolean()
enableWebSearch?: boolean;
@ApiPropertyOptional({
type: Boolean,
description: '是否启用深度思考(当前仅 qwen 平台生效)',
example: true,
})
@IsOptional()
@IsBoolean()
enableThinking?: boolean;
@ApiProperty({
type: () => ChatMessageDto,
isArray: true,
description: '聊天消息列表(至少一条用户消息)',
})
@IsArray()
@ValidateNested({ each: true })
@Type(() => ChatMessageDto)
messages!: ChatMessageDto[];
}