File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -281,12 +281,22 @@ def recall(
281281 key = r .get ("source" , r .get ("layer" , "unknown" ))
282282 by_source .setdefault (key , []).append (r )
283283
284+ # Determine display width: use terminal width minus margin, min 80
285+ try :
286+ term_width = shutil .get_terminal_size ().columns
287+ except Exception :
288+ term_width = 120
289+ content_width = max (80 , term_width - 20 ) # leave room for prefix/score
290+
284291 for src , items in by_source .items ():
285292 console .print (f"\n ── { src .capitalize ()} { '─' * 40 } " )
286293 for r in items :
287294 score = r .get ("final_score" , 0 )
288295 entity = r .get ("entity_type" , r .get ("category" , "" ))
289- console .print (f" [{ entity } ] { r .get ('content' , '' )[:80 ]} (score={ score :.2f} )" )
296+ content = r .get ("content" , "" ).replace ("\n " , " " )
297+ if len (content ) > content_width :
298+ content = content [:content_width ] + "…"
299+ console .print (f" [{ entity } ] { content } (score={ score :.2f} )" )
290300
291301
292302_UUID_PATTERN = re .compile (r'^[0-9a-f]{8}(-[0-9a-f]{4}){0,3}' , re .IGNORECASE )
You can’t perform that action at this time.
0 commit comments