BUGFIX: 1、对话历史记录 有的回答没有深度思考标识 2、批量生成,积分扣除不足
This commit is contained in:
@@ -33,6 +33,8 @@ public interface CreditsService extends IService<CreditsDetail> {
|
|||||||
|
|
||||||
void addRecordToCreditsDeduction(Long accountId, String taskId, CreditsEventsEnum creditsEventsEnum);
|
void addRecordToCreditsDeduction(Long accountId, String taskId, CreditsEventsEnum creditsEventsEnum);
|
||||||
|
|
||||||
|
void addRecordToCreditsDeduction(Long accountId, String taskId, CreditsEventsEnum creditsEventsEnum, Integer num);
|
||||||
|
|
||||||
Boolean taskCreditsDeduction(Long accountId, String taskId);
|
Boolean taskCreditsDeduction(Long accountId, String taskId);
|
||||||
|
|
||||||
CreditsDetail getByAccountIdAndChangeEvent(Long accountId, String changeEvent, String changedCredits);
|
CreditsDetail getByAccountIdAndChangeEvent(Long accountId, String changeEvent, String changedCredits);
|
||||||
|
|||||||
@@ -266,6 +266,12 @@ public class CreditsServiceImpl extends ServiceImpl<CreditsDetailMapper, Credits
|
|||||||
redisUtil.addToString(creditsDeduction + ":" + accountId + ":" + taskId, creditsEventsEnum.getValue(), CommonConstant.CREDITS_EXPIRE_TIME);
|
redisUtil.addToString(creditsDeduction + ":" + accountId + ":" + taskId, creditsEventsEnum.getValue(), CommonConstant.CREDITS_EXPIRE_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addRecordToCreditsDeduction(Long accountId, String taskId, CreditsEventsEnum creditsEventsEnum, Integer num) {
|
||||||
|
// 5、添加当前任务的预扣积分到redis 任务有效期一天,若待扣积分两天还没被移除,说明任务已经失败,待扣积分自动失效
|
||||||
|
redisUtil.addToString(creditsDeduction + ":" + accountId + ":" + taskId, String.valueOf(Long.parseLong(creditsEventsEnum.getValue()) * num), CommonConstant.CREDITS_EXPIRE_TIME);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行扣除积分,更新数据库
|
* 执行扣除积分,更新数据库
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2041,7 +2041,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
toProductImageResultMapper.insert(toProductImageResult);
|
toProductImageResultMapper.insert(toProductImageResult);
|
||||||
result.add(toProductImageResult);
|
result.add(toProductImageResult);
|
||||||
// 添加需要扣除的积分到预扣除区
|
// 添加需要扣除的积分到预扣除区
|
||||||
creditsService.addRecordToCreditsDeduction(userHolder.getId(), taskId, CreditsEventsEnum.TO_PRODUCT_IMAGE);
|
creditsService.addRecordToCreditsDeduction(userHolder.getId(), taskId, CreditsEventsEnum.TO_PRODUCT_IMAGE, cloudTaskDTO.getNums());
|
||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
pythonService.toProductImageBatch(batchTaskId, paramList, userHolder.getId().toString());
|
pythonService.toProductImageBatch(batchTaskId, paramList, userHolder.getId().toString());
|
||||||
@@ -2083,7 +2083,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
toProductImageResultMapper.insert(toProductImageResult);
|
toProductImageResultMapper.insert(toProductImageResult);
|
||||||
result.add(toProductImageResult);
|
result.add(toProductImageResult);
|
||||||
// 添加需要扣除的积分到预扣除区
|
// 添加需要扣除的积分到预扣除区
|
||||||
creditsService.addRecordToCreditsDeduction(userHolder.getId(), taskId, CreditsEventsEnum.TO_PRODUCT_IMAGE);
|
creditsService.addRecordToCreditsDeduction(userHolder.getId(), taskId, CreditsEventsEnum.TO_PRODUCT_IMAGE, cloudTaskDTO.getNums());
|
||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
pythonService.toProductImageBatch(batchTaskId, paramList, userHolder.getId().toString());
|
pythonService.toProductImageBatch(batchTaskId, paramList, userHolder.getId().toString());
|
||||||
@@ -2208,7 +2208,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
result.add(toProductImageResult);
|
result.add(toProductImageResult);
|
||||||
|
|
||||||
// 添加需要扣除的积分到预扣除区
|
// 添加需要扣除的积分到预扣除区
|
||||||
creditsService.addRecordToCreditsDeduction(userHolder.getId(), taskId, CreditsEventsEnum.RELIGHT);
|
creditsService.addRecordToCreditsDeduction(userHolder.getId(), taskId, CreditsEventsEnum.RELIGHT, cloudTaskDTO.getNums());
|
||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
// 走模型
|
// 走模型
|
||||||
@@ -2251,7 +2251,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
result.add(toProductImageResult);
|
result.add(toProductImageResult);
|
||||||
|
|
||||||
// 添加需要扣除的积分到预扣除区
|
// 添加需要扣除的积分到预扣除区
|
||||||
creditsService.addRecordToCreditsDeduction(userHolder.getId(), taskId, CreditsEventsEnum.RELIGHT);
|
creditsService.addRecordToCreditsDeduction(userHolder.getId(), taskId, CreditsEventsEnum.RELIGHT, cloudTaskDTO.getNums());
|
||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
// 走模型
|
// 走模型
|
||||||
@@ -2325,7 +2325,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
Boolean b = pythonService.poseTransformationBatch(poseTransformBatchDTO.getProductImage(), poseTransformBatchDTO.getPoseId(), taskId);
|
Boolean b = pythonService.poseTransformationBatch(poseTransformBatchDTO.getProductImage(), poseTransformBatchDTO.getPoseId(), taskId);
|
||||||
if (b){
|
if (b){
|
||||||
// 6、添加预扣除积分到redis
|
// 6、添加预扣除积分到redis
|
||||||
creditsService.addRecordToCreditsDeduction(accountId, uuid, creditsEventsEnum);
|
creditsService.addRecordToCreditsDeduction(accountId, uuid, creditsEventsEnum, cloudTaskDTO.getNums());
|
||||||
// 6.1 添加积分扣除记录到db
|
// 6.1 添加积分扣除记录到db
|
||||||
creditsService.preInsert(accountId, creditsEventsEnum.getName(), uuid, Boolean.TRUE, null);
|
creditsService.preInsert(accountId, creditsEventsEnum.getName(), uuid, Boolean.TRUE, null);
|
||||||
}else {
|
}else {
|
||||||
|
|||||||
@@ -353,6 +353,7 @@ public class LLMServiceImpl implements LLMService {
|
|||||||
chatMessageMapper.insert(systemMessage);
|
chatMessageMapper.insert(systemMessage);
|
||||||
systemMessage.setId(null);
|
systemMessage.setId(null);
|
||||||
responseContentBuilder = new StringBuilder();
|
responseContentBuilder = new StringBuilder();
|
||||||
|
contentType = null;
|
||||||
}
|
}
|
||||||
String toolsName = json.getString("tools_name");
|
String toolsName = json.getString("tools_name");
|
||||||
JSONObject toolsData = json.getJSONObject("content");
|
JSONObject toolsData = json.getJSONObject("content");
|
||||||
|
|||||||
Reference in New Issue
Block a user