Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit467a3c6

Browse files
committed
feat(AgentsInsCommand): enhance error handling for agent invocation and improve not found message
1 parenta25d09a commit467a3c6

File tree

1 file changed

+18
-19
lines changed
  • exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/compiler/exec/agents

1 file changed

+18
-19
lines changed

‎exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/compiler/exec/agents/AgentsInsCommand.kt‎

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import kotlinx.serialization.json.Json
1414
* Agents command implementation for listing and invoking AI agents.
1515
*
1616
* Example:
17+
* List all agents:
1718
* ```devin
1819
* /agents
1920
* ```
@@ -258,33 +259,31 @@ class AgentsInsCommand(
258259
return"${DEVINS_ERROR} Error invoking A2A agent '$agentName':${e.message}"
259260
}
260261
}
261-
// If agent not found in A2A, continue to try DevIns agents
262262
}
263263

264-
// Try to find and invoke DevIns agent
265264
val devInsAgents=DevInsAgentToolCollector.all(project)
266265
val devInsAgent= devInsAgents.find { it.name== agentName }
267266

268-
if (devInsAgent!=null) {
269-
returntry {
270-
val collectors= com.intellij.openapi.extensions.ExtensionPointName
271-
.create<DevInsAgentToolCollector>("cc.unitmesh.devInsAgentTool")
272-
.extensionList
267+
if (devInsAgent==null) {
268+
// Agent not found
269+
return"${DEVINS_ERROR} Agent '$agentName' not found. Use /agents to list all available agents."
270+
}
273271

274-
for (collectorin collectors) {
275-
val result= collector.execute(project, agentName, input)
276-
if (result!=null) {
277-
return"DevIns Agent '$agentName' response:\n$result"
278-
}
279-
}
272+
returntry {
273+
val collectors= com.intellij.openapi.extensions.ExtensionPointName
274+
.create<DevInsAgentToolCollector>("cc.unitmesh.devInsAgentTool")
275+
.extensionList
280276

281-
"${DEVINS_ERROR} Failed to execute DevIns agent '$agentName'"
282-
}catch (e:Exception) {
283-
"${DEVINS_ERROR} Error executing DevIns agent '$agentName':${e.message}"
277+
for (collectorin collectors) {
278+
val result= collector.execute(project, agentName, input)
279+
if (result!=null) {
280+
return"DevIns Agent '$agentName' response:\n$result"
281+
}
284282
}
285-
}
286283

287-
// Agent not found
288-
return"${DEVINS_ERROR} Agent '$agentName' not found. Use /agents to list all available agents."
284+
"${DEVINS_ERROR} Failed to execute DevIns agent '$agentName'"
285+
}catch (e:Exception) {
286+
"${DEVINS_ERROR} Error executing DevIns agent '$agentName':${e.message}"
287+
}
289288
}
290289
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp