mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-04-28 19:52:17 +00:00
Encapsulate settings (#180)
This commit is contained in:
parent
de971806d0
commit
ef5fd5919f
36 changed files with 697 additions and 369 deletions
|
|
@ -3,7 +3,7 @@ package ee.carlrobert.codegpt.conversations;
|
|||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
import ee.carlrobert.codegpt.conversations.message.Message;
|
||||
import ee.carlrobert.codegpt.settings.SettingsState;
|
||||
import ee.carlrobert.codegpt.settings.state.ModelSettingsState;
|
||||
import ee.carlrobert.openai.client.ClientCode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -38,13 +38,10 @@ public class ConversationService {
|
|||
}
|
||||
|
||||
public Conversation createConversation(ClientCode clientCode) {
|
||||
var settings = SettingsState.getInstance();
|
||||
var conversation = new Conversation();
|
||||
conversation.setId(UUID.randomUUID());
|
||||
conversation.setClientCode(clientCode);
|
||||
conversation.setModel(settings.isChatCompletionOptionSelected ?
|
||||
settings.getChatCompletionModel() :
|
||||
settings.getTextCompletionModel());
|
||||
conversation.setModel(ModelSettingsState.getInstance().getCompletionModel());
|
||||
conversation.setCreatedOn(LocalDateTime.now());
|
||||
conversation.setUpdatedOn(LocalDateTime.now());
|
||||
return conversation;
|
||||
|
|
@ -111,8 +108,7 @@ public class ConversationService {
|
|||
}
|
||||
|
||||
public Conversation startConversation() {
|
||||
var currentClientCode = SettingsState.getInstance().isChatCompletionOptionSelected ?
|
||||
ClientCode.CHAT_COMPLETION : ClientCode.TEXT_COMPLETION;
|
||||
var currentClientCode = ModelSettingsState.getInstance().isUseChatCompletion() ? ClientCode.CHAT_COMPLETION : ClientCode.TEXT_COMPLETION;
|
||||
var conversation = createConversation(currentClientCode);
|
||||
conversationState.setCurrentConversation(conversation);
|
||||
addConversation(conversation);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue