update
This commit is contained in:
@@ -42,7 +42,6 @@ module YiemAgent
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
end # module YiemAgent_v1
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -135,6 +130,7 @@ function conversation(a::T) where {T<:agent}
|
||||
|
||||
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]
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user