azure test with open ai

This commit is contained in:
moji
2023-07-01 15:52:24 +08:00
parent 5fa92f6333
commit ebcc49ef49
2 changed files with 21 additions and 0 deletions

View File

@ -47,4 +47,19 @@ public class ChatGptConfig {
* 非必填默认值为TRUE
*/
private Boolean restAiStream = Boolean.TRUE;
/**
* Get Azure OpenAI key credential from the Azure Portal
*/
private String azureApiKey;
/**
* Get Azure OpenAI endpoint from the Azure Portal
*/
private String azureEndpoint;
/**
* deploymentId of the deployed model, default gpt-3.5-turbo
*/
private String azureDeploymentId;
}

View File

@ -154,6 +154,9 @@ public class ConfigController {
DataResult<Config> aiSqlSource = configService.find(RestAIClient.AI_SQL_SOURCE);
DataResult<Config> restAiUrl = configService.find(RestAIClient.REST_AI_URL);
DataResult<Config> restAiHttpMethod = configService.find(RestAIClient.REST_AI_STREAM_OUT);
DataResult<Config> azureApiKey = configService.find(AzureOpenAIClient.AZURE_CHATGPT_API_KEY);
DataResult<Config> azureEndpoint = configService.find(AzureOpenAIClient.AZURE_CHATGPT_ENDPOINT);
DataResult<Config> azureDeployId = configService.find(AzureOpenAIClient.AZURE_CHATGPT_DEPLOYMENT_ID);
ChatGptConfig config = new ChatGptConfig();
config.setApiHost(Objects.nonNull(apiHost.getData()) ? apiHost.getData().getContent() : null);
config.setAiSqlSource(Objects.nonNull(aiSqlSource.getData()) ? aiSqlSource.getData().getContent() : null);
@ -163,6 +166,9 @@ public class ConfigController {
config.setApiKey(Objects.nonNull(apiKey.getData()) ? apiKey.getData().getContent() : null);
config.setHttpProxyHost(Objects.nonNull(httpProxyHost.getData()) ? httpProxyHost.getData().getContent() : null);
config.setHttpProxyPort(Objects.nonNull(httpProxyPort.getData()) ? httpProxyPort.getData().getContent() : null);
config.setAzureApiKey(Objects.nonNull(azureApiKey.getData()) ? azureApiKey.getData().getContent() : null);
config.setAzureEndpoint(Objects.nonNull(azureEndpoint.getData()) ? azureEndpoint.getData().getContent() : null);
config.setAzureDeploymentId(Objects.nonNull(azureDeployId.getData()) ? azureDeployId.getData().getContent() : null);
return DataResult.of(config);
}
}