改成onebot-11通用接口 #9
@ -10,7 +10,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class QQBotApplication {
|
public class QQBotApplication {
|
||||||
public static final String version = "QQBot v.1.7.1";
|
public static final String version = "QQBot v.1.7.2";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("version = " + version);
|
System.out.println("version = " + version);
|
||||||
|
@ -50,11 +50,6 @@ public class QQBotController {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping("/napcat/qq/bot.do")
|
@RequestMapping("/napcat/qq/bot.do")
|
||||||
public String qq_bot(HttpServletRequest request, HttpServletResponse response) {
|
public String qq_bot(HttpServletRequest request, HttpServletResponse response) {
|
||||||
// 处理请求
|
|
||||||
Set<String> strings = request.getParameterMap().keySet();
|
|
||||||
for (String key : strings) {
|
|
||||||
System.out.println(key + ":" + request.getParameter(key));
|
|
||||||
}
|
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
try {
|
try {
|
||||||
BufferedInputStream stream = new BufferedInputStream(request.getInputStream());
|
BufferedInputStream stream = new BufferedInputStream(request.getInputStream());
|
||||||
@ -65,7 +60,6 @@ public class QQBotController {
|
|||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
}
|
}
|
||||||
String str = outputStream.toString(StandardCharsets.UTF_8);
|
String str = outputStream.toString(StandardCharsets.UTF_8);
|
||||||
System.out.println("str = " + str);
|
|
||||||
MessageEvent event = MessageEvent.parseHandle(str);
|
MessageEvent event = MessageEvent.parseHandle(str);
|
||||||
|
|
||||||
long qqNumber = event.isGroup() ? event.getGroupId() : event.getUserId();
|
long qqNumber = event.isGroup() ? event.getGroupId() : event.getUserId();
|
||||||
|
@ -17,9 +17,9 @@ public class BaiduGPTManager {
|
|||||||
//4.0
|
//4.0
|
||||||
private static final String url_4_0 = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro";
|
private static final String url_4_0 = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro";
|
||||||
private static String url = url_3_5;
|
private static String url = url_3_5;
|
||||||
private static final String AppID = "36678599";
|
private static final String AppID = ConfigTools.load(ConfigTools.CONFIG,"baidu.gpt.appid", String.class);
|
||||||
private static final String ApiKey = "eyHo6K2ILBm7if78701Az1eT";
|
private static final String ApiKey =ConfigTools.load(ConfigTools.CONFIG,"baidu.gpt.apikey", String.class);
|
||||||
private static final String SecretKey = "U4vXt8AOTk9FgB0Omft5IOh6vwhzoDgZ";
|
private static final String SecretKey =ConfigTools.load(ConfigTools.CONFIG,"baidu.gpt.SecretKey", String.class);
|
||||||
private final Map<String, List<Message>> msgMap;
|
private final Map<String, List<Message>> msgMap;
|
||||||
|
|
||||||
private BaiduGPTManager() {
|
private BaiduGPTManager() {
|
||||||
|
@ -3,8 +3,6 @@ package com.yutou.qqbot.utlis;
|
|||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.yutou.qqbot.QQBotManager;
|
|
||||||
import com.yutou.qqbot.models.Model;
|
|
||||||
|
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
Loading…
Reference in New Issue
Block a user