mirror of
https://github.com/jie65535/JChatGPT.git
synced 2025-07-28 18:59:20 +08:00
Add HTTP Client timeout config
This commit is contained in:
parent
3c4373e1ff
commit
f822999ab4
@ -663,7 +663,7 @@ object JChatGPT : KotlinPlugin(
|
||||
// 发送组合消息
|
||||
SendCompositeMessage(),
|
||||
|
||||
// 继续循环
|
||||
// 结束循环
|
||||
StopLoopAgent(),
|
||||
|
||||
// 网页搜索
|
||||
|
@ -3,6 +3,7 @@ package top.jie65535.mirai.tools
|
||||
import com.aallam.openai.api.chat.Tool
|
||||
import io.ktor.client.*
|
||||
import io.ktor.client.engine.okhttp.*
|
||||
import io.ktor.client.plugins.HttpTimeout
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
@ -26,7 +27,13 @@ abstract class BaseAgent(
|
||||
* HTTP客户端
|
||||
*/
|
||||
protected val httpClient by lazy {
|
||||
HttpClient(OkHttp)
|
||||
HttpClient(OkHttp) {
|
||||
install(HttpTimeout) {
|
||||
requestTimeoutMillis = 60000
|
||||
connectTimeoutMillis = 5000
|
||||
socketTimeoutMillis = 15000
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user