mirror of
https://github.com/jie65535/JChatGPT.git
synced 2025-06-02 17:39:10 +08:00
Update to allow Crazy KFC usage only on Thursdays
This commit is contained in:
parent
72d0914a7a
commit
e1af3d8233
@ -5,6 +5,8 @@ import com.aallam.openai.api.core.Parameters
|
|||||||
import io.ktor.client.request.*
|
import io.ktor.client.request.*
|
||||||
import io.ktor.client.statement.*
|
import io.ktor.client.statement.*
|
||||||
import kotlinx.serialization.json.*
|
import kotlinx.serialization.json.*
|
||||||
|
import java.time.DayOfWeek
|
||||||
|
import java.time.OffsetDateTime
|
||||||
|
|
||||||
class CrazyKfc : BaseAgent(
|
class CrazyKfc : BaseAgent(
|
||||||
tool = Tool.function(
|
tool = Tool.function(
|
||||||
@ -13,6 +15,12 @@ class CrazyKfc : BaseAgent(
|
|||||||
parameters = Parameters.Empty
|
parameters = Parameters.Empty
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
/**
|
||||||
|
* 仅周四可用
|
||||||
|
*/
|
||||||
|
override val isEnabled: Boolean
|
||||||
|
get() = OffsetDateTime.now().dayOfWeek == DayOfWeek.THURSDAY
|
||||||
|
|
||||||
override suspend fun execute(args: JsonObject?): String {
|
override suspend fun execute(args: JsonObject?): String {
|
||||||
val response = httpClient.get("https://api.52vmy.cn/api/wl/yan/kfc")
|
val response = httpClient.get("https://api.52vmy.cn/api/wl/yan/kfc")
|
||||||
return response.bodyAsText()
|
return response.bodyAsText()
|
||||||
|
Loading…
Reference in New Issue
Block a user