Skip to content

Commit e6b8487

Browse files
committed
feature: 修改会话总结实现
- 保留历史对话,将总结后的数据设置为模型不可见 - 总结支持后端线程执行,不影响前端线程的对话执行 - 支持多用户的skill 操作
1 parent abf32ad commit e6b8487

56 files changed

Lines changed: 647 additions & 104 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

examples/fastapi_server/_app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ async def chat(req: ChatRequest) -> ChatResponse: # pylint: disable=unused-vari
137137
))
138138

139139
except Exception as exc:
140-
logger.exception("Error during agent run (session=%s)", session_id)
140+
logger.error("Error during agent run (session=%s): %s", session_id, exc)
141141
raise HTTPException(status_code=500, detail=str(exc)) from exc
142142

143143
return ChatResponse(
@@ -214,7 +214,7 @@ async def _event_generator() -> AsyncGenerator[str, None]:
214214
yield _sse(StreamChunk(type="done", session_id=session_id))
215215

216216
except Exception as exc:
217-
logger.exception("Error during streaming run (session=%s)", session_id)
217+
logger.error("Error during streaming run (session=%s): %s", session_id, exc)
218218
yield _sse(StreamChunk(type="error", data=str(exc), session_id=session_id))
219219

220220
return StreamingResponse(

pyproject.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,12 @@ all = [
142142
"wecom-aibot-sdk-python>=0.1.5",
143143
]
144144

145-
[project.scripts]
146-
trpc_agent_cmd = "trpc_agent_sdk._cli:main"
147-
148-
# 使用 include 保证三个包都包含进来
149145
[tool.hatch.build.targets.wheel]
150146
packages = ["trpc_agent_sdk"]
151147

148+
[project.scripts]
149+
trpc_agent_cmd = "trpc_agent_sdk._cli:main"
150+
152151
[project.urls]
153152
Homepage = "https://github.com/trpc-group/trpc-agent-python.git"
154153
Documentation = "https://github.com/trpc-group/trpc-agent-python.git"

tests/events/test_event.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ def test_default_fields(self):
4242
assert event.tag is None
4343
assert event.filter_key is None
4444
assert event.object is None
45+
assert event.model_flags > 0
46+
assert event.is_model_visible() is True
47+
assert event.is_summary_event() is False
4548

4649
def test_auto_generated_id_is_valid_uuid(self):
4750
event = Event(invocation_id="inv-1", author="a")
@@ -308,6 +311,33 @@ def test_error_message_without_code_not_error(self):
308311
assert event.is_error() is False
309312

310313

314+
# ---------------------------------------------------------------------------
315+
# Event model visibility / summary flags
316+
# ---------------------------------------------------------------------------
317+
318+
319+
class TestEventModelFlags:
320+
def test_set_model_visible_false(self):
321+
event = Event(invocation_id="inv-1", author="a")
322+
event.set_model_visible(False)
323+
assert event.is_model_visible() is False
324+
325+
def test_visible_field_also_controls_model_visibility(self):
326+
event = Event(invocation_id="inv-1", author="a", visible=False)
327+
assert event.is_model_visible() is False
328+
329+
def test_set_summary_event_true(self):
330+
event = Event(invocation_id="inv-1", author="a")
331+
event.set_summary_event(True)
332+
assert event.is_summary_event() is True
333+
334+
def test_clear_summary_event(self):
335+
event = Event(invocation_id="inv-1", author="a")
336+
event.set_summary_event(True)
337+
event.set_summary_event(False)
338+
assert event.is_summary_event() is False
339+
340+
311341
# ---------------------------------------------------------------------------
312342
# Event.has_trailing_code_execution_result
313343
# ---------------------------------------------------------------------------
File renamed without changes.
File renamed without changes.

tests/server/openclaw/channels/test__command_handler.py renamed to tests/server/openclaw/channels/test_command_handler.py

File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/server/openclaw/config/test__config.py renamed to tests/server/openclaw/config/test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def test_env_var_path(self, mock_set_config, tmp_path, monkeypatch):
243243
@patch("trpc_agent_sdk.server.openclaw.config._config.DEFAULT_CONFIG_PATH")
244244
def test_default_path_fallback(self, mock_default_path, mock_default_dir, mock_set_config, tmp_path, monkeypatch):
245245
monkeypatch.delenv(TRPC_CLAW_CONFIG, raising=False)
246-
default_dir = tmp_path / ".trpc_agent_claw"
246+
default_dir = tmp_path / ".trpc_claw"
247247
default_dir.mkdir()
248248
mock_default_dir.exists.return_value = True
249249
cfg_file = default_dir / "config.yaml"
File renamed without changes.

0 commit comments

Comments
 (0)