This commit is contained in:
narawat lamaiin
2024-03-20 15:02:19 +07:00
parent 30c19a9469
commit 56a40ee894
2 changed files with 7 additions and 6 deletions

View File

@@ -212,8 +212,8 @@ function agentReflex(
maxUserMsg::Int=10,
)
#NEXTVERSION publish to agentConfigTopic to get a config.
#NEXTVERSION get a config message in a.mqttMsgList
#NEXTVERSION publish to a.config[:configtopic] to get a config.
#NEXTVERSION get a config message in a.mqttMsg_internal
#NEXTVERSION set agent according to config
newAgent = agentReflex(

View File

@@ -98,9 +98,9 @@ function sendReceivePrompt(a::T1, prompt::String, sendtopic::String;
while true #WORKING check how to receive msg , should i use :text or :message?
timepass = (Dates.now() - starttime).value / 1000.0
if isready(a.mqttMsg_internal)
topic, payload = take!(payloadChannel)
if payload[:msgMeta][:repondToMsgId] == outgoing_msg[:msgMeta][:msgId]
result = haskey(payload, :txt) ? payload[:txt] : nothing
topic, payload = take!(a.mqttMsg_internal)
if payload[:msgMeta][:replyToMsgId] == outgoing_msg[:msgMeta][:msgId]
result = haskey(payload, :text) ? payload[:text] : nothing
break
end
elseif timepass <= timeout
@@ -112,8 +112,9 @@ function sendReceivePrompt(a::T1, prompt::String, sendtopic::String;
else
error("undefined condition. timepass=$timepass timeout=$timeout $(@__LINE__)")
end
sleep(0.1) # allow other threads to run
end
sleep(0.1) # allow other threads to run
return result
end