mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-05-17 04:01:13 +00:00
Allow users to disconnect their OpenAI account by clearing stored ChatGPT OAuth tokens while preserving unrelated auth data. Fetch and normalize Codex usage windows, then show remaining percentage and reset timing in the OAuth settings UI. Add focused tests for usage parsing and disconnect cleanup.
17 lines
494 B
Python
17 lines
494 B
Python
from __future__ import annotations
|
|
|
|
from helpers.api import ApiHandler, Request
|
|
from plugins._oauth.helpers import codex
|
|
|
|
|
|
class Disconnect(ApiHandler):
|
|
async def process(self, input: dict, request: Request) -> dict:
|
|
try:
|
|
result = codex.disconnect_auth()
|
|
return {
|
|
"ok": True,
|
|
**result,
|
|
"codex": codex.status(),
|
|
}
|
|
except Exception as exc:
|
|
return {"ok": False, "error": str(exc)}
|