04/22 user dashboard view, no credentials popup automatically

This commit is contained in:
2026-04-22 18:38:57 -04:00
parent b7e2a164c7
commit eab4207e1f
10 changed files with 479 additions and 62 deletions
+7 -4
View File
@@ -156,11 +156,12 @@ class AiSummaryView(ttk.Frame):
try:
import configparser
from config import CONFIG_FILE
from utils.config_crypto import decrypt_value
cfg = configparser.ConfigParser()
cfg.read(CONFIG_FILE, encoding="utf-8")
if cfg.has_section(_CFG_SECTION):
self._api_key_var.set(
cfg.get(_CFG_SECTION, _CFG_KEY_KEY, fallback=""))
raw_key = cfg.get(_CFG_SECTION, _CFG_KEY_KEY, fallback="")
self._api_key_var.set(decrypt_value(raw_key))
model = cfg.get(_CFG_SECTION, _CFG_KEY_MODEL,
fallback=GROQ_MODELS[0])
if model in GROQ_MODELS:
@@ -169,15 +170,17 @@ class AiSummaryView(ttk.Frame):
logger.warning(f"Could not load Groq config: {e}")
def _save_config(self):
"""Persist API key / model to config.ini [groq] section."""
"""Persist API key / model to config.ini [groq] section (key encrypted)."""
try:
import configparser
from config import CONFIG_FILE
from utils.config_crypto import encrypt_value
cfg = configparser.ConfigParser()
cfg.read(CONFIG_FILE, encoding="utf-8")
if not cfg.has_section(_CFG_SECTION):
cfg.add_section(_CFG_SECTION)
cfg.set(_CFG_SECTION, _CFG_KEY_KEY, self._api_key_var.get().strip())
cfg.set(_CFG_SECTION, _CFG_KEY_KEY,
encrypt_value(self._api_key_var.get().strip()))
cfg.set(_CFG_SECTION, _CFG_KEY_MODEL, self._model_var.get())
with open(CONFIG_FILE, "w", encoding="utf-8") as fh:
cfg.write(fh)