This commit is contained in:
narawat lamaiin
2024-05-09 13:04:54 +07:00
parent ed63c19e66
commit 78d69194e9
4 changed files with 47 additions and 33 deletions

View File

@@ -162,11 +162,29 @@ function virtualWineCustomerChatbox(a::T1, input::T2
:text=> prompt,
)
)
@show outgoingMsg
result = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=120)
response = result[:response]
return (response[:text], response[:select], response[:reward], response[:isterminal])
attempt = 0
while attempt <= 5
attempt += 1
try
result = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=120)
response = result[:response]
return (response[:text], response[:select], response[:reward], response[:isterminal])
catch e
io = IOBuffer()
showerror(io, e)
errorMsg = String(take!(io))
st = sprint((io, v) -> show(io, "text/plain", v), stacktrace(catch_backtrace()))
println("")
@warn "Error occurred: $errorMsg\n$st"
println("")
end
if attempt > 5
error("virtualWineCustomerChatbox failed to get a response")
end
end
end