feat: Add web-only fallback mode with API key promo
- Skill now works without any API keys using WebSearch fallback - Shows promo banner marketing Reddit/X data when keys are missing - Partial mode (one key) shows shorter tip for the missing source - Updated SKILL.md to document three modes: Full, Partial, Web-Only - Added get_missing_keys() to env.py for promo logic - Added show_promo(), start_web_only(), show_web_only_complete() to ui.py - Updated render_compact() to include inline promo for web-only mode Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -72,6 +72,24 @@ def get_available_sources(config: Dict[str, Any]) -> str:
|
||||
return 'web' # Fallback: WebSearch only (no API keys needed)
|
||||
|
||||
|
||||
def get_missing_keys(config: Dict[str, Any]) -> str:
|
||||
"""Determine which API keys are missing.
|
||||
|
||||
Returns: 'both', 'reddit', 'x', or 'none'
|
||||
"""
|
||||
has_openai = bool(config.get('OPENAI_API_KEY'))
|
||||
has_xai = bool(config.get('XAI_API_KEY'))
|
||||
|
||||
if has_openai and has_xai:
|
||||
return 'none'
|
||||
elif has_openai:
|
||||
return 'x' # Missing xAI key
|
||||
elif has_xai:
|
||||
return 'reddit' # Missing OpenAI key
|
||||
else:
|
||||
return 'both' # Missing both keys
|
||||
|
||||
|
||||
def validate_sources(requested: str, available: str, include_web: bool = False) -> tuple[str, Optional[str]]:
|
||||
"""Validate requested sources against available keys.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user