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(chat): add custom agent response provider #101
Add a custom agent response provider to handle custom agent responses. This allows for customizable behavior based on the specific agent used.
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 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
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
26 changes: 26 additions & 0 deletions
26
src/main/kotlin/cc/unitmesh/devti/provider/custom/AgentResponseProvider.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,26 @@ | ||
package cc.unitmesh.devti.provider.custom | ||
|
||
import cc.unitmesh.devti.agent.model.CustomAgentConfig | ||
import com.intellij.openapi.extensions.ExtensionPointName | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.util.concurrency.annotations.RequiresBackgroundThread | ||
|
||
data class CustomAgentContext( | ||
val config: CustomAgentConfig, | ||
val response: String | ||
) | ||
|
||
internal interface AgentResponseProvider { | ||
val name: String | ||
|
||
@RequiresBackgroundThread | ||
fun execute(project: Project, context: CustomAgentContext): String | ||
|
||
companion object { | ||
val EP_NAME = ExtensionPointName<AgentResponseProvider>("cc.unitmesh.customAgentResponse") | ||
|
||
fun instance(name: String): List<AgentResponseProvider> { | ||
return EP_NAME.extensionList.filter { it.name == name } | ||
} | ||
} | ||
} |