diff --git a/docs/curl/curl-glm-4v.sh b/docs/curl/curl-glm-4v.sh index 25e5357bb3e3412932ee136a663230631b4e2399..d85a4162ea6bdd638af2afd7dea51fc42cf0b991 100644 --- a/docs/curl/curl-glm-4v.sh +++ b/docs/curl/curl-glm-4v.sh @@ -1,6 +1,6 @@ # url 支持base64和图片地址;https://bugstack.cn/images/article/project/chatgpt/chatgpt-extra-231011-01.png curl -X POST \ - -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsInNpZ25fdHlwZSI6IlNJR04ifQ.eyJhcGlfa2V5IjoiNjJkZGVjMzhiMWQwYjlhN2IwZmRkYWYyNzFlNmVkOTAiLCJleHAiOjE3MDU4MDgxNDEwNDUsInRpbWVzdGFtcCI6MTcwNTgwNjM0MTA0NX0.o7kogP0ZIFWVEEhplGaW1zBz16B1UbG2NIEqb7ZVflU" \ + -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsInNpZ25fdHlwZSI6IlNJR04ifQ.eyJhcGlfa2V5IjoiMzk1ODBlMzRlMTc1MDE5YzIzMGZkZDUxOTgxN2IzODEiLCJleHAiOjE3MTczNzE2MzE4MDgsInRpbWVzdGFtcCI6MTcxNzM2OTgzMTgwOH0.2lk57oALzFxx2eAo-dKojKnVpn_MvJ8VJ4NQWTMYPHQ" \ -H "Content-Type: application/json" \ -H "User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)" \ -d '{ diff --git a/src/main/java/cn/bugstack/chatglm/model/ChatCompletionRequest.java b/src/main/java/cn/bugstack/chatglm/model/ChatCompletionRequest.java index 1dc83d54c23785f88b1efd3393e193a4cd62c51f..9d154d90d9690dd8bbb8c0557475429d9e2ce7b9 100644 --- a/src/main/java/cn/bugstack/chatglm/model/ChatCompletionRequest.java +++ b/src/main/java/cn/bugstack/chatglm/model/ChatCompletionRequest.java @@ -70,7 +70,7 @@ public class ChatCompletionRequest { * 24年1月发布的 GLM_3_5_TURBO、GLM_4 模型时新增 */ @JsonProperty("max_tokens") - private Integer maxTokens = 2048; + private Integer maxTokens = 1024; /** * 模型在遇到stop所制定的字符时将停止生成,目前仅支持单个停止词,格式为["stop_word1"] * 24年1月发布的 GLM_3_5_TURBO、GLM_4 模型时新增 diff --git a/src/test/java/cn/bugstack/chatglm/test/ApiTest.java b/src/test/java/cn/bugstack/chatglm/test/ApiTest.java index cef643f5479243d8e3d33b9a0eb9a75046170764..7415afdd85c08712a64aefe595674a06f3bee005 100644 --- a/src/test/java/cn/bugstack/chatglm/test/ApiTest.java +++ b/src/test/java/cn/bugstack/chatglm/test/ApiTest.java @@ -40,7 +40,7 @@ public class ApiTest { // 1. 配置文件 Configuration configuration = new Configuration(); configuration.setApiHost("https://open.bigmodel.cn/"); - configuration.setApiSecretKey("74e0b7fff9a578e2137300bcd58ae062.q0ABClJJS50rHQnn"); + configuration.setApiSecretKey("39580e34e175019c230fdd519817b381.*****"); configuration.setLevel(HttpLoggingInterceptor.Level.BODY); // 2. 会话工厂 OpenAiSessionFactory factory = new DefaultOpenAiSessionFactory(configuration); @@ -125,7 +125,7 @@ public class ApiTest { // 入参;模型、请求信息 ChatCompletionRequest request = new ChatCompletionRequest(); - request.setModel(Model.GLM_4); // GLM_3_5_TURBO、GLM_4 + request.setModel(Model.GLM_4V); // GLM_3_5_TURBO、GLM_4 request.setIsCompatible(false); // 24年1月发布的 glm-3-turbo、glm-4 支持函数、知识库、联网功能 request.setTools(new ArrayList() { @@ -196,10 +196,10 @@ public class ApiTest { { // content 字符串格式 - add(ChatCompletionRequest.Prompt.builder() - .role(Role.user.getCode()) - .content("这个图片写了什么") - .build()); +// add(ChatCompletionRequest.Prompt.builder() +// .role(Role.user.getCode()) +// .content("这个图片写了什么") +// .build()); // content 对象格式 add(ChatCompletionRequest.Prompt.builder() @@ -348,7 +348,7 @@ public class ApiTest { // 1. 配置文件 Configuration configuration = new Configuration(); configuration.setApiHost("https://open.bigmodel.cn/"); - configuration.setApiSecretKey("62ddec38b1d0b9a7b0fddaf271e6ed90.HpD0SUBUlvqd05ey"); + configuration.setApiSecretKey("39580e34e175019c230fdd519817b381.*****"); // 2. 获取Token String token = BearerTokenUtils.getToken(configuration.getApiKey(), configuration.getApiSecret());