| 137 | input_content = args.input_file |
| 138 | |
| 139 | def interactive_callback(candidates: List[Dict]) -> int: |
| 140 | if not args.interactive: |
| 141 | # Non-interactive mode, skip all candidates |
| 142 | return -1 |
| 143 | |
| 144 | print("Found multiple possible matches:") |
| 145 | for i, candidate in enumerate(candidates): |
| 146 | print(f"{i + 1}. {candidate.get('title', 'Unknown')}") |
| 147 | print(f" Authors: {', '.join(candidate.get('authors', []))}") |
| 148 | print(f" Journal: {candidate.get('journal', 'Unknown')}") |
| 149 | print(f" Year: {candidate.get('year', 'Unknown')}") |
| 150 | print(f" Match Score: {candidate.get('match_score', 0)}") |
| 151 | print() |
| 152 | |
| 153 | while True: |
| 154 | try: |
| 155 | choice = input("Please select (1-{}, 0=skip): ".format(len(candidates))) |
| 156 | choice_num = int(choice) |
| 157 | if choice_num == 0: |
| 158 | return -1 # Skip |
| 159 | elif 1 <= choice_num <= len(candidates): |
| 160 | return choice_num - 1 |
| 161 | else: |
| 162 | print("Invalid selection, please try again") |
| 163 | except (ValueError, KeyboardInterrupt): |
| 164 | print("Operation cancelled") |
| 165 | return -1 |
| 166 | |
| 167 | if args.quiet: |
| 168 | import logging |