mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-07-30 03:03:13 +08:00
fix zhipu issue
This commit is contained in:
@ -58,8 +58,8 @@ public class ZhipuChatAIClient {
|
||||
|
||||
public static void refresh() {
|
||||
String apiKey = "";
|
||||
String apiHost = "";
|
||||
String model = "";
|
||||
String apiHost = "https://open.bigmodel.cn/api/paas/v3/model-api/";
|
||||
String model = "chatglm_turbo";
|
||||
ConfigService configService = ApplicationContextUtil.getBean(ConfigService.class);
|
||||
Config apiHostConfig = configService.find(ZHIPU_HOST).getData();
|
||||
if (apiHostConfig != null && StringUtils.isNotBlank(apiHostConfig.getContent())) {
|
||||
|
@ -211,7 +211,7 @@ public class ZhipuChatAIStreamClient {
|
||||
.build();
|
||||
//创建事件
|
||||
EventSource eventSource = factory.newEventSource(request, eventSourceListener);
|
||||
log.info("finish invoking fast chat ai");
|
||||
log.info("finish invoking zhipu chat ai");
|
||||
} catch (Exception e) {
|
||||
log.error("fast chat ai error", e);
|
||||
eventSourceListener.onFailure(null, e, null);
|
||||
|
@ -60,12 +60,14 @@ public class ZhipuChatAIEventSourceListener extends EventSourceListener {
|
||||
}
|
||||
|
||||
ZhipuChatCompletions chatCompletions = mapper.readValue(data, ZhipuChatCompletions.class);
|
||||
String text = "";
|
||||
String text = chatCompletions.getData();
|
||||
if (Objects.isNull(text)) {
|
||||
for (FastChatMessage message : chatCompletions.getBody().getChoices()) {
|
||||
if (message != null && message.getContent() != null) {
|
||||
text = message.getContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Message message = new Message();
|
||||
message.setContent(text);
|
||||
|
@ -14,6 +14,8 @@ public class ZhipuChatCompletions {
|
||||
|
||||
private int statusCode;
|
||||
|
||||
private String data;
|
||||
|
||||
/*
|
||||
* The collection of completions choices associated with this completions response.
|
||||
* Generally, `n` choices are generated per provided prompt with a default value of 1.
|
||||
|
@ -16,10 +16,6 @@ import java.util.List;
|
||||
@Data
|
||||
public final class ZhipuChatCompletionsOptions {
|
||||
|
||||
// path variables
|
||||
@JsonProperty(value = "")
|
||||
private String invokeMethod = "sse-invoke";
|
||||
|
||||
@JsonProperty(value = "request_id")
|
||||
private String requestId;
|
||||
|
||||
|
Reference in New Issue
Block a user