update
This commit is contained in:
@@ -1149,17 +1149,21 @@ function generatechat(a::sommelier)
|
|||||||
pprintln(Dict(responsedict))
|
pprintln(Dict(responsedict))
|
||||||
|
|
||||||
# check if LLM recommend wine before checking inventory
|
# check if LLM recommend wine before checking inventory
|
||||||
isMemEmpty = isempty(a.memory[:shortmem])
|
ind = 1:length(a.memory[:events])
|
||||||
if occursin("Yes", responsedict[:mentioning_winery]) && isMemEmpty
|
timeline = ""
|
||||||
errornote = "Note: You can't recommend wines yet. You must check your inventory before recommending wine to the user."
|
for (i, event) in enumerate(a.memory[:events][ind])
|
||||||
error("You must check your inventory before recommending wine")
|
if event[:outcome] === nothing
|
||||||
elseif occursin("(check", responsedict[:chat]) || occursin("*check", responsedict[:chat]) ||
|
timeline *= "$i) $(event[:subject])> $(event[:action_or_dialogue])\n"
|
||||||
occursin("inventory)", responsedict[:chat]) || occursin("inventory*", responsedict[:chat])
|
|
||||||
|
|
||||||
errornote = "Note: You can't recommend wines yet. You must check your inventory before recommending wine to the user."
|
|
||||||
error("You must check your inventory before recommending wine")
|
|
||||||
else
|
else
|
||||||
errornote = ""
|
timeline *= "$i) $(event[:subject])> $(event[:action_or_dialogue]) $(event[:outcome])\n"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
mentioned_winery = strip.(split(responsedict[:mentioning_winery], ","))
|
||||||
|
for i in mentioned_winery
|
||||||
|
if i != "None" && i != "" && !occursin(i, timeline)
|
||||||
|
errornote = "Note: Before recommending a wine, ensure it's in your inventory. Check your stock first."
|
||||||
|
error("Before recommending a wine, ensure it's in your inventory. Check your stock first.")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
a.memory[:CHATBOX] = "" # delete content because it no longer used.
|
a.memory[:CHATBOX] = "" # delete content because it no longer used.
|
||||||
|
|||||||
Reference in New Issue
Block a user