update
This commit is contained in:
@@ -42,7 +42,6 @@ module YiemAgent
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end # module YiemAgent_v1
|
end # module YiemAgent_v1
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ using ..type, ..util, ..llmfunction
|
|||||||
|
|
||||||
Signature\n
|
Signature\n
|
||||||
-----
|
-----
|
||||||
""" #TODO update document
|
""" #[] update document
|
||||||
function conversation(a::T) where {T<:agent}
|
function conversation(a::T) where {T<:agent}
|
||||||
while true
|
while true
|
||||||
# check for incoming user message
|
# check for incoming user message
|
||||||
@@ -112,18 +112,13 @@ function conversation(a::T) where {T<:agent}
|
|||||||
:text => "Okay. What shall we talk about?",
|
:text => "Okay. What shall we talk about?",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
client, connection = MakeConnection(a.config[:mqttinfo][:broker],
|
_ = GeneralUtils.sendMqttMsg(outgoingMsg)
|
||||||
a.config[:mqttinfo][:port])
|
|
||||||
connect(client, connection)
|
|
||||||
publish(client, outgoingMsg[:msgMeta][:sendTopic],
|
|
||||||
JSON3.write(outgoingMsg))
|
|
||||||
disconnect(client)
|
|
||||||
|
|
||||||
else # a new thinking
|
else # a new thinking
|
||||||
# add usermsg to a.chathistory
|
# add usermsg to a.chathistory
|
||||||
addNewMessage(a, "user", usermsg)
|
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"
|
if a.plan[:currenttrajectory][end][:action] == "chatbox"
|
||||||
#usermsg -> observation and continue actor loop as planned
|
#usermsg -> observation and continue actor loop as planned
|
||||||
|
|
||||||
@@ -135,6 +130,7 @@ function conversation(a::T) where {T<:agent}
|
|||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
sleep(1)
|
sleep(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -158,7 +154,7 @@ function conversation(a::T) where {T<:agent}
|
|||||||
# @show isuseplan
|
# @show isuseplan
|
||||||
|
|
||||||
# if isuseplan # use plan before responding
|
# 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
|
# a.memory[:shortterm]["User:"] = usermsg
|
||||||
# end
|
# end
|
||||||
# workstate, response = work(a)
|
# 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 LLM using askbox, use returning msg form askbox as conversation response
|
||||||
# if workstate == "askbox" || workstate == "formulatedUserResponse"
|
# 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
|
# else
|
||||||
# response = chat_mistral_openorca(a)
|
# response = chat_mistral_openorca(a)
|
||||||
# response = split(response, "\n\n")[1]
|
# response = split(response, "\n\n")[1]
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ abstract type agent end
|
|||||||
|
|
||||||
Signature\n
|
Signature\n
|
||||||
-----
|
-----
|
||||||
""" #TODO update docstring
|
""" #[] update docstring
|
||||||
@kwdef mutable struct sommelier <: agent
|
@kwdef mutable struct sommelier <: agent
|
||||||
name::String
|
name::String
|
||||||
id::String
|
id::String
|
||||||
@@ -148,9 +148,9 @@ function sommelier(
|
|||||||
thinkingcount::Integer= 0,
|
thinkingcount::Integer= 0,
|
||||||
)
|
)
|
||||||
|
|
||||||
#NEXTVERSION publish to a.config[:configtopic] to get a config.
|
#[NEXTVERSION] publish to a.config[:configtopic] to get a config.
|
||||||
#NEXTVERSION get a config message in a.mqttMsg_internal
|
#[NEXTVERSION] get a config message in a.mqttMsg_internal
|
||||||
#NEXTVERSION set agent according to config
|
#[NEXTVERSION] set agent according to config
|
||||||
|
|
||||||
newAgent = sommelier(
|
newAgent = sommelier(
|
||||||
receiveUserMsgChannel= receiveUserMsgChannel,
|
receiveUserMsgChannel= receiveUserMsgChannel,
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ function addNewMessage(a::T1, role::String, text::T2;
|
|||||||
error("role is not in agent.availableRole $(@__LINE__)")
|
error("role is not in agent.availableRole $(@__LINE__)")
|
||||||
end
|
end
|
||||||
|
|
||||||
#TODO summarize the oldest 10 message
|
#[] summarize the oldest 10 message
|
||||||
if length(a.chathistory) > maximumMsg
|
if length(a.chathistory) > maximumMsg
|
||||||
summarize(a.chathistory)
|
summarize(a.chathistory)
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user