update
This commit is contained in:
+13
-7
@@ -310,13 +310,13 @@ function _agentLoop(agent::yiemAgent)
|
||||
else # _processMessage() done and no followUp message.
|
||||
agent.agentEventSink("_agentLoop 4 agent._state.messages length $(length(agent._state.messages))")
|
||||
result = deepcopy(agent._state.messages[end])
|
||||
|
||||
agent.agentEventSink("_agentLoop 4-1 ")
|
||||
# filter out reasoningContent in-place
|
||||
filter!(c -> !(c isa reasoningContent), result.content)
|
||||
|
||||
agent.agentEventSink("_agentLoop 5 ")
|
||||
# format output
|
||||
respondToUI = _assistantMessageToOpenAI(result)
|
||||
|
||||
agent.agentEventSink("_agentLoop 6 ")
|
||||
put!(agent.outputChannel, respondToUI)
|
||||
if !isempty(result.content) && result.content[1] isa textContent
|
||||
agent.agentEventSink(result.content[1].text)
|
||||
@@ -376,6 +376,13 @@ function _agentLoop(agent::yiemAgent)
|
||||
end
|
||||
end
|
||||
catch e
|
||||
bt = catch_backtrace()
|
||||
errMsg = sprint() do io
|
||||
showerror(io, e, bt)
|
||||
println(io)
|
||||
end
|
||||
agentEventSink(errMsg)
|
||||
|
||||
# On any error, send error response and exit the loop
|
||||
@error "Agent loop failed" error=e
|
||||
end
|
||||
@@ -1085,13 +1092,12 @@ function executePreparedToolCall(
|
||||
llmCall::Union{Any,Nothing}=nothing,
|
||||
)::executedOutcome
|
||||
agentEventSink("executePreparedToolCall 1")
|
||||
agentEventSink("executePreparedToolCall 2")
|
||||
agentEventSink("executePreparedToolCall 3")
|
||||
|
||||
try
|
||||
try #WORKING
|
||||
result = prep.tool.execute(prep.toolCall.id, prep.args, signal, agentEventSink, llmCall)
|
||||
agentEventSink("executePreparedToolCall 2")
|
||||
agentEventSink(result.content[1].text)
|
||||
agentEventSink("executePreparedToolCall 4")
|
||||
agentEventSink("executePreparedToolCall 3")
|
||||
return executedOutcome(result, false)
|
||||
catch e
|
||||
bt = catch_backtrace()
|
||||
|
||||
Reference in New Issue
Block a user