Skip to content

Commit 407f19c

Browse files
committed
Bugfix for missing Codeoutput
1 parent 3ac39a7 commit 407f19c

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/climateclaw/services/streaming/stream_variants.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,12 @@ def cleanup_conversation(
183183
# If there is a pending Code (no output yet) and the next item is not CodeOutput,
184184
# insert an empty CodeOutput before appending the new item.
185185
if pending_code_id is not None and not isinstance(v, SVCodeOutput):
186-
out.append(SVCodeOutput(output="", id=pending_code_id))
186+
out.append(
187+
SVCodeOutput(
188+
output="No response was received from code-interpreter.",
189+
id=pending_code_id,
190+
)
191+
)
187192
pending_code_id = None
188193

189194
if isinstance(v, SVCode):
@@ -201,7 +206,12 @@ def cleanup_conversation(
201206

202207
if pending_code_id is not None:
203208
# close dangling code with an empty output
204-
out.append(SVCodeOutput(output="", id=pending_code_id))
209+
out.append(
210+
SVCodeOutput(
211+
output="No response was received from code-interpreter.",
212+
id=pending_code_id,
213+
)
214+
)
205215

206216
# Ensure ends with StreamEnd (only if requested)
207217
if append_stream_end:

tests/unit_tests/test_stream_variants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_cleanup_inserts_codeoutput_and_end():
2929
assert kinds == ["User", "Code", "CodeOutput", "StreamEnd"]
3030
assert isinstance(out[2], SVCodeOutput)
3131
assert out[2].id == "call_1"
32-
assert out[2].output == ""
32+
assert out[2].output == "No response was received from code-interpreter."
3333

3434

3535
def test_cleanup_no_extra_end_if_existing():

0 commit comments

Comments
 (0)