From e8c13015ea44493e8c7898d2e8f1956f0ff2d3b4 Mon Sep 17 00:00:00 2001 From: narawat lamaiin Date: Fri, 19 Apr 2024 11:51:56 +0700 Subject: [PATCH] update --- src/YiemAgent.jl | 1 - src/interface.jl | 16 ++++++---------- src/type.jl | 8 ++++---- src/util.jl | 2 +- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/YiemAgent.jl b/src/YiemAgent.jl index c37002c..1ea3d2d 100644 --- a/src/YiemAgent.jl +++ b/src/YiemAgent.jl @@ -42,7 +42,6 @@ module YiemAgent - end # module YiemAgent_v1 diff --git a/src/interface.jl b/src/interface.jl index f7da86c..66edafd 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -84,7 +84,7 @@ using ..type, ..util, ..llmfunction Signature\n ----- -""" #TODO update document +""" #[] update document function conversation(a::T) where {T<:agent} while true # check for incoming user message @@ -112,18 +112,13 @@ function conversation(a::T) where {T<:agent} :text => "Okay. What shall we talk about?", ) ) - client, connection = MakeConnection(a.config[:mqttinfo][:broker], - a.config[:mqttinfo][:port]) - connect(client, connection) - publish(client, outgoingMsg[:msgMeta][:sendTopic], - JSON3.write(outgoingMsg)) - disconnect(client) + _ = GeneralUtils.sendMqttMsg(outgoingMsg) else # a new thinking # add usermsg to a.chathistory addNewMessage(a, "user", usermsg) - #WORKING if the last used tool is a chatbox + #[WORKING] if the last used tool is a chatbox if a.plan[:currenttrajectory][end][:action] == "chatbox" #usermsg -> observation and continue actor loop as planned @@ -134,6 +129,7 @@ function conversation(a::T) where {T<:agent} #actor loop(best plan) end + end end sleep(1) end @@ -158,7 +154,7 @@ function conversation(a::T) where {T<:agent} # @show isuseplan # if isuseplan # use plan before responding - # if haskey(a.memory[:shortterm], "User:") == false #TODO should change role if user want to buy wine. + # if haskey(a.memory[:shortterm], "User:") == false #[] should change role if user want to buy wine. # a.memory[:shortterm]["User:"] = usermsg # end # workstate, response = work(a) @@ -166,7 +162,7 @@ function conversation(a::T) where {T<:agent} # # if LLM using askbox, use returning msg form askbox as conversation response # if workstate == "askbox" || workstate == "formulatedUserResponse" - # #TODO paraphrase msg so that it is human friendlier word. + # #[] paraphrase msg so that it is human friendlier word. # else # response = chat_mistral_openorca(a) # response = split(response, "\n\n")[1] diff --git a/src/type.jl b/src/type.jl index f296d17..d4ac39e 100644 --- a/src/type.jl +++ b/src/type.jl @@ -76,7 +76,7 @@ abstract type agent end Signature\n ----- -""" #TODO update docstring +""" #[] update docstring @kwdef mutable struct sommelier <: agent name::String id::String @@ -148,9 +148,9 @@ function sommelier( thinkingcount::Integer= 0, ) - #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 + #[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 = sommelier( receiveUserMsgChannel= receiveUserMsgChannel, diff --git a/src/util.jl b/src/util.jl index e04c8fe..aff186d 100644 --- a/src/util.jl +++ b/src/util.jl @@ -107,7 +107,7 @@ function addNewMessage(a::T1, role::String, text::T2; error("role is not in agent.availableRole $(@__LINE__)") end - #TODO summarize the oldest 10 message + #[] summarize the oldest 10 message if length(a.chathistory) > maximumMsg summarize(a.chathistory) else