Use central Anthropic key for AI insights; add update-check banner
AI insights now fetches the Claude API key from the central settings service instead of storing its own encrypted copy, so wages and other apps can share the same key. Also wires up the update-available banner using the existing version-check hook pattern. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
72f607132c
commit
4137813fc7
7 changed files with 141 additions and 42 deletions
|
|
@ -117,3 +117,17 @@ async def get_resos_credentials() -> Optional[dict]:
|
|||
def get_resos_credentials_sync() -> Optional[dict]:
|
||||
"""Blocking variant of get_resos_credentials for sync job contexts."""
|
||||
return _extract_resos(get_integration_sync("resos"))
|
||||
|
||||
|
||||
def _extract_anthropic(s: Optional[dict]) -> Optional[dict]:
|
||||
if not s:
|
||||
return None
|
||||
key = s.get("api_key") or ""
|
||||
if not key:
|
||||
return None
|
||||
return {"api_key": key}
|
||||
|
||||
|
||||
async def get_anthropic_credentials() -> Optional[dict]:
|
||||
"""Returns {'api_key'} from central settings, or None if not configured."""
|
||||
return _extract_anthropic(await get_integration("anthropic"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue