Skip to content

Commit

Permalink
Merge pull request #163 from ymli0215/master
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Apr 27, 2024
2 parents e7a692e + f6bcc2b commit 0d6ee83
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions docs/agent/custom-ai-agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ Demo:
},
{
"name": "DevInInsert",
"description": "Update",
"description": "Update,並指定20秒的timeout時間",
"url": "http://127.0.0.1:8765/api/agent/devins-sample",
"responseAction": "DevIns"
"responseAction": "DevIns",
"defaultTimeout": 20
}
]
```
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class WriteInsCommand(val myProject: Project, val argument: String, val content:
} ?: return "$DEVINS_ERROR: File not found: $argument"

val startLine = range?.startLine ?: 0
val endLine = range?.endLine ?: document.lineCount
val endLine = if (document.lineCount == 0) 1 else range?.endLine ?: document.lineCount

try {
val startOffset = document.getLineStartOffset(startLine)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import cc.unitmesh.devti.llms.custom.updateCustomFormat
import com.intellij.openapi.components.Service
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.project.Project
import java.util.concurrent.TimeUnit
import kotlinx.coroutines.flow.Flow
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
Expand Down Expand Up @@ -50,7 +51,7 @@ class CustomAgentExecutor(val project: Project) : CustomSSEProcessor(project) {
}
}

client = client.newBuilder().build()
client = client.newBuilder().connectTimeout(agent.defaultTimeout, TimeUnit.SECONDS).readTimeout(agent.defaultTimeout, TimeUnit.SECONDS).build()
val call = client.newCall(builder.url(agent.url).post(body).build())

return when (agent.responseAction) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ data class CustomAgentConfig(
val transition: List<CustomFlowTransition> = emptyList(),
val interactive: InteractionType = InteractionType.ChatPanel,
val auth: CustomAgentAuth? = null,
val defaultTimeout: Long = 10,
) {
var state: CustomAgentState = CustomAgentState.START

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
"WebView",
"DevIns"
]
},
"defaultTimeout": {
"type": "number"
}
},
"required": [
Expand Down

0 comments on commit 0d6ee83

Please sign in to comment.