This commit is contained in:
narawat lamaiin
2024-05-19 17:55:15 +07:00
parent afc2b0ddd2
commit fcf8d855b8
5 changed files with 207 additions and 33 deletions

View File

@@ -753,6 +753,7 @@ function conversation(a::T, userinput::Dict) where {T<:agent}
addNewMessage(a, "user", userinput[:text])
if isempty(a.plan[:currenttrajectory])
a.plan[:currenttrajectory] = Dict{Symbol, Any}(
# deepcopy the info to prevent modifying the info unintentionally during MCTS planning
:customerinfo=> deepcopy(a.keywordinfo[:customerinfo]),
@@ -769,7 +770,10 @@ function conversation(a::T, userinput::Dict) where {T<:agent}
:thoughtHistory=> OrderedDict{Symbol, Any}(
#[] :recap=>,
:question=> userinput[:text],
)
),
:virtualCustomerChatHistory=> Vector{Dict{Symbol, Any}}(
[Dict(:name=> "user", :text=> userinput[:text])]
),
)
else
_, a.plan[:currenttrajectory] = makeNewState(a.plan[:currenttrajectory],
@@ -780,7 +784,7 @@ function conversation(a::T, userinput::Dict) where {T<:agent}
while true
bestNextState, besttrajectory = runMCTS(a, a.plan[:currenttrajectory], decisionMaker,
evaluator, reflector, totalsample=2, maxDepth=2, maxiterations=1, explorationweight=1.0)
evaluator, reflector, totalsample=2, maxDepth=2, maxiterations=2, explorationweight=1.0)
a.plan[:activeplan] = bestNextState
latestActionKey, latestActionIndice =