mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-07-31 03:32:43 +08:00
fix custom ai
This commit is contained in:
@ -66,7 +66,7 @@ public class FastChatAIEventSourceListener extends EventSourceListener {
|
||||
log.info("Model={} is created at {}.", chatCompletions.getId(),
|
||||
chatCompletions.getCreated());
|
||||
for (FastChatChoice choice : chatCompletions.getChoices()) {
|
||||
FastChatMessage message = choice.getMessage();
|
||||
FastChatMessage message = choice.getDelta();
|
||||
if (message != null) {
|
||||
log.info("Index: {}, Chat Role: {}", choice.getIndex(), message.getRole());
|
||||
if (message.getContent() != null) {
|
||||
|
@ -30,8 +30,8 @@ public final class FastChatChoice {
|
||||
/*
|
||||
* The log probabilities model for tokens associated with this completions choice.
|
||||
*/
|
||||
@JsonProperty(value = "message")
|
||||
private FastChatMessage message;
|
||||
@JsonProperty(value = "delta")
|
||||
private FastChatMessage delta;
|
||||
|
||||
/*
|
||||
* Reason for finishing
|
||||
@ -44,18 +44,18 @@ public final class FastChatChoice {
|
||||
*
|
||||
* @param text the text value to set.
|
||||
* @param index the index value to set.
|
||||
* @param message the message value to set
|
||||
* @param delta the message value to set
|
||||
* @param finishReason the finishReason value to set.
|
||||
*/
|
||||
@JsonCreator
|
||||
private FastChatChoice(
|
||||
@JsonProperty(value = "text") String text,
|
||||
@JsonProperty(value = "index") int index,
|
||||
@JsonProperty(value = "message") FastChatMessage message,
|
||||
@JsonProperty(value = "delta") FastChatMessage delta,
|
||||
@JsonProperty(value = "finish_reason") FastChatCompletionsFinishReason finishReason) {
|
||||
this.text = text;
|
||||
this.index = index;
|
||||
this.message = message;
|
||||
this.delta = delta;
|
||||
this.finishReason = finishReason;
|
||||
}
|
||||
|
||||
@ -82,8 +82,8 @@ public final class FastChatChoice {
|
||||
*
|
||||
* @return the logprobs value.
|
||||
*/
|
||||
public FastChatMessage getMessage() {
|
||||
return this.message;
|
||||
public FastChatMessage getDelta() {
|
||||
return this.delta;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,7 +83,7 @@ public class ConfigController {
|
||||
saveChat2dbAIConfig(request);
|
||||
break;
|
||||
case RESTAI:
|
||||
saveRestAIConfig(request);
|
||||
saveFastChatAIConfig(request);
|
||||
break;
|
||||
case AZUREAI:
|
||||
saveAzureAIConfig(request);
|
||||
@ -330,12 +330,6 @@ public class ConfigController {
|
||||
config.setModel(Objects.nonNull(azureDeployId.getData()) ? azureDeployId.getData().getContent() : "");
|
||||
break;
|
||||
case RESTAI:
|
||||
DataResult<Config> restAiUrl = configService.find(RestAIClient.REST_AI_URL);
|
||||
DataResult<Config> restAiHttpMethod = configService.find(RestAIClient.REST_AI_STREAM_OUT);
|
||||
config.setApiHost(Objects.nonNull(restAiUrl.getData()) ? restAiUrl.getData().getContent() : "");
|
||||
config.setStream(Objects.nonNull(restAiHttpMethod.getData()) ? Boolean.valueOf(
|
||||
restAiHttpMethod.getData().getContent()) : Boolean.TRUE);
|
||||
break;
|
||||
case FASTCHATAI:
|
||||
DataResult<Config> fastChatApiKey = configService.find(FastChatAIClient.FASTCHAT_API_KEY);
|
||||
DataResult<Config> fastChatApiHost = configService.find(FastChatAIClient.FASTCHAT_HOST);
|
||||
|
Reference in New Issue
Block a user