9router 0.4.11 → 0.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/.next/BUILD_ID +1 -1
- package/app/.next/app-path-routes-manifest.json +8 -8
- package/app/.next/build-manifest.json +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +4 -4
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/combo/[id]/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/quota/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error.html +1 -1
- package/app/.next/server/app/_global-error.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/_not-found/page.js +1 -1
- package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found.html +1 -1
- package/app/.next/server/app/_not-found.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +1 -1
- package/app/.next/server/app/api/combos/[id]/route.js +1 -1
- package/app/.next/server/app/api/init/route.js +1 -1
- package/app/.next/server/app/api/models/route.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/import/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route.js +1 -1
- package/app/.next/server/app/api/providers/route.js +1 -1
- package/app/.next/server/app/api/providers/validate/route.js +1 -1
- package/app/.next/server/app/api/settings/route.js +1 -1
- package/app/.next/server/app/api/translator/console-logs/route.js +1 -1
- package/app/.next/server/app/api/translator/console-logs/stream/route.js +4 -4
- package/app/.next/server/app/api/translator/translate/route.js +1 -1
- package/app/.next/server/app/api/translator/translate/route.js.nft.json +1 -1
- package/app/.next/server/app/api/tunnel/disable/route.js +1 -1
- package/app/.next/server/app/api/tunnel/enable/route.js +1 -1
- package/app/.next/server/app/api/tunnel/status/route.js +1 -1
- package/app/.next/server/app/api/tunnel/tailscale-check/route.js +11 -13
- package/app/.next/server/app/api/tunnel/tailscale-disable/route.js +1 -1
- package/app/.next/server/app/api/tunnel/tailscale-enable/route.js +1 -1
- package/app/.next/server/app/api/tunnel/tailscale-login/route.js +11 -13
- package/app/.next/server/app/api/usage/[connectionId]/route.js +1 -1
- package/app/.next/server/app/api/usage/providers/route.js +1 -1
- package/app/.next/server/app/api/v1/audio/speech/route.js +1 -1
- package/app/.next/server/app/api/v1/embeddings/route.js +1 -1
- package/app/.next/server/app/api/v1/images/generations/route.js +2 -2
- package/app/.next/server/app/api/v1/images/generations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/models/route.js +1 -1
- package/app/.next/server/app/api/v1/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/route.js +1 -1
- package/app/.next/server/app/api/v1/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/search/route.js +1 -1
- package/app/.next/server/app/api/v1/web/fetch/route.js +1 -1
- package/app/.next/server/app/api/version/route.js +1 -1
- package/app/.next/server/app/api/version/update/route.js +1 -1
- package/app/.next/server/app/callback/page.js +1 -1
- package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback.html +1 -1
- package/app/.next/server/app/callback.rsc +4 -4
- package/app/.next/server/app/callback.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/callback.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/basic-chat.html +1 -1
- package/app/.next/server/app/dashboard/basic-chat.rsc +6 -6
- package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/basic-chat.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/basic-chat.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next/server/app/dashboard/cli-tools.rsc +6 -6
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.html +1 -1
- package/app/.next/server/app/dashboard/combos.rsc +6 -6
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.html +1 -1
- package/app/.next/server/app/dashboard/endpoint.rsc +6 -6
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/media-providers/web.html +1 -1
- package/app/.next/server/app/dashboard/media-providers/web.rsc +6 -6
- package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/mitm.html +1 -1
- package/app/.next/server/app/dashboard/mitm.rsc +6 -6
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.html +1 -1
- package/app/.next/server/app/dashboard/profile.rsc +6 -6
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.html +1 -1
- package/app/.next/server/app/dashboard/providers/new.rsc +6 -6
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.html +1 -1
- package/app/.next/server/app/dashboard/providers.rsc +6 -6
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.rsc +6 -6
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/quota.html +2 -2
- package/app/.next/server/app/dashboard/quota.rsc +7 -7
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/quota.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing/page.js +1 -1
- package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.rsc +5 -5
- package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +5 -5
- package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.html +1 -1
- package/app/.next/server/app/dashboard/translator.rsc +6 -6
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.html +1 -1
- package/app/.next/server/app/dashboard/usage.rsc +6 -6
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard.html +1 -1
- package/app/.next/server/app/dashboard.rsc +6 -6
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/index.html +1 -1
- package/app/.next/server/app/index.rsc +4 -4
- package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/landing/page.js +1 -1
- package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/landing.html +1 -1
- package/app/.next/server/app/landing.rsc +4 -4
- package/app/.next/server/app/landing.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/landing.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
- package/app/.next/server/app/login/page.js +2 -2
- package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/login.html +1 -1
- package/app/.next/server/app/login.rsc +5 -5
- package/app/.next/server/app/login.segments/_full.segment.rsc +5 -5
- package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/login.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/login.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/app/.next/server/app/page.js +1 -1
- package/app/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app-paths-manifest.json +8 -8
- package/app/.next/server/chunks/126.js +2 -2
- package/app/.next/server/chunks/1574.js +2 -2
- package/app/.next/server/chunks/1578.js +1 -1
- package/app/.next/server/chunks/2049.js +1 -1
- package/app/.next/server/chunks/21.js +1 -1
- package/app/.next/server/chunks/2141.js +1 -1
- package/app/.next/server/chunks/253.js +1 -1
- package/app/.next/server/chunks/2692.js +23 -0
- package/app/.next/server/chunks/450.js +2 -2
- package/app/.next/server/chunks/5221.js +1 -1
- package/app/.next/server/chunks/5339.js +1 -1
- package/app/.next/server/chunks/7770.js +1 -1
- package/app/.next/server/chunks/7973.js +1 -1
- package/app/.next/server/chunks/8035.js +1 -1
- package/app/.next/server/chunks/8193.js +1 -1
- package/app/.next/server/chunks/8202.js +6 -6
- package/app/.next/server/chunks/8513.js +13 -15
- package/app/.next/server/chunks/8565.js +1 -0
- package/app/.next/server/middleware-build-manifest.js +1 -1
- package/app/.next/server/middleware.js +1 -1
- package/app/.next/server/pages/404.html +1 -1
- package/app/.next/server/pages/500.html +1 -1
- package/app/.next/static/chunks/3116-cec85bb5f212583f.js +23 -0
- package/app/.next/static/chunks/4156-cb6c83e3583f0406.js +7 -0
- package/app/.next/static/chunks/505-18fef307aacf3205.js +1 -0
- package/app/.next/static/chunks/8035-51e868622e22263b.js +3 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-2709902f127ecc7a.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-24f203d25ad3f861.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-99e1297a29f0994e.js +53 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-e95c413c30b592eb.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/web/combo/[id]/page-8b1737ee82d2cbfa.js +4 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/web/page-c32e5ceca2e291dd.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/mitm/page-dc8502d8e3b95e92.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/profile/page-1c3e2ce342940999.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-20eb7b59c080e8f7.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-a6a52208ff3881e2.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-7447209d1946170b.js +2 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/quota/page-7d10d891e789f63e.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-92b9dd8c50ab5e50.js +1 -0
- package/app/.next/static/chunks/app/dashboard/settings/pricing/page-77a73529baba955b.js +1 -0
- package/app/.next/static/chunks/app/login/page-2f45309b2d2ca209.js +1 -0
- package/app/.next/static/css/c5a3b7a7aed78240.css +1 -0
- package/app/package.json +1 -1
- package/app/public/i18n/literals/zh-CN.json +404 -127
- package/app/public/providers/cloudflare-ai.png +0 -0
- package/app/public/providers/nebius.png +0 -0
- package/app/public/providers/xiaomi-mimo.png +0 -0
- package/app/src/mitm/server.js +34 -31
- package/cli.js +6 -0
- package/package.json +1 -1
- package/app/.next/server/chunks/6762.js +0 -23
- package/app/.next/static/chunks/4156-dffbf1c435fa1271.js +0 -7
- package/app/.next/static/chunks/4380-8da8f918438df3db.js +0 -23
- package/app/.next/static/chunks/505-2524099b7d200dd4.js +0 -1
- package/app/.next/static/chunks/8035-be13431b81f6e555.js +0 -3
- package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-c8fe80e1731776e1.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-e6de48be0a07b12f.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-72f2d697d6bc8b5f.js +0 -53
- package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-1cd57da85dc9a5a0.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/web/combo/[id]/page-55f152f000244dfd.js +0 -4
- package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/web/page-c02c96576b763028.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/mitm/page-0c6b98e73588b409.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/profile/page-8d500331b6e10813.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-0a4d03fd9b812949.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-d8aedd72c61ec172.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-b675d50ce82d5577.js +0 -2
- package/app/.next/static/chunks/app/(dashboard)/dashboard/quota/page-bd3385cc5ab746eb.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-538a897db589c145.js +0 -1
- package/app/.next/static/chunks/app/dashboard/settings/pricing/page-d9a2df5b3f666b3b.js +0 -1
- package/app/.next/static/chunks/app/login/page-2424ce8673ecf5cb.js +0 -1
- package/app/.next/static/css/e7f512f42893c6a3.css +0 -1
- /package/app/.next/static/{g75qvBgg9uvwRkdVyyKkl → 7D6ZXM7R9e5iCcGAVJvY1}/_buildManifest.js +0 -0
- /package/app/.next/static/{g75qvBgg9uvwRkdVyyKkl → 7D6ZXM7R9e5iCcGAVJvY1}/_ssgManifest.js +0 -0
package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-0a4d03fd9b812949.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{7207:(e,t,s)=>{Promise.resolve().then(s.bind(s,60717))},60717:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>C});var i=s(73365),a=s(1521),r=s(29717),o=s(99568),l=s.n(o),n=s(58872),d=s(74156),c=s(82495),p=s(69633),x=s(96459);let m=new Map;async function u(e){if(!e?.url||!e?.type)return[];let t=m.get(e.url);if(t&&Date.now()<t.expiresAt)return t.data;try{let t=new URLSearchParams({url:e.url,type:e.type}),s=await fetch(`/api/providers/suggested-models?${t}`);if(!s.ok)return[];let i=(await s.json()).data??[];return m.set(e.url,{data:i,expiresAt:Date.now()+6e5}),i}catch{return[]}}var h=s(86447),y=s.n(h);function f({model:e,fullModel:t,alias:s,copied:a,onCopy:r,testStatus:o,isCustom:l,isFree:n,onDeleteAlias:d,onTest:c,isTesting:p}){let x="ok"===o?"#22c55e":"error"===o?"#ef4444":void 0;return(0,i.jsx)("div",{className:`group px-3 py-2 rounded-lg border ${"ok"===o?"border-green-500/40":"error"===o?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-base",style:x?{color:x}:void 0,children:"ok"===o?"check_circle":"error"===o?"cancel":"smart_toy"}),(0,i.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,i.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),e.name&&(0,i.jsx)("span",{className:"text-[9px] text-text-muted/70 italic pl-1",children:e.name})]}),c&&(0,i.jsxs)("div",{className:"relative group/btn",children:[(0,i.jsx)("button",{onClick:c,disabled:p,className:`p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-opacity ${p?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",style:p?{animation:"spin 1s linear infinite"}:void 0,children:p?"progress_activity":"science"})}),(0,i.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:p?"Testing...":"Test"})]}),(0,i.jsxs)("div",{className:"relative group/btn",children:[(0,i.jsx)("button",{onClick:()=>r(t,`model-${e.id}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:a===`model-${e.id}`?"check":"content_copy"})}),(0,i.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:a===`model-${e.id}`?"Copied!":"Copy"})]}),l&&(0,i.jsx)("button",{onClick:d,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity ml-auto",title:"Remove custom model",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})})]})})}function g({modelId:e,fullModel:t,copied:s,onCopy:a,onDeleteAlias:r,onTest:o,testStatus:l,isTesting:n}){let d="ok"===l?"#22c55e":"error"===l?"#ef4444":void 0;return(0,i.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===l?"border-green-500/40":"error"===l?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",style:d?{color:d}:void 0,children:"ok"===l?"check_circle":"error"===l?"cancel":"smart_toy"}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,i.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,i.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,i.jsxs)("div",{className:"relative group/btn",children:[(0,i.jsx)("button",{onClick:()=>a(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:s===`model-${e}`?"check":"content_copy"})}),(0,i.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:s===`model-${e}`?"Copied!":"Copy"})]}),o&&(0,i.jsxs)("div",{className:"relative group/btn",children:[(0,i.jsx)("button",{onClick:o,disabled:n,className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-colors",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",style:n?{animation:"spin 1s linear infinite"}:void 0,children:n?"progress_activity":"science"})}),(0,i.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:n?"Testing...":"Test"})]})]})]}),(0,i.jsx)("button",{onClick:r,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function b({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:s,copied:r,onCopy:o,onSetAlias:l,onDeleteAlias:n,connections:c,isAnthropic:p}){let[x,m]=(0,a.useState)(""),[u,h]=(0,a.useState)(!1),[y,f]=(0,a.useState)(!1),[v,j]=(0,a.useState)(null),[N,k]=(0,a.useState)({}),w=async t=>{if(!v){j(t);try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${e}/${t}`})}),i=await s.json();k(e=>({...e,[t]:i.ok?"ok":"error"}))}catch{k(e=>({...e,[t]:"error"}))}finally{j(null)}}},C=Object.entries(s).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,s])=>({modelId:s.replace(`${e}/`,""),fullModel:s,alias:t})),S=i=>{let a,r=`${e}/${i}`;if(Object.values(s).includes(r))return null;let o=(a=i.split("/"))[a.length-1];if(!s[o])return o;let l=`${t}-${o}`;return s[l]?null:l},A=async()=>{if(!x.trim()||u)return;let t=x.trim(),s=S(t);if(!s)return void alert("All suggested aliases already exist. Please choose a different model or remove conflicting aliases.");h(!0);try{await l(t,s,e),m("")}catch(e){console.log("Error adding model:",e)}finally{h(!1)}},$=async()=>{if(y)return;let t=c.find(e=>!1!==e.isActive);if(t){f(!0);try{let s=await fetch(`/api/providers/${t.id}/models`),i=await s.json();if(!s.ok)return void alert(i.error||"Failed to import models");let a=i.models||[];if(0===a.length)return void alert("No models returned from /models.");let r=0;for(let t of a){let s=t.id||t.name||t.model;if(!s)continue;let i=S(s);i&&(await l(s,i,e),r+=1)}0===r&&alert("No new models were added.")}catch(e){console.log("Error importing models:",e)}finally{f(!1)}}},P=c.some(e=>!1!==e.isActive);return(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",p?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,i.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,i.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,i.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,i.jsx)("input",{id:"new-compatible-model-input",type:"text",value:x,onChange:e=>m(e.target.value),onKeyDown:e=>"Enter"===e.key&&A(),placeholder:p?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,i.jsx)(d.$n,{size:"sm",icon:"add",onClick:A,disabled:!x.trim()||u,children:u?"Adding...":"Add"}),(0,i.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"download",onClick:$,disabled:!P||y,children:y?"Importing...":"Import from /models"})]}),!P&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),C.length>0&&(0,i.jsx)("div",{className:"flex flex-col gap-3",children:C.map(({modelId:e,fullModel:s,alias:a})=>(0,i.jsx)(g,{modelId:e,fullModel:`${t}/${e}`,copied:r,onCopy:o,onDeleteAlias:()=>n(a),onTest:c.length>0?()=>w(e):void 0,testStatus:N[e],isTesting:v===e},s))})]})}function v({until:e}){let[t,s]=(0,a.useState)("");return((0,a.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void s("");let i=Math.floor(t/1e3);if(i<60)s(`${i}s`);else if(i<3600)s(`${Math.floor(i/60)}m ${i%60}s`);else{let e=Math.floor(i/3600),t=Math.floor(i%3600/60);s(`${e}h ${t}m`)}};t();let i=setInterval(t,1e3);return()=>clearInterval(i)},[e]),t)?(0,i.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}function j({connection:e,proxyPools:t,isOAuth:s,isFirst:r,isLast:o,onMoveUp:l,onMoveDown:n,onToggleActive:c,onUpdateProxy:p,onEdit:x,onDelete:m}){let[u,h]=(0,a.useState)(!1),[y,f]=(0,a.useState)(!1),g=(0,a.useRef)(null),b=new Map((t||[]).map(e=>[e.id,e])),N=e.providerSpecificData?.proxyPoolId||null,k=N?b.get(N):null,w=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,C=!!N||w,S=k?`Pool: ${k.name}`:N?`Pool: ${N} (inactive/missing)`:w?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",A="";if(k?.proxyUrl||e.providerSpecificData?.connectionProxyUrl){let t=k?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;try{let e=new URL(t);A=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{A=t}}let $=k?.noProxy||e.providerSpecificData?.connectionNoProxy||"",P="default";k?.isActive===!0?P="success":(N||w)&&(P="error"),(0,a.useEffect)(()=>{if(!u)return;let e=e=>{g.current&&!g.current.contains(e.target)&&h(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[u]);let T=async e=>{f(!0);try{await p("__none__"===e?null:e)}finally{f(!1),h(!1)}},O=s?e.name||e.email||e.displayName||"OAuth Account":e.name,[I,E]=(0,a.useState)(!1),R=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>!!e).sort()[0]||null;(0,a.useEffect)(()=>{let t=()=>{E(!!Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>e&&new Date(e).getTime()>Date.now()).sort()[0])};t();let s=R?setInterval(t,1e3):null;return()=>{s&&clearInterval(s)}},[R]);let _="unavailable"!==e.testStatus||I?e.testStatus:"active";return(0,i.jsxs)("div",{className:`group flex items-center justify-between p-2 rounded-lg hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${!1===e.isActive?"opacity-60":""}`,children:[(0,i.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,i.jsxs)("div",{className:"flex flex-col",children:[(0,i.jsx)("button",{onClick:l,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,i.jsx)("button",{onClick:n,disabled:o,className:`p-0.5 rounded ${o?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,i.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:s?"lock":"key"}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("p",{className:"text-sm font-medium truncate",children:O}),(0,i.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,i.jsx)(d.Ex,{variant:!1===e.isActive?"default":"active"===_||"success"===_?"success":"error"===_||"expired"===_||"unavailable"===_?"error":"default",size:"sm",dot:!0,children:!1===e.isActive?"disabled":_||"Unknown"}),C&&(0,i.jsx)(d.Ex,{variant:P,size:"sm",children:"Proxy"}),I&&!1!==e.isActive&&(0,i.jsx)(v,{until:R}),e.lastError&&!1!==e.isActive&&(0,i.jsx)("span",{className:"text-xs text-red-500 truncate max-w-[300px]",title:e.lastError,children:e.lastError}),(0,i.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,i.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]})]}),C&&(0,i.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,i.jsx)("span",{className:"text-[11px] text-text-muted truncate max-w-[420px]",title:S,children:S}),A&&(0,i.jsx)("code",{className:"text-[10px] font-mono bg-black/5 dark:bg-white/5 px-1 py-0.5 rounded text-text-muted",children:A}),$&&(0,i.jsxs)("span",{className:"text-[11px] text-text-muted truncate max-w-[320px]",title:$,children:["no_proxy: ",$]})]})]})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsxs)("div",{className:"flex gap-1",children:[(t||[]).length>0&&(0,i.jsxs)("div",{className:"relative",ref:g,children:[(0,i.jsxs)("button",{onClick:()=>h(e=>!e),className:`flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 transition-colors ${C?"text-primary":"text-text-muted hover:text-primary"}`,disabled:y,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:y?"progress_activity":"lan"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),u&&(0,i.jsxs)("div",{className:"absolute right-0 top-full mt-1 z-50 bg-bg border border-border rounded-lg shadow-lg py-1 min-w-[160px]",children:[(0,i.jsx)("button",{onClick:()=>T("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!N?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,i.jsx)("button",{onClick:()=>T(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${N===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),(0,i.jsxs)("button",{onClick:x,className:"flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,i.jsxs)("button",{onClick:m,className:"flex flex-col items-center px-2 py-1 rounded hover:bg-red-500/10 text-red-500",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,i.jsx)(d.lM,{size:"sm",checked:e.isActive??!0,onChange:c,title:e.isActive??!0?"Disable connection":"Enable connection"})]})]})}function N({isOpen:e,provider:t,providerName:s,isCompatible:r,isAnthropic:o,authType:l,authHint:n,website:c,proxyPools:p,onSave:x,onClose:m}){let u="__none__",h="ollama-local"===t,y="cookie"===l,f=y?"Cookie Value":"API Key",g="azure"===t,b="cloudflare-ai"===t,[v,j]=(0,a.useState)({name:"",apiKey:"",priority:1,proxyPoolId:u,ollamaHostUrl:""}),[k,w]=(0,a.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[C,S]=(0,a.useState)({accountId:""}),[A,$]=(0,a.useState)(!1),[P,T]=(0,a.useState)(null),[O,I]=(0,a.useState)(!1),E=()=>h&&v.ollamaHostUrl.trim()?{baseUrl:v.ollamaHostUrl.trim()}:g?{azureEndpoint:k.azureEndpoint,apiVersion:k.apiVersion,deployment:k.deployment,organization:k.organization}:b?{accountId:C.accountId}:void 0,R=async()=>{$(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:v.apiKey,providerSpecificData:E()})}),s=await e.json();T(s.valid?"success":"failed")}catch{T("failed")}finally{$(!1)}},_=async()=>{if(t&&(h||v.apiKey)&&(h||v.name)){I(!0);try{let e=!1;try{$(!0),T(null);let s=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:v.apiKey,providerSpecificData:E()})});e=!!(await s.json()).valid,T(e?"success":"failed")}catch{T("failed")}finally{$(!1)}await x({name:v.name||(h?"Ollama Local":""),apiKey:v.apiKey,priority:v.priority,proxyPoolId:v.proxyPoolId===u?null:v.proxyPoolId,testStatus:e?"active":"unknown",providerSpecificData:E()})}finally{I(!1)}}};return t?(0,i.jsx)(d.aF,{isOpen:e,title:`Add ${s||t} ${f}`,onClose:m,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)(d.pd,{label:"Name",value:v.name,onChange:e=>j({...v,name:e.target.value}),placeholder:h?"Ollama Local":"Production Key"}),h&&(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(d.pd,{label:"Ollama Host URL",value:v.ollamaHostUrl,onChange:e=>j({...v,ollamaHostUrl:e.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,i.jsx)("div",{className:"pt-6",children:(0,i.jsx)(d.$n,{onClick:R,disabled:A||O,variant:"secondary",children:A?"Checking...":"Check"})})]}),!h&&(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(d.pd,{label:f,type:y?"text":"password",value:v.apiKey,onChange:e=>j({...v,apiKey:e.target.value}),placeholder:y?"grok-web"===t?"sso=xxxxx... or just the raw value":"eyJhbGciOi...":"",className:"flex-1"}),(0,i.jsx)("div",{className:"pt-6",children:(0,i.jsx)(d.$n,{onClick:R,disabled:!v.apiKey||A||O,variant:"secondary",children:A?"Checking...":"Check"})})]}),y&&n&&(0,i.jsxs)("p",{className:"text-xs text-text-muted",children:[n,c&&(0,i.jsxs)(i.Fragment,{children:[" ",(0,i.jsxs)("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",c.replace(/^https?:\/\//,"")]})]})]}),h&&(0,i.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,i.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,i.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),P&&(0,i.jsx)(d.Ex,{variant:"success"===P?"success":"error",children:"success"===P?"Valid":"Invalid"}),r&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:o?`Validation checks ${s||"Anthropic Compatible"} by verifying the API key.`:`Validation checks ${s||"OpenAI Compatible"} via /models on your base URL.`}),b&&(0,i.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,i.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Cloudflare Workers AI"}),(0,i.jsx)(d.pd,{label:"Account ID",value:C.accountId,onChange:e=>S({...C,accountId:e.target.value}),placeholder:"abc123def456..."}),(0,i.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Find your Account ID in the right sidebar of ",(0,i.jsx)("a",{href:"https://dash.cloudflare.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"dash.cloudflare.com"})]})]}),g&&(0,i.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,i.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,i.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,i.jsx)(d.pd,{label:"Azure Endpoint",value:k.azureEndpoint,onChange:e=>w({...k,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,i.jsx)(d.pd,{label:"Deployment Name",value:k.deployment,onChange:e=>w({...k,deployment:e.target.value}),placeholder:"gpt-4"}),(0,i.jsx)(d.pd,{label:"API Version",value:k.apiVersion,onChange:e=>w({...k,apiVersion:e.target.value}),placeholder:"2024-10-01-preview"}),(0,i.jsx)(d.pd,{label:"Organization",value:k.organization,onChange:e=>w({...k,organization:e.target.value}),placeholder:"Organization ID"})]})]}),(0,i.jsx)(d.pd,{label:"Priority",type:"number",value:v.priority,onChange:e=>j({...v,priority:Number.parseInt(e.target.value)||1})}),(0,i.jsx)(d.l6,{label:"Proxy Pool",value:v.proxyPoolId,onChange:e=>j({...v,proxyPoolId:e.target.value}),options:[{value:u,label:"None"},...(p||[]).map(e=>({value:e.id,label:e.name}))],placeholder:"None"}),0===(p||[]).length&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"No active proxy pools available. Create one in Proxy Pools page first."}),(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Legacy manual proxy fields are still accepted by API for backward compatibility."}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(d.$n,{onClick:_,fullWidth:!0,disabled:O||!h&&(!v.name||!v.apiKey)||g&&(!k.azureEndpoint||!k.deployment||!k.organization)||b&&!C.accountId,children:O?"Saving...":"Save"}),(0,i.jsx)(d.$n,{onClick:m,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function k({isOpen:e,node:t,onSave:s,onClose:r,isAnthropic:o}){let[l,n]=(0,a.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[c,p]=(0,a.useState)(!1),[x,m]=(0,a.useState)(""),[u,h]=(0,a.useState)(""),[y,f]=(0,a.useState)(!1),[g,b]=(0,a.useState)(null);(0,a.useEffect)(()=>{t&&n({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(o?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,o]);let v=async()=>{if(l.name.trim()&&l.prefix.trim()&&l.baseUrl.trim()){p(!0);try{let e={name:l.name,prefix:l.prefix,baseUrl:l.baseUrl};o||(e.apiType=l.apiType),await s(e)}finally{p(!1)}}},j=async()=>{f(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:l.baseUrl,apiKey:x,type:o?"anthropic-compatible":"openai-compatible",modelId:u.trim()||void 0})}),t=await e.json();b(t.valid?"success":"failed")}catch{b("failed")}finally{f(!1)}};return t?(0,i.jsx)(d.aF,{isOpen:e,title:`Edit ${o?"Anthropic":"OpenAI"} Compatible`,onClose:r,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)(d.pd,{label:"Name",value:l.name,onChange:e=>n({...l,name:e.target.value}),placeholder:`${o?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,i.jsx)(d.pd,{label:"Prefix",value:l.prefix,onChange:e=>n({...l,prefix:e.target.value}),placeholder:o?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!o&&(0,i.jsx)(d.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:l.apiType,onChange:e=>n({...l,apiType:e.target.value})}),(0,i.jsx)(d.pd,{label:"Base URL",value:l.baseUrl,onChange:e=>n({...l,baseUrl:e.target.value}),placeholder:o?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${o?"Anthropic":"OpenAI"}-compatible API.`}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(d.pd,{label:"API Key (for Check)",type:"password",value:x,onChange:e=>m(e.target.value),className:"flex-1"}),(0,i.jsx)("div",{className:"pt-6",children:(0,i.jsx)(d.$n,{onClick:j,disabled:!x||y||!l.baseUrl.trim(),variant:"secondary",children:y?"Checking...":"Check"})})]}),(0,i.jsx)(d.pd,{label:"Model ID (optional)",value:u,onChange:e=>h(e.target.value),placeholder:"e.g. my-model-id",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),g&&(0,i.jsx)(d.Ex,{variant:"success"===g?"success":"error",children:"success"===g?"Valid":"Invalid"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(d.$n,{onClick:v,fullWidth:!0,disabled:!l.name.trim()||!l.prefix.trim()||!l.baseUrl.trim()||c,children:c?"Saving...":"Save"}),(0,i.jsx)(d.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function w({isOpen:e,providerAlias:t,providerDisplayAlias:s,onSave:r,onClose:o}){let[l,n]=(0,a.useState)(""),[c,p]=(0,a.useState)(null),[x,m]=(0,a.useState)(""),[u,h]=(0,a.useState)(!1);(0,a.useEffect)(()=>{e&&(n(""),p(null),m(""))},[e]);let y=async()=>{if(l.trim()){p("testing"),m("");try{let e=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${t}/${l.trim()}`})}),s=await e.json();p(s.ok?"ok":"error"),m(s.error||"")}catch(e){p("error"),m(e.message)}}},f=async()=>{if(l.trim()&&!u){h(!0);try{await r(l.trim())}finally{h(!1)}}};return(0,i.jsx)(d.aF,{isOpen:e,onClose:o,title:"Add Custom Model",children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)("input",{type:"text",value:l,onChange:e=>{n(e.target.value),p(null),m("")},onKeyDown:e=>{"Enter"===e.key&&y()},placeholder:"e.g. claude-opus-4-5",className:"flex-1 px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",autoFocus:!0}),(0,i.jsx)(d.$n,{variant:"secondary",icon:"science",loading:"testing"===c,onClick:y,disabled:!l.trim()||"testing"===c,children:"testing"===c?"Testing...":"Test"})]}),(0,i.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,i.jsx)("code",{className:"font-mono bg-sidebar px-1 rounded",children:l.trim()||"model-id"})]})]}),"ok"===c&&(0,i.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-base",children:"check_circle"}),"Model is reachable"]}),"error"===c&&(0,i.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",children:"cancel"}),(0,i.jsx)("span",{children:x||"Model not reachable"})]}),(0,i.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,i.jsx)(d.$n,{onClick:o,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,i.jsx)(d.$n,{onClick:f,fullWidth:!0,size:"sm",disabled:!l.trim()||u,children:u?"Adding...":"Add Model"})]})]})})}function C(){let e=(0,r.useParams)(),t=(0,r.useRouter)(),s=e.id,[o,m]=(0,a.useState)([]),[h,y]=(0,a.useState)(!0),[g,v]=(0,a.useState)(null),[C,S]=(0,a.useState)([]),[A,$]=(0,a.useState)(!1),[P,T]=(0,a.useState)(!1),[O,I]=(0,a.useState)(!1),[E,R]=(0,a.useState)(!1),[_,U]=(0,a.useState)(!1),[D,q]=(0,a.useState)(!1),[z,M]=(0,a.useState)(null),[L,F]=(0,a.useState)({}),[K,J]=(0,a.useState)(!1),[W,V]=(0,a.useState)({}),[H,G]=(0,a.useState)(""),[B,Q]=(0,a.useState)(null),[Z,X]=(0,a.useState)(!1),[Y,ee]=(0,a.useState)([]),[et,es]=(0,a.useState)("__none__"),[ei,ea]=(0,a.useState)(!1),[er,eo]=(0,a.useState)(null),[el,en]=(0,a.useState)(""),[ed,ec]=(0,a.useState)("auto"),[ep,ex]=(0,a.useState)([]),[em,eu]=(0,a.useState)([]),{copied:eh,copy:ey}=(0,x.C)(),ef=g?{id:g.id,name:g.name||("anthropic-compatible"===g.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===g.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===g.type?"AC":"OC",apiType:g.apiType,baseUrl:g.baseUrl,type:g.type}:c.zN[s]||c.fg[s]||c.IS[s]||c.nJ[s]||c.br[s],eg=!!c.zN[s]||!!c.IS[s],eb=!!c.IS[s]?.noAuth,ev=(0,p.KC)(s),ej=(0,c.wG)(s),eN=(0,c.mq)(s),ek=(0,c.gb)(s),ew=eN||ek;c.Q2[s]?.thinkingConfig||c.s9.extended;let eC=ew?s:ej,eS=ew?g?.prefix||s:ej,eA=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&F(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]);(0,a.useEffect)(()=>{"kilocode"===s&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&eu(e.models)}).catch(()=>{})},[s]);let e$=(0,a.useCallback)(async()=>{try{let[e,t,i,a]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),r=await e.json(),o=await t.json(),l=await i.json(),n=a.ok?await a.json():{};if(e.ok){let e=(r.connections||[]).filter(e=>e.provider===s);m(e)}i.ok&&S(l.proxyPools||[]);let d=(n.providerStrategies||{})[s]||{};eo(d.fallbackStrategy||null),en(null!=d.stickyRoundRobinLimit?String(d.stickyRoundRobinLimit):"1");let c=(n.providerThinking||{})[s]||{};if(ec(c.mode||"auto"),t.ok){let e=(o.nodes||[]).find(e=>e.id===s)||null;if(!e&&ew)for(let t=0;t<3;t+=1){await new Promise(e=>setTimeout(e,150));let t=await fetch("/api/provider-nodes",{cache:"no-store"});if(t.ok&&(e=((await t.json()).nodes||[]).find(e=>e.id===s)||null))break}v(e)}}catch(e){console.log("Error fetching connections:",e)}finally{y(!1)}},[s,ew]),eP=async e=>{try{let t=await fetch(`/api/provider-nodes/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),i=await t.json();t.ok&&(v(i.node),await e$(),U(!1))}catch(e){console.log("Error updating provider node:",e)}},eT=async(e,t)=>{try{let i=await fetch("/api/settings",{cache:"no-store"}),a=(i.ok?await i.json():{}).providerStrategies||{},r={};e&&(r.fallbackStrategy=e),"round-robin"===e&&""!==t&&(r.stickyRoundRobinLimit=Number(t)||3);let o={...a};0===Object.keys(r).length?delete o[s]:o[s]=r,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:o})})}catch(e){console.log("Error saving provider strategy:",e)}};(0,a.useEffect)(()=>{e$(),eA()},[e$,eA]),(0,a.useEffect)(()=>{let e=(c.zN[s]||c.fg[s]||c.IS[s]||c.nJ[s])?.modelsFetcher;e&&u(e).then(ex)},[s]);let eO=async(e,t,s=ej)=>{let i=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:i,alias:t})});if(e.ok)await eA();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},eI=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await eA()}catch(e){console.log("Error deleting alias:",e)}},eE=async e=>{if(confirm("Delete this connection?"))try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&m(o.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}},eR=()=>{e$(),$(!1)},e_=async e=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:s,...e})})).ok&&(await e$(),I(!1))}catch(e){console.log("Error saving connection:",e)}},eU=async e=>{try{(await fetch(`/api/providers/${z.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await e$(),R(!1))}catch(e){console.log("Error updating connection:",e)}},eD=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&m(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error updating connection status:",e)}},eq=async(e,t)=>{let s=[...o];[s[e],s[t]]=[s[t],s[e]],m(s);try{await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])}catch(e){console.log("Error swapping priority:",e),await e$()}},ez=o.filter(e=>Y.includes(e.id));o.length>0&&(Y.length,o.length),(0,a.useEffect)(()=>{ee(e=>e.filter(e=>o.some(t=>t.id===e)))},[o]);let eM=(()=>{if(0===ez.length)return"";let e=new Set(ez.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return"All selected currently unbound";let s=C.find(e=>e.id===t);return`All selected currently bound to ${s?.name||t}`}return"Selected connections have mixed proxy bindings"})(),eL=()=>{ei||q(!1)},eF=async()=>{if(0===Y.length)return;let e="__none__"===et?null:et;ea(!0);try{let t=[];for(let s of Y)try{let i=await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:e})});t.push(i.ok)}catch(e){console.log("Error applying bulk proxy pool for",s,e),t.push(!1)}let s=t.filter(e=>!e).length;s>0&&alert(`Updated with ${s} failed request(s).`),await e$(),ee([]),es("__none__"),q(!1)}catch(e){console.log("Error applying bulk proxy pool:",e)}finally{ea(!1)}},eK=(0,i.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:o.map((e,t)=>(0,i.jsx)("div",{className:"flex items-stretch",children:(0,i.jsx)("div",{className:"flex-1 min-w-0",children:(0,i.jsx)(j,{connection:e,proxyPools:C,isOAuth:eg,isFirst:0===t,isLast:t===o.length-1,onMoveUp:()=>eq(t,t-1),onMoveDown:()=>eq(t,t+1),onToggleActive:t=>eD(e.id,t),onUpdateProxy:async t=>{try{(await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&m(s=>s.map(s=>s.id===e.id?{...s,providerSpecificData:{...s.providerSpecificData,proxyPoolId:t||null}}:s))}catch(e){console.log("Error updating proxy:",e)}},onEdit:()=>{M(e),R(!0)},onDelete:()=>eE(e.id)})})},e.id))}),eJ=[{value:"__none__",label:"None"},...C.map(e=>({value:e.id,label:e.name}))],eW=0===Y.length?"Select one or more connections, then click Proxy Action.":eM,eV=Y.length>0&&!ei,eH=(0,i.jsx)(d.aF,{isOpen:D,onClose:eL,title:`Proxy Action (${Y.length} selected)`,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)(d.l6,{label:"Proxy Pool",value:et,onChange:e=>es(e.target.value),options:eJ,placeholder:"None"}),(0,i.jsx)("p",{className:"text-xs text-text-muted",children:eW}),(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Selecting None will unbind selected connections from proxy pool."}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(d.$n,{onClick:eF,fullWidth:!0,disabled:!eV,children:ei?"Applying...":"Apply"}),(0,i.jsx)(d.$n,{onClick:eL,variant:"ghost",fullWidth:!0,disabled:ei,children:"Cancel"})]})]})}),eG=async e=>{if(!B){Q(e);try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${eC}/${e}`})}),s=await t.json();V(t=>({...t,[e]:s.ok?"ok":"error"})),G(s.ok?"":s.error||"Model not reachable")}catch{V(t=>({...t,[e]:"error"})),G("Network error")}finally{Q(null)}}};return h?(0,i.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,i.jsx)(d.Qv,{}),(0,i.jsx)(d.Qv,{})]}):ef?(0,i.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,i.jsxs)("div",{children:[(0,i.jsxs)(l(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,i.jsxs)("div",{className:"flex items-center gap-4",children:[(0,i.jsx)("div",{className:"rounded-lg flex items-center justify-center",style:{backgroundColor:`${ef.color}15`},children:K?(0,i.jsx)("span",{className:"text-sm font-bold",style:{color:ef.color},children:ef.textIcon||ef.id.slice(0,2).toUpperCase()}):(0,i.jsx)(n.default,{src:eN&&ef.apiType?"responses"===ef.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":ek?"/providers/anthropic-m.png":`/providers/${ef.id}.png`,alt:ef.name,width:48,height:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",sizes:"48px",onError:()=>J(!0)})}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:ef.name}),(0,i.jsxs)("p",{className:"text-text-muted",children:[o.length," connection",1===o.length?"":"s"]})]})]})]}),ef.deprecated&&(0,i.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-yellow-500/10 border border-yellow-500/30",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,i.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:ef.deprecationNotice})]}),ef.notice&&!ef.deprecated&&(0,i.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-blue-500/10 border border-blue-500/30",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,i.jsx)("p",{className:"text-xs text-blue-600 dark:text-blue-400 leading-relaxed",children:ef.notice.text}),ef.notice.apiKeyUrl&&(0,i.jsx)("a",{href:ef.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs font-medium text-white bg-blue-500 hover:bg-blue-600 px-2 py-0.5 rounded shrink-0 transition-colors",children:"Get API Key →"})]}),ew&&g&&(0,i.jsxs)(d.Zp,{children:[(0,i.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:ek?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,i.jsxs)("p",{className:"text-sm text-text-muted",children:[ek?"Messages API":"responses"===g.apiType?"Responses API":"Chat Completions"," \xb7 ",(g.baseUrl||"").replace(/\/$/,""),"/",ek?"messages":"responses"===g.apiType?"responses":"chat/completions"]})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(d.$n,{size:"sm",icon:"add",onClick:()=>I(!0),disabled:o.length>0,children:"Add"}),(0,i.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>U(!0),children:"Edit"}),(0,i.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{if(confirm(`Delete this ${ek?"Anthropic":"OpenAI"} Compatible node?`))try{(await fetch(`/api/provider-nodes/${s}`,{method:"DELETE"})).ok&&t.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}},children:"Delete"})]})]}),o.length>0&&(0,i.jsx)("p",{className:"text-sm text-text-muted",children:"Only one connection is allowed per compatible node. Add another node if you need more connections."})]}),eb?(0,i.jsx)(d.gw,{providerId:s}):(0,i.jsxs)(d.Zp,{children:[(0,i.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,i.jsx)("div",{className:"flex items-center gap-4",children:(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,i.jsx)(d.lM,{checked:"round-robin"===er,onChange:e=>{let t=e?"round-robin":null,s=e?el||"1":el;e&&!el&&en("1"),eo(t),eT(t,s)}}),"round-robin"===er&&(0,i.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,i.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,i.jsx)("input",{type:"number",min:1,value:el,onChange:e=>{var t;en(t=e.target.value),eT("round-robin",t)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})})]}),0===o.length?(0,i.jsxs)("div",{className:"text-center py-12",children:[(0,i.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:eg?"lock":"key"})}),(0,i.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No connections yet"}),(0,i.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Add your first connection to get started"}),!ew&&(0,i.jsxs)("div",{className:"flex gap-2 justify-center",children:["iflow"===s&&(0,i.jsx)(d.$n,{icon:"cookie",variant:"secondary",onClick:()=>T(!0),children:"Cookie Auth"}),(0,i.jsx)(d.$n,{icon:"add",onClick:()=>eg?$(!0):I(!0),children:"iflow"===s?"OAuth":"Add Connection"})]})]}):(0,i.jsxs)(i.Fragment,{children:[eK,!ew&&(0,i.jsxs)("div",{className:"flex gap-2 mt-4",children:["iflow"===s&&(0,i.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>T(!0),title:"Add connection using browser cookie",children:"Cookie"}),(0,i.jsx)(d.$n,{size:"sm",icon:"add",onClick:()=>eg?$(!0):I(!0),children:"Add"})]})]})]}),(0,i.jsxs)(d.Zp,{children:[(0,i.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,i.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"})}),!!H&&(0,i.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:H}),(()=>{let e,t,a;if(ew)return(0,i.jsx)(b,{providerStorageAlias:eC,providerDisplayAlias:eS,modelAliases:L,copied:eh,onCopy:ey,onSetAlias:eO,onDeleteAlias:eI,connections:o,isAnthropic:ek});let r=[...ev,...em.filter(e=>!ev.some(t=>t.id===e.id))].filter(e=>!e.type||"llm"===e.type),l=Object.entries(L).filter(([e,t])=>{let s=`${eC}/`;if(!t.startsWith(s))return!1;let i=t.slice(s.length);return ef.passthroughModels?!ev.some(e=>e.id===i):!ev.some(e=>e.id===i)&&e===i}).map(([e,t])=>({id:t.slice(`${eC}/`.length),alias:e,fullModel:t}));return(0,i.jsxs)("div",{className:"flex flex-wrap gap-3",children:[r.map(e=>{let t=`${eC}/${e.id}`,a=`${s}/${e.id}`,r=Object.entries(L).find(([,e])=>e===t||e===a)?.[0];return(0,i.jsx)(f,{model:e,fullModel:`${eS}/${e.id}`,alias:r,copied:eh,onCopy:ey,onSetAlias:t=>eO(e.id,t,eC),onDeleteAlias:()=>eI(r),testStatus:W[e.id],onTest:o.length>0||eb?()=>eG(e.id):void 0,isTesting:B===e.id,isFree:e.isFree},e.id)}),l.map(e=>(0,i.jsx)(f,{model:{id:e.id},fullModel:`${eS}/${e.id}`,alias:e.alias,copied:eh,onCopy:ey,onSetAlias:()=>{},onDeleteAlias:()=>eI(e.alias),testStatus:W[e.id],onTest:o.length>0||eb?()=>eG(e.id):void 0,isTesting:B===e.id,isCustom:!0,isFree:!1},e.id)),(0,i.jsxs)("button",{onClick:()=>X(!0),className:"flex items-center gap-1.5 px-3 py-2 rounded-lg border border-dashed border-black/15 dark:border-white/15 text-xs text-text-muted hover:text-primary hover:border-primary/40 transition-colors",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),ep.length>0&&(e=new Set(Object.values(L)),t=new Set(ev.map(e=>e.id)),0===(a=ep.filter(s=>!e.has(`${eC}/${s.id}`)&&!t.has(s.id))).length?null:(0,i.jsxs)("div",{className:"w-full mt-2",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(e=>(0,i.jsxs)("button",{onClick:async()=>{let t=e.id.split("/").pop();await eO(e.id,t,eC)},className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:`${e.name} \xb7 ${(e.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id.split("/").pop()]},e.id))})]}))]})})()]}),eH,"kiro"===s?(0,i.jsx)(d.Mh,{isOpen:A,providerInfo:ef,onSuccess:eR,onClose:()=>$(!1)}):"cursor"===s?(0,i.jsx)(d.G9,{isOpen:A,onSuccess:eR,onClose:()=>$(!1)}):"gitlab"===s?(0,i.jsx)(d.vj,{isOpen:A,providerInfo:ef,onSuccess:eR,onClose:()=>$(!1)}):(0,i.jsx)(d.LF,{isOpen:A,provider:s,providerInfo:ef,onSuccess:eR,onClose:()=>$(!1)}),"iflow"===s&&(0,i.jsx)(d.vE,{isOpen:P,onSuccess:()=>{e$(),T(!1)},onClose:()=>T(!1)}),(0,i.jsx)(N,{isOpen:O,provider:s,providerName:ef.name,isCompatible:ew,isAnthropic:ek,authType:ef?.authType,authHint:ef?.authHint,website:ef?.website,proxyPools:C,onSave:e_,onClose:()=>I(!1)}),(0,i.jsx)(d.wI,{isOpen:E,connection:z,proxyPools:C,onSave:eU,onClose:()=>R(!1)}),ew&&(0,i.jsx)(k,{isOpen:_,node:g,onSave:eP,onClose:()=>U(!1),isAnthropic:ek}),!ew&&(0,i.jsx)(w,{isOpen:Z,providerAlias:eC,providerDisplayAlias:eS,onSave:async e=>{let t=ef?.passthroughModels?e.split("/").pop():e;await eO(e,t,eC),X(!1)},onClose:()=>X(!1)})]}):(0,i.jsxs)("div",{className:"text-center py-20",children:[(0,i.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,i.jsx)(l(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}f.propTypes={model:y().shape({id:y().string.isRequired}).isRequired,fullModel:y().string.isRequired,alias:y().string,copied:y().string,onCopy:y().func.isRequired,testStatus:y().oneOf(["ok","error"]),isCustom:y().bool,isFree:y().bool,onDeleteAlias:y().func,onTest:y().func,isTesting:y().bool},y().string.isRequired,y().string.isRequired,y().string,y().func.isRequired,y().func.isRequired,y().func,y().oneOf(["ok","error"]),y().bool,y().string.isRequired,y().object.isRequired,y().string,y().func.isRequired,y().func.isRequired,y().func.isRequired,b.propTypes={providerStorageAlias:y().string.isRequired,providerDisplayAlias:y().string.isRequired,modelAliases:y().object.isRequired,copied:y().string,onCopy:y().func.isRequired,onSetAlias:y().func.isRequired,onDeleteAlias:y().func.isRequired,connections:y().arrayOf(y().shape({id:y().string,isActive:y().bool})).isRequired,isAnthropic:y().bool},v.propTypes={until:y().string.isRequired},j.propTypes={connection:y().shape({id:y().string,name:y().string,email:y().string,displayName:y().string,modelLockUntil:y().string,testStatus:y().string,isActive:y().bool,lastError:y().string,priority:y().number,globalPriority:y().number}).isRequired,proxyPools:y().arrayOf(y().shape({id:y().string,name:y().string,proxyUrl:y().string,noProxy:y().string,isActive:y().bool})),isOAuth:y().bool.isRequired,isFirst:y().bool.isRequired,isLast:y().bool.isRequired,onMoveUp:y().func.isRequired,onMoveDown:y().func.isRequired,onToggleActive:y().func.isRequired,onUpdateProxy:y().func,onEdit:y().func.isRequired,onDelete:y().func.isRequired},N.propTypes={isOpen:y().bool.isRequired,provider:y().string,providerName:y().string,isCompatible:y().bool,isAnthropic:y().bool,authType:y().string,authHint:y().string,website:y().string,proxyPools:y().arrayOf(y().shape({id:y().string,name:y().string})),onSave:y().func.isRequired,onClose:y().func.isRequired},k.propTypes={isOpen:y().bool.isRequired,node:y().shape({id:y().string,name:y().string,prefix:y().string,apiType:y().string,baseUrl:y().string}),onSave:y().func.isRequired,onClose:y().func.isRequired,isAnthropic:y().bool},w.propTypes={isOpen:y().bool.isRequired,providerAlias:y().string.isRequired,providerDisplayAlias:y().string.isRequired,onSave:y().func.isRequired,onClose:y().func.isRequired}}},e=>{e.O(0,[7848,4335,6795,8872,505,4156,2347,5158,7358],()=>e(e.s=7207)),_N_E=e.O()}]);
|
package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-d8aedd72c61ec172.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8460],{43007:(e,t,s)=>{Promise.resolve().then(s.bind(s,69692))},69692:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>b});var r=s(73365),a=s(1521),l=s(86447),i=s.n(l),n=s(74156),o=s(68266),d=s(43202),c=s(82495),p=s(99568),m=s.n(p),x=s(14793);let u={available:{icon:"check_circle",color:"#22c55e",label:"Available"},cooldown:{icon:"schedule",color:"#f59e0b",label:"Cooldown"},unavailable:{icon:"error",color:"#ef4444",label:"Unavailable"},unknown:{icon:"help",color:"#6b7280",label:"Unknown"}};function h(){let[e,t]=(0,a.useState)(null),[s,l]=(0,a.useState)(!0),[i,o]=(0,a.useState)(!1),[d,c]=(0,a.useState)(null),p=(0,a.useRef)(null),m=(0,x.i)(),h=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/availability");if(e.ok){let s=await e.json();t(s)}}catch{}finally{l(!1)}},[]);(0,a.useEffect)(()=>{h();let e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),(0,a.useEffect)(()=>{let e=e=>{p.current&&!p.current.contains(e.target)&&o(!1)};return i&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);let f=async(e,t)=>{c(`${e}:${t}`);try{(await fetch("/api/models/availability",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clearCooldown",provider:e,model:t})})).ok?(m.success(`Cooldown cleared for ${t}`),await h()):m.error("Failed to clear cooldown")}catch{m.error("Failed to clear cooldown")}finally{c(null)}};if(s)return null;let b=e?.models||[],v=0===(e?.unavailableCount||b.filter(e=>"available"!==e.status).length),g={};return b.forEach(e=>{if("available"===e.status)return;let t=e.provider||"unknown";g[t]||(g[t]=[]),g[t].push(e)}),(0,r.jsx)("div",{className:"relative",ref:p,children:i&&(0,r.jsxs)("div",{className:"absolute top-full right-0 mt-2 w-80 bg-surface border border-border rounded-xl shadow-2xl z-50 overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-bg",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",style:{color:v?"#22c55e":"#f59e0b"},children:v?"verified":"warning"}),(0,r.jsx)("span",{className:"text-sm font-semibold text-text-main",children:"Model Status"})]}),(0,r.jsx)("button",{onClick:h,className:"p-1 rounded-lg hover:bg-surface text-text-muted hover:text-text-main transition-colors",title:"Refresh",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"})})]}),(0,r.jsx)("div",{className:"px-4 py-3 max-h-60 overflow-y-auto",children:v?(0,r.jsx)("p",{className:"text-sm text-text-muted text-center py-2",children:"All models are responding normally."}):(0,r.jsx)("div",{className:"flex flex-col gap-2.5",children:Object.entries(g).map(([e,t])=>(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs font-semibold text-text-main mb-1.5 capitalize",children:e}),(0,r.jsx)("div",{className:"flex flex-col gap-1",children:t.map(e=>{let t=u[e.status]||u.unknown,s=d===`${e.provider}:${e.model}`;return(0,r.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5 rounded-lg bg-surface/30",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] shrink-0",style:{color:t.color},children:t.icon}),(0,r.jsx)("span",{className:"font-mono text-xs text-text-main truncate",children:e.model})]}),"cooldown"===e.status&&(0,r.jsx)(n.$n,{size:"sm",variant:"ghost",onClick:()=>f(e.provider,e.model),disabled:s,className:"text-[10px] px-1.5! py-0.5! ml-2",children:s?"...":"Clear"})]},`${e.provider}-${e.model}`)})})]},e))})})]})})}function f(e,t,s){let a=[];if(e>0&&a.push((0,r.jsxs)(n.Ex,{variant:"success",size:"sm",dot:!0,children:[e," Connected"]},"connected")),t>0){let e=s?`${t} Error (${s})`:`${t} Error`;a.push((0,r.jsx)(n.Ex,{variant:"error",size:"sm",dot:!0,children:e},"error"))}return 0===a.length?(0,r.jsx)("span",{className:"text-text-muted",children:"No connections"}):a}function b(){let[e,t]=(0,a.useState)([]),[s,l]=(0,a.useState)([]),[i,o]=(0,a.useState)(!0),[p,m]=(0,a.useState)(!1),[u,f]=(0,a.useState)(!1),[b,C]=(0,a.useState)(null),[k,T]=(0,a.useState)(null),w=(0,x.i)();(0,a.useEffect)(()=>{(async()=>{try{let[e,s]=await Promise.all([fetch("/api/providers"),fetch("/api/provider-nodes")]),r=await e.json(),a=await s.json();e.ok&&t(r.connections||[]),s.ok&&l(a.nodes||[])}catch(e){console.log("Error fetching data:",e)}finally{o(!1)}})()},[]);let A=(t,s)=>{let r=e.filter(e=>e.provider===t&&e.authType===s),a=e=>{let t=Object.entries(e).some(([e,t])=>e.startsWith("modelLock_")&&t&&new Date(t).getTime()>Date.now());return"unavailable"!==e.testStatus||t?e.testStatus:"active"},l=r.filter(e=>{let t=a(e);return"active"===t||"success"===t}).length,i=r.filter(e=>{let t=a(e);return"error"===t||"expired"===t||"unavailable"===t}),n=i.length,o=r.length,d=o>0&&r.every(e=>!1===e.isActive),c=i.sort((e,t)=>new Date(t.lastErrorAt||0)-new Date(e.lastErrorAt||0))[0];return{connected:l,error:n,total:o,errorCode:c?function(e){if(!e)return null;let t=e.lastErrorType;if("runtime_error"===t)return"RUNTIME";if("upstream_auth_error"===t||"auth_missing"===t||"token_refresh_failed"===t||"token_expired"===t)return"AUTH";if("upstream_rate_limited"===t)return"429";if("upstream_unavailable"===t)return"5XX";if("network_error"===t)return"NET";let s=Number(e.errorCode);if(Number.isFinite(s)&&s>=400)return String(s);let r=function(e){if(!e)return null;let t=e.match(/\b([45]\d{2})\b/);return t?t[1]:"ERR"}(e.lastError);if("401"===r||"403"===r)return"AUTH";if(r&&"ERR"!==r)return r;let a=(e.lastError||"").toLowerCase();return a.includes("runtime")||a.includes("not runnable")||a.includes("not installed")?"RUNTIME":a.includes("invalid api key")||a.includes("token invalid")||a.includes("revoked")||a.includes("unauthorized")?"AUTH":"ERR"}(c):null,errorTime:c?.lastErrorAt?function(e){if(!e)return"";let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let s=Math.floor(t/60);if(s<24)return`${s}h ago`;let r=Math.floor(s/24);return`${r}d ago`}(c.lastErrorAt):null,allDisabled:d}},I=async(s,r,a)=>{let l=e.filter(e=>e.provider===s&&e.authType===r);t(e=>e.map(e=>e.provider===s&&e.authType===r?{...e,isActive:a}:e)),await Promise.allSettled(l.map(e=>fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:a})})))},E=async(e,t=null)=>{if(!b){C("provider"===e?t:e),T(null);try{let s=await fetch("/api/providers/test-batch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e,providerId:t})}),r=await s.json();if(T(r),r.summary){let{passed:e,failed:t,total:s}=r.summary;0===t?w.success(`All ${s} tests passed`):w.warning(`${e}/${s} passed, ${t} failed`)}}catch(e){T({error:"Test request failed"}),w.error("Provider test failed")}finally{C(null)}}},$=s.filter(e=>"openai-compatible"===e.type).map(e=>({id:e.id,name:e.name||"OpenAI Compatible",color:"#10A37F",textIcon:"OC",apiType:e.apiType})),R=s.filter(e=>"anthropic-compatible"===e.type).map(e=>({id:e.id,name:e.name||"Anthropic Compatible",color:"#D97757",textIcon:"AC"}));return i?(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsx)(n.Qv,{}),(0,r.jsx)(n.Qv,{})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold flex items-center gap-2",children:"OAuth Providers"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(h,{}),(0,r.jsxs)("button",{onClick:()=>E("oauth"),disabled:!!b,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-colors ${"oauth"===b?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg border-border text-text-muted hover:text-text-main hover:border-primary/40"}`,title:"Test all OAuth connections","aria-label":"Test all OAuth connections",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px]${"oauth"===b?" animate-spin":""}`,children:"play_arrow"}),"oauth"===b?"Testing...":"Test All"]})]})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Object.entries(d.zN).map(([e,t])=>(0,r.jsx)(v,{providerId:e,provider:t,stats:A(e,"oauth"),authType:"oauth",onToggle:t=>I(e,"oauth",t)},e))})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold flex items-center gap-2",children:"Free & Free Tier Providers"}),(0,r.jsxs)("button",{onClick:()=>E("free"),disabled:!!b,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-colors ${"free"===b?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg border-border text-text-muted hover:text-text-main hover:border-primary/40"}`,title:"Test all Free connections","aria-label":"Test all Free provider connections",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px]${"free"===b?" animate-spin":""}`,children:"play_arrow"}),"free"===b?"Testing...":"Test All"]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[Object.entries(c.IS).map(([e,t])=>(0,r.jsx)(v,{providerId:e,provider:t,stats:A(e,"oauth"),authType:"free",onToggle:t=>I(e,"oauth",t)},e)),Object.entries(c.nJ).map(([e,t])=>(0,r.jsx)(g,{providerId:e,provider:t,stats:A(e,"apikey"),authType:"apikey",onToggle:t=>I(e,"apikey",t)},e))]})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("h2",{className:"text-xl font-semibold flex items-center gap-2",children:["API Key Providers"," "]}),(0,r.jsxs)("button",{onClick:()=>E("apikey"),disabled:!!b,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-colors ${"apikey"===b?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg border-border text-text-muted hover:text-text-main hover:border-primary/40"}`,title:"Test all API Key connections","aria-label":"Test all API Key connections",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px]${"apikey"===b?" animate-spin":""}`,children:"play_arrow"}),"apikey"===b?"Testing...":"Test All"]})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Object.entries(d.fg).filter(([,e])=>(e.serviceKinds??["llm"]).includes("llm")).map(([e,t])=>(0,r.jsx)(g,{providerId:e,provider:t,stats:A(e,"apikey"),authType:"apikey",onToggle:t=>I(e,"apikey",t)},e))})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("h2",{className:"text-xl font-semibold flex items-center gap-2",children:["API Key Compatible Providers"," "]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(n.$n,{size:"sm",icon:"add",onClick:()=>f(!0),children:"Add Anthropic Compatible"}),(0,r.jsx)(n.$n,{size:"sm",variant:"secondary",icon:"add",onClick:()=>m(!0),className:"!bg-white !text-black hover:!bg-gray-100",children:"Add OpenAI Compatible"})]})]}),0===$.length&&0===R.length?(0,r.jsxs)("div",{className:"text-center py-8 border border-dashed border-border rounded-xl",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[32px] text-text-muted mb-2",children:"extension"}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:"No compatible providers added yet"}),(0,r.jsx)("p",{className:"text-text-muted text-xs mt-1",children:"Use the buttons above to add OpenAI or Anthropic compatible endpoints"})]}):(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[...$,...R].map(e=>(0,r.jsx)(g,{providerId:e.id,provider:e,stats:A(e.id,"apikey"),authType:"compatible",onToggle:t=>I(e.id,"apikey",t)},e.id))})]}),(0,r.jsx)(j,{isOpen:p,onClose:()=>m(!1),onCreated:e=>{l(t=>[...t,e]),m(!1)}}),(0,r.jsx)(y,{isOpen:u,onClose:()=>f(!1),onCreated:e=>{l(t=>[...t,e]),f(!1)}}),k&&(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[10vh]",onClick:()=>T(null),children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),(0,r.jsxs)("div",{className:"relative bg-surface border border-border rounded-xl w-full max-w-[600px] max-h-[80vh] overflow-y-auto shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"sticky top-0 z-10 flex items-center justify-between px-5 py-3 border-b border-border bg-surface/95 backdrop-blur-sm rounded-t-xl",children:[(0,r.jsx)("h3",{className:"font-semibold",children:"Test Results"}),(0,r.jsx)("button",{onClick:()=>T(null),className:"p-1 rounded-lg hover:bg-bg text-text-muted hover:text-text-main transition-colors","aria-label":"Close test results",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]}),(0,r.jsx)("div",{className:"p-5",children:(0,r.jsx)(N,{results:k})})]})]})]})}function v({providerId:e,provider:t,stats:s,authType:a,onToggle:l}){let{connected:i,error:d,errorCode:c,errorTime:p,allDisabled:x}=s,u=!!t.noAuth;return(0,r.jsx)(m(),{href:`/dashboard/providers/${e}`,className:"group",children:(0,r.jsx)(n.Zp,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${x?"opacity-50":""}`,children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color?.length>7?t.color:t.color+"15"}`},children:(0,r.jsx)(o.A,{src:`/providers/${t.id}.png`,alt:t.name,size:30,className:"object-contain rounded-lg max-w-[32px] max-h-[32px]",fallbackText:t.textIcon||t.id.slice(0,2).toUpperCase(),fallbackColor:t.color})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-semibold",children:t.name}),(0,r.jsx)("div",{className:"flex items-center gap-2 text-xs flex-wrap",children:x?(0,r.jsx)(n.Ex,{variant:"default",size:"sm",children:(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"pause_circle"}),"Disabled"]})}):u?(0,r.jsx)(n.Ex,{variant:"success",size:"sm",dot:!0,children:"Ready"}):(0,r.jsxs)(r.Fragment,{children:[f(i,d,c),p&&(0,r.jsx)("span",{className:"text-text-muted",children:p})]})})]})]}),(0,r.jsx)("div",{className:"flex items-center gap-2",children:s.total>0&&(0,r.jsx)("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity",onClick:e=>{e.preventDefault(),e.stopPropagation(),l(!!x)},children:(0,r.jsx)(n.lM,{size:"sm",checked:!x,onChange:()=>{},title:x?"Enable provider":"Disable provider"})})})]})})})}function g({providerId:e,provider:t,stats:s,authType:a,onToggle:l}){let{connected:i,error:d,errorCode:p,errorTime:x,allDisabled:u}=s,h=e.startsWith(c.JH),b=e.startsWith(c.DI);return(0,r.jsx)(m(),{href:`/dashboard/providers/${e}`,className:"group",children:(0,r.jsx)(n.Zp,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${u?"opacity-50":""}`,children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color?.length>7?t.color:t.color+"15"}`},children:(0,r.jsx)(o.A,{src:h?"responses"===t.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":b?"/providers/anthropic-m.png":`/providers/${t.id}.png`,alt:t.name,size:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",fallbackText:t.textIcon||t.id.slice(0,2).toUpperCase(),fallbackColor:t.color})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-semibold",children:t.name}),(0,r.jsx)("div",{className:"flex items-center gap-2 text-xs flex-wrap",children:u?(0,r.jsx)(n.Ex,{variant:"default",size:"sm",children:(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"pause_circle"}),"Disabled"]})}):(0,r.jsxs)(r.Fragment,{children:[f(i,d,p),h&&(0,r.jsx)(n.Ex,{variant:"default",size:"sm",children:"responses"===t.apiType?"Responses":"Chat"}),b&&(0,r.jsx)(n.Ex,{variant:"default",size:"sm",children:"Messages"}),x&&(0,r.jsx)("span",{className:"text-text-muted",children:x})]})})]})]}),(0,r.jsx)("div",{className:"flex items-center gap-2",children:s.total>0&&(0,r.jsx)("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity",onClick:e=>{e.preventDefault(),e.stopPropagation(),l(!!u)},children:(0,r.jsx)(n.lM,{size:"sm",checked:!u,onChange:()=>{},title:u?"Enable provider":"Disable provider"})})})]})})})}function j({isOpen:e,onClose:t,onCreated:s}){let[l,i]=(0,a.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[o,d]=(0,a.useState)(!1),[c,p]=(0,a.useState)(""),[m,x]=(0,a.useState)(""),[u,h]=(0,a.useState)(!1),[f,b]=(0,a.useState)(null);(0,a.useEffect)(()=>{i(e=>({...e,baseUrl:"https://api.openai.com/v1"}))},[l.apiType]);let v=async()=>{if(l.name.trim()&&l.prefix.trim()&&l.baseUrl.trim()){d(!0);try{let e=await fetch("/api/provider-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:l.name,prefix:l.prefix,apiType:l.apiType,baseUrl:l.baseUrl,type:"openai-compatible"})}),t=await e.json();e.ok&&(s(t.node),i({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),p(""),b(null))}catch(e){console.log("Error creating OpenAI Compatible node:",e)}finally{d(!1)}}},g=async()=>{h(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:l.baseUrl,apiKey:c,type:"openai-compatible",modelId:m.trim()||void 0})}),t=await e.json();b(t)}catch{b({valid:!1,error:"Network error"})}finally{h(!1)}};return(0,r.jsx)(n.aF,{isOpen:e,title:"Add OpenAI Compatible",onClose:t,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(n.pd,{label:"Name",value:l.name,onChange:e=>i({...l,name:e.target.value}),placeholder:"OpenAI Compatible (Prod)",hint:"Required. A friendly label for this node."}),(0,r.jsx)(n.pd,{label:"Prefix",value:l.prefix,onChange:e=>i({...l,prefix:e.target.value}),placeholder:"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),(0,r.jsx)(n.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:l.apiType,onChange:e=>i({...l,apiType:e.target.value})}),(0,r.jsx)(n.pd,{label:"Base URL",value:l.baseUrl,onChange:e=>i({...l,baseUrl:e.target.value}),placeholder:"https://api.openai.com/v1",hint:"Use the base URL (ending in /v1) for your OpenAI-compatible API."}),(0,r.jsx)(n.pd,{label:"API Key (for Check)",type:"password",value:c,onChange:e=>p(e.target.value)}),(0,r.jsx)(n.pd,{label:"Model ID (optional)",value:m,onChange:e=>x(e.target.value),placeholder:"e.g. gpt-4, claude-3-opus",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(n.$n,{onClick:g,disabled:!c||u||!l.baseUrl.trim(),variant:"secondary",children:u?"Checking...":"Check"}),(()=>{if(!f)return null;let{valid:e,error:t,method:s}=f;return e?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.Ex,{variant:"success",children:"Valid"}),"chat"===s&&(0,r.jsx)("span",{className:"text-sm text-text-muted",children:"(via inference test)"})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)(n.Ex,{variant:"error",children:"Invalid"}),t&&(0,r.jsx)("span",{className:"text-sm text-red-500",children:t})]})})()]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(n.$n,{onClick:v,fullWidth:!0,disabled:!l.name.trim()||!l.prefix.trim()||!l.baseUrl.trim()||o,children:o?"Creating...":"Create"}),(0,r.jsx)(n.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function y({isOpen:e,onClose:t,onCreated:s}){let[l,i]=(0,a.useState)({name:"",prefix:"",baseUrl:"https://api.anthropic.com/v1"}),[o,d]=(0,a.useState)(!1),[c,p]=(0,a.useState)(""),[m,x]=(0,a.useState)(""),[u,h]=(0,a.useState)(!1),[f,b]=(0,a.useState)(null);(0,a.useEffect)(()=>{e&&(b(null),p(""),x(""))},[e]);let v=async()=>{if(l.name.trim()&&l.prefix.trim()&&l.baseUrl.trim()){d(!0);try{let e=await fetch("/api/provider-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:l.name,prefix:l.prefix,baseUrl:l.baseUrl,type:"anthropic-compatible"})}),t=await e.json();e.ok&&(s(t.node),i({name:"",prefix:"",baseUrl:"https://api.anthropic.com/v1"}),p(""),b(null))}catch(e){console.log("Error creating Anthropic Compatible node:",e)}finally{d(!1)}}},g=async()=>{h(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:l.baseUrl,apiKey:c,type:"anthropic-compatible",modelId:m.trim()||void 0})}),t=await e.json();b(t)}catch{b({valid:!1,error:"Network error"})}finally{h(!1)}};return(0,r.jsx)(n.aF,{isOpen:e,title:"Add Anthropic Compatible",onClose:t,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(n.pd,{label:"Name",value:l.name,onChange:e=>i({...l,name:e.target.value}),placeholder:"Anthropic Compatible (Prod)",hint:"Required. A friendly label for this node."}),(0,r.jsx)(n.pd,{label:"Prefix",value:l.prefix,onChange:e=>i({...l,prefix:e.target.value}),placeholder:"ac-prod",hint:"Required. Used as the provider prefix for model IDs."}),(0,r.jsx)(n.pd,{label:"Base URL",value:l.baseUrl,onChange:e=>i({...l,baseUrl:e.target.value}),placeholder:"https://api.anthropic.com/v1",hint:"Use the base URL (ending in /v1) for your Anthropic-compatible API. The system will append /messages."}),(0,r.jsx)(n.pd,{label:"API Key (for Check)",type:"password",value:c,onChange:e=>p(e.target.value)}),(0,r.jsx)(n.pd,{label:"Model ID (optional)",value:m,onChange:e=>x(e.target.value),placeholder:"e.g. claude-3-opus",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(n.$n,{onClick:g,disabled:!c||u||!l.baseUrl.trim(),variant:"secondary",children:u?"Checking...":"Check"}),(()=>{if(!f)return null;let{valid:e,error:t,method:s}=f;return e?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.Ex,{variant:"success",children:"Valid"}),"chat"===s&&(0,r.jsx)("span",{className:"text-sm text-text-muted",children:"(via inference test)"})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)(n.Ex,{variant:"error",children:"Invalid"}),t&&(0,r.jsx)("span",{className:"text-sm text-red-500",children:t})]})})()]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(n.$n,{onClick:v,fullWidth:!0,disabled:!l.name.trim()||!l.prefix.trim()||!l.baseUrl.trim()||o,children:o?"Creating...":"Create"}),(0,r.jsx)(n.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function N({results:e}){if(e.error&&!e.results)return(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-red-500 text-[32px] mb-2 block",children:"error"}),(0,r.jsx)("p",{className:"text-sm text-red-400",children:e.error})]});let{summary:t,mode:s}=e,a=e.results||[];return(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[t&&(0,r.jsxs)("div",{className:"flex items-center gap-3 text-xs mb-1",children:[(0,r.jsxs)("span",{className:"text-text-muted",children:[{oauth:"OAuth",free:"Free",apikey:"API Key",provider:"Provider",all:"All"}[s]||s," Test"]}),(0,r.jsxs)("span",{className:"px-2 py-0.5 rounded bg-emerald-500/15 text-emerald-400 font-medium",children:[t.passed," passed"]}),t.failed>0&&(0,r.jsxs)("span",{className:"px-2 py-0.5 rounded bg-red-500/15 text-red-400 font-medium",children:[t.failed," failed"]}),(0,r.jsxs)("span",{className:"text-text-muted ml-auto",children:[t.total," tested"]})]}),a.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs px-3 py-2 rounded-lg bg-black/[0.03] dark:bg-white/[0.03]",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[16px] ${e.valid?"text-emerald-500":"text-red-500"}`,children:e.valid?"check_circle":"error"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("span",{className:"font-medium",children:e.connectionName}),(0,r.jsxs)("span",{className:"text-text-muted ml-1.5",children:["(",e.provider,")"]})]}),void 0!==e.latencyMs&&(0,r.jsxs)("span",{className:"text-text-muted font-mono tabular-nums",children:[e.latencyMs,"ms"]}),(0,r.jsx)("span",{className:`text-[10px] uppercase font-bold px-1.5 py-0.5 rounded ${e.valid?"bg-emerald-500/15 text-emerald-400":"bg-red-500/15 text-red-400"}`,children:e.valid?"OK":e.diagnosis?.type||"ERROR"})]},e.connectionId||t)),0===a.length&&(0,r.jsx)("div",{className:"text-center py-4 text-text-muted text-sm",children:"No active connections found for this group."})]})}v.propTypes={providerId:i().string.isRequired,provider:i().shape({id:i().string.isRequired,name:i().string.isRequired,color:i().string,textIcon:i().string}).isRequired,stats:i().shape({connected:i().number,error:i().number,errorCode:i().string,errorTime:i().string}).isRequired,authType:i().string,onToggle:i().func},g.propTypes={providerId:i().string.isRequired,provider:i().shape({id:i().string.isRequired,name:i().string.isRequired,color:i().string,textIcon:i().string,apiType:i().string}).isRequired,stats:i().shape({connected:i().number,error:i().number,errorCode:i().string,errorTime:i().string}).isRequired,authType:i().string,onToggle:i().func},j.propTypes={isOpen:i().bool.isRequired,onClose:i().func.isRequired,onCreated:i().func.isRequired},y.propTypes={isOpen:i().bool.isRequired,onClose:i().func.isRequired,onCreated:i().func.isRequired},N.propTypes={results:i().shape({mode:i().string,results:i().array,summary:i().shape({total:i().number,passed:i().number,failed:i().number}),error:i().string}).isRequired}}},e=>{e.O(0,[7848,4335,6795,505,4156,2347,5158,7358],()=>e(e.s=43007)),_N_E=e.O()}]);
|
package/app/.next/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-b675d50ce82d5577.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6812],{26491:(e,t,r)=>{Promise.resolve().then(r.bind(r,85148))},85148:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var l=r(73365),s=r(1521),o=r(74156),a=r(14793);function i(e={}){return{name:e.name||"",proxyUrl:e.proxyUrl||"",noProxy:e.noProxy||"",isActive:!1!==e.isActive,strictProxy:!0===e.strictProxy}}function n(){let[e,t]=(0,s.useState)([]),[r,n]=(0,s.useState)(!0),[c,d]=(0,s.useState)(!1),[x,p]=(0,s.useState)(!1),[m,h]=(0,s.useState)(!1),[u,y]=(0,s.useState)(null),[f,v]=(0,s.useState)(i()),[j,g]=(0,s.useState)(""),[b,N]=(0,s.useState)({vercelToken:"",projectName:"vercel-relay"}),[k,P]=(0,s.useState)(!1),[w,C]=(0,s.useState)(!1),[$,S]=(0,s.useState)(!1),[E,U]=(0,s.useState)(null),T=(0,a.i)(),A=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/proxy-pools?includeUsage=true",{cache:"no-store"}),r=await e.json();e.ok&&t(r.proxyPools||[])}catch(e){console.log("Error fetching proxy pools:",e)}finally{n(!1)}},[]);(0,s.useEffect)(()=>{A()},[A]);let I=()=>{y(null),v(i())},O=()=>{I(),d(!0)},D=()=>{d(!1),I()},F=async()=>{let e={name:f.name.trim(),proxyUrl:f.proxyUrl.trim(),noProxy:f.noProxy.trim(),isActive:!0===f.isActive,strictProxy:!0===f.strictProxy};if(e.name&&e.proxyUrl){P(!0);try{let t=!!u,r=await fetch(t?`/api/proxy-pools/${u.id}`:"/api/proxy-pools",{method:t?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok)await A(),D(),T.success(u?"Proxy pool updated":"Proxy pool created");else{let e=await r.json();T.error(e.error||"Failed to save proxy pool")}}catch(e){console.log("Error saving proxy pool:",e)}finally{P(!1)}}},V=async e=>{if(confirm(`Delete proxy pool "${e.name}"?`))try{let r=await fetch(`/api/proxy-pools/${e.id}`,{method:"DELETE"});if(r.ok){t(t=>t.filter(t=>t.id!==e.id)),T.success("Proxy pool deleted");return}let l=await r.json();409===r.status?T.warning(`Cannot delete: ${l.boundConnectionCount||0} connection(s) are still using this pool.`):T.error(l.error||"Failed to delete proxy pool")}catch(e){console.log("Error deleting proxy pool:",e),T.error("Failed to delete proxy pool")}},L=async e=>{U(e);try{let t=await fetch(`/api/proxy-pools/${e}/test`,{method:"POST"}),r=await t.json();if(!t.ok)return void T.error(r.error||"Failed to test proxy");await A(),T.success(r.ok?"Proxy test passed":"Proxy test failed")}catch(e){console.log("Error testing proxy pool:",e),T.error("Failed to test proxy")}finally{U(null)}},_=()=>{w||p(!1)},R=()=>{$||h(!1)},W=async()=>{if(b.vercelToken.trim()){S(!0);try{let e=await fetch("/api/proxy-pools/vercel-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),t=await e.json();e.ok?(await A(),R(),T.success(`Deployed: ${t.deployUrl}`)):T.error(t.error||"Deploy failed")}catch(e){console.log("Error deploying Vercel relay:",e),T.error("Deploy failed")}finally{S(!1)}}},B=async()=>{let t=j.split(/\r?\n/).map(e=>e.trim()).filter(Boolean);if(0===t.length)return void T.warning("Please paste at least one proxy line.");let r=[],l=[];if(t.forEach((e,t)=>{try{let l=(e=>{let t=e.trim();if(!t)return null;if(t.includes("://")){let e=new URL(t),r=e.port?`${e.hostname}:${e.port}`:e.hostname;return{proxyUrl:e.toString(),name:`Imported ${r}`}}let r=t.split(":");if(4===r.length){let[e,t,l,s]=r;if(!e||!t||!l||!s)throw Error("Invalid host:port:user:pass format");return{proxyUrl:new URL(`http://${encodeURIComponent(l)}:${encodeURIComponent(s)}@${e}:${t}`).toString(),name:`Imported ${e}:${t}`}}throw Error("Unsupported format")})(e);l&&r.push({...l,lineNumber:t+1})}catch(e){l.push(`Line ${t+1}: ${e.message}`)}}),l.length>0)return void T.error(`Invalid proxy format:
|
|
2
|
-
${l.join("\n")}`);C(!0);try{let t=new Set(e.map(e=>`${(e.proxyUrl||"").trim()}|||${(e.noProxy||"").trim()}`)),l=0,s=0,o=0;for(let e of r){let r=`${e.proxyUrl}|||`;if(t.has(r)){s+=1;continue}(await fetch("/api/proxy-pools",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,proxyUrl:e.proxyUrl,noProxy:"",isActive:!0})})).ok?(l+=1,t.add(r)):o+=1}await A(),p(!1),T.success(`Batch import completed: Created ${l}, Skipped ${s}, Failed ${o}`)}catch(e){console.log("Error batch importing proxies:",e),T.error("Batch import failed")}finally{C(!1)}},z=(0,s.useMemo)(()=>e.filter(e=>!0===e.isActive).length,[e]);return r?(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsx)(o.Qv,{}),(0,l.jsx)(o.Qv,{})]}):(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"text-2xl font-semibold",children:"Proxy Pools"}),(0,l.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Manage reusable per-connection proxies and bind them to provider connections."})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(o.$n,{variant:"secondary",icon:"cloud_upload",onClick:()=>{N({vercelToken:"",projectName:"vercel-relay"}),h(!0)},children:"Vercel Relay"}),(0,l.jsx)(o.$n,{variant:"secondary",icon:"upload",onClick:()=>{g(""),p(!0)},children:"Batch Import"}),(0,l.jsx)(o.$n,{icon:"add",onClick:O,children:"Add Proxy Pool"})]})]}),(0,l.jsxs)(o.Zp,{children:[(0,l.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(o.Ex,{variant:"default",children:["Total: ",e.length]}),(0,l.jsxs)(o.Ex,{variant:"success",children:["Active: ",z]})]})}),0===e.length?(0,l.jsxs)("div",{className:"text-center py-10",children:[(0,l.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No proxy pool entries yet"}),(0,l.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Create a proxy pool entry, then assign it to connections."}),(0,l.jsx)(o.$n,{icon:"add",onClick:O,children:"Add Proxy Pool"})]}):(0,l.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.04] dark:divide-white/[0.05]",children:e.map(e=>{var t;return(0,l.jsxs)("div",{className:"py-3 flex items-center justify-between gap-3 group",children:[(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,l.jsx)("p",{className:"text-sm font-medium truncate",children:e.name}),(0,l.jsx)(o.Ex,{variant:"active"===(t=e.testStatus)?"success":"error"===t?"error":"default",size:"sm",dot:!0,children:e.testStatus||"unknown"}),(0,l.jsx)(o.Ex,{variant:e.isActive?"success":"default",size:"sm",children:e.isActive?"active":"inactive"}),"vercel"===e.type&&(0,l.jsx)(o.Ex,{variant:"default",size:"sm",children:"vercel relay"}),(0,l.jsxs)(o.Ex,{variant:"default",size:"sm",children:[e.boundConnectionCount||0," bound"]})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate mt-1",children:e.proxyUrl}),e.noProxy?(0,l.jsxs)("p",{className:"text-xs text-text-muted truncate",children:["No proxy: ",e.noProxy]}):null,(0,l.jsxs)("p",{className:"text-[11px] text-text-muted mt-1",children:["Last tested: ",function(e){if(!e)return"Never";let t=new Date(e);return Number.isNaN(t.getTime())?"Never":t.toLocaleString()}(e.lastTestedAt),e.lastError?` \xb7 ${e.lastError}`:""]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,l.jsx)("button",{onClick:()=>L(e.id),className:"p-2 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary",title:"Test proxy",disabled:E===e.id,children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",style:E===e.id?{animation:"spin 1s linear infinite"}:void 0,children:E===e.id?"progress_activity":"science"})}),(0,l.jsx)("button",{onClick:()=>{y(e),v(i(e)),d(!0)},className:"p-2 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary",title:"Edit",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,l.jsx)("button",{onClick:()=>V(e),className:"p-2 rounded hover:bg-red-500/10 text-red-500",title:"Delete",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]},e.id)})})]}),(0,l.jsx)(o.aF,{isOpen:x,title:"Batch Import Proxies",onClose:_,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"text-sm font-medium text-text-main mb-1 block",children:"Paste Proxy List (One per line)"}),(0,l.jsx)("textarea",{value:j,onChange:e=>g(e.target.value),placeholder:"http://user:pass@127.0.0.1:7897\n127.0.0.1:7897:user:pass",className:"w-full min-h-[180px] py-2 px-3 text-sm text-text-main bg-white dark:bg-white/5 border border-black/10 dark:border-white/10 rounded-md focus:ring-1 focus:ring-primary/30 focus:border-primary/50 focus:outline-none transition-all"}),(0,l.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Supported formats: protocol://user:pass@host:port, host:port:user:pass"})]}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:B,disabled:!j.trim()||w,children:w?"Importing...":"Import"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:_,disabled:w,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:m,title:"Deploy Vercel Relay",onClose:R,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"rounded-lg bg-blue-500/5 border border-blue-500/10 p-3 flex flex-col gap-1.5",children:[(0,l.jsx)("p",{className:"text-sm text-text-main font-medium",children:"What is Vercel Relay?"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Deploys an edge relay function to Vercel. All AI provider requests will be forwarded through Vercel's edge network, masking your real IP from providers."}),(0,l.jsxs)("ul",{className:"text-xs text-text-muted list-disc pl-4 space-y-0.5",children:[(0,l.jsx)("li",{children:"Your IP is replaced by Vercel's dynamic edge IPs (hundreds of IPs across 20+ global regions)"}),(0,l.jsx)("li",{children:"Vercel serves millions of apps — providers can't block Vercel IPs without affecting legitimate traffic"}),(0,l.jsx)("li",{children:"Free tier: 100GB bandwidth/month, 500K edge invocations"}),(0,l.jsx)("li",{children:"Deploy multiple relays on different accounts for more IP diversity"})]})]}),(0,l.jsx)(o.pd,{label:"Vercel API Token",value:b.vercelToken,onChange:e=>N(t=>({...t,vercelToken:e.target.value})),placeholder:"your-vercel-api-token",hint:(0,l.jsxs)(l.Fragment,{children:["Token is used once for deployment and not stored. ",(0,l.jsx)("a",{href:"https://vercel.com/account/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]}),type:"password"}),(0,l.jsx)(o.pd,{label:"Project Name",value:b.projectName,onChange:e=>N(t=>({...t,projectName:e.target.value})),placeholder:"my-relay",hint:"Unique name for your Vercel project. Leave empty for auto-generated name."}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:W,disabled:!b.vercelToken.trim()||$,children:$?"Deploying... (may take ~1 min)":"Deploy"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:R,disabled:$,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:c,title:u?"Edit Proxy Pool":"Add Proxy Pool",onClose:D,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)(o.pd,{label:"Name",value:f.name,onChange:e=>v(t=>({...t,name:e.target.value})),placeholder:"Office Proxy"}),(0,l.jsx)(o.pd,{label:"Proxy URL",value:f.proxyUrl,onChange:e=>v(t=>({...t,proxyUrl:e.target.value})),placeholder:"http://127.0.0.1:7897"}),(0,l.jsx)(o.pd,{label:"No Proxy",value:f.noProxy,onChange:e=>v(t=>({...t,noProxy:e.target.value})),placeholder:"localhost,127.0.0.1,.internal",hint:"Comma-separated hosts/domains to bypass proxy"}),(0,l.jsxs)("div",{className:"rounded-lg border border-border/50 p-3 flex items-center justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium text-sm",children:"Active"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Inactive pools are ignored by runtime resolution."})]}),(0,l.jsx)(o.lM,{checked:!0===f.isActive,onChange:()=>v(e=>({...e,isActive:!e.isActive})),disabled:k})]}),(0,l.jsxs)("div",{className:"rounded-lg border border-border/50 p-3 flex items-center justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium text-sm",children:"Strict Proxy"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Fail request if proxy is unreachable instead of falling back to direct."})]}),(0,l.jsx)(o.lM,{checked:!0===f.strictProxy,onChange:()=>v(e=>({...e,strictProxy:!e.strictProxy})),disabled:k})]}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:F,disabled:!f.name.trim()||!f.proxyUrl.trim()||k,children:k?"Saving...":"Save"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:D,disabled:k,children:"Cancel"})]})]})})]})}}},e=>{e.O(0,[7848,4335,6795,505,4156,2347,5158,7358],()=>e(e.s=26491)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3826],{58944:(e,t,r)=>{Promise.resolve().then(r.bind(r,59295)),Promise.resolve().then(r.bind(r,91494))},59295:(e,t,r)=>{"use strict";r.d(t,{default:()=>h});var a=r(73365),s=r(1521),l=r(68266),n=r(94718);function i(e,t){return t&&0!==t?!e||e<0?100:e>=t?0:Math.round((t-e)/t*100):0}function o({quotas:e=[],compact:t=!1}){if(!e||0===e.length)return null;let r=t?"py-1.5 px-2":"py-2 px-3",s=t?"text-xs":"text-sm",l=t?"text-xs":"text-sm",n=t?"text-[10px] leading-tight":"text-xs";return(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsx)("table",{className:"w-full table-fixed text-left",children:(0,a.jsx)("tbody",{children:e.map((e,o)=>{let c=void 0!==e.remainingPercentage?Math.round(e.remainingPercentage):i(e.used,e.total),d=c>70?{text:"text-green-600 dark:text-green-400",bg:"bg-green-500",bgLight:"bg-green-500/10",emoji:"\uD83D\uDFE2"}:c>=30?{text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-500",bgLight:"bg-yellow-500/10",emoji:"\uD83D\uDFE1"}:{text:"text-red-600 dark:text-red-400",bg:"bg-red-500",bgLight:"bg-red-500/10",emoji:"\uD83D\uDD34"},u=function(e){if(!e)return"-";try{let t="string"==typeof e?new Date(e):e,r=new Date,a=t-r;if(a<=0)return"-";let s=Math.ceil(a/6e4);if(s<60)return`${s}m`;let l=Math.floor(s/60),n=s%60;if(l<24)return`${l}h ${n}m`;let i=Math.floor(l/24);return`${i}d ${l%24}h ${n}m`}catch(e){return"-"}}(e.resetAt),m=function(e){if(!e)return null;try{let t=new Date(e),r=new Date,a=new Date(r.getFullYear(),r.getMonth(),r.getDate()),s=new Date(a);s.setDate(s.getDate()+1);let l="";l=t>=a&&t<s?"Today":t>=s&&t<new Date(s.getTime()+864e5)?"Tomorrow":t.toLocaleDateString("en-US",{month:"short",day:"numeric"});let n=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${l}, ${n}`}catch{return null}}(e.resetAt);return(0,a.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,a.jsx)("td",{className:`${r} w-[30%]`,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,a.jsx)("span",{className:"text-[10px] shrink-0",children:d.emoji}),(0,a.jsx)("span",{className:`${s} font-medium text-text-primary truncate`,children:e.name})]})}),(0,a.jsx)("td",{className:`${r} w-[45%]`,children:(0,a.jsxs)("div",{className:t?"space-y-1":"space-y-1.5",children:[(0,a.jsx)("div",{className:`${t?"h-1":"h-1.5"} rounded-full overflow-hidden border ${d.bgLight} ${0===c?"border-black/10 dark:border-white/10":"border-transparent"}`,children:(0,a.jsx)("div",{className:`h-full transition-all duration-300 ${d.bg}`,style:{width:`${Math.min(c,100)}%`}})}),(0,a.jsxs)("div",{className:`flex items-center justify-between ${t?"text-[10px]":"text-xs"}`,children:[(0,a.jsxs)("span",{className:"text-text-muted",children:[e.used.toLocaleString()," / ",e.total>0?e.total.toLocaleString():"∞"]}),(0,a.jsxs)("span",{className:`font-medium ${d.text}`,children:[c,"%"]})]})]})}),(0,a.jsx)("td",{className:`${r} w-[25%]`,children:"-"!==u||m?(0,a.jsxs)("div",{className:"space-y-0.5",children:["-"!==u&&(0,a.jsxs)("div",{className:`${l} text-text-primary font-medium`,children:["in ",u]}),m&&(0,a.jsx)("div",{className:`${n} text-text-muted`,children:m})]}):(0,a.jsx)("div",{className:`${l} text-text-muted italic`,children:"N/A"})})]},o)})})})})}var c=r(14406),d=r(292),u=r(38230),m=r(74156),x=r(82495);function h(){let[e,t]=(0,s.useState)([]),[r,h]=(0,s.useState)({}),[p,b]=(0,s.useState)({}),[f,g]=(0,s.useState)({}),[v,y]=(0,s.useState)(!0),[j,w]=(0,s.useState)(null),[N,k]=(0,s.useState)(!1),[$,E]=(0,s.useState)(60),[A,C]=(0,s.useState)(!0),[q,S]=(0,s.useState)(null),[P,D]=(0,s.useState)(null),[L,T]=(0,s.useState)(!1),[O,I]=(0,s.useState)(null),[M,_]=(0,s.useState)([]),[F,R]=(0,s.useState)("all"),[U,z]=(0,s.useState)(!1),K=(0,s.useRef)(null),J=(0,s.useRef)(null),G=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/providers/client");if(!e.ok)throw Error("Failed to fetch connections");let r=(await e.json()).connections||[];return t(r),r}catch(e){return console.error("Error fetching connections:",e),t([]),[]}},[]),H=(0,s.useCallback)(async(e,t)=>{b(t=>({...t,[e]:!0})),g(t=>({...t,[e]:null}));try{console.log(`[ProviderLimits] Fetching quota for ${t} (${e})`);let r=await fetch(`/api/usage/${e}`);if(!r.ok){let a=(await r.json().catch(()=>({}))).error||r.statusText;if(404===r.status)return void console.warn(`[ProviderLimits] Connection not found for ${t}, skipping`);if(401===r.status){console.warn(`[ProviderLimits] Auth error for ${t}:`,a),h(t=>({...t,[e]:{quotas:[],message:a}}));return}throw Error(`HTTP ${r.status}: ${a}`)}let a=await r.json();console.log(`[ProviderLimits] Got quota for ${t}:`,a);let s=function(e,t){if(!t||"object"!=typeof t)return[];let r=[];try{switch(e.toLowerCase()){case"github":default:t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"antigravity":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codex":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"kiro":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"claude":t.message?r.push({name:"error",used:0,total:0,resetAt:null,message:t.message}):t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}let a=(0,n.KC)(e);if(a.length>0){let e=new Map(a.map((e,t)=>[e.id,t]));r.sort((t,r)=>{let a=t.modelKey||t.name,s=r.modelKey||r.name;return(e.get(a)??999)-(e.get(s)??999)})}return r}(t,a);h(t=>({...t,[e]:{quotas:s,plan:a.plan||null,message:a.message||null,raw:a}}))}catch(r){console.error(`[ProviderLimits] Error fetching quota for ${t} (${e}):`,r),g(t=>({...t,[e]:r.message||"Failed to fetch quota"}))}finally{b(t=>({...t,[e]:!1}))}},[]),Y=(0,s.useCallback)(async(e,t)=>{await H(e,t),w(new Date)},[H]),B=(0,s.useCallback)(async e=>{if(confirm("Delete this connection?")){S(e);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&(t(t=>t.filter(t=>t.id!==e)),h(t=>{let r={...t};return delete r[e],r}),b(t=>{let r={...t};return delete r[e],r}),g(t=>{let r={...t};return delete r[e],r}))}catch(e){console.error("Error deleting connection:",e)}finally{S(null)}}},[]),Q=(0,s.useCallback)(async(e,r)=>{D(e);try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:r})})).ok&&t(t=>t.map(t=>t.id===e?{...t,isActive:r}:t))}catch(e){console.error("Error updating connection status:",e)}finally{D(null)}},[]),V=(0,s.useCallback)(async e=>{if(!O?.id)return;let t=O.id,r=O.provider;try{(await fetch(`/api/providers/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await G(),T(!1),I(null),x.wb.includes(r)&&await H(t,r))}catch(e){console.error("Error saving connection:",e)}},[O,G,H]);(0,s.useEffect)(()=>{let e=!1;return fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.json()).then(t=>{!e&&t?.proxyPools&&_(t.proxyPools)}).catch(()=>{}),()=>{e=!0}},[]);let W=(0,s.useCallback)(async()=>{if(!N){k(!0),E(60);try{let e=(await G()).filter(e=>x.wb.includes(e.provider)&&"oauth"===e.authType);await Promise.all(e.map(e=>H(e.id,e.provider))),w(new Date)}catch(e){console.error("Error refreshing all providers:",e)}finally{k(!1)}}},[N,G,H]);(0,s.useEffect)(()=>{(async()=>{C(!0);let e=await G();C(!1);let t=e.filter(e=>x.wb.includes(e.provider)&&"oauth"===e.authType),r={};t.forEach(e=>{r[e.id]=!0}),b(r),await Promise.all(t.map(e=>H(e.id,e.provider))),w(new Date)})()},[]),(0,s.useEffect)(()=>{if(!v){K.current&&(clearInterval(K.current),K.current=null),J.current&&(clearInterval(J.current),J.current=null);return}return K.current=setInterval(()=>{W()},6e4),J.current=setInterval(()=>{E(e=>e<=1?60:e-1)},1e3),()=>{K.current&&clearInterval(K.current),J.current&&clearInterval(J.current)}},[v,W]),(0,s.useEffect)(()=>{let e=()=>{document.hidden?(K.current&&(clearInterval(K.current),K.current=null),J.current&&(clearInterval(J.current),J.current=null)):v&&(K.current=setInterval(W,6e4),J.current=setInterval(()=>{E(e=>e<=1?60:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[v,W]);let X=(0,s.useCallback)(()=>{if(!j)return"Never";let e=Math.floor((new Date-j)/6e4),t=Math.floor(e/60),r=Math.floor(t/24);return r>0?`${r}d ago`:t>0?`${t}h ago`:e>0?`${e}m ago`:"Just now"},[j]),Z=e.filter(e=>x.wb.includes(e.provider)&&"oauth"===e.authType),ee=Z.filter(e=>"all"===F||e.provider===F),et=e=>{let t=(r[e.id]?.quotas||[]).map(e=>e.resetAt?new Date(e.resetAt).getTime():1/0).filter(e=>Number.isFinite(e));return t.length>0?Math.min(...t):1/0},er=[...ee].sort((e,t)=>{if(U){let r=et(e)-et(t);if(0!==r)return r}let r=x.wb.indexOf(e.provider),a=x.wb.indexOf(t.provider);return r!==a?r-a:e.provider.localeCompare(t.provider)}),ea=Array.from(new Set(Z.map(e=>e.provider))).sort();return(er.length,Object.values(r).filter(e=>e?.quotas?.length>0).length,Object.values(r).reduce((e,t)=>t?.quotas?e+ +!!t.quotas.some(e=>30>i(e.used,e.total)&&e.total>0):e,0),A||0!==er.length)?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-text-primary",children:"Provider Limits"}),(0,a.jsxs)("span",{className:"text-sm text-text-muted",children:["Last updated: ",X()]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("select",{value:F,onChange:e=>R(e.target.value),className:"h-10 rounded-lg border border-black/10 bg-transparent px-3 text-sm text-text-primary dark:border-white/10","aria-label":"Filter quota providers",children:[(0,a.jsx)("option",{value:"all",children:"All providers"}),ea.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]}),(0,a.jsxs)("button",{type:"button",onClick:()=>z(e=>!e),className:`flex items-center gap-2 rounded-lg border px-3 py-2 text-sm transition-colors ${U?"border-amber-500/40 bg-amber-500/10 text-amber-500":"border-black/10 text-text-primary hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5"}`,title:"Sort accounts by earliest quota reset time",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"hourglass_top"}),"Expiring first"]}),(0,a.jsxs)("button",{onClick:()=>y(e=>!e),className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-black/10 dark:border-white/10 hover:bg-black/5 dark:hover:bg-white/5 transition-colors",title:v?"Disable auto-refresh":"Enable auto-refresh",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] ${v?"text-primary":"text-text-muted"}`,children:v?"toggle_on":"toggle_off"}),(0,a.jsx)("span",{className:"text-sm text-text-primary",children:"Auto-refresh"}),v&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["(",$,"s)"]})]}),(0,a.jsx)(u.default,{variant:"secondary",size:"md",icon:"refresh",onClick:W,disabled:N,loading:N,children:"Refresh All"})]})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:er.map(e=>{let t,s,n=r[e.id],i=p[e.id],u=f[e.id],m=!1===e.isActive,x=q===e.id||P===e.id;return(0,a.jsxs)(d.default,{padding:"none",className:`min-w-0 ${m?"opacity-60":""}`,children:[(0,a.jsx)("div",{className:"px-4 py-3 border-b border-black/10 dark:border-white/10",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)("div",{className:"w-8 h-8 shrink-0 rounded-md flex items-center justify-center overflow-hidden",children:(0,a.jsx)(l.A,{src:`/providers/${e.provider}.png`,alt:e.provider,size:32,className:"object-contain",fallbackText:e.provider?.slice(0,2).toUpperCase()||"PR"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-primary capitalize truncate",children:e.provider}),(s=(t=e=>"string"==typeof e&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e))(e.email)?e.email:(t(e.name),e.name))?(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:s}):null]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,a.jsx)("button",{type:"button",onClick:()=>Y(e.id,e.provider),disabled:i||x,className:"p-1.5 rounded-lg hover:bg-black/5 dark:hover:bg-white/5 transition-colors disabled:opacity-50",title:"Refresh quota",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted ${i?"animate-spin":""}`,children:"refresh"})}),(0,a.jsx)("button",{type:"button",onClick:()=>{I(e),T(!0)},disabled:x,className:"p-1.5 rounded-lg hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary transition-colors disabled:opacity-50",title:"Edit connection",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,a.jsx)("button",{type:"button",onClick:()=>B(e.id),disabled:x,className:"p-1.5 rounded-lg hover:bg-red-500/10 text-red-500 transition-colors disabled:opacity-50",title:"Delete connection",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] ${q===e.id?"animate-pulse":""}`,children:"delete"})}),(0,a.jsx)("div",{className:"inline-flex items-center pl-0.5",title:e.isActive??!0?"Disable connection":"Enable connection",children:(0,a.jsx)(c.default,{size:"sm",checked:e.isActive??!0,disabled:x,onChange:t=>Q(e.id,t)})})]})]})}),(0,a.jsx)("div",{className:"px-3 py-3",children:i?(0,a.jsx)("div",{className:"text-center py-5 text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px] animate-spin",children:"progress_activity"})}):u?(0,a.jsxs)("div",{className:"text-center py-5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px] text-red-500",children:"error"}),(0,a.jsx)("p",{className:"mt-1.5 text-xs text-text-muted",children:u})]}):n?.message?(0,a.jsx)("div",{className:"text-center py-5",children:(0,a.jsx)("p",{className:"text-xs text-text-muted",children:n.message})}):(0,a.jsx)(o,{quotas:n?.quotas,compact:!0})})]},e.id)})}),(0,a.jsx)(m.wI,{isOpen:L,connection:O,proxyPools:M,onSave:V,onClose:()=>{T(!1),I(null)}})]}):(0,a.jsx)(d.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] text-text-muted opacity-20",children:"cloud_off"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:"No Providers Connected"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:"Connect to providers with OAuth to track your API quota limits and usage."})]})})}}},e=>{e.O(0,[7848,4335,6795,505,4156,2347,5158,7358],()=>e(e.s=58944)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2825],{33154:(e,t,s)=>{Promise.resolve().then(s.bind(s,83101))},83101:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>v});var a=s(73365),r=s(1521),n=s(29717),l=s(74156),i=s(292),d=s(38230),o=s(87706);function c({isOpen:e,onClose:t,title:s,children:n,width:l="md",className:i}){let d={sm:"w-[400px]",md:"w-[500px]",lg:"w-[600px]",xl:"w-[800px]",full:"w-full"};return((0,r.useEffect)(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),(0,r.useEffect)(()=>{let s=s=>{"Escape"===s.key&&e&&t()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,t]),e)?(0,a.jsxs)("div",{className:"fixed inset-0 z-50",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm transition-opacity cursor-pointer",onClick:t,"aria-hidden":"true"}),(0,a.jsxs)("div",{className:(0,o.cn)("absolute right-0 top-0 h-full bg-surface shadow-2xl flex flex-col","animate-in slide-in-from-right duration-200","border-l border-black/10 dark:border-white/10",d[l]||d.md,i),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-black/5 dark:border-white/5 flex-shrink-0",children:[(0,a.jsx)("div",{className:"flex items-center gap-3",children:s&&(0,a.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:s})}),(0,a.jsx)("button",{type:"button",onClick:t,className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto p-6",children:n})]})]}):null}function x({currentPage:e,pageSize:t,totalItems:s,onPageChange:r,onPageSizeChange:n,className:l}){let i=Math.ceil(s/t),c=s>0?(e-1)*t+1:0,m=Math.min(e*t,s),h=(()=>{let t=[],s=Math.max(1,e-2),a=Math.min(i,s+5-1);a-s+1<5&&(s=Math.max(1,a-5+1));for(let e=s;e<=a;e++)t.push(e);return t})();return(0,a.jsxs)("div",{className:(0,o.cn)("flex flex-col sm:flex-row items-center justify-between gap-4 py-4",l),children:[s>0&&(0,a.jsxs)("div",{className:"text-sm text-text-muted",children:["Showing ",(0,a.jsx)("span",{className:"font-medium text-text-main",children:c})," to"," ",(0,a.jsx)("span",{className:"font-medium text-text-main",children:m})," of"," ",(0,a.jsx)("span",{className:"font-medium text-text-main",children:s})," results"]}),(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[n&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"Rows:"}),(0,a.jsx)("select",{value:t,onChange:e=>n(Number(e.target.value)),className:(0,o.cn)("h-9 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20","cursor-pointer"),children:[10,20,50].map(e=>(0,a.jsx)("option",{value:e,children:e},e))})]}),i>1&&(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(d.default,{variant:"outline",size:"sm",onClick:()=>r(e-1),disabled:1===e,className:"w-9 px-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_left"})}),h[0]>1&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.default,{variant:"ghost",size:"sm",onClick:()=>r(1),className:"w-9 px-0",children:"1"}),h[0]>2&&(0,a.jsx)("span",{className:"text-text-muted px-1",children:"..."})]}),h.map(t=>(0,a.jsx)(d.default,{variant:e===t?"primary":"ghost",size:"sm",onClick:()=>r(t),className:"w-9 px-0",children:t},t)),h[h.length-1]<i&&(0,a.jsxs)(a.Fragment,{children:[h[h.length-1]<i-1&&(0,a.jsx)("span",{className:"text-text-muted px-1",children:"..."}),(0,a.jsx)(d.default,{variant:"ghost",size:"sm",onClick:()=>r(i),className:"w-9 px-0",children:i})]}),(0,a.jsx)(d.default,{variant:"outline",size:"sm",onClick:()=>r(e+1),disabled:e===i,className:"w-9 px-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_right"})})]})]})]})}var m=s(82495);let h=null,p=null;async function u(){if(h&&p)return{providerNameCache:h,providerNodesCache:p};let e=await fetch("/api/provider-nodes"),t=(await e.json()).nodes||[];for(let e of(p={},t))p[e.id]=e.name;return{providerNameCache:h={...m.Q2,...p},providerNodesCache:p}}function f(e,t){if(!e||!t)return e;let s=t[e];if("string"==typeof s)return s;if(s?.name)return s.name;let a=(0,m.zt)(e)||m.Q2[e];return a?.name||e}function b({title:e,children:t,defaultOpen:s=!1,icon:n=null}){let[l,i]=(0,r.useState)(s);return(0,a.jsxs)("div",{className:"border border-black/5 dark:border-white/5 rounded-lg overflow-hidden",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>i(!l),className:"w-full flex items-center justify-between p-3 bg-black/[0.02] dark:bg-white/[0.02] hover:bg-black/[0.04] dark:hover:bg-white/[0.04] transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[n&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:n}),(0,a.jsx)("span",{className:"font-semibold text-sm text-text-main",children:e})]}),(0,a.jsx)("span",{className:(0,o.cn)("material-symbols-outlined text-[20px] text-text-muted transition-transform duration-200",l?"rotate-90":""),children:"chevron_right"})]}),l&&(0,a.jsx)("div",{className:"p-4 border-t border-black/5 dark:border-white/5",children:t})]})}function j(e){let t=e?.prompt_tokens||e?.input_tokens||0,s=e?.cached_tokens||e?.cache_read_input_tokens||0;return t<s?s:t}function g(){let[e,t]=(0,r.useState)([]),[s,n]=(0,r.useState)({page:1,pageSize:20,totalItems:0,totalPages:0}),[l,m]=(0,r.useState)(!1),[h,p]=(0,r.useState)(null),[g,v]=(0,r.useState)(!1),[N,k]=(0,r.useState)([]),[w,y]=(0,r.useState)(null),[S,C]=(0,r.useState)({provider:"",startDate:"",endDate:""}),D=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/usage/providers"),t=await e.json();k(t.providers||[]);let s=await u();y(s.providerNameCache)}catch(e){console.error("Failed to fetch providers:",e)}},[]),_=(0,r.useCallback)(async()=>{m(!0);try{let e=new URLSearchParams({page:s.page.toString(),pageSize:s.pageSize.toString()});S.provider&&e.append("provider",S.provider),S.startDate&&e.append("startDate",S.startDate),S.endDate&&e.append("endDate",S.endDate);let a=await fetch(`/api/usage/request-details?${e}`),r=await a.json();t(r.details||[]),n(e=>({...e,...r.pagination}))}catch(e){console.error("Failed to fetch request details:",e)}finally{m(!1)}},[s.page,s.pageSize,S]);return(0,r.useEffect)(()=>{D()},[D]),(0,r.useEffect)(()=>{_()},[_]),(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(i.default,{padding:"md",children:(0,a.jsxs)("div",{className:"flex flex-wrap gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{htmlFor:"provider-filter",className:"text-sm font-medium text-text-main",children:"Provider"}),(0,a.jsxs)("select",{id:"provider-filter",value:S.provider,onChange:e=>C({...S,provider:e.target.value}),className:(0,o.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20","cursor-pointer min-w-[150px]"),children:[(0,a.jsx)("option",{value:"",children:"All Providers"}),N.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{htmlFor:"start-date-filter",className:"text-sm font-medium text-text-main",children:"Start Date"}),(0,a.jsx)("input",{id:"start-date-filter",type:"datetime-local",value:S.startDate,onChange:e=>C({...S,startDate:e.target.value}),className:(0,o.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20")})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{htmlFor:"end-date-filter",className:"text-sm font-medium text-text-main",children:"End Date"}),(0,a.jsx)("input",{id:"end-date-filter",type:"datetime-local",value:S.endDate,onChange:e=>C({...S,endDate:e.target.value}),className:(0,o.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20")})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-text-main opacity-0","aria-hidden":"true",children:"Clear"}),(0,a.jsx)(d.default,{variant:"ghost",onClick:()=>{C({provider:"",startDate:"",endDate:""})},disabled:!S.provider&&!S.startDate&&!S.endDate,children:"Clear Filters"})]})]})}),(0,a.jsxs)(i.default,{padding:"none",children:[(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5",children:[(0,a.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Timestamp"}),(0,a.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Model"}),(0,a.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Provider"}),(0,a.jsx)("th",{className:"text-right p-4 text-sm font-semibold text-text-main",children:"Input Tokens"}),(0,a.jsx)("th",{className:"text-right p-4 text-sm font-semibold text-text-main",children:"Output Tokens"}),(0,a.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Latency"}),(0,a.jsx)("th",{className:"text-center p-4 text-sm font-semibold text-text-main",children:"Action"})]})}),(0,a.jsx)("tbody",{children:l?(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:"7",className:"p-8 text-center text-text-muted",children:(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[20px]",children:"progress_activity"}),"Loading..."]})})}):0===e.length?(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:"7",className:"p-8 text-center text-text-muted",children:"No request details found"})}):e.map((e,t)=>(0,a.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5 last:border-b-0 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,a.jsx)("td",{className:"p-4 text-sm text-text-main",children:new Date(e.timestamp).toLocaleString()}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main font-mono",children:e.model}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main",children:(0,a.jsx)("span",{className:"font-medium",children:f(e.provider,w)})}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:j(e.tokens).toLocaleString()}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:e.tokens?.completion_tokens?.toLocaleString()||0}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-muted",children:(0,a.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,a.jsxs)("div",{children:["TTFT: ",(0,a.jsxs)("span",{className:"font-mono",children:[e.latency?.ttft||0,"ms"]})]}),(0,a.jsxs)("div",{children:["Total: ",(0,a.jsxs)("span",{className:"font-mono",children:[e.latency?.total||0,"ms"]})]})]})}),(0,a.jsx)("td",{className:"p-4 text-center",children:(0,a.jsx)(d.default,{variant:"outline",size:"sm",onClick:()=>{p(e),v(!0)},children:"Detail"})})]},`${e.id}-${t}`))})]})}),!l&&e.length>0&&(0,a.jsx)("div",{className:"border-t border-black/5 dark:border-white/5",children:(0,a.jsx)(x,{currentPage:s.page,pageSize:s.pageSize,totalItems:s.totalItems,onPageChange:e=>{n(t=>({...t,page:e}))},onPageSizeChange:e=>{n(t=>({...t,pageSize:e,page:1}))}})})]}),(0,a.jsx)(c,{isOpen:g,onClose:()=>v(!1),title:"Request Details",width:"lg",children:h&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"ID:"})," ",(0,a.jsx)("span",{className:"text-text-main font-mono",children:h.id})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Timestamp:"})," ",(0,a.jsx)("span",{className:"text-text-main",children:new Date(h.timestamp).toLocaleString()})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Provider:"})," ",(0,a.jsx)("span",{className:"text-text-main font-medium",children:f(h.provider,w)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Model:"})," ",(0,a.jsx)("span",{className:"text-text-main font-mono",children:h.model})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Status:"})," ",(0,a.jsx)("span",{className:(0,o.cn)("font-medium","success"===h.status?"text-green-600":"text-red-600"),children:h.status})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Latency:"})," ",(0,a.jsxs)("span",{className:"text-text-main font-mono",children:["TTFT ",h.latency?.ttft||0,"ms / Total ",h.latency?.total||0,"ms"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Input Tokens:"})," ",(0,a.jsx)("span",{className:"text-text-main font-mono",children:j(h.tokens).toLocaleString()})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Output Tokens:"})," ",(0,a.jsx)("span",{className:"text-text-main font-mono",children:h.tokens?.completion_tokens?.toLocaleString()||0})]})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(b,{title:"1. Client Request (Input)",defaultOpen:!0,icon:"input",children:(0,a.jsx)("pre",{className:"bg-black/5 dark:bg-white/5 p-4 rounded-lg overflow-auto max-h-[300px] text-xs font-mono text-text-main border border-black/5 dark:border-white/5",children:JSON.stringify(h.request,null,2)})}),h.providerRequest&&(0,a.jsx)(b,{title:"2. Provider Request (Translated)",icon:"translate",children:(0,a.jsx)("pre",{className:"bg-black/5 dark:bg-white/5 p-4 rounded-lg overflow-auto max-h-[300px] text-xs font-mono text-text-main border border-black/5 dark:border-white/5",children:JSON.stringify(h.providerRequest,null,2)})}),h.providerResponse&&(0,a.jsx)(b,{title:"3. Provider Response (Raw)",icon:"data_object",children:(0,a.jsx)("pre",{className:"bg-black/5 dark:bg-white/5 p-4 rounded-lg overflow-auto max-h-[300px] text-xs font-mono text-text-main border border-black/5 dark:border-white/5",children:"object"==typeof h.providerResponse?JSON.stringify(h.providerResponse,null,2):h.providerResponse})}),(0,a.jsxs)(b,{title:"4. Client Response (Final)",defaultOpen:!0,icon:"output",children:[h.response?.thinking&&(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("h4",{className:"font-semibold text-text-main mb-2 flex items-center gap-2 text-xs uppercase tracking-wide opacity-70",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"psychology"}),"Thinking Process"]}),(0,a.jsx)("pre",{className:"bg-amber-50 dark:bg-amber-950/30 p-4 rounded-lg overflow-auto max-h-[200px] text-xs font-mono text-amber-900 dark:text-amber-100 border border-amber-200 dark:border-amber-800",children:h.response.thinking})]}),(0,a.jsx)("h4",{className:"font-semibold text-text-main mb-2 text-xs uppercase tracking-wide opacity-70",children:"Content"}),(0,a.jsx)("pre",{className:"bg-black/5 dark:bg-white/5 p-4 rounded-lg overflow-auto max-h-[300px] text-xs font-mono text-text-main border border-black/5 dark:border-white/5",children:h.response?.content||"[No content]"})]})]})]})})]})}function v(){return(0,a.jsx)(r.Suspense,{fallback:(0,a.jsx)(l.Qv,{}),children:(0,a.jsx)(N,{})})}function N(){let e=(0,n.useSearchParams)(),t=(0,n.useRouter)(),[s,i]=(0,r.useState)(!1),d=e.get("tab"),o=d&&["overview","logs","details"].includes(d)?d:"overview";return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(l.Iz,{options:[{value:"overview",label:"Overview"},{value:"details",label:"Details"}],value:o,onChange:s=>{if(s===o)return;i(!0);let a=new URLSearchParams(e);a.set("tab",s),t.push(`/dashboard/usage?${a.toString()}`,{scroll:!1}),setTimeout(()=>i(!1),300)}}),s?(0,a.jsx)(l.Qv,{}):(0,a.jsxs)(a.Fragment,{children:["overview"===o&&(0,a.jsx)(r.Suspense,{fallback:(0,a.jsx)(l.Qv,{}),children:(0,a.jsx)(l.jK,{})}),"logs"===o&&(0,a.jsx)(l.gM,{}),"details"===o&&(0,a.jsx)(g,{})]})]})}}},e=>{e.O(0,[7848,4335,6795,505,4156,2347,5158,7358],()=>e(e.s=33154)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7370],{292:(e,t,s)=>{"use strict";s.d(t,{default:()=>i});var r=s(73365),a=s(87706);function i({children:e,title:t,subtitle:s,icon:n,action:l,padding:c="md",hover:d=!1,className:o,...x}){return(0,r.jsxs)("div",{className:(0,a.cn)("bg-surface","border border-black/5 dark:border-white/5","rounded-lg shadow-sm",d&&"hover:shadow-md hover:border-primary/30 transition-all cursor-pointer",{none:"",xs:"p-3",sm:"p-4",md:"p-6",lg:"p-8"}[c],o),...x,children:[(t||l)&&(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[n&&(0,r.jsx)("div",{className:"p-2 rounded-lg bg-bg text-text-muted",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:n})}),(0,r.jsxs)("div",{children:[t&&(0,r.jsx)("h3",{className:"text-text-main font-semibold",children:t}),s&&(0,r.jsx)("p",{className:"text-sm text-text-muted",children:s})]})]}),l]}),e]})}i.Section=function({children:e,className:t,...s}){return(0,r.jsx)("div",{className:(0,a.cn)("p-4 rounded-lg","bg-black/[0.02] dark:bg-white/[0.02]","border border-black/5 dark:border-white/5",t),...s,children:e})},i.Row=function({children:e,className:t,...s}){return(0,r.jsx)("div",{className:(0,a.cn)("p-3 -mx-3 px-3 transition-colors","border-b border-black/5 dark:border-white/5 last:border-b-0","hover:bg-black/[0.02] dark:hover:bg-white/[0.02]",t),...s,children:e})},i.ListItem=function({children:e,actions:t,className:s,...i}){return(0,r.jsxs)("div",{className:(0,a.cn)("group flex items-center justify-between p-3 -mx-3 px-3","border-b border-black/[0.03] dark:border-white/[0.03] last:border-b-0","hover:bg-black/[0.02] dark:hover:bg-white/[0.02]","transition-colors",s),...i,children:[(0,r.jsx)("div",{className:"flex-1 min-w-0",children:e}),t&&(0,r.jsx)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:t})]})}},10075:(e,t,s)=>{Promise.resolve().then(s.bind(s,32530))},29717:(e,t,s)=>{"use strict";var r=s(21505);s.o(r,"notFound")&&s.d(t,{notFound:function(){return r.notFound}}),s.o(r,"useParams")&&s.d(t,{useParams:function(){return r.useParams}}),s.o(r,"usePathname")&&s.d(t,{usePathname:function(){return r.usePathname}}),s.o(r,"useRouter")&&s.d(t,{useRouter:function(){return r.useRouter}}),s.o(r,"useSearchParams")&&s.d(t,{useSearchParams:function(){return r.useSearchParams}})},32530:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>d});var r=s(73365),a=s(1521),i=s(29717),n=s(292);let l={gh:{"gpt-5.3-codex":{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75}}};function c({isOpen:e,onClose:t,onSave:s}){let[i,n]=(0,a.useState)({}),[d,o]=(0,a.useState)(!0),[x,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{e&&h()},[e]);let h=async()=>{o(!0);try{let e=await fetch("/api/pricing");if(e.ok){let t=await e.json();n(t)}else n(l)}catch(e){console.error("Failed to load pricing:",e),n(l)}finally{o(!1)}},u=async()=>{m(!0);try{let e=await fetch("/api/pricing",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(e.ok)s?.(),t();else{let t=await e.json();alert(`Failed to save pricing: ${t.error}`)}}catch(e){console.error("Failed to save pricing:",e),alert("Failed to save pricing")}finally{m(!1)}},p=async()=>{if(confirm("Reset all pricing to defaults? This cannot be undone."))try{(await fetch("/api/pricing",{method:"DELETE"})).ok&&n(l)}catch(e){console.error("Failed to reset pricing:",e),alert("Failed to reset pricing")}};if(!e)return null;let b=Object.keys(i).sort(),j=["input","output","cached","reasoning","cache_creation"];return(0,r.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:(0,r.jsxs)("div",{className:"bg-bg-base border border-border rounded-lg shadow-xl max-w-6xl w-full max-h-[90vh] overflow-hidden flex flex-col",children:[(0,r.jsxs)("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold",children:"Pricing Configuration"}),(0,r.jsx)("button",{onClick:t,className:"text-text-muted hover:text-text text-2xl leading-none",children:"\xd7"})]}),(0,r.jsx)("div",{className:"flex-1 overflow-auto p-4",children:d?(0,r.jsx)("div",{className:"text-center py-8 text-text-muted",children:"Loading pricing data..."}):(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"bg-bg-subtle border border-border rounded-lg p-3 text-sm",children:[(0,r.jsx)("p",{className:"font-medium mb-1",children:"Pricing Rates Format"}),(0,r.jsxs)("p",{className:"text-text-muted",children:["All rates are in ",(0,r.jsx)("strong",{children:"dollars per million tokens"})," ($/1M tokens). Example: Input rate of 2.50 means $2.50 per 1,000,000 input tokens."]})]}),b.map(e=>{let t=Object.keys(i[e]).sort();return(0,r.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,r.jsx)("div",{className:"bg-bg-subtle px-4 py-2 font-semibold text-sm",children:e.toUpperCase()}),(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-full text-sm",children:[(0,r.jsx)("thead",{className:"bg-bg-hover text-text-muted uppercase text-xs",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"px-3 py-2 text-left",children:"Model"}),(0,r.jsx)("th",{className:"px-3 py-2 text-right",children:"Input"}),(0,r.jsx)("th",{className:"px-3 py-2 text-right",children:"Output"}),(0,r.jsx)("th",{className:"px-3 py-2 text-right",children:"Cached"}),(0,r.jsx)("th",{className:"px-3 py-2 text-right",children:"Reasoning"}),(0,r.jsx)("th",{className:"px-3 py-2 text-right",children:"Cache Creation"})]})}),(0,r.jsx)("tbody",{className:"divide-y divide-border",children:t.map(t=>(0,r.jsxs)("tr",{className:"hover:bg-bg-subtle/50",children:[(0,r.jsx)("td",{className:"px-3 py-2 font-medium",children:t}),j.map(s=>(0,r.jsx)("td",{className:"px-3 py-2",children:(0,r.jsx)("input",{type:"number",step:"0.01",min:"0",value:i[e][t][s]||0,onChange:r=>{let a;!isNaN(a=parseFloat(r.target.value))&&!(a<0)&&n(r=>{let i={...r};return i[e]||(i[e]={}),i[e][t]||(i[e][t]={}),i[e][t][s]=a,i})},className:"w-20 px-2 py-1 text-right bg-bg-base border border-border rounded focus:outline-none focus:border-primary"})},s))]},t))})]})})]},e)}),0===b.length&&(0,r.jsx)("div",{className:"text-center py-8 text-text-muted",children:"No pricing data available"})]})}),(0,r.jsxs)("div",{className:"p-4 border-t border-border flex items-center justify-between gap-2",children:[(0,r.jsx)("button",{onClick:p,className:"px-4 py-2 text-sm text-red-500 hover:bg-red-500/10 rounded border border-red-500/20 transition-colors",disabled:x,children:"Reset to Defaults"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{onClick:t,className:"px-4 py-2 text-sm text-text-muted hover:text-text border border-border rounded transition-colors",disabled:x,children:"Cancel"}),(0,r.jsx)("button",{onClick:u,className:"px-4 py-2 text-sm bg-primary text-white rounded hover:bg-primary/90 transition-colors disabled:opacity-50",disabled:x,children:x?"Saving...":"Save Changes"})]})]})]})})}function d(){(0,i.useRouter)();let[e,t]=(0,a.useState)(!1),[s,l]=(0,a.useState)(null),[d,o]=(0,a.useState)(!0);(0,a.useEffect)(()=>{x()},[]);let x=async()=>{o(!0);try{let e=await fetch("/api/pricing");if(e.ok){let t=await e.json();l(t)}}catch(e){console.error("Failed to load pricing:",e)}finally{o(!1)}};return(0,r.jsxs)("div",{className:"max-w-6xl mx-auto p-6 space-y-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-3xl font-bold",children:"Pricing Settings"}),(0,r.jsx)("p",{className:"text-text-muted mt-1",children:"Configure pricing rates for cost tracking and calculations"})]}),(0,r.jsx)("button",{onClick:()=>t(!0),className:"px-4 py-2 bg-primary text-white rounded hover:bg-primary/90 transition-colors",children:"Edit Pricing"})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,r.jsxs)(n.default,{className:"p-4",children:[(0,r.jsx)("div",{className:"text-text-muted text-sm uppercase font-semibold",children:"Total Models"}),(0,r.jsx)("div",{className:"text-2xl font-bold mt-1",children:d?"...":(()=>{if(!s)return 0;let e=0;for(let t in s)e+=Object.keys(s[t]).length;return e})()})]}),(0,r.jsxs)(n.default,{className:"p-4",children:[(0,r.jsx)("div",{className:"text-text-muted text-sm uppercase font-semibold",children:"Providers"}),(0,r.jsx)("div",{className:"text-2xl font-bold mt-1",children:d?"...":(!s?[]:Object.keys(s).sort()).length})]}),(0,r.jsxs)(n.default,{className:"p-4",children:[(0,r.jsx)("div",{className:"text-text-muted text-sm uppercase font-semibold",children:"Status"}),(0,r.jsx)("div",{className:"text-2xl font-bold mt-1 text-success",children:d?"...":"Active"})]})]}),(0,r.jsxs)(n.default,{className:"p-6",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold mb-4",children:"How Pricing Works"}),(0,r.jsxs)("div",{className:"space-y-3 text-sm text-text-muted",children:[(0,r.jsxs)("p",{children:[(0,r.jsx)("strong",{children:"Cost Calculation:"}),"Costs are calculated based on token usage and pricing rates. Each request's cost is determined by: (input_tokens \xd7 input_rate) + (output_tokens \xd7 output_rate) + (cached_tokens \xd7 cached_rate)"]}),(0,r.jsxs)("p",{children:[(0,r.jsx)("strong",{children:"Pricing Format:"})," All rates are in ",(0,r.jsx)("strong",{children:"dollars per million tokens"})," ($/1M tokens). Example: An input rate of 2.50 means $2.50 per 1,000,000 input tokens."]}),(0,r.jsx)("p",{children:(0,r.jsx)("strong",{children:"Token Types:"})}),(0,r.jsxs)("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Input:"})," Standard prompt tokens"]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Output:"})," Completion/response tokens"]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Cached:"})," Cached input tokens (typically 50% of input rate)"]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Reasoning:"})," Special reasoning/thinking tokens (fallback to output rate)"]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Cache Creation:"})," Tokens used to create cache entries (fallback to input rate)"]})]}),(0,r.jsxs)("p",{children:[(0,r.jsx)("strong",{children:"Custom Pricing:"})," You can override default pricing for specific models. Reset to defaults anytime to restore standard rates."]})]})]}),(0,r.jsxs)(n.default,{className:"p-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold",children:"Current Pricing Overview"}),(0,r.jsx)("button",{onClick:()=>t(!0),className:"text-primary hover:underline text-sm",children:"View Full Details"})]}),d?(0,r.jsx)("div",{className:"text-center py-4 text-text-muted",children:"Loading pricing data..."}):s?(0,r.jsxs)("div",{className:"space-y-3",children:[Object.keys(s).slice(0,5).map(e=>(0,r.jsxs)("div",{className:"text-sm",children:[(0,r.jsxs)("span",{className:"font-semibold",children:[e.toUpperCase(),":"]})," ",(0,r.jsxs)("span",{className:"text-text-muted",children:[Object.keys(s[e]).length," models"]})]},e)),Object.keys(s).length>5&&(0,r.jsxs)("div",{className:"text-sm text-text-muted",children:["+ ",Object.keys(s).length-5," more providers"]})]}):(0,r.jsx)("div",{className:"text-text-muted",children:"No pricing data available"})]}),e&&(0,r.jsx)(c,{isOpen:e,onClose:()=>t(!1),onSave:()=>{x()}})]})}},87706:(e,t,s)=>{"use strict";function r(...e){return e.filter(Boolean).join(" ").replace(/\s+/g," ").trim()}s.d(t,{cn:()=>r})}},e=>{e.O(0,[2347,5158,7358],()=>e(e.s=10075)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4520],{15872:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>i});var a=t(73365),r=t(1521),l=t(74156),n=t(29717);function i(){let[e,s]=(0,r.useState)(""),[t,i]=(0,r.useState)(""),[c,d]=(0,r.useState)(!1),[o,u]=(0,r.useState)(null),m=(0,n.useRouter)();(0,r.useEffect)(()=>{!async function(){let e=new AbortController,s=setTimeout(()=>e.abort(),5e3),t=window.location.origin;try{let a=await fetch(`${t}/api/settings`,{signal:e.signal});if(clearTimeout(s),a.ok){let e=await a.json();if(!1===e.requireLogin){m.push("/dashboard"),m.refresh();return}u(!!e.hasPassword)}else u(!0)}catch(e){clearTimeout(s),u(!0)}}()},[m]);let x=async s=>{s.preventDefault(),d(!0),i("");try{let s=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:e})});if(s.ok)m.push("/dashboard"),m.refresh();else{let e=await s.json();i(e.error||"Invalid password")}}catch(e){i("An error occurred. Please try again.")}finally{d(!1)}};return null===o?(0,a.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-bg p-4",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-primary"}),(0,a.jsx)("p",{className:"text-text-muted mt-4",children:"Loading..."})]})}):(0,a.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-bg p-4",children:(0,a.jsxs)("div",{className:"w-full max-w-md",children:[(0,a.jsxs)("div",{className:"text-center mb-8",children:[(0,a.jsx)("h1",{className:"text-3xl font-bold text-primary mb-2",children:"9Router"}),(0,a.jsx)("p",{className:"text-text-muted",children:"Enter your password to access the dashboard"})]}),(0,a.jsx)(l.Zp,{children:(0,a.jsxs)("form",{onSubmit:x,className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium",children:"Password"}),(0,a.jsx)(l.pd,{type:"password",placeholder:"Enter password",value:e,onChange:e=>s(e.target.value),required:!0,autoFocus:!0}),t&&(0,a.jsx)("p",{className:"text-xs text-red-500",children:t})]}),(0,a.jsx)(l.$n,{type:"submit",variant:"primary",className:"w-full",loading:c,children:"Login"}),(0,a.jsxs)("p",{className:"text-xs text-center text-text-muted mt-2",children:["Default password is ",(0,a.jsx)("code",{className:"bg-sidebar px-1 rounded",children:"123456"})]})]})})]})})}},92943:(e,s,t)=>{Promise.resolve().then(t.bind(t,15872))}},e=>{e.O(0,[7848,4335,6795,505,4156,2347,5158,7358],()=>e(e.s=92943)),_N_E=e.O()}]);
|