This commit is contained in:
2026-02-23 01:04:00 +08:00
parent 1e2e726744
commit c8598d3dea
7 changed files with 28 additions and 14 deletions

View File

@@ -29,8 +29,10 @@ public class DifyServiceImpl implements DifyService {
/** Dify 平台标识 */
private static final String PLATFORM_DIFY = "dify";
/** Dify 模型类型 */
private static final String MODEL_TYPE_WRITING = "writing";
/** Dify 模型类型 - Pro深度版 */
private static final String MODEL_TYPE_WRITING_PRO = "writing_pro";
/** Dify 模型类型 - 标准版 */
private static final String MODEL_TYPE_WRITING_STANDARD = "writing_standard";
@Resource
private AiAgentService aiAgentService;
@@ -55,8 +57,11 @@ public class DifyServiceImpl implements DifyService {
throw new RuntimeException("智能体不存在");
}
// 2. 获取积分配置
AiModelConfigDO config = pointsService.getConfig(PLATFORM_DIFY, MODEL_TYPE_WRITING);
// 2. 根据 modelMode 获取对应的积分配置
String modelType = "standard".equals(reqVO.getModelMode())
? MODEL_TYPE_WRITING_STANDARD
: MODEL_TYPE_WRITING_PRO;
AiModelConfigDO config = pointsService.getConfig(PLATFORM_DIFY, modelType);
// 3. 预检积分
pointsService.checkPoints(userId, config.getConsumePoints());

View File

@@ -23,4 +23,7 @@ public class DifyChatReqVO {
@Schema(description = "会话ID可选首次对话不传")
private String conversationId;
@Schema(description = "模型模式pro-深度版 standard-标准版", example = "pro")
private String modelMode = "pro";
}

View File

@@ -34,10 +34,12 @@ public interface AiAgentMapper extends BaseMapperX<AiAgentDO> {
}
/**
* 查询启用状态的智能体列表
* 查询启用状态的智能体列表(只查询必要字段)
*/
default List<AiAgentDO> selectEnabledList() {
return selectList(new LambdaQueryWrapperX<AiAgentDO>()
.select(AiAgentDO::getId, AiAgentDO::getAgentId, AiAgentDO::getAgentName,
AiAgentDO::getIcon, AiAgentDO::getDescription, AiAgentDO::getCategoryName)
.eq(AiAgentDO::getStatus, 1)
.orderByDesc(AiAgentDO::getId));
}