改成onebot-11通用接口 #9

Merged
yutou merged 10 commits from dev_HTTP服务化 into master 2024-05-10 13:09:42 +08:00
4 changed files with 4 additions and 12 deletions
Showing only changes of commit 2c37c19cc9 - Show all commits

View File

@ -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);

View File

@ -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();

View File

@ -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() {

View File

@ -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;