mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-19 16:28:46 +00:00
fix: NPE (fixes #1046)
This commit is contained in:
parent
5aa120bdca
commit
f6ccf201f4
1 changed files with 10 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ package ee.carlrobert.codegpt.conversations;
|
|||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.Service;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import ee.carlrobert.codegpt.completions.ChatCompletionParameters;
|
||||
import ee.carlrobert.codegpt.conversations.message.Message;
|
||||
import ee.carlrobert.codegpt.settings.GeneralSettings;
|
||||
|
|
@ -24,6 +25,8 @@ import org.jetbrains.annotations.NotNull;
|
|||
@Service
|
||||
public final class ConversationService {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(ConversationService.class);
|
||||
|
||||
private final ConversationsState conversationState = ConversationsState.getInstance();
|
||||
|
||||
private ConversationService() {
|
||||
|
|
@ -111,7 +114,13 @@ public final class ConversationService {
|
|||
}
|
||||
|
||||
public Conversation startConversation() {
|
||||
var completionCode = GeneralSettings.getSelectedService().getCompletionCode();
|
||||
var selectedService = GeneralSettings.getSelectedService();
|
||||
if (selectedService == null) {
|
||||
LOG.warn("Selected service is not defined, falling back to ProxyAI.");
|
||||
selectedService = ServiceType.CODEGPT;
|
||||
}
|
||||
|
||||
var completionCode = selectedService.getCompletionCode();
|
||||
var conversation = createConversation(completionCode);
|
||||
conversationState.setCurrentConversation(conversation);
|
||||
addConversation(conversation);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue