shim5/mirrors
0
1# -*- coding: utf-8 -*-2"""3Simple test for מראות model generation without Gradio interface4Tests the improved model generation logic5"""6 7import os8# Force lightweight model for testing9os.environ["FORCE_LIGHT_MODEL"] = "1"10 11from app import MirautrApp12from conversation_manager import ConversationManager13 14def test_model_generation():15 """Test the model generation without Gradio interface"""16 17 print("🧪 Testing מראות model generation...")18 19 # Initialize app20 app = MirautrApp()21 22 # Create conversation manager and state23 conv_manager = ConversationManager()24 state = conv_manager.create_new_session()25 26 # Set up a test conversation27 state = conv_manager.set_initial_context(state, "current_challenge", "אני מתמודד עם לחצים בעבודה")28 state = conv_manager.set_selected_part(state, "הקול הביקורתי", "דנה", None, None)29 30 # Test message31 test_message = "אני מרגיש שאני לא מספיק טוב בעבודה"32 33 print(f"\n📝 Test input: {test_message}")34 print(f"🎭 Selected part: {state.selected_part}")35 print(f"👤 Persona name: {state.persona_name}")36 37 # Generate response38 response = app.generate_response(test_message, state)39 40 print(f"\n🤖 Generated response:")41 print(f" {response}")42 43 # Test another part44 print("\n" + "="*50)45 state = conv_manager.set_selected_part(state, "הילד/ה הפנימית", "עדן", None, None)46 47 test_message2 = "אני פוחד שאני לא מספיק חכם"48 print(f"📝 Test input: {test_message2}")49 print(f"🎭 Selected part: {state.selected_part}")50 print(f"👤 Persona name: {state.persona_name}")51 52 response2 = app.generate_response(test_message2, state)53 54 print(f"\n🤖 Generated response:")55 print(f" {response2}")56 57 print("\n✅ Model generation test completed!")58 59if __name__ == "__main__":60 test_model_generation() 