supeng 2 päivää sitten
vanhempi
commit
ee36d3fdac

+ 4 - 2
content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/service/impl/GeminiGenerateContentAction.java

@@ -1,6 +1,7 @@
 package com.tzld.piaoquan.content.understanding.service.impl;
 package com.tzld.piaoquan.content.understanding.service.impl;
 
 
 import com.alibaba.fastjson.JSON;
 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.base.CommonResponse;
 import com.tzld.piaoquan.content.understanding.common.enums.ContentTypeEnum;
 import com.tzld.piaoquan.content.understanding.common.enums.ContentTypeEnum;
 import com.tzld.piaoquan.content.understanding.model.param.ActionParam;
 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));
                 Optional<String> optionalS = httpPoolClient.postJson(geminiApiUrl, JSON.toJSONString(geminiParam));
                 log.info("geminiGenerateContentAction optionalS = {}", optionalS);
                 log.info("geminiGenerateContentAction optionalS = {}", optionalS);
                 if (optionalS.isPresent()) {
                 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"))) {
                     if (commonResponse.isSuccess() && Objects.nonNull(commonResponse.getData()) && Objects.nonNull(commonResponse.getData().get("result"))) {
                         String content = commonResponse.getData().get("result").toString();
                         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));
                     throw new RuntimeException("geminiGenerateContentAction optionalS is null geminiParam = " + JSON.toJSONString(geminiParam));
                 }
                 }
             } catch (Exception e) {
             } 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);
                 throw new RuntimeException("geminiGenerateContentAction request error", e);
             }
             }
         }, RETRY_TIMES, "geminiGenerateContentAction");
         }, RETRY_TIMES, "geminiGenerateContentAction");