File size: 1,986 Bytes
f095630
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# -*- coding: utf-8 -*-
"""
Simple test for ΧžΧ¨ΧΧ•Χͺ model generation without Gradio interface
Tests the improved model generation logic
"""

import os
# Force lightweight model for testing
os.environ["FORCE_LIGHT_MODEL"] = "1"

from app import MirautrApp
from conversation_manager import ConversationManager

def test_model_generation():
    """Test the model generation without Gradio interface"""
    
    print("πŸ§ͺ Testing ΧžΧ¨ΧΧ•Χͺ model generation...")
    
    # Initialize app
    app = MirautrApp()
    
    # Create conversation manager and state
    conv_manager = ConversationManager()
    state = conv_manager.create_new_session()
    
    # Set up a test conversation
    state = conv_manager.set_initial_context(state, "current_challenge", "אני מΧͺΧžΧ•Χ“Χ“ גם ΧœΧ—Χ¦Χ™Χ Χ‘Χ’Χ‘Χ•Χ“Χ”")
    state = conv_manager.set_selected_part(state, "Χ”Χ§Χ•Χœ Χ”Χ‘Χ™Χ§Χ•Χ¨ΧͺΧ™", "Χ“Χ Χ”", None, None)
    
    # Test message
    test_message = "אני ΧžΧ¨Χ’Χ™Χ© שאני לא ΧžΧ‘Χ€Χ™Χ§ Χ˜Χ•Χ‘ Χ‘Χ’Χ‘Χ•Χ“Χ”"
    
    print(f"\nπŸ“ Test input: {test_message}")
    print(f"🎭 Selected part: {state.selected_part}")
    print(f"πŸ‘€ Persona name: {state.persona_name}")
    
    # Generate response
    response = app.generate_response(test_message, state)
    
    print(f"\nπŸ€– Generated response:")
    print(f"   {response}")
    
    # Test another part
    print("\n" + "="*50)
    state = conv_manager.set_selected_part(state, "Χ”Χ™ΧœΧ“/Χ” Χ”Χ€Χ Χ™ΧžΧ™Χͺ", "Χ’Χ“ΧŸ", None, None)
    
    test_message2 = "אני Χ€Χ•Χ—Χ“ שאני לא ΧžΧ‘Χ€Χ™Χ§ חכם"
    print(f"πŸ“ Test input: {test_message2}")
    print(f"🎭 Selected part: {state.selected_part}")
    print(f"πŸ‘€ Persona name: {state.persona_name}")
    
    response2 = app.generate_response(test_message2, state)
    
    print(f"\nπŸ€– Generated response:")
    print(f"   {response2}")
    
    print("\nβœ… Model generation test completed!")

if __name__ == "__main__":
    test_model_generation()