update
This commit is contained in:
@@ -237,7 +237,7 @@ function decisionMaker(a::T; recent::Integer=5)::Dict{Symbol,Any} where {T<:agen
|
||||
chathistory = chatHistoryToText(a.chathistory)
|
||||
|
||||
# check if winename in shortmem occurred in chathistory. if not, skip decision and imediately use PRESENTBOX
|
||||
if haskey(a.memory[:shortmem], :available_wine)
|
||||
if length(a.memory[:shortmem][:available_wine]) != 0
|
||||
# check if wine name mentioned in recentevents, only check first wine name is enough
|
||||
# because agent will recommend every wines it found each time.
|
||||
winenames = []
|
||||
@@ -263,7 +263,7 @@ function decisionMaker(a::T; recent::Integer=5)::Dict{Symbol,Any} where {T<:agen
|
||||
end
|
||||
|
||||
context = # may b add wine name instead of the hold wine data is better
|
||||
if haskey(a.memory[:shortmem], :available_wine)
|
||||
if length(a.memory[:shortmem][:available_wine]) != 0
|
||||
winenames = []
|
||||
for (i, wine) in enumerate(a.memory[:shortmem][:available_wine])
|
||||
name = "$i) $(wine["wine_name"]) "
|
||||
@@ -872,11 +872,11 @@ function think(a::T)::NamedTuple{(:actionname, :result),Tuple{String,String}} wh
|
||||
|
||||
elseif actionname == "CHECKINVENTORY"
|
||||
if rawresponse !== nothing
|
||||
if haskey(a.memory[:shortmem], :available_wine)
|
||||
vd = GeneralUtils.dfToVectorDict(rawresponse)
|
||||
a.memory[:shortmem][:available_wine] = vcat(vd, rawresponse)
|
||||
vd = GeneralUtils.dfToVectorDict(rawresponse)
|
||||
if length(a.memory[:shortmem][:available_wine]) == 0
|
||||
a.memory[:shortmem][:available_wine] = vcat(a.memory[:shortmem][:available_wine], vd)
|
||||
else
|
||||
a.memory[:shortmem][:available_wine] = GeneralUtils.dfToVectorDict(rawresponse)
|
||||
a.memory[:shortmem][:available_wine] = vd
|
||||
end
|
||||
else
|
||||
println("checkinventory return nothing")
|
||||
@@ -965,7 +965,7 @@ function generatechat(a::sommelier, thoughtDict)
|
||||
|
||||
# a.memory[:shortmem][:available_wine] is a vector of dictionary
|
||||
context =
|
||||
if haskey(a.memory[:shortmem], :available_wine)
|
||||
if length(a.memory[:shortmem][:available_wine]) != 0
|
||||
"Wines previously found in your inventory: $(availableWineToText(a.memory[:shortmem][:available_wine]))"
|
||||
else
|
||||
"N/A"
|
||||
|
||||
@@ -180,10 +180,11 @@ function sommelier(
|
||||
|
||||
memory = Dict{Symbol, Any}(
|
||||
:chatbox=> "",
|
||||
:shortmem=> OrderedDict{Symbol, Any}(),
|
||||
:shortmem=> OrderedDict{Symbol, Any}(
|
||||
:available_wine=> [],
|
||||
),
|
||||
:events=> Vector{Dict{Symbol, Any}}(),
|
||||
:state=> Dict{Symbol, Any}(
|
||||
:wine_presented_to_user=> "None",
|
||||
),
|
||||
:recap=> OrderedDict{Symbol, Any}(),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user