Skip to content

Agent Zero AI framework

Add ChatGPT Codex OAuth discovery banner

Alessandro332ffdcf4d59
diff --git a/plugins/_discovery/extensions/python/banners/10_discovery_cards.py b/plugins/_discovery/extensions/python/banners/10_discovery_cards.py
index 94c9587bb..3b51f1c44 100644
--- a/plugins/_discovery/extensions/python/banners/10_discovery_cards.py
+++ b/plugins/_discovery/extensions/python/banners/10_discovery_cards.py
@@ -1,16 +1,26 @@
from helpers.extension import Extension
from helpers import plugins
+
class DiscoveryCardsExtension(Extension):
"""Injects discovery cards into the banners list."""
+ def _codex_oauth_connected(self) -> bool:
+ try:
+ from plugins._oauth.helpers import codex
+
+ return bool(codex.status().get("connected"))
+ except Exception:
+ return False
+
async def execute(self, banners: list = [], frontend_context: dict = {}, **kwargs):
# Optional logic: only show specific cards if plugins aren't already configured.
# Telegram, Email, Whatsapp are built-in, so we only need to check if they've been configured.
-
+
telegram_config = plugins.get_plugin_config("_telegram_integration") or {}
email_config = plugins.get_plugin_config("_email_integration") or {}
whatsapp_config = plugins.get_plugin_config("_whatsapp_integration") or {}
+ codex_oauth_connected = self._codex_oauth_connected()
# 1. Plugin Hub Hero
banners.append({
@@ -76,3 +86,21 @@ class DiscoveryCardsExtension(Extension):
"priority": 50,
"show_in_onboarding": True
})
+
+ # 5. Codex/ChatGPT OAuth
+ banners.append({
+ "id": "discovery-codex-oauth",
+ "type": "hero",
+ "placement": "after-features",
+ "title": "Connect ChatGPT/Codex" if not codex_oauth_connected else "ChatGPT/Codex Connected",
+ "description": "Link your account through the OAuth plugin to unlock account-backed Codex models locally."
+ if not codex_oauth_connected
+ else "Manage your OAuth connection and account-backed Codex models.",
+ "thumbnail": "/plugins/_discovery/webui/assets/hero-openai-oauth.png",
+ "icon": "key",
+ "cta_text": "Connect Account" if not codex_oauth_connected else "Manage OAuth",
+ "cta_action": "open-plugin-config:_oauth",
+ "dismissible": True,
+ "priority": 40,
+ "show_in_onboarding": True
+ })
diff --git a/plugins/_discovery/extensions/webui/welcome-actions-end/discovery-cards.html b/plugins/_discovery/extensions/webui/welcome-actions-end/discovery-cards.html
index a90d7dbc1..e5a7643c5 100644
--- a/plugins/_discovery/extensions/webui/welcome-actions-end/discovery-cards.html
+++ b/plugins/_discovery/extensions/webui/welcome-actions-end/discovery-cards.html
@@ -10,7 +10,7 @@
x-show="!($store.welcomeStore?.banners || []).some(b => b.id === 'missing-api-key') && ($store.discoveryStore.cards.length > 0 || $store.discoveryStore.hasDismissedCards)">
<div class="discovery-section">
- <template x-for="card in $store.discoveryStore.heroCards" :key="card.id">
+ <template x-for="card in $store.discoveryStore.topHeroCards" :key="card.id">
<article class="discovery-hero"
role="button"
tabindex="0"
@@ -89,6 +89,44 @@
</template>
</div>
+ <template x-for="card in $store.discoveryStore.bottomHeroCards" :key="card.id">
+ <article class="discovery-hero"
+ role="button"
+ tabindex="0"
+ @click="$store.discoveryStore.executeCta(card.cta_action)"
+ @keydown.enter.prevent="$store.discoveryStore.executeCta(card.cta_action)"
+ @keydown.space.prevent="$store.discoveryStore.executeCta(card.cta_action)">
+ <button class="discovery-dismiss"
+ type="button"
+ x-show="card.dismissible"
+ @click.stop="$store.discoveryStore.dismissCard(card.id)"
+ :aria-label="`Dismiss ${card.title}`"
+ title="Dismiss">
+ <span class="material-symbols-outlined">close</span>
+ </button>
+
+ <div class="discovery-hero-content">
+ <h3 class="discovery-hero-title" x-text="card.title"></h3>
+ <p class="discovery-hero-desc" x-text="card.description"></p>
+ <button class="btn btn-ok"
+ type="button"
+ @click.stop="$store.discoveryStore.executeCta(card.cta_action)">
+ <span x-text="card.cta_text"></span>
+ <span class="material-symbols-outlined">arrow_forward</span>
+ </button>
+ </div>
+
+ <div class="discovery-hero-thumb">
+ <template x-if="card.thumbnail">
+ <img :src="card.thumbnail" :alt="card.title" loading="lazy">
+ </template>
+ <template x-if="!card.thumbnail && card.icon">
+ <span class="material-symbols-outlined discovery-hero-icon" x-text="card.icon"></span>
+ </template>
+ </div>
+ </article>
+ </template>
+
<div class="discovery-undismiss" x-show="$store.discoveryStore.hasDismissedCards">
<button type="button"
class="discovery-undismiss-btn"
diff --git a/plugins/_discovery/webui/assets/hero-openai-oauth.png b/plugins/_discovery/webui/assets/hero-openai-oauth.png
new file mode 100644
index 000000000..eba0d1485
Binary files /dev/null and b/plugins/_discovery/webui/assets/hero-openai-oauth.png differ
diff --git a/plugins/_discovery/webui/discovery-store.js b/plugins/_discovery/webui/discovery-store.js
index 76316df96..2fdd1ed03 100644
--- a/plugins/_discovery/webui/discovery-store.js
+++ b/plugins/_discovery/webui/discovery-store.js
@@ -116,8 +116,16 @@ const model = {
// --- Computed ---
+ get topHeroCards() {
+ return this.cards.filter((card) => card.type === "hero" && card.placement !== "after-features");
+ },
+
+ get bottomHeroCards() {
+ return this.cards.filter((card) => card.type === "hero" && card.placement === "after-features");
+ },
+
get heroCards() {
- return this.cards.filter((card) => card.type === "hero");
+ return [...this.topHeroCards, ...this.bottomHeroCards];
},
get featureCards() {