mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 03:30:48 +08:00
完善 MCP/会话上下文治理并补齐搜索与诊断能力。
补充历史压缩与会话诊断链路,强化 tool pairing 与空响应兜底观测;完善 Admin MCP 导入/绑定与相关前端展示;新增 web_search_fast/web_fetch_clean 及多项测试与文档更新,并同步技能安装与角色绑定策略改进。 Made-with: Cursor
This commit is contained in:
parent
df91434936
commit
ae44cbcad5
43 changed files with 3549 additions and 57 deletions
|
|
@ -24,7 +24,7 @@ class _Msg:
|
|||
self.turn_uuid = turn_uuid
|
||||
|
||||
|
||||
def test_build_llm_messages_unpaired_tool_rows_downgrade_to_assistant_text() -> None:
|
||||
def test_build_llm_messages_unpaired_tool_rows_are_dropped() -> None:
|
||||
model = RuleBasedChatModel()
|
||||
rows = [
|
||||
_Msg("user", "hi"),
|
||||
|
|
@ -51,7 +51,36 @@ def test_build_llm_messages_unpaired_tool_rows_downgrade_to_assistant_text() ->
|
|||
msgs = build_llm_messages(store_messages=rows, system_prompt="s", model=model, lang="zh")
|
||||
assert not any(m.get("role") == "tool" for m in msgs), msgs
|
||||
assistant_texts = [str(m.get("content") or "") for m in msgs if m.get("role") == "assistant"]
|
||||
assert any("[tool_use_result" in t for t in assistant_texts)
|
||||
assert not any("[tool_use_result" in t for t in assistant_texts)
|
||||
|
||||
|
||||
def test_build_llm_messages_tool_row_not_immediately_after_assistant_tool_calls_is_dropped() -> None:
|
||||
model = RuleBasedChatModel()
|
||||
rows = [
|
||||
_Msg("user", "hi"),
|
||||
_Msg(
|
||||
"assistant",
|
||||
"",
|
||||
tool_calls=json.dumps(
|
||||
[
|
||||
{
|
||||
"id": "call_1",
|
||||
"name": "t",
|
||||
"arguments": {},
|
||||
}
|
||||
],
|
||||
ensure_ascii=False,
|
||||
),
|
||||
),
|
||||
_Msg("assistant", "interleaving"),
|
||||
_Msg(
|
||||
"tool",
|
||||
'{"ok":true}',
|
||||
tool_calls=json.dumps({"tool_call_id": "call_1", "name": "t"}, ensure_ascii=False),
|
||||
),
|
||||
]
|
||||
msgs = build_llm_messages(store_messages=rows, system_prompt="s", model=model, lang="zh")
|
||||
assert not any(m.get("role") == "tool" for m in msgs), msgs
|
||||
|
||||
|
||||
def test_build_llm_messages_user_relay_pointer_as_text_meta() -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue