111
This commit is contained in:
1 parent
81eca8933a
commit
345f906c35
540 files changed
+494222
-90
No files matched your search
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>luqj-baidu-ai</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.baidubce</groupId>
|
||||
<artifactId>qianfan</artifactId>
|
||||
<version>0.0.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-framework</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>luqj-common</artifactId>
|
||||
<version>3.4.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -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字的评论");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user