Skip to content

Commit 3f85061

Browse files
committed
add workspace id to inline api
1 parent 0e1e603 commit 3f85061

File tree

1 file changed

+12
-2
lines changed
  • plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/service

1 file changed

+12
-2
lines changed

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/service/CodeWhispererService.kt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import com.intellij.psi.PsiDocumentManager
2121
import com.intellij.psi.PsiFile
2222
import com.intellij.util.concurrency.annotations.RequiresEdt
2323
import com.intellij.util.messages.Topic
24+
import io.ktor.client.request.request
2425
import kotlinx.coroutines.CoroutineScope
2526
import kotlinx.coroutines.Deferred
2627
import kotlinx.coroutines.Job
@@ -231,7 +232,8 @@ class CodeWhispererService(private val cs: CoroutineScope) : Disposable {
231232
buildCodeWhispererRequest(
232233
requestContext.fileContextInfo,
233234
requestContext.awaitSupplementalContext(),
234-
requestContext.customizationArn
235+
requestContext.customizationArn,
236+
requestContext.workspaceId
235237
)
236238
)
237239

@@ -666,7 +668,12 @@ class CodeWhispererService(private val cs: CoroutineScope) : Disposable {
666668
// 5. customization
667669
val customizationArn = CodeWhispererModelConfigurator.getInstance().activeCustomization(project)?.arn
668670

669-
return RequestContext(project, editor, triggerTypeInfo, caretPosition, fileContext, supplementalContext, connection, latencyContext, customizationArn)
671+
// TODO: use workspaceID from LSP
672+
// hardcoded for now!
673+
val workspaceId = null
674+
675+
return RequestContext(project, editor, triggerTypeInfo, caretPosition,
676+
fileContext, supplementalContext, connection, latencyContext, customizationArn, workspaceId)
670677
}
671678

672679
fun validateResponse(response: GenerateCompletionsResponse): GenerateCompletionsResponse {
@@ -800,6 +807,7 @@ class CodeWhispererService(private val cs: CoroutineScope) : Disposable {
800807
fileContextInfo: FileContextInfo,
801808
supplementalContext: SupplementalContextInfo?,
802809
customizationArn: String?,
810+
workspaceId: String?
803811
): GenerateCompletionsRequest {
804812
val programmingLanguage = ProgrammingLanguage.builder()
805813
.languageName(fileContextInfo.programmingLanguage.toCodeWhispererRuntimeLanguage().languageId)
@@ -828,6 +836,7 @@ class CodeWhispererService(private val cs: CoroutineScope) : Disposable {
828836
.referenceTrackerConfiguration { it.recommendationsWithReferences(includeCodeWithReference) }
829837
.customizationArn(customizationArn)
830838
.optOutPreference(getTelemetryOptOutPreference())
839+
.workspaceId(workspaceId)
831840
.build()
832841
}
833842
}
@@ -843,6 +852,7 @@ data class RequestContext(
843852
val connection: ToolkitConnection?,
844853
val latencyContext: LatencyContext,
845854
val customizationArn: String?,
855+
val workspaceId: String?
846856
) {
847857
// TODO: should make the entire getRequestContext() suspend function instead of making supplemental context only
848858
var supplementalContext: SupplementalContextInfo? = null

0 commit comments

Comments
 (0)