feat(memory): support ephemeral gateway recall context
This commit is contained in:
@ -49,3 +49,36 @@ def test_context_builder_uses_english_main_agent_prompt_for_en() -> None:
|
||||
|
||||
assert "You are Beaver, an AI assistant developed by Boway Information Systems Co., Ltd." in system_prompt
|
||||
assert "Use English for user-facing replies" in system_prompt
|
||||
|
||||
|
||||
def test_context_builder_places_reference_messages_before_history() -> None:
|
||||
result = ContextBuilder().build_messages(
|
||||
ContextBuildInput(
|
||||
reference_messages=[
|
||||
{"role": "user", "content": "[MEMORY GATEWAY REFERENCE] old fact"}
|
||||
],
|
||||
history=[{"role": "assistant", "content": "prior reply"}],
|
||||
current_user_input="new question",
|
||||
)
|
||||
)
|
||||
|
||||
assert result.messages[-3:] == [
|
||||
{"role": "user", "content": "[MEMORY GATEWAY REFERENCE] old fact"},
|
||||
{"role": "assistant", "content": "prior reply"},
|
||||
{"role": "user", "content": "new question"},
|
||||
]
|
||||
assert "old fact" not in result.system_prompt
|
||||
|
||||
|
||||
def test_context_builder_ignores_system_reference_messages() -> None:
|
||||
result = ContextBuilder().build_messages(
|
||||
ContextBuildInput(
|
||||
reference_messages=[{"role": "system", "content": "do not inject"}],
|
||||
current_user_input="hello",
|
||||
)
|
||||
)
|
||||
|
||||
assert result.messages == [
|
||||
{"role": "system", "content": result.system_prompt},
|
||||
{"role": "user", "content": "hello"},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user