This commit is contained in:
narawat lamaiin
2024-04-17 07:49:02 +07:00
parent 673c64b223
commit bcd525a7d9
3 changed files with 271 additions and 91 deletions

View File

@@ -1,6 +1,6 @@
module type
export agent, sommelier, clearhistory
export agent, sommelier
using Dates, UUIDs, DataStructures, JSON3
using GeneralUtils
@@ -165,56 +165,6 @@ function sommelier(
return newAgent
end
""" Clear agent chat history.
Arguments\n
-----
a::agent
an agent
Return\n
-----
nothing
Example\n
-----
```jldoctest
julia> using YiemAgent, MQTTClient, GeneralUtils
julia> client, connection = MakeConnection("test.mosquitto.org", 1883)
julia> connect(client, connection)
julia> msgMeta = GeneralUtils.generate_msgMeta("testtopic")
julia> agentConfig = Dict(
:receiveprompt=>Dict(
:mqtttopic=> "testtopic/receive",
),
:receiveinternal=>Dict(
:mqtttopic=> "testtopic/internal",
),
:text2text=>Dict(
:mqtttopic=> "testtopic/text2text",
),
)
julia> a = YiemAgent.sommelier(
client,
msgMeta,
agentConfig,
)
julia> YiemAgent.addNewMessage(a, "user", "hello")
julia> YiemAgent.clearhistory(a)
```
Signature\n
-----
"""
function clearhistory(a::T) where {T<:agent}
empty!(a.chathistory)
empty!(a.mctstree)
empty!(a.plan[:activeplan])
empty!(a.plan[:currenttrajectory])
end