This commit is contained in:
narawat lamaiin
2024-04-24 12:30:16 +07:00
parent 96689b0913
commit b2c24e97ae
3 changed files with 28 additions and 75 deletions

View File

@@ -109,8 +109,8 @@ function conversation(a::T, userinput::Dict) where {T<:agent}
else #[WORKING] new thinking
initialState = Dict(
:info=> Dict(), # keyword info
:thoughtHistory=> Dict( # contain question, thought_1, action_1, observation_1, thought_2, ...
:info=> Dict{Symbol, Any}(), # keyword info
:thoughtHistory=> Dict{Symbol, Any}( # contain question, thought_1, action_1, observation_1, thought_2, ...
:question=> userinput[:text],
)
)
@@ -125,71 +125,6 @@ end
# function conversation(a::T) where {T<:agent}
# """
# [] update document
# [x] MCTS() for planning
# """
# while true
# # check for incoming user message
# if isready(a.receiveUserMsgChannel)
# incomingMsg = take!(a.receiveUserMsgChannel)
# incomingPayload = incomingMsg[:payload]
# @show incomingMsg
# # "newtopic" command to delete chat history
# if incomingPayload[:text] == "newtopic"
# clearhistory(a)
# msgMeta = deepcopy(a.msgMeta)
# msgMeta[:sendTopic] = incomingMsg[:msgMeta][:replyTopic]
# msgMeta[:senderName] = "agent-backend"
# msgMeta[:senderId] = a.id
# msgMeta[:receiverName] = "agent-frontend"
# msgMeta[:receiverId] = incomingMsg[:msgMeta][:senderId]
# msgMeta[:replyTopic] = a.config[:receivemsg][:prompt]
# msgMeta[:msgId] = string(uuid4())
# msgMeta[:replyToMsgId] = incomingMsg[:msgMeta][:msgId]
# outgoingMsg = Dict(
# :msgMeta=> msgMeta,
# :payload=> Dict(
# :name=> a.name, # will be shown in frontend as agent name
# :text => "Okay. What shall we talk about?",
# )
# )
# # _ = GeneralUtils.sendMqttMsg(outgoingMsg)
# else
# @show a = 55555
# # add usermsg to a.chathistory
# addNewMessage(a, "user", usermsg)
# #[] if the last used tool is a chatbox
# if a.plan[:currenttrajectory][end][:action] == "chatbox"
# #usermsg -> observation and continue actor loop as planned
# else #[WORKING] new thinking
# initialState = 0
# bestplan = runMCTS(initialState, decisionMaker, stateValueEstimator, reflector,
# 3, 10, 1000, 1.0)
# # actor loop(best plan)
# end
# end
# end
# sleep(1)
# end
# end