updates
This commit is contained in:
parent
002d15fa3d
commit
80776bcd13
|
|
@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import org.jeecg.common.util.RestUtil;
|
import org.jeecg.common.util.RestUtil;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description
|
* @Description
|
||||||
|
|
@ -20,34 +21,43 @@ public class IpKit {
|
||||||
private final static String UNKNOWN = "unknown";
|
private final static String UNKNOWN = "unknown";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String url = "http://ai.izcsz.com/api/v1/chat/completions";
|
// String url = "http://ai.izcsz.com/api/v1/chat/completions";
|
||||||
String authorization = "Bearer fastgpt-MBOxnysyhuzMMuLijtq1qYQa6dwIo6AsB0lR5L2r5ommMhBrRd0g9OKNwx4E6";
|
// String authorization = "Bearer fastgpt-MBOxnysyhuzMMuLijtq1qYQa6dwIo6AsB0lR5L2r5ommMhBrRd0g9OKNwx4E6";
|
||||||
String contentType = "application/json";
|
// String contentType = "application/json";
|
||||||
|
//
|
||||||
|
// JSONObject jsonObject = new JSONObject();
|
||||||
|
// jsonObject.put("chatId", "abcd");
|
||||||
|
// jsonObject.put("stream", false);
|
||||||
|
// jsonObject.put("detail", false);
|
||||||
|
// JSONObject variables = new JSONObject();
|
||||||
|
// variables.put("nick", "亮亮");
|
||||||
|
// jsonObject.put("variables", variables);
|
||||||
|
//
|
||||||
|
// // 创建一个 JSONArray 来包含消息对象
|
||||||
|
// JSONArray messagesArray = new JSONArray();
|
||||||
|
// JSONObject messageObject = new JSONObject();
|
||||||
|
// messageObject.put("content", "坦克700北京多少钱能买");
|
||||||
|
// messageObject.put("role", "user");
|
||||||
|
// // 将消息对象添加到数组中
|
||||||
|
// messagesArray.add(messageObject);
|
||||||
|
//
|
||||||
|
// // 将数组赋值给 "messages" 字段
|
||||||
|
// jsonObject.put("messages", messagesArray);
|
||||||
|
//
|
||||||
|
// JSONObject headerJson = new JSONObject();
|
||||||
|
// headerJson.put("Authorization", authorization);
|
||||||
|
// headerJson.put("Content-Type", contentType);
|
||||||
|
// JSONObject post = RestUtil.post(url, null, jsonObject,headerJson);
|
||||||
|
// System.out.println(post);
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
|
||||||
jsonObject.put("chatId", "abcd");
|
|
||||||
jsonObject.put("stream", false);
|
|
||||||
jsonObject.put("detail", false);
|
|
||||||
JSONObject variables = new JSONObject();
|
|
||||||
variables.put("nick", "亮亮");
|
|
||||||
jsonObject.put("variables", variables);
|
|
||||||
|
|
||||||
// 创建一个 JSONArray 来包含消息对象
|
Scanner scan = new Scanner(System.in);
|
||||||
JSONArray messagesArray = new JSONArray();
|
//在此输入您的代码...
|
||||||
JSONObject messageObject = new JSONObject();
|
String[] strs= scan.next().split(""); // 直接输入后转为字符串数组
|
||||||
messageObject.put("content", "坦克700北京多少钱能买");
|
for(int i=strs.length-1;i>0;i++){
|
||||||
messageObject.put("role", "user");
|
System.out.print(strs[i]);
|
||||||
// 将消息对象添加到数组中
|
}
|
||||||
messagesArray.add(messageObject);
|
scan.close();
|
||||||
|
|
||||||
// 将数组赋值给 "messages" 字段
|
|
||||||
jsonObject.put("messages", messagesArray);
|
|
||||||
|
|
||||||
JSONObject headerJson = new JSONObject();
|
|
||||||
headerJson.put("Authorization", authorization);
|
|
||||||
headerJson.put("Content-Type", contentType);
|
|
||||||
JSONObject post = RestUtil.post(url, null, jsonObject,headerJson);
|
|
||||||
System.out.println(post);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getRealIp(HttpServletRequest request) {
|
public static String getRealIp(HttpServletRequest request) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue