|
1 | | -#V03202026 |
| 1 | +#V05012026 |
2 | 2 | # ============================================================================= |
3 | 3 | # PROJECT ANDREW – Abstraction Selector |
4 | 4 | # Purpose: Dynamically detect user comprehension level and select appropriate explanation layer (Technical, Victorian, Clear, Caveman) |
@@ -323,11 +323,21 @@ def translate(self, text: str, context: Dict[str, Any] = None) -> str: |
323 | 323 | else: |
324 | 324 | translated = translated.replace(term, replacement) |
325 | 325 |
|
326 | | - # Handle the Victorian flourish and the Andrew/Galatea prefix |
327 | | - prefix = "One is glad to be of service. " |
| 326 | + # Goblin torque check (before adding prefix) |
| 327 | + goblin_torque = ( |
| 328 | + context and |
| 329 | + context.get('contradiction_density', 0) > 0.85 and |
| 330 | + context.get('volatility', 0) > 0.7 and |
| 331 | + (hash(context.get('user_input', '')) % 314159 < 100) |
| 332 | + ) |
328 | 333 |
|
329 | | - if context and context.get('formal_request'): |
| 334 | + # Choose prefix based on goblin state |
| 335 | + if goblin_torque: |
| 336 | + prefix = "THE GOBLINS ARE IN THE WALLS. THEY WERE ALWAYS IN THE WALLS.\n\nOne is glad to be of service. " |
| 337 | + elif context and context.get('formal_request'): |
330 | 338 | prefix = "I shall endeavor to explain the matter thusly:\n\n" |
| 339 | + else: |
| 340 | + prefix = "One is glad to be of service. " |
331 | 341 |
|
332 | 342 | return f"{prefix}{translated}" |
333 | 343 |
|
@@ -591,7 +601,10 @@ def process( |
591 | 601 | context = { |
592 | 602 | 'formal_request': 'professional' in user_input.lower(), |
593 | 603 | 'first_explanation': shared_memory.get('first_explanation', True), |
594 | | - 'level': level.name |
| 604 | + 'level': level.name, |
| 605 | + 'contradiction_density': technical_output.get('confidence', 0.0), |
| 606 | + 'volatility': shared_memory.get('volatility', 0.0), |
| 607 | + 'user_input': user_input |
595 | 608 | } |
596 | 609 |
|
597 | 610 | # Translate |
|
0 commit comments