Get the maximum number of tool iterations for AI conversations. Checks user preferences first, then falls back to system configuration. Returns: The maximum tool iterations (default 20).
()
| 567 | |
| 568 | |
| 569 | def get_max_tool_iterations(): |
| 570 | """ |
| 571 | Get the maximum number of tool iterations for AI conversations. |
| 572 | |
| 573 | Checks user preferences first, then falls back to system configuration. |
| 574 | |
| 575 | Returns: |
| 576 | The maximum tool iterations (default 20). |
| 577 | """ |
| 578 | try: |
| 579 | pref_module = Preferences.module('ai') |
| 580 | if pref_module: |
| 581 | pref = pref_module.preference('max_tool_iterations') |
| 582 | if pref: |
| 583 | value = pref.get() |
| 584 | if value is not None: |
| 585 | return int(value) |
| 586 | except Exception: |
| 587 | pass |
| 588 | |
| 589 | # Fall back to system configuration |
| 590 | return getattr(config, 'MAX_LLM_TOOL_ITERATIONS', 20) |
| 591 | |
| 592 | |
| 593 | def get_llm_config(): |
no test coverage detected