@@ -502,15 +502,15 @@ def download_results_zip(zip_name: str) -> StreamingResponse:
502502# -----------------------------
503503
504504@router .get ("/results/{dataset}/conversations" )
505- def get_conversations (dataset : str , offset : int = 0 , limit : int = 1000 ) -> Dict [str , Any ]:
505+ def get_conversations (dataset : str , offset : int = 0 , limit : int | None = None ) -> Dict [str , Any ]:
506506 """Get conversations with pagination.
507507
508508 Returns only the requested slice, not entire file.
509509
510510 Args:
511511 dataset: Dataset name (folder under final_results/)
512512 offset: Number of conversations to skip
513- limit: Maximum number of conversations to return
513+ limit: Maximum number of conversations to return (None = all)
514514
515515 Returns:
516516 Dict with data, offset, limit, and has_more flag
@@ -527,19 +527,19 @@ def get_conversations(dataset: str, offset: int = 0, limit: int = 1000) -> Dict[
527527
528528 conversations = []
529529 import json
530- with open (conversations_file ) as f :
530+ with open (conversations_file , encoding = 'utf-8' , errors = 'replace' ) as f :
531531 for i , line in enumerate (f ):
532532 if i < offset :
533533 continue
534- if i >= offset + limit :
534+ if limit is not None and i >= offset + limit :
535535 break
536536 conversations .append (json .loads (line ))
537537
538538 return {
539539 "data" : conversations ,
540540 "offset" : offset ,
541541 "limit" : limit ,
542- "has_more" : len (conversations ) == limit
542+ "has_more" : limit is not None and len (conversations ) == limit
543543 }
544544
545545
0 commit comments