Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 39cf9a72a1 | |||
| 1c829ad854 | |||
| da98baddb6 | |||
| c5fbaabf42 |
+23
-4
@@ -395,13 +395,19 @@ function conversation(a::sommelier; userinput::Union{Dict{String, Any}, JSON.Obj
|
||||
addNewMessage(a, "assistant", assistant_response; maximumMsg=maximumMsg)
|
||||
|
||||
items_info = []
|
||||
send_item_ind = [] # index of the item being send to frontend
|
||||
if haskey(a.memory["shortmem"], "items_info")
|
||||
|
||||
for (i, item) in enumerate(a.memory["shortmem"]["items_info"])
|
||||
if haskey(item, "wine_name") && occursin(item["wine_name"], thoughtdict["action_input"])
|
||||
push!(items_info, item)
|
||||
deleteat!(a.memory["shortmem"]["items_info"], i)
|
||||
push!(items_info, deepcopy(item))
|
||||
push!(send_item_ind, i)
|
||||
|
||||
end
|
||||
end
|
||||
# remove sent items
|
||||
deleteat!(a.memory["shortmem"]["items_info"], send_item_ind)
|
||||
|
||||
end
|
||||
|
||||
response_to_frontend = Dict{String, Any}(
|
||||
@@ -431,13 +437,19 @@ function conversation(a::sommelier; userinput::Union{Dict{String, Any}, JSON.Obj
|
||||
addNewMessage(a, "assistant", assistant_response; maximumMsg=maximumMsg)
|
||||
|
||||
items_info = []
|
||||
send_item_ind = [] # index of the item being send to frontend
|
||||
if haskey(a.memory["shortmem"], "items_info")
|
||||
|
||||
for (i, item) in enumerate(a.memory["shortmem"]["items_info"])
|
||||
if haskey(item, "wine_name") && occursin(item["wine_name"], thoughtdict["action_input"])
|
||||
push!(items_info, item)
|
||||
deleteat!(a.memory["shortmem"]["items_info"], i)
|
||||
push!(items_info, deepcopy(item))
|
||||
push!(send_item_ind, i)
|
||||
|
||||
end
|
||||
end
|
||||
# remove sent items
|
||||
deleteat!(a.memory["shortmem"]["items_info"], send_item_ind)
|
||||
|
||||
end
|
||||
|
||||
response_to_frontend = Dict{String, Any}(
|
||||
@@ -527,7 +539,14 @@ function think(a::T)::NamedTuple{(:thoughtdict, :result_raw), Tuple{OrderedDict,
|
||||
result_raw = nothing
|
||||
if thoughtdict["action_name"] ∈ ["CHAT_BOX"]
|
||||
|
||||
# sometime CHAT_BOX input is too short.
|
||||
# if thoughtdict["action_input] < 20 character, use generatechat!()
|
||||
if length(thoughtdict["action_input"]) < 20
|
||||
thoughtdict, result_raw = generatechat!(a)
|
||||
else
|
||||
thoughtdict["action_result"] = "Action result is the next user dialogue."
|
||||
result_raw = thoughtdict["action_input"]
|
||||
end
|
||||
|
||||
elseif thoughtdict["action_name"] == "END_CONVER_GUIDELINE"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user