Skip to content

Your lightweight open-source personal agent.

fix(provider): restore reasoning_content and extra_content in message sanitization

Lingao Meng3f8eafc89ac2
diff --git a/nanobot/providers/openai_compat_provider.py b/nanobot/providers/openai_compat_provider.py
index 4fa057b90..132f05a28 100644
--- a/nanobot/providers/openai_compat_provider.py
+++ b/nanobot/providers/openai_compat_provider.py
@@ -21,6 +21,7 @@ if TYPE_CHECKING:
_ALLOWED_MSG_KEYS = frozenset({
"role", "content", "tool_calls", "tool_call_id", "name",
+ "reasoning_content", "extra_content",
})
_ALNUM = string.ascii_letters + string.digits
diff --git a/nanobot/session/manager.py b/nanobot/session/manager.py
index 95e3916b9..27df31405 100644
--- a/nanobot/session/manager.py
+++ b/nanobot/session/manager.py
@@ -54,7 +54,7 @@ class Session:
out: list[dict[str, Any]] = []
for message in sliced:
entry: dict[str, Any] = {"role": message["role"], "content": message.get("content", "")}
- for key in ("tool_calls", "tool_call_id", "name"):
+ for key in ("tool_calls", "tool_call_id", "name", "reasoning_content"):
if key in message:
entry[key] = message[key]
out.append(entry)