Skip to content

Commit 9e323fe

Browse files
committed
addressing comments
1 parent 5231789 commit 9e323fe

File tree

2 files changed

+11
-36
lines changed

2 files changed

+11
-36
lines changed

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import java.io.ByteArrayInputStream
5858
import java.io.ByteArrayOutputStream
5959
import java.io.File
6060
import java.io.IOException
61+
import java.nio.file.Path
6162
import java.nio.file.Paths
6263
import java.time.Duration
6364
import java.time.Instant
@@ -263,25 +264,23 @@ class CodeWhispererUTGChatManager(val project: Project, private val cs: Coroutin
263264
if (shortAnswer.stopIteration == "true") {
264265
throw CodeTestException("TestGenFailedError: ${shortAnswer.planSummary}", "TestGenFailedError", shortAnswer.planSummary)
265266
}
267+
val fileName = shortAnswer.sourceFilePath?.let { Path.of(it).fileName.toString() } ?: path.fileName.toString()
266268
codeTestChatHelper.updateAnswer(
267269
CodeTestChatMessageContent(
268-
message = generateSummaryMessage(path.fileName.toString()) + shortAnswer.planSummary,
270+
message = generateSummaryMessage(fileName) + shortAnswer.planSummary,
269271
type = ChatMessageType.Answer
270272
),
271273
messageIdOverride = codeTestResponseContext.testSummaryMessageId
272274
)
273275
}
274-
if (session.iteration == 1) {
275-
codeTestChatHelper.updateUI(
276-
promptInputDisabledState = true,
277-
promptInputProgress = testGenProgressField(0),
278-
)
279-
} else {
280-
codeTestChatHelper.updateUI(
281-
promptInputDisabledState = true,
282-
promptInputProgress = buildAndExecuteProgrogressField,
283-
)
284-
}
276+
codeTestChatHelper.updateUI(
277+
promptInputDisabledState = true,
278+
promptInputProgress = if (session.iteration == 1) {
279+
testGenProgressField(0)
280+
} else {
281+
buildAndExecuteProgrogressField
282+
}
283+
)
285284
}
286285

287286
// polling every 2 seconds to reduce # of API calls

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/utils/UTGChatUtil.kt

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -201,27 +201,3 @@ private fun cleanText(input: String): String {
201201
return cleaned.toString()
202202
}
203203

204-
suspend fun combineBuildAndExecuteLogFiles(
205-
buildLogFile: VirtualFile?,
206-
testLogFile: VirtualFile?,
207-
): VirtualFile? {
208-
if (buildLogFile == null || testLogFile == null) return null
209-
val buildLogFileContent = String(buildLogFile.contentsToByteArray(), StandardCharsets.UTF_8)
210-
val testLogFileContent = String(testLogFile.contentsToByteArray(), StandardCharsets.UTF_8)
211-
212-
val combinedContent = "Build Output:\n$buildLogFileContent\nTest Execution Output:\n$testLogFileContent"
213-
214-
// Create a new virtual file and write combined content
215-
val newFile = VirtualFileManager.getInstance().findFileByNioPath(
216-
withContext(currentCoroutineContext()) {
217-
Files.createTempFile(null, null)
218-
}
219-
)
220-
withContext(EDT) {
221-
ApplicationManager.getApplication().runWriteAction {
222-
newFile?.setBinaryContent(combinedContent.toByteArray(StandardCharsets.UTF_8))
223-
}
224-
}
225-
226-
return newFile
227-
}

0 commit comments

Comments
 (0)