Merge restoration policy into system message
This commit is contained in:
@@ -294,6 +294,21 @@ class RestorationSystemPolicyTests(unittest.TestCase):
|
||||
self.assertIn("Photo-restoration mode", normalized["instructions"])
|
||||
self.assertTrue(normalized["instructions"].endswith("Client policy."))
|
||||
|
||||
def test_chat_policy_merges_with_existing_leading_system_message(self) -> None:
|
||||
request = {"messages": [
|
||||
{"role": "system", "content": "Global policy."},
|
||||
{"role": "user", "content": "Mach schöner"},
|
||||
]}
|
||||
normalized = _inject_restoration_system_policy(
|
||||
request, "/v1/chat/completions")
|
||||
system_messages = [
|
||||
message for message in normalized["messages"]
|
||||
if message.get("role") == "system"
|
||||
]
|
||||
self.assertEqual(len(system_messages), 1)
|
||||
self.assertIn("Photo-restoration mode", system_messages[0]["content"])
|
||||
self.assertTrue(system_messages[0]["content"].endswith("Global policy."))
|
||||
|
||||
|
||||
class RetentionTests(unittest.TestCase):
|
||||
def test_oldest_pairs_are_removed(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user