generated from JetBrains/intellij-platform-plugin-template
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(provider): enable DevIn agent responses #101
This commit enables the execution of DevIn agent responses within the custom agent chat processor by adding a new interface for DevIn response providers and implementing a custom agent response provider for DevIn language. The DevIn custom agent response provider executes the DevIn code and notifies the project of the result.
- Loading branch information
Showing
5 changed files
with
90 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...ins-lang/src/main/kotlin/cc/unitmesh/devti/language/provider/DevInsCustomAgentResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package cc.unitmesh.devti.language.provider | ||
|
||
import cc.unitmesh.devti.AutoDevNotifications | ||
import cc.unitmesh.devti.language.DevInLanguage | ||
import cc.unitmesh.devti.language.compiler.DevInsCompiler | ||
import cc.unitmesh.devti.language.psi.DevInFile | ||
import cc.unitmesh.devti.provider.custom.AgentResponseProvider | ||
import cc.unitmesh.devti.provider.custom.CustomAgentContext | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.psi.PsiFileFactory | ||
import java.util.* | ||
|
||
|
||
class DevInsCustomAgentResponse : AgentResponseProvider { | ||
override val name: String = "DevIn" | ||
|
||
override fun execute(project: Project, context: CustomAgentContext): String { | ||
val filename = "DevIns-${UUID.randomUUID()}.devin" | ||
|
||
val devInFile = PsiFileFactory.getInstance(project) | ||
.createFileFromText(filename, DevInLanguage, context.response) as DevInFile | ||
|
||
val devInsCompiler = DevInsCompiler(project, devInFile) | ||
val result = devInsCompiler.compile() | ||
|
||
AutoDevNotifications.notify(project, result.output) | ||
|
||
return result.output | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters