mirror of
https://github.com/jie65535/JChatGPT.git
synced 2025-12-15 18:41:36 +08:00
Optimize search results
Add Weather Service Agent Add Crazy Thursday Agent
This commit is contained in:
@@ -1,14 +1,28 @@
|
||||
package top.jie65535.mirai.tools
|
||||
|
||||
import com.aallam.openai.api.chat.Tool
|
||||
import io.ktor.client.*
|
||||
import io.ktor.client.engine.okhttp.*
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
|
||||
abstract class BaseAgent(
|
||||
val tool: Tool
|
||||
) {
|
||||
/**
|
||||
* 是否启用该工具
|
||||
*/
|
||||
open val isEnabled: Boolean = true
|
||||
|
||||
abstract suspend fun execute(args: JsonObject): String
|
||||
/**
|
||||
* 加载时消息 可用于提示用户正在执行
|
||||
*/
|
||||
open val loadingMessage: String = ""
|
||||
|
||||
protected val httpClient by lazy {
|
||||
HttpClient(OkHttp)
|
||||
}
|
||||
|
||||
abstract suspend fun execute(args: JsonObject?): String
|
||||
|
||||
override fun toString(): String {
|
||||
return "${tool.function.name}: ${tool.function.description}"
|
||||
|
||||
Reference in New Issue
Block a user