@@ -94,7 +94,7 @@ def reply(context, llm_args: {}, &update_blk)
9494 output_thinking : true ,
9595 cancel_manager : context . cancel_manager ,
9696 **llm_kwargs ,
97- ) do |partial , cancel |
97+ ) do |partial |
9898 tool =
9999 persona . find_tool (
100100 partial ,
@@ -111,23 +111,22 @@ def reply(context, llm_args: {}, &update_blk)
111111 if tool_call . partial?
112112 if tool . class . allow_partial_tool_calls?
113113 tool . partial_invoke
114- update_blk . call ( "" , cancel , tool . custom_raw , :partial_tool )
114+ update_blk . call ( "" , tool . custom_raw , :partial_tool )
115115 end
116116 next
117117 end
118118
119119 tool_found = true
120120 # a bit hacky, but extra newlines do no harm
121121 if needs_newlines
122- update_blk . call ( "\n \n " , cancel )
122+ update_blk . call ( "\n \n " )
123123 needs_newlines = false
124124 end
125125
126126 process_tool (
127127 tool : tool ,
128128 raw_context : raw_context ,
129129 current_llm : current_llm ,
130- cancel : cancel ,
131130 update_blk : update_blk ,
132131 prompt : prompt ,
133132 context : context ,
@@ -146,17 +145,17 @@ def reply(context, llm_args: {}, &update_blk)
146145 else
147146 if partial . is_a? ( DiscourseAi ::Completions ::Thinking )
148147 if partial . partial? && partial . message . present?
149- update_blk . call ( partial . message , cancel , nil , :thinking )
148+ update_blk . call ( partial . message , nil , :thinking )
150149 end
151150 if !partial . partial?
152151 # this will be dealt with later
153152 raw_context << partial
154153 current_thinking << partial
155154 end
156155 elsif partial . is_a? ( DiscourseAi ::Completions ::StructuredOutput )
157- update_blk . call ( partial , cancel , nil , :structured_output )
156+ update_blk . call ( partial , nil , :structured_output )
158157 else
159- update_blk . call ( partial , cancel )
158+ update_blk . call ( partial )
160159 end
161160 end
162161 end
@@ -217,14 +216,13 @@ def process_tool(
217216 tool :,
218217 raw_context :,
219218 current_llm :,
220- cancel :,
221219 update_blk :,
222220 prompt :,
223221 context :,
224222 current_thinking :
225223 )
226224 tool_call_id = tool . tool_call_id
227- invocation_result_json = invoke_tool ( tool , cancel , context , &update_blk ) . to_json
225+ invocation_result_json = invoke_tool ( tool , context , &update_blk ) . to_json
228226
229227 tool_call_message = {
230228 type : :tool_call ,
@@ -258,27 +256,27 @@ def process_tool(
258256 raw_context << [ invocation_result_json , tool_call_id , "tool" , tool . name ]
259257 end
260258
261- def invoke_tool ( tool , cancel , context , &update_blk )
259+ def invoke_tool ( tool , context , &update_blk )
262260 show_placeholder = !context . skip_tool_details && !tool . class . allow_partial_tool_calls?
263261
264- update_blk . call ( "" , cancel , build_placeholder ( tool . summary , "" ) ) if show_placeholder
262+ update_blk . call ( "" , build_placeholder ( tool . summary , "" ) ) if show_placeholder
265263
266264 result =
267265 tool . invoke do |progress , render_raw |
268266 if render_raw
269- update_blk . call ( "" , cancel , tool . custom_raw , :partial_invoke )
267+ update_blk . call ( "" , tool . custom_raw , :partial_invoke )
270268 show_placeholder = false
271269 elsif show_placeholder
272270 placeholder = build_placeholder ( tool . summary , progress )
273- update_blk . call ( "" , cancel , placeholder )
271+ update_blk . call ( "" , placeholder )
274272 end
275273 end
276274
277275 if show_placeholder
278276 tool_details = build_placeholder ( tool . summary , tool . details , custom_raw : tool . custom_raw )
279- update_blk . call ( tool_details , cancel , nil , :tool_details )
277+ update_blk . call ( tool_details , nil , :tool_details )
280278 elsif tool . custom_raw . present?
281- update_blk . call ( tool . custom_raw , cancel , nil , :custom_raw )
279+ update_blk . call ( tool . custom_raw , nil , :custom_raw )
282280 end
283281
284282 result
0 commit comments