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

fix(cloud login): add userName to setup host call when using the cloud login #164

Merged
merged 2 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class SharedChatPane(val project: Project) : JPanel(), Disposable {
is Host.CloudHost -> {
accountManager.apiKey = host.apiKey
InferenceGlobalContext.instance.inferenceUri = "Refact"
accountManager.user = host.userName
}

is Host.Enterprise -> {
Expand Down
5 changes: 3 additions & 2 deletions src/main/kotlin/com/smallcloud/refactai/settings/Host.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ enum class HostKind(val value: String) {
}

sealed class Host {
data class CloudHost(val apiKey: String, val sendCorrectedCodeSnippets: Boolean) : Host()
data class CloudHost(val apiKey: String, val sendCorrectedCodeSnippets: Boolean, val userName: String) : Host()

data class SelfHost(val endpointAddress: String) : Host()

Expand All @@ -31,7 +31,8 @@ class HostDeserializer : JsonDeserializer<Host> {
HostKind.CLOUD.value -> {
val apiKey = host.get("apiKey")?.asString ?: return null
val sendCorrectedCodeSnippets = host.get("sendCorrectedCodeSnippets")?.asBoolean?: false
return Host.CloudHost(apiKey, sendCorrectedCodeSnippets)
val userName = host.get("userName")?.asString?: "";
return Host.CloudHost(apiKey, sendCorrectedCodeSnippets, userName)
}
HostKind.SELF.value -> {
val endpointAddress = host.get("endpointAddress")?.asString ?: return null
Expand Down
Loading