优化
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -23,4 +23,7 @@ public class DifyChatReqVO {
|
||||
@Schema(description = "会话ID(可选,首次对话不传)")
|
||||
private String conversationId;
|
||||
|
||||
@Schema(description = "模型模式:pro-深度版 standard-标准版", example = "pro")
|
||||
private String modelMode = "pro";
|
||||
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user