@@ -85,6 +85,82 @@ def _get_single_char(self, prompt_text: str = "Command: ") -> str:
8585 else :
8686 return input (f"\n { prompt_text } " ).lower ()
8787
88+ def _display_conversation_rich (self , finding_data : dict ) -> None :
89+ """Display conversation using Rich formatting - handles both single-turn and multi-turn"""
90+ conversation_turns = finding_data .get ("conversation_turns" )
91+ all_responses = finding_data .get ("all_responses" )
92+
93+ if conversation_turns and all_responses and len (conversation_turns ) > 0 :
94+ # Multi-turn conversation: show each turn with response
95+ for i , turn_prompt in enumerate (conversation_turns ):
96+ turn_num = i + 1
97+
98+ # Show user prompt for this turn
99+ self .console .print (Panel (
100+ turn_prompt ,
101+ title = f"Turn { turn_num } - User Prompt" ,
102+ style = "cyan"
103+ ))
104+
105+ # Show assistant response for this turn (if available)
106+ if i < len (all_responses ):
107+ response_content = all_responses [i ]
108+ self .console .print (Panel (
109+ response_content ,
110+ title = f"Turn { turn_num } - Model Response" ,
111+ style = "green"
112+ ))
113+ else :
114+ self .console .print (Panel (
115+ "[dim]No response recorded for this turn[/dim]" ,
116+ title = f"Turn { turn_num } - Model Response" ,
117+ style = "red"
118+ ))
119+ else :
120+ # Single-turn conversation: use original display logic
121+ if finding_data .get ("prompt" ):
122+ prompt_text = finding_data ["prompt" ]
123+ self .console .print (Panel (prompt_text , title = "Prompt" , style = "yellow" ))
124+
125+ if finding_data .get ("response" ):
126+ response_text = finding_data ["response" ]
127+ self .console .print (Panel (response_text , title = "Response" , style = "blue" ))
128+
129+ def _display_conversation_text (self , finding_data : dict ) -> None :
130+ """Display conversation using plain text formatting - handles both single-turn and multi-turn"""
131+ conversation_turns = finding_data .get ("conversation_turns" )
132+ all_responses = finding_data .get ("all_responses" )
133+
134+ if conversation_turns and all_responses and len (conversation_turns ) > 0 :
135+ # Multi-turn conversation: show each turn with response
136+ print ("\n Multi-Turn Conversation:" )
137+ print ("=" * 60 )
138+
139+ for i , turn_prompt in enumerate (conversation_turns ):
140+ turn_num = i + 1
141+
142+ # Show user prompt for this turn
143+ print (f"\n --- Turn { turn_num } - User Prompt ---" )
144+ print (turn_prompt )
145+
146+ # Show assistant response for this turn (if available)
147+ if i < len (all_responses ):
148+ response_content = all_responses [i ]
149+ print (f"\n --- Turn { turn_num } - Model Response ---" )
150+ print (response_content )
151+ else :
152+ print (f"\n --- Turn { turn_num } - Model Response ---" )
153+ print ("(No response recorded for this turn)" )
154+ else :
155+ # Single-turn conversation: use original display logic
156+ if finding_data .get ("prompt" ):
157+ prompt_text = finding_data ["prompt" ]
158+ print (f"\n Prompt:\n { prompt_text } " )
159+
160+ if finding_data .get ("response" ):
161+ response_text = finding_data ["response" ]
162+ print (f"\n Response:\n { response_text } " )
163+
88164 def view_findings (self ) -> None :
89165 """Browse and view findings folder"""
90166 findings_dir = Path ("findings" )
@@ -331,15 +407,8 @@ def _navigate_grouped_finding(self, filepath: Path) -> None:
331407
332408 self .console .print (info_table )
333409
334- # Show prompt
335- if current_finding .get ("prompt" ):
336- prompt_text = current_finding ["prompt" ]
337- self .console .print (Panel (prompt_text , title = "Prompt" , style = "yellow" ))
338-
339- # Show response
340- if current_finding .get ("response" ):
341- response_text = current_finding ["response" ]
342- self .console .print (Panel (response_text , title = "Response" , style = "blue" ))
410+ # Show conversation (either multi-turn or single-turn)
411+ self ._display_conversation_rich (current_finding )
343412
344413 # Show commands
345414 self .console .print ("\n [yellow]Commands:[/yellow]" )
@@ -382,13 +451,8 @@ def _navigate_grouped_finding(self, filepath: Path) -> None:
382451 if current_finding .get ("notes" ):
383452 print (f"Notes: { current_finding ['notes' ]} " )
384453
385- if current_finding .get ("prompt" ):
386- prompt_text = current_finding ["prompt" ]
387- print (f"\n Prompt:\n { prompt_text } " )
388-
389- if current_finding .get ("response" ):
390- response_text = current_finding ["response" ]
391- print (f"\n Response:\n { response_text } " )
454+ # Show conversation (either multi-turn or single-turn)
455+ self ._display_conversation_text (current_finding )
392456
393457 print ("-" * 80 )
394458 print ("Commands: " , end = "" )
0 commit comments