This commit is contained in:
narawat lamaiin
2025-07-18 07:54:50 +07:00
parent b3e8df7287
commit 066d72553f
2 changed files with 10 additions and 7 deletions

View File

@@ -211,7 +211,7 @@ end
what to do with the message.
# Arguments
- `sendTopic`
- `sendTo`
topic the sender sends to e.g. "/agent/wine/api/v1/prompt"
# Keyword Arguments
@@ -264,7 +264,7 @@ end
# Signature
"""
function generate_msgMeta(
sendTopic::T1, # topic the sender sends to e.g. "/agent/wine/api/v1/prompt"
sendTo::T1, # topic the sender sends to e.g. "/agent/wine/api/v1/prompt"
;
msgPurpose::T1= "nothing", # purpose of this message e.g. "updateStatus"
senderName::T1= "nothing", # sender name (String) e.g. "agent-wine-web-frontend"
@@ -292,7 +292,7 @@ function generate_msgMeta(
)::Dict{Symbol, Any} where {T1<:AbstractString}
msgMeta::Dict=Dict(
:sendTopic=> sendTopic, # topic the sender sends to e.g. "/agent/wine/api/v1/prompt"
:sendTo=> sendTo, # topic the sender sends to e.g. "/agent/wine/api/v1/prompt"
:msgPurpose=> msgPurpose, # purpose of this message e.g. "updateStatus"
:senderName=> senderName, # sender name (String) e.g. "agent-wine-web-frontend"
:senderId=> senderId, # sender id e.g. uuid4snakecase()
@@ -370,7 +370,7 @@ function isMqttConnectionAlive(mqttInstance::T)::Bool where {T<:mqttClientInstan
)
)
publish(mqttInstance.client, keepaliveMsg[:msgMeta][:sendTopic],
publish(mqttInstance.client, keepaliveMsg[:msgMeta][:sendTo],
JSON3.write(keepaliveMsg))
timediff = 0
starttime = Dates.now()
@@ -524,7 +524,7 @@ end
function sendMqttMsg(mqttInstance::mqttClientInstance, outgoingMsg::Dict{Symbol, T}
)::NamedTuple where {T<:Any}
try
publish(mqttInstance.client, outgoingMsg[:msgMeta][:sendTopic], JSON3.write(outgoingMsg))
publish(mqttInstance.client, outgoingMsg[:msgMeta][:sendTo], JSON3.write(outgoingMsg))
return (success=true, error=nothing)
catch e
return (success=false, error=e)
@@ -740,7 +740,7 @@ function dataTransferOverMQTT_sender(workDict::Dict, incomingMsg::Dict; data=not
:timestamp => "Tue Oct 01 2024 16:22:12 GMT+0700 (เวลาอินโดจีน)",
:replyToMsgId => nothing,
:acknowledgestatus => nothing,
:sendTopic => "/yiem_branch_1/agent/wine/backend/db/api/v1/testing",
:sendTo => "/yiem_branch_1/agent/wine/backend/db/api/v1/testing",
:mqttBrokerPort => nothing,
:receiverName => "agent_wine_backend",
:replyTopic => "/agent/wine/frontend/514b634a_90b9_4e07_891d_fdf55b1aed25",
@@ -807,7 +807,7 @@ function dataTransferOverMQTT_sender(workDict::Dict, incomingMsg::Dict; data=not
:timestamp => "Tue Oct 01 2024 16:34:06 GMT+0700 (เวลาอินโดจีน)",
:replyToMsgId => nothing,
:acknowledgestatus => nothing,
:sendTopic => "/yiem_branch_1/agent/wine/backend/db/api/v1/testing",
:sendTo => "/yiem_branch_1/agent/wine/backend/db/api/v1/testing",
:mqttBrokerPort => nothing,
:receiverName => "agent_wine_backend",
:replyTopic => "/agent/wine/frontend/514b634a_90b9_4e07_891d_fdf55b1aed25",

View File

@@ -1298,6 +1298,9 @@ function textToDict(text::String, detectKeywords::Vector{String};
error("Keyword $keyword not found in text: $text")
end
end
if typeof(kw[1]) <: AbstractArray
kw = reduce(vcat, kw)
end
od1, od2 =
if symbolkey