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
-----
"""
function conversation(a::agentReflex, usermsg::String; attemptlimit::Int=3)
a.attemptlimit = attemptlimit
""" #TODO update document
function conversation(a::T, usermsg::String) where {T<:agent}
#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
response = nothing

View File

@@ -95,15 +95,17 @@ abstract type agent end
:retailerinfo => 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}(
# 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
:currenttrajectory=> Dict{Symbol, Any}(), # store
:activeplan => Vector{Dict{Symbol, Any}}(), # current using plan
:currenttrajectory=> Vector{Dict{Symbol, Any}}(), # store
)
# communication
@@ -111,7 +113,7 @@ abstract type agent end
msgMeta::Dict{Symbol, Any} # a template for msgMeta
# 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
end