forked from wangziqi/gongxue-base
Refactor AI config to step-based wizard with DeepSeek defaults
This commit is contained in:
@@ -24,8 +24,8 @@ export class SaveAiConfigDto {
|
||||
@IsIn(PROVIDERS)
|
||||
provider!: AiProvider;
|
||||
|
||||
@ValidateIf((o: SaveAiConfigDto) => o.provider === AiProvider.OPENAI_COMPATIBLE || o.baseUrl !== undefined)
|
||||
@IsNotEmpty({ message: 'OPENAI_COMPATIBLE 模式必须提供 baseUrl' })
|
||||
@ValidateIf((o: SaveAiConfigDto) => o.provider === AiProvider.OPENAI_COMPATIBLE || (o.baseUrl !== undefined && o.baseUrl !== ''))
|
||||
@IsNotEmpty({ message: 'Base URL 不能为空' })
|
||||
@IsString()
|
||||
baseUrl?: string;
|
||||
|
||||
@@ -113,4 +113,32 @@ export interface AiRuntimeConfig {
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
/** DTO for POST /api/ai/config/models — fetch available model list from provider */
|
||||
export class FetchModelsDto {
|
||||
@IsOptional()
|
||||
@IsIn(PROVIDERS)
|
||||
provider?: AiProvider;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
baseUrl?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
apiKey?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
@Min(1000)
|
||||
@Max(120000)
|
||||
timeoutMs?: number;
|
||||
}
|
||||
|
||||
/** Response shape for POST /api/ai/config/models */
|
||||
export interface FetchModelsResultDto {
|
||||
success: boolean;
|
||||
models: Array<{ id: string }>;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export { DEFAULT_BASE_URLS };
|
||||
|
||||
Reference in New Issue
Block a user