refactor: optimize matrix channel — optional deps, trim comments, simplify methods

This commit is contained in:
Re-bin
2026-02-26 03:04:01 +00:00
parent 84f2f3c316
commit 988a85d8de
4 changed files with 236 additions and 714 deletions

View File

@@ -312,7 +312,11 @@ nanobot gateway
<details>
<summary><b>Matrix (Element)</b></summary>
Uses Matrix sync via `matrix-nio` (inbound media + outbound file attachments).
Install Matrix dependencies first:
```bash
pip install nanobot-ai[matrix]
```
**1. Create/choose a Matrix account**

View File

@@ -229,8 +229,6 @@ class AgentLoop:
)
else:
clean = self._strip_think(response.content)
if on_progress and clean:
await on_progress(clean)
messages = self.context.add_assistant_message(
messages, clean, reasoning_content=response.reasoning_content,
)

File diff suppressed because it is too large Load Diff

View File

@@ -42,12 +42,14 @@ dependencies = [
"prompt-toolkit>=3.0.50,<4.0.0",
"mcp>=1.26.0,<2.0.0",
"json-repair>=0.57.0,<1.0.0",
]
[project.optional-dependencies]
matrix = [
"matrix-nio[e2e]>=0.25.2",
"mistune>=3.0.0,<4.0.0",
"nh3>=0.2.17,<1.0.0",
]
[project.optional-dependencies]
dev = [
"pytest>=9.0.0,<10.0.0",
"pytest-asyncio>=1.3.0,<2.0.0",