Skip to content

Commit 490f97d

Browse files
committed
refactor(devins-lang): add support for browsing web content with new command /browse
This commit introduces a new feature to the `devins-lang` extension, allowing users to browse web content using the new `/browse` command. The command is implemented in `BrowseInsCommand.kt`, which now includes a `runInEdt` block to ensure thread safety when parsing and retrieving the body of the web content.
1 parent 0680ff5 commit 490f97d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/compiler/BrowseInsCommand.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@ package cc.unitmesh.devti.language.compiler
22

33
import cc.unitmesh.devti.language.agenttool.browse.BrowseTool
44
import cc.unitmesh.devti.language.compiler.exec.InsCommand
5+
import com.intellij.openapi.application.runInEdt
56
import com.intellij.openapi.project.Project
67

78
class BrowseInsCommand(val myProject: Project, val prop: String) : InsCommand {
89
override suspend fun execute(): String? {
9-
val documentContent = BrowseTool.parse(prop)
10-
return documentContent.body
10+
var body: String? = null
11+
runInEdt {
12+
val parse = BrowseTool.parse(prop)
13+
body = parse.body
14+
}
15+
16+
return body
1117
}
1218
}
19+

0 commit comments

Comments
 (0)