Skip to content

Commit 22ffb89

Browse files
authored
Merge pull request #167 from open-webui/main
0.9.14
2 parents b44310e + 7fb978d commit 22ffb89

5 files changed

Lines changed: 188 additions & 342 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.9.14] - 2026-07-23
9+
10+
### Changed
11+
12+
- 🔧 **Chat handling got a cleanup.** Computer now carries conversations forward more cleanly after some internal refactoring.
13+
814
## [0.9.13] - 2026-07-23
915

1016
### Fixed

cptr/utils/ai.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,10 @@ def _to_anthropic_messages(messages: list[dict]) -> list[dict]:
259259
# assistant with tool calls → Anthropic tool_use blocks
260260
blocks: list[dict] = []
261261
if content:
262-
blocks.append({"type": "text", "text": content})
262+
if isinstance(content, list):
263+
blocks.extend(block for block in content if block.get("type") == "text")
264+
else:
265+
blocks.append({"type": "text", "text": content})
263266
for tc in m["tool_calls"]:
264267
blocks.append(
265268
{
@@ -422,7 +425,7 @@ def _to_openai_messages(
422425
423426
Strict default OpenAI-compatible requests do not receive provider-specific
424427
reasoning fields. llama.cpp compatibility replays text reasoning as
425-
reasoning_content. Other non-standard fields (fc_id in tool_calls) are
428+
reasoning_content. Other non-standard fields (fc_id in tool_calls) are
426429
stripped.
427430
"""
428431
result = []
@@ -461,6 +464,7 @@ def _to_openai_messages(
461464
else:
462465
out = dict(m)
463466
out.pop("reasoning_items", None)
467+
out["content"] = content
464468
if out.get("tool_calls"):
465469
out["tool_calls"] = [
466470
{k: v for k, v in tc.items() if k != "fc_id"} for tc in out["tool_calls"]
@@ -726,6 +730,24 @@ def _to_responses_input(
726730
m.get("reasoning_items"), provider_type=provider_type
727731
):
728732
items.append(ri)
733+
content = m.get("content", "")
734+
if isinstance(content, list):
735+
text = "".join(
736+
block.get("text") or ""
737+
for block in content
738+
if isinstance(block, dict)
739+
and block.get("type") in ("text", "output_text", "input_text")
740+
)
741+
else:
742+
text = content
743+
if isinstance(text, str) and text.strip():
744+
items.append(
745+
{
746+
"type": "message",
747+
"role": "assistant",
748+
"content": [{"type": "output_text", "text": text}],
749+
}
750+
)
729751
for tc in m["tool_calls"]:
730752
call_id = tc.get("id", "")
731753
# Skip function_calls that have no matching tool result

0 commit comments

Comments
 (0)