forked from wangziqi/gongxue-base
Refactor AI config to step-based wizard with DeepSeek defaults
This commit is contained in:
@@ -12,7 +12,7 @@ import { RequirePermission } from '../auth/decorators/permission.decorator';
|
||||
import { OperationLogsService } from '../operation-logs/operation-logs.service';
|
||||
import { extractRequestInfo } from '../common/request-utils';
|
||||
import { AiConfigService } from './ai-config.service';
|
||||
import { SaveAiConfigDto, TestAiConfigDto } from './dto/ai-config.dto';
|
||||
import { SaveAiConfigDto, TestAiConfigDto, FetchModelsDto } from './dto/ai-config.dto';
|
||||
|
||||
interface AuthenticatedRequest {
|
||||
user?: { id: number; username: string };
|
||||
@@ -47,7 +47,7 @@ export class AiConfigController {
|
||||
action: 'save',
|
||||
targetId: config.id,
|
||||
targetType: 'AiConfig',
|
||||
detail: `provider=${body.provider} host=${new URL(config.baseUrl).hostname} model=${body.defaultModel ? 'configured' : 'not-set'} enabled=${body.enabled ?? config.enabled}`,
|
||||
detail: `provider=${body.provider} host=${new URL(config.baseUrl).hostname} model=${body.defaultModel ? 'configured' : 'not-set'}`,
|
||||
ipAddress,
|
||||
userAgent,
|
||||
});
|
||||
@@ -73,6 +73,13 @@ export class AiConfigController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Post('models')
|
||||
@RequirePermission('ai:config:read')
|
||||
async fetchModels(@Body() body: FetchModelsDto) {
|
||||
const result = await this.service.fetchModels(body);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Post('clear-key')
|
||||
@RequirePermission('ai:config:write')
|
||||
async clearKey(@Req() req: AuthenticatedRequest) {
|
||||
|
||||
Reference in New Issue
Block a user