diff --git a/webui/src/main/kotlin/com/github/simiacryptus/aicoder/util/SimpleDiffUtil.kt b/webui/src/main/kotlin/com/github/simiacryptus/aicoder/util/SimpleDiffUtil.kt index b0adb28f..e1243c5c 100644 --- a/webui/src/main/kotlin/com/github/simiacryptus/aicoder/util/SimpleDiffUtil.kt +++ b/webui/src/main/kotlin/com/github/simiacryptus/aicoder/util/SimpleDiffUtil.kt @@ -214,7 +214,9 @@ fun SocketManagerBase.addApplyDiffLinks2( val diffVal = diffBlock.groupValues[2] val prevCode = code[filename] ?: "" val newCode = SimpleDiffUtil.patch(prevCode, diffVal) - val echoDiff = DiffMatchPatch.patch_toText(DiffMatchPatch.Companion.patch_make(prevCode, newCode)) + val echoDiff = try { + DiffMatchPatch.patch_toText(DiffMatchPatch.patch_make(prevCode, newCode)) + } catch (e: Throwable) { renderMarkdown("```\n${e.stackTraceToString()}\n```") } val hrefLink = hrefLink("Apply Diff") { try { val newCode = code.map { (file, prevCode) ->