From 4415bdbe914e6d2631f48a2e9ab46acf6eece36d Mon Sep 17 00:00:00 2001 From: narawat lamaiin Date: Wed, 17 Apr 2024 15:28:59 +0700 Subject: [PATCH] update --- src/interface.jl | 28 +++++++++++++++++++++++++--- src/type.jl | 14 ++++++++------ 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/interface.jl b/src/interface.jl index 7f02fa4..8cc240e 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -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 diff --git a/src/type.jl b/src/type.jl index 37ba4a7..9cf2fab 100644 --- a/src/type.jl +++ b/src/type.jl @@ -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