zevairouter 1.0.178 → 1.0.180
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/CHANGELOG.md +11 -0
- package/cli/app/.next-cli-build/BUILD_ID +1 -1
- package/cli/app/.next-cli-build/app-path-routes-manifest.json +10 -10
- package/cli/app/.next-cli-build/build-manifest.json +2 -2
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +9 -9
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +2 -2
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +2 -2
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/terminal/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/callback.html +1 -1
- package/cli/app/.next-cli-build/server/app/callback.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/context.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/playground.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/quota.rsc +7 -7
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +7 -7
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/index.html +1 -1
- package/cli/app/.next-cli-build/server/app/index.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/landing.html +1 -1
- package/cli/app/.next-cli-build/server/app/landing.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/login.html +1 -1
- package/cli/app/.next-cli-build/server/app/login.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app-paths-manifest.json +10 -10
- package/cli/app/.next-cli-build/server/chunks/2607.js +10 -10
- package/cli/app/.next-cli-build/server/chunks/3110.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/3155.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/3949.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/412.js +2 -2
- package/cli/app/.next-cli-build/server/chunks/5307.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5469.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/8242.js +2 -2
- package/cli/app/.next-cli-build/server/chunks/8306.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/8895.js +2 -2
- package/cli/app/.next-cli-build/server/chunks/9621.js +1 -1
- package/cli/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/pages/404.html +1 -1
- package/cli/app/.next-cli-build/server/pages/500.html +1 -1
- package/cli/app/.next-cli-build/static/chunks/523-24d141baca2cf3ac.js +3 -0
- package/cli/app/.next-cli-build/static/chunks/5497-30373888abff3013.js +7 -0
- package/cli/app/.next-cli-build/static/chunks/{620-aa5d878e9ca8eac1.js → 620-cbb8c8ac230e6489.js} +1 -1
- package/cli/app/.next-cli-build/static/chunks/6617-24b58186724a353a.js +56 -0
- package/cli/app/.next-cli-build/static/chunks/9126-700ad9f1ec9210fb.js +1 -0
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/page-bd827e591cfc8125.js +1 -0
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/page-80ae115554408efe.js +1 -0
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-a17208b586055f9b.js +59 -0
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-0403dfd2234f0c80.js +1 -0
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/page-146309ef654004c5.js +4 -0
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/web/{page-6a6d9f0fc6c0587d.js → page-1952e4c3364688ee.js} +1 -1
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-ec166e9835cac316.js +3 -0
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/new/page-9a9e09af961343c0.js +1 -0
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-7abc7eb028939fe1.js +1 -0
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-98cde94871a97a17.js +1 -0
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/settings/pricing/page-f47976ebed4de8c2.js +1 -0
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-465deae43bb4635c.js +1 -0
- package/cli/app/.next-cli-build/static/css/{46b47c65b0eb8d0a.css → 3e50676a328eeb27.css} +1 -1
- package/cli/app/CHANGELOG.md +11 -0
- package/cli/app/package.json +1 -1
- package/cli/package.json +1 -1
- package/package.json +1 -1
- package/cli/app/.next-cli-build/static/chunks/523-176a0660a9383518.js +0 -3
- package/cli/app/.next-cli-build/static/chunks/5497-a4f1f8e10718edc0.js +0 -7
- package/cli/app/.next-cli-build/static/chunks/6617-a18c27f06c68d9a4.js +0 -56
- package/cli/app/.next-cli-build/static/chunks/9126-7d5476f17beddfb0.js +0 -1
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/page-4e5ba3d1c19bf9d9.js +0 -1
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/page-b67882cc21d5ac2e.js +0 -1
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-1ae6ca8eae912178.js +0 -59
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-03b4d5addd474977.js +0 -1
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/page-05d62a2714eab250.js +0 -4
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-5d5fa8b4319dc8cf.js +0 -3
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/new/page-84e5b58e1bc94fc3.js +0 -1
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-9d2250c9ecfdeb7a.js +0 -1
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-d60217faba1a8018.js +0 -1
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/settings/pricing/page-f2e034926e037cb9.js +0 -1
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-46ad1923add78d75.js +0 -1
- /package/cli/app/.next-cli-build/static/{2GcXDLDxuvj6CKV-GA0Ft → IJRGkO8fMyjXMMNrPPjxN}/_buildManifest.js +0 -0
- /package/cli/app/.next-cli-build/static/{2GcXDLDxuvj6CKV-GA0Ft → IJRGkO8fMyjXMMNrPPjxN}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9126],{19126:(e,t,r)=>{Promise.resolve().then(r.bind(r,88512))},88512:(e,t,r)=>{"use strict";r.d(t,{default:()=>C});var a=r(95155),s=r(12115),l=r(9233),n=r(91992),i=r(35497),o=r(28777),d=r(52679);let c="basic-chat.sessions",m="basic-chat.activeSessionId",u="basic-chat.activeProviderId",p="basic-chat.draft",x="basic-chat.temperature",h="basic-chat.systemPrompt",b=[],f=["Explain this project like I'm new","Write a concise PR description","Debug this error message","Summarize the key trade-offs"],g=new Set(["alicode","alicode-intl","anthropic","antigravity","assemblyai","byteplus","cerebras","chutes","claude","cline","clinepass","codex","cohere","deepseek","fireworks","gemini","gemini-cli","github","grok-cli","groq","hyperbolic","kimchi","kiro","mistral","nanobanana","nebius","nvidia","ollama","ollama-local","openai","openrouter","perplexity","perplexity-agent","qoder","qwen","siliconflow","together","vercel-ai-gateway","volcengine-ark","xai"]);function y(){if(globalThis.crypto?.randomUUID)return globalThis.crypto.randomUUID();let e="";for(let t=0;t<8;t+=1)e+=Math.floor(0xffffffff*Math.random()).toString(16).padStart(8,"0");return`chat_${Date.now()}_${e}`}function v(e){if("string"==typeof e)return e;if(null==e)return"";if(Array.isArray(e))return e.map(v).filter(Boolean).join(" ");if("object"==typeof e){if("string"==typeof e.message)return e.message;if("string"==typeof e.error)return e.error;try{return JSON.stringify(e)}catch{}}return String(e)}function N(e){try{return JSON.stringify(e)}catch{return""}}function w(e=""){let t=v(e).replace(/\s+/g," ").trim();return t?t.length>52?`${t.slice(0,52).trimEnd()}…`:t:"New chat"}async function j(e){return await new Promise((t,r)=>{let a=new FileReader;a.onload=()=>t(String(a.result||"")),a.onerror=()=>r(a.error||Error("Failed to read file")),a.readAsDataURL(e)})}function S(e){let t=e?.provider||e?.id,r=t?d.Q2[t]:null;return r?.name||function(e=""){return String(e).replace(/[-_]/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()||"Unknown"}(t||"provider")}function I(e){return Array.from(e.values()).map(e=>({...e,models:(function(e){let t=new Map;for(let r of e)r?.id&&(t.has(r.id)||t.set(r.id,r));return Array.from(t.values())})(e.models).sort((e,t)=>e.name.localeCompare(t.name))})).filter(e=>e.models.length>0).sort((e,t)=>e.providerName.localeCompare(t.providerName))}async function k(e,t={},r=8e3){let a=new AbortController,s=setTimeout(()=>a.abort(),r);try{return await fetch(e,{...t,signal:a.signal})}finally{clearTimeout(s)}}async function A(e,t,r){if(!e.length)return[];let a=Array(e.length),s=0,l=Array.from({length:Math.min(t,e.length)},async()=>{for(;s<e.length;){let t=s;s+=1,a[t]=await r(e[t],t)}});return await Promise.all(l),a}function C(){let[e,t]=(0,s.useState)([]),[r,C]=(0,s.useState)(!0),[T,$]=(0,s.useState)(""),[M,E]=(0,s.useState)([]),[D,_]=(0,s.useState)(""),[O,R]=(0,s.useState)(""),[z,U]=(0,s.useState)(""),[q,L]=(0,s.useState)(""),[P,F]=(0,s.useState)([]),[J,B]=(0,s.useState)(!1),[H,W]=(0,s.useState)(""),[K,Y]=(0,s.useState)(""),[G,Q]=(0,s.useState)(!1),[V,Z]=(0,s.useState)(!1),[X,ee]=(0,s.useState)(""),[et,er]=(0,s.useState)(!1),[ea,es]=(0,s.useState)(!1),[el,en]=(0,s.useState)(""),[ei,eo]=(0,s.useState)(.7),[ed,ec]=(0,s.useState)(""),em=(0,s.useRef)(null),eu=(0,s.useRef)(null),ep=(0,s.useRef)(!1),ex=(0,s.useRef)(null),eh=(0,s.useRef)(null),eb=(0,s.useRef)(null),ef=(0,s.useRef)(null),eg=(0,s.useRef)(null),ey=(0,s.useRef)(null),ev=(0,s.useRef)(!1),eN=(0,s.useRef)({sessions:[],activeSessionId:"",activeProviderId:"",draft:""});(0,s.useEffect)(()=>{try{let e=function(e,t){try{return JSON.parse(e)}catch{return t}}(globalThis.localStorage.getItem(c),[]),t=Array.isArray(e)?e.map(e=>({...e,messages:Array.isArray(e.messages)?e.messages:[]})):[],r=globalThis.localStorage.getItem(x),a=null===r?NaN:Number(r);E(t),_(globalThis.localStorage.getItem(m)||""),R(globalThis.localStorage.getItem(u)||""),L(globalThis.localStorage.getItem(p)||""),eo(Number.isFinite(a)?Math.min(2,Math.max(0,a)):.7),ec(globalThis.localStorage.getItem(h)||"")}catch{}finally{Q(!0)}},[]),(0,s.useEffect)(()=>{let e=!1;return async function(){C(!0),$("");try{let r=await k("/api/providers",{cache:"no-store"},15e3),a=await r.json().catch(()=>({})),s=Array.isArray(a.connections)?a.connections.filter(e=>e?.isActive!==!1):[];if(0===s.length){e||(t([]),$("No providers connected yet."),C(!1));return}let l=new Map,n=[];for(let e of s){let t=e.provider||e.id,r=S(e),a=(0,d.mq)(t)?"openai-compatible":(0,d.gb)(t)?"anthropic-compatible":t;if(!l.has(t)){l.set(t,{providerId:t,providerName:r,providerType:a,connections:[],models:[]});let s=(0,o.KC)(t).map(t=>t?.id?{id:`${e.provider}/${t.id}`,requestModel:`${e.provider}/${t.id}`,name:t.name||t.id,providerId:e.provider,providerName:S(e),source:"static"}:null).filter(Boolean);l.get(t).models.push(...s),0===s.length&&function(e){let t=e?.provider;return!!t&&(!!g.has(t)||!!e?.providerSpecificData?.baseUrl&&((0,d.mq)(t)||(0,d.gb)(t)))}(e)&&n.push(e)}let s=l.get(t);s.providerName=s.providerName||r,s.providerType=s.providerType||a,s.connections.push(e)}let i=I(l);e||(t(i),0===i.length?$("Loading live models…"):$(""),C(!1));let c=await A(n,6,async t=>{if(e)return{connection:t,models:[]};try{let e=await k(`/api/providers/${t.id}/models`,{cache:"no-store"},8e3),r=await e.json().catch(()=>({}));if(!e.ok)return{connection:t,models:[]};let a=(Array.isArray(r?.models)?r.models:Array.isArray(r?.data)?r.data:Array.isArray(r?.results)?r.results:Array.isArray(r)?r:[]).map(e=>(function(e,t){let r="string"==typeof e?e:e?.id||e?.name||e?.model||"";if(!r)return null;let a="string"==typeof e?e:e?.name||e?.displayName||r,s=r;return((0,d.mq)(t.provider)||(0,d.gb)(t.provider))&&!r.includes("/")&&(s=`${t.provider}/${r}`),{id:s,requestModel:s,name:a,providerId:t.provider,providerName:S(t),source:"live"}})(e,t)).filter(Boolean);return{connection:t,models:a}}catch{return{connection:t,models:[]}}});if(e)return;for(let e of c){let t=e.connection.provider||e.connection.id,r=l.get(t);r&&e.models?.length&&r.models.push(...e.models)}let m=I(l);e||(t(m),0===m.length?$("Providers connected but no models available."):$(""))}catch(r){e||($(v(r?.message)||"Failed to load providers/models."),t([]),C(!1))}}(),()=>{e=!0}},[]),(0,s.useEffect)(()=>{let e=e=>{ex.current&&!ex.current.contains(e.target)&&Z(!1),eh.current&&!eh.current.contains(e.target)&&er(!1),eb.current&&!eb.current.contains(e.target)&&es(!1)},t=e=>{"Escape"===e.key&&(Z(!1),ee(""),es(!1),er(!1))};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[]),(0,s.useEffect)(()=>{if(G)try{globalThis.localStorage.setItem(x,String(ei))}catch{}},[G,ei]),(0,s.useEffect)(()=>{if(G)try{globalThis.localStorage.setItem(h,ed)}catch{}},[G,ed]);let ew=(0,s.useMemo)(()=>{let t=new Map;for(let r of e)for(let e of r.models)t.set(e.id,{...e,providerId:r.providerId,providerName:r.providerName});return t},[e]),ej=(0,s.useMemo)(()=>e.find(e=>e.providerId===O)||e[0]||null,[e,O]),eS=(0,s.useMemo)(()=>{if(z&&ew.has(z))return ew.get(z);if(D){let e=M.find(e=>e.id===D);if(e?.modelId&&ew.has(e.modelId))return ew.get(e.modelId)}return ej?.models?.[0]||null},[z,ew,ej,M,D]),eI=(0,s.useMemo)(()=>M.find(e=>e.id===D)||null,[M,D]),ek=eI?.messages||b,eA=(0,s.useMemo)(()=>[...M].sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()),[M]),eC=!J&&!!eS&&(q.trim().length>0||P.length>0);(0,s.useEffect)(()=>{if(!G)return;if(eN.current={sessions:M,activeSessionId:D,activeProviderId:O,draft:q},null!==ey.current){ev.current=!0;return}ev.current=!1;let e=t=>{ey.current=globalThis.setTimeout(()=>{ey.current=null;let t=eN.current;try{let e=N(t.sessions);try{globalThis.localStorage.setItem(c,e)}catch(r){let e=t.sessions.map(e=>({...e,messages:(e.messages||[]).map(e=>Array.isArray(e.attachments)&&0!==e.attachments.length?{...e,attachments:e.attachments.map(({dataUrl:e,...t})=>({...t}))}:e)}));try{globalThis.localStorage.setItem(c,N(e))}catch{throw r}}globalThis.localStorage.setItem(m,t.activeSessionId),globalThis.localStorage.setItem(u,t.activeProviderId),globalThis.localStorage.setItem(p,t.draft)}catch{}ev.current&&(ev.current=!1,e(2e3))},t)};return e(J?2e3:400),()=>{if(null!==ey.current){globalThis.clearTimeout(ey.current),ey.current=null;let t=ev.current;ev.current=!1,t&&e(400)}}},[G,J,M,D,O,q]),(0,s.useEffect)(()=>{if(!G||r||ep.current||0===e.length)return;let t=e.find(e=>e.providerId===O)||e[0],a=z&&ew.has(z)?ew.get(z):t.models[0];if(M.length>0){let e=M.find(e=>e.id===D)||M[0],r=e?.modelId&&ew.has(e.modelId)?ew.get(e.modelId):a;ep.current=!0,_(e.id),R(r?.providerId||t.providerId),U(r?.id||a.id);return}let s={id:y(),title:"New chat",providerId:t.providerId,providerName:t.providerName,modelId:a.id,modelName:a.name,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messages:[]};ep.current=!0,E([s]),_(s.id),R(t.providerId),U(a.id)},[G,r,e,ew,M,D,O,z]);let eT=(e,t)=>{E(r=>r.map(r=>r.id===e?t({...r,messages:Array.isArray(r.messages)?r.messages.map(e=>({...e})):[]}):r))},e$=e=>e?{id:y(),title:"New chat",providerId:e.providerId,providerName:e.providerName,modelId:e.id,modelName:e.name,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messages:[]}:null,eM=()=>{if(!eS)return;let e=e$(eS);e&&(E(t=>[e,...t]),_(e.id),R(e.providerId),U(e.modelId),L(""),F([]),W(""),Y(""))},eE=async e=>{let t=Array.from(e.target.files||[]);if(0===t.length)return;let r=t.filter(e=>e.type.startsWith("image/"));if(0===r.length){e.target.value="";return}let a=await Promise.allSettled(r.map(async e=>({id:y(),name:e.name,type:e.type,size:e.size,dataUrl:await j(e)}))),s=a.filter(e=>"fulfilled"===e.status).map(e=>e.value);if(s.length>0&&F(e=>[...e,...s]),s.length<r.length){let e=a.find(e=>"rejected"===e.status)?.reason;$(v(e?.message)?`Failed to read file: ${v(e.message)}`:"Failed to read one or more files.")}e.target.value=""},eD=(e,t)=>{let r=w(t);eT(e,e=>({...e,title:"New chat"===e.title?r:e.title,updatedAt:new Date().toISOString()}))};(0,s.useEffect)(()=>{let e;(e=ef.current)&&(e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,Math.round(.28*window.innerHeight))}px`)},[q]),(0,s.useEffect)(()=>{eg.current?.scrollIntoView({behavior:"smooth",block:"end"})},[ek,K,J]);let e_=async(e,t)=>{try{await navigator.clipboard.writeText(v(t)),en(e),setTimeout(()=>en(t=>t===e?"":t),1500)}catch{}},eO=async(e={})=>{let t=eS||ej?.models?.[0]||null;if(!t)return;let r=!0===e.regenerate;r&&J&&(eu.current?.abort(),eu.current=null,B(!1),W(""),Y(""));let a=D,s=M.find(e=>e.id===a),l="string"==typeof e.userText?e.userText:q.trim(),n=Array.isArray(e.attachments)?e.attachments:P;if(r){if(!s)return;let e=[...s.messages||[]];for(;e.length&&e[e.length-1]?.role==="assistant";)e.pop();let t=[...e].reverse().find(e=>"user"===e.role);if(!t)return;l=v(t.content).trim(),n=Array.isArray(t.attachments)?t.attachments:[],s={...s,messages:e},E(e=>e.map(e=>e.id===a?s:e))}if(!l&&(!n||0===n.length))return;if(!s){if(!(s=e$(t)))return;a=s.id,E(e=>[s,...e]),_(a)}let i=r?null:{id:y(),role:"user",content:l,attachments:(n||[]).map(e=>({id:e.id,name:e.name,type:e.type,dataUrl:e.dataUrl})),createdAt:new Date().toISOString()},o=y(),d={id:o,role:"assistant",content:"",createdAt:new Date().toISOString(),status:"streaming"},c=[...r?[...s.messages||[]]:[...s.messages||[],i],d];E(e=>e.map(e=>e.id===a?{...e,providerId:t.providerId,providerName:t.providerName,modelId:t.id,modelName:t.name,messages:c,updatedAt:new Date().toISOString(),title:"New chat"===e.title?w(l):e.title}:e)),!r&&(L(""),F([]),ef.current&&(ef.current.style.height="auto")),B(!0),W(o),Y(""),eu.current?.abort(),eu.current=new AbortController;let m=c.filter(e=>"assistant"!==e.role||e.id!==o).map(e=>({role:e.role,content:"user"===e.role?function(e){let t=v(e.content).trim(),r=Array.isArray(e.attachments)?e.attachments:[];if(0===r.length)return t;let a=[];for(let e of(t&&a.push({type:"text",text:t}),r))e?.dataUrl&&a.push({type:"image_url",image_url:{url:e.dataUrl}});return a.length>0?a:t}(e):e.content})),u=ed.trim(),p=u?[{role:"system",content:u},...m]:m;try{let e=await fetch("/api/dashboard/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({model:t.requestModel||t.id,messages:p,stream:!0,temperature:ei}),signal:eu.current.signal});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(v(t.error||t.message||`Request failed (${e.status})`))}let r=e.body?.getReader();if(!r){let t=await e.json().catch(()=>({})),r=v(t?.choices?.[0]?.message?.content||t?.output_text||t?.error||t?.message||"");eT(a,e=>({...e,messages:e.messages.map(e=>e.id===o?{...e,content:r,status:"done"}:e),updatedAt:new Date().toISOString()}));return}let s=new TextDecoder,n="",i="";for(;;){let{value:e,done:t}=await r.read();if(t)break;let l=(n+=s.decode(e,{stream:!0})).split(/\r?\n/);for(let e of(n=l.pop()||"",l)){let t=e.trim();if(!t.startsWith("data:"))continue;let r=t.slice(5).trim();if(r&&"[DONE]"!==r)try{let e=JSON.parse(r),t=function(e){if(!e||"object"!=typeof e)return"";let t=e.choices?.[0];return[(t?.delta||{}).content,t?.message?.content,e.output_text,e.text].map(v).filter(Boolean)[0]||""}(e);if(!t)continue;i+=t,Y(i),eT(a,e=>({...e,messages:e.messages.map(e=>e.id===o?{...e,content:i,status:"streaming"}:e),updatedAt:new Date().toISOString()}))}catch{}}}eT(a,e=>({...e,messages:e.messages.map(e=>e.id===o?{...e,content:i||e.content,status:"done"}:e),updatedAt:new Date().toISOString()})),eD(a,l)}catch(e){if("AbortError"===e.name)eT(a,e=>({...e,messages:e.messages.map(e=>e.id===o?{...e,content:e.content||"Stopped",status:"stopped"}:e),updatedAt:new Date().toISOString()})),eD(a,l);else{let t=v(e?.message||e);eT(a,e=>({...e,messages:e.messages.map(e=>e.id===o?{...e,content:e.content||`Error: ${t}`,status:"error"}:e),updatedAt:new Date().toISOString()}))}}finally{B(!1),W(""),Y(""),eu.current=null}},eR=eS?eS.name:"Select model",ez=eS?`${eS.providerName||""} \xb7 ${eS.requestModel||eS.id}`.replace(/^ · /,""):"Connected providers only",eU=(0,s.useMemo)(()=>{let t=X.trim().toLowerCase();return t?e.map(e=>{let r=(e.providerName||"").toLowerCase().includes(t)||(e.providerId||"").toLowerCase().includes(t)?e.models:e.models.filter(e=>`${e.name||""} ${e.requestModel||""} ${e.id||""}`.toLowerCase().includes(t));return{...e,models:r}}).filter(e=>e.models.length>0):e},[e,X]);return(0,a.jsxs)("div",{className:"relative flex h-full min-h-0 min-w-0 flex-1 overflow-hidden bg-bg text-text-main",children:[(0,a.jsxs)("aside",{id:"playground-history",className:`${et?"flex":"hidden"} fixed inset-y-0 left-0 z-30 w-[min(85vw,260px)] shrink-0 flex-col border-r border-border-subtle bg-surface/95 backdrop-blur-xl lg:static lg:z-auto lg:flex lg:w-[260px] lg:bg-surface/60`,children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 border-b border-border-subtle p-3",children:[(0,a.jsxs)("button",{type:"button",onClick:eM,disabled:!eS,className:"flex h-9 flex-1 items-center justify-center gap-2 rounded-[10px] bg-primary text-sm font-semibold text-white transition hover:bg-primary-hover disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"add"}),"New chat"]}),(0,a.jsx)("button",{type:"button",className:"flex size-11 items-center justify-center rounded-[10px] border border-border text-text-muted lg:hidden hover:bg-surface-2",onClick:()=>er(!1),"aria-label":"Close history",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]}),(0,a.jsxs)("div",{ref:eh,className:"flex-1 overflow-y-auto p-2 custom-scrollbar",children:[(0,a.jsx)("p",{className:"px-2 py-2 text-[11px] font-semibold uppercase tracking-wider text-text-subtle",children:"Chats"}),0===eA.length?(0,a.jsx)("div",{className:"rounded-[10px] border border-dashed border-border px-3 py-6 text-center text-xs text-text-muted",children:"No conversations yet"}):(0,a.jsx)("div",{className:"space-y-0.5",children:eA.map(e=>{let t=e.id===D,r=[...e.messages||[]].reverse().find(e=>"user"===e.role)||e.messages?.[0];return(0,a.jsxs)("button",{type:"button",onClick:()=>{var t;let r;t=e.id,(r=M.find(e=>e.id===t))&&(_(t),R(r.providerId||O),U(r.modelId||z),er(!1)),window.innerWidth<1024&&er(!1)},className:`group flex w-full items-start gap-2 rounded-[10px] px-2.5 py-2.5 text-left transition ${t?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-[16px] opacity-70",children:"chat_bubble"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("p",{className:"truncate text-[13px] font-medium leading-snug",children:e.title||"New chat"}),(0,a.jsxs)("p",{className:"mt-0.5 truncate text-[11px] opacity-60",children:[v(r?.content)||"Empty"," \xb7"," ",function(e){if(!e)return"Now";let t=new Date(e).getTime();if(Number.isNaN(t))return"Now";let r=Math.max(1,Math.round((Date.now()-t)/6e4));if(r<60)return`${r}m`;let a=Math.round(r/60);return a<24?`${a}h`:`${Math.round(a/24)}d`}(e.updatedAt)]})]})]},e.id)})})]}),(0,a.jsx)("div",{className:"border-t border-border-subtle p-3",children:(0,a.jsxs)("button",{type:"button",onClick:()=>{if(!D)return;let e=M.filter(e=>e.id!==D),t=e[0]||null;E(e),t?(_(t.id),R(t.providerId),U(t.modelId)):(_(""),R(""),U(""))},disabled:!D||0===M.length,className:"flex h-8 w-full items-center justify-center gap-1.5 rounded-[8px] text-xs font-medium text-text-muted transition hover:bg-surface-2 hover:text-danger disabled:opacity-40",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"delete"}),"Delete current chat"]})})]}),(0,a.jsxs)("div",{className:"relative flex min-w-0 flex-1 flex-col",children:[(0,a.jsxs)("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border-subtle px-3 py-2 lg:hidden",children:[(0,a.jsx)("button",{type:"button",onClick:()=>er(!0),className:"flex size-11 items-center justify-center rounded-[10px] border border-border text-text-muted hover:bg-surface-2","aria-label":"Open chats","aria-expanded":et,"aria-controls":"playground-history",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"history"})}),(0,a.jsxs)("div",{className:"min-w-0 text-center",children:[(0,a.jsx)("p",{className:"truncate text-sm font-semibold",children:eR}),(0,a.jsx)("p",{className:"truncate text-[11px] text-text-subtle",children:ez})]}),(0,a.jsx)("button",{type:"button",onClick:eM,disabled:!eS,className:"flex size-11 items-center justify-center rounded-[10px] border border-border text-text-muted hover:bg-surface-2 disabled:opacity-40","aria-label":"New chat",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"edit_square"})})]}),T?(0,a.jsx)("div",{role:"alert",className:"mx-4 mt-3 rounded-[10px] border border-danger/25 bg-danger/10 px-3 py-2.5 text-sm text-danger",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"error"}),(0,a.jsx)("p",{children:T})]})}):null,(0,a.jsx)("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:0===ek.length?(0,a.jsxs)("div",{className:"flex min-h-full flex-col items-center justify-center px-6 pb-36 pt-10 text-center",children:[(0,a.jsx)("div",{className:"mb-4 flex size-12 items-center justify-center rounded-2xl border border-border bg-surface text-primary shadow-soft",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[26px]",children:"forum"})}),(0,a.jsx)("h2",{className:"text-[22px] font-semibold tracking-tight text-text-main",children:"How can I help?"}),(0,a.jsx)("p",{className:"mt-1.5 max-w-md text-[13px] leading-relaxed text-text-muted",children:"Pick a model below, then ask anything through your connected providers."}),(0,a.jsx)("div",{className:"mt-6 flex max-w-xl flex-wrap items-center justify-center gap-2",children:f.map(e=>(0,a.jsx)("button",{type:"button",disabled:!eS||r,onClick:()=>{L(e),requestAnimationFrame(()=>ef.current?.focus())},className:"rounded-full border border-border bg-surface px-3.5 py-2 text-left text-[12.5px] text-text-muted transition hover:border-primary/35 hover:bg-primary/5 hover:text-text-main disabled:opacity-40",children:e},e))}),r?(0,a.jsx)("p",{className:"mt-4 text-xs text-text-subtle",children:"Loading models…"}):null]}):(0,a.jsxs)("div",{className:"mx-auto w-full max-w-3xl px-4 py-6 lg:px-8",children:[ek.map((e,t)=>{let r="user"===e.role,s="assistant"===e.role,i=s&&e.id===H&&"streaming"===e.status,o=v(e.content)||(s?K:""),d="error"===e.status,c="stopped"===e.status,m=s&&t===ek.length-1&&"streaming"!==e.status;return(0,a.jsx)("div",{className:"group relative mb-1 border-b border-border-subtle/50 py-5 last:border-0",children:(0,a.jsxs)("div",{className:"flex gap-3.5",children:[(0,a.jsx)("div",{className:`flex size-7 shrink-0 items-center justify-center rounded-full text-[11px] font-bold ${r?"bg-primary text-white":"border border-border bg-surface-2 text-text-muted"}`,children:r?"Y":"AI"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("p",{className:"mb-1.5 text-[12px] font-semibold text-text-main",children:r?"You":eS?.name||"Assistant"}),e.attachments?.length?(0,a.jsx)("div",{className:"mb-3 grid max-w-md grid-cols-2 gap-2 sm:grid-cols-3",children:e.attachments.map(e=>(0,a.jsx)("a",{href:e.dataUrl,target:"_blank",rel:"noreferrer",className:"overflow-hidden rounded-lg border border-border",children:(0,a.jsx)("img",{src:e.dataUrl,alt:e.name,className:"h-24 w-full object-cover"})},e.id))}):null,s&&!d?(0,a.jsx)("div",{className:"playground-md text-[14.5px] leading-[1.7] text-text-main",dangerouslySetInnerHTML:{__html:function(e){let t=v(e);if(!t)return"";try{return n.A.sanitize(l.xI.parse(t))}catch{return t.replace(/</g,"<").replace(/>/g,">")}}(o)||""}}):(0,a.jsx)("div",{className:`whitespace-pre-wrap break-words text-[14.5px] leading-[1.7] ${d?"text-danger":"text-text-main"}`,children:o}),s&&i?(0,a.jsx)("span",{className:"ml-0.5 inline-block animate-pulse text-primary",children:"▋"}):null,c?(0,a.jsx)("p",{className:"mt-2 text-xs text-text-muted",children:"Generation stopped"}):null,s&&o&&!i?(0,a.jsxs)("div",{className:"mt-2 flex items-center gap-1 opacity-100 transition sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>e_(e.id,o),className:"inline-flex h-7 items-center gap-1 rounded-md px-2 text-[11px] font-medium text-text-muted hover:bg-surface-2 hover:text-text-main",title:"Copy",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:el===e.id?"check":"content_copy"}),el===e.id?"Copied":"Copy"]}),m&&!J?(0,a.jsxs)("button",{type:"button",onClick:()=>eO({regenerate:!0}),disabled:J,className:"inline-flex h-7 items-center gap-1 rounded-md px-2 text-[11px] font-medium text-text-muted hover:bg-surface-2 hover:text-text-main disabled:cursor-not-allowed disabled:opacity-50",title:"Regenerate",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"}),"Retry"]}):null]}):null]})]})},e.id)}),(0,a.jsx)("div",{ref:eg})]})}),(0,a.jsx)("div",{className:"shrink-0 border-t border-border-subtle bg-bg/90 backdrop-blur-xl",children:(0,a.jsxs)("div",{className:"mx-auto w-full max-w-3xl px-4 pb-4 pt-3 lg:px-6",children:[P.length>0?(0,a.jsx)("div",{className:"mb-2 flex flex-wrap gap-2",children:P.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-full border border-border bg-surface px-3 py-1.5",children:[(0,a.jsx)("span",{className:"max-w-[10rem] truncate text-xs text-text-muted",children:e.name}),(0,a.jsx)("button",{type:"button",onClick:()=>{var t;return t=e.id,void F(e=>e.filter(e=>e.id!==t))},className:"text-text-subtle hover:text-text-main","aria-label":"Remove attachment",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]},e.id))}):null,(0,a.jsxs)("div",{className:"rounded-2xl border border-border-subtle bg-surface-2/80 shadow-soft ring-1 ring-border-subtle focus-within:border-primary/50 focus-within:ring-primary/20 transition",children:[(0,a.jsx)("textarea",{ref:ef,"aria-label":"Message",value:q,onChange:e=>L(e.target.value),onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),eC&&eO())},placeholder:eS?`Message ${eS.name}…`:"Select a model below to start chatting",rows:1,disabled:!eS||r,className:"max-h-[28vh] min-h-[52px] w-full resize-none overflow-y-auto bg-transparent px-4 pt-3.5 text-[15px] leading-6 text-text-main outline-none placeholder:text-text-subtle custom-scrollbar disabled:opacity-50"}),(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 px-2.5 pb-2.5 pt-1",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>em.current?.click(),disabled:!eS||r,className:"inline-flex h-11 items-center gap-1.5 rounded-full border border-border bg-surface px-3 text-[12px] font-medium text-text-main transition hover:border-primary/40 hover:bg-primary/10 hover:text-primary disabled:cursor-not-allowed disabled:opacity-40",title:"Upload image",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"add_photo_alternate"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Image"})]}),(0,a.jsx)("input",{ref:em,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:eE}),(0,a.jsxs)("div",{ref:eb,className:"relative",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>es(e=>!e),className:`inline-flex h-11 items-center gap-1.5 rounded-full border px-3 text-[12px] font-medium transition ${ea||ed.trim()||.7!==ei?"border-primary/40 bg-primary/10 text-primary":"border-border bg-surface text-text-main hover:border-primary/40 hover:bg-primary/10 hover:text-primary"}`,title:"Chat settings","aria-label":"Chat settings","aria-expanded":ea,"aria-controls":"playground-chat-settings",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"tune"}),(0,a.jsx)("span",{className:"hidden sm:inline tabular-nums",children:ei.toFixed(1)})]}),ea?(0,a.jsxs)("div",{id:"playground-chat-settings",className:"absolute bottom-[calc(100%+8px)] left-0 z-40 w-[min(320px,calc(100vw-2rem))] space-y-3 rounded-xl border border-border bg-surface p-3 shadow-elevated",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[(0,a.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-text-subtle",children:"Temperature"}),(0,a.jsx)("span",{className:"text-xs font-semibold tabular-nums text-text-main",children:ei.toFixed(2)})]}),(0,a.jsx)("input",{type:"range",min:0,max:2,step:.05,value:ei,onChange:e=>eo(Number(e.target.value)),className:"w-full accent-[var(--color-primary,#E56A4A)]"}),(0,a.jsxs)("div",{className:"mt-1 flex justify-between text-[10px] text-text-subtle",children:[(0,a.jsx)("span",{children:"Precise"}),(0,a.jsx)("span",{children:"Creative"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wider text-text-subtle",children:"System prompt"}),(0,a.jsx)("textarea",{value:ed,onChange:e=>ec(e.target.value),rows:4,placeholder:"Optional instructions for the model…",className:"w-full resize-y rounded-lg border border-border bg-bg px-2.5 py-2 text-[12.5px] leading-5 text-text-main outline-none placeholder:text-text-subtle focus:border-primary/40 custom-scrollbar"})]}),(0,a.jsx)("button",{type:"button",onClick:()=>{eo(.7),ec("")},className:"text-[11px] font-medium text-text-muted hover:text-text-main",children:"Reset defaults"})]}):null]}),(0,a.jsxs)("div",{ref:ex,className:"relative min-w-0",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>{Z(e=>{let t=!e;return t||ee(""),t})},disabled:r||0===e.length,"aria-label":`Choose model, currently ${eR}`,"aria-haspopup":"listbox","aria-expanded":V,"aria-controls":"playground-model-menu",className:"inline-flex h-11 max-w-[min(100vw-12rem,260px)] items-center gap-1.5 rounded-full border border-border bg-surface px-3 text-left transition hover:border-primary/40 hover:bg-surface-2 disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary shrink-0",children:"smart_toy"}),(0,a.jsx)("span",{className:"min-w-0 truncate text-[12.5px] font-semibold text-text-main",children:r?"Loading…":eR}),(0,a.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[16px] text-text-muted",children:V?"expand_less":"expand_more"})]}),V?(0,a.jsxs)("div",{id:"playground-model-menu",role:"listbox","aria-label":"Models",className:"absolute bottom-[calc(100%+8px)] left-0 z-40 w-[min(420px,calc(100vw-2rem))] overflow-hidden rounded-xl border border-border bg-surface shadow-elevated",children:[(0,a.jsxs)("div",{className:"border-b border-border-subtle px-3 py-2.5 space-y-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-text-subtle",children:"Models"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[e.length," providers \xb7 search by name"]})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("span",{className:"material-symbols-outlined pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[16px] text-text-subtle",children:"search"}),(0,a.jsx)("input",{type:"search",value:X,onChange:e=>ee(e.target.value),placeholder:"Search models…",autoFocus:!0,className:"w-full rounded-lg border border-border bg-bg py-1.5 pl-8 pr-3 text-[16px] text-text-main outline-none placeholder:text-text-subtle focus:border-primary/40"})]})]}),(0,a.jsx)("div",{className:"max-h-[min(50vh,360px)] overflow-y-auto p-1.5 custom-scrollbar",children:0===eU.length?(0,a.jsxs)("p",{className:"px-3 py-6 text-center text-xs text-text-muted",children:["No models match “",X.trim(),"”"]}):eU.map(e=>(0,a.jsxs)("div",{className:"mb-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-2 py-1.5",children:[(0,a.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-text-subtle",children:e.providerName}),(0,a.jsx)(i.Ex,{size:"sm",variant:"default",children:e.models.length})]}),(0,a.jsx)("div",{className:"space-y-0.5",children:e.models.map(e=>{let t=e.id===z;return(0,a.jsxs)("button",{type:"button",role:"option","aria-selected":t,onClick:()=>{(e=>{let t=ew.get(e);if(!t)return;let r=M.find(e=>e.id===D);if(r&&r.messages.length>0){let e=e$(t);if(!e)return;E(t=>[e,...t]),_(e.id)}else if(r)E(e=>e.map(e=>e.id===r.id?{...e,providerId:t.providerId,providerName:t.providerName,modelId:t.id,modelName:t.name}:e)),_(r.id);else{let e=e$(t);if(!e)return;E(t=>[e,...t]),_(e.id)}R(t.providerId),U(t.id),Z(!1)})(e.id),ee("")},className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left transition ${t?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"}`,children:[(0,a.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,a.jsx)("span",{className:"block truncate text-[13px] font-medium",children:e.name}),(0,a.jsx)("span",{className:"block truncate text-[11px] opacity-60",children:e.requestModel})]}),t?(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"check"}):null]},e.id)})})]},e.providerId))})]}):null]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[J?(0,a.jsxs)("button",{type:"button",onClick:()=>{eu.current?.abort()},className:"inline-flex h-11 items-center gap-1.5 rounded-full border border-border bg-surface px-3 text-[12px] font-semibold text-text-main transition hover:bg-surface-2",title:"Stop generating",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"stop_circle"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Stop"})]}):null,(0,a.jsxs)("button",{type:"button",onClick:eO,disabled:!eC,className:`inline-flex h-11 min-w-9 items-center justify-center gap-1.5 rounded-full px-3.5 text-[13px] font-semibold transition ${eC?"bg-primary text-white shadow-[0_2px_12px_rgba(229,106,74,0.45)] hover:bg-primary-hover active:scale-[0.97]":"bg-surface-3 text-text-subtle cursor-not-allowed opacity-70"}`,title:"Send message",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] font-bold",children:"send"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Send"})]})]})]})]}),(0,a.jsx)("p",{className:"mt-2 text-center text-[11px] text-text-subtle",children:"Routed through ZevaiRouter \xb7 Enter to send \xb7 Shift+Enter for new line"})]})})]}),et?(0,a.jsx)("button",{type:"button",className:"fixed inset-0 z-20 bg-black/40 lg:hidden","aria-label":"Close history",onClick:()=>er(!1)}):null]})}l.xI.setOptions({gfm:!0,breaks:!0})}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3554],{7905:(e,t,s)=>{Promise.resolve().then(s.bind(s,85309))},85309:(e,t,s)=>{"use strict";s.d(t,{default:()=>u});var a=s(95155),l=s(12115),r=s(98500),i=s.n(r),d=s(35497),o=s(3534),n=s(28777),c=s(87582);let x=s(41463).env.NEXT_PUBLIC_CLOUD_URL;function u({toolId:e,machineId:t}){let s=o.dM[e],[r,m]=(0,l.useState)([]),[v,h]=(0,l.useState)(!0),[p,b]=(0,l.useState)({}),[f,j]=(0,l.useState)(!1),[g,E]=(0,l.useState)(!1),[P,k]=(0,l.useState)(""),[w,N]=(0,l.useState)(!1),[y,S]=(0,l.useState)(""),[_,A]=(0,l.useState)([]),[C,U]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=!0;return(async()=>{try{let[t,s,a,l]=await Promise.all([fetch("/api/providers"),fetch("/api/settings"),fetch("/api/tunnel/status"),fetch("/api/dashboard/cli-tools/keys",{cache:"no-store"})]);if(!e)return;if(401===t.status||401===s.status||401===a.status||401===l.status)return void U(!0);if(t.ok){let e=await t.json();m(e.connections||[])}if(s.ok){let e=await s.json();j(e.cloudEnabled||!1)}if(a.ok){let e=await a.json();E(!!(e.tunnel?.enabled||e.tunnel?.settingsEnabled)),k(e.tunnel?.publicUrl||""),N(!!(e.tailscale?.enabled||e.tailscale?.settingsEnabled)),S(e.tailscale?.tunnelUrl||"")}if(l.ok){let e=await l.json();A(e.keys||[])}}catch(e){console.log("Error loading tool data:",e)}finally{e&&h(!1)}})(),()=>{e=!1}},[]);let L=()=>r.filter(e=>!1!==e.isActive),I=(0,l.useCallback)((e,t,s)=>{b(a=>a[e]?.[t]===s?a:{...a,[e]:{...a[e],[t]:s}})},[]);return s?(0,a.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-4 px-1 sm:px-0",children:[(0,a.jsxs)(i(),{href:"/dashboard/cli-tools",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary w-fit",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"arrow_back"}),"Back to CLI Tools"]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("h1",{className:"text-xl font-semibold text-text-main sm:text-2xl",children:s.name}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:s.description})]}),v?(0,a.jsx)(d.Qv,{}):C?(0,a.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-red-500/10 border border-red-500/30 rounded-lg",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-red-500",children:"lock"}),(0,a.jsx)("p",{className:"flex-1 text-sm text-red-600",children:"Your session has expired — tool data, tunnel status, and API keys could not be loaded. Log in again before applying settings, otherwise the tool may be written with a fallback key."})]}),(0,a.jsx)("div",{className:"pl-9",children:(0,a.jsxs)("a",{href:"/login",className:"inline-flex items-center px-3 py-1.5 rounded-md border border-red-500/40 bg-red-500/20 text-red-700 dark:text-red-300 text-xs font-medium hover:bg-red-500/30",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] mr-1",children:"login"}),"Log in again"]})})]}):(()=>{let t,l,r,i=(t=L(),l=[],r=new Set,t.forEach(e=>{let t=n.Xg[e.provider]||e.provider;(0,n.KC)(e.provider).forEach(s=>{let a=`${t}/${s.id}`;r.has(a)||(r.add(a),l.push({value:a,label:`${t}/${s.id}`,provider:e.provider,alias:t,connectionName:e.name,modelId:s.id}))})}),l).length>0,d={tool:s,isExpanded:!0,onToggle:()=>{},baseUrl:g&&P?P:f&&x?x:window.location.origin,apiKeys:_,tunnelEnabled:g,tunnelPublicUrl:P,tailscaleEnabled:w,tailscaleUrl:y};switch(e){case"claude":return(0,a.jsx)(c.Tk,{...d,activeProviders:L(),modelMappings:p[e]||{},onModelMappingChange:(t,s)=>I(e,t,s),hasActiveProviders:i,cloudEnabled:f});case"codex":return(0,a.jsx)(c.Ah,{...d,activeProviders:L(),cloudEnabled:f});case"opencode":return(0,a.jsx)(c.qO,{...d,activeProviders:L(),cloudEnabled:f});case"cowork":return(0,a.jsx)(c.Q6,{...d,activeProviders:L(),hasActiveProviders:i,cloudEnabled:f,cloudUrl:x,tunnelEnabled:g,tunnelPublicUrl:P,tailscaleEnabled:w,tailscaleUrl:y});case"droid":return(0,a.jsx)(c.ZM,{...d,activeProviders:L(),hasActiveProviders:i,cloudEnabled:f});case"openclaw":return(0,a.jsx)(c.yZ,{...d,activeProviders:L(),hasActiveProviders:i,cloudEnabled:f});case"hermes":return(0,a.jsx)(c.RF,{...d,activeProviders:L(),hasActiveProviders:i,cloudEnabled:f});case"copilot":return(0,a.jsx)(c.h1,{...d,activeProviders:L(),cloudEnabled:f});case"cline":return(0,a.jsx)(c.aG,{...d,activeProviders:L(),cloudEnabled:f});case"kilo":return(0,a.jsx)(c.c9,{...d,activeProviders:L(),cloudEnabled:f});case"deepseek-tui":return(0,a.jsx)(c.lF,{...d,activeProviders:L(),hasActiveProviders:i,cloudEnabled:f});case"jcode":return(0,a.jsx)(c.mW,{...d,activeProviders:L(),hasActiveProviders:i,cloudEnabled:f});default:return(0,a.jsx)(c.a7,{toolId:e,...d,activeProviders:L(),cloudEnabled:f,tunnelEnabled:g})}})()]}):(0,a.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-4 px-1 sm:px-0",children:[(0,a.jsxs)(i(),{href:"/dashboard/cli-tools",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary w-fit",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"arrow_back"}),"Back to CLI Tools"]}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Tool not found or disabled."})]})}}},e=>{e.O(0,[2574,3862,3745,3339,620,5497,6617,8441,3794,7358],()=>e(e.s=7905)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2326],{53501:(e,s,l)=>{"use strict";l.d(s,{default:()=>m});var t=l(95155),r=l(12115),a=l(35497),n=l(3534),o=l(87582),i=l(98500),d=l.n(i),c=l(5772);function x({toolId:e,tool:s,status:l}){let r=l?.error?{label:"Unavailable",cls:"bg-red-500/10 text-red-600 dark:text-red-400"}:l?l.installed?l.hasZevai?{label:"Connected",cls:"bg-green-500/10 text-green-600 dark:text-green-400"}:{label:"Not configured",cls:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400"}:{label:"Not installed",cls:"bg-gray-500/10 text-gray-500"}:{label:"Unknown",cls:"bg-gray-500/10 text-gray-500"};return(0,t.jsx)(d(),{href:`/dashboard/cli-tools/${e}`,className:"block",children:(0,t.jsx)(a.Zp,{padding:"sm",className:"h-full overflow-hidden hover:border-primary/50 transition-colors cursor-pointer",children:(0,t.jsx)("div",{className:"flex h-full flex-col gap-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:s.image?(0,t.jsx)(c.default,{src:s.image,alt:s.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}}):s.icon?(0,t.jsx)("span",{className:"material-symbols-outlined text-[28px]",style:{color:s.color},children:s.icon}):null}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("h3",{className:"font-medium text-sm truncate",children:s.name}),(0,t.jsx)("span",{className:`inline-block mt-1 px-1.5 py-0.5 text-[10px] font-medium rounded-full ${r.cls}`,children:r.label})]}),(0,t.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px] shrink-0",children:"chevron_right"})]})})})})}function m({machineId:e}){let[s,l]=(0,r.useState)(!0),[i,d]=(0,r.useState)({}),[c,u]=(0,r.useState)(null),g=(0,r.useRef)(null),p=(0,r.useCallback)(async e=>{try{let s=await fetch("/api/cli-tools/all-statuses",{signal:e});!e.aborted&&s.ok?(d(await s.json()),u(null)):e.aborted||u(`Failed to load tool statuses (HTTP ${s.status})`)}catch(s){"AbortError"!==s.name&&(console.log("Error fetching tool statuses:",s),e.aborted||u("Failed to load tool statuses. Check your connection and try again."))}finally{e.aborted||l(!1)}},[]),h=(0,r.useCallback)(()=>{g.current?.abort();let e=new AbortController;g.current=e,p(e.signal)},[p]);if((0,r.useEffect)(()=>{let e=window.setTimeout(h,0),s=()=>h();return window.addEventListener("focus",s),()=>{window.clearTimeout(e),g.current?.abort(),window.removeEventListener("focus",s)}},[h]),s)return(0,t.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-4",children:[(0,t.jsx)(a.Qv,{}),(0,t.jsx)(a.Qv,{}),(0,t.jsx)(a.Qv,{}),(0,t.jsx)(a.Qv,{}),(0,t.jsx)(a.Qv,{}),(0,t.jsx)(a.Qv,{})]});let b=Object.entries(n.dM),f=Object.entries(n.wn);return(0,t.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-6 px-1 sm:px-0",children:[c&&(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-600",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"error"}),(0,t.jsx)("span",{className:"flex-1",children:c}),(0,t.jsxs)("button",{type:"button",onClick:h,className:"inline-flex items-center gap-1 rounded-md border border-red-500/40 bg-red-500/20 px-2 py-1 font-medium text-red-700 hover:bg-red-500/30 dark:text-red-300",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"}),"Retry"]})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-4",children:b.map(([e,s])=>(0,t.jsx)(x,{toolId:e,tool:s,status:i[e]},e))}),(0,t.jsxs)("div",{className:"flex flex-col gap-3 sm:gap-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary",children:"security"}),(0,t.jsx)("h2",{className:"text-sm font-semibold text-text-main",children:"MITM Tools"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-4",children:f.map(([e,s])=>(0,t.jsx)(o.gY,{tool:s},e))})]})]})}},89734:(e,s,l)=>{Promise.resolve().then(l.bind(l,53501))}},e=>{e.O(0,[2574,3862,3745,3339,620,5497,6617,8441,3794,7358],()=>e(e.s=89734)),_N_E=e.O()}]);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[182],{54909:(e,t,s)=>{Promise.resolve().then(s.bind(s,94588))},62199:(e,t,s)=>{"use strict";s.d(t,{O:()=>a});let r=Object.freeze({"/v1/embeddings":"embeddings","/v1/images/generations":"images","/v1/audio/speech":"speech","/v1/audio/transcriptions":"transcriptions","/v1/search":"search","/v1/web/fetch":"fetch"});function a(e){if("string"!=typeof e)return null;let t=e.indexOf("?"),s=-1===t?e:e.slice(0,t),a=-1===t?"":e.slice(t),l=r[s];return l?`/api/dashboard/media/${l}${a}`:null}},70217:(e,t,s)=>{"use strict";s.d(t,{BU:()=>u,G9:()=>o,d4:()=>d,gJ:()=>r,i2:()=>c});let r=[{id:"all",label:"All"},{id:"active",label:"Active",keys:["active"]},{id:"errors",label:"Errors",keys:["connection_error","auth_error","quota_exhausted","rate_limited","banned","cooldown","unknown"]},{id:"connection",label:"Connection",keys:["connection_error"]},{id:"auth",label:"Auth",keys:["auth_error"]},{id:"limit",label:"Limit",keys:["rate_limited","cooldown"]},{id:"exhausted",label:"Exhausted",keys:["quota_exhausted"]},{id:"banned",label:"Banned",keys:["banned"]},{id:"disabled",label:"Disabled",keys:["disabled"]}],a={active:{label:"active",severity:"success",terminal:!1},disabled:{label:"disabled",severity:"default",terminal:!1},connection_error:{label:"connection error",severity:"error",terminal:!1},auth_error:{label:"auth error",severity:"error",terminal:!0},quota_exhausted:{label:"exhausted",severity:"error",terminal:!0},rate_limited:{label:"rate limited",severity:"warning",terminal:!1},banned:{label:"banned",severity:"error",terminal:!0},cooldown:{label:"cooldown",severity:"warning",terminal:!1},unknown:{label:"unknown",severity:"default",terminal:!1}},l={policy_suspended:"banned",credential_rejected:"auth_error",reauth_required:"auth_error",authentication:"auth_error",entitlement_or_quota:"quota_exhausted",rate_limited:"rate_limited",permission_denied:"auth_error",upstream_transient:"connection_error"};function n(e){if(!e)return"";if("string"==typeof e)return e.toLowerCase();try{return JSON.stringify(e).toLowerCase()}catch{return String(e).toLowerCase()}}function o(e={},t=Date.now()){let s=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>new Date(e).getTime()).filter(e=>Number.isFinite(e)&&e>t);return s.length>0?new Date(Math.min(...s)).toISOString():null}function i(e,t=""){let s=a[e]||a.unknown;return{key:e,...s,reason:t}}function d(e={}){var t;let s=(t=e).quarantinedAt?i(l[n(t.failureClass)]||"unknown",t.quarantineReason||t.lastError||"Connection is quarantined"):null;if(s)return s;if(!1===e.isActive)return i("disabled","Connection is disabled");if(function(e={}){return null!==o(e)}(e))return i("cooldown","Model cooldown is active");if(function(e){if(!e)return!1;let t=new Date(e).getTime();return Number.isFinite(t)&&t>Date.now()}(e.rateLimitedUntil))return i("rate_limited","Rate limit cooldown is active");let r=n(e.testStatus||e.status),a=n(e.lastErrorType||e.errorType),c=n(e.errorCode||e.statusCode),u=n(e.lastError||e.error),m=`${r} ${a} ${c} ${u}`.trim();return!m||["active","success","ok"].includes(r)?i("active",""):m.includes("ban")||m.includes("suspend")||m.includes("restricted")?i("banned",e.lastError||"Account appears restricted"):m.includes("exhaust")||m.includes("quota exceeded")||m.includes("insufficient_quota")||m.includes("payment required")||"402"===c?i("quota_exhausted",e.lastError||"Quota exhausted"):a.includes("rate_limited")||m.includes("rate limit")||m.includes("too many requests")||"429"===c?i("rate_limited",e.lastError||"Rate limited"):a.includes("auth")||a.includes("token")||m.includes("unauthorized")||m.includes("invalid api key")||m.includes("token invalid")||m.includes("token expired")||m.includes("revoked")||"401"===c||"403"===c?i("auth_error",e.lastError||"Authentication failed"):a.includes("network")||m.includes("network")||m.includes("timeout")||m.includes("fetch failed")||m.includes("econn")||m.includes("dns")||m.includes("proxy")?i("connection_error",e.lastError||"Connection failed"):["error","expired","unavailable","failed"].includes(r)?i("connection_error",e.lastError||e.testStatus||"Connection failed"):i("unknown",e.lastError||e.testStatus||"")}function c(e,t){if(!t||"all"===t)return!0;let s=r.find(e=>e.id===t);return!s||s.keys.includes(d(e).key)}function u(e){return e?.severity==="success"?"success":e?.severity==="error"?"error":"default"}},81277:(e,t,s)=>{"use strict";s.d(t,{c:()=>l});var r=s(12115),a=s(70217);function l(e={}){let[t,s]=(0,r.useState)(null),n=JSON.stringify(Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).sort(([e],[t])=>e.localeCompare(t)));return(0,r.useEffect)(()=>(function(e,t,s={}){let r=s.now||Date.now,l=s.setTimer||globalThis.setTimeout,n=s.clearTimer||globalThis.clearTimeout,o=!1,i=null,d=()=>{if(i=null,o)return;let s=r(),n=(0,a.G9)(e,s);t(n),n&&(i=l(d,Math.min(Math.max(1,new Date(n).getTime()-s+1),0x7fffffff)))};return i=l(d,0),()=>{o=!0,null!==i&&n(i),i=null}})(Object.fromEntries(JSON.parse(n)),s),[n]),t}},94588:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>M});var r=s(95155),a=s(73321),l=s(98500),n=s.n(l),o=s(12115),i=s(35497),d=s(57250),c=s(52679),u=s(28777),m=s(11059),p=s(14051),x=s.n(p),h=s(81277);function b({until:e}){let[t,s]=(0,o.useState)("");return((0,o.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void s("");let r=Math.floor(t/1e3);r<60?s(`${r}s`):r<3600?s(`${Math.floor(r/60)}m ${r%60}s`):s(`${Math.floor(r/3600)}h ${Math.floor(r%3600/60)}m`)};t();let r=setInterval(t,1e3);return()=>clearInterval(r)},[e]),t)?(0,r.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}function f({connection:e,proxyPools:t,isOAuth:s,isFirst:a,isLast:l,onMoveUp:n,onMoveDown:d,onToggleActive:c,onUpdateProxy:u,onEdit:m,onDelete:p}){let[x,g]=(0,o.useState)(!1),[y,v]=(0,o.useState)(!1),j=(0,o.useRef)(null),w=new Map((t||[]).map(e=>[e.id,e])),N=e.providerSpecificData?.proxyPoolId||null,k=N?w.get(N):null,C=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,S=!!N||C,$=k?`Pool: ${k.name}`:N?`Pool: ${N} (inactive/missing)`:C?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",_="",T=k?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;if(T)try{let e=new URL(T);_=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{_=T}let E=k?.noProxy||e.providerSpecificData?.connectionNoProxy||"",R=k?.isActive===!0?"success":N||C?"error":"default",O=(0,h.c)(e),A=null!==O;(0,o.useEffect)(()=>{if(!x)return;let e=e=>{j.current&&!j.current.contains(e.target)&&g(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[x]);let P="unavailable"!==e.testStatus||A?e.testStatus:"active",I=s?e.name||e.email||e.displayName||"OAuth Account":e.name,L=async e=>{v(!0);try{await u("__none__"===e?null:e)}finally{v(!1),g(!1)}};return(0,r.jsxs)("div",{className:`group flex flex-col gap-3 p-2 rounded-lg sm:flex-row sm:items-center sm:justify-between hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${!1===e.isActive?"opacity-60":""}`,children:[(0,r.jsxs)("div",{className:"flex w-full min-w-0 flex-1 items-start gap-3 sm:items-center",children:[(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("button",{onClick:n,disabled:a,className:`p-0.5 rounded ${a?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,r.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,r.jsx)("button",{onClick:d,disabled:l,className:`p-0.5 rounded ${l?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,r.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:s?"lock":"key"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-sm font-medium truncate",children:I}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-1",children:[(0,r.jsx)(i.Ex,{variant:!1===e.isActive?"default":"active"===P||"success"===P?"success":"error"===P||"expired"===P||"unavailable"===P?"error":"default",size:"sm",dot:!0,children:!1===e.isActive?"disabled":P||"Unknown"}),S&&(0,r.jsx)(i.Ex,{variant:R,size:"sm",children:"Proxy"}),A&&!1!==e.isActive&&(0,r.jsx)(b,{until:O}),e.lastError&&!1!==e.isActive&&(0,r.jsx)("span",{className:"text-xs text-red-500 truncate max-w-[300px]",title:e.lastError,children:e.lastError}),(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]})]}),S&&(0,r.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[(0,r.jsx)("span",{className:"text-[11px] text-text-muted truncate max-w-[420px]",title:$,children:$}),_&&(0,r.jsx)("code",{className:"text-[10px] font-mono bg-black/5 dark:bg-white/5 px-1 py-0.5 rounded text-text-muted",children:_}),E&&(0,r.jsxs)("span",{className:"text-[11px] text-text-muted truncate max-w-[320px]",title:E,children:["no_proxy: ",E]})]})]})]}),(0,r.jsxs)("div",{className:"flex w-full flex-wrap items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,r.jsxs)("div",{className:"flex flex-wrap gap-1",children:[(t||[]).length>0&&(0,r.jsxs)("div",{className:"relative",ref:j,children:[(0,r.jsxs)("button",{onClick:()=>g(e=>!e),className:`flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 transition-colors ${S?"text-primary":"text-text-muted hover:text-primary"}`,disabled:y,children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:y?"progress_activity":"lan"}),(0,r.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),x&&(0,r.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,r.jsx)("button",{onClick:()=>L("__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,r.jsx)("button",{onClick:()=>L(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,r.jsxs)("button",{onClick:m,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,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,r.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,r.jsxs)("button",{onClick:p,className:"flex flex-col items-center px-2 py-1 rounded hover:bg-red-500/10 text-red-500",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,r.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,r.jsx)(i.lM,{size:"sm",checked:e.isActive??!0,onChange:c,title:e.isActive??!0?"Disable":"Enable"})]})]})}function g({isOpen:e,provider:t,providerName:s,proxyPools:a,onSave:l,onClose:n}){let d="__none__",[c,u]=(0,o.useState)({name:"",apiKey:"",priority:1,proxyPoolId:d}),[m,p]=(0,o.useState)(!1),[x,h]=(0,o.useState)(null),[b,f]=(0,o.useState)(!1),y=async()=>{p(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:c.apiKey})}),s=await e.json();h(s.valid?"success":"failed")}catch{h("failed")}finally{p(!1)}},v=async()=>{if(t&&c.apiKey){f(!0);try{let e=!1;try{p(!0),h(null);let s=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:c.apiKey})});e=!!(await s.json()).valid,h(e?"success":"failed")}catch{h("failed")}finally{p(!1)}await l({name:c.name,apiKey:c.apiKey,priority:c.priority,proxyPoolId:c.proxyPoolId===d?null:c.proxyPoolId,testStatus:e?"active":"unknown"})}finally{f(!1)}}};return t?(0,r.jsx)(i.aF,{isOpen:e,title:`Add ${s||t} API Key`,onClose:n,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Name"}),(0,r.jsx)("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:c.name,onChange:e=>u({...c,name:e.target.value}),placeholder:"Production Key"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"API Key"}),(0,r.jsx)("input",{type:"password",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:c.apiKey,onChange:e=>u({...c,apiKey:e.target.value})})]}),(0,r.jsx)("div",{className:"pt-6",children:(0,r.jsx)(i.$n,{onClick:y,disabled:!c.apiKey||m||b,variant:"secondary",children:m?"Checking...":"Check"})})]}),x&&(0,r.jsx)(i.Ex,{variant:"success"===x?"success":"error",children:"success"===x?"Valid":"Invalid"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Priority"}),(0,r.jsx)("input",{type:"number",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:c.priority,onChange:e=>u({...c,priority:Number.parseInt(e.target.value)||1})})]}),(0,r.jsx)(i.l6,{label:"Proxy Pool",value:c.proxyPoolId,onChange:e=>u({...c,proxyPoolId:e.target.value}),options:[{value:d,label:"None"},...(a||[]).map(e=>({value:e.id,label:e.name}))]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:v,fullWidth:!0,disabled:!c.name||!c.apiKey||b,children:b?"Saving...":"Save"}),(0,r.jsx)(i.$n,{onClick:n,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function y({providerId:e,isOAuth:t}){let[s,a]=(0,o.useState)([]),[l,n]=(0,o.useState)([]),[d,c]=(0,o.useState)(!0),[u,m]=(0,o.useState)(""),[p,x]=(0,o.useState)(!1),[h,b]=(0,o.useState)(!1),[v,j]=(0,o.useState)(null),[w,N]=(0,o.useState)(null),[k,C]=(0,o.useState)("1"),S=(0,o.useRef)(null),$=(0,o.useRef)("1"),[_,T]=(0,o.useState)(null),E=async e=>{if(!e.ok)return null;try{return await e.json()}catch{return null}},R=(0,o.useCallback)(async()=>{try{let[t,s,r]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),l=await E(t),o=await E(s),i=await E(r)||{},d=null===l,c=null===o;d||a((l.connections||[]).filter(t=>t.provider===e)),c||n(o.proxyPools||[]),d||c?m("Connection data could not be loaded. Check that the server is running, then retry."):m("");let u=(i.providerStrategies||{})[e]||{};N(u.fallbackStrategy||null),C(null!=u.stickyRoundRobinLimit?String(u.stickyRoundRobinLimit):"1"),$.current=null!=u.stickyRoundRobinLimit?String(u.stickyRoundRobinLimit):"1"}catch(e){console.log("ConnectionsCard fetch error:",e),m("Connection data could not be loaded. Check that the server is running, then retry.")}finally{c(!1)}},[e]);(0,o.useEffect)(()=>{R()},[R]);let O=async(t,s)=>{try{let r=await fetch("/api/settings",{cache:"no-store"}),a=(r.ok?await r.json():{}).providerStrategies||{},l={};t&&(l.fallbackStrategy=t),"round-robin"===t&&""!==s&&(l.stickyRoundRobinLimit=Number(s)||3);let n={...a};0===Object.keys(l).length?delete n[e]:n[e]=l,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:n})})}catch(e){console.log("saveStrategy error:",e)}},A=async(e,t)=>{let r=[...s];[r[e],r[t]]=[r[t],r[e]],a(r);try{let[s,a]=await Promise.all([fetch(`/api/providers/${r[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e+1})}),fetch(`/api/providers/${r[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t+1})})]);s.ok&&a.ok||await R()}catch{await R()}},P=async e=>{T({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{T(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&a(t=>t.filter(t=>t.id!==e))}catch(e){console.log("delete error:",e)}}})},I=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&a(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("toggle error:",e)}},L=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&a(s=>s.map(s=>s.id===e?{...s,providerSpecificData:{...s.providerSpecificData,proxyPoolId:t||null}}:s))}catch(e){console.log("proxy error:",e)}},M=async t=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,...t})})).ok&&(await R(),x(!1))}catch(e){console.log("save apikey error:",e)}},D=async e=>{try{(await fetch(`/api/providers/${v.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await R(),b(!1))}catch(e){console.log("update connection error:",e)}};return d?(0,r.jsx)(i.Zp,{children:(0,r.jsx)("div",{className:"h-20 animate-pulse bg-black/5 rounded-lg"})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(i.Zp,{children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-4",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,r.jsx)(i.lM,{checked:"round-robin"===w,onChange:e=>{let t=e?"round-robin":null;N(t),e&&!k&&C("1");let s=e?k||"1":k;$.current=s,S.current&&(clearTimeout(S.current),S.current=null),O(t,s)}}),"round-robin"===w&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,r.jsx)("input",{type:"number",min:1,value:k,onChange:e=>{C(e.target.value),$.current=e.target.value,S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{O("round-robin",$.current)},500)},className:"w-16 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]}),u&&(0,r.jsxs)("div",{className:"mb-4 flex flex-col gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-600 dark:border-red-800 dark:bg-red-900/20 dark:text-red-400 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsx)("span",{children:u}),(0,r.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"refresh",onClick:()=>{c(!0),R()},children:"Retry"})]}),0!==s.length||u?s.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:s.map((e,a)=>(0,r.jsx)(f,{connection:e,proxyPools:l,isOAuth:t,isFirst:0===a,isLast:a===s.length-1,onMoveUp:()=>A(a,a-1),onMoveDown:()=>A(a,a+1),onToggleActive:t=>I(e.id,t),onUpdateProxy:t=>L(e.id,t),onEdit:()=>{j(e),b(!0)},onDelete:()=>P(e.id)},e.id))}),(0,r.jsx)("div",{className:"mt-4 flex justify-stretch sm:justify-start",children:(0,r.jsx)(i.$n,{size:"sm",icon:"add",onClick:()=>x(!0),children:"Add"})})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),(0,r.jsx)(i.$n,{size:"sm",icon:"add",onClick:()=>x(!0),children:"Add Connection"})]})]}),(0,r.jsx)(g,{isOpen:p,provider:e,proxyPools:l,onSave:M,onClose:()=>x(!1)}),(0,r.jsx)(i.wI,{isOpen:h,connection:v,proxyPools:l,onSave:D,onClose:()=>b(!1)}),(0,r.jsx)(i.uo,{isOpen:!!_,onClose:()=>T(null),onConfirm:_?.onConfirm,title:_?.title||"Confirm",message:_?.message,variant:"danger"})]})}function v({model:e,fullModel:t,copied:s,onCopy:a,testStatus:l,isCustom:n,isFree:o,onDeleteAlias:i,onTest:d,isTesting:c}){let u="ok"===l?"#22c55e":"error"===l?"#ef4444":void 0;return(0,r.jsx)("div",{className:`group px-3 py-2 rounded-lg border ${"ok"===l?"border-green-500/40":"error"===l?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base",style:u?{color:u}:void 0,children:"ok"===l?"check_circle":"error"===l?"cancel":"smart_toy"}),(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),e.name&&(0,r.jsx)("span",{className:"text-[9px] text-text-muted/70 italic pl-1",children:e.name})]}),d&&(0,r.jsxs)("div",{className:"relative group/btn",children:[(0,r.jsx)("button",{onClick:d,disabled:c,className:`p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-opacity ${c?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:(0,r.jsx)("span",{className:"material-symbols-outlined text-sm",style:c?{animation:"spin 1s linear infinite"}:void 0,children:c?"progress_activity":"science"})}),(0,r.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:c?"Testing...":"Test"})]}),(0,r.jsxs)("div",{className:"relative group/btn",children:[(0,r.jsx)("button",{onClick:()=>a(t,`model-${e.id}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-sm",children:s===`model-${e.id}`?"check":"content_copy"})}),(0,r.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:s===`model-${e.id}`?"Copied!":"Copy"})]}),o&&(0,r.jsx)("span",{className:"text-[10px] font-bold text-green-500 bg-green-500/10 px-1.5 py-0.5 rounded",children:"FREE"}),n&&(0,r.jsx)("button",{onClick:i,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,r.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})})]})})}function j({isOpen:e,onSave:t,onClose:s}){let[a,l]=(0,o.useState)(""),n=()=>{a.trim()&&(t(a.trim()),l(""))};return(0,r.jsx)(i.aF,{isOpen:e,title:"Add Custom Model",onClose:s,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,r.jsx)("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:a,onChange:e=>l(e.target.value),onKeyDown:e=>"Enter"===e.key&&n(),placeholder:"e.g. tts-1-hd",autoFocus:!0})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:n,fullWidth:!0,disabled:!a.trim(),children:"Add"}),(0,r.jsx)(i.$n,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function w({providerId:e,kindFilter:t,providerAliasOverride:s}){let{copied:a,copy:l}=(0,m.C)(),[n,d]=(0,o.useState)({}),[p,x]=(0,o.useState)([]),[h,b]=(0,o.useState)({}),[f,g]=(0,o.useState)(null),[y,N]=(0,o.useState)(null),[k,C]=(0,o.useState)(!1),[S,$]=(0,o.useState)([]),_=s||(0,c.wG)(e),T=t||"llm",E=(0,o.useCallback)(async()=>{try{let[t,s,r]=await Promise.all([fetch("/api/models/alias"),fetch("/api/providers",{cache:"no-store"}),fetch("/api/models/custom",{cache:"no-store"})]),a=await t.json(),l=await s.json(),n=await r.json();t.ok&&d(a.aliases||{}),s.ok&&$((l.connections||[]).filter(t=>t.provider===e)),r.ok&&x(n.models||[])}catch(e){console.log("ModelsCard fetch error:",e)}},[e]);(0,o.useEffect)(()=>{E()},[E]);let R=async(e,t)=>{let s=`${_}/${e}`;try{(await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:s,alias:t})})).ok&&await E()}catch(e){console.log("set alias error:",e)}},O=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await E()}catch(e){console.log("delete alias error:",e)}},A=async e=>{try{(await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:_,id:e,type:T})})).ok&&(await E(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("add custom model error:",e)}},P=async e=>{try{let t=new URLSearchParams({providerAlias:_,id:e,type:T});(await fetch(`/api/models/custom?${t}`,{method:"DELETE"})).ok&&(await E(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("delete custom model error:",e)}},I=async e=>{if(!f){g(e);try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${_}/${e}`,kind:t})}),r=await s.json();b(t=>({...t,[e]:r.ok?"ok":"error"})),N(r.ok?null:{modelId:e,message:r.error||"Model not reachable"})}catch{b(t=>({...t,[e]:"error"})),N({modelId:e,message:"Network error"})}finally{g(null)}}},L=(0,u.KC)(e),M=t?L.filter(e=>e.kinds?e.kinds.includes(t):(e.type||"llm")===t):L,D=p.filter(e=>e.providerAlias===_&&(e.type||"llm")===T&&!M.some(t=>t.id===e.id)),U=(0,o.useMemo)(()=>{let e={};for(let[t,s]of Object.entries(n))s in e||(e[s]=t);return e},[n]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(i.Zp,{children:[(0,r.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,r.jsxs)("h2",{className:"text-lg font-semibold",children:["Models",t?` — ${t.toUpperCase()}`:""]})}),y&&(0,r.jsxs)("p",{className:"text-xs text-red-500 mb-3 break-words",children:[y.modelId,": ",y.message]}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-3",children:[M.map(e=>{let t=U[`${_}/${e.id}`];return(0,r.jsx)(v,{model:e,fullModel:`${_}/${e.id}`,alias:t,copied:a,onCopy:l,onSetAlias:t=>R(e.id,t),onDeleteAlias:()=>O(t),testStatus:h[e.id],onTest:S.length>0?()=>I(e.id):void 0,isTesting:f===e.id,isFree:e.isFree},e.id)}),D.map(e=>(0,r.jsx)(v,{model:{id:e.id,name:e.name},fullModel:`${_}/${e.id}`,copied:a,onCopy:l,onSetAlias:()=>{},onDeleteAlias:()=>P(e.id),testStatus:h[e.id],onTest:S.length>0?()=>I(e.id):void 0,isTesting:f===e.id,isCustom:!0},`${e.id}-${e.type}`)),(0,r.jsxs)("button",{onClick:()=>C(!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,r.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]})]})]}),(0,r.jsx)(j,{isOpen:k,onSave:async e=>{await A(e),C(!1)},onClose:()=>C(!1)})]})}b.propTypes={until:x().string.isRequired},f.propTypes={connection:x().shape({id:x().string,name:x().string,email:x().string,displayName:x().string,testStatus:x().string,isActive:x().bool,lastError:x().string,priority:x().number}).isRequired,proxyPools:x().array,isOAuth:x().bool.isRequired,isFirst:x().bool.isRequired,isLast:x().bool.isRequired,onMoveUp:x().func.isRequired,onMoveDown:x().func.isRequired,onToggleActive:x().func.isRequired,onUpdateProxy:x().func,onEdit:x().func.isRequired,onDelete:x().func.isRequired},g.propTypes={isOpen:x().bool.isRequired,provider:x().string,providerName:x().string,proxyPools:x().array,onSave:x().func.isRequired,onClose:x().func.isRequired},y.propTypes={providerId:x().string.isRequired,isOAuth:x().bool},v.propTypes={model:x().shape({id:x().string.isRequired}).isRequired,fullModel:x().string.isRequired,copied:x().string,onCopy:x().func.isRequired,testStatus:x().oneOf(["ok","error"]),isCustom:x().bool,isFree:x().bool,onDeleteAlias:x().func,onTest:x().func,isTesting:x().bool},j.propTypes={isOpen:x().bool.isRequired,onSave:x().func.isRequired,onClose:x().func.isRequired},w.propTypes={providerId:x().string.isRequired,kindFilter:x().string,providerAliasOverride:x().string};let N={"google-tts":{hasLanguageDropdown:!1,hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"hardcoded"},openai:{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"openai-tts-models",voiceKey:"openai-tts-voices",voicesPerModel:!0},openrouter:{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"openrouter-tts-models",voiceKey:"openrouter-tts-voices",voicesPerModel:!0},elevenlabs:{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",modelKey:"elevenlabs-tts-models",apiEndpoint:"/api/media-providers/tts/elevenlabs/voices"},"edge-tts":{hasLanguageDropdown:!1,hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"api-language"},"local-device":{hasLanguageDropdown:!1,hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"api-language"},nvidia:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},hyperbolic:{hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"config"},deepgram:{hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/deepgram/voices"},huggingface:{hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"config"},cartesia:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},playht:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},coqui:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},tortoise:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},inworld:{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",modelKey:"inworld-tts-models",apiEndpoint:"/api/media-providers/tts/inworld/voices"},qwen:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},minimax:{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/minimax/voices",defaultVoiceId:"English_expressive_narrator"},"minimax-cn":{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/minimax/voices?provider=minimax-cn",defaultVoiceId:"English_expressive_narrator"},gemini:{hasLanguageDropdown:!1,hasLanguageHint:!0,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"gemini-tts-models",voiceKey:"gemini-tts-voices",voicesPerModel:!0}};var k=s(717),C=s(91781),S=s(62199);function $({label:e,children:t}){return(0,r.jsxs)("div",{className:"flex min-w-0 flex-col gap-1.5 sm:flex-row sm:items-center sm:gap-3",children:[(0,r.jsx)("span",{className:"w-full text-xs font-medium text-text-muted sm:w-20 sm:shrink-0",children:e}),(0,r.jsx)("div",{className:"w-full min-w-0 flex-1",children:t})]})}let _=`// Audio will appear here after running.
|
|
2
|
+
// Example JSON response (response_format=json):
|
|
3
|
+
{
|
|
4
|
+
"format": "mp3",
|
|
5
|
+
"audio": "//NExAANaAIIAUAAANNNNNNNN..." // base64 encoded MP3
|
|
6
|
+
}`,T=`{
|
|
7
|
+
"object": "list",
|
|
8
|
+
"data": [{
|
|
9
|
+
"object": "embedding",
|
|
10
|
+
"index": 0,
|
|
11
|
+
"embedding": [0.002301, -0.019212, 0.004815, -0.031249, ...]
|
|
12
|
+
}],
|
|
13
|
+
"model": "...",
|
|
14
|
+
"usage": { "prompt_tokens": 9, "total_tokens": 9 }
|
|
15
|
+
}`,E="https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png";function R(e){let t="string"==typeof e?e.trim():"";return t?/^(data:image\/|https?:\/\/)/i.test(t)?t:`data:image/png;base64,${t}`:""}let O={webSearch:{inputLabel:"Query",inputPlaceholder:"What is the latest news about AI?",defaultInput:"What is the latest news about AI?",bodyKey:"query",defaultResponse:`{
|
|
16
|
+
"results": [
|
|
17
|
+
{ "title": "...", "url": "...", "snippet": "..." }
|
|
18
|
+
]
|
|
19
|
+
}`,extraFields:[{key:"search_type",label:"Type",type:"select",default:"web",options:["web","news"]},{key:"max_results",label:"Max results",type:"number",default:5,min:1,max:100},{key:"country",label:"Country",type:"text",default:""},{key:"language",label:"Language",type:"text",default:""}]},webFetch:{inputLabel:"URL",inputPlaceholder:"https://example.com",defaultInput:"https://example.com",bodyKey:"url",defaultResponse:`{
|
|
20
|
+
"content": "...",
|
|
21
|
+
"title": "...",
|
|
22
|
+
"url": "..."
|
|
23
|
+
}`,extraFields:[{key:"format",label:"Format",type:"select",default:"markdown",options:["markdown","text","html"]},{key:"max_characters",label:"Max chars",type:"number",default:0,min:0}]},image:{inputLabel:"Prompt",inputPlaceholder:"A cute cat wearing a hat",defaultInput:"A cute cat wearing a hat",bodyKey:"prompt",defaultResponse:`{
|
|
24
|
+
"data": [
|
|
25
|
+
{ "url": "...", "b64_json": "..." }
|
|
26
|
+
]
|
|
27
|
+
}`,extraFields:[{key:"n",label:"n",type:"number",default:1,min:1,max:4},{key:"size",label:"Size",type:"select",default:"auto",options:["auto","1024x1024","1024x1536","1536x1024","1024x1792","1792x1024"]},{key:"quality",label:"Quality",type:"select",default:"auto",options:["auto","low","medium","high","standard","hd"]},{key:"background",label:"Background",type:"select",default:"auto",options:["auto","transparent","opaque"]},{key:"style",label:"Style",type:"select",default:"",options:["","vivid","natural"]},{key:"response_format",label:"Format",type:"select",default:"",options:["","url","b64_json"]},{key:"image_detail",label:"Image Detail",type:"select",default:"high",options:["auto","low","high","original"]},{key:"output_format",label:"Codec",type:"select",default:"png",options:["png","jpeg","webp"]}]},imageToText:{inputLabel:"Image URL",inputPlaceholder:"https://example.com/image.png",defaultInput:"https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/1200px-Cat03.jpg",bodyKey:"url",extraBody:{prompt:"Describe this image in detail"},defaultResponse:`{
|
|
28
|
+
"text": "A cat sitting on a windowsill...",
|
|
29
|
+
"model": "..."
|
|
30
|
+
}`},video:{inputLabel:"Prompt",inputPlaceholder:"A serene lake at sunset",defaultInput:"A serene lake at sunset",bodyKey:"prompt",defaultResponse:`{
|
|
31
|
+
"data": [
|
|
32
|
+
{ "url": "..." }
|
|
33
|
+
]
|
|
34
|
+
}`},music:{inputLabel:"Prompt",inputPlaceholder:"A calm piano melody",defaultInput:"A calm piano melody",bodyKey:"prompt",defaultResponse:`{
|
|
35
|
+
"data": [
|
|
36
|
+
{ "url": "...", "format": "mp3" }
|
|
37
|
+
]
|
|
38
|
+
}`}};function A({providerId:e,customAlias:t}){let s=(0,c.gC)(e),a=s?t||e:(0,c.wG)(e),l=s?[]:(0,u.KC)(e).filter(e=>"embedding"===e.type),[n,d]=(0,o.useState)(l[0]?.id??""),[p,x]=(0,o.useState)("The quick brown fox jumps over the lazy dog"),[h,b]=(0,o.useState)(""),[f,g]=(0,o.useState)(""),[y,v]=(0,o.useState)(!1),[j,w]=(0,o.useState)(""),[N,k]=(0,o.useState)(""),[C,_]=(0,o.useState)(null),[E,R]=(0,o.useState)(!1),[O,P]=(0,o.useState)(""),{copied:I,copy:L}=(0,m.C)(),{copied:M,copy:D}=(0,m.C)();(0,o.useEffect)(()=>{w(window.location.origin),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&k(e.publicUrl)}).catch(()=>{})},[]);let U=y?N:j,K=n?`${a}/${n}`:"",B=()=>{let e={model:K,input:p.trim()},t=Number(h);return h&&Number.isFinite(t)&&t>0&&(e.dimensions=t),e},F=`curl -X POST ${U}/v1/embeddings \\
|
|
39
|
+
-H "Content-Type: application/json" \\
|
|
40
|
+
-H "Authorization: Bearer ${f||"YOUR_KEY"}" \\
|
|
41
|
+
-d '${JSON.stringify(B())}'`,q=async()=>{if(!p.trim()||!K)return;R(!0),P(""),_(null);let e=Date.now();try{let t={"Content-Type":"application/json"};f&&(t.Authorization=`Bearer ${f}`);let s=await fetch((0,S.O)("/v1/embeddings"),{method:"POST",headers:t,body:JSON.stringify(B())}),r=Date.now()-e,a=await s.json().catch(()=>null);if(!s.ok)return void P(a?.error?.message||a?.error||`HTTP ${s.status}`);if(null==a)return void P("Invalid response from server");_({data:a,latencyMs:r})}catch(e){P(e.message||"Network error")}finally{R(!1)}},J=C?JSON.stringify(C.data,null,2):"";return(0,r.jsxs)(i.Zp,{children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Example"}),(0,r.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,r.jsx)($,{label:"Model",children:s?(0,r.jsx)("input",{value:n,onChange:e=>d(e.target.value),placeholder:"e.g. voyage-3, embed-english-v3.0, text-embedding-3-small",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"}):(0,r.jsx)("select",{value:n,onChange:e=>d(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:l.map(e=>(0,r.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),(0,r.jsx)($,{label:"Endpoint",children:(0,r.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,r.jsx)("input",{value:U,onChange:e=>y?k(e.target.value):w(e.target.value),className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono",placeholder:"http://localhost:3000"}),N&&(0,r.jsxs)("button",{onClick:()=>v(e=>!e),title:y?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${y?"border-primary/40 bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"wifi_tethering"}),"Tunnel"]})]})}),(0,r.jsx)($,{label:"API Key",children:(0,r.jsx)("input",{type:"password",value:f,onChange:e=>g(e.target.value),placeholder:"sk-...",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}),(0,r.jsx)($,{label:"Input",children:(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("input",{value:p,onChange:e=>x(e.target.value),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),p&&(0,r.jsx)("button",{type:"button",onClick:()=>x(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})}),(0,r.jsx)($,{label:"Dimensions",children:(0,r.jsx)("input",{type:"number",min:"1",value:h,onChange:e=>b(e.target.value),placeholder:"optional, e.g. 512, 1024 (leave empty for default)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),(0,r.jsxs)("div",{className:"mt-1",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,r.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,r.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,r.jsxs)("button",{onClick:()=>L(F),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:I?"check":"content_copy"}),I?"Copied":"Copy"]}),(0,r.jsxs)("button",{onClick:q,disabled:E||!p.trim()||!K,className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-white text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:E?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),E?"Running...":"Run"]})]})]}),(0,r.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:F})]}),O&&(0,r.jsx)("p",{className:"text-xs text-red-500 break-words",children:O}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,r.jsxs)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:["Response ",C&&(0,r.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",C.latencyMs,"ms"]})]}),C&&(0,r.jsxs)("button",{onClick:()=>D(J),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:M?"check":"content_copy"}),M?"Copied":"Copy"]})]}),(0,r.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all opacity-70",children:(e=>{if(!e)return T;let t=JSON.parse(JSON.stringify(e));return(t.data||[]).forEach(e=>{Array.isArray(e.embedding)&&e.embedding.length>4&&(e.embedding=[...e.embedding.slice(0,4).map(e=>parseFloat(e.toFixed(6))),`... (${e.embedding.length} dims)`])}),JSON.stringify(t,null,2)})(C?.data)})]})]})]})}function P({providerId:e}){let t,s=(0,c.wG)(e),a=N[e]||N["edge-tts"],[l,n]=(0,o.useState)(a.defaultVoiceId||""),[d,p]=(0,o.useState)(""),[x,h]=(0,o.useState)(a.defaultVoiceId||""),[b,f]=(0,o.useState)([]),[g,y]=(0,o.useState)(""),[v,j]=(0,o.useState)(()=>{let t=c.Q2[e]?.ttsConfig?.models;if(t?.length)return t[0].id;if(a.hasModelSelector&&a.modelKey){let e=(0,u.KC)(a.modelKey);return e?.[0]?.id||""}return""}),[w,T]=(0,o.useState)("Hello, this is a text to speech test."),[E,R]=(0,o.useState)(!1),[O,A]=(0,o.useState)(""),[I,L]=(0,o.useState)(""),[M,D]=(0,o.useState)("mp3"),[U,K]=(0,o.useState)(""),[B,F]=(0,o.useState)(null),[q,J]=(0,o.useState)(!1),[z,V]=(0,o.useState)(""),[H,W]=(0,o.useState)(null),{copied:G,copy:Y}=(0,m.C)(),Q=(0,o.useRef)("");(0,o.useEffect)(()=>()=>{if(Q.current)try{URL.revokeObjectURL(Q.current)}catch{}},[]);let[Z,X]=(0,o.useState)(!1),[ee,et]=(0,o.useState)([]),[es,er]=(0,o.useState)(!1),[ea,el]=(0,o.useState)(""),[en,eo]=(0,o.useState)(""),[ei,ed]=(0,o.useState)({}),[ec,eu]=(0,o.useState)("");(0,o.useEffect)(()=>{if(A(window.location.origin),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&L(e.publicUrl)}).catch(()=>{}),"hardcoded"===a.voiceSource){let t=a.hasModelSelector&&a.modelKey&&(0,u.KC)(a.modelKey)?.[0]?.id||"",s=a.voicesPerModel&&t?(0,k.jY)(e,t)||[]:(0,u.KC)(a.voiceKey||e).filter(e=>"tts"===e.type);if(s.length)if(a.hasBrowseButton){let e=s.find(e=>"en"===e.id)||s[0];y(e.id),n(e.id),p(e.name),f([{id:e.id,name:e.name}])}else f(s),n(s[0].id),p(s[0].name||s[0].id)}},[e]),(0,o.useEffect)(()=>{if(!a.voicesPerModel||!v)return;let t=(0,k.jY)(e,v)||[];f(t),t.length&&(n(t[0].id),p(t[0].name||t[0].id))},[v]);let em=async()=>{if(X(!0),el(""),eo(""),!ee.length){er(!0);try{if("hardcoded"===a.voiceSource){let t=a.voiceKey||e,s=(0,u.KC)(t).filter(e=>"tts"===e.type),r={};for(let e of s)r[e.id]||(r[e.id]={code:e.id,name:e.name,voices:[{id:e.id,name:e.name}]});ed(r),et(Object.values(r).sort((e,t)=>e.name.localeCompare(t.name)))}else{let t=a.apiEndpoint?a.apiEndpoint:`/api/media-providers/tts/voices?provider=${"local-device"===e?"local-device":"edge-tts"}`,s=await fetch(t),r=await s.json();if(r.error)return void eo(r.error);et(r.languages||[]),ed(r.byLang||{})}}catch(e){eo(e.message)}finally{er(!1)}}},ep=ea?ee.filter(e=>e.name.toLowerCase().includes(ea.toLowerCase())||e.code.toLowerCase().includes(ea.toLowerCase())):ee,ex=E?I:O,eh=a.hasVoiceIdInput&&x||l,eb=a.hasModelSelector&&v&&eh?`${s}/${v}/${eh}`:a.hasModelSelector&&v?`${s}/${v}`:eh?`${s}/${eh}`:"",ef=(t={model:eb,input:w},a.hasLanguageHint&&ec&&(t.language=ec),t),eg=`curl -X POST ${ex}/v1/audio/speech${"json"===M?"?response_format=json":""} \\
|
|
42
|
+
-H "Content-Type: application/json" \\
|
|
43
|
+
-H "Authorization: Bearer YOUR_KEY" \\
|
|
44
|
+
-d '${JSON.stringify(ef)}' \\
|
|
45
|
+
${"json"===M?"":"--output speech.mp3"}`,ey=async()=>{if(!w.trim()||!eb)return;if(J(!0),V(""),Q.current){try{URL.revokeObjectURL(Q.current)}catch{}Q.current=""}K(""),F(null);let e=Date.now();try{let t=(0,S.O)(`/v1/audio/speech${"json"===M?"?response_format=json":""}`),s=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...ef,input:w.trim()})});if(W(Date.now()-e),!s.ok){let e=await s.json().catch(()=>({}));V(e?.error?.message||e?.error||`HTTP ${s.status}`);return}if("json"===M){let e=await s.json().catch(()=>null);if(!e||"string"!=typeof e.audio||!e.audio)return void V(e?.error?.message||e?.error||"TTS response did not include audio data");F(e);let t=await fetch(`data:audio/mp3;base64,${e.audio}`).then(e=>e.blob()),r=URL.createObjectURL(t);Q.current=r,K(r)}else{let e=await s.blob(),t=URL.createObjectURL(e);Q.current=t,K(t)}}catch(e){V(e.message||"Network error")}finally{J(!1)}};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(i.Zp,{children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Example"}),(0,r.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,r.jsx)($,{label:"Endpoint",children:(0,r.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,r.jsxs)("span",{className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate",children:[ex,"/v1/audio/speech"]}),I&&(0,r.jsxs)("button",{onClick:()=>R(e=>!e),title:E?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${E?"border-primary/40 bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"wifi_tethering"}),"Tunnel"]})]})}),(0,r.jsx)($,{label:"API Key",children:(0,r.jsx)("span",{className:"px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate block",children:(0,r.jsx)("span",{className:"text-text-muted italic",children:"Dashboard session (server-side)"})})}),a.hasModelSelector&&(a.modelKey||c.Q2[e]?.ttsConfig?.models?.length)&&(0,r.jsx)($,{label:"Model",children:(0,r.jsx)("select",{value:v,onChange:e=>j(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:((c.Q2[e]?.ttsConfig?.models?.length?c.Q2[e].ttsConfig.models:(0,u.KC)(a.modelKey))||[]).map(e=>(0,r.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),a.hasLanguageHint&&(0,r.jsx)($,{label:"Language",children:(0,r.jsxs)("select",{value:ec,onChange:e=>eu(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,r.jsx)("option",{value:"",children:"Auto-detect"}),C.I.map(e=>(0,r.jsx)("option",{value:e.name,children:e.name},e.id))]})}),a.hasBrowseButton&&(0,r.jsx)($,{label:"Language",children:(0,r.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,r.jsx)("button",{onClick:em,className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm border border-border rounded-lg bg-background font-mono truncate text-left hover:border-primary/40 transition-colors",children:g?(0,r.jsx)("span",{className:"text-text-main",children:ee.find(e=>e.code===g)?.name||g}):(0,r.jsx)("span",{className:"text-text-muted",children:"No language selected"})}),(0,r.jsxs)("button",{onClick:em,className:"flex w-full items-center justify-center gap-1 text-xs px-2.5 py-1.5 rounded-lg border border-border text-text-muted hover:text-primary hover:border-primary/40 transition-colors sm:w-auto sm:shrink-0",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"language"}),"Select language"]})]})}),b.length>0&&(0,r.jsx)($,{label:"Voice",children:(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:b.map(e=>(0,r.jsxs)("button",{onClick:()=>{n(e.id),p(e.name),a.hasVoiceIdInput&&h(e.id)},className:`px-2.5 py-1 rounded-full text-xs border transition-colors ${l===e.id?"bg-primary/15 border-primary/40 text-primary font-medium":"border-border text-text-muted hover:text-primary hover:border-primary/40"}`,children:[e.name,e.gender?` \xb7 ${e.gender[0].toUpperCase()}`:"",!0===e.free_users_allowed&&(0,r.jsx)("span",{className:"ml-1.5 px-1 py-0.5 text-[9px] font-semibold rounded bg-green-500/15 text-green-600 border border-green-500/20",children:"Free"}),!1===e.free_users_allowed&&(0,r.jsx)("span",{className:"ml-1.5 px-1 py-0.5 text-[9px] font-semibold rounded bg-amber-500/15 text-amber-600 border border-amber-500/20",children:"Paid"})]},e.id))})}),a.hasVoiceIdInput&&(0,r.jsx)($,{label:"Voice ID",children:(0,r.jsx)("div",{className:"flex flex-col gap-1",children:(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("input",{value:x,onChange:e=>{h(e.target.value),n(e.target.value)},placeholder:"e.g. CwhRBWXzGAHq8TQ4Fs17",className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"}),x&&(0,r.jsx)("button",{type:"button",onClick:()=>{h(""),n("")},className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})})}),a.hasLanguageDropdown&&(0,r.jsx)($,{label:"Language",children:(0,r.jsx)("select",{value:l,onChange:t=>{let s=(0,u.KC)(e).filter(e=>"tts"===e.type).find(e=>e.id===t.target.value);n(t.target.value),p(s?.name||t.target.value)},className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:(0,u.KC)(e).filter(e=>"tts"===e.type).map(e=>(0,r.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),(0,r.jsx)($,{label:"Input",children:(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("input",{value:w,onChange:e=>T(e.target.value),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),w&&(0,r.jsx)("button",{type:"button",onClick:()=>T(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})}),(0,r.jsx)($,{label:"Output Format",children:(0,r.jsxs)("select",{value:M,onChange:e=>D(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,r.jsx)("option",{value:"mp3",children:"MP3 (Binary)"}),(0,r.jsx)("option",{value:"json",children:"JSON (Base64)"})]})}),(0,r.jsxs)("div",{className:"mt-1",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,r.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,r.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,r.jsxs)("button",{onClick:()=>Y(eg),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:G?"check":"content_copy"}),G?"Copied":"Copy"]}),(0,r.jsxs)("button",{onClick:ey,disabled:q||!w.trim()||!eb,className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-white text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:q?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),q?"Generating...":"Run"]})]})]}),(0,r.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:eg})]}),z&&(0,r.jsx)("p",{className:"text-xs text-red-500 break-words",children:z}),U?(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,r.jsxs)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:["Response ",H&&(0,r.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",H,"ms"]})]}),(0,r.jsxs)("a",{href:U,download:"speech.mp3",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})]}),(0,r.jsx)("audio",{controls:!0,src:U,className:"w-full"}),B&&(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsx)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:(0,r.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"JSON Response"})}),(0,r.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:JSON.stringify({format:B.format,audio:B.audio?`${B.audio.substring(0,100)}...`:""},null,2)})]})]}):(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Response"}),(0,r.jsx)("pre",{className:"mt-1.5 bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all opacity-50",children:_})]})]})]}),Z&&(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-end justify-center sm:items-center",style:{backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(2px)"},onClick:()=>X(!1),children:(0,r.jsxs)("div",{className:"border border-border rounded-xl shadow-2xl w-full max-w-md mx-4 flex flex-col max-h-[80vh]",style:{backgroundColor:"var(--color-bg)",isolation:"isolate"},onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border shrink-0 rounded-t-xl",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold",children:"Select Language"}),(0,r.jsx)("button",{onClick:()=>X(!1),className:"text-text-muted hover:text-primary transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,r.jsx)("div",{className:"px-4 py-2.5 border-b border-border shrink-0",children:(0,r.jsx)("input",{autoFocus:!0,value:ea,onChange:e=>el(e.target.value),placeholder:"Search language...",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),(0,r.jsxs)("div",{className:"overflow-y-auto flex-1 p-2",children:[en&&(0,r.jsx)("p",{className:"text-xs text-red-500 px-2 py-1",children:en}),es?(0,r.jsx)("p",{className:"text-xs text-text-muted px-2 py-3",children:"Loading..."}):(0,r.jsxs)("div",{className:"flex flex-col gap-0.5",children:[ep.map(e=>(0,r.jsxs)("button",{onClick:()=>{let t;return X(!1),y(e.code),void(f(t=ei[e.code]?.voices||[]),t.length&&(n(t[0].id),p(t[0].name),a.hasVoiceIdInput&&h(t[0].id)))},className:`flex items-center justify-between w-full px-3 py-2 rounded-lg text-left hover:bg-sidebar transition-colors ${g===e.code?"bg-primary/10 text-primary":""}`,children:[(0,r.jsx)("span",{className:"text-sm",children:e.name}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:[e.voices.length," voices"]}),g===e.code&&(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",children:"check"})]})]},e.code)),0===ep.length&&(0,r.jsx)("p",{className:"text-xs text-text-muted px-2 py-3",children:"No languages found."})]})]})]})})]})}function I({providerId:e,kind:t}){let s=(0,c.wG)(e),a=(0,c.rs)(s)===e?s:e,l=c.rj.find(e=>e.id===t),n=O[t],d=n||{},p=(0,u.KC)(e).filter(e=>e.type===t),x=new Set(["image","video","music","imageToText"]).has(t),h=x&&0===p.length,[b,f]=(0,o.useState)(p[0]?.id??""),g=p.find(e=>e.id===b),y=!!g?.capabilities?.includes("edit"),v=!!g?.capabilities?.includes("mask"),[j,w]=(0,o.useState)(d.defaultInput||""),[N,k]=(0,o.useState)(""),[C,_]=(0,o.useState)(""),[T,A]=(0,o.useState)(()=>(d.extraFields||[]).reduce((e,t)=>(e[t.key]=t.default??"",e),{})),[P,L]=(0,o.useState)(!1),[M,D]=(0,o.useState)(""),[U,K]=(0,o.useState)(""),[B,F]=(0,o.useState)(null),[q,J]=(0,o.useState)(null),[z,V]=(0,o.useState)(null),[H,W]=(0,o.useState)("json"),[G,Y]=(0,o.useState)(""),[Q,Z]=(0,o.useState)(!1),[X,ee]=(0,o.useState)(""),[et,es]=(0,o.useState)([]),[er,ea]=(0,o.useState)(""),{copied:el,copy:en}=(0,m.C)(),{copied:eo,copy:ei}=(0,m.C)(),ed=(0,o.useRef)(null);if((0,o.useEffect)(()=>()=>{ed.current?.abort()},[]),(0,o.useEffect)(()=>{D(window.location.origin),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&K(e.publicUrl)}).catch(()=>{}),fetch("/api/providers/client").then(e=>e.json()).then(t=>{es((t.connections||[]).filter(t=>t.provider===e&&!1!==t.isActive))}).catch(()=>{})},[e]),!l||!n)return null;let ec=P?U:M,eu=l.endpoint.path,em=x?b?`${a}/${b}`:h?"":a:a,ep="cloudflare-ai"!==e?{}:"@cf/runwayml/stable-diffusion-v1-5-img2img"===b?{image:E}:"@cf/runwayml/stable-diffusion-v1-5-inpainting"===b?{image:E,mask_image:"https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png"}:{},ex=N.trim()||ep.image||"",eh=C.trim()||ep.mask_image||"",eb=R(ex),ef=R(eh),eg=Object.entries(T).reduce((e,[t,s])=>(""===s||null==s||"number"==typeof s&&Number.isNaN(s)||(e[t]=s),e),{}),ey={model:em,[n.bodyKey]:j,...n.extraBody,...eg,...y&&ex?{image:ex}:{},...v&&eh?{mask_image:eh}:{}},ev="image"===t&&"binary"===H,ej="image"===t&&"codex"===e&&!ev,ew=`${eu}${ev?"?response_format=binary":""}`,eN=(0,S.O)(ew),ek=`-H "Content-Type: application/json" \\
|
|
46
|
+
-H "Authorization: Bearer YOUR_KEY"${er?` \\
|
|
47
|
+
-H "x-connection-id: ${er}"`:""}${ej?` \\
|
|
48
|
+
-H "Accept: text/event-stream"`:""}`,eC=`curl -X ${l.endpoint.method} ${ec}${ew} \\
|
|
49
|
+
${ek.replace(/\\\n /g,"\\\n ")} \\
|
|
50
|
+
-d '${JSON.stringify(ey)}'${ev?" \\\n --output image.png":""}`,eS=async()=>{if(!eN)return void ee("Not supported by this router build");if(!j.trim()||!em)return;if(Z(!0),ee(""),F(null),J(null),V(null),G){try{URL.revokeObjectURL(G)}catch{}Y("")}let e=Date.now();try{let t={"Content-Type":"application/json"};er&&(t["x-connection-id"]=er),ej&&(t.Accept="text/event-stream");let s={...ey,model:em},r=await fetch(eN,{method:l.endpoint.method,headers:t,body:JSON.stringify(s)});if(!r.ok){let e=await r.json().catch(()=>({}));ee(e?.error?.message||e?.error||`HTTP ${r.status}`);return}let a=r.headers.get("content-type")||"";if(a.startsWith("image/")){let t=await r.blob(),s=URL.createObjectURL(t);Y(s),F({data:{binary:!0,mime:a,size:t.size},latencyMs:Date.now()-e});return}if(a.includes("text/event-stream")&&r.body){let t=new AbortController;ed.current=t;let s=r.body.getReader(),a=()=>{s.cancel().catch(()=>{})};t.signal.addEventListener("abort",a,{once:!0});let l=new TextDecoder,n="",o=null,i=null;try{for(;;){let e;if(t.signal.aborted)return;let{done:r,value:a}=await s.read();if(r)break;for(n+=l.decode(a,{stream:!0});-1!==(e=n.indexOf("\n\n"));){let t=n.slice(0,e);n=n.slice(e+2);let s=null,r="";for(let e of t.split("\n"))e.startsWith("event:")?s=e.slice(6).trim():e.startsWith("data:")&&(r+=e.slice(5).trim());if(s)try{let e=r?JSON.parse(r):{};"progress"===s?J(e):"partial_image"===s?V(e):"done"===s?o=e:"error"===s&&(i=e?.message||"Stream error")}catch{}}}}catch(e){if(t.signal.aborted)return;throw e}finally{t.signal.removeEventListener("abort",a),ed.current===t&&(ed.current=null)}let d=Date.now()-e;if(i)return void ee(i);o&&F({data:o,latencyMs:d})}else{let t=await r.json(),s=Date.now()-e;F({data:t,latencyMs:s})}}catch(e){ee(e.message||"Network error")}finally{Z(!1)}},e$=e=>{if(!e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(e$);let t={};for(let[s,r]of Object.entries(e))t[s]="b64_json"===s&&"string"==typeof r&&r.length>100?`<${r.length} chars base64>`:e$(r);return t},e_=B?JSON.stringify(e$(B.data),null,2):"";return(0,r.jsxs)(i.Zp,{children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Example"}),(0,r.jsxs)("div",{className:"flex flex-col gap-2.5",children:[p.length>0?(0,r.jsx)($,{label:"Model",children:(0,r.jsx)("select",{value:b,onChange:e=>f(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:p.map(e=>(0,r.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}):h?(0,r.jsx)($,{label:"Model",children:(0,r.jsx)("input",{value:b,onChange:e=>f(e.target.value),placeholder:"Enter model id (provider-specific)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}):null,(0,r.jsx)($,{label:"Endpoint",children:(0,r.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,r.jsxs)("span",{className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate",children:[ec,eu]}),U&&(0,r.jsxs)("button",{onClick:()=>L(e=>!e),title:P?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${P?"border-primary/40 bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"wifi_tethering"}),"Tunnel"]})]})}),(0,r.jsx)($,{label:"API Key",children:(0,r.jsx)("span",{className:"px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate block",children:(0,r.jsx)("span",{className:"text-text-muted italic",children:"Dashboard session (server-side)"})})}),et.length>0&&(0,r.jsx)($,{label:"Connection",children:(0,r.jsxs)("select",{value:er,onChange:e=>ea(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,r.jsx)("option",{value:"",children:"Auto (by priority)"}),et.map(e=>{let t=e.providerSpecificData?.chatgptPlanType,s=e.email||e.name||e.id.slice(0,8);return(0,r.jsxs)("option",{value:e.id,children:[s,t?` [${t}]`:""]},e.id)})]})}),(0,r.jsx)($,{label:n.inputLabel,children:(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("input",{value:j,onChange:e=>w(e.target.value),placeholder:n.inputPlaceholder,className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),j&&(0,r.jsx)("button",{type:"button",onClick:()=>w(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})}),y&&(0,r.jsx)($,{label:"Ref Image (URL)",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("input",{value:N,onChange:e=>k(e.target.value),placeholder:ep.image||"https://example.com/source.png",className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),N&&(0,r.jsx)("button",{type:"button",onClick:()=>k(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),eb&&(0,r.jsx)("img",{src:eb,alt:"Reference",className:"max-h-40 rounded-lg border border-border object-contain bg-sidebar",onError:e=>{e.currentTarget.style.display="none"},onLoad:e=>{e.currentTarget.style.display="block"}})]})}),v&&(0,r.jsx)($,{label:"Mask (URL)",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("input",{value:C,onChange:e=>_(e.target.value),placeholder:ep.mask_image||"https://example.com/mask.png",className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),C&&(0,r.jsx)("button",{type:"button",onClick:()=>_(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),ef&&(0,r.jsx)("img",{src:ef,alt:"Mask",className:"max-h-40 rounded-lg border border-border object-contain bg-sidebar",onError:e=>{e.currentTarget.style.display="none"},onLoad:e=>{e.currentTarget.style.display="block"}})]})}),(n.extraFields||[]).filter(e=>0===p.length||Array.isArray(g?.params)&&g.params.includes(e.key)).map(e=>(0,r.jsx)($,{label:e.label,children:"select"===e.type?(0,r.jsx)("select",{value:T[e.key]??"",onChange:t=>A(s=>({...s,[e.key]:t.target.value})),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:(e.options||[]).map(e=>(0,r.jsx)("option",{value:e,children:""===e?"(default)":e},e))}):"text"===e.type?(0,r.jsx)("input",{type:"text",value:T[e.key]??"",placeholder:e.placeholder,onChange:t=>A(s=>({...s,[e.key]:t.target.value})),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}):(0,r.jsx)("input",{type:"number",value:T[e.key]??"",min:e.min,max:e.max,onChange:t=>A(s=>({...s,[e.key]:""===t.target.value?"":Number(t.target.value)})),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})},e.key)),"image"===t&&(0,r.jsx)($,{label:"Output Format",children:(0,r.jsxs)("select",{value:H,onChange:e=>W(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,r.jsx)("option",{value:"json",children:"JSON (Base64)"}),(0,r.jsx)("option",{value:"binary",children:"Binary File"})]})}),(0,r.jsxs)("div",{className:"mt-1",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,r.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,r.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[eN&&(0,r.jsxs)("button",{onClick:()=>en(eC),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:el?"check":"content_copy"}),el?"Copied":"Copy"]}),(0,r.jsxs)("button",{onClick:eS,disabled:!eN||Q||!j.trim()||!em,title:eN?void 0:"Not supported by this router build",className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-white text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:Q?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),eN?Q?"Running...":"Run":"Unavailable"]})]})]}),eN?(0,r.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:eC}):(0,r.jsx)("div",{className:"rounded-lg border border-border bg-sidebar px-3 py-2.5 text-xs text-text-muted",children:"Not supported by this router build"})]}),(Q||q)&&ej&&(0,r.jsxs)("div",{className:"flex flex-col gap-2 px-3 py-2 rounded-lg bg-sidebar border border-border sm:flex-row sm:items-center sm:gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",style:Q?{animation:"spin 1s linear infinite"}:void 0,children:Q?"progress_activity":"check_circle"}),(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:[q?.stage||"starting",!Q&&q?.bytesReceived?` \xb7 ${(q.bytesReceived/1024).toFixed(1)} KB`:""]})]}),z?.b64_json&&!B&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Partial preview"}),(0,r.jsx)("img",{src:`data:image/png;base64,${z.b64_json}`,alt:"Partial",className:"max-w-full rounded-lg border border-border mt-1.5 opacity-80"})]}),X&&(0,r.jsx)("p",{className:"text-xs text-red-500 break-words",children:X}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,r.jsxs)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:["Response ",B&&(0,r.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",B.latencyMs,"ms"]})]}),B&&(0,r.jsxs)("button",{onClick:()=>ei(e_),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:eo?"check":"content_copy"}),eo?"Copied":"Copy"]})]}),(0,r.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all opacity-70",children:B?e_:n.defaultResponse}),"image"===t&&(G||B?.data?.data?.[0])&&(0,r.jsxs)("div",{className:"mt-2",children:[(0,r.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,r.jsxs)("a",{href:G||(B?.data?.data?.[0]?.b64_json?`data:image/png;base64,${B.data.data[0].b64_json}`:B?.data?.data?.[0]?.url||""),download:"image.png",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})}),(0,r.jsx)("img",{src:G||(B?.data?.data?.[0]?.b64_json?`data:image/png;base64,${B.data.data[0].b64_json}`:B?.data?.data?.[0]?.url),alt:"Generated",className:"max-w-full rounded-lg border border-border"})]})]})]})]})}function L({providerId:e}){let t=(0,c.wG)(e),s=(0,u.KC)(e).filter(e=>"stt"===e.type),[a,l]=(0,o.useState)([]),n=[...s,...a],[d,p]=(0,o.useState)(s[0]?.id??""),x=n.find(e=>e.id===d),h=Array.isArray(x?.params)?x.params:[],[b,f]=(0,o.useState)(null),[g,y]=(0,o.useState)(""),[v,j]=(0,o.useState)(""),[w,N]=(0,o.useState)("json"),[k,C]=(0,o.useState)(""),[_,T]=(0,o.useState)(!1),[E,R]=(0,o.useState)(""),[O,A]=(0,o.useState)(""),[P,I]=(0,o.useState)(null),[M,D]=(0,o.useState)(null),[U,K]=(0,o.useState)(!1),[B,F]=(0,o.useState)(""),{copied:q,copy:J}=(0,m.C)(),{copied:z,copy:V}=(0,m.C)();(0,o.useEffect)(()=>{R(window.location.origin),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&A(e.publicUrl)}).catch(()=>{});let e=()=>{fetch("/api/models/custom",{cache:"no-store"}).then(e=>e.json()).then(e=>{l((e.models||[]).filter(e=>"stt"===e.type&&e.providerAlias===t))}).catch(()=>{})};return e(),window.addEventListener("focus",e),window.addEventListener("customModelChanged",e),()=>{window.removeEventListener("focus",e),window.removeEventListener("customModelChanged",e)}},[t]);let H=_?O:E,W=d?`${t}/${d}`:"",G=`curl -X POST ${H}/v1/audio/transcriptions \\
|
|
51
|
+
-H "Authorization: Bearer YOUR_KEY" \\
|
|
52
|
+
-F "file=@${b?.name||"audio.mp3"}" \\
|
|
53
|
+
-F "model=${W}"${h.includes("language")&&g?` \\
|
|
54
|
+
-F "language=${g}"`:""}${h.includes("response_format")?` \\
|
|
55
|
+
-F "response_format=${w}"`:""}${h.includes("temperature")&&k?` \\
|
|
56
|
+
-F "temperature=${k}"`:""}${h.includes("prompt")&&v?` \\
|
|
57
|
+
-F "prompt=${v}"`:""}`,Y=async()=>{if(!b||!W)return;K(!0),F(""),I(null);let e=Date.now();try{let t=new FormData;t.append("file",b),t.append("model",W),h.includes("language")&&g&&t.append("language",g),h.includes("response_format")&&t.append("response_format",w),h.includes("temperature")&&k&&t.append("temperature",k),h.includes("prompt")&&v&&t.append("prompt",v);let s=await fetch((0,S.O)("/v1/audio/transcriptions"),{method:"POST",body:t});D(Date.now()-e);let r=(s.headers.get("content-type")||"").includes("application/json")?await s.json():await s.text();if(!s.ok)return void F(r?.error?.message||r?.error||r||`HTTP ${s.status}`);I(r)}catch(e){F(e.message||"Network error")}finally{K(!1)}},Q="string"==typeof P?P:P?JSON.stringify(P,null,2):`{
|
|
58
|
+
"text": "Hello world..."
|
|
59
|
+
}`;return(0,r.jsxs)(i.Zp,{children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Example"}),(0,r.jsxs)("div",{className:"flex flex-col gap-2.5",children:[n.length>0?(0,r.jsx)($,{label:"Model",children:(0,r.jsx)("select",{value:d,onChange:e=>p(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:n.map(e=>(0,r.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}):(0,r.jsx)($,{label:"Model",children:(0,r.jsx)("input",{value:d,onChange:e=>p(e.target.value),placeholder:"Enter model id",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}),(0,r.jsx)($,{label:"Endpoint",children:(0,r.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,r.jsxs)("span",{className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate",children:[H,"/v1/audio/transcriptions"]}),O&&(0,r.jsxs)("button",{onClick:()=>T(e=>!e),title:_?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${_?"border-primary/40 bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"wifi_tethering"}),"Tunnel"]})]})}),(0,r.jsx)($,{label:"API Key",children:(0,r.jsx)("span",{className:"px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate block",children:(0,r.jsx)("span",{className:"text-text-muted italic",children:"Dashboard session (server-side)"})})}),(0,r.jsx)($,{label:"Audio File",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsx)("input",{type:"file",accept:"audio/*,video/mp4,.m4a,.mp3,.wav,.ogg,.flac,.webm,.opus",onChange:e=>f(e.target.files?.[0]||null),className:"w-full text-xs text-text-muted file:mr-2 file:py-1 file:px-2.5 file:rounded-lg file:border file:border-border file:bg-background file:text-text-main hover:file:bg-sidebar file:cursor-pointer"}),b&&(0,r.jsxs)("span",{className:"text-xs text-text-muted font-mono",children:[b.name," \xb7 ",(b.size/1024).toFixed(1)," KB"]})]})}),h.includes("language")&&(0,r.jsx)($,{label:"Language",children:(0,r.jsx)("input",{value:g,onChange:e=>y(e.target.value),placeholder:"e.g. en, vi, ja (auto-detect if empty)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}),h.includes("prompt")&&(0,r.jsx)($,{label:"Prompt",children:(0,r.jsx)("input",{value:v,onChange:e=>j(e.target.value),placeholder:"optional context to improve accuracy",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),h.includes("temperature")&&(0,r.jsx)($,{label:"Temperature",children:(0,r.jsx)("input",{type:"number",step:"0.1",min:"0",max:"1",value:k,onChange:e=>C(e.target.value),placeholder:"0 - 1 (default 0)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),h.includes("response_format")&&(0,r.jsx)($,{label:"Response Format",children:(0,r.jsxs)("select",{value:w,onChange:e=>N(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,r.jsx)("option",{value:"json",children:"json"}),(0,r.jsx)("option",{value:"text",children:"text"}),(0,r.jsx)("option",{value:"srt",children:"srt"}),(0,r.jsx)("option",{value:"verbose_json",children:"verbose_json"}),(0,r.jsx)("option",{value:"vtt",children:"vtt"})]})}),(0,r.jsxs)("div",{className:"mt-1",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,r.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,r.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,r.jsxs)("button",{onClick:()=>J(G),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:q?"check":"content_copy"}),q?"Copied":"Copy"]}),(0,r.jsxs)("button",{onClick:Y,disabled:U||!b||!W,className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-white text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:U?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),U?"Transcribing...":"Run"]})]})]}),(0,r.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:G})]}),B&&(0,r.jsx)("p",{className:"text-xs text-red-500 break-words",children:B}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,r.jsxs)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:["Response ",P&&M&&(0,r.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",M,"ms"]})]}),P&&(0,r.jsxs)("button",{onClick:()=>V(Q),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:z?"check":"content_copy"}),z?"Copied":"Copy"]})]}),(0,r.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all opacity-70",children:Q})]})]})]})}function M(){let{kind:e,id:t}=(0,a.useParams)(),s=(0,a.useRouter)(),l=c.rj.find(t=>t.id===e),u=(0,c.gC)(t)&&"embedding"===e,[m,p]=(0,o.useState)(null),[x,h]=(0,o.useState)(u),[b,f]=(0,o.useState)(!1),[g,v]=(0,o.useState)(!1),j=async()=>{if(confirm("Delete this Custom Embedding node?")){v(!0);try{let r=await fetch(`/api/provider-nodes/${t}`,{method:"DELETE"});if(r.ok)return void s.push(`/dashboard/media-providers/${e}`);let a=await r.json().catch(()=>({}));alert(a.error||"Failed to delete custom embedding node")}catch{alert("Failed to delete custom embedding node")}v(!1)}};if((0,o.useEffect)(()=>{if(!u)return;let e=!1;return fetch("/api/provider-nodes",{cache:"no-store"}).then(e=>e.json()).then(s=>{e||(p((s.nodes||[]).find(e=>e.id===t)||null),h(!1))}).catch(()=>{e||h(!1)}),()=>{e=!0}},[t,u]),!l)return(0,a.notFound)();let N=c.Q2[t],k=u?m?{id:t,name:m.name||"Custom Embedding",color:"#6366F1",textIcon:"CE"}:null:N;if(!u&&!N||u&&!x&&!m)return(0,a.notFound)();if(u&&x)return(0,r.jsx)("div",{className:"text-text-muted text-sm py-12 text-center",children:"Loading..."});let C=u?["embedding"]:k.serviceKinds??["llm"];return u||C.includes(e)?(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)(n(),{href:`/dashboard/media-providers/${e}`,className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),l.label]}),(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[(0,r.jsx)("div",{className:"size-12 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${k.color}15`},children:(0,r.jsx)(d.A,{src:`/providers/${k.id}.png`,alt:k.name,size:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",fallbackText:k.textIcon||k.id.slice(0,2).toUpperCase(),fallbackColor:k.color})}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[(0,r.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:k.name}),!u&&k.notice?.apiKeyUrl&&(0,r.jsxs)("a",{href:k.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),"Get API Key"]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5 mt-1 flex-wrap",children:[u&&(0,r.jsxs)(i.Ex,{variant:"default",size:"sm",children:["Custom \xb7 ",m?.prefix]}),C.map(t=>(0,r.jsx)(i.Ex,{variant:t===e?"primary":"default",size:"sm",children:t.toUpperCase()},t))]})]}),u&&(0,r.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,r.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>f(!0),children:"Edit"}),(0,r.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:j,disabled:g,children:g?"Deleting...":"Delete"})]})]})]}),!u&&k.kindNotice?.[e]&&(0,r.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 rounded-lg bg-amber-500/10 border border-amber-500/30 text-amber-700 dark:text-amber-400",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px] mt-0.5",children:"warning"}),(0,r.jsx)("p",{className:"text-sm",children:k.kindNotice[e]})]}),!u&&k.notice?.text&&!k.deprecated&&(0,r.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,r.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:k.notice.text}),k.notice.apiKeyUrl&&(0,r.jsx)("a",{href:k.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center rounded bg-blue-500 px-2 py-1 text-xs font-medium text-white transition-colors hover:bg-blue-600 sm:py-0.5",children:"Get API Key →"})]}),!u&&k.noAuth?(0,r.jsx)(i.gw,{providerId:t}):(0,r.jsx)(y,{providerId:t,isOAuth:!1}),"tts"!==e&&"webSearch"!==e&&"webFetch"!==e&&(0,r.jsx)(w,{providerId:t,kindFilter:e,providerAliasOverride:u?m?.prefix:void 0}),!u&&(k.searchConfig||k.fetchConfig||k.ttsConfig||k.sttConfig||k.embeddingConfig||k.searchViaChat)&&(0,r.jsx)(i.Wx,{config:"webFetch"===e?k.fetchConfig:"tts"===e?k.ttsConfig:"stt"===e?k.sttConfig:"embedding"===e?k.embeddingConfig:k.searchConfig||{mode:"chat-completions",defaultModel:k.searchViaChat?.defaultModel,pricingUrl:k.searchViaChat?.pricingUrl,freeTier:k.searchViaChat?.freeTier},provider:k,title:`${l.label} Config`}),"embedding"===e&&(0,r.jsx)(A,{providerId:t,customAlias:m?.prefix}),"tts"===e&&(0,r.jsx)(P,{providerId:t}),"stt"===e&&!u&&(0,r.jsx)(L,{providerId:t}),!u&&O[e]&&(0,r.jsx)(I,{providerId:t,kind:e}),u&&(0,r.jsx)(i.x0,{isOpen:b,node:m,onClose:()=>f(!1),onSaved:e=>{p(e),f(!1)}})]}):(0,a.notFound)()}}},e=>{e.O(0,[2574,3862,3745,3339,620,5497,8441,3794,7358],()=>e(e.s=54909)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6620],{16144:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>f});var i=t(95155),r=t(73321),a=t(98500),n=t.n(a),o=t(12115),l=t(35497),c=t(57250),d=t(52679);let m=new Set([]),h={image:"image-combo",tts:"tts-combo"};function x(e){let s=Object.entries(e).some(([e,s])=>e.startsWith("modelLock_")&&s&&new Date(s).getTime()>Date.now());return"unavailable"!==e.testStatus||s?e.testStatus:"active"}function p({provider:e,kind:s,connections:t,isCustom:r,onToggle:a}){let o=d.Q2[e.id],m=!!o?.noAuth,h=t.filter(s=>s.provider===e.id),u=h.filter(e=>{let s=x(e);return"active"===s||"success"===s}).length,f=h.filter(e=>{let s=x(e);return"error"===s||"expired"===s||"unavailable"===s}).length,b=h.length,g=b>0&&h.every(e=>!1===e.isActive);return(0,i.jsx)(n(),{href:`/dashboard/media-providers/${s}/${e.id}`,className:"group",children:(0,i.jsx)(l.Zp,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${g?"opacity-50":""}`,children:(0,i.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[(0,i.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,i.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${e.color?.length>7?e.color:(e.color??"#888")+"15"}`},children:(0,i.jsx)(c.A,{src:`/providers/${e.id}.png`,alt:e.name,size:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",fallbackText:e.textIcon||e.id.slice(0,2).toUpperCase(),fallbackColor:e.color})}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("h3",{className:"font-semibold text-sm",children:e.name}),(0,i.jsxs)("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[r&&(0,i.jsx)(l.Ex,{variant:"default",size:"sm",children:"Custom"}),m?(0,i.jsx)(l.Ex,{variant:"success",size:"sm",children:"Ready"}):g?(0,i.jsx)(l.Ex,{variant:"default",size:"sm",children:"Disabled"}):0===b?(0,i.jsx)("span",{className:"text-xs text-text-muted",children:"No connections"}):(0,i.jsxs)(i.Fragment,{children:[u>0&&(0,i.jsxs)(l.Ex,{variant:"success",size:"sm",dot:!0,children:[u," Connected"]}),f>0&&(0,i.jsxs)(l.Ex,{variant:"error",size:"sm",dot:!0,children:[f," Error"]}),0===u&&0===f&&(0,i.jsxs)(l.Ex,{variant:"default",size:"sm",children:[b," Added"]})]})]})]})]}),b>0&&(0,i.jsx)("div",{className:"shrink-0 opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100",onClick:s=>{s.preventDefault(),s.stopPropagation(),a&&a(e.id,g)},children:(0,i.jsx)(l.lM,{size:"sm",checked:!g,onChange:()=>{},title:g?"Enable provider":"Disable provider"})})]})})})}function u({combos:e}){return 0===e.length?null:(0,i.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>(0,i.jsx)(n(),{href:`/dashboard/media-providers/combo/${e.id}`,children:(0,i.jsx)(l.Zp,{padding:"xs",className:"hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors cursor-pointer",children:(0,i.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"}),(0,i.jsx)("code",{className:"text-sm font-mono font-medium flex-1 truncate",children:e.name}),(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-1 sm:shrink-0",children:[e.models.slice(0,6).map((e,s)=>{let t="string"==typeof e?e.split("/")[0]:"",r=d.Q2[t];return(0,i.jsx)("div",{title:r?.name||e,className:"size-5 rounded flex items-center justify-center",style:{backgroundColor:`${r?.color??"#888"}15`},children:(0,i.jsx)(c.A,{src:`/providers/${t}.png`,alt:r?.name||t,size:18,className:"object-contain rounded max-w-[18px] max-h-[18px]",fallbackText:r?.textIcon||t.slice(0,2).toUpperCase(),fallbackColor:r?.color})},`${e}-${s}`)}),e.models.length>6&&(0,i.jsxs)("span",{className:"text-[10px] text-text-muted ml-1",children:["+",e.models.length-6]})]}),(0,i.jsx)("span",{className:"text-[11px] text-text-muted shrink-0",children:e.models.length}),(0,i.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[16px]",children:"chevron_right"})]})})},e.id))})}function f(){let{kind:e}=(0,r.useParams)(),s=(0,r.useRouter)(),[t,a]=(0,o.useState)([]),[n,c]=(0,o.useState)([]),[x,f]=(0,o.useState)([]),[b,g]=(0,o.useState)(!1),[j,v]=(0,o.useState)(!1);(0,o.useEffect)(()=>{("webSearch"===e||"webFetch"===e)&&s.replace("/dashboard/media-providers/web")},[e,s]);let N=d.rj.find(s=>s.id===e),y="embedding"===e,k=m.has(e);if((0,o.useEffect)(()=>{N&&(fetch("/api/providers",{cache:"no-store"}).then(e=>e.json()).then(e=>a(e.connections||[])).catch(()=>{}),y&&fetch("/api/provider-nodes",{cache:"no-store"}).then(e=>e.json()).then(e=>c((e.nodes||[]).filter(e=>"custom-embedding"===e.type))).catch(()=>{}),k&&fetch("/api/combos",{cache:"no-store"}).then(e=>e.json()).then(e=>f(e.combos||[])).catch(()=>{}))},[y,k,N]),!N)return(0,r.notFound)();let w=(0,d.o5)(e),C=x.filter(s=>s.kind===e),$=n.map(e=>({id:e.id,name:e.name||"Custom Embedding",color:"#6366F1",textIcon:"CE"})),E=[...w,...$],S=async(e,s)=>{let i=t.filter(s=>s.provider===e);a(t=>t.map(t=>t.provider===e?{...t,isActive:s}:t)),(await Promise.allSettled(i.map(e=>fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:s})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e})))).some(e=>"rejected"===e.status)&&a(t=>t.map(t=>t.provider===e?{...t,isActive:!s}:t))},z=async()=>{if(!j){v(!0);try{let t=h[e]||`${e}-combo`,i=t,r=1,a=new Set(x.map(e=>e.name));for(;a.has(i);)i=`${t}-${r++}`;let n=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,models:[],kind:e})});if(n.ok){let e=await n.json();s.push(`/dashboard/media-providers/combo/${e.id}`)}else{let e=await n.json().catch(()=>({}));alert(e.error||"Failed to create combo")}}catch{alert("Failed to create combo")}finally{v(!1)}}};return(0,i.jsxs)("div",{className:"flex flex-col gap-6",children:[(y||k)&&(0,i.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[k&&(0,i.jsx)(l.$n,{size:"sm",icon:"add",onClick:z,disabled:j,children:"Create Combo"}),y&&(0,i.jsx)(l.$n,{size:"sm",icon:"add",onClick:()=>g(!0),children:"Add Custom Embedding"})]}),k&&C.length>0&&(0,i.jsx)(u,{combos:C}),0===E.length?(0,i.jsxs)("div",{className:"text-center py-12 border border-dashed border-border rounded-xl text-text-muted text-sm",children:["No providers support ",(0,i.jsx)("strong",{children:N.label})," yet."]}):(0,i.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[w.map(s=>(0,i.jsx)(p,{provider:s,kind:e,connections:t,onToggle:S},s.id)),$.map(s=>(0,i.jsx)(p,{provider:s,kind:e,connections:t,isCustom:!0,onToggle:S},s.id))]}),y&&(0,i.jsx)(l.x0,{isOpen:b,onClose:()=>g(!1),onCreated:e=>{c(s=>[...s,e]),g(!1)}})]})}},79069:(e,s,t)=>{Promise.resolve().then(t.bind(t,16144))}},e=>{e.O(0,[2574,3862,3745,3339,620,5497,8441,3794,7358],()=>e(e.s=79069)),_N_E=e.O()}]);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8334],{22662:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>f});var a=s(95155),r=s(73321),l=s(12115),i=s(98500),n=s.n(i),o=s(35497),c=s(57250),d=s(52679),m=s(62199);let x=/^[a-zA-Z0-9_.\-]+$/,h={webSearch:"Web Search",webFetch:"Web Fetch",image:"Text to Image",tts:"Text To Speech"},u={webSearch:"/v1/search",webFetch:"/v1/web/fetch",image:"/v1/images/generations",tts:"/v1/audio/speech"},p={webSearch:e=>({model:e,query:"What is the latest news about AI?",search_type:"web",max_results:5}),webFetch:e=>({model:e,url:"https://example.com",format:"markdown"}),image:e=>({model:e,prompt:"A cute cat playing piano",n:1,size:"1024x1024"}),tts:e=>({model:e,input:"Hello, this is a test.",voice:"alloy"})};function b(e){return"webSearch"===e||"webFetch"===e?"/dashboard/media-providers/web":`/dashboard/media-providers/${e}`}function f(){let{id:e}=(0,r.useParams)(),t=(0,r.useRouter)(),[s,i]=(0,l.useState)(null),[f,g]=(0,l.useState)(!0),[j,w]=(0,l.useState)(""),[y,v]=(0,l.useState)(""),[N,k]=(0,l.useState)([]),[S,C]=(0,l.useState)(!1),[$,O]=(0,l.useState)(!1),[U,_]=(0,l.useState)([]),[T,R]=(0,l.useState)(""),[A,P]=(0,l.useState)(!1),[z,F]=(0,l.useState)(null),[L,E]=(0,l.useState)(""),[D,J]=(0,l.useState)([]),[M,Z]=(0,l.useState)({}),H=async()=>{R("");try{let[t,s,a,r,l]=await Promise.all([fetch(`/api/combos/${e}`,{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"}),fetch("/api/usage/logs",{cache:"no-store"}),fetch("/api/providers",{cache:"no-store"}),fetch("/api/models/alias",{cache:"no-store"})]);if(l.ok&&Z((await l.json()).aliases||{}),r.ok&&J((await r.json()).connections||[]),!t.ok){i(null),g(!1);return}let n=await t.json();i(n),w(n.name),k(n.models||[]);let o=s.ok?await s.json():{};C(o.comboStrategies?.[n.name]?.fallbackStrategy==="round-robin");let c=a.ok?await a.json():[];_(c.filter(e=>{var t,s;return t=e,s=n.name,"string"==typeof t&&!!s&&RegExp(`(^|[^a-zA-Z0-9_.\\-])${s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}($|[^a-zA-Z0-9_.\\-])`).test(t)}).slice(0,50))}catch{R("Failed to load combo. Check your connection and try again.")}g(!1)};(0,l.useEffect)(()=>{H()},[e]);let I=e=>e.trim()?x.test(e)?(v(""),!0):(v("Only letters, numbers, -, _ and ."),!1):(v("Name is required"),!1),W=async t=>{let s=await fetch(`/api/combos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return!!s.ok||(alert((await s.json()).error||"Failed to save"),!1)},q=async()=>{if(!I(j)||j===s.name)return;let e=await W({name:j});e&&await B(s.name,j),e&&await H()},B=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).comboStrategies||{};if(!a[e])return;let r={...a,[t]:a[e]};delete r[e],(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:r})})).ok||alert("Combo renamed, but failed to migrate its round-robin setting.")}catch{alert("Combo renamed, but failed to migrate its round-robin setting.")}},Y=async e=>{let t=e?.value||e;if(!t||N.includes(t))return;let s=[...N,t];k(s),await W({models:s})||k(N)},G=async e=>{let t=e?.value||e;if(!t||!N.includes(t))return;let s=N.filter(e=>e!==t);k(s),await W({models:s})||k(N)},K=async e=>{let t=N.filter((t,s)=>s!==e);k(t),await W({models:t})||k(N)},Q=async(e,t)=>{let s=[...N],a=e+t;a<0||a>=s.length||([s[e],s[a]]=[s[a],s[e]],k(s),await W({models:s})||k(N))},V=async e=>{C(e);try{let t=await fetch("/api/settings",{cache:"no-store"}),a={...(t.ok?await t.json():{}).comboStrategies||{}};e?a[s.name]={fallbackStrategy:"round-robin"}:delete a[s.name],(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:a})})).ok||C(!e)}catch{C(!e)}},X=async()=>{if(confirm(`Delete combo "${s.name}"?`))try{let a=await fetch(`/api/combos/${e}`,{method:"DELETE"});if(a.ok)t.push(b(s.kind));else{let e=await a.json().catch(()=>({}));alert(e.error||"Failed to delete combo")}}catch{alert("Failed to delete combo")}},ee=async()=>{if(P(!0),F(null),E(""),z?.audioUrl)try{URL.revokeObjectURL(z.audioUrl)}catch{}if(z?.imageUrl?.startsWith("blob:"))try{URL.revokeObjectURL(z.imageUrl)}catch{}let e=Date.now();try{let t=u[s.kind],a=(0,m.O)(t);if(!a)return void E("Not supported by this router build");let r=p[s.kind](s.name),l=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),i=Date.now()-e;if(!l.ok){let e=await l.json().catch(()=>({}));E(e?.error?.message||e?.error||`HTTP ${l.status}`),F({json:JSON.stringify(e,null,2),latencyMs:i});return}let n=l.headers.get("content-type")||"";if(n.startsWith("image/")){let e=await l.blob();F({imageUrl:URL.createObjectURL(e),latencyMs:i});return}if(n.startsWith("audio/")||"application/octet-stream"===n){let e=await l.blob();F({audioUrl:URL.createObjectURL(e),latencyMs:i});return}let o=await l.json(),c=o?.data?.[0],d=c?.b64_json?`data:image/png;base64,${c.b64_json}`:c?.url||"";F({json:JSON.stringify(function e(t){if(!t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(e);let s={};for(let[a,r]of Object.entries(t))s[a]="b64_json"===a&&"string"==typeof r&&r.length>100?`<${r.length} chars base64>`:e(r);return s}(o),null,2),imageUrl:d,latencyMs:i})}catch(e){E(e.message||"Network error")}finally{P(!1)}};if(f)return(0,a.jsx)("div",{className:"text-text-muted text-sm",children:"Loading..."});if(!s&&T)return(0,a.jsxs)("div",{className:"flex flex-col items-center gap-3 py-12 text-center",children:[(0,a.jsx)("p",{className:"text-sm text-red-500",children:T}),(0,a.jsx)(o.$n,{size:"sm",variant:"outline",icon:"refresh",onClick:()=>{g(!0),H()},children:"Retry"})]});if(!s)return(0,r.notFound)();let et=h[s.kind]||d.rj.find(e=>e.id===s.kind)?.label||"Combo",es=u[s.kind],ea=s.kind&&p[s.kind]?p[s.kind](s.name):null,er=es?`curl -X POST http://localhost:1997${es} \\
|
|
2
|
+
-H "Content-Type: application/json" \\
|
|
3
|
+
-H "Authorization: Bearer YOUR_KEY" \\
|
|
4
|
+
-d '${JSON.stringify(ea)}'`:"",el=b(s.kind);return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,a.jsx)(n(),{href:el,className:"text-text-muted hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined",children:"arrow_back"})}),(0,a.jsx)("div",{className:"size-10 rounded-lg bg-primary/10 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"layers"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[et," Combo"]}),(0,a.jsx)("code",{className:"text-lg font-semibold font-mono",children:s.name})]})]}),(0,a.jsx)(o.$n,{variant:"outline",icon:"delete",onClick:X,className:"text-red-500 border-red-200 hover:bg-red-50",children:"Delete"})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Settings"}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(o.pd,{label:"Combo Name",value:j,onChange:e=>{w(e.target.value),I(e.target.value)},onBlur:q,error:y}),(0,a.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:"Only letters, numbers, -, _ and ."})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Round Robin"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Rotate providers across requests instead of strict fallback order."})]}),(0,a.jsx)(o.lM,{checked:S,onChange:V})]})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Providers"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Tried in order (top-down) or rotated when round-robin is on."})]}),(0,a.jsx)(o.$n,{size:"sm",icon:"add",onClick:()=>O(!0),children:"Add Provider"})]}),0===N.length?(0,a.jsx)("div",{className:"text-center py-6 border border-dashed border-border rounded-lg text-text-muted text-sm",children:"No providers yet."}):(0,a.jsx)("div",{className:"flex flex-col gap-2",children:N.map((e,t)=>{let{providerId:s,model:r}=function(e){if("string"!=typeof e)return{providerId:"",model:""};let t=e.indexOf("/");return t<0?{providerId:e,model:""}:{providerId:e.slice(0,t),model:e.slice(t+1)}}(e),l=d.Q2[s];return(0,a.jsxs)("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-black/[0.02] dark:bg-white/[0.02]",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted w-5 text-center",children:t+1}),(0,a.jsx)(c.A,{src:`/providers/${s}.png`,alt:l?.name||s,size:24,className:"object-contain rounded shrink-0",fallbackText:l?.textIcon||s.slice(0,2).toUpperCase(),fallbackColor:l?.color}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"text-sm font-medium truncate",children:l?.name||s}),r&&(0,a.jsx)("code",{className:"text-[10px] text-text-muted font-mono truncate block",children:r})]}),(0,a.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,a.jsx)("button",{onClick:()=>Q(t,-1),disabled:0===t,className:`p-1 rounded ${0===t?"text-text-muted/20":"text-text-muted hover:text-primary hover:bg-black/5"}`,title:"Move up",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_upward"})}),(0,a.jsx)("button",{onClick:()=>Q(t,1),disabled:t===N.length-1,className:`p-1 rounded ${t===N.length-1?"text-text-muted/20":"text-text-muted hover:text-primary hover:bg-black/5"}`,title:"Move down",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_downward"})}),(0,a.jsx)("button",{onClick:()=>K(t),className:"p-1 rounded text-text-muted hover:text-red-500 hover:bg-red-500/10",title:"Remove",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]})]},`${e}-${t}`)})})]}),s.kind&&es&&(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Test Example"}),(0,a.jsx)(o.$n,{size:"sm",icon:"play_arrow",onClick:ee,disabled:A||0===N.length,children:A?"Running...":"Run"})]}),(0,a.jsx)("pre",{className:"text-xs font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-x-auto whitespace-pre-wrap break-all",children:er}),L&&(0,a.jsx)("p",{className:"mt-3 text-xs text-red-500 break-words",children:L}),z&&(0,a.jsxs)("div",{className:"mt-3 flex flex-col gap-3",children:[null!=z.latencyMs&&(0,a.jsxs)("span",{className:"text-[11px] text-text-muted",children:["⚡ ",z.latencyMs,"ms"]}),z.imageUrl&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,a.jsxs)("a",{href:z.imageUrl,download:"image.png",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})}),(0,a.jsx)("img",{src:z.imageUrl,alt:"Generated",className:"max-w-full rounded-lg border border-border"})]}),z.audioUrl&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,a.jsxs)("a",{href:z.audioUrl,download:"speech.mp3",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})}),(0,a.jsx)("audio",{controls:!0,src:z.audioUrl,className:"w-full"})]}),z.json&&(0,a.jsx)("pre",{className:"text-xs font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-auto max-h-[300px] whitespace-pre-wrap break-all",children:z.json})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Usage Logs"}),0===U.length?(0,a.jsx)("p",{className:"text-xs text-text-muted italic",children:"No usage yet."}):(0,a.jsx)("pre",{className:"text-[11px] font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-auto max-h-[400px] whitespace-pre-wrap",children:U.join("\n")})]}),(0,a.jsx)(o.rq,{isOpen:$,onClose:()=>O(!1),onSelect:Y,onDeselect:G,activeProviders:D,modelAliases:M,title:`Add ${et} Model`,kindFilter:s.kind,addedModelValues:N,closeOnSelect:!1})]})}},62199:(e,t,s)=>{"use strict";s.d(t,{O:()=>r});let a=Object.freeze({"/v1/embeddings":"embeddings","/v1/images/generations":"images","/v1/audio/speech":"speech","/v1/audio/transcriptions":"transcriptions","/v1/search":"search","/v1/web/fetch":"fetch"});function r(e){if("string"!=typeof e)return null;let t=e.indexOf("?"),s=-1===t?e:e.slice(0,t),r=-1===t?"":e.slice(t),l=a[s];return l?`/api/dashboard/media/${l}${r}`:null}},98269:(e,t,s)=>{Promise.resolve().then(s.bind(s,22662))}},e=>{e.O(0,[2574,3862,3745,3339,620,5497,8441,3794,7358],()=>e(e.s=98269)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9260],{30837:(e,s,t)=>{Promise.resolve().then(t.bind(t,71088))},71088:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>b});var r=t(95155),a=t(98500),i=t.n(a),l=t(12115),o=t(73321),c=t(35497),n=t(57250),d=t(52679);function
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9260],{30837:(e,s,t)=>{Promise.resolve().then(t.bind(t,71088))},71088:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>b});var r=t(95155),a=t(98500),i=t.n(a),l=t(12115),o=t(73321),c=t(35497),n=t(57250),d=t(52679);function x(e){let s=Object.entries(e).some(([e,s])=>e.startsWith("modelLock_")&&s&&new Date(s).getTime()>Date.now());return"unavailable"!==e.testStatus||s?e.testStatus:"active"}function m({provider:e,kind:s,connections:t}){let a=d.Q2[e.id],l=!!a?.noAuth,o=t.filter(s=>s.provider===e.id),h=o.filter(e=>{let s=x(e);return"active"===s||"success"===s}).length,p=o.filter(e=>{let s=x(e);return"error"===s||"expired"===s||"unavailable"===s}).length,b=o.length,u=b>0&&o.every(e=>!1===e.isActive);return(0,r.jsx)(i(),{href:`/dashboard/media-providers/${s}/${e.id}`,className:"group",children:(0,r.jsx)(c.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 min-w-0 items-center gap-3",children:[(0,r.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${e.color?.length>7?e.color:(e.color??"#888")+"15"}`},children:(0,r.jsx)(n.A,{src:`/providers/${e.id}.png`,alt:e.name,size:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",fallbackText:e.textIcon||e.id.slice(0,2).toUpperCase(),fallbackColor:e.color})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-semibold text-sm",children:e.name}),(0,r.jsx)("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:l?(0,r.jsx)(c.Ex,{variant:"success",size:"sm",children:"Ready"}):u?(0,r.jsx)(c.Ex,{variant:"default",size:"sm",children:"Disabled"}):0===b?(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"No connections"}):(0,r.jsxs)(r.Fragment,{children:[h>0&&(0,r.jsxs)(c.Ex,{variant:"success",size:"sm",dot:!0,children:[h," Connected"]}),p>0&&(0,r.jsxs)(c.Ex,{variant:"error",size:"sm",dot:!0,children:[p," Error"]}),0===h&&0===p&&(0,r.jsxs)(c.Ex,{variant:"default",size:"sm",children:[b," Added"]})]})})]})]})})})}function h({combos:e}){return 0===e.length?(0,r.jsx)("p",{className:"text-xs text-text-muted italic",children:"No combos yet."}):(0,r.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>(0,r.jsx)(i(),{href:`/dashboard/media-providers/combo/${e.id}`,children:(0,r.jsx)(c.Zp,{padding:"xs",className:"hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors cursor-pointer",children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"}),(0,r.jsx)("code",{className:"text-sm font-mono font-medium flex-1 truncate",children:e.name}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1 sm:shrink-0",children:[e.models.slice(0,6).map((e,s)=>{let t="string"==typeof e?e.split("/")[0]:"",a=d.Q2[t];return(0,r.jsx)("div",{title:a?.name||e,className:"size-5 rounded flex items-center justify-center",style:{backgroundColor:`${a?.color??"#888"}15`},children:(0,r.jsx)(n.A,{src:`/providers/${t}.png`,alt:a?.name||t,size:18,className:"object-contain rounded max-w-[18px] max-h-[18px]",fallbackText:a?.textIcon||t.slice(0,2).toUpperCase(),fallbackColor:a?.color})},`${e}-${s}`)}),e.models.length>6&&(0,r.jsxs)("span",{className:"text-[10px] text-text-muted ml-1",children:["+",e.models.length-6]})]}),(0,r.jsx)("span",{className:"text-[11px] text-text-muted shrink-0",children:e.models.length}),(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[16px]",children:"chevron_right"})]})})},e.id))})}function p({title:e,icon:s,kind:t,providers:a,connections:i,combos:l,onCreateCombo:o}){return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary",children:s}),(0,r.jsx)("h2",{className:"text-base font-semibold",children:e}),(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:["(",a.length," providers \xb7 ",l.length," combos)"]})]}),(0,r.jsx)(c.$n,{size:"sm",icon:"add",onClick:o,children:"Create Combo"})]}),l.length>0&&(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsx)(h,{combos:l})}),0===a.length?(0,r.jsx)("div",{className:"text-center py-8 border border-dashed border-border rounded-xl text-text-muted text-sm",children:"No providers."}):(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:a.map(e=>(0,r.jsx)(m,{provider:e,kind:t,connections:i},e.id))})]})}function b(){let e=(0,o.useRouter)(),[s,t]=(0,l.useState)([]),[a,i]=(0,l.useState)([]),[n,x]=(0,l.useState)(!0),[m,h]=(0,l.useState)(""),b=async()=>{h("");try{let[e,s]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/combos",{cache:"no-store"})]);if(!e.ok&&!s.ok)throw Error("load failed");e.ok&&t((await e.json()).connections||[]),s.ok&&i((await s.json()).combos||[])}catch{h("Failed to load providers. Check your connection and try again.")}finally{x(!1)}};(0,l.useEffect)(()=>{b()},[]);let u=(0,d.o5)("webSearch"),f=(0,d.o5)("webFetch"),j=a.filter(e=>"webSearch"===e.kind),v=a.filter(e=>"webFetch"===e.kind),g=async s=>{let t="webSearch"===s?"search-combo":"fetch-combo",r=t,i=1,l=new Set(a.map(e=>e.name));for(;l.has(r);)r=`${t}-${i++}`;let o=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r,models:[],kind:s})});if(o.ok){let s=await o.json();e.push(`/dashboard/media-providers/combo/${s.id}`)}else alert((await o.json()).error||"Failed to create combo")};return n?(0,r.jsx)("div",{className:"text-text-muted text-sm",children:"Loading..."}):m?(0,r.jsxs)("div",{className:"flex flex-col items-center gap-3 py-12 text-center",children:[(0,r.jsx)("p",{className:"text-sm text-red-500",children:m}),(0,r.jsx)(c.$n,{size:"sm",variant:"outline",icon:"refresh",onClick:()=>{x(!0),b()},children:"Retry"})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsx)(p,{title:"Web Search",icon:"search",kind:"webSearch",providers:u,connections:s,combos:j,onCreateCombo:()=>g("webSearch")}),(0,r.jsx)("div",{className:"border-t border-border"}),(0,r.jsx)(p,{title:"Web Fetch",icon:"travel_explore",kind:"webFetch",providers:f,connections:s,combos:v,onCreateCombo:()=>g("webFetch")})]})}}},e=>{e.O(0,[2574,3862,3745,3339,620,5497,8441,3794,7358],()=>e(e.s=30837)),_N_E=e.O()}]);
|