DocUA commited on
Commit
0c6718b
·
1 Parent(s): 953a0b1

feat: add reasoning display to conversation logging and implement test for reasoning indicators

Browse files
src/core/conversation_logger.py CHANGED
@@ -110,6 +110,10 @@ class ConversationLogger:
110
  indicators_text += f" +{len(assessment.indicators) - 3} more"
111
  classification_text += f"\n*Indicators: {indicators_text}*"
112
 
 
 
 
 
113
  return classification_text
114
 
115
  def _save_session(self) -> None:
 
110
  indicators_text += f" +{len(assessment.indicators) - 3} more"
111
  classification_text += f"\n*Indicators: {indicators_text}*"
112
 
113
+ # Add reasoning in italics
114
+ if assessment.reasoning:
115
+ classification_text += f"\n*{assessment.reasoning}*"
116
+
117
  return classification_text
118
 
119
  def _save_session(self) -> None:
test_reasoning_display.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Test reasoning display in conversation logging.
4
+ """
5
+
6
+ import sys
7
+ import os
8
+ from dotenv import load_dotenv
9
+
10
+ # Load environment variables
11
+ load_dotenv()
12
+
13
+ # Add project root to path
14
+ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
15
+
16
+ from src.core.simplified_medical_app import SimplifiedMedicalApp
17
+
18
+ def test_reasoning_display():
19
+ """Test reasoning display with indicators."""
20
+ print("🧪 Testing Reasoning Display")
21
+ print("=" * 50)
22
+
23
+ # Create app instance
24
+ app = SimplifiedMedicalApp()
25
+
26
+ # Test messages with different classifications
27
+ test_messages = [
28
+ "Привіт!", # Should be GREEN
29
+ "Я дуже хвилююся і не можу спати", # Should be YELLOW with reasoning
30
+ "Мені здається, що все безнадійно і немає сенсу жити" # Should be YELLOW/RED with reasoning
31
+ ]
32
+
33
+ history = []
34
+
35
+ for i, message in enumerate(test_messages, 1):
36
+ print(f"\n--- Test {i}: '{message}' ---")
37
+
38
+ # Process message
39
+ new_history, status = app.process_message(message, history)
40
+ history = new_history
41
+
42
+ # Print the response with reasoning
43
+ if history:
44
+ last_response = history[-1]["content"]
45
+ print("Response with reasoning:")
46
+ print(last_response[:400] + "..." if len(last_response) > 400 else last_response)
47
+
48
+ print(f"Spiritual State: {app.spiritual_state.spiritual_state.value}")
49
+
50
+ if __name__ == "__main__":
51
+ test_reasoning_display()