Skip to content

Commit

Permalink
feat(chat): add custom agent response provider #101
Browse files Browse the repository at this point in the history
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
phodal committed Mar 17, 2024
1 parent 389cac2 commit e599196
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/222/main/resources/META-INF/autodev-core.xml
Expand Up @@ -159,6 +159,10 @@
<extensionPoint qualifiedName="cc.unitmesh.chatContextProvider"
interface="cc.unitmesh.devti.provider.context.ChatContextProvider"
dynamic="true"/>

<extensionPoint qualifiedName="cc.unitmesh.customAgentResponse"
interface="cc.unitmesh.devti.provider.custom.AgentResponseProvider"
dynamic="true"/>
</extensionPoints>

<applicationListeners>
Expand Down
4 changes: 4 additions & 0 deletions src/233/main/resources/META-INF/autodev-core.xml
Expand Up @@ -159,6 +159,10 @@
<extensionPoint qualifiedName="cc.unitmesh.chatContextProvider"
interface="cc.unitmesh.devti.provider.context.ChatContextProvider"
dynamic="true"/>

<extensionPoint qualifiedName="cc.unitmesh.customAgentResponse"
interface="cc.unitmesh.devti.provider.custom.AgentResponseProvider"
dynamic="true"/>
</extensionPoints>

<applicationListeners>
Expand Down
@@ -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 }
}
}
}

0 comments on commit e599196

Please sign in to comment.