|
|
@@ -51,12 +51,13 @@ public class DeconstructStrategy implements DemandExtractionStrategy {
|
|
|
@Override
|
|
|
public StrategyResultDTO execute(SdTask task, SdStrategy strategy) {
|
|
|
log.info("Executing deconstruct task: taskId={}, taskNo={}", task.getId(), task.getTaskNo());
|
|
|
+ StrategyConfigDTO strategyConfigDTO = JSON.parseObject(strategy.getConfig(), StrategyConfigDTO.class);
|
|
|
// 1. 获取Prompt模板
|
|
|
- SdPromptTemplate promptTemplate = sdPromptTemplateMapper.selectById(strategy.getPromptTemplateId());
|
|
|
+ SdPromptTemplate promptTemplate = sdPromptTemplateMapper.selectById(strategyConfigDTO.getPromptTemplateId());
|
|
|
if (Objects.isNull(promptTemplate)) {
|
|
|
- log.error("Prompt template not found: promptTemplateId={}", strategy.getPromptTemplateId());
|
|
|
+ log.error("Prompt template not found: promptTemplateId={}", strategyConfigDTO.getPromptTemplateId());
|
|
|
return StrategyResultDTO.builder()
|
|
|
- .isSuccess(false)
|
|
|
+ .success(false)
|
|
|
.msg("Prompt template not found")
|
|
|
.build();
|
|
|
}
|
|
|
@@ -72,7 +73,7 @@ public class DeconstructStrategy implements DemandExtractionStrategy {
|
|
|
if (Objects.isNull(subTasks) || subTasks.isEmpty()) {
|
|
|
log.warn("No successful subtasks found: taskId={}", task.getId());
|
|
|
return StrategyResultDTO.builder()
|
|
|
- .isSuccess(false)
|
|
|
+ .success(false)
|
|
|
.msg("No successful subtasks found")
|
|
|
.build();
|
|
|
}
|
|
|
@@ -90,7 +91,7 @@ public class DeconstructStrategy implements DemandExtractionStrategy {
|
|
|
if (Objects.isNull(resultItems) || resultItems.isEmpty()) {
|
|
|
log.warn("No subtask result items found: taskId={}", task.getId());
|
|
|
return StrategyResultDTO.builder()
|
|
|
- .isSuccess(false)
|
|
|
+ .success(false)
|
|
|
.msg("No subtask result items found")
|
|
|
.build();
|
|
|
}
|
|
|
@@ -107,11 +108,10 @@ public class DeconstructStrategy implements DemandExtractionStrategy {
|
|
|
|
|
|
// 6. 调用AI服务 (TODO: 实现具体调用逻辑)
|
|
|
log.info("Preparing to call AI service: taskId={}, promptLength={}", task.getId(), finalPrompt.length());
|
|
|
- StrategyConfigDTO strategyConfigDTO = JSON.parseObject(strategy.getConfig(), StrategyConfigDTO.class);
|
|
|
try {
|
|
|
String result = openRouterClient.chat(strategyConfigDTO.getModel(), finalPrompt);
|
|
|
return StrategyResultDTO.builder()
|
|
|
- .isSuccess(true)
|
|
|
+ .success(true)
|
|
|
.result(result)
|
|
|
.build();
|
|
|
} catch (IOException e) {
|
|
|
@@ -119,8 +119,9 @@ public class DeconstructStrategy implements DemandExtractionStrategy {
|
|
|
}
|
|
|
log.info("Deconstruct task execution completed: taskId={}", task.getId());
|
|
|
return StrategyResultDTO.builder()
|
|
|
- .isSuccess(false)
|
|
|
+ .success(false)
|
|
|
.msg("execute Deconstruct strategy failure")
|
|
|
.build();
|
|
|
+
|
|
|
}
|
|
|
}
|