Skip to content

Commit

Permalink
fix: fix merge to summary issue
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Dec 18, 2023
1 parent cb0639b commit c9db1ee
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
11 changes: 8 additions & 3 deletions unit-cli/src/main/kotlin/cc/unitmesh/runner/Picker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,14 @@ class PickerCommand : CliktCommand() {
File(outputDir, result.outputName).writeText(json.encodeToString(result.content))
}

val outputFile = File(outputDir, "summary.json")
val json = Json { prettyPrint = true }
outputFile.writeText(json.encodeToString(finalResult))
val outputFile = File(outputDir, "summary.jsonl")
if (outputFile.exists()) {
outputFile.delete()
}

finalResult.forEach {
outputFile.appendText(it.toString() + "\n")
}

logger.info("Runner finished: ${outputDir.absolutePath}")
logger.info("Total size: ${finalResult.size}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package cc.unitmesh.runner.cli

import cc.unitmesh.pick.prompt.Instruction
import kotlinx.serialization.Serializable

@Serializable
data class ProcessorResult(
val repository: String,
val content: MutableList<Instruction>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ data class PickerOption(
*/
val codeQualityTypes: List<CodeQualityType> = listOf(),
val builderConfig: BuilderConfig = BuilderConfig(),
val maxCompletionInOneFile: Int = 1,
) {
fun pureDataFileName(): String {
return baseDir + File.separator + repoFileName() + ".jsonl"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package cc.unitmesh.pick.prompt

import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json

@Serializable
data class Instruction(
val instruction: String,
val input: String,
val output: String,
)
) {
override fun toString(): String {
return Json.encodeToString(serializer(), this)
}
}

0 comments on commit c9db1ee

Please sign in to comment.