| 68 | |
| 69 | |
| 70 | def llm_prompt_truncation(config: ConfigObj) -> tuple[int, int]: |
| 71 | if 'llm' in config and re.match(r'^\d+$', config['llm'].get('prompt_field_truncate', '')): |
| 72 | field_truncate = int(config['llm'].get('prompt_field_truncate')) |
| 73 | else: |
| 74 | field_truncate = 0 |
| 75 | if 'llm' in config and re.match(r'^\d+$', config['llm'].get('prompt_section_truncate', '')): |
| 76 | section_truncate = int(config['llm'].get('prompt_section_truncate')) |
| 77 | else: |
| 78 | section_truncate = 0 |
| 79 | return field_truncate, section_truncate |
| 80 | |
| 81 | |
| 82 | class AppStateMixin: |