Remove ineffective photo restoration pipeline

This commit is contained in:
Mikei386
2026-09-08 09:40:43 +02:00
parent f82dc081c9
commit e82e0340e4
9 changed files with 17 additions and 552 deletions
-40
View File
@@ -24,13 +24,10 @@ from router_support import ( # noqa: E402
load_profile_registry,
)
from ai_profile_router import ( # noqa: E402
RESTORATION_CHAT_MODEL,
VIRTUAL_MODELS,
STATE,
_cap_chat_generation,
_context_matches,
_inject_global_system_policy,
_inject_restoration_system_policy,
_normalize_chat_image,
_normalize_chat_images,
_normalize_llamacpp_reasoning,
@@ -83,10 +80,6 @@ class RuntimeStoreTests(unittest.TestCase):
class ProfileRegistryTests(unittest.TestCase):
def test_restoration_model_maps_to_fast_instruction_profile(self) -> None:
self.assertEqual(RESTORATION_CHAT_MODEL, "restauration")
self.assertEqual(VIRTUAL_MODELS[RESTORATION_CHAT_MODEL], "fast")
def test_fallback_contains_uncensored_profile(self) -> None:
registry = load_profile_registry(None)
self.assertEqual(registry["uncensored"]["context"], 80000)
@@ -277,39 +270,6 @@ class GlobalSystemPolicyTests(unittest.TestCase):
self._inject(request, "/v1/images/generations"), request)
class RestorationSystemPolicyTests(unittest.TestCase):
def test_chat_policy_requires_image_tool_and_preservation(self) -> None:
request = {"messages": [{"role": "user", "content": "Mach schöner"}]}
normalized = _inject_restoration_system_policy(
request, "/v1/chat/completions")
policy = normalized["messages"][0]["content"]
self.assertIn("image generation/editing tool", policy)
self.assertIn("Preserve identity", policy)
self.assertIn("Do not attempt restoration with Python", policy)
def test_responses_policy_keeps_client_instructions(self) -> None:
request = {"instructions": "Client policy.", "input": "Mach schöner"}
normalized = _inject_restoration_system_policy(
request, "/v1/responses")
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:
with tempfile.TemporaryDirectory() as temp: