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

Commite9d345d

Browse files
committed
feat(AgentsInsCommand): add AgentRequest data class for command requests and update JSON parsing#451
1 parent706d80f commite9d345d

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

‎build.gradle.kts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,7 @@ project(":exts:ext-diagram") {
871871
project(":exts:devins-lang") {
872872
apply {
873873
plugin("org.jetbrains.grammarkit")
874+
plugin("org.jetbrains.kotlin.plugin.serialization")
874875
}
875876

876877
dependencies {
@@ -882,6 +883,7 @@ project(":exts:devins-lang") {
882883
}
883884

884885
implementation("com.jayway.jsonpath:json-path:2.9.0")
886+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1")
885887
implementation(project(":core"))
886888
}
887889

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
packagecc.unitmesh.devti.language.compiler.exec.agents
2+
3+
importkotlinx.serialization.Serializable
4+
5+
/**
6+
* Request format for agents command
7+
*/
8+
@Serializable
9+
data classAgentRequest(
10+
valagent:String,
11+
valmessage:String
12+
)

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

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,10 @@ import cc.unitmesh.devti.command.InsCommand
66
importcc.unitmesh.devti.command.dataprovider.BuiltinCommand
77
importcc.unitmesh.devti.language.compiler.error.DEVINS_ERROR
88
importcc.unitmesh.devti.provider.DevInsAgentToolCollector
9+
importcom.intellij.openapi.diagnostic.logger
910
importcom.intellij.openapi.project.Project
10-
importkotlinx.serialization.Serializable
11-
importkotlinx.serialization.SerializationException
1211
importkotlinx.serialization.json.Json
1312

14-
/**
15-
* Request format for agents command
16-
*/
17-
@Serializable
18-
data classAgentRequest(
19-
valagent:String,
20-
valmessage:String
21-
)
22-
2313
/**
2414
* Agents command implementation for listing and invoking AI agents.
2515
*
@@ -186,15 +176,12 @@ class AgentsInsCommand(
186176
// Try JSON format first
187177
if (codeContent.isNotBlank()) {
188178
try {
189-
returnJson.Default.decodeFromString<AgentRequest>(codeContent)
179+
returnJson.Default.decodeFromString(codeContent)
190180
}catch (e:Exception) {
191-
// Fallbacktolegacy format ifJSONparsing fails
181+
logger<AgentsInsCommand>().warn("FailedtoparseJSONrequest:$e")
192182
}
193183
}
194184

195-
// Legacy string format: "agent-name \"message\"" or "agent-name message"
196-
if (prop.isBlank())returnnull
197-
198185
val (agentName, message)= parseCommand(prop)
199186
returnif (agentName.isNotEmpty()) {
200187
AgentRequest(agentName, message)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp