|
@@ -1,6 +1,7 @@
|
|
|
package com.tzld.piaoquan.content.understanding.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.TypeReference;
|
|
|
import com.tzld.piaoquan.content.understanding.common.base.CommonResponse;
|
|
|
import com.tzld.piaoquan.content.understanding.common.enums.ContentTypeEnum;
|
|
|
import com.tzld.piaoquan.content.understanding.model.param.ActionParam;
|
|
@@ -62,7 +63,8 @@ public class GeminiGenerateContentAction implements Action {
|
|
|
Optional<String> optionalS = httpPoolClient.postJson(geminiApiUrl, JSON.toJSONString(geminiParam));
|
|
|
log.info("geminiGenerateContentAction optionalS = {}", optionalS);
|
|
|
if (optionalS.isPresent()) {
|
|
|
- CommonResponse<Map<String, Object>> commonResponse = JSON.parseObject(optionalS.get(), CommonResponse.class);
|
|
|
+ CommonResponse<Map<String, Object>> commonResponse = JSON.parseObject(optionalS.get(), new TypeReference<CommonResponse<Map<String, Object>>>() {
|
|
|
+ });
|
|
|
if (commonResponse.isSuccess() && Objects.nonNull(commonResponse.getData()) && Objects.nonNull(commonResponse.getData().get("result"))) {
|
|
|
String content = commonResponse.getData().get("result").toString();
|
|
|
//过滤一些特殊格式
|
|
@@ -75,7 +77,7 @@ public class GeminiGenerateContentAction implements Action {
|
|
|
throw new RuntimeException("geminiGenerateContentAction optionalS is null geminiParam = " + JSON.toJSONString(geminiParam));
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- log.error("geminiGenerateContentAction error param = {}", e, JSON.toJSONString(geminiParam));
|
|
|
+ log.error("geminiGenerateContentAction error param = {}", JSON.toJSONString(geminiParam), e);
|
|
|
throw new RuntimeException("geminiGenerateContentAction request error", e);
|
|
|
}
|
|
|
}, RETRY_TIMES, "geminiGenerateContentAction");
|