From 066d72553f6cf7147bbb1c4202386a8141f61c16 Mon Sep 17 00:00:00 2001 From: narawat lamaiin Date: Fri, 18 Jul 2025 07:54:50 +0700 Subject: [PATCH] update --- src/communication.jl | 14 +++++++------- src/interface.jl | 3 +++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/communication.jl b/src/communication.jl index 9aade9c..b56609d 100644 --- a/src/communication.jl +++ b/src/communication.jl @@ -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", diff --git a/src/interface.jl b/src/interface.jl index 37ff735..f7c5672 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -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