Merge pull request #3474 from pipecat-ai/fix/optional-member-access-function-call-cancel
Fix Pylance reportOptionalMemberAccess in _handle_function_call_cancel
This commit is contained in:
@@ -1024,10 +1024,8 @@ class LLMAssistantContextAggregator(LLMContextResponseAggregator):
|
|||||||
logger.debug(
|
logger.debug(
|
||||||
f"{self} FunctionCallCancelFrame: [{frame.function_name}:{frame.tool_call_id}]"
|
f"{self} FunctionCallCancelFrame: [{frame.function_name}:{frame.tool_call_id}]"
|
||||||
)
|
)
|
||||||
if frame.tool_call_id not in self._function_calls_in_progress:
|
function_call = self._function_calls_in_progress.get(frame.tool_call_id)
|
||||||
return
|
if function_call and function_call.cancel_on_interruption:
|
||||||
|
|
||||||
if self._function_calls_in_progress[frame.tool_call_id].cancel_on_interruption:
|
|
||||||
await self.handle_function_call_cancel(frame)
|
await self.handle_function_call_cancel(frame)
|
||||||
del self._function_calls_in_progress[frame.tool_call_id]
|
del self._function_calls_in_progress[frame.tool_call_id]
|
||||||
|
|
||||||
|
|||||||
@@ -890,10 +890,8 @@ class LLMAssistantAggregator(LLMContextAggregator):
|
|||||||
logger.debug(
|
logger.debug(
|
||||||
f"{self} FunctionCallCancelFrame: [{frame.function_name}:{frame.tool_call_id}]"
|
f"{self} FunctionCallCancelFrame: [{frame.function_name}:{frame.tool_call_id}]"
|
||||||
)
|
)
|
||||||
if frame.tool_call_id not in self._function_calls_in_progress:
|
function_call = self._function_calls_in_progress.get(frame.tool_call_id)
|
||||||
return
|
if function_call and function_call.cancel_on_interruption:
|
||||||
|
|
||||||
if self._function_calls_in_progress[frame.tool_call_id].cancel_on_interruption:
|
|
||||||
# Update context with the function call cancellation
|
# Update context with the function call cancellation
|
||||||
self._update_function_call_result(frame.function_name, frame.tool_call_id, "CANCELLED")
|
self._update_function_call_result(frame.function_name, frame.tool_call_id, "CANCELLED")
|
||||||
del self._function_calls_in_progress[frame.tool_call_id]
|
del self._function_calls_in_progress[frame.tool_call_id]
|
||||||
|
|||||||
Reference in New Issue
Block a user