This commit is contained in:
narawat lamaiin
2024-05-09 13:08:31 +07:00
parent 78d69194e9
commit a4e7dee5bf
2 changed files with 98 additions and 94 deletions

View File

@@ -185,8 +185,9 @@ function decisionMaker(a::T1, state::T2)::Dict{Symbol, Any} where {T1<:agent, T2
) )
attempt = 0 attempt = 0
while attempt <= 5 while true
attempt += 1 attempt += 1
if attempt <= 5
try try
response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg) response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg)
_responseJsonStr = response[:response][:text] _responseJsonStr = response[:response][:text]
@@ -218,7 +219,7 @@ function decisionMaker(a::T1, state::T2)::Dict{Symbol, Any} where {T1<:agent, T2
println("") println("")
end end
if attempt > 5 else
error("DecisionMaker failed to generate a thought") error("DecisionMaker failed to generate a thought")
end end
end end
@@ -315,8 +316,9 @@ function progressValueEstimator(a::T1, state::T2)::Tuple{String, Integer} where
) )
attempt = 0 attempt = 0
while attempt <= 5 while true
attempt += 1 attempt += 1
if attempt <= 5
try try
response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg) response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg)
_responseJsonStr = response[:response][:text] _responseJsonStr = response[:response][:text]
@@ -343,7 +345,7 @@ function progressValueEstimator(a::T1, state::T2)::Tuple{String, Integer} where
println("") println("")
end end
if attempt > 5 else
error("progressValueEstimator failed to generate an evaluation") error("progressValueEstimator failed to generate an evaluation")
end end
end end
@@ -451,8 +453,9 @@ function reflector(a::T1, state::T2)::String where {T1<:agent, T2<:AbstractDict}
) )
attempt = 0 attempt = 0
while attempt <= 5 while true
attempt += 1 attempt += 1
if attempt <= 5
try try
response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg) response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg)
_responseJsonStr = response[:response][:text] _responseJsonStr = response[:response][:text]
@@ -478,7 +481,7 @@ function reflector(a::T1, state::T2)::String where {T1<:agent, T2<:AbstractDict}
println("") println("")
end end
if attempt > 5 else
error("reflector failed to generate a thought") error("reflector failed to generate a thought")
end end
end end

View File

@@ -164,8 +164,9 @@ function virtualWineCustomerChatbox(a::T1, input::T2
) )
attempt = 0 attempt = 0
while attempt <= 5 while true
attempt += 1 attempt += 1
if attempt <= 5
try try
result = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=120) result = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=120)
response = result[:response] response = result[:response]
@@ -181,7 +182,7 @@ function virtualWineCustomerChatbox(a::T1, input::T2
println("") println("")
end end
if attempt > 5 else
error("virtualWineCustomerChatbox failed to get a response") error("virtualWineCustomerChatbox failed to get a response")
end end
end end