Skip to content

Commit 6caa11b

Browse files
author
Your Name
committed
fix: Correct indentation in show_send_output_stream
Co-authored-by: cecli (openai/gemini_cli_local/gemini-2.5-pro)
1 parent 990c27a commit 6caa11b

1 file changed

Lines changed: 97 additions & 97 deletions

File tree

cecli/coders/base_coder.py

Lines changed: 97 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -3212,121 +3212,121 @@ async def show_send_output_stream(self, completion):
32123212
async for chunk in coroutines.interruptible_async_generator(
32133213
completion, self.interrupt_event
32143214
):
3215-
if self.args.debug:
3216-
with open(".cecli/logs/chunks.log", "a") as f:
3217-
print(chunk, file=f)
3215+
if self.args.debug:
3216+
with open(".cecli/logs/chunks.log", "a") as f:
3217+
print(chunk, file=f)
32183218

3219-
# Check if confirmation is in progress and wait if needed
3220-
if not self.io.confirmation_in_progress_event.is_set():
3221-
await self.io.confirmation_in_progress_event.wait()
3219+
# Check if confirmation is in progress and wait if needed
3220+
if not self.io.confirmation_in_progress_event.is_set():
3221+
await self.io.confirmation_in_progress_event.wait()
32223222

3223-
if isinstance(chunk, str):
3224-
self.io.tool_error(chunk)
3225-
continue
3226-
else:
3227-
if len(chunk.choices) == 0:
3223+
if isinstance(chunk, str):
3224+
self.io.tool_error(chunk)
32283225
continue
3226+
else:
3227+
if len(chunk.choices) == 0:
3228+
continue
32293229

3230-
if (
3231-
hasattr(chunk.choices[0], "finish_reason")
3232-
and chunk.choices[0].finish_reason == "length"
3233-
):
3234-
raise FinishReasonLength()
3235-
3236-
try:
3237-
if chunk.choices[0].delta.tool_calls:
3238-
received_content = True
3239-
self.token_profiler.on_token()
3240-
for tool_call_chunk in chunk.choices[0].delta.tool_calls:
3241-
self.tool_reflection = True
3230+
if (
3231+
hasattr(chunk.choices[0], "finish_reason")
3232+
and chunk.choices[0].finish_reason == "length"
3233+
):
3234+
raise FinishReasonLength()
32423235

3243-
if tool_call_chunk.type:
3244-
self.io.update_spinner_suffix(tool_call_chunk.type)
3236+
try:
3237+
if chunk.choices[0].delta.tool_calls:
3238+
received_content = True
3239+
self.token_profiler.on_token()
3240+
for tool_call_chunk in chunk.choices[0].delta.tool_calls:
3241+
self.tool_reflection = True
32453242

3246-
if tool_call_chunk.function:
3247-
if tool_call_chunk.function.name:
3248-
self.io.update_spinner_suffix(tool_call_chunk.function.name)
3243+
if tool_call_chunk.type:
3244+
self.io.update_spinner_suffix(tool_call_chunk.type)
32493245

3250-
if tool_call_chunk.function.arguments:
3251-
self.io.update_spinner_suffix(
3252-
tool_call_chunk.function.arguments
3253-
)
3246+
if tool_call_chunk.function:
3247+
if tool_call_chunk.function.name:
3248+
self.io.update_spinner_suffix(tool_call_chunk.function.name)
32543249

3255-
except (AttributeError, IndexError):
3256-
# Handle cases where the response structure doesn't match expectations
3257-
pass
3250+
if tool_call_chunk.function.arguments:
3251+
self.io.update_spinner_suffix(
3252+
tool_call_chunk.function.arguments
3253+
)
32583254

3259-
try:
3260-
func = chunk.choices[0].delta.function_call
3261-
# dump(func)
3262-
if func:
3263-
for k, v in func.items():
3264-
self.tool_reflection = True
3265-
self.io.update_spinner_suffix(v)
3266-
3267-
received_content = True
3268-
self.token_profiler.on_token()
3269-
except AttributeError:
3270-
pass
3255+
except (AttributeError, IndexError):
3256+
# Handle cases where the response structure doesn't match expectations
3257+
pass
32713258

3272-
text = ""
3273-
3274-
try:
3275-
reasoning_content = chunk.choices[0].delta.reasoning_content
3276-
except AttributeError:
32773259
try:
3278-
reasoning_content = chunk.choices[0].delta.reasoning
3260+
func = chunk.choices[0].delta.function_call
3261+
# dump(func)
3262+
if func:
3263+
for k, v in func.items():
3264+
self.tool_reflection = True
3265+
self.io.update_spinner_suffix(v)
3266+
3267+
received_content = True
3268+
self.token_profiler.on_token()
32793269
except AttributeError:
3280-
reasoning_content = None
3270+
pass
32813271

3282-
if reasoning_content:
3283-
if nested.getter(self.args, "show_thinking"):
3284-
if not self.got_reasoning_content:
3285-
text += f"<{REASONING_TAG}>\n\n"
3286-
text += reasoning_content
3287-
self.got_reasoning_content = True
3288-
received_content = True
3289-
self.token_profiler.on_token()
3290-
self.io.update_spinner_suffix(reasoning_content)
3291-
self.partial_response_reasoning_content += reasoning_content
3272+
text = ""
32923273

3293-
try:
3294-
content = chunk.choices[0].delta.content
3295-
if content:
3296-
if self.got_reasoning_content and not self.ended_reasoning_content:
3297-
text += f"\n\n</{self.reasoning_tag_name}>\n\n"
3298-
self.ended_reasoning_content = True
3299-
3300-
text += content
3301-
received_content = True
3274+
try:
3275+
reasoning_content = chunk.choices[0].delta.reasoning_content
3276+
except AttributeError:
3277+
try:
3278+
reasoning_content = chunk.choices[0].delta.reasoning
3279+
except AttributeError:
3280+
reasoning_content = None
3281+
3282+
if reasoning_content:
3283+
if nested.getter(self.args, "show_thinking"):
3284+
if not self.got_reasoning_content:
3285+
text += f"<{REASONING_TAG}>\n\n"
3286+
text += reasoning_content
3287+
self.got_reasoning_content = True
3288+
received_content = True
33023289
self.token_profiler.on_token()
3303-
self.io.update_spinner_suffix(content)
3304-
except AttributeError:
3305-
pass
3290+
self.io.update_spinner_suffix(reasoning_content)
3291+
self.partial_response_reasoning_content += reasoning_content
33063292

3307-
self.partial_response_content += text
3293+
try:
3294+
content = chunk.choices[0].delta.content
3295+
if content:
3296+
if self.got_reasoning_content and not self.ended_reasoning_content:
3297+
text += f"\n\n</{self.reasoning_tag_name}>\n\n"
3298+
self.ended_reasoning_content = True
3299+
3300+
text += content
3301+
received_content = True
3302+
self.token_profiler.on_token()
3303+
self.io.update_spinner_suffix(content)
3304+
except AttributeError:
3305+
pass
33083306

3309-
chunk_index += 1
3310-
chunk._hidden_params["created_at"] = chunk_index
3311-
self.partial_response_chunks.append(chunk)
3307+
self.partial_response_content += text
33123308

3313-
if self.show_pretty():
3314-
# Use simplified streaming - just call the method with full content
3315-
content_to_show = self.live_incremental_response(False)
3316-
self.stream_wrapper(content_to_show, final=False)
3317-
elif text:
3318-
# Apply reasoning tag formatting for non-pretty output
3319-
if nested.getter(self.args, "show_thinking"):
3320-
text = replace_reasoning_tags(text, self.reasoning_tag_name)
3321-
try:
3322-
self.stream_wrapper(text, final=False)
3323-
except UnicodeEncodeError:
3324-
# Safely encode and decode the text
3325-
safe_text = text.encode(sys.stdout.encoding, errors="backslashreplace").decode(
3326-
sys.stdout.encoding
3327-
)
3328-
self.stream_wrapper(safe_text, final=False)
3329-
yield text
3309+
chunk_index += 1
3310+
chunk._hidden_params["created_at"] = chunk_index
3311+
self.partial_response_chunks.append(chunk)
3312+
3313+
if self.show_pretty():
3314+
# Use simplified streaming - just call the method with full content
3315+
content_to_show = self.live_incremental_response(False)
3316+
self.stream_wrapper(content_to_show, final=False)
3317+
elif text:
3318+
# Apply reasoning tag formatting for non-pretty output
3319+
if nested.getter(self.args, "show_thinking"):
3320+
text = replace_reasoning_tags(text, self.reasoning_tag_name)
3321+
try:
3322+
self.stream_wrapper(text, final=False)
3323+
except UnicodeEncodeError:
3324+
# Safely encode and decode the text
3325+
safe_text = text.encode(sys.stdout.encoding, errors="backslashreplace").decode(
3326+
sys.stdout.encoding
3327+
)
3328+
self.stream_wrapper(safe_text, final=False)
3329+
yield text
33303330
except (asyncio.CancelledError, KeyboardInterrupt):
33313331
raise KeyboardInterrupt
33323332

0 commit comments

Comments
 (0)