diff --git a/src/interface.jl b/src/interface.jl index d25ebb5..4237026 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -87,15 +87,14 @@ using ..type, ..util, ..llmfunction """ #TODO update document function conversation(a::T) where {T<:agent} while true - println("---> conversation loop") - println("---> a.receiveUserMsgChannel ready = $(isready(a.receiveUserMsgChannel))") # check for incoming user message if isready(a.receiveUserMsgChannel) incomingMsg = take!(a.receiveUserMsgChannel) incomingPayload = incomingMsg[:payload] + + # "newtopic" command to delete chat history if incomingPayload[:text] == "newtopic" clearhistory(a) - @show incomingMsg msgMeta = deepcopy(a.msgMeta) msgMeta[:sendTopic] = incomingMsg[:msgMeta][:replyTopic] msgMeta[:senderName] = "agent-backend" @@ -116,22 +115,16 @@ function conversation(a::T) where {T<:agent} client, connection = MakeConnection(a.config[:mqttinfo][:broker], a.config[:mqttinfo][:port]) connect(client, connection) - - @show outgoingMsg publish(client, outgoingMsg[:msgMeta][:sendTopic], JSON3.write(outgoingMsg)) disconnect(client) - println("published") - else + + else # a new thinking end end - # # if new message == "newtopic" - # #TODO add "newtopic" command to delete history - - # # else @@ -149,7 +142,7 @@ function conversation(a::T) where {T<:agent} # # actor loop(best plan) # # end - sleep(3) + sleep(1) end