Refine configuration migration process to improve user experience

- Updated prompts for the OPENAI_BASE_URL to clarify its use for custom endpoints.
- Enhanced the migration function to skip "advanced" environment variables during interactive configuration, streamlining the setup for standard users.
- Improved messaging for missing optional API keys, ensuring clearer guidance for users during configuration.
This commit is contained in:
teknium1 2026-02-15 21:53:59 -08:00
parent 2f34e6fd30
commit e0c9d495ef

View file

@ -196,9 +196,10 @@ OPTIONAL_ENV_VARS = {
}, },
"OPENAI_BASE_URL": { "OPENAI_BASE_URL": {
"description": "Custom OpenAI-compatible API endpoint (for VLLM/SGLang/etc.)", "description": "Custom OpenAI-compatible API endpoint (for VLLM/SGLang/etc.)",
"prompt": "OpenAI-compatible base URL (Enter to skip, only needed for custom endpoints)", "prompt": "OpenAI-compatible base URL (only if running your own endpoint)",
"url": None, "url": None,
"password": False, "password": False,
"advanced": True, # Hide from standard migrate flow
}, },
"OPENAI_API_KEY": { "OPENAI_API_KEY": {
"description": "OpenAI API key (voice transcription + custom endpoint)", "description": "OpenAI API key (voice transcription + custom endpoint)",
@ -401,21 +402,17 @@ def migrate_config(interactive: bool = True, quiet: bool = False) -> Dict[str, A
results["warnings"].append(f"Skipped {var['name']} - some features may not work") results["warnings"].append(f"Skipped {var['name']} - some features may not work")
print() print()
# Check for missing optional env vars and offer to configure # Check for missing optional env vars and offer to configure interactively
# Skip "advanced" vars (like OPENAI_BASE_URL) -- those are for power users
missing_optional = get_missing_env_vars(required_only=False) missing_optional = get_missing_env_vars(required_only=False)
# Filter to only truly optional ones (not already handled as required above)
required_names = {v["name"] for v in missing_env} if missing_env else set() required_names = {v["name"] for v in missing_env} if missing_env else set()
missing_optional = [v for v in missing_optional if v["name"] not in required_names] missing_optional = [
v for v in missing_optional
if missing_optional and not quiet: if v["name"] not in required_names and not v.get("advanced")
print(f"\n {len(missing_optional)} optional API key(s) not configured:") ]
for var in missing_optional:
tools = var.get("tools", [])
tools_str = f" → enables: {', '.join(tools)}" if tools else ""
print(f"{var['name']}: {var['description']}{tools_str}")
if interactive and missing_optional: if interactive and missing_optional:
print("\n Would you like to configure any optional keys now?") print(" Would you like to configure any optional keys now?")
try: try:
answer = input(" Configure optional keys? [y/N]: ").strip().lower() answer = input(" Configure optional keys? [y/N]: ").strip().lower()
except (EOFError, KeyboardInterrupt): except (EOFError, KeyboardInterrupt):
@ -424,8 +421,12 @@ def migrate_config(interactive: bool = True, quiet: bool = False) -> Dict[str, A
if answer in ("y", "yes"): if answer in ("y", "yes"):
print() print()
for var in missing_optional: for var in missing_optional:
desc = var.get("description", "")
if var.get("url"): if var.get("url"):
print(f" {desc}")
print(f" Get your key at: {var['url']}") print(f" Get your key at: {var['url']}")
else:
print(f" {desc}")
if var.get("password"): if var.get("password"):
import getpass import getpass
@ -792,7 +793,10 @@ def config_command(args):
print(f"\n {len(missing_config)} new config option(s) will be added with defaults") print(f"\n {len(missing_config)} new config option(s) will be added with defaults")
required_missing = [v for v in missing_env if v.get("is_required")] required_missing = [v for v in missing_env if v.get("is_required")]
optional_missing = [v for v in missing_env if not v.get("is_required")] optional_missing = [
v for v in missing_env
if not v.get("is_required") and not v.get("advanced")
]
if required_missing: if required_missing:
print(f"\n ⚠️ {len(required_missing)} required API key(s) missing:") print(f"\n ⚠️ {len(required_missing)} required API key(s) missing:")