Skip to content

Commit

Permalink
Send anonymousUseID to agent (#142)
Browse files Browse the repository at this point in the history
See sourcegraph/cody#1871

## Test plan

Tested as part of sourcegraph/cody#1871
  • Loading branch information
Strum355 authored Nov 24, 2023
1 parent 016c031 commit d93e317
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package com.sourcegraph.cody.agent

data class ExtensionConfiguration(
var serverEndpoint: String,
var proxy: String? = null,
var accessToken: String,
var customHeaders: Map<String, String> = emptyMap(),
var autocompleteAdvancedProvider: String? = null,
var autocompleteAdvancedServerEndpoint: String? = null,
var autocompleteAdvancedAccessToken: String? = null,
var debug: Boolean? = false,
var verboseDebug: Boolean? = false,
var codebase: String? = null
val anonymousUserID: String?,
val serverEndpoint: String,
val proxy: String? = null,
val accessToken: String,
val customHeaders: Map<String, String> = emptyMap(),
val autocompleteAdvancedProvider: String? = null,
val autocompleteAdvancedServerEndpoint: String? = null,
val autocompleteAdvancedAccessToken: String? = null,
val debug: Boolean? = false,
val verboseDebug: Boolean? = false,
val codebase: String? = null
)
32 changes: 14 additions & 18 deletions src/main/kotlin/com/sourcegraph/config/ConfigUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,20 @@ object ConfigUtil {
val serverAuth = ServerAuthLoader.loadServerAuth(project)
val codyAgentCodebase = CodyAgent.getClient(project).codebase

val config =
ExtensionConfiguration(
serverEndpoint = serverAuth.instanceUrl,
accessToken = serverAuth.accessToken,
customHeaders = getCustomRequestHeadersAsMap(serverAuth.customRequestHeaders),
proxy = UserLevelConfig.getProxy(),
autocompleteAdvancedServerEndpoint = UserLevelConfig.getAutocompleteServerEndpoint(),
autocompleteAdvancedAccessToken = UserLevelConfig.getAutocompleteAccessToken(),
debug = isCodyDebugEnabled(),
verboseDebug = isCodyVerboseDebugEnabled(),
codebase = codyAgentCodebase?.getUrl(),
)

UserLevelConfig.getAutocompleteProviderType()?.let {
config.autocompleteAdvancedProvider = it.vscodeSettingString()
}

return config
return ExtensionConfiguration(
anonymousUserID = CodyApplicationSettings.instance.anonymousUserId,
serverEndpoint = serverAuth.instanceUrl,
accessToken = serverAuth.accessToken,
customHeaders = getCustomRequestHeadersAsMap(serverAuth.customRequestHeaders),
proxy = UserLevelConfig.getProxy(),
autocompleteAdvancedServerEndpoint = UserLevelConfig.getAutocompleteServerEndpoint(),
autocompleteAdvancedAccessToken = UserLevelConfig.getAutocompleteAccessToken(),
autocompleteAdvancedProvider =
UserLevelConfig.getAutocompleteProviderType()?.vscodeSettingString(),
debug = isCodyDebugEnabled(),
verboseDebug = isCodyVerboseDebugEnabled(),
codebase = codyAgentCodebase?.getUrl(),
)
}

@JvmStatic
Expand Down

0 comments on commit d93e317

Please sign in to comment.