Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not set model explicitly for enterprise #612

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/main/kotlin/com/sourcegraph/cody/chat/AgentChatSession.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.sourcegraph.cody.agent.*
import com.sourcegraph.cody.agent.protocol.*
import com.sourcegraph.cody.chat.ui.ChatPanel
import com.sourcegraph.cody.commands.CommandId
import com.sourcegraph.cody.config.CodyAuthenticationManager
import com.sourcegraph.cody.config.RateLimitStateManager
import com.sourcegraph.cody.history.HistoryService
import com.sourcegraph.cody.history.state.ChatState
Expand Down Expand Up @@ -239,9 +240,15 @@ private constructor(
private fun setCustomModelForAgentSession(model: ChatModel): CompletableFuture<Void> {
return sessionId.get().thenAccept { sessionId ->
CodyAgentService.withAgentRestartIfNeeded(project) { agent ->
agent.server.webviewReceiveMessage(
WebviewReceiveMessageParams(
sessionId, WebviewMessage(command = "chatModel", model = model.agentName)))
val activeAccountType = CodyAuthenticationManager.instance.getActiveAccount(project)
if (activeAccountType != null && !activeAccountType.isDotcomAccount()) {
agent.server.webviewReceiveMessage(
WebviewReceiveMessageParams(sessionId, WebviewMessage(command = "chatModel")))
} else {
agent.server.webviewReceiveMessage(
WebviewReceiveMessageParams(
sessionId, WebviewMessage(command = "chatModel", model = model.agentName)))
}
}
}
}
Expand Down
Loading