This commit is contained in:
2026-08-16 18:25:26 +07:00
parent 25f8468696
commit 00447e4dde
+7 -1
View File
@@ -224,6 +224,8 @@ function _agentLoop(agent::yiemAgent)
followUpMsg = take!(agent.followUpChannel) followUpMsg = take!(agent.followUpChannel)
put!(agent.inputChannel, followUpMsg) put!(agent.inputChannel, followUpMsg)
end end
processingTask = nothing # reset
result = nothing # reset
else # _processMessage() done and no followUp message. else # _processMessage() done and no followUp message.
agent.agentEventSink("_agentLoop 4 agent._state.messages length $(length(agent._state.messages))") agent.agentEventSink("_agentLoop 4 agent._state.messages length $(length(agent._state.messages))")
result = agent._state.messages[end] result = agent._state.messages[end]
@@ -233,7 +235,6 @@ function _agentLoop(agent::yiemAgent)
agent.agentEventSink(filtered_content[1].text) agent.agentEventSink(filtered_content[1].text)
end end
processingTask = nothing # reset processingTask = nothing # reset
newUserMsg = nothing # reset
result = nothing # reset result = nothing # reset
end end
end end
@@ -263,6 +264,11 @@ function _agentLoop(agent::yiemAgent)
# spawn new _processMessage() if it is not already running. # spawn new _processMessage() if it is not already running.
if processingTask === nothing if processingTask === nothing
agent.agentEventSink("_agentLoop 5 agent._state.messages length $(length(agent._state.messages))") agent.agentEventSink("_agentLoop 5 agent._state.messages length $(length(agent._state.messages))")
# discard all messages in followUpChannel
while isready(agent.followUpChannel)
_ = take!(agent.followUpChannel)
end
# Dispatch message through the processing pipeline # Dispatch message through the processing pipeline
processingTask = @spawn _processMessage( processingTask = @spawn _processMessage(
processMessageInputCh, processMessageInputCh,