From 0dfaa32149f7e572bb8542374f615971065c083f Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Wed, 29 May 2024 17:08:56 +0800 Subject: [PATCH] feat(agent): add enabled flag to CustomAgentConfig #195 Add an `enabled` flag to CustomAgentConfig and filter enabled agents. --- .../cc/unitmesh/devti/agent/model/CustomAgentConfig.kt | 7 ++++++- .../unitmesh/devti/custom/schema/autodev-custom-agent.json | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/cc/unitmesh/devti/agent/model/CustomAgentConfig.kt b/src/main/kotlin/cc/unitmesh/devti/agent/model/CustomAgentConfig.kt index 47a902310..4f719eb73 100644 --- a/src/main/kotlin/cc/unitmesh/devti/agent/model/CustomAgentConfig.kt +++ b/src/main/kotlin/cc/unitmesh/devti/agent/model/CustomAgentConfig.kt @@ -56,6 +56,7 @@ data class CustomAgentConfig( val interactive: InteractionType = InteractionType.ChatPanel, val auth: CustomAgentAuth? = null, val defaultTimeout: Long = 10, + val enabled: Boolean = true, ) { var state: CustomAgentState = CustomAgentState.START @@ -67,7 +68,11 @@ data class CustomAgentConfig( } catch (e: Exception) { emptyList() } - return configs + + /** + * Only return enabled agents + */ + return configs.filter { it.enabled } } } } diff --git a/src/main/resources/cc/unitmesh/devti/custom/schema/autodev-custom-agent.json b/src/main/resources/cc/unitmesh/devti/custom/schema/autodev-custom-agent.json index b5e9223fa..fe28e4758 100644 --- a/src/main/resources/cc/unitmesh/devti/custom/schema/autodev-custom-agent.json +++ b/src/main/resources/cc/unitmesh/devti/custom/schema/autodev-custom-agent.json @@ -56,6 +56,9 @@ }, "defaultTimeout": { "type": "number" + }, + "enabled": { + "type": "boolean" } }, "required": [