fix: custom OpenAI service settings sync (#472)

This commit is contained in:
Simon Svensson 2024-04-17 11:46:21 +02:00 committed by GitHub
parent 7d075f6905
commit b2d9442eba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View file

@ -51,6 +51,9 @@ public class GeneralSettings implements PersistentStateComponent<GeneralSettings
if ("azure.chat.completion".equals(clientCode)) {
state.setSelectedService(ServiceType.AZURE);
}
if ("custom.openai.chat.completion".equals(clientCode)) {
state.setSelectedService(ServiceType.CUSTOM_OPENAI);
}
if ("llama.chat.completion".equals(clientCode)) {
state.setSelectedService(ServiceType.LLAMA_CPP);
var llamaSettings = LlamaSettings.getCurrentState();

View file

@ -25,6 +25,17 @@ class GeneralSettingsTest : BasePlatformTestCase() {
assertThat(openAISettings.model).isEqualTo("gpt-4")
}
fun testCustomOpenAISettingsSync() {
val conversation = Conversation()
conversation.clientCode = "custom.openai.chat.completion"
val settings = GeneralSettings.getInstance()
settings.state.selectedService = ServiceType.OPENAI
settings.sync(conversation)
assertThat(settings.state.selectedService).isEqualTo(ServiceType.CUSTOM_OPENAI)
}
fun testAzureSettingsSync() {
val settings = GeneralSettings.getInstance()
val conversation = Conversation()