This commit is contained in:
lu7213 committed 2025-12-02 23:07:47 +08:00
1 parent 81eca8933a
commit 345f906c35
540 files changed
+494222 -90

No files matched your search

@@ -0,0 +1,5 @@
package com.luqj.bdai.service;
public interface IBaiduAiService {
String getPl(String content);
}
@@ -0,0 +1,32 @@
package com.luqj.bdai.service.impl;
import com.baidubce.qianfan.Qianfan;
import com.baidubce.qianfan.core.auth.Auth;
import com.baidubce.qianfan.model.chat.ChatResponse;
import com.luqj.bdai.service.IBaiduAiService;
import org.springframework.stereotype.Service;
@Service
public class BaiduAiServiceImpl implements IBaiduAiService {
Qianfan qianfan = new Qianfan(Auth.TYPE_OAUTH,"mcxmebDP4a3UU0ELLOYEN3rx", "cJcRakEzVDfcCEABl2jmvd5rnWViMhFP");
public String getPl(String content){
ChatResponse response = qianfan
.chatCompletion()
// .model("ERNIE-3.5-8K")
.model("ERNIE-Speed-128K")
.temperature(0.95)
.topP(0.7)
.penaltyScore(1.0)
// .stop()
// 与Chat类似,但通过prompt传入指令
.addMessage("user",content)
.execute();
System.out.println(response.getResult());
return response.getResult();
}
public static void main(String[] args) {
BaiduAiServiceImpl baiduAiService = new BaiduAiServiceImpl();
baiduAiService.getPl("一个驱逐舰05的车主论坛上发布了一条标题为:不知道是不是没有设置对,亏点油耗这么高,我是强制保电50% 的文章,写一条字数大于20字,小于35字的评论");
}
}