This commit is contained in:
narawat lamaiin
2024-04-17 15:28:59 +07:00
parent bcd525a7d9
commit 4415bdbe91
2 changed files with 33 additions and 9 deletions

View File

@@ -84,9 +84,31 @@ using ..type, ..util, ..llmfunction
Signature\n Signature\n
----- -----
""" """ #TODO update document
function conversation(a::agentReflex, usermsg::String; attemptlimit::Int=3) function conversation(a::T, usermsg::String) where {T<:agent}
a.attemptlimit = attemptlimit #TODO add "newtopic" command to delete history
# add usermsg to a.chathistory
addNewMessage(a, "user", usermsg)
#WORKING if the last used tool is a chatbox
if a.plan[:currenttrajectory][end][:action] == "chatbox"
# usermsg -> observation and continue actor loop as planned
else # a new thinking
end
workstate = nothing workstate = nothing
response = nothing response = nothing

View File

@@ -95,15 +95,17 @@ abstract type agent end
:retailerinfo => Dict{Symbol, Any}(), :retailerinfo => Dict{Symbol, Any}(),
) )
mctstree::Dict{Symbol, Any} = Dict{Symbol, Any}() mctstree::Dict{Symbol, Any} = Dict{Symbol, Any}()
# 1-history point compose of:
# state_t, statevalue_t, thought_t, action_t, observation_t, state_tplus1, statevalue_tplus1 # 1-historyPoint is in Dict{Symbol, Any} and compose of:
# state, statevalue, thought, action, observation
plan::Dict{Symbol, Any} = Dict{Symbol, Any}( plan::Dict{Symbol, Any} = Dict{Symbol, Any}(
# store 3 to 5 best plan AI frequently used to avoid having to search MCTS all the time # store 3 to 5 best plan AI frequently used to avoid having to search MCTS all the time
:existingplan => Dict{Symbol, Any}(), # each plan is in [historyPoint_1, historyPoint_2, ...] format
:existingplan => Vector(),
:activeplan => Dict{Symbol, Any}(), # current using plan :activeplan => Vector{Dict{Symbol, Any}}(), # current using plan
:currenttrajectory=> Dict{Symbol, Any}(), # store :currenttrajectory=> Vector{Dict{Symbol, Any}}(), # store
) )
# communication # communication
@@ -111,7 +113,7 @@ abstract type agent end
msgMeta::Dict{Symbol, Any} # a template for msgMeta msgMeta::Dict{Symbol, Any} # a template for msgMeta
# put incoming message here. waiting for further processing # put incoming message here. waiting for further processing
userMsg::Channel{Dict} = Channel{Dict}(8) # for user communication incomingUserMsg::Channel{Dict} = Channel{Dict}(8) # for user communication
internalMsg::Channel{Dict} = Channel{Dict}(8) # for internal communication internalMsg::Channel{Dict} = Channel{Dict}(8) # for internal communication
end end