forked from xiangwang25/whale-town-end-v2
Initial WhaleTown V2 backend
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { IsIn, IsOptional, IsString, IsUrl, Length } from 'class-validator';
|
||||
|
||||
export class ListCafeCompanionModelsDto {
|
||||
@IsOptional()
|
||||
@IsIn(['openai', 'anthropic'], { message: '代理协议必须是 openai 或 anthropic' })
|
||||
protocol?: 'openai' | 'anthropic';
|
||||
|
||||
@IsUrl({ require_tld: false }, { message: '接口URL格式不正确' })
|
||||
@Length(1, 240, { message: '接口URL长度需在1-240字符之间' })
|
||||
base_url!: string;
|
||||
|
||||
@IsString({ message: '接口Token必须是字符串' })
|
||||
@Length(1, 2000, { message: '接口Token长度需在1-2000字符之间' })
|
||||
token!: string;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { IsInt, IsOptional, IsString, Length, Matches, Min } from 'class-validator';
|
||||
|
||||
export class PurchaseCafeCompanionChatTimeDto {
|
||||
@IsString({ message: '服务点ID必须是字符串' })
|
||||
@Length(1, 80, { message: '服务点ID长度需在1-80字符之间' })
|
||||
@Matches(/^[A-Za-z0-9_:-]+$/, { message: '服务点ID格式不正确' })
|
||||
service_point_id!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString({ message: '陪伴机器人ID必须是字符串' })
|
||||
@Length(1, 120, { message: '陪伴机器人ID长度需在1-120字符之间' })
|
||||
@Matches(/^[A-Za-z0-9_:-]+$/, { message: '陪伴机器人ID格式不正确' })
|
||||
companion_id?: string;
|
||||
|
||||
@IsInt({ message: '聊天时长必须是整数分钟' })
|
||||
@Min(1, { message: '聊天时长必须大于0分钟' })
|
||||
minutes!: number;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import { IsBoolean, IsIn, IsInt, IsOptional, IsString, IsUrl, Length, Matches, Max, Min } from 'class-validator';
|
||||
|
||||
export class RegisterCafeCompanionAgentDto {
|
||||
@IsString({ message: '服务点ID必须是字符串' })
|
||||
@Length(1, 80, { message: '服务点ID长度需在1-80字符之间' })
|
||||
@Matches(/^[A-Za-z0-9_:-]+$/, { message: '服务点ID格式不正确' })
|
||||
service_point_id!: string;
|
||||
|
||||
@IsString({ message: '人设名称必须是字符串' })
|
||||
@Length(1, 80, { message: '人设名称长度需在1-80字符之间' })
|
||||
persona_name!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsIn(['openai', 'anthropic'], { message: '代理协议必须是 openai 或 anthropic' })
|
||||
protocol?: 'openai' | 'anthropic';
|
||||
|
||||
@IsUrl({ require_tld: false }, { message: '接口URL格式不正确' })
|
||||
@Length(1, 240, { message: '接口URL长度需在1-240字符之间' })
|
||||
base_url!: string;
|
||||
|
||||
@IsString({ message: '接口Token必须是字符串' })
|
||||
@Length(1, 2000, { message: '接口Token长度需在1-2000字符之间' })
|
||||
token!: string;
|
||||
|
||||
@IsString({ message: '模型名称必须是字符串' })
|
||||
@Length(1, 120, { message: '模型名称长度需在1-120字符之间' })
|
||||
model!: string;
|
||||
|
||||
@IsString({ message: '人设指令必须是字符串' })
|
||||
@Length(1, 4000, { message: '人设指令长度需在1-4000字符之间' })
|
||||
persona_prompt!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString({ message: '欢迎语必须是字符串' })
|
||||
@Length(0, 300, { message: '欢迎语不能超过300字符' })
|
||||
welcome_message?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean({ message: '启用状态必须是布尔值' })
|
||||
enabled?: boolean;
|
||||
|
||||
@IsInt({ message: '打工时间必须是整数分钟' })
|
||||
@Min(30, { message: '打工时间不能少于30分钟' })
|
||||
@Max(480, { message: '打工时间不能超过8小时' })
|
||||
employment_minutes!: number;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { IsString, Length, Matches } from 'class-validator';
|
||||
|
||||
export class ResignCafeCompanionEmploymentDto {
|
||||
@IsString({ message: '服务点ID必须是字符串' })
|
||||
@Length(1, 80, { message: '服务点ID长度需在1-80字符之间' })
|
||||
@Matches(/^[A-Za-z0-9_:-]+$/, { message: '服务点ID格式不正确' })
|
||||
service_point_id!: string;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { IsString, Length, Matches } from 'class-validator';
|
||||
|
||||
export class SendCafeCompanionMessageDto {
|
||||
@IsString({ message: '会话ID必须是字符串' })
|
||||
@Length(1, 120, { message: '会话ID长度需在1-120字符之间' })
|
||||
@Matches(/^[A-Za-z0-9_:-]+$/, { message: '会话ID格式不正确' })
|
||||
session_id!: string;
|
||||
|
||||
@IsString({ message: '消息内容必须是字符串' })
|
||||
@Length(1, 1200, { message: '消息内容长度需在1-1200字符之间' })
|
||||
content!: string;
|
||||
}
|
||||
Reference in New Issue
Block a user