sync update from LAN repo (source master @ ca48c4ec)
This commit is contained in:
1 parent
8bc8b0e082
commit
ea9dcff9c0
873 files changed
+107866
-14011
No files matched your search
@@ -114,6 +114,46 @@ def _title_config() -> TitleConfig:
|
||||
)
|
||||
|
||||
|
||||
def test_admin_question_title_switch_finalizes_question_before_first_model_call(monkeypatch) -> None:
|
||||
monkeypatch.setattr(
|
||||
title_middleware_module,
|
||||
"get_conversation_context_settings",
|
||||
lambda: SimpleNamespace(use_question_as_title=True),
|
||||
)
|
||||
middleware = TitleMiddleware(
|
||||
title_config=_title_config().model_copy(update={"enabled": False})
|
||||
)
|
||||
state = {
|
||||
"messages": [SimpleNamespace(type="human", content="请帮我分析这份合同")],
|
||||
}
|
||||
|
||||
result = middleware.before_model(state, runtime=SimpleNamespace())
|
||||
|
||||
assert result == {
|
||||
"title": "请帮我分析这份合同",
|
||||
"title_provisional": False,
|
||||
}
|
||||
|
||||
|
||||
def test_admin_question_title_switch_off_keeps_async_title_generation(monkeypatch) -> None:
|
||||
monkeypatch.setattr(
|
||||
title_middleware_module,
|
||||
"get_conversation_context_settings",
|
||||
lambda: SimpleNamespace(use_question_as_title=False),
|
||||
)
|
||||
middleware = TitleMiddleware(title_config=_title_config())
|
||||
state = {
|
||||
"messages": [SimpleNamespace(type="human", content="请帮我分析这份合同")],
|
||||
}
|
||||
|
||||
result = middleware.before_model(state, runtime=SimpleNamespace())
|
||||
|
||||
assert result == {
|
||||
"title": "请帮我分析这份合同",
|
||||
"title_provisional": True,
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_finalize_thread_title_updates_checkpoint_and_display_name(monkeypatch) -> None:
|
||||
async def _fake_generate(self, state):
|
||||
|
||||
Reference in new issue
Block a user