Commit 951663b6b7dfcc46822eb23c5e628926a0951996
1 parent
73e4f831
fix:【AI 大模型】toolContext 为空,会导致报错问题
Showing
1 changed file
with
1 additions
and
0 deletions
yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/util/AiUtils.java
| @@ -38,6 +38,7 @@ public class AiUtils { | @@ -38,6 +38,7 @@ public class AiUtils { | ||
| 38 | public static ChatOptions buildChatOptions(AiPlatformEnum platform, String model, Double temperature, Integer maxTokens, | 38 | public static ChatOptions buildChatOptions(AiPlatformEnum platform, String model, Double temperature, Integer maxTokens, |
| 39 | Set<String> toolNames, Map<String, Object> toolContext) { | 39 | Set<String> toolNames, Map<String, Object> toolContext) { |
| 40 | toolNames = ObjUtil.defaultIfNull(toolNames, Collections.emptySet()); | 40 | toolNames = ObjUtil.defaultIfNull(toolNames, Collections.emptySet()); |
| 41 | + toolContext = ObjUtil.defaultIfNull(toolContext, Collections.emptyMap()); | ||
| 41 | // noinspection EnhancedSwitchMigration | 42 | // noinspection EnhancedSwitchMigration |
| 42 | switch (platform) { | 43 | switch (platform) { |
| 43 | case TONG_YI: | 44 | case TONG_YI: |