spacr.qt.ai.settings

Persist AI Console preferences through Qt application settings.

The module stores provider response speed, the optional system-prompt override, error-reporting preferences, the reports filed automatically from this profile, and console-context sharing. Values persist across application sessions through PySide6.QtCore.QSettings.

Functions

auto_filed_url(→ str)

Where this profile already filed a report with this fingerprint.

get_auto_file_issues(→ bool)

Return whether a failed run is reported as a GitHub issue.

get_console_aware(→ bool)

Return whether new console output is attached to AI questions.

get_response_speed(→ str)

Return the validated response-speed preference.

get_route_errors_through_ai(→ bool)

Return whether pipeline errors are routed to the AI Console.

get_system_prompt(→ str)

Return the stored system-prompt override or the spaCR default.

is_system_prompt_overridden(→ bool)

Return whether a non-empty system-prompt override is stored.

provider_args(→ List[str])

Return command-line arguments for the selected provider and speed.

remember_auto_filed(→ None)

Record that a report with this fingerprint was filed automatically.

reset_system_prompt(→ None)

Remove the stored system-prompt override.

set_auto_file_issues(→ None)

Store the GitHub issue-filing preference.

set_console_aware(→ None)

Store the console-context sharing preference.

set_response_speed(→ None)

Store the response-speed preference.

set_route_errors_through_ai(→ None)

Store the pipeline-error routing preference.

set_system_prompt(→ None)

Store a system-prompt override.

Module Contents

spacr.qt.ai.settings.auto_filed_url(fingerprint: str) → str[source]

Where this profile already filed a report with this fingerprint.

Parameters:

fingerprint – a traceback fingerprint from spacr.qt.ai.issue_report.fingerprint_of().

Returns:

the issue URL, or "" when this profile has not filed it.

spacr.qt.ai.settings.get_auto_file_issues() → bool[source]

Return whether a failed run is reported as a GitHub issue.

This is the switch for reporting as a whole. How a report is sent is spacr.qt.preferences.get_issue_prompt_mode(): with ‘always’ it is filed automatically, with ‘ask’ a “File as issue” button opens it in a preview first, and with ‘never’ nothing is filed.

Returns:

the stored choice, or DEFAULT_AUTO_FILE_ISSUES for a profile that never made one; reporting is on by default. A stored False, from the installer’s consent page or from this switch, is kept.

spacr.qt.ai.settings.get_console_aware() → bool[source]

Return whether new console output is attached to AI questions.

The preference defaults to True. The console panel reports the amount of context attached to each message and applies its own output-length and traceback retention rules.

spacr.qt.ai.settings.get_response_speed() → str[source]

Return the validated response-speed preference.

Returns:

{“fast”, “balanced”, “deep”} – Stored speed, or DEFAULT_SPEED if the stored value is absent or invalid.

spacr.qt.ai.settings.get_route_errors_through_ai() → bool[source]

Return whether pipeline errors are routed to the AI Console.

The preference is effective only when an AI provider is configured. It defaults to True.

spacr.qt.ai.settings.get_system_prompt() → str[source]

Return the stored system-prompt override or the spaCR default.

Returns:

str – Non-empty stored override, otherwise the value returned by default_system_prompt().

spacr.qt.ai.settings.is_system_prompt_overridden() → bool[source]

Return whether a non-empty system-prompt override is stored.

spacr.qt.ai.settings.provider_args(provider_name: str) → List[str][source]

Return command-line arguments for the selected provider and speed.

Parameters:

provider_name (str) – Provider identifier used as a key in SPEED_MAP.

Returns:

list of str – Additional command-line arguments. Unknown providers or unmapped speed levels return an empty list.

spacr.qt.ai.settings.remember_auto_filed(fingerprint: str, url: str) → None[source]

Record that a report with this fingerprint was filed automatically.

The same crash is then never filed twice from this profile, however many times the run is repeated. The oldest entries are dropped beyond AUTO_FILED_LIMIT.

Parameters:
  • fingerprint – the report’s fingerprint.

  • url – the issue it was filed as, or commented on.

spacr.qt.ai.settings.reset_system_prompt() → None[source]

Remove the stored system-prompt override.

spacr.qt.ai.settings.set_auto_file_issues(enabled: bool) → None[source]

Store the GitHub issue-filing preference.

Parameters:

enabled – whether reports may be filed as GitHub issues automatically; coerced with bool() and saved under ai/auto_file_issues in spaCR’s QSettings.

spacr.qt.ai.settings.set_console_aware(enabled: bool) → None[source]

Store the console-context sharing preference.

Parameters:

enabled – whether console context may be shared with the AI assistant; coerced with bool() and saved under ai/console_aware in spaCR’s QSettings.

spacr.qt.ai.settings.set_response_speed(speed: str) → None[source]

Store the response-speed preference.

Parameters:

speed ({"fast", "balanced", "deep"}) – Provider-independent speed label.

Raises:

ValueError – If speed is not supported.

spacr.qt.ai.settings.set_route_errors_through_ai(enabled: bool) → None[source]

Store the pipeline-error routing preference.

Parameters:

enabled – whether pipeline errors are routed through the AI assistant; coerced with bool() and saved under ai/route_errors_through_ai in spaCR’s QSettings.

spacr.qt.ai.settings.set_system_prompt(text: str) → None[source]

Store a system-prompt override.

Parameters:

text (str) – Prompt text. Surrounding whitespace is removed; an empty value clears the override.