This commit is contained in:
narawat lamaiin
2024-08-21 18:09:12 +07:00
parent 4dabb03d93
commit 97793ada3e

View File

@@ -1186,12 +1186,12 @@ function generatechat(memory::Dict, chathistory::Vector, text2textInstructLLM::F
- Focus on the latest conversation. - Focus on the latest conversation.
You should then respond to the user with: You should then respond to the user with:
1) Chat: Given the situation, what would you say to convey your thoughts to the user? 1) Mentioning_wine: Are you going to mentioning specific wine name to the user? Can be "Yes" or "No"
2) Mentioning_wine: Are you mentioning specific wine name to the user? Can be "Yes" or "No" 2) Chat: Given the situation, what would you say to convey your thoughts to the user?
You should only respond in format as described below: You should only respond in format as described below:
Chat: ...
Mentioning_wine: ... Mentioning_wine: ...
Chat: ...
Let's begin! Let's begin!
""" """
@@ -1231,7 +1231,7 @@ function generatechat(memory::Dict, chathistory::Vector, text2textInstructLLM::F
try try
response = text2textInstructLLM(prompt) response = text2textInstructLLM(prompt)
responsedict = GeneralUtils.textToDict(response,["Chat", "Mentioning_wine"], responsedict = GeneralUtils.textToDict(response,["Mentioning_wine", "Chat"],
rightmarker=":", symbolkey=true) rightmarker=":", symbolkey=true)
for i [:Chat] for i [:Chat]
@@ -1677,9 +1677,11 @@ function generateSituationReport(a, text2textInstructLLM::Function; skiprecent::
if length(a.memory[:events]) <= skiprecent if length(a.memory[:events]) <= skiprecent
return Dict(:recap=> "None") return Dict(:recap=> "None")
end end
events = deepcopy(a.memory[:events][1:end-skiprecent])
timeline = "" timeline = ""
for (i, event) in enumerate(a.memory[:events][1:end-skiprecent]) for (i, event) in enumerate(events)
if event[:outcome] === nothing if event[:outcome] === nothing
timeline *= "$i) $(event[:subject])> $(event[:action_or_dialogue])\n" timeline *= "$i) $(event[:subject])> $(event[:action_or_dialogue])\n"
else else
@@ -1693,7 +1695,7 @@ function generateSituationReport(a, text2textInstructLLM::Function; skiprecent::
for attempt in 1:10 for attempt in 1:10
usermsg = usermsg =
""" """
Total events: $(length(a.memory[:events])) Total events: $(length(events))
Events timeline: $timeline Events timeline: $timeline
$errornote $errornote
""" """
@@ -1720,9 +1722,9 @@ function generateSituationReport(a, text2textInstructLLM::Function; skiprecent::
eventcount = count("Event_", response) eventcount = count("Event_", response)
if eventcount < (length(a.memory[:events]) - skiprecent) if eventcount < (length(events))
errornote = "Note: You need to summarize every events." errornote = "Note: You need to summarize all 3 events."
println("the summary covers $eventcount/$(length(a.memory[:events])) ", @__FILE__, " ", @__LINE__) println("the summary covers $eventcount/$(length(events)) ", @__FILE__, " ", @__LINE__)
else else
return Dict(:recap=> response) return Dict(:recap=> response)
end end