bugfix: use correct config.json when applying
This commit is contained in:
parent
7e2dfb9dd8
commit
7e466e73ac
1 changed files with 31 additions and 5 deletions
|
|
@ -51,6 +51,7 @@ import java.net.NetworkInterface
|
|||
import java.nio.charset.Charset
|
||||
import java.nio.file.Paths
|
||||
import java.util.*
|
||||
import kotlin.coroutines.resume
|
||||
|
||||
|
||||
fun uuid(): String {
|
||||
|
|
@ -106,7 +107,9 @@ class AsyncFileSaveListener(private val ideProtocolClient: IdeProtocolClient) :
|
|||
for (event in events) {
|
||||
if (event.path.endsWith(".continue/config.json") || event.path.endsWith(".continue/config.ts") || event.path.endsWith(
|
||||
".continue\\config.json"
|
||||
) || event.path.endsWith(".continue\\config.ts") || event.path.endsWith(".continuerc.json") || event.path.endsWith(".continuerc.json")
|
||||
) || event.path.endsWith(".continue\\config.ts") || event.path.endsWith(".continuerc.json") || event.path.endsWith(
|
||||
".continuerc.json"
|
||||
)
|
||||
) {
|
||||
return object : AsyncFileListener.ChangeApplier {
|
||||
override fun afterVfsChange() {
|
||||
|
|
@ -662,18 +665,41 @@ class IdeProtocolClient(
|
|||
var llm = getModelByRole(config, "applyCodeBlock")
|
||||
|
||||
if (llm == null) {
|
||||
val models = (config as? Map<*, *>)?.get("models") as? List<Map<*, *>>
|
||||
llm = models?.find { model -> model["title"] == curSelectedModelTitle } as Map<String, Any>
|
||||
llm = try {
|
||||
suspendCancellableCoroutine { continuation ->
|
||||
continuePluginService.coreMessenger?.request(
|
||||
"config/getSerializedProfileInfo",
|
||||
null,
|
||||
null
|
||||
) { response ->
|
||||
val models =
|
||||
((response as Map<String, Any>)["config"] as Map<String, Any>)["models"] as List<Map<String, Any>>
|
||||
val foundModel = models.find { it["title"] == curSelectedModelTitle }
|
||||
|
||||
if (llm == null) {
|
||||
showToast("error", "Model '$curSelectedModelTitle' not found in config.")
|
||||
if (foundModel == null) {
|
||||
launch {
|
||||
showToast(
|
||||
"error",
|
||||
"Model '$curSelectedModelTitle' not found in config."
|
||||
)
|
||||
}
|
||||
continuation.resume(null)
|
||||
} else {
|
||||
continuation.resume(foundModel)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
launch { showToast("error", "Failed to fetch model configuration") }
|
||||
respond(null)
|
||||
return@launch
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
val llmTitle = (llm as? Map<*, *>)?.get("title") as? String ?: ""
|
||||
|
||||
|
||||
val prompt =
|
||||
"The following code was suggested as an edit:\n```\n${text}\n```\nPlease apply it to the previous code."
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue