|
@@ -1,5 +1,9 @@
|
|
package org.jeecg.modules.okki.site.controller;
|
|
package org.jeecg.modules.okki.site.controller;
|
|
|
|
|
|
|
|
+import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
+import com.zhipu.oapi.ClientV4;
|
|
|
|
+import com.zhipu.oapi.Constants;
|
|
|
|
+import com.zhipu.oapi.service.v4.model.*;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.http.HttpHeaders;
|
|
import org.apache.http.HttpHeaders;
|
|
@@ -16,6 +20,11 @@ import org.jeecg.modules.okki.site.service.IOkkiSiteService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @Description: 站点
|
|
* @Description: 站点
|
|
* @Author: Jack
|
|
* @Author: Jack
|
|
@@ -170,4 +179,75 @@ public class ShopApiController {
|
|
feiShuSheetService.createFeiShuSeoShowlistBitable(recordSheetDto);
|
|
feiShuSheetService.createFeiShuSeoShowlistBitable(recordSheetDto);
|
|
return Result.ok();
|
|
return Result.ok();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @RequestMapping("/test")
|
|
|
|
+ public Result<?> test() throws JsonProcessingException {
|
|
|
|
+ List<ChatMessage> messages = new ArrayList<>();
|
|
|
|
+ ChatMessage systemChatMessage = new ChatMessage(ChatMessageRole.SYSTEM.value(), "#角色 你是一位情感、心理学和社会学领域的专家,专注于情感分析。通过对话中的语言和情感线索,你能够深入洞察对话者的心理活动,捕捉他们的情感波动、内在需求和潜在动机。不仅如此,你还可以分析对话中的社会互动模式,揭示人际关系中的权力动态、依赖性或冲突源。无论是提供情感支持、改善人际沟通,还是帮助理解复杂的心理状态,你都能通过精准的情感解读,为我提供全面的分析与建议。");
|
|
|
|
+ messages.add(systemChatMessage);
|
|
|
|
+
|
|
|
|
+ String promot = "Mick(SEM优化专员) 9-13 11:18:29\n" +
|
|
|
|
+ "@Anne☆英 您好,这边给您准备了一份广告部署表,里面帮您整理了产品列表,每日预算以及投放地区的内容,麻烦您看一下是否符合我们推广的预期。如果有问题也欢迎与我们沟通修改。\n" +
|
|
|
|
+ "\n" +
|
|
|
|
+ "Mick(SEM优化专员) 9-13 11:18:42\n" +
|
|
|
|
+ "[文件:2-Google ads部署表.xls]\n" +
|
|
|
|
+ "\n" +
|
|
|
|
+ "Anne☆英@微信@微信联系人 9-13 11:21:08\n" +
|
|
|
|
+ "好的,我们先看看\n" +
|
|
|
|
+ "\n" +
|
|
|
|
+ "Anne☆英@微信@微信联系人 9-13 11:26:51\n" +
|
|
|
|
+ "@王佳恒 你好,就是这一组吗?\n" +
|
|
|
|
+ "\n" +
|
|
|
|
+ "Mick(SEM优化专员) 9-13 11:27:47\n" +
|
|
|
|
+ "嗯嗯对的\n" +
|
|
|
|
+ "\n" +
|
|
|
|
+ "Mick(SEM优化专员) 9-13 11:27:58\n" +
|
|
|
|
+ "目前给您整理了一个广告大类的内容\n" +
|
|
|
|
+ "\n" +
|
|
|
|
+ "Anne☆英@微信@微信联系人 9-13 11:33:52\n" +
|
|
|
|
+ "不行哦,这几个Google图片搜出来的,几乎100%与我们要做的产品不相关\n" +
|
|
|
|
+ "\n" +
|
|
|
|
+ "Anne☆英@微信@微信联系人 9-13 11:41:30\n" +
|
|
|
|
+ "standup pouch 也不行,这个词零售属性更强,不符合我们定位的B端客户\n" +
|
|
|
|
+ "\n" +
|
|
|
|
+ "Anne☆英@微信@微信联系人 9-13 11:43:21\n" +
|
|
|
|
+ "@王佳恒 你有没有keywords everywhere?\n" +
|
|
|
|
+ "\n" +
|
|
|
|
+ "Anne☆英@微信@微信联系人 9-13 11:44:19\n" +
|
|
|
|
+ "如果有,帮忙查一下: eight side-sealed bag 和quad seal bag 的 volume(搜索量)和CPC (点击花费)\n" +
|
|
|
|
+ "\n" +
|
|
|
|
+ "Anne☆英@微信@微信联系人 9-13 11:50:26\n" +
|
|
|
|
+ "另外,你直接拿我们网站上这个作为这个广告组的着陆页,也不合适吧?着陆页觉得客户是否询盘,不是应该好好设计一下吗?";
|
|
|
|
+ ChatMessage userChatMessage = new ChatMessage(ChatMessageRole.USER.value(), promot);
|
|
|
|
+ messages.add(userChatMessage);
|
|
|
|
+
|
|
|
|
+ log.info("messages:{}", FastJsonUtil.toJSONString(messages));
|
|
|
|
+
|
|
|
|
+ HashMap<String, Object> extraJson = new HashMap<>();
|
|
|
|
+ extraJson.put("temperature", 0.5);
|
|
|
|
+ extraJson.put("max_tokens", 3);
|
|
|
|
+
|
|
|
|
+ ChatCompletionRequest chatCompletionRequest = ChatCompletionRequest.builder()
|
|
|
|
+ .model(Constants.ModelChatGLM4)
|
|
|
|
+ .stream(Boolean.FALSE)
|
|
|
|
+ .invokeMethod(Constants.invokeMethod)
|
|
|
|
+ .messages(messages)
|
|
|
|
+ .build();
|
|
|
|
+
|
|
|
|
+ ClientV4 client = new ClientV4.Builder("3e1dc0e5cee1a8f0cc7b1fd01e5276c0.ueEh44nuymbAbUle")
|
|
|
|
+ .networkConfig(300, 100, 100, 100, TimeUnit.SECONDS)
|
|
|
|
+ .connectionPool(new okhttp3.ConnectionPool(8, 1, TimeUnit.SECONDS))
|
|
|
|
+ .build();
|
|
|
|
+
|
|
|
|
+ ModelApiResponse invokeModelApiResp = client.invokeModelApi(chatCompletionRequest);
|
|
|
|
+ log.info("model output: {}", FastJsonUtil.toJSONString(invokeModelApiResp));
|
|
|
|
+
|
|
|
|
+ String text = "";
|
|
|
|
+ if (invokeModelApiResp.isSuccess()) {
|
|
|
|
+ List<Choice> choices = invokeModelApiResp.getData().getChoices();
|
|
|
|
+ text = choices.get(0).getMessage().getContent().toString();
|
|
|
|
+ }
|
|
|
|
+ return Result.OK("OK", text);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|