@@ -51,6 +51,7 @@ import java.net.NetworkInterface
51
51
import java.nio.charset.Charset
52
52
import java.nio.file.Paths
53
53
import java.util.*
54
+ import kotlin.coroutines.resume
54
55
55
56
56
57
fun uuid (): String {
@@ -106,7 +107,9 @@ class AsyncFileSaveListener(private val ideProtocolClient: IdeProtocolClient) :
106
107
for (event in events) {
107
108
if (event.path.endsWith(" .continue/config.json" ) || event.path.endsWith(" .continue/config.ts" ) || event.path.endsWith(
108
109
" .continue\\ config.json"
109
- ) || event.path.endsWith(" .continue\\ config.ts" ) || event.path.endsWith(" .continuerc.json" ) || event.path.endsWith(" .continuerc.json" )
110
+ ) || event.path.endsWith(" .continue\\ config.ts" ) || event.path.endsWith(" .continuerc.json" ) || event.path.endsWith(
111
+ " .continuerc.json"
112
+ )
110
113
) {
111
114
return object : AsyncFileListener .ChangeApplier {
112
115
override fun afterVfsChange () {
@@ -662,18 +665,41 @@ class IdeProtocolClient(
662
665
var llm = getModelByRole(config, " applyCodeBlock" )
663
666
664
667
if (llm == null ) {
665
- val models = (config as ? Map <* , * >)?.get(" models" ) as ? List <Map <* , * >>
666
- llm = models?.find { model -> model[" title" ] == curSelectedModelTitle } as Map <String , Any >
667
-
668
- if (llm == null ) {
669
- showToast(" error" , " Model '$curSelectedModelTitle ' not found in config." )
668
+ llm = try {
669
+ suspendCancellableCoroutine { continuation ->
670
+ continuePluginService.coreMessenger?.request(
671
+ " config/getSerializedProfileInfo" ,
672
+ null ,
673
+ null
674
+ ) { response ->
675
+ val models =
676
+ ((response as Map <String , Any >)[" config" ] as Map <String , Any >)[" models" ] as List <Map <String , Any >>
677
+ val foundModel = models.find { it[" title" ] == curSelectedModelTitle }
678
+
679
+ if (foundModel == null ) {
680
+ launch {
681
+ showToast(
682
+ " error" ,
683
+ " Model '$curSelectedModelTitle ' not found in config."
684
+ )
685
+ }
686
+ continuation.resume(null )
687
+ } else {
688
+ continuation.resume(foundModel)
689
+ }
690
+ }
691
+ }
692
+ } catch (e: Exception ) {
693
+ launch { showToast(" error" , " Failed to fetch model configuration" ) }
670
694
respond(null )
671
695
return @launch
672
696
}
673
697
}
674
698
699
+
675
700
val llmTitle = (llm as ? Map <* , * >)?.get(" title" ) as ? String ? : " "
676
701
702
+
677
703
val prompt =
678
704
" The following code was suggested as an edit:\n ```\n ${text} \n ```\n Please apply it to the previous code."
679
705
0 commit comments