import { BaseService, service } from '/@/cool';

// AI模型配置服务
class AiModelService extends BaseService {
	namespace = '/admin/aiconfig/ai/model';
}

// AI接口配置服务
class AiApiConfigService extends BaseService {
	namespace = '/admin/aiconfig/ai/api/config';

	// 测试连接
	async testConnection(data: any) {
		return this.request({
			url: '/testConnection',
			method: 'POST',
			data
		});
	}
}

// AI模板配置服务
class AiTemplateService extends BaseService {
	namespace = '/admin/aiconfig/ai/template';

	// 根据场景获取模板
	async getByScene(scene: string) {
		return this.request({
			url: '/byScene',
			method: 'GET',
			params: { scene }
		});
	}

	// 根据模型ID获取模板
	async getByModel(modelId: number) {
		return this.request({
			url: '/byModel',
			method: 'GET',
			params: { modelId }
		});
	}
}

// 注册服务
service.aiconfig = {
	model: new AiModelService(),
	apiConfig: new AiApiConfigService(),
	template: new AiTemplateService()
};

export default service.aiconfig;