@jheavenknows/bluerouter 5.4.28 → 5.4.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/.next-cli-build/BUILD_ID +1 -1
- package/app/.next-cli-build/app-path-routes-manifest.json +5 -5
- package/app/.next-cli-build/build-manifest.json +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/ai-power-index/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/analytics/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/analytics/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/api-keys/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/api-keys/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/audit-proxy/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/audit-proxy/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/model-profiles/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cluster/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/logs/console/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/logs/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/personal/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/personalcloudprovider/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/personalcloudprovidermonitor/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/personalquota/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-logs/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/provider-health/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/stt/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/tts/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/resource-monitor/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/app/.next-cli-build/server/app/_not-found.rsc +6 -6
- package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/api/audit-proxy/ca/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/audit-proxy/me/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/audit-proxy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/audit-proxy/users/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/ldap/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/ldap/users/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/view-mode/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/branding/[asset]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/branding/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/branding/upload/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-model-profiles/cloud-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-model-profiles/model-catalog/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-model-profiles/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/autostart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/prompt-log-db/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/root-ca/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cluster/config/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cluster/heartbeat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cluster/peers/[id]/command/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cluster/peers/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cluster/peers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cluster/snapshot/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cluster/sync/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cluster/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/codex-catalog/download/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/codex-catalog/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/codex-catalog/upload/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/dashboard/ai-power-index/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/dashboard/analytics/ai-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/dashboard/analytics/analyze/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/dashboard/analytics/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/dashboard/combos/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/dashboard/endpoint/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/dashboard/prompt-logs/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/dashboard/prompt-logs/options/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/dashboard/prompt-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/dashboard/token-saver/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/[id]/caveman-test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/[id]/rotate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/grok-cli/device-code/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/grok-cli/poll/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/personal-cloud-providers/[id]/api-key-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/personal-cloud-providers/[id]/import-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/personal-cloud-providers/[id]/models/[...routeModel]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/personal-cloud-providers/[id]/move/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/personal-cloud-providers/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/personal-cloud-providers/[id]/usage/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/personal-cloud-providers/client/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/personal-cloud-providers/monitor/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/personal-cloud-providers/permissions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/personal-cloud-providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/personal-cloud-providers/routing/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/personal-cloud-providers/shares/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/personal-cloud-providers/visibility/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pricing/catalog/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pricing/recalculate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/openai-compatible/manage/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/resource-monitor/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/resource-monitor/ai-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/resource-monitor/analyze/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/resource-monitor/history/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/resource-monitor/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/database/export/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-start-daemon/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/callback.html +1 -1
- package/app/.next-cli-build/server/app/callback.rsc +6 -6
- package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/ai-power-index.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/ai-power-index.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/ai-power-index.segments/!KGRhc2hib2FyZCk/dashboard/ai-power-index/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/ai-power-index.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/ai-power-index.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/api-keys.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/api-keys.rsc +10 -10
- package/app/.next-cli-build/server/app/dashboard/api-keys.segments/!KGRhc2hib2FyZCk/dashboard/api-keys/__PAGE__.segment.rsc +10 -10
- package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_full.segment.rsc +10 -10
- package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.rsc +9 -9
- package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/model-profiles/__PAGE__.segment.rsc +9 -9
- package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.segments/_full.segment.rsc +9 -9
- package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cluster.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cluster.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cluster.segments/!KGRhc2hib2FyZCk/dashboard/cluster/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cluster.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cluster.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/logs.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/logs.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/logs.segments/!KGRhc2hib2FyZCk/dashboard/logs/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/logs.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/logs.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/personal.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/personal.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/personal.segments/!KGRhc2hib2FyZCk/dashboard/personal/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/personal.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/personal.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/!KGRhc2hib2FyZCk/dashboard/prompt-logs/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/provider-health.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/provider-health.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/provider-health.segments/!KGRhc2hib2FyZCk/dashboard/provider-health/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers/stt.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/stt.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/providers/stt.segments/!KGRhc2hib2FyZCk/dashboard/providers/stt/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/providers/stt.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/providers/stt.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers/tts.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/tts.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/providers/tts.segments/!KGRhc2hib2FyZCk/dashboard/providers/tts/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/providers/tts.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/providers/tts.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.rsc +9 -9
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +9 -9
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +9 -9
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/resource-monitor.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/resource-monitor.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/resource-monitor.segments/!KGRhc2hib2FyZCk/dashboard/resource-monitor/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/resource-monitor.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/resource-monitor.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/app/.next-cli-build/server/app/dashboard.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/index.html +1 -1
- package/app/.next-cli-build/server/app/index.rsc +6 -6
- package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/landing.html +1 -1
- package/app/.next-cli-build/server/app/landing.rsc +6 -6
- package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/login.html +1 -1
- package/app/.next-cli-build/server/app/login.rsc +7 -7
- package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app-paths-manifest.json +5 -5
- package/app/.next-cli-build/server/chunks/1470.js +8 -22
- package/app/.next-cli-build/server/chunks/2428.js +1 -1
- package/app/.next-cli-build/server/chunks/2731.js +8 -22
- package/app/.next-cli-build/server/chunks/3399.js +1 -1
- package/app/.next-cli-build/server/chunks/402.js +1 -1
- package/app/.next-cli-build/server/chunks/4746.js +1 -1
- package/app/.next-cli-build/server/chunks/6811.js +1 -1
- package/app/.next-cli-build/server/chunks/689.js +1 -1
- package/app/.next-cli-build/server/chunks/6992.js +1 -1
- package/app/.next-cli-build/server/chunks/9489.js +1 -1
- package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/app/.next-cli-build/server/middleware.js +1 -1
- package/app/.next-cli-build/server/pages/404.html +1 -1
- package/app/.next-cli-build/server/pages/500.html +1 -1
- package/app/.next-cli-build/static/chunks/{5263-6856971b5c7c38ac.js → 5263-675098c923e1ee6b.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/analytics/page-1fa5bfb048882df9.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/api-keys/{page-02881fb8f9782fd0.js → page-1f046119676ebee9.js} +2 -2
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-786d94f8dd164774.js +1 -0
- package/app/.next-cli-build/static/css/{b1d9e34c2c3debb5.css → 3ee2c86da45c8465.css} +1 -1
- package/app/cli/.build-home/AppData/Roaming/bluerouter/db/data.sqlite-shm +0 -0
- package/app/cli/.build-home/AppData/Roaming/bluerouter/db/data.sqlite-wal +0 -0
- package/app/package.json +1 -1
- package/package.json +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/analytics/page-a490ee99c12ec139.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-e6712886cd01ffe3.js +0 -1
- /package/app/.next-cli-build/static/{x-Qb8zBG_LMJpbcg7V5kZ → RLHlm_VhJtUy0g062tWk9}/_buildManifest.js +0 -0
- /package/app/.next-cli-build/static/{x-Qb8zBG_LMJpbcg7V5kZ → RLHlm_VhJtUy0g062tWk9}/_ssgManifest.js +0 -0
- /package/app/cli/.build-home/AppData/Roaming/bluerouter/db/backups/{upgrade-5.4.18-to-5.4.19-5.4.19-20260825-075641 → upgrade-5.4.26-to-5.4.27-5.4.27-20260827-201818}/data.sqlite +0 -0
|
Binary file
|
|
Binary file
|
package/app/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8978],{53836:(e,t,s)=>{Promise.resolve().then(s.bind(s,76174)),Promise.resolve().then(s.bind(s,85881)),Promise.resolve().then(s.bind(s,70965))},70965:(e,t,s)=>{"use strict";s.d(t,{default:()=>c});var n=s(95155),r=s(12115),l=s(94027);let a=new Set(["Auto-off thinking","Thinking auto-off","Thinking OFF"]),i=new Set(["Large context"]);function o(e){return"cloud"===String(e||"").trim().toLowerCase()?"cloud":"local"}function d(e){document.cookie=`bluerouter_analytics_scope=${e}; Path=/; Max-Age=31536000; SameSite=Lax`}function c({initialScope:e="local",children:t}){let{isAdmin:s,isMonitorAdmin:x,isAiGatewaysMonitor:m}=(0,l.s)(),u=s||x||m,h=!u,[p,b]=(0,r.useState)(()=>o(e)),[g,y]=(0,r.useState)(!1),j=(0,r.useRef)(null);(0,r.useLayoutEffect)(()=>{u&&d(p),y(!0)},[u,p]),(0,r.useLayoutEffect)(()=>{let e=j.current;if(!e)return;let t=!1,n=()=>{t=!1,function(e,t){if(e){for(let t of e.querySelectorAll("[data-admin-only-thinking-hidden='true']"))t.style.display="",delete t.dataset.adminOnlyThinkingHidden;if(!t){for(let t of e.querySelectorAll("div.text-sm.font-medium.text-text-muted")){if(!a.has(t.textContent?.trim()))continue;let e=t.closest(".min-w-0.rounded-2xl.border.border-border.bg-surface");e&&(e.style.display="none",e.dataset.adminOnlyThinkingHidden="true")}for(let t of e.querySelectorAll("h2")){if(t.textContent?.trim()!=="Thinking Analytics")continue;let e=t.closest(".min-w-0.rounded-2xl.border.border-border.bg-surface");e&&(e.style.display="none",e.dataset.adminOnlyThinkingHidden="true")}}}}(e,s),function(e,t){if(e){for(let t of e.querySelectorAll("[data-regular-user-experience-hidden='true']"))t.style.display="",delete t.dataset.regularUserExperienceHidden;for(let t of e.querySelectorAll("[data-regular-user-experience-full-width='true']"))t.style.removeProperty("grid-column"),t.style.removeProperty("width"),delete t.dataset.regularUserExperienceFullWidth;if(t){for(let t of e.querySelectorAll("div.text-sm.font-medium.text-text-muted")){if(!i.has(t.textContent?.trim()))continue;let e=t.closest(".min-w-0.rounded-2xl.border.border-border.bg-surface");e&&(e.style.display="none",e.dataset.regularUserExperienceHidden="true")}for(let t of e.querySelectorAll("h2")){if(t.textContent?.trim()!=="Large Context Analytics")continue;let e=t.closest(".min-w-0.rounded-2xl.border.border-border.bg-surface");e&&(e.style.gridColumn="1 / -1",e.style.width="100%",e.dataset.regularUserExperienceFullWidth="true")}}}}(e,h)},r=()=>{t||(t=!0,requestAnimationFrame(n))};r();let l=new MutationObserver(r);return l.observe(e,{childList:!0,subtree:!0}),()=>l.disconnect()},[s,h,g]);let v=e=>{if(!u)return;let t=o(e);if(t===p)return;d(t),b(t);let s=new URL(window.location.href);s.searchParams.set("scope",t),window.history.replaceState(window.history.state,"",s.toString())};return(0,n.jsxs)("div",{ref:j,children:[u?(0,n.jsx)("div",{className:"px-4 pt-4 md:px-6 md:pt-6",children:(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 rounded-2xl border border-border bg-surface p-2 shadow-sm",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>v("local"),"aria-pressed":"local"===p,className:`flex min-w-[220px] flex-1 items-center gap-3 rounded-xl px-4 py-3 text-left transition ${"local"===p?"bg-primary text-white shadow-sm":"text-text-muted hover:bg-background hover:text-text-main"}`,children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[22px]",children:"developer_board"}),(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm font-semibold",children:"Local models & providers"}),(0,n.jsx)("span",{className:`mt-0.5 block text-xs ${"local"===p?"text-white/75":"text-text-subtle"}`,children:"Self-hosted runtime, latency, TTFT, throughput v\xe0 token"})]})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>v("cloud"),"aria-pressed":"cloud"===p,className:`flex min-w-[220px] flex-1 items-center gap-3 rounded-xl px-4 py-3 text-left transition ${"cloud"===p?"bg-primary text-white shadow-sm":"text-text-muted hover:bg-background hover:text-text-main"}`,children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[22px]",children:"cloud"}),(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm font-semibold",children:"Cloud providers"}),(0,n.jsx)("span",{className:`mt-0.5 block text-xs ${"cloud"===p?"text-white/75":"text-text-subtle"}`,children:"External provider reliability, latency, token v\xe0 cost"})]})]})]})}):null,g?(0,n.jsx)("div",{children:t},u?p:"user-owned"):null]})}},76174:(e,t,s)=>{"use strict";s.d(t,{default:()=>eb});var n=s(95155),r=s(12115),l=s(9233),a=s(94027);function i(e){let t=Number(e);return Number.isFinite(t)?t:0}function o(e,t=0){return i(e).toLocaleString("vi-VN",{maximumFractionDigits:t})}function d(e){return new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}).format(i(e))}function c(e){let t=Number(e);return!Number.isFinite(t)||t<=0?"-":t>=1e3?`${(t/1e3).toLocaleString("vi-VN",{maximumFractionDigits:2})} s`:`${Math.round(t)} ms`}function x(e){let t=Number(e);return Number.isFinite(t)&&t>0?`${t.toLocaleString("vi-VN",{maximumFractionDigits:1})} tok/s`:"-"}function m(e){return`$${i(e).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:4})}`}function u({row:e}){return(0,n.jsxs)("div",{className:"min-w-[105px] text-xs tabular-nums",children:[(0,n.jsx)("div",{className:"font-semibold text-text-main",children:d(e.totalTokens)}),(0,n.jsxs)("div",{className:"text-text-muted",children:["in ",d(e.promptTokens)," \xb7 out ",d(e.completionTokens)]})]})}function h({label:e,value:t,hint:s}){return(0,n.jsxs)("div",{className:"rounded-xl border border-border bg-background/55 px-3 py-2.5",children:[(0,n.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-text-muted",children:e}),(0,n.jsx)("div",{className:"mt-1 text-lg font-semibold tabular-nums text-text-main",children:t}),s?(0,n.jsx)("div",{className:"mt-0.5 text-[10px] text-text-muted",children:s}):null]})}function p({rows:e,cloud:t}){return e.length?(0,n.jsx)("div",{className:"overflow-x-auto overflow-y-auto rounded-2xl border border-border",style:{maxHeight:"520px"},children:(0,n.jsxs)("table",{className:"min-w-[1080px] w-full divide-y divide-border text-sm",children:[(0,n.jsx)("thead",{className:"sticky top-0 z-10 bg-background/95 backdrop-blur",children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{className:"px-3 py-2.5 text-left text-xs font-semibold text-text-muted",children:"Model / Provider"}),(0,n.jsx)("th",{className:"px-3 py-2.5 text-right text-xs font-semibold text-text-muted",children:"Req"}),(0,n.jsx)("th",{className:"px-3 py-2.5 text-left text-xs font-semibold text-text-muted",children:"Tokens"}),(0,n.jsx)("th",{className:"px-3 py-2.5 text-right text-xs font-semibold text-text-muted",children:"Error"}),(0,n.jsx)("th",{className:"px-3 py-2.5 text-right text-xs font-semibold text-text-muted",children:"P95 latency"}),(0,n.jsx)("th",{className:"px-3 py-2.5 text-right text-xs font-semibold text-text-muted",children:"P95 TTFT"}),t?null:(0,n.jsx)("th",{className:"px-3 py-2.5 text-right text-xs font-semibold text-text-muted",title:"Decode tok/s = Σ output tokens / Σ (latency - TTFT). Chỉ d\xf9ng request th\xe0nh c\xf4ng c\xf3 output v\xe0 TTFT hợp lệ.",children:"Decode tok/s"}),t?(0,n.jsx)("th",{className:"px-3 py-2.5 text-right text-xs font-semibold text-text-muted",children:"Cost"}):null,(0,n.jsx)("th",{className:"px-3 py-2.5 text-right text-xs font-semibold text-text-muted",children:"Last used"})]})}),(0,n.jsx)("tbody",{className:"divide-y divide-border/70",children:e.map(e=>{let s,r,l=(s=i(e.requests),r=i(e.errors),s>0?r/s:i(e.errorRate)),a=e.decodeTokensPerSecond,d=i(e.decodeSamples);return(0,n.jsxs)("tr",{className:"hover:bg-background/50",children:[(0,n.jsxs)("td",{className:"px-3 py-2.5",children:[(0,n.jsx)("div",{className:"font-semibold text-text-main",children:e.model||e.label||"unknown"}),(0,n.jsx)("div",{className:"mt-0.5 text-xs text-text-muted",children:e.providerLabel||e.provider||"unknown"})]}),(0,n.jsx)("td",{className:"px-3 py-2.5 text-right tabular-nums",children:o(e.requests)}),(0,n.jsx)("td",{className:"px-3 py-2.5",children:(0,n.jsx)(u,{row:e})}),(0,n.jsx)("td",{className:"px-3 py-2.5 text-right",children:(0,n.jsxs)("span",{className:l>=.05?"text-red-500":l>0?"text-amber-500":"text-emerald-500",children:[(100*l).toLocaleString("vi-VN",{maximumFractionDigits:1}),"%"]})}),(0,n.jsx)("td",{className:"px-3 py-2.5 text-right tabular-nums",children:c(e.p95LatencyMs)}),(0,n.jsx)("td",{className:"px-3 py-2.5 text-right tabular-nums",children:c(e.p95TtftMs)}),t?null:(0,n.jsxs)("td",{className:"px-3 py-2.5 text-right tabular-nums",children:[(0,n.jsx)("div",{className:"font-semibold",children:x(a)}),(0,n.jsxs)("div",{className:"mt-0.5 text-[10px] font-normal text-text-muted",children:[o(d)," mẫu decode"]}),null==a&&e.e2eOutputTokensPerSecond?(0,n.jsxs)("div",{className:"text-[10px] font-normal text-text-subtle",children:["E2E ",x(e.e2eOutputTokensPerSecond)]}):null]}),t?(0,n.jsx)("td",{className:"px-3 py-2.5 text-right tabular-nums text-emerald-600 dark:text-emerald-300",children:m(e.cost)}):null,(0,n.jsx)("td",{className:"px-3 py-2.5 text-right text-xs text-text-muted",children:function(e){if(!e)return"-";let t=new Date(e);return Number.isNaN(t.getTime())?String(e):t.toLocaleString("vi-VN")}(e.lastSeen)})]},e.key||`${e.provider}-${e.model}`)})})]})}):(0,n.jsxs)("div",{className:"rounded-2xl border border-dashed border-border px-4 py-7 text-center text-sm text-text-muted",children:["Kh\xf4ng c\xf3 model ",t?"cloud":"local"," trong khoảng lọc hiện tại."]})}function b({type:e,rows:t,summary:s}){let r="local"===e,l=s.decodeTokensPerSecond,a=[`Σ output / Σ(latency − TTFT) \xb7 ${o(s.decodeSamples||0)} mẫu decode hợp lệ`,null==l&&s.e2eOutputTokensPerSecond?`Chưa c\xf3 mẫu decode hợp lệ \xb7 E2E ${x(s.e2eOutputTokensPerSecond)}`:""].filter(Boolean).join(" \xb7 ");return(0,n.jsxs)("section",{className:"rounded-3xl border border-border bg-surface p-5 shadow-[var(--shadow-soft)]",children:[(0,n.jsxs)("div",{className:"mb-4 flex flex-wrap items-start justify-between gap-3",children:[(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.jsx)("div",{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl ${r?"bg-primary/10 text-primary":"bg-amber-500/10 text-amber-600 dark:text-amber-300"}`,children:(0,n.jsx)("span",{className:"material-symbols-outlined text-[22px]",children:r?"developer_board":"cloud"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:r?"Local Models":"Cloud Models"}),(0,n.jsx)("p",{className:"mt-0.5 text-xs text-text-muted",children:r?"Self-hosted inference: vLLM, SGLang, Ollama, llama.cpp hoặc compatible endpoint được đ\xe1nh dấu Local.":"External/cloud API providers, kể cả compatible endpoint được đ\xe1nh dấu Cloud."})]})]}),(0,n.jsxs)("span",{className:"rounded-full border border-border bg-background px-3 py-1 text-xs font-semibold text-text-muted",children:[o(s.models??t.length)," models"]})]}),(0,n.jsxs)("div",{className:"mb-4 grid gap-2 sm:grid-cols-2 xl:grid-cols-3",children:[(0,n.jsx)(h,{label:"Requests",value:o(s.requests)}),(0,n.jsx)(h,{label:"Total tokens",value:d(s.totalTokens),hint:`In ${d(s.promptTokens)} \xb7 Out ${d(s.completionTokens)}`}),r?(0,n.jsx)(h,{label:"Decode speed",value:x(l),hint:a}):(0,n.jsx)(h,{label:"Estimated cost",value:m(s.cost)})]}),(0,n.jsx)(p,{rows:t,cloud:!r})]})}function g({data:e}){let t=e?.groups||{},s=e?.deploymentAnalytics||{},r=String(e?.analyticsScope||"all").trim().toLowerCase(),l=t.localModels||[],a=t.cloudModels||[],i=t.unknownModels||[];return(0,n.jsxs)("div",{className:"space-y-5",children:["cloud"!==r?(0,n.jsx)(b,{type:"local",rows:l,summary:s.local||{}}):null,"local"!==r?(0,n.jsx)(b,{type:"cloud",rows:a,summary:s.cloud||{}}):null,i.length>0?(0,n.jsx)("div",{className:"rounded-2xl border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-sm text-amber-700 dark:text-amber-300",children:(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"warning"}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"font-semibold",children:[o(i.length)," model chưa x\xe1c định Local / Cloud"]}),(0,n.jsx)("div",{className:"mt-0.5 text-xs opacity-90",children:"Mở Custom Provider tương ứng v\xe0 chọn Deployment để số liệu kh\xf4ng bị gộp sai."})]})]})}):null]})}l.xI.setOptions({gfm:!0,breaks:!0});let y=[{value:"today",label:"H\xf4m nay"},{value:"todayWorking",label:"H\xf4m nay (Working time)"},{value:"yesterday",label:"H\xf4m qua"},{value:"yesterdayWorking",label:"H\xf4m qua (Working time)"},{value:"24h",label:"24 giờ"},{value:"thisWeek",label:"Tuần n\xe0y"},{value:"lastWeek",label:"Tuần trước"},{value:"7d",label:"7 ng\xe0y"},{value:"thisMonth",label:"Th\xe1ng n\xe0y"},{value:"lastMonth",label:"Th\xe1ng trước"},{value:"30d",label:"30 ng\xe0y"},{value:"60d",label:"60 ng\xe0y"},{value:"all",label:"Tất cả (60 ng\xe0y)"}],j=[{value:"overview",label:"Tổng quan",icon:"dashboard"},{value:"apiKeys",label:"API keys",icon:"vpn_key"},{value:"clients",label:"Client/User",icon:"groups"},{value:"sources",label:"Source IP / Tool",icon:"hub"},{value:"providers",label:"Provider / Model",icon:"dns"},{value:"experience",label:"Trải nghiệm",icon:"speed"},{value:"errors",label:"Lỗi & bất thường",icon:"warning"},{value:"raw",label:"Raw usage",icon:"table"},{value:"aiHealth",label:"Đ\xe1nh gi\xe1 AI",icon:"neurology"}],v="blueRouterAnalyticsTab",k={normal:{className:"border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",label:"B\xecnh thường"},warning:{className:"border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300",label:"Cảnh b\xe1o"},critical:{className:"border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300",label:"Nghi\xeam trọng"},no_traffic:{className:"border-border bg-surface-2 text-text-muted",label:"Kh\xf4ng c\xf3 lưu lượng"},unknown:{className:"border-border bg-surface-2 text-text-muted",label:"Kh\xf4ng r\xf5"}};function f({status:e}){let t=k[e]||k.unknown;return(0,n.jsxs)("span",{className:O("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-semibold",t.className),children:[(0,n.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),t.label]})}function N(e){let t=Number(e||0);if(!t)return"-";let s=["B","KiB","MiB","GiB","TiB"],n=Math.min(Math.floor(Math.log(t)/Math.log(1024)),s.length-1);return`${(t/1024**n).toLocaleString("vi-VN",{maximumFractionDigits:1})} ${s[n]}`}function T({nodes:e=[]}){return e.length?(0,n.jsxs)("section",{className:"border-y border-border py-4",children:[(0,n.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[19px] text-primary",children:"developer_board"}),(0,n.jsx)("h4",{className:"text-sm font-semibold text-text-main",children:"Cấu h\xecnh phần cứng từng node tại l\xfac đ\xe1nh gi\xe1"})]}),(0,n.jsx)("div",{className:"divide-y divide-border",children:e.map(e=>(0,n.jsxs)("div",{className:"grid gap-2 py-3 text-xs md:grid-cols-[minmax(180px,0.8fr)_minmax(0,2.2fr)]",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"font-semibold text-text-main",children:e.name}),(0,n.jsx)("div",{className:"mt-0.5 text-text-muted",children:e.host||e.hostname||"-"}),(0,n.jsx)("div",{className:e.reachable?"mt-1 text-emerald-600 dark:text-emerald-300":"mt-1 text-red-600 dark:text-red-300",children:e.reachable?"C\xf3 dữ liệu":e.error||"Chưa c\xf3 snapshot"})]}),e.reachable?(0,n.jsxs)("div",{className:"space-y-1 text-text-muted",children:[(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"font-medium text-text-main",children:"CPU:"})," ",e.cpu?.model||"-"," \xb7 ",e.cpu?.cores||0," cores \xb7 sử dụng ",Number(e.cpu?.usagePercent||0).toLocaleString("vi-VN",{maximumFractionDigits:1}),"%"]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"font-medium text-text-main",children:"RAM:"})," ",N(e.memory?.totalBytes)," \xb7 đang d\xf9ng ",N(e.memory?.usedBytes)," (",Number(e.memory?.usagePercent||0).toLocaleString("vi-VN",{maximumFractionDigits:1}),"%)"]}),e.gpus?.length?e.gpus.map(t=>(0,n.jsxs)("p",{children:[(0,n.jsxs)("span",{className:"font-medium text-text-main",children:["GPU ",t.index,":"]})," ",t.name," \xb7 VRAM ",(Number(t.memoryTotalMb||0)/1024).toLocaleString("vi-VN",{maximumFractionDigits:1})," GiB \xb7 sử dụng ",Number(t.usagePercent||0).toLocaleString("vi-VN",{maximumFractionDigits:1}),"%"]},`${e.id}-${t.index}`)):(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"font-medium text-text-main",children:"GPU:"})," Kh\xf4ng ph\xe1t hiện NVIDIA GPU"]}),(0,n.jsxs)("p",{className:"text-text-subtle",children:["Snapshot: ",e.statusAt?new Date(e.statusAt).toLocaleString("vi-VN"):"-"]})]}):null]},e.id))})]}):null}function w(){let[e,t]=(0,r.useState)([]),[s,a]=(0,r.useState)(""),[i,o]=(0,r.useState)(null),[d,c]=(0,r.useState)(!1),[x,m]=(0,r.useState)(!1),[u,h]=(0,r.useState)(""),[p,b]=(0,r.useState)(!1),[g,y]=(0,r.useState)(""),[j,v]=(0,r.useState)(""),[k,N]=(0,r.useState)(!1),[w,S]=(0,r.useState)("");(0,r.useEffect)(()=>{(async()=>{let e="";try{let t=await fetch("/api/dashboard/analytics/analyze",{cache:"no-store"}),s=await t.json().catch(()=>({}));if(t.ok){o(s.analysis||null),c(!0===s.standby),e=s.selectedModel||"";let t=s.vllmConfig||"";y(t),v(t)}}catch{}try{let s=await fetch("/api/dashboard/analytics/ai-models",{cache:"no-store"}),n=(await s.json().catch(()=>({}))).options||[];t(n),a(t=>{let s=t||e;return s&&n.some(e=>e.value===s)?s:n[0]?.value||""})}catch{t([])}finally{b(!0)}})()},[]);let q=(0,r.useCallback)(e=>{a(e),fetch("/api/dashboard/analytics/analyze",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:e})}).catch(()=>{})},[]),P=(0,r.useCallback)(async({showMessage:e=!0}={})=>{N(!0),e&&S("");try{let t=await fetch("/api/dashboard/analytics/analyze",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({vllmConfig:g})}),s=await t.json().catch(()=>({}));if(!t.ok)throw Error(s.error||"Kh\xf4ng thể lưu cấu h\xecnh vLLM");let n=s.vllmConfig||"";return y(n),v(n),e&&S("Đ\xe3 lưu cấu h\xecnh vLLM"),n}finally{N(!1)}},[g]),L=(0,r.useCallback)(async()=>{h("");try{await P()}catch(e){S(""),h(e?.message||"Kh\xf4ng thể lưu cấu h\xecnh vLLM")}},[P]),M=(0,r.useCallback)(async()=>{if(!s)return;let e=s.indexOf("::"),t=s.slice(0,e),n=s.slice(e+2);m(!0),h("");try{g.trim()!==j&&await P({showMessage:!1});let e=await fetch("/api/dashboard/analytics/analyze",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:t,model:n})}),s=await e.json().catch(()=>({}));if(!e.ok)throw Error(s.error||"Kh\xf4ng thể ph\xe2n t\xedch");o(s.analysis)}catch(e){h(e?.message||"Kh\xf4ng thể ph\xe2n t\xedch")}finally{m(!1)}},[P,j,s,g]),R=(0,r.useMemo)(()=>i?.summary?l.xI.parse(i.summary):"",[i]);return(0,n.jsxs)("section",{className:"overflow-hidden rounded-3xl border border-border bg-surface shadow-[var(--shadow-soft)]",children:[(0,n.jsx)("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-border px-6 py-5",children:(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[(0,n.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl bg-primary/10 text-primary",children:(0,n.jsx)("span",{className:"material-symbols-outlined text-[27px]",children:"neurology"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-lg font-semibold text-text-main",children:"Đ\xe1nh gi\xe1 AI về trải nghiệm & hiệu năng"}),(0,n.jsx)("p",{className:"mt-0.5 text-xs text-text-muted",children:'Ph\xe2n t\xedch giờ l\xe0m việc h\xf4m nay, tập trung v\xe0o tab "Trải nghiệm" v\xe0 c\xe1c vLLM AI server local. Chạy nền tự động mỗi 1 giờ.'})]})]})}),(0,n.jsxs)("div",{className:"space-y-5 p-6",children:[d?(0,n.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/10 px-4 py-3 text-sm text-amber-700 dark:text-amber-300",children:"Standby mode: kết quả ph\xe2n t\xedch được đồng bộ tự động từ Master. Node n\xe0y kh\xf4ng tự chạy ph\xe2n t\xedch AI."}):null,(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("label",{htmlFor:"analytics-vllm-config",className:"text-xs font-medium text-text-muted",children:"Cấu h\xecnh vLLM của c\xe1c server"}),(0,n.jsxs)("span",{className:"text-xs text-text-subtle",children:[g.length.toLocaleString("vi-VN")," / 50.000 k\xfd tự"]})]}),(0,n.jsx)("textarea",{id:"analytics-vllm-config",rows:8,maxLength:5e4,value:g,onChange:e=>{y(e.target.value),S("")},disabled:d||k,placeholder:"M\xf4 tả theo từng node, v\xed dụ:\nnode-gpu-01: model=..., --tensor-parallel-size 4, --max-model-len 32768, --gpu-memory-utilization 0.9\nnode-gpu-02: model=..., replicas=2, c\xe1c tham số batching/concurrency...",className:"w-full resize-y rounded-lg border border-border bg-surface px-3 py-2.5 font-mono text-xs leading-5 text-text-main outline-none transition focus:border-primary focus:ring-2 focus:ring-primary/15 disabled:opacity-60"}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsx)("p",{className:"text-xs text-text-muted",children:"D\xf9ng t\xean hoặc host tr\xf9ng với Linux node trong Resource Monitor để AI \xe1nh xạ ch\xednh x\xe1c."}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[w?(0,n.jsx)("span",{className:"text-xs text-emerald-600 dark:text-emerald-300",children:w}):null,(0,n.jsxs)("button",{type:"button",onClick:L,disabled:d||k||g.trim()===j,className:"inline-flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-2 text-xs font-semibold text-text-main transition hover:border-primary/40 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:k?"progress_activity":"save"}),k?"Đang lưu...":"Lưu cấu h\xecnh"]})]})]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,n.jsxs)("label",{className:"flex min-w-[280px] flex-1 flex-col gap-1.5 text-sm",children:[(0,n.jsx)("span",{className:"text-xs font-medium text-text-muted",children:"AI model d\xf9ng để ph\xe2n t\xedch"}),(0,n.jsxs)("select",{className:"rounded-xl border border-border bg-surface px-3 py-2.5 text-sm text-text-main disabled:opacity-60",value:s,onChange:e=>q(e.target.value),disabled:!e.length||d,children:[e.length?null:(0,n.jsx)("option",{value:"",children:"Chưa c\xf3 kết nối AI n\xe0o đang hoạt động"}),e.map(e=>(0,n.jsx)("option",{value:e.value,children:e.label},e.value))]})]}),(0,n.jsxs)("button",{type:"button",onClick:M,disabled:!s||d||x,className:"flex items-center gap-2 rounded-xl bg-primary px-4 py-2.5 text-sm font-semibold text-white shadow-sm transition disabled:cursor-not-allowed disabled:opacity-60",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:x?"progress_activity":"auto_awesome"}),x?"Đang ph\xe2n t\xedch...":"Ph\xe2n t\xedch lại"]})]}),u?(0,n.jsx)("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 px-4 py-3 text-sm text-red-600 dark:text-red-300",children:u}):null,i?(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs text-text-muted",children:[(0,n.jsxs)("span",{children:["Model: ",(0,n.jsx)("span",{className:"font-semibold",children:i.modelLabel})]}),(0,n.jsxs)("span",{children:["Cập nhật l\xfac ",i.generatedAt?new Date(i.generatedAt).toLocaleString("vi-VN"):"-"]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("span",{className:"text-xs text-text-muted",children:"Tổng quan:"}),(0,n.jsx)(f,{status:i.status}),(0,n.jsx)("span",{className:"text-xs text-text-muted",children:"vLLM local:"}),(0,n.jsx)(f,{status:i.vllmStatus}),"number"==typeof i.vllmServerCount?(0,n.jsxs)("span",{className:"text-xs text-text-subtle",children:["(",i.vllmServerCount," node)"]}):null]}),(0,n.jsx)(T,{nodes:i.hardwareNodes||[]}),(0,n.jsx)("div",{className:"analytics-ai-body rounded-2xl border border-border bg-surface-2/40 p-5 text-sm leading-6 text-text-main",dangerouslySetInnerHTML:{__html:R}})]}):!x&&p?(0,n.jsx)("div",{className:"rounded-2xl border border-dashed border-border bg-surface-2/40 py-10 text-center text-sm text-text-muted",children:'Chưa c\xf3 ph\xe2n t\xedch n\xe0o — bấm "Ph\xe2n t\xedch lại" để bắt đầu.'}):null]})]})}function S(e,t=0){return Number(e||0).toLocaleString("vi-VN",{maximumFractionDigits:t})}function q(e){let t=Number(e||0);return Intl.NumberFormat("vi-VN",{notation:"compact",maximumFractionDigits:1}).format(t)}function P(e){let t=100*Number(e||0);return`${t.toLocaleString("vi-VN",{maximumFractionDigits:1})}%`}function L(e){let t=Number(e||0);return t?`$${t.toLocaleString("vi-VN",{minimumFractionDigits:4,maximumFractionDigits:6})}`:"$0"}function M(e){if(null==e||Number.isNaN(Number(e)))return"-";let t=Number(e);return t>=1e3?`${(t/1e3).toLocaleString("vi-VN",{maximumFractionDigits:2})}s`:`${t.toLocaleString("vi-VN",{maximumFractionDigits:0})}ms`}function R(e,t="/s"){if(null==e||Number.isNaN(Number(e)))return"-";let s=Number(e);return`${s.toLocaleString("vi-VN",{maximumFractionDigits:s>=10?1:2})}${t}`}function I(e){return null==e||Number.isNaN(Number(e))?"-":`${Number(e).toLocaleString("vi-VN",{maximumFractionDigits:0})}/100`}function C(e){if(!e)return null;let t=String(e).trim();return new Date(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)?$/.test(t)?`${t.replace(" ","T")}Z`:t)}function A(e){if(!e)return"-";try{let t=C(e);if(!t||Number.isNaN(t.getTime()))return String(e);return t.toLocaleString("vi-VN",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{return String(e)}}function $(e){if(!e)return"";try{let t=C(e);if(!t||Number.isNaN(t.getTime()))return String(e);return t.toLocaleString("vi-VN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1})}catch{return String(e)}}function F(){let{isAdmin:e,isMonitorAdmin:t,isAiGatewaysMonitor:s}=(0,a.s)();return e||t||s}function O(...e){return e.filter(Boolean).join(" ")}function K(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function E(e,t={}){let s=new URLSearchParams;return Object.entries({...e,...t}).forEach(([e,t])=>{let n=String(t??"").trim();n&&s.set(e,n)}),s.toString()}function U({children:e,className:t=""}){return(0,n.jsx)("div",{className:O("min-w-0 rounded-2xl border border-border bg-surface p-5 shadow-sm",t),children:e})}function _({icon:e,label:t,value:s,hint:r,help:l,tone:a="blue"}){return(0,n.jsx)(U,{className:"min-h-[126px]",children:(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-sm font-medium text-text-muted",children:t}),(0,n.jsx)("div",{className:"mt-2 text-2xl font-semibold text-text-main",children:s}),r?(0,n.jsx)("div",{className:"mt-2 text-xs text-text-muted",children:r}):null,l?(0,n.jsx)("div",{className:"mt-1 text-[11px] leading-4 text-text-muted/70",children:l}):null]}),(0,n.jsx)("div",{className:O("flex h-10 w-10 items-center justify-center rounded-xl",{blue:"bg-blue-500/10 text-blue-600 dark:text-blue-300",green:"bg-green-500/10 text-green-600 dark:text-green-300",red:"bg-red-500/10 text-red-600 dark:text-red-300",amber:"bg-amber-500/10 text-amber-600 dark:text-amber-300",purple:"bg-purple-500/10 text-purple-600 dark:text-purple-300",slate:"bg-slate-500/10 text-slate-600 dark:text-slate-300"}[a]||"bg-blue-500/10 text-blue-600 dark:text-blue-300"),children:(0,n.jsx)("span",{className:"material-symbols-outlined text-[22px]",children:e})})]})})}function D({label:e,children:t}){return(0,n.jsxs)("label",{className:"space-y-1.5 text-xs font-medium text-text-muted",children:[(0,n.jsx)("span",{children:e}),t]})}function V({value:e,onChange:t,children:s}){return(0,n.jsx)("select",{value:e||"",onChange:e=>t(e.target.value),className:"h-10 w-full rounded-xl border border-border bg-background px-3 text-sm text-text-main outline-none transition focus:border-primary/60 focus:ring-2 focus:ring-primary/20",children:s})}function H({value:e,onChange:t,placeholder:s="",type:r="text"}){return(0,n.jsx)("input",{value:e||"",type:r,onChange:e=>t(e.target.value),placeholder:s,className:"h-10 w-full rounded-xl border border-border bg-background px-3 text-sm text-text-main outline-none transition placeholder:text-text-muted/60 focus:border-primary/60 focus:ring-2 focus:ring-primary/20"})}function B(){return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:Array.from({length:8}).map((e,t)=>(0,n.jsx)("div",{className:"h-32 animate-pulse rounded-2xl border border-border bg-surface"},t))}),(0,n.jsx)("div",{className:"h-80 animate-pulse rounded-2xl border border-border bg-surface"})]})}function G({title:e="Kh\xf4ng c\xf3 dữ liệu",description:t="Kh\xf4ng t\xecm thấy dữ liệu theo bộ lọc hiện tại."}){return(0,n.jsxs)("div",{className:"flex min-h-[180px] flex-col items-center justify-center rounded-2xl border border-dashed border-border bg-surface/60 p-8 text-center",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-4xl text-text-muted",children:"database_off"}),(0,n.jsx)("div",{className:"mt-3 text-sm font-semibold text-text-main",children:e}),(0,n.jsx)("div",{className:"mt-1 max-w-xl text-sm text-text-muted",children:t})]})}function z({data:e=[],valueKey:t="totalTokens",secondaryKey:s="requests",height:r=220}){let l=e||[],a=Math.max(...l.map(e=>Number(e[t]||0)),1),i=Math.max(...l.map(e=>Number(e[s]||0)),1);return 0===l.length?(0,n.jsx)(G,{description:"Chưa c\xf3 time-series trong khoảng thời gian n\xe0y."}):(0,n.jsx)("div",{className:"overflow-x-auto",children:(0,n.jsxs)("div",{className:"min-w-[720px]",children:[(0,n.jsx)("div",{className:"flex items-end gap-1",style:{height:r},children:l.map((e,l)=>{let o=Math.max(2,Number(e[t]||0)/a*(r-42)),d=Math.max(2,Number(e[s]||0)/i*(r-42));return(0,n.jsx)("div",{className:"group flex flex-1 flex-col items-center justify-end gap-1",children:(0,n.jsxs)("div",{className:"relative flex h-full w-full max-w-[34px] items-end justify-center gap-0.5",children:[(0,n.jsx)("div",{className:"w-2 rounded-t bg-primary/70",style:{height:o}}),(0,n.jsx)("div",{className:"w-2 rounded-t bg-amber-500/70",style:{height:d}}),(0,n.jsxs)("div",{className:"pointer-events-none absolute bottom-full left-1/2 z-20 hidden w-56 -translate-x-1/2 rounded-xl border border-border bg-surface p-3 text-left text-xs shadow-xl group-hover:block",children:[(0,n.jsx)("div",{className:"font-semibold text-text-main",children:$(e.label)}),(0,n.jsxs)("div",{className:"mt-1 text-text-muted",children:["Request: ",S(e.requests)]}),(0,n.jsxs)("div",{className:"text-text-muted",children:["Input token: ",S(e.promptTokens)]}),(0,n.jsxs)("div",{className:"text-text-muted",children:["Output token: ",S(e.completionTokens)]}),(0,n.jsxs)("div",{className:"text-text-muted",children:["Tổng token: ",S(e.totalTokens)]}),(0,n.jsxs)("div",{className:"text-text-muted",children:["Lỗi: ",S(e.errors)]})]})]})},`${e.label}-${l}`)})}),(0,n.jsxs)("div",{className:"mt-3 flex justify-between gap-2 text-[11px] text-text-muted",children:[(0,n.jsx)("span",{children:$(l[0]?.label)}),(0,n.jsx)("span",{children:$(l[Math.floor(l.length/2)]?.label)}),(0,n.jsx)("span",{children:$(l[l.length-1]?.label)})]})]})})}function W(){return(0,n.jsxs)("div",{className:"flex flex-wrap gap-3 text-xs text-text-muted",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"h-2.5 w-2.5 rounded-sm bg-primary/70"}),"Token"]}),(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"h-2.5 w-2.5 rounded-sm bg-amber-500/70"}),"Request"]})]})}function X({columns:e,rows:t,empty:s="Kh\xf4ng c\xf3 dữ liệu"}){return t&&0!==t.length?(0,n.jsx)("div",{className:"overflow-x-auto overflow-y-auto rounded-2xl border border-border",style:{maxHeight:"500px"},children:(0,n.jsxs)("table",{className:"min-w-full divide-y divide-border text-sm",children:[(0,n.jsx)("thead",{className:"bg-background/70",children:(0,n.jsx)("tr",{children:e.map(e=>(0,n.jsx)("th",{className:O("whitespace-nowrap px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-text-muted",e.className),children:e.label},e.key))})}),(0,n.jsx)("tbody",{className:"divide-y divide-border bg-surface",children:t.map((t,s)=>(0,n.jsx)("tr",{className:"hover:bg-background/60",children:e.map(e=>(0,n.jsx)("td",{className:O("whitespace-nowrap px-4 py-3 align-top text-text-main",e.className),children:e.render?e.render(t,s):t[e.key]??"-"},e.key))},t.key||t.id||`${t.label}-${s}`))})]})}):(0,n.jsx)(G,{title:s})}function J({items:e=[]}){return e&&0!==e.length?(0,n.jsx)("div",{className:"flex max-w-[360px] flex-wrap gap-1.5",children:e.slice(0,3).map(e=>(0,n.jsxs)("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-xs text-primary",children:[e.label||e.key," \xb7 ",S(e.count??e.requests??e.totalTokens??0)]},e.key))}):(0,n.jsx)("span",{className:"text-text-muted",children:"-"})}function Z({row:e}){return(0,n.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,n.jsxs)("div",{className:"font-semibold text-text-main",children:[q(e.totalTokens)," token"]}),(0,n.jsxs)("div",{className:"text-text-muted",children:["In ",q(e.promptTokens)," / Out ",q(e.completionTokens)]})]})}function Q({leaderboard:e={}}){let t=F(),s=e.rows||[],r=e.status||"warming",l="ready"===r?`${e.periodLabel||"H\xf4m nay"} \xb7 cập nhật ${A(e.generatedAt)} \xb7 refresh nền mỗi ${Math.round((e.refreshEveryMs||9e5)/6e4)} ph\xfat`:"error"===r?"Leaderboard đang chờ job nền tổng hợp lại dữ liệu.":"Leaderboard đang được job nền khởi tạo.";return(0,n.jsxs)(U,{className:"border-amber-500/20 bg-amber-500/[0.03]",children:[(0,n.jsxs)("div",{className:"mb-4 flex flex-wrap items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-2xl text-amber-500",children:"crown"}),(0,n.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Top 5 vinh danh token"})]}),(0,n.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"Xếp hạng theo API key owner d\xf9ng nhiều input + output token nhất."})]}),(0,n.jsx)("span",{className:"rounded-full bg-amber-500/10 px-3 py-1 text-xs font-semibold text-amber-700 dark:text-amber-300",children:l})]}),(0,n.jsx)(X,{rows:s,empty:"Chưa c\xf3 snapshot leaderboard từ job nền.",columns:[{key:"rank",label:"Hạng",render:e=>(0,n.jsxs)("div",{className:"flex min-w-[170px] items-center gap-3",children:[(0,n.jsx)("div",{className:O("flex h-10 w-10 shrink-0 items-center justify-center rounded-xl",1===e.rank?"bg-amber-500/15 text-amber-600":"bg-primary/10 text-primary"),children:(0,n.jsx)("span",{className:"material-symbols-outlined text-[22px]",children:"crown"})}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"font-semibold text-text-main",children:["#",e.rank," \xb7 ",e.title]}),(0,n.jsxs)("div",{className:"text-xs text-text-muted",children:[P(e.tokenShare||0)," tổng token"]})]})]})},{key:"owner",label:"Owner",render:e=>(0,n.jsxs)("div",{className:"min-w-[210px]",children:[(0,n.jsx)("div",{className:"font-semibold text-text-main",children:e.ownerUser||e.label}),(0,n.jsxs)("div",{className:"text-xs text-text-muted",children:[e.apiKeyName||"API key",t&&e.apiKeyFingerprint?` \xb7 ${e.apiKeyFingerprint}`:""]})]})},{key:"requests",label:"Req",render:e=>S(e.requests)},{key:"tokens",label:"Token",render:e=>(0,n.jsx)(Z,{row:e})},{key:"scope",label:"Phạm vi",render:e=>(0,n.jsxs)("div",{className:"text-xs text-text-muted",children:[(0,n.jsxs)("div",{children:["API key ",S(e.apiKeyCount)," \xb7 IP ",S(e.sourceIpCount)]}),(0,n.jsxs)("div",{children:["Model ",S(e.modelCount)," \xb7 Provider ",S(e.providerCount)]})]})},{key:"lastSeen",label:"Last seen",render:e=>A(e.lastSeen)}]})]})}function Y({value:e}){let t=Number(e||0);return(0,n.jsx)("span",{className:O("rounded-full px-2 py-1 text-xs font-semibold",t>=.2?"bg-red-500/10 text-red-600 dark:text-red-300":t>=.05?"bg-amber-500/10 text-amber-600 dark:text-amber-300":"bg-green-500/10 text-green-600 dark:text-green-300"),children:P(t)})}function ee({level:e,label:t}){let s=String(e||"none");return(0,n.jsx)("span",{className:O("rounded-full px-2 py-1 text-xs font-semibold",{fast:"bg-green-500/10 text-green-700 dark:text-green-300",ok:"bg-blue-500/10 text-blue-700 dark:text-blue-300",slow:"bg-amber-500/10 text-amber-700 dark:text-amber-300",very_slow:"bg-red-500/10 text-red-700 dark:text-red-300",low_sample:"bg-amber-500/10 text-amber-700 dark:text-amber-300",none:"bg-slate-500/10 text-slate-700 dark:text-slate-300"}[s]||"bg-slate-500/10 text-slate-700 dark:text-slate-300"),children:t||"-"})}function et({level:e,label:t}){let s=String(e||"normal");return(0,n.jsx)("span",{className:O("rounded-full px-2 py-1 text-xs font-semibold",{critical:"bg-red-500/10 text-red-700 dark:text-red-300",high:"bg-amber-500/10 text-amber-700 dark:text-amber-300",medium:"bg-blue-500/10 text-blue-700 dark:text-blue-300",normal:"bg-green-500/10 text-green-700 dark:text-green-300",none:"bg-slate-500/10 text-slate-700 dark:text-slate-300"}[s]||"bg-slate-500/10 text-slate-700 dark:text-slate-300"),children:t||"-"})}function es({value:e}){let t=String(e||"unknown"),s={gateway:{label:"Gateway",cls:"bg-purple-500/10 text-purple-700 dark:text-purple-300"},upstream:{label:"Upstream",cls:"bg-red-500/10 text-red-700 dark:text-red-300"},client:{label:"Client",cls:"bg-slate-500/10 text-slate-700 dark:text-slate-300"},rate_limit:{label:"Rate limit",cls:"bg-amber-500/10 text-amber-700 dark:text-amber-300"},unknown:{label:"Unknown",cls:"bg-zinc-500/10 text-zinc-700 dark:text-zinc-300"}}[t]||{label:t,cls:"bg-zinc-500/10 text-zinc-700 dark:text-zinc-300"};return(0,n.jsx)("span",{className:O("rounded-full px-2 py-1 text-xs font-semibold",s.cls),children:s.label})}function en({row:e}){let t=e.sampleMessage||e.errorMessageShort||"";return t?(0,n.jsx)("span",{className:"block max-w-[360px] truncate text-xs text-text-muted",title:t,children:t}):(0,n.jsx)("span",{className:"text-text-muted",children:"-"})}function er({icon:e,label:t,value:s,hint:r,tone:l="slate"}){return(0,n.jsx)("div",{className:O("rounded-2xl border p-4 shadow-sm",{red:"border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300",amber:"border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300",purple:"border-purple-500/20 bg-purple-500/10 text-purple-700 dark:text-purple-300",slate:"border-border bg-surface text-text-main",green:"border-green-500/20 bg-green-500/10 text-green-700 dark:text-green-300"}[l]||"border-border bg-surface text-text-main"),children:(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wide opacity-75",children:t}),(0,n.jsx)("div",{className:"mt-2 text-2xl font-bold",children:S(s)}),r?(0,n.jsx)("div",{className:"mt-1 text-xs opacity-80",children:r}):null]}),(0,n.jsx)("span",{className:"material-symbols-outlined text-[24px] opacity-80",children:e})]})})}function el({anomaly:e}){let t="danger"===e.level?"border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300":"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",s="danger"===e.level?"error":"warning";return(0,n.jsx)("div",{className:O("rounded-2xl border p-4",t),children:(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[22px]",children:s}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"font-semibold",children:e.title}),(0,n.jsx)("div",{className:"mt-1 text-sm opacity-90",children:e.detail})]})]})})}function ea({notes:e=[]}){return e.length?(0,n.jsx)("div",{className:"space-y-2 rounded-2xl border border-blue-500/20 bg-blue-500/10 p-4 text-sm text-blue-700 dark:text-blue-300",children:e.map((e,t)=>(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"info"}),(0,n.jsx)("span",{children:e})]},t))}):null}function ei({filters:e,setFilters:t,options:s,onRefresh:r,onExportCsv:l,loading:a,showProviderFilters:i=!0}){let o=(e,s)=>t(t=>({...t,[e]:s}));return(0,n.jsxs)(U,{children:[(0,n.jsxs)("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-6",children:[(0,n.jsx)(D,{label:"Khoảng thời gian",children:(0,n.jsx)(V,{value:e.period,onChange:e=>o("period",e),children:y.map(e=>(0,n.jsx)("option",{value:e.value,children:e.label},e.value))})}),i?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(D,{label:"Provider",children:(0,n.jsxs)(V,{value:e.provider,onChange:e=>o("provider",e),children:[(0,n.jsx)("option",{value:"",children:"Tất cả provider"}),(s.providers||[]).map(e=>{let t="string"==typeof e?e:e.value,s="string"==typeof e?e:e.label||e.value;return(0,n.jsx)("option",{value:t,children:s},t)})]})}),(0,n.jsx)(D,{label:"Model",children:(0,n.jsxs)(V,{value:e.model,onChange:e=>o("model",e),children:[(0,n.jsx)("option",{value:"",children:"Tất cả model"}),(s.models||[]).map(e=>(0,n.jsx)("option",{value:e,children:e},e))]})})]}):null,(0,n.jsx)(D,{label:"Source IP",children:(0,n.jsx)(H,{value:e.clientIp,onChange:e=>o("clientIp",e),placeholder:"172.16.253.1"})}),(0,n.jsx)(D,{label:"Source tool",children:(0,n.jsx)(H,{value:e.sourceTool,onChange:e=>o("sourceTool",e),placeholder:"copilot, antigravity..."})}),(0,n.jsx)(D,{label:"Status",children:(0,n.jsxs)(V,{value:e.status,onChange:e=>o("status",e),children:[(0,n.jsx)("option",{value:"",children:"Tất cả status"}),(s.statuses||[]).map(e=>(0,n.jsx)("option",{value:e,children:e},e))]})}),(0,n.jsx)(D,{label:"Session / keyword",children:(0,n.jsx)(H,{value:e.sessionId||e.keyword,onChange:e=>o("keyword",e),placeholder:"session, prompt, error..."})})]}),(0,n.jsxs)("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsx)("div",{className:"text-xs text-text-muted",children:"Token/cost lấy từ UsageHistory. Source IP/tool/session lấy từ Prompt Logs."}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)("button",{onClick:()=>t({period:"today",provider:"",model:"",status:"",clientIp:"",sourceTool:"",sessionId:"",keyword:""}),className:"rounded-xl border border-border px-3 py-2 text-sm font-medium text-text-main hover:bg-background",children:"Reset"}),(0,n.jsxs)("button",{onClick:l,className:"rounded-xl border border-border px-3 py-2 text-sm font-medium text-text-main hover:bg-background",children:[(0,n.jsx)("span",{className:"material-symbols-outlined mr-1 align-[-4px] text-[18px]",children:"download"}),"Export CSV"]}),(0,n.jsxs)("button",{onClick:()=>r?.(),disabled:a,className:"rounded-xl bg-primary px-4 py-2 text-sm font-semibold text-white shadow-sm disabled:opacity-60",children:[(0,n.jsx)("span",{className:"material-symbols-outlined mr-1 align-[-5px] text-[18px]",children:"refresh"}),a?"Đang tải...":"Refresh"]})]})]})]})}function eo({data:e}){let t=F(),s=e.overview||{},r=e.latency||{},l=e.experience||{};return(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsx)(Q,{leaderboard:e.tokenLeaderboard}),(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[(0,n.jsx)(_,{icon:"call_made",label:"Tổng request",value:S(s.requests),hint:`${S(s.requestsPerMinute,2)} request/ph\xfat`,help:"Số request khớp bộ lọc hiện tại."}),(0,n.jsx)(_,{icon:"check_circle",label:"Th\xe0nh c\xf4ng",value:S(s.success),hint:`Tỷ lệ lỗi ${P(s.errorRate)}`,help:"Request trả về th\xe0nh c\xf4ng v\xe0 c\xf3 trạng th\xe1i OK.",tone:"green"}),(0,n.jsx)(_,{icon:"dns",label:"Lỗi server/provider",value:S(s.serverErrorEvents),hint:`Server-impacting ${P(s.serverErrorRate)} \xb7 client ${S(s.clientErrorEvents)}`,help:"Lỗi từ gateway, provider hoặc model server; t\xe1ch ri\xeang lỗi client.",tone:s.serverErrorEvents?"red":"green"}),(0,n.jsx)(_,{icon:"speed",label:"Trải nghiệm",value:I(l.score),hint:`${l.label||"-"} \xb7 ${S(l.samples)} mẫu`,help:"Điểm 0-100. Trừ tối đa 45 cho tốc độ (latency/TTFT/slow-rate t\xednh gộp, kh\xf4ng cộng dồn) v\xe0 40 cho lỗi server. Rate limit v\xe0 lỗi client chỉ trừ nhẹ v\xec kh\xf4ng phản \xe1nh chất lượng dịch vụ.",tone:l.tone||"purple"}),(0,n.jsx)(_,{icon:"timer",label:"Latency P95",value:M(l.p95LatencyMs||r.p95Ms),hint:`AVG ${M(l.avgLatencyMs||r.avgMs)} \xb7 P50 ${M(l.p50LatencyMs||r.p50Ms)}`,help:"95% request ho\xe0n tất nhanh hơn gi\xe1 trị n\xe0y.",tone:"purple"}),(0,n.jsx)(_,{icon:"bolt",label:"TTFT P95",value:M(l.p95TtftMs),hint:`${S(l.ttftSamples)} mẫu TTFT \xb7 chờ token đầu ti\xean`,help:"95% request nhận token đầu ti\xean nhanh hơn gi\xe1 trị n\xe0y. Mẫu TTFT = request th\xe0nh c\xf4ng c\xf3 token v\xe0 c\xf3 ttftMs > 0; rộng hơn mẫu decode của card Output speed.",tone:l.slowTtftRate>=.2?"amber":"blue"}),(0,n.jsx)(_,{icon:"input",label:"Input P95",value:q(l.p95PromptTokens||0),hint:`Avg ${q(l.avgPromptTokens||s.avgPromptTokens)} \xb7 >=30k ${P(l.longInputRate)}`,help:"95% request c\xf3 k\xedch thước input nhỏ hơn gi\xe1 trị n\xe0y."}),(0,n.jsx)(_,{icon:"psychology_alt",label:"Auto-off thinking",value:P(e.thinkingAnalytics?.autoOffRate),hint:`${S(e.thinkingAnalytics?.autoOffRequests||0)} request bị tắt theo policy`,help:"Tỷ lệ request bị tắt thinking do vượt ngưỡng hoặc policy.",tone:(e.thinkingAnalytics?.autoOffRate||0)>=.3?"amber":"slate"}),(0,n.jsx)(_,{icon:"data_object",label:"Large context >=50k",value:P(e.largeContextAnalytics?.gte50kRate),hint:`>=100k ${P(e.largeContextAnalytics?.gte100kRate)}`,help:"Tỷ lệ request c\xf3 context rất lớn, dễ l\xe0m tăng TTFT/latency.",tone:(e.largeContextAnalytics?.gte50kRate||0)>=.3?"amber":"slate"}),(0,n.jsx)(_,{icon:"person_alert",label:"Top user nặng",value:s.topHeavyUser||"-",hint:`Chiếm ${P(s.topHeavyUserTokenShare)} tổng token`,help:"User/API key ti\xeau thụ nhiều token nhất trong bộ lọc.",tone:s.topHeavyUserTokenShare>=.35?"amber":"slate"}),(0,n.jsx)(_,{icon:"running_with_errors",label:"Request chậm",value:P(l.slowRequestRate),hint:`>= ${M(l.thresholds?.slowLatencyMs||45e3)} \xb7 max ${M(l.maxLatencyMs)}`,help:"Tỷ lệ request vượt ngưỡng chậm đ\xe3 cấu h\xecnh.",tone:l.slowRequestRate>=.2?"amber":"green"}),(0,n.jsx)(_,{icon:"output",label:"Output tokens",value:q(s.completionTokens),hint:`Avg ${S(s.avgCompletionTokens,1)} / request`,help:"Tổng token model sinh ra."}),(0,n.jsx)(_,{icon:"token",label:"Tổng tokens",value:q(s.totalTokens),hint:`${q(s.tokensPerMinute)} token/ph\xfat`,help:"Tổng input + output token.",tone:"amber"}),(0,n.jsx)(_,{icon:"speed",label:"Output speed",value:R(l.decodeTokensPerSecond," tok/s"),hint:`${S(l.decodeSamples)} mẫu decode \xb7 Latency/10k input ${M(l.latencyMsPer10kInputTokens)}`,help:"Tốc độ sinh token sau khi model bắt đầu trả lời: Σ output token / Σ(latency − TTFT). Mẫu decode chỉ gồm request th\xe0nh c\xf4ng, c\xf3 TTFT thật v\xe0 c\xf3 output token, n\xean \xedt hơn cả tổng request lẫn số mẫu TTFT d\xf9ng cho card TTFT P95.",tone:"slate"}),(0,n.jsx)(_,{icon:"payments",label:"Cost ước t\xednh",value:L(s.cost),hint:"Dựa tr\xean pricing đ\xe3 cấu h\xecnh",help:"Chi ph\xed suy ra từ token usage v\xe0 bảng gi\xe1 hiện tại.",tone:"green"})]}),(0,n.jsxs)("div",{className:"grid min-w-0 gap-5 xl:grid-cols-[2fr_1fr]",children:[(0,n.jsxs)(U,{children:[(0,n.jsxs)("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Tần suất request & token theo thời gian"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"Cột xanh l\xe0 token, cột v\xe0ng l\xe0 số request trong từng bucket thời gian."})]}),(0,n.jsx)(W,{})]}),(0,n.jsx)(z,{data:e.timeSeries||[]})]}),(0,n.jsxs)(U,{children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"T\xf3m tắt active"}),(0,n.jsx)("div",{className:"mt-4 space-y-3",children:[["API key đang d\xf9ng",s.activeApiKeys],["Provider active",s.activeProviders],["Model active",s.activeModels],["Endpoint active",s.activeEndpoints],["Cached tokens",s.cachedTokens],["Reasoning tokens",s.reasoningTokens],["Latency AVG",M(l.avgLatencyMs||r.avgMs)],["Latency P50",M(l.p50LatencyMs||r.p50Ms)],["Latency P99",M(l.p99LatencyMs||r.p99Ms)],["TTFT P95",M(l.p95TtftMs)],["Input P95",q(l.p95PromptTokens||0)],["Long input >=30k",P(l.longInputRate)]].map(([e,t])=>(0,n.jsxs)("div",{className:"flex items-center justify-between rounded-xl bg-background px-3 py-2",children:[(0,n.jsx)("span",{className:"text-sm text-text-muted",children:e}),(0,n.jsx)("span",{className:"font-semibold text-text-main",children:"number"==typeof t?S(t):t})]},e))})]})]}),(0,n.jsxs)("div",{className:"grid gap-5 xl:grid-cols-2",children:[(0,n.jsxs)(U,{children:[(0,n.jsx)("h2",{className:"mb-4 text-lg font-semibold text-text-main",children:"Top API key d\xf9ng nhiều token"}),(0,n.jsx)(X,{rows:(e.clientRequests?.topApiKeysByTokens||e.groups?.apiKeys||[]).slice(0,8),columns:[{key:"name",label:"API key",render:e=>(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"font-semibold",children:e.name||e.label}),(0,n.jsxs)("div",{className:"text-xs text-text-muted",children:[t?e.fingerprint||e.apiKeyFingerprint:"",e.ownerUser||e.apiKeyOwner?`${t&&(e.fingerprint||e.apiKeyFingerprint)?" \xb7 ":""}${e.ownerUser||e.apiKeyOwner}`:""]})]})},{key:"requests",label:"Req",render:e=>S(e.requests)},{key:"tokens",label:"Token",render:e=>(0,n.jsx)(Z,{row:e})},{key:"input",label:"P95/Max input",render:e=>(0,n.jsxs)("div",{className:"text-xs",children:[(0,n.jsx)("div",{children:q(e.p95PromptTokens||0)}),(0,n.jsxs)("div",{className:"text-text-muted",children:["max ",q(e.maxPromptTokens||0)]})]})}]})]}),(0,n.jsxs)(U,{children:[(0,n.jsx)("h2",{className:"mb-4 text-lg font-semibold text-text-main",children:"Top Source IP d\xf9ng nhiều token"}),(0,n.jsx)(X,{rows:(e.clientRequests?.topSourceIpsByTokens||[]).slice(0,8),columns:[{key:"label",label:"Source IP",render:e=>(0,n.jsx)("span",{className:"font-mono text-xs",children:e.label})},{key:"requests",label:"Req",render:e=>S(e.requests)},{key:"tokens",label:"Token",render:e=>(0,n.jsx)(Z,{row:e})},{key:"heavy",label:"Nặng",render:e=>(0,n.jsxs)("span",{className:"text-xs text-text-muted",children:[S(e.heavyRequests||0)," req"]})}],empty:"Kh\xf4ng c\xf3 Source IP c\xf3 token trong khoảng lọc."})]})]})]})}function ed({data:e}){let t=F(),s=e.clientRequests||{},r=s.summary||{},l=s.topHeavyUsers||[],a=s.topProblemClients||[],i=s.topApiKeysByTokens||[],o=s.topSourceIpsByTokens||[];s.topSourceIpsByHeavyRequests;let d=s.inputBuckets||[],c=e=>(0,n.jsxs)("div",{className:"min-w-[220px]",children:[(0,n.jsx)("div",{className:"font-semibold text-text-main",children:e.label}),(0,n.jsx)("div",{className:"mt-1 text-xs text-text-muted",children:e.ownerUser?`Owner ${e.ownerUser}`:e.apiKeyName||"Kh\xf4ng c\xf3 owner"}),(0,n.jsx)("div",{className:"font-mono text-[11px] text-text-muted",children:t?e.apiKeyFingerprint||e.primaryClientIp||e.key:e.primaryClientIp||""})]}),x=e=>(0,n.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,n.jsxs)("div",{children:["Nặng ",S(e.heavyRequests)," \xb7 ",P(e.heavyRequestRate)]}),(0,n.jsxs)("div",{className:"text-text-muted",children:["P95 input ",q(e.p95PromptTokens)," \xb7 Max ",q(e.maxPromptTokens)]}),(0,n.jsxs)("div",{className:"text-text-muted",children:[">=70k ",S(e.extremeInputRequests)," \xb7 ",P(e.extremeInputRate)]})]});return(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[(0,n.jsx)(_,{icon:"person_alert",label:"Top user nặng nhất",value:r.topUserLabel||"-",hint:`${q(r.topUserTokens)} token \xb7 ${P(r.topUserTokenShare)} tổng token`,tone:r.topUserTokenShare>=.35?"amber":"slate"}),(0,n.jsx)(_,{icon:"vpn_key",label:"Top API key nhiều token",value:r.topApiKeyLabel||"-",hint:`${q(r.topApiKeyTokens)} token \xb7 ${P(r.topApiKeyTokenShare)} tổng token`,tone:r.topApiKeyTokenShare>=.35?"amber":"blue"}),(0,n.jsx)(_,{icon:"lan",label:"Top IP nhiều token",value:r.topSourceIpLabel||"-",hint:`${q(r.topSourceIpTokens)} token \xb7 ${P(r.topSourceIpTokenShare)} tổng token`,tone:r.topSourceIpTokenShare>=.35?"amber":"purple"}),(0,n.jsx)(_,{icon:"input",label:"Input d\xe0i >=30k",value:P(r.longInputBucketShare||0),hint:`>=70k ${P(r.extremeInputShare||0)}`,tone:(r.extremeInputShare||0)>=.1?"amber":"green"}),(0,n.jsx)(_,{icon:"groups",label:"User/API key được theo d\xf5i",value:S(r.trackedUsers||0),hint:"Theo owner/API key fingerprint/source IP",tone:"blue"}),(0,n.jsx)(_,{icon:"network_check",label:"Top IP request nặng",value:r.topSourceIpHeavyLabel||"-",hint:`${S(r.topSourceIpHeavyRequests||0)} request >=30k input/total`,tone:r.topSourceIpHeavyRequests?"amber":"slate"}),(0,n.jsx)(_,{icon:"report",label:"Client lỗi nhiều",value:S(r.problemClients||0),hint:"Nh\xf3m user/API key c\xf3 error rows",tone:r.problemClients?"amber":"green"})]}),(0,n.jsxs)(U,{children:[(0,n.jsxs)("div",{className:"mb-4 flex flex-wrap items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Top user/API key gửi request nặng nhất"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"Xếp theo tổng input/output token của request th\xe0nh c\xf4ng c\xf3 token. D\xf9ng để ph\xe1t hiện user VS Code/agent đang tạo tải long-context lớn."})]}),(0,n.jsx)("span",{className:"rounded-full bg-primary/10 px-3 py-1 text-xs font-semibold text-primary",children:"Kh\xf4ng hiển thị full bearer token"})]}),(0,n.jsx)(X,{rows:l,columns:[{key:"user",label:"User/API key",render:c},{key:"quality",label:"\xc1p lực",render:e=>(0,n.jsx)(et,{level:e.level,label:e.pressureLabel})},{key:"requests",label:"Req",render:e=>S(e.requests)},{key:"tokens",label:"Token",render:e=>(0,n.jsx)(Z,{row:e})},{key:"input",label:"Input pressure",render:e=>(0,n.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,n.jsxs)("div",{children:["Avg ",q(e.avgPromptTokens)," \xb7 P95 ",q(e.p95PromptTokens)]}),(0,n.jsxs)("div",{className:"text-text-muted",children:["Max ",q(e.maxPromptTokens)," \xb7 >=30k ",P(e.longInputRate)]}),(0,n.jsxs)("div",{className:"text-text-muted",children:[">=50k ",P(e.hugeInputRate)," \xb7 >=70k ",P(e.extremeInputRate)]})]})},{key:"latency",label:"Latency / TTFT",render:e=>(0,n.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,n.jsxs)("div",{children:["P95 ",M(e.p95LatencyMs)," \xb7 Max ",M(e.maxLatencyMs)]}),(0,n.jsxs)("div",{className:"text-text-muted",children:["TTFT P95 ",M(e.p95TtftMs)," \xb7 Slow ",P(e.slowRequestRate)]})]})},{key:"topModels",label:"Top model",render:e=>(0,n.jsx)(J,{items:e.topModels})},{key:"topIps",label:"IP / Tool",render:e=>(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)(J,{items:e.topIps}),(0,n.jsx)(J,{items:e.topTools})]})},{key:"meta",label:"Meta",render:e=>(0,n.jsxs)("div",{className:"space-y-1 text-xs text-text-muted",children:[(0,n.jsxs)("div",{children:["Key ",S(e.apiKeyCount)," \xb7 IP ",S(e.sourceIpCount)," \xb7 Tool ",S(e.sourceToolCount)]}),(0,n.jsxs)("div",{children:["Session ",S(e.sessionCount)," \xb7 Last ",A(e.lastSeen)]})]})}],empty:"Kh\xf4ng c\xf3 request th\xe0nh c\xf4ng c\xf3 token trong khoảng lọc."})]}),(0,n.jsxs)("div",{className:"grid gap-5 xl:grid-cols-2",children:[(0,n.jsxs)(U,{children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Top API key d\xf9ng nhiều token nhất"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"Xếp theo tổng input + output token từ UsageHistory, kh\xf4ng lộ full bearer token."})]}),(0,n.jsx)(X,{rows:i,columns:[{key:"apiKey",label:"API key",render:e=>(0,n.jsxs)("div",{className:"min-w-[220px]",children:[(0,n.jsx)("div",{className:"font-semibold text-text-main",children:e.label}),(0,n.jsx)("div",{className:"mt-1 text-xs text-text-muted",children:e.apiKeyOwner?`Owner ${e.apiKeyOwner}`:e.apiKeyName||e.primarySourceTool||"-"}),(0,n.jsx)("div",{className:"font-mono text-[11px] text-text-muted",children:t?e.apiKeyFingerprint||e.primaryClientIp||e.key:e.primaryClientIp||""})]})},{key:"requests",label:"Req",render:e=>S(e.requests)},{key:"tokens",label:"Token",render:e=>(0,n.jsx)(Z,{row:e})},{key:"input",label:"Input nặng",render:x},{key:"meta",label:"Nguồn",render:e=>(0,n.jsxs)("div",{className:"text-xs text-text-muted",children:[(0,n.jsxs)("div",{children:["IP ",S(e.sourceIpCount)," \xb7 Tool ",S(e.sourceToolCount)]}),(0,n.jsxs)("div",{children:["Model ",S(e.modelCount)," \xb7 Provider ",S(e.providerCount)]})]})},{key:"lastSeen",label:"Last seen",render:e=>A(e.lastSeen)}],empty:"Kh\xf4ng c\xf3 API key c\xf3 token trong khoảng lọc."})]}),(0,n.jsxs)(U,{children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Top Source IP d\xf9ng nhiều token nhất"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"Dựa tr\xean UsageHistory n\xean c\xf3 input/output token, kh\xe1c với bảng Source IP từ Prompt Logs chỉ đếm log."})]}),(0,n.jsx)(X,{rows:o,columns:[{key:"ip",label:"Source IP",render:e=>(0,n.jsxs)("div",{className:"min-w-[180px]",children:[(0,n.jsx)("div",{className:"font-mono text-sm font-semibold text-text-main",children:e.label}),(0,n.jsxs)("div",{className:"mt-1 text-xs text-text-muted",children:["Tool ",S(e.sourceToolCount)," \xb7 API key ",S(e.apiKeyCount)]}),(0,n.jsxs)("div",{className:"text-xs text-text-muted",children:["Model ",S(e.modelCount)," \xb7 Provider ",S(e.providerCount)]})]})},{key:"requests",label:"Req",render:e=>S(e.requests)},{key:"tokens",label:"Token",render:e=>(0,n.jsx)(Z,{row:e})},{key:"input",label:"Input nặng",render:x},{key:"lastSeen",label:"Last seen",render:e=>A(e.lastSeen)}],empty:"Kh\xf4ng c\xf3 Source IP c\xf3 token trong khoảng lọc."})]})]}),(0,n.jsxs)("div",{className:"grid gap-5 xl:grid-cols-2",children:[(0,n.jsxs)(U,{children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Ph\xe2n bố request theo k\xedch thước input"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"Gi\xfap admin biết workload đang l\xe0 chat ngắn hay long-context VS Code/agent."})]}),(0,n.jsx)(X,{rows:d,columns:[{key:"label",label:"Input bucket",render:e=>(0,n.jsx)("span",{className:"font-mono text-xs",children:e.label})},{key:"requests",label:"Req",render:e=>S(e.requests)},{key:"share",label:"Tỷ trọng",render:e=>P(e.share)},{key:"tokens",label:"Token",render:e=>(0,n.jsx)(Z,{row:e})},{key:"latency",label:"Latency P95/MAX",render:e=>(0,n.jsxs)("div",{className:"text-xs",children:[(0,n.jsxs)("div",{children:[M(e.p95LatencyMs)," / ",M(e.maxLatencyMs)]}),(0,n.jsxs)("div",{className:"text-text-muted",children:["TTFT P95 ",M(e.p95TtftMs)]})]})}],empty:"Kh\xf4ng c\xf3 dữ liệu bucket input."})]}),(0,n.jsxs)(U,{children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Client/API key lỗi nhiều"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"D\xf9ng để ph\xe1t hiện sai endpoint/model/auth/policy hoặc client tool cấu h\xecnh sai."})]}),(0,n.jsx)(X,{rows:a,columns:[{key:"user",label:"Client",render:c},{key:"requests",label:"Req",render:e=>S(e.requests)},{key:"errors",label:"Lỗi",render:e=>S(e.errors)},{key:"errorRate",label:"Error %",render:e=>(0,n.jsx)(Y,{value:e.errorRate})},{key:"tokens",label:"Token",render:e=>(0,n.jsx)(Z,{row:e})},{key:"source",label:"IP/Tool",render:e=>(0,n.jsxs)("div",{className:"text-xs",children:[(0,n.jsx)("div",{className:"font-mono",children:e.primaryClientIp||"-"}),(0,n.jsx)("div",{className:"text-text-muted",children:e.primarySourceTool||"-"})]})},{key:"lastSeen",label:"Last seen",render:e=>A(e.lastSeen)}],empty:"Kh\xf4ng c\xf3 client lỗi theo bộ lọc hiện tại."})]})]}),(0,n.jsxs)(U,{children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"G\xf3c nh\xecn monitor client n\xean d\xf9ng"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"C\xe1c chỉ số n\xe0y bổ sung cho latency/model để admin ph\xe2n biệt server chậm hay client gửi request qu\xe1 nặng."})]}),(0,n.jsx)("div",{className:"grid gap-3 text-sm md:grid-cols-2 xl:grid-cols-3",children:[["Token/user","X\xe1c định user/API key tạo tải lớn nhất, hữu \xedch cho quota v\xe0 hướng dẫn workflow VS Code."],["Input bucket","Nếu phần lớn request nằm ở 30k-70k+, P95/P99 cao chủ yếu do prompt eval/context d\xe0i."],["TTFT theo user","TTFT cao cho một user thường l\xe0 input d\xe0i hoặc chờ slot, kh\xf4ng nhất thiết provider lỗi."],["Error theo client","T\xe1ch lỗi sai endpoint/model/API key khỏi lỗi server/provider để kh\xf4ng cảnh b\xe1o nhầm."],["Source IP/tool","Ph\xe1t hiện m\xe1y/tool gửi request nhiều hoặc cấu h\xecnh sai."],["Top request nặng","D\xf9ng Raw usage để drill-down request cụ thể khi một user k\xe9o tải hệ thống."]].map(([e,t])=>(0,n.jsxs)("div",{className:"rounded-xl border border-border bg-background p-3",children:[(0,n.jsx)("div",{className:"font-semibold text-text-main",children:e}),(0,n.jsx)("div",{className:"mt-1 text-xs text-text-muted",children:t})]},e))})]})]})}function ec({data:e}){let t=F();return(0,n.jsxs)(U,{children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Thống k\xea theo API key"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"Kh\xf4ng hiển thị full bearer token. Dashboard chỉ d\xf9ng fingerprint/masked key."})]}),(0,n.jsx)(X,{rows:e.groups?.apiKeys||[],columns:[{key:"name",label:"API key",render:e=>(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"font-semibold",children:e.name}),(0,n.jsxs)("div",{className:"text-xs text-text-muted",children:[t?e.fingerprint:"",e.ownerUser?`${t&&e.fingerprint?" \xb7 ":""}Owner: ${e.ownerUser}`:""]})]})},{key:"requests",label:"Requests",render:e=>S(e.requests)},{key:"success",label:"OK/Lỗi",render:e=>(0,n.jsxs)("div",{className:"text-xs",children:[(0,n.jsxs)("div",{className:"text-green-600",children:["OK ",S(e.success)]}),(0,n.jsxs)("div",{className:"text-red-600",children:["Lỗi ",S(e.errors)]})]})},{key:"tokens",label:"In/Out token",render:e=>(0,n.jsx)(Z,{row:e})},{key:"cost",label:"Cost",render:e=>L(e.cost)},{key:"errorRate",label:"Error %",render:e=>(0,n.jsx)(Y,{value:e.errorRate})},{key:"topModels",label:"Top model",render:e=>(0,n.jsx)(J,{items:e.topModels})},{key:"topProviders",label:"Top provider",render:e=>(0,n.jsx)(J,{items:e.topProviders})},{key:"lastSeen",label:"Last seen",render:e=>A(e.lastSeen)}]})]})}function ex({data:e}){let t=e.clientRequests?.topSourceIpsByTokens||[],s=e.clientRequests?.topSourceIpsByHeavyRequests||[],r=e=>(0,n.jsxs)("div",{className:"min-w-[180px]",children:[(0,n.jsx)("div",{className:"font-mono text-sm font-semibold text-text-main",children:e.label}),(0,n.jsxs)("div",{className:"mt-1 text-xs text-text-muted",children:["API key ",S(e.apiKeyCount)," \xb7 Tool ",S(e.sourceToolCount)]}),(0,n.jsxs)("div",{className:"text-xs text-text-muted",children:["Model ",S(e.modelCount)," \xb7 Provider ",S(e.providerCount)]})]});return(0,n.jsxs)("div",{className:"grid gap-5 xl:grid-cols-2",children:[(0,n.jsxs)(U,{children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Top IP d\xf9ng nhiều token nhất"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"Aggregate từ UsageHistory, xếp theo tổng input + output token."})]}),(0,n.jsx)(X,{rows:t,columns:[{key:"ip",label:"Source IP",render:r},{key:"requests",label:"Req",render:e=>S(e.requests)},{key:"tokens",label:"Token",render:e=>(0,n.jsx)(Z,{row:e})},{key:"lastSeen",label:"Last seen",render:e=>A(e.lastSeen)}],empty:"Kh\xf4ng c\xf3 Source IP c\xf3 token trong khoảng lọc."})]}),(0,n.jsxs)(U,{children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Top IP gửi request nặng nhất"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"Xếp theo số request input/total token từ 30k trở l\xean, sau đ\xf3 theo max/P95 input."})]}),(0,n.jsx)(X,{rows:s,columns:[{key:"ip",label:"Source IP",render:r},{key:"requests",label:"Req",render:e=>S(e.requests)},{key:"heavy",label:"Request nặng",render:e=>(0,n.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,n.jsxs)("div",{children:["Nặng ",S(e.heavyRequests)," \xb7 ",P(e.heavyRequestRate)]}),(0,n.jsxs)("div",{className:"text-text-muted",children:["P95 input ",q(e.p95PromptTokens)," \xb7 Max ",q(e.maxPromptTokens)]}),(0,n.jsxs)("div",{className:"text-text-muted",children:[">=70k ",S(e.extremeInputRequests)," \xb7 ",P(e.extremeInputRate)]})]})},{key:"tokens",label:"Token",render:e=>(0,n.jsx)(Z,{row:e})},{key:"lastSeen",label:"Last seen",render:e=>A(e.lastSeen)}],empty:"Kh\xf4ng c\xf3 Source IP gửi request nặng trong khoảng lọc."})]}),(0,n.jsxs)(U,{children:[(0,n.jsx)("h2",{className:"mb-4 text-lg font-semibold text-text-main",children:"Source IP từ Prompt Logs"}),(0,n.jsx)(X,{rows:e.promptLogs?.topClientIps||[],columns:[{key:"label",label:"IP",render:e=>(0,n.jsx)("span",{className:"font-mono text-xs",children:e.label})},{key:"requests",label:"Logs",render:e=>S(e.requests)},{key:"errors",label:"Lỗi",render:e=>S(e.errors)},{key:"errorRate",label:"Error %",render:e=>(0,n.jsx)(Y,{value:e.errorRate})},{key:"topTools",label:"Tools",render:e=>(0,n.jsx)(J,{items:e.topTools})},{key:"topModels",label:"Models",render:e=>(0,n.jsx)(J,{items:e.topModels})},{key:"lastSeen",label:"Last seen",render:e=>A(e.lastSeen)}]})]}),(0,n.jsxs)(U,{children:[(0,n.jsx)("h2",{className:"mb-4 text-lg font-semibold text-text-main",children:"Source tool"}),(0,n.jsx)(X,{rows:e.promptLogs?.topSourceTools||[],columns:[{key:"label",label:"Tool",render:e=>(0,n.jsx)("span",{className:"font-semibold",children:e.label})},{key:"requests",label:"Logs",render:e=>S(e.requests)},{key:"errors",label:"Lỗi",render:e=>S(e.errors)},{key:"errorRate",label:"Error %",render:e=>(0,n.jsx)(Y,{value:e.errorRate})},{key:"topIps",label:"Top IP",render:e=>(0,n.jsx)(J,{items:e.topIps})},{key:"topModels",label:"Top model",render:e=>(0,n.jsx)(J,{items:e.topModels})},{key:"lastSeen",label:"Last seen",render:e=>A(e.lastSeen)}]})]}),(0,n.jsxs)(U,{className:"xl:col-span-2",children:[(0,n.jsx)("h2",{className:"mb-4 text-lg font-semibold text-text-main",children:"Session nhiều hoạt động"}),(0,n.jsx)(X,{rows:e.promptLogs?.topSessions||[],columns:[{key:"label",label:"Session",render:e=>(0,n.jsx)("span",{className:"font-mono text-xs",children:e.label})},{key:"requests",label:"Logs",render:e=>S(e.requests)},{key:"errors",label:"Lỗi",render:e=>S(e.errors)},{key:"topIps",label:"IP",render:e=>(0,n.jsx)(J,{items:e.topIps})},{key:"topTools",label:"Tool",render:e=>(0,n.jsx)(J,{items:e.topTools})},{key:"topModels",label:"Model",render:e=>(0,n.jsx)(J,{items:e.topModels})},{key:"lastSeen",label:"Last seen",render:e=>A(e.lastSeen)}]})]})]})}function em({data:e}){return(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsxs)(U,{children:[(0,n.jsx)("h2",{className:"mb-4 text-lg font-semibold text-text-main",children:"Provider"}),(0,n.jsx)(X,{rows:e.groups?.providers||[],columns:[{key:"label",label:"Provider",render:e=>(0,n.jsx)("span",{className:"font-semibold",children:e.label})},{key:"requests",label:"Requests",render:e=>S(e.requests)},{key:"tokens",label:"Token",render:e=>(0,n.jsx)(Z,{row:e})},{key:"cost",label:"Cost",render:e=>L(e.cost)},{key:"errorRate",label:"Error %",render:e=>(0,n.jsx)(Y,{value:e.errorRate})},{key:"topModels",label:"Top model",render:e=>(0,n.jsx)(J,{items:e.topModels})},{key:"lastSeen",label:"Last seen",render:e=>A(e.lastSeen)}]})]}),(0,n.jsx)(g,{data:e}),(0,n.jsxs)(U,{children:[(0,n.jsx)("h2",{className:"mb-4 text-lg font-semibold text-text-main",children:"Provider account / connection"}),(0,n.jsx)(X,{rows:e.groups?.providerAccounts||[],columns:[{key:"label",label:"Account",render:e=>(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"font-semibold",children:e.label}),(0,n.jsx)("div",{className:"text-xs text-text-muted",children:e.providerLabel||e.provider||e.connectionId})]})},{key:"requests",label:"Req",render:e=>S(e.requests)},{key:"tokens",label:"Token",render:e=>(0,n.jsx)(Z,{row:e})},{key:"errorRate",label:"Lỗi",render:e=>(0,n.jsx)(Y,{value:e.errorRate})}]})]}),(0,n.jsxs)(U,{children:[(0,n.jsx)("h2",{className:"mb-4 text-lg font-semibold text-text-main",children:"Endpoint"}),(0,n.jsx)(X,{rows:e.groups?.endpoints||[],columns:[{key:"label",label:"Endpoint",render:e=>(0,n.jsx)("span",{className:"font-mono text-xs",children:e.label})},{key:"requests",label:"Requests",render:e=>S(e.requests)},{key:"tokens",label:"Token",render:e=>(0,n.jsx)(Z,{row:e})},{key:"cost",label:"Cost",render:e=>L(e.cost)},{key:"errorRate",label:"Error %",render:e=>(0,n.jsx)(Y,{value:e.errorRate})},{key:"lastSeen",label:"Last seen",render:e=>A(e.lastSeen)}]})]})]})}function eu({data:e}){let t=F(),s=e.experience||{},r=s.thresholds||{},l=e.thinkingAnalytics||{},a=e.largeContextAnalytics||{},i=s.byModel||[],o=s.slowestRequests||[];return(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[(0,n.jsx)(_,{icon:"verified",label:"Đ\xe1nh gi\xe1 tổng",value:I(s.score),hint:`${s.label||"-"} \xb7 ${S(s.samples)} mẫu success c\xf3 token`,help:"Điểm 0-100 từ request th\xe0nh c\xf4ng c\xf3 token. Tốc độ trừ tối đa 45 (chuẩn ho\xe1 theo k\xedch thước input khi prompt lớn), lỗi server trừ tối đa 40. Rate limit trừ nhẹ v\xec đ\xf3 l\xe0 hệ thống tự bảo vệ.",tone:s.tone||"slate"}),(0,n.jsx)(_,{icon:"timer",label:"Latency AVG / P95",value:`${M(s.avgLatencyMs)} / ${M(s.p95LatencyMs)}`,hint:`P50 ${M(s.p50LatencyMs)} \xb7 P99 ${M(s.p99LatencyMs)}`,help:"AVG l\xe0 trung b\xecnh; P95 thể hiện nh\xf3m 5% request chậm nhất.",tone:"purple"}),(0,n.jsx)(_,{icon:"bolt",label:"TTFT AVG / P95",value:`${M(s.avgTtftMs)} / ${M(s.p95TtftMs)}`,hint:`${S(s.ttftSamples)} mẫu TTFT \xb7 queue/prompt eval/input d\xe0i`,help:"Thời gian từ l\xfac gửi request đến token đầu ti\xean. Mẫu TTFT rộng hơn mẫu decode v\xec kh\xf4ng đ\xf2i hỏi c\xf3 output token.",tone:s.slowTtftRate>=.2?"amber":"blue"}),(0,n.jsx)(_,{icon:"keyboard_double_arrow_up",label:"Input AVG / P95",value:`${q(s.avgPromptTokens)} / ${q(s.p95PromptTokens)}`,hint:`>=30k ${P(s.longInputRate)} \xb7 >=50k ${P(s.hugeInputRate)}`,help:"Input c\xe0ng lớn th\xec prompt eval v\xe0 TTFT thường c\xe0ng cao."}),(0,n.jsx)(_,{icon:"running_with_errors",label:"Slow request",value:P(s.slowRequestRate),hint:`Latency >= ${M(r.slowLatencyMs||45e3)} \xb7 rất chậm ${P(s.verySlowRequestRate)}`,help:"Tỷ lệ request ho\xe0n tất chậm hơn ngưỡng vận h\xe0nh.",tone:s.slowRequestRate>=.2?"amber":"green"}),(0,n.jsx)(_,{icon:"pending_actions",label:"Slow TTFT",value:P(s.slowTtftRate),hint:`TTFT >= ${M(r.slowTtftMs||2e4)}`,help:"Tỷ lệ request chờ token đầu ti\xean qu\xe1 l\xe2u.",tone:s.slowTtftRate>=.2?"amber":"green"}),(0,n.jsx)(_,{icon:"speed",label:"Decode tốc độ",value:R(s.decodeTokensPerSecond," tok/s"),hint:`${S(s.decodeSamples)} mẫu decode \xb7 E2E ${R(s.e2eOutputTokensPerSecond," tok/s")}`,help:"Σ output token / Σ(latency − TTFT), chỉ t\xednh request th\xe0nh c\xf4ng c\xf3 TTFT thật v\xe0 c\xf3 output token. Tập mẫu n\xe0y nhỏ hơn tập mẫu TTFT d\xf9ng cho TTFT AVG/P95. E2E l\xe0 output/tổng latency (gồm cả prefill).",tone:"slate"}),(0,n.jsx)(_,{icon:"data_usage",label:"Latency / 10k input",value:M(s.latencyMsPer10kInputTokens),hint:"Hữu \xedch khi VS Code gửi 30k–70k token",help:"Σ latency E2E / (Σ input token / 10k). L\xe0 latency to\xe0n bộ request được chuẩn h\xf3a theo input, n\xean vẫn phụ thuộc độ d\xe0i output — kh\xf4ng phải tốc độ prefill.",tone:"slate"}),(0,n.jsx)(_,{icon:"psychology_alt",label:"Thinking auto-off",value:P(l.autoOffRate),hint:`${S(l.autoOffRequests||0)} / ${S(l.totalRequests||0)} request`,help:"Request bị tắt thinking tự động do vượt ngưỡng prompt chars.",tone:(l.autoOffRate||0)>=.3?"amber":"green"}),(0,n.jsx)(_,{icon:"toggle_off",label:"Thinking OFF",value:P(l.thinkingOffRate),hint:`ON ${P(l.thinkingOnRate)} \xb7 unknown ${P(l.unknownRate)}`,help:"Tỷ lệ request cuối c\xf9ng chạy ở chế độ kh\xf4ng thinking.",tone:(l.thinkingOffRate||0)>=.5?"blue":"slate"}),(0,n.jsx)(_,{icon:"data_object",label:"Large context",value:P(a.gte50kRate),hint:`>=30k ${P(a.gte30kRate)} \xb7 >=100k ${P(a.gte100kRate)}`,help:"Tỷ lệ request c\xf3 context lớn; thường l\xe0 nguy\xean nh\xe2n l\xe0m P95/P99 tăng.",tone:(a.gte50kRate||0)>=.3?"amber":"slate"})]}),(0,n.jsxs)("div",{className:"grid gap-5 xl:grid-cols-2",children:[(0,n.jsxs)(U,{children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Thinking Analytics"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"Theo d\xf5i request bật/tắt thinking v\xe0 tỷ lệ auto-off do vượt ngưỡng prompt chars."})]}),(0,n.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:[["Thinking ON",S(l.thinkingOnRequests||0),P(l.thinkingOnRate)],["Thinking OFF",S(l.thinkingOffRequests||0),P(l.thinkingOffRate)],["Auto-off hit",S(l.autoOffRequests||0),P(l.autoOffRate)],["C\xf3 ngưỡng auto-off",S(l.thresholdConfiguredRequests||0),`hit ${P(l.autoOffEligibleHitRate)}`]].map(([e,t,s])=>(0,n.jsxs)("div",{className:"rounded-2xl bg-background p-4",children:[(0,n.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wide text-text-muted",children:e}),(0,n.jsx)("div",{className:"mt-2 text-xl font-semibold text-text-main",children:t}),(0,n.jsx)("div",{className:"mt-1 text-xs text-text-muted",children:s})]},e))}),(0,n.jsx)("div",{className:"mt-4",children:(0,n.jsx)(X,{rows:l.byModel||[],empty:"Chưa c\xf3 dữ liệu thinking trong khoảng lọc.",columns:[{key:"model",label:"Model",render:e=>(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"font-semibold",children:e.model}),(0,n.jsx)("div",{className:"text-xs text-text-muted",children:e.provider})]})},{key:"requests",label:"Req",render:e=>S(e.requests)},{key:"autoOff",label:"Auto-off",render:e=>(0,n.jsxs)("div",{className:"text-xs",children:[(0,n.jsx)("div",{children:S(e.autoOffRequests)}),(0,n.jsx)("div",{className:"text-text-muted",children:P(e.autoOffRate)})]})},{key:"thinking",label:"ON/OFF",render:e=>(0,n.jsxs)("div",{className:"text-xs",children:[(0,n.jsxs)("div",{children:["ON ",S(e.thinkingOnRequests)]}),(0,n.jsxs)("div",{className:"text-text-muted",children:["OFF ",S(e.thinkingOffRequests)]})]})},{key:"chars",label:"Chars avg/max",render:e=>(0,n.jsxs)("div",{className:"text-xs",children:[(0,n.jsx)("div",{children:q(e.avgPromptChars)}),(0,n.jsxs)("div",{className:"text-text-muted",children:["max ",q(e.maxPromptChars)]})]})}]})})]}),(0,n.jsxs)(U,{children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Large Context Analytics"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"Bucket theo request size, ưu ti\xean prompt chars; nếu chưa c\xf3 chars th\xec fallback prompt tokens."})]}),(0,n.jsx)("div",{className:"grid gap-3 md:grid-cols-3",children:[[">=30k",a.gte30kRequests,a.gte30kRate],[">=50k",a.gte50kRequests,a.gte50kRate],[">=100k",a.gte100kRequests,a.gte100kRate]].map(([e,t,s])=>(0,n.jsxs)("div",{className:"rounded-2xl bg-background p-4",children:[(0,n.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wide text-text-muted",children:e}),(0,n.jsx)("div",{className:"mt-2 text-xl font-semibold text-text-main",children:S(t||0)}),(0,n.jsx)("div",{className:"mt-1 text-xs text-text-muted",children:P(s)})]},e))}),(0,n.jsx)("div",{className:"mt-4",children:(0,n.jsx)(X,{rows:a.buckets||[],empty:"Chưa c\xf3 large context buckets trong khoảng lọc.",columns:[{key:"label",label:"Bucket",render:e=>(0,n.jsx)("span",{className:"font-semibold",children:e.label})},{key:"requests",label:"Req",render:e=>(0,n.jsxs)("div",{className:"text-xs",children:[(0,n.jsx)("div",{children:S(e.requests)}),(0,n.jsx)("div",{className:"text-text-muted",children:P(e.share)})]})},{key:"chars",label:"Size avg/max",render:e=>(0,n.jsxs)("div",{className:"text-xs",children:[(0,n.jsx)("div",{children:q(e.avgRequestSize)}),(0,n.jsxs)("div",{className:"text-text-muted",children:["max ",q(e.maxRequestSize)]})]})},{key:"latency",label:"Latency/TTFT",render:e=>(0,n.jsxs)("div",{className:"text-xs",children:[(0,n.jsx)("div",{children:M(e.avgLatencyMs)}),(0,n.jsxs)("div",{className:"text-text-muted",children:["TTFT ",M(e.avgTtftMs)]})]})},{key:"autoOff",label:"Auto-off",render:e=>(0,n.jsxs)("div",{className:"text-xs",children:[(0,n.jsx)("div",{children:S(e.autoOffRequests)}),(0,n.jsx)("div",{className:"text-text-muted",children:P(e.autoOffRate)})]})}]})})]})]}),(0,n.jsxs)(U,{children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"C\xe1ch đọc trải nghiệm user"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"Nh\xf3m n\xe0y chỉ t\xednh request th\xe0nh c\xf4ng c\xf3 token v\xe0 latency > 0. Error/pending/success 0-token kh\xf4ng trộn v\xe0o tốc độ model. TTFT l\xe0 thời gian tới token đầu ti\xean; với VS Code input 30k–70k, TTFT cao thường phản \xe1nh chờ slot hoặc prompt eval d\xe0i."})]}),(0,n.jsxs)("div",{className:"grid gap-3 md:grid-cols-3",children:[(0,n.jsxs)("div",{className:"rounded-2xl bg-background p-4",children:[(0,n.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wide text-text-muted",children:"Nhanh/chậm thực tế"}),(0,n.jsx)("div",{className:"mt-2 text-sm text-text-main",children:"Latency AVG/P50/P95/MAX cho biết user phải chờ bao l\xe2u để request ho\xe0n tất."})]}),(0,n.jsxs)("div",{className:"rounded-2xl bg-background p-4",children:[(0,n.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wide text-text-muted",children:"Queue hoặc prompt eval"}),(0,n.jsx)("div",{className:"mt-2 text-sm text-text-main",children:"TTFT cao + input P95 cao l\xe0 t\xedn hiệu request d\xe0i, hết slot hoặc upstream đang queue."})]}),(0,n.jsxs)("div",{className:"rounded-2xl bg-background p-4",children:[(0,n.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wide text-text-muted",children:"VS Code / agent"}),(0,n.jsx)("div",{className:"mt-2 text-sm text-text-main",children:"Theo d\xf5i tỷ lệ input >=30k/50k/70k để biết P95/P99 cao c\xf3 phải do context cực d\xe0i hay kh\xf4ng."})]})]})]}),(0,n.jsxs)(U,{children:[(0,n.jsx)("h2",{className:"mb-4 text-lg font-semibold text-text-main",children:"Chất lượng phản hồi theo provider/model"}),(0,n.jsx)(X,{rows:i,empty:"Chưa c\xf3 mẫu latency cho model trong khoảng lọc.",columns:[{key:"model",label:"Model",render:e=>(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"font-semibold",children:e.model}),(0,n.jsx)("div",{className:"text-xs text-text-muted",children:e.providerLabel||e.provider})]})},{key:"quality",label:"Đ\xe1nh gi\xe1",render:e=>(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)(ee,{level:e.level,label:e.labelQuality}),(0,n.jsx)("div",{className:"text-xs text-text-muted",children:I(e.score)})]})},{key:"samples",label:"Mẫu",render:e=>S(e.samples)},{key:"latency",label:"Latency P50/P95/MAX",render:e=>(0,n.jsxs)("div",{className:"text-xs",children:[(0,n.jsxs)("div",{children:[M(e.p50LatencyMs)," / ",M(e.p95LatencyMs)]}),(0,n.jsxs)("div",{className:"text-text-muted",children:["max ",M(e.maxLatencyMs)]})]})},{key:"ttft",label:"TTFT P95",render:e=>M(e.p95TtftMs)},{key:"input",label:"Input avg/P95",render:e=>(0,n.jsxs)("div",{className:"text-xs",children:[(0,n.jsxs)("div",{children:[q(e.avgPromptTokens)," / ",q(e.p95PromptTokens)]}),(0,n.jsxs)("div",{className:"text-text-muted",children:[">=30k ",P(e.longInputRate)]})]})},{key:"slow",label:"Chậm",render:e=>(0,n.jsx)(Y,{value:e.slowRequestRate})},{key:"speed",label:"Decode tok/s",render:e=>R(e.decodeTokensPerSecond??e.outputTokensPerSecond," tok/s")}]})]}),(0,n.jsxs)(U,{children:[(0,n.jsx)("h2",{className:"mb-4 text-lg font-semibold text-text-main",children:"Request chậm nhất"}),(0,n.jsx)(X,{rows:o,empty:"Kh\xf4ng c\xf3 request chậm trong khoảng lọc.",columns:[{key:"timestamp",label:"Time",render:e=>A(e.timestamp)},{key:"model",label:"Model",render:e=>(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"font-semibold",children:e.model}),(0,n.jsx)("div",{className:"text-xs text-text-muted",children:e.providerLabel||e.provider})]})},{key:"latency",label:"Latency / TTFT",render:e=>(0,n.jsxs)("div",{className:"text-xs",children:[(0,n.jsx)("div",{className:"font-semibold",children:M(e.latencyMs)}),(0,n.jsxs)("div",{className:"text-text-muted",children:["TTFT ",M(e.ttftMs)]})]})},{key:"tokens",label:"In / Out",render:e=>(0,n.jsx)(Z,{row:e})},{key:"apiKeyName",label:"API key",render:e=>(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{children:e.apiKeyName}),t?(0,n.jsx)("div",{className:"font-mono text-xs text-text-muted",children:e.apiKeyFingerprint}):null]})},{key:"sourceTool",label:"Tool/IP",render:e=>(0,n.jsxs)("div",{className:"text-xs",children:[(0,n.jsx)("div",{children:e.sourceTool||"-"}),(0,n.jsx)("div",{className:"font-mono text-text-muted",children:e.clientIp||"-"})]})},{key:"endpoint",label:"Endpoint",render:e=>(0,n.jsx)("span",{className:"font-mono text-xs",children:e.endpoint||"-"})}]})]})]})}function eh({data:e}){let t=F(),s=e.requestErrors||{},r=s.summary||{},l=e.overview||{},a=Number(l.serverErrorRate||0),i=Number(l.clientErrorRate||0),o=Number(l.rateLimitErrorRate||0),d=[{key:"faultOwner",label:"Loại",render:e=>(0,n.jsx)(es,{value:e.faultOwner})},{key:"status",label:"Status",render:e=>(0,n.jsx)("span",{className:"rounded-full bg-red-500/10 px-2 py-1 text-xs font-semibold text-red-600 dark:text-red-300",children:e.status})},{key:"provider",label:"Provider",render:e=>e.providerLabel||e.provider},{key:"model",label:"Model"},{key:"endpoint",label:"Endpoint",render:e=>(0,n.jsx)("span",{className:"font-mono text-xs",children:e.endpoint})},{key:"requests",label:"Lỗi",render:e=>S(e.errors||e.requests)},{key:"errorType",label:"Type",render:e=>(0,n.jsx)("span",{className:"font-mono text-xs",children:e.errorType||e.errorCode||"-"})},{key:"sampleMessage",label:"Sample",render:e=>(0,n.jsx)(en,{row:e})},{key:"lastSeen",label:"Last seen",render:e=>A(e.lastSeen)}];return(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-5",children:[(0,n.jsx)(er,{icon:"dns",label:"Server/provider",value:r.serverImpacting||0,hint:`${P(a)} tr\xean tổng request`,tone:r.serverImpacting?"red":"green"}),(0,n.jsx)(er,{icon:"cloud_off",label:"Upstream",value:r.upstream||0,hint:"Provider/model server, timeout, network, 5xx",tone:r.upstream?"red":"green"}),(0,n.jsx)(er,{icon:"router",label:"Gateway",value:r.gateway||0,hint:"Lỗi nội bộ BlueRouter/gateway",tone:r.gateway?"purple":"green"}),(0,n.jsx)(er,{icon:"integration_instructions",label:"Client/request",value:r.client||0,hint:`${P(i)} do endpoint/model/body/auth`,tone:r.client?"slate":"green"}),(0,n.jsx)(er,{icon:"speed",label:"Rate/quota",value:r.rateLimit||0,hint:`${P(o)} rate-limit/quota`,tone:r.rateLimit?"amber":"green"})]}),(0,n.jsx)("div",{className:"rounded-2xl border border-blue-500/20 bg-blue-500/10 p-4 text-sm text-blue-700 dark:text-blue-300",children:(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[22px]",children:"rule_settings"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"font-semibold",children:"Ph\xe2n loại lỗi đ\xe3 t\xe1ch client khỏi server/provider"}),(0,n.jsxs)("div",{className:"mt-1 opacity-90",children:["Cảnh b\xe1o vận h\xe0nh n\xean ưu ti\xean nh\xf3m ",(0,n.jsx)("b",{children:"Server/provider"})," gồm gateway, upstream, timeout, network v\xe0 5xx. Nh\xf3m ",(0,n.jsx)("b",{children:"Client/request"})," vẫn được log đầy đủ nhưng thường l\xe0 sai endpoint, model, auth, JSON/body hoặc context."]})]})]})}),e.anomalies?.length?(0,n.jsx)("div",{className:"grid gap-4 xl:grid-cols-2",children:e.anomalies.map((e,t)=>(0,n.jsx)(el,{anomaly:e},t))}):(0,n.jsxs)("div",{className:"rounded-2xl border border-green-500/20 bg-green-500/10 p-4 text-sm text-green-700 dark:text-green-300",children:[(0,n.jsx)("span",{className:"material-symbols-outlined mr-2 align-[-5px]",children:"check_circle"}),"Chưa ph\xe1t hiện bất thường server/provider r\xf5 r\xe0ng theo bộ lọc hiện tại."]}),(0,n.jsxs)(U,{children:[(0,n.jsxs)("div",{className:"mb-4 flex flex-wrap items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Lỗi server/provider cần xử l\xfd"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"Chỉ gồm gateway/upstream/server-impacting errors. Đ\xe2y l\xe0 bảng quan trọng nhất cho vận h\xe0nh."})]}),(0,n.jsxs)("span",{className:"rounded-full bg-red-500/10 px-3 py-1 text-xs font-semibold text-red-600 dark:text-red-300",children:[S(r.serverImpacting||0)," lỗi"]})]}),(0,n.jsx)(X,{rows:s.topServerErrors||[],columns:d,empty:"Kh\xf4ng c\xf3 lỗi server/provider trong khoảng lọc."})]}),(0,n.jsxs)("div",{className:"grid gap-5 xl:grid-cols-2",children:[(0,n.jsxs)(U,{children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Lỗi client/request sai"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"Sai endpoint, model, auth, JSON/body, context length. D\xf9ng để hướng dẫn client sửa request."})]}),(0,n.jsx)(X,{rows:s.topClientErrors||[],columns:d.filter(e=>!["sampleMessage"].includes(e.key)),empty:"Kh\xf4ng c\xf3 lỗi client/request trong khoảng lọc."})]}),(0,n.jsxs)(U,{children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Ph\xe2n bố loại lỗi"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"T\xe1ch nguồn chịu tr\xe1ch nhiệm để kh\xf4ng nhầm lỗi client th\xe0nh lỗi server."})]}),(0,n.jsx)(X,{rows:s.byFaultOwner||[],columns:[{key:"faultOwner",label:"Loại",render:e=>(0,n.jsx)(es,{value:e.faultOwner||e.key})},{key:"requests",label:"Số lỗi",render:e=>S(e.requests)},{key:"lastSeen",label:"Last seen",render:e=>A(e.lastSeen)}],empty:"Kh\xf4ng c\xf3 lỗi để ph\xe2n loại."})]})]}),s.topRateLimitErrors?.length?(0,n.jsxs)(U,{children:[(0,n.jsx)("h2",{className:"mb-4 text-lg font-semibold text-text-main",children:"Rate limit / quota"}),(0,n.jsx)(X,{rows:s.topRateLimitErrors||[],columns:d})]}):null,(0,n.jsxs)(U,{children:[(0,n.jsx)("h2",{className:"mb-4 text-lg font-semibold text-text-main",children:"Tất cả lỗi raw theo status/provider/model/endpoint"}),(0,n.jsx)(X,{rows:[...e.groups?.errors||[]].sort((e,t)=>new Date(C(t.lastSeen)||0)-new Date(C(e.lastSeen)||0)||Number(t.errors||t.requests||0)-Number(e.errors||e.requests||0)),columns:[{key:"faultOwner",label:"Loại",render:e=>(0,n.jsx)(es,{value:e.faultOwner})},{key:"status",label:"Status",render:e=>(0,n.jsx)("span",{className:"rounded-full bg-red-500/10 px-2 py-1 text-xs font-semibold text-red-600 dark:text-red-300",children:e.status})},{key:"provider",label:"Provider",render:e=>e.providerLabel||e.provider},{key:"model",label:"Model"},{key:"endpoint",label:"Endpoint",render:e=>(0,n.jsx)("span",{className:"font-mono text-xs",children:e.endpoint})},{key:"requests",label:"Lỗi",render:e=>S(e.errors||e.requests)},{key:"apiKey",label:"API key",render:e=>(0,n.jsx)("span",{className:"font-mono text-xs",children:t?e.apiKey:e.apiKeyName||"•••"})},{key:"lastSeen",label:"Last seen",render:e=>A(e.lastSeen)}]})]}),(0,n.jsxs)(U,{children:[(0,n.jsx)("h2",{className:"mb-4 text-lg font-semibold text-text-main",children:"Status distribution"}),(0,n.jsx)(X,{rows:e.groups?.statuses||[],columns:[{key:"label",label:"Status"},{key:"requests",label:"Requests",render:e=>S(e.requests)},{key:"tokens",label:"Token",render:e=>(0,n.jsx)(Z,{row:e})},{key:"errorRate",label:"Error %",render:e=>(0,n.jsx)(Y,{value:e.errorRate})}]})]})]})}function ep({data:e}){let t=F();return(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsxs)(U,{children:[(0,n.jsx)("h2",{className:"mb-4 text-lg font-semibold text-text-main",children:"Top request nặng token"}),(0,n.jsx)(X,{rows:e.heavyRequests||[],columns:[{key:"timestamp",label:"Time",render:e=>A(e.timestamp)},{key:"model",label:"Model",render:e=>(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"font-semibold",children:e.model}),(0,n.jsx)("div",{className:"text-xs text-text-muted",children:e.providerLabel||e.provider})]})},{key:"apiKeyName",label:"API key",render:e=>(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{children:e.apiKeyName}),t?(0,n.jsx)("div",{className:"font-mono text-xs text-text-muted",children:e.apiKeyFingerprint}):null]})},{key:"accountName",label:"Account"},{key:"endpoint",label:"Endpoint",render:e=>(0,n.jsx)("span",{className:"font-mono text-xs",children:e.endpoint})},{key:"tokens",label:"Token",render:e=>(0,n.jsx)(Z,{row:e})},{key:"status",label:"Status"}]})]}),(0,n.jsxs)(U,{children:[(0,n.jsx)("h2",{className:"mb-4 text-lg font-semibold text-text-main",children:"Recent usage"}),(0,n.jsx)(X,{rows:e.recentUsage||[],columns:[{key:"timestamp",label:"Time",render:e=>A(e.timestamp)},{key:"provider",label:"Provider",render:e=>e.providerLabel||e.provider},{key:"model",label:"Model"},{key:"apiKeyName",label:"API key"},{key:"tokens",label:"Token",render:e=>(0,n.jsx)(Z,{row:e})},{key:"cost",label:"Cost",render:e=>L(e.cost)},{key:"status",label:"Status"}]})]})]})}function eb(){let{isAdmin:e,isMonitorAdmin:t,isAiGatewaysMonitor:s}=(0,a.s)(),l=e||t||s,i=(0,r.useMemo)(()=>e?j:j.filter(e=>"aiHealth"!==e.value),[e]),[o,d]=(0,r.useState)({period:"today",provider:"",model:"",status:"",clientIp:"",sourceTool:"",sessionId:"",keyword:""}),[c,x]=(0,r.useState)(null),[m,u]=(0,r.useState)(!0),[h,p]=(0,r.useState)(""),[b,g]=(0,r.useState)("overview"),[y,k]=(0,r.useState)(null),f=function(e,t=450){let[s,n]=(0,r.useState)(e);return(0,r.useEffect)(()=>{let s=setTimeout(()=>n(e),t);return()=>clearTimeout(s)},[e,t]),s}(o,450),N=(0,r.useRef)(0),T=(0,r.useCallback)(async({clear:e=!1,filtersOverride:t=null}={})=>{let s=N.current+1;N.current=s,e&&x(null),u(!0),p("");let n=Date.now();try{let e=t||f,r=E(e,{timeZone:K()}),l=await fetch(`/api/dashboard/analytics?${r}`,{cache:"no-store"}),a=await l.json().catch(()=>({}));if(s!==N.current)return;if(!l.ok)throw Error(a.error||"Kh\xf4ng tải được dữ liệu analytics");x(a),k({loadedMs:Date.now()-n,cacheState:a.cacheState||"",cacheAgeMs:a.cacheAgeMs||0})}catch(e){if(s!==N.current)return;p(e.message||"Kh\xf4ng tải được dữ liệu analytics")}finally{s===N.current&&u(!1)}},[f]);(0,r.useEffect)(()=>{T({clear:!0})},[T]),(0,r.useEffect)(()=>{let e=localStorage.getItem(v);e&&i.some(t=>t.value===e)&&g(e)},[i]),(0,r.useEffect)(()=>{i.some(e=>e.value===b)||g("overview")},[i,b]),(0,r.useEffect)(()=>{localStorage.setItem(v,b)},[b]);let S=c?.options||{},q=(0,r.useMemo)(()=>c?.generatedAt?A(c.generatedAt):"-",[c]);return(0,n.jsxs)("div",{className:"space-y-5 p-4 md:p-6",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-primary",children:[(0,n.jsx)("span",{className:"material-symbols-outlined",children:"monitoring"}),(0,n.jsx)("span",{className:"text-sm font-semibold uppercase tracking-wide",children:"BlueRouter Analytics"})]}),(0,n.jsx)("h1",{className:"mt-2 text-2xl font-bold text-text-main",children:"Thống k\xea sử dụng Gateway"}),(0,n.jsx)("p",{className:"mt-1 max-w-3xl text-sm text-text-muted",children:"Theo d\xf5i tần suất request, input/output token, API key, provider, model, endpoint, Source IP, source tool v\xe0 lỗi vận h\xe0nh."})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3 rounded-2xl border border-border bg-surface px-4 py-3 text-sm text-text-muted",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"schedule"}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{children:["Generated: ",q]}),y?(0,n.jsxs)("div",{className:"mt-0.5 text-xs",children:["Loaded in ",y.loadedMs>=1e3?`${(y.loadedMs/1e3).toLocaleString("vi-VN",{maximumFractionDigits:1})}s`:`${y.loadedMs}ms`,"hit"===y.cacheState?(0,n.jsxs)("span",{className:"ml-1.5 rounded bg-emerald-500/10 px-1.5 py-0.5 font-medium text-emerald-500",children:["cache hit",y.cacheAgeMs?` \xb7 ${Math.round(y.cacheAgeMs/1e3)}s`:""]}):"joined"===y.cacheState?(0,n.jsx)("span",{className:"ml-1.5 rounded bg-sky-500/10 px-1.5 py-0.5 font-medium text-sky-500",children:"shared compute"}):"fresh"===y.cacheState?(0,n.jsx)("span",{className:"ml-1.5 rounded bg-amber-500/10 px-1.5 py-0.5 font-medium text-amber-500",children:"fresh compute"}):null]}):null]})]})]}),(0,n.jsx)(ei,{filters:o,setFilters:d,options:S,onRefresh:e=>T({filtersOverride:e||o}),onExportCsv:()=>{let e=E(o,{format:"csv",timeZone:K()});window.open(`/api/dashboard/analytics?${e}`,"_blank","noopener,noreferrer")},loading:m,showProviderFilters:l}),h?(0,n.jsxs)("div",{className:"rounded-2xl border border-red-500/30 bg-red-500/10 p-4 text-sm text-red-700 dark:text-red-300",children:[(0,n.jsx)("span",{className:"material-symbols-outlined mr-2 align-[-5px]",children:"error"}),h]}):null,c?.qualityNotes?.length?(0,n.jsx)(ea,{notes:c.qualityNotes}):null,(0,n.jsx)("div",{className:"flex flex-wrap gap-2 rounded-2xl border border-border bg-surface p-2",children:i.map(e=>(0,n.jsxs)("button",{onClick:()=>g(e.value),className:O("flex items-center gap-2 rounded-xl px-3 py-2 text-sm font-medium transition",b===e.value?"bg-primary text-white shadow-sm":"text-text-muted hover:bg-background hover:text-text-main"),children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:e.icon}),e.label]},e.value))}),m&&!c?(0,n.jsx)(B,{}):null,!m&&c&&c.overview?.requests===0&&0===(c.promptLogs?.total||0)?(0,n.jsx)(G,{title:"Chưa c\xf3 dữ liệu analytics",description:"Kh\xf4ng c\xf3 UsageHistory hoặc Prompt Logs theo bộ lọc hiện tại."}):null,c?(0,n.jsxs)(n.Fragment,{children:["overview"===b?(0,n.jsx)(eo,{data:c}):null,"apiKeys"===b?(0,n.jsx)(ec,{data:c}):null,"clients"===b?(0,n.jsx)(ed,{data:c}):null,"sources"===b?(0,n.jsx)(ex,{data:c}):null,"providers"===b?(0,n.jsx)(em,{data:c}):null,"experience"===b?(0,n.jsx)(eu,{data:c}):null,"errors"===b?(0,n.jsx)(eh,{data:c}):null,"raw"===b?(0,n.jsx)(ep,{data:c}):null]}):null,"aiHealth"===b&&e?(0,n.jsx)(w,{}):null]})}},85881:(e,t,s)=>{"use strict";s.d(t,{default:()=>a});var n=s(12115);let r="blueRouterAnalyticsTab";function l(e){return Array.from(document.querySelectorAll("button")).find(t=>Array.from(t.childNodes).filter(e=>3===e.nodeType).map(e=>e.textContent?.trim()||"").filter(Boolean).join(" ")===e)||null}function a(){return(0,n.useLayoutEffect)(()=>{let e=!1,t=()=>{e||(e=!0,requestAnimationFrame(()=>{let t,s;e=!1,t=document.getElementById("analytics-vllm-config"),(s=t?.closest(".space-y-2"))&&(s.style.display="none",s.setAttribute("aria-hidden","true")),function(){try{"raw"===localStorage.getItem(r)&&localStorage.setItem(r,"overview")}catch{}let e=l("Raw usage");if(e){if(e.classList.contains("bg-primary")){let e=l("Tổng quan");e?.click()}e.remove()}}()}))};t();let s=new MutationObserver(t);return s.observe(document.body,{childList:!0,subtree:!0}),()=>s.disconnect()},[]),null}},94027:(e,t,s)=>{"use strict";s.d(t,{Y:()=>o,s:()=>d});var n=s(95155),r=s(12115),l=s(14051),a=s.n(l);let i=(0,r.createContext)(null);function o({children:e}){let[t,s]=(0,r.useState)(null),[l,a]=(0,r.useState)(!0),[d,c]=(0,r.useState)(""),x=(0,r.useCallback)(async()=>{a(!0),c("");try{let e=await fetch("/api/auth/status",{cache:"no-store"}),t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t?.error||"Kh\xf4ng tải được trạng th\xe1i đăng nhập");return s(t||{}),t||{}}catch(e){return c(e?.message||"Kh\xf4ng tải được trạng th\xe1i đăng nhập"),s({}),{}}finally{a(!1)}},[]);(0,r.useEffect)(()=>{let e=!1;return(async()=>{a(!0),c("");try{let t=await fetch("/api/auth/status",{cache:"no-store"}),n=await t.json().catch(()=>({}));if(e)return;if(!t.ok)throw Error(n?.error||"Kh\xf4ng tải được trạng th\xe1i đăng nhập");s(n||{})}catch(t){e||(c(t?.message||"Kh\xf4ng tải được trạng th\xe1i đăng nhập"),s({}))}finally{e||a(!1)}})(),()=>{e=!0}},[]);let m=(0,r.useMemo)(()=>{let e,s,n,r,l,a,i;return s=(e=t&&"object"==typeof t?t:{}).displayName||e.oidcName||e.oidcEmail||e.userId||"",r=(n=!0===e.actualIsAdmin||!0===e.isAdmin&&!0!==e.showAsUser)&&!0===e.showAsUser,l=!0===e.isAdmin&&!r,a=!0===e.isMonitorAdmin,i=!0===e.isAiGatewaysMonitor,{status:e,displayName:s,userId:e.userId||"",loginMethod:e.loginMethod||"",role:e.role||"guest",actualRole:e.actualRole||e.role||"guest",isAdmin:l,actualIsAdmin:n,showAsUser:r,canToggleUserMode:!0===e.canToggleUserMode||n,isMonitorAdmin:a,isAiGatewaysMonitor:i,canManageApiKeys:!0===e.canManageApiKeys||l||a,canUseMonitorAdminTabs:!0===e.canUseMonitorAdminTabs||l||a,canViewAllAnalytics:!0===e.canViewAllAnalytics||l||a||i,canUseAuditProxy:!0===e.canUseAuditProxy||l}},[t]),u=(0,r.useMemo)(()=>({...m,loading:l,error:d,reload:x}),[m,l,d,x]);return(0,n.jsx)(i.Provider,{value:u,children:e})}function d(){let e=(0,r.useContext)(i);return e||{status:{},displayName:"",userId:"",loginMethod:"",role:"admin",actualRole:"admin",isAdmin:!0,actualIsAdmin:!0,showAsUser:!1,canToggleUserMode:!0,isMonitorAdmin:!1,isAiGatewaysMonitor:!1,canManageApiKeys:!0,canUseMonitorAdminTabs:!0,canViewAllAnalytics:!0,loading:!1,error:"",reload:async()=>({})}}o.propTypes={children:a().node}}},e=>{e.O(0,[9959,8441,3794,7358],()=>e(e.s=53836)),_N_E=e.O()}]);
|
package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-e6712886cd01ffe3.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3649],{20061:(e,t,n)=>{Promise.resolve().then(n.bind(n,47295))},47295:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>Y});var a=n(95155),r=n(12115),s=n(44923),l=n(87256),i=n(39768),o=n(5020),d=n(35497),c=n(11059),m=n(28777),u=n(52679);let x=/^[a-zA-Z0-9_.\-]+$/,p=[{value:"global",label:"To\xe0n cục / h\xe0nh vi hiện tại",description:"Giữ h\xe0nh vi hiện tại: mọi request d\xf9ng chung v\xf2ng xoay combo to\xe0n cục."},{value:"client_ip",label:"IP client",description:"Giữ c\xf9ng model khởi đầu cho c\xf9ng IP client cho đến khi hết TTL."},{value:"client_session",label:"IP client + phi\xean chat",description:"Ph\xf9 hợp nhất cho c\xf4ng cụ chat. Giữ c\xf9ng model cho c\xf9ng m\xe1y v\xe0 c\xf9ng phi\xean chat."}],h=[{value:"fallback",label:"Ưu ti\xean fallback",description:"Thử model trong combo theo đ\xfang thứ tự hiển thị, lỗi th\xec fallback."},{value:"round-robin",label:"Round Robin",description:"Lu\xe2n phi\xean model đang bật được thử đầu ti\xean. C\xe1c t\xf9y chọn giữ d\xednh b\xean dưới vẫn được \xe1p dụng."},{value:"least-latency",label:"Độ trễ thấp nhất",description:"Ưu ti\xean target c\xf3 điểm health/độ trễ tốt nhất. Hữu \xedch cho LAN Ollama."},{value:"p2c",label:"P2C",description:"Power of Two Choices: lấy mẫu hai target khỏe rồi chọn target \xedt bận hơn."}],b=[{card:"border-sky-100 bg-sky-50/55 dark:border-sky-400/15 dark:bg-sky-950/10",panel:"border-sky-100/80 bg-white/80 dark:border-sky-400/15 dark:bg-zinc-950/60"},{card:"border-slate-200 bg-slate-50/80 dark:border-slate-500/15 dark:bg-slate-900/35",panel:"border-slate-200/80 bg-white/80 dark:border-slate-500/15 dark:bg-zinc-950/60"},{card:"border-emerald-100 bg-emerald-50/45 dark:border-emerald-400/15 dark:bg-emerald-950/10",panel:"border-emerald-100/80 bg-white/80 dark:border-emerald-400/15 dark:bg-zinc-950/60"},{card:"border-violet-100 bg-violet-50/45 dark:border-violet-400/15 dark:bg-violet-950/10",panel:"border-violet-100/80 bg-white/80 dark:border-violet-400/15 dark:bg-zinc-950/60"}],g=Object.freeze({temperature:.3,top_p:.95,presence_penalty:0,max_tokens:4096,reasoning_budget:0,thinkingMode:"off",forceThinkingOffAboveChars:5e4}),f=Object.freeze({temperature:.6,top_p:.95,presence_penalty:0,max_tokens:4096}),y=Object.freeze({temperature:.7,top_p:.8,presence_penalty:0,max_tokens:4096}),v=Object.freeze({think:"inheritThinkRequestOverrides",nothink:"inheritNoThinkRequestOverrides"}),k=[{key:"temperature",label:"temp",min:0,max:2,step:.05},{key:"top_p",label:"top_p",min:.01,max:1,step:.01},{key:"presence_penalty",label:"presence_penalty",min:-2,max:2,step:.05},{key:"max_tokens",label:"max_tokens",min:1,max:262144,step:1}],j=Object.freeze({temperature:.2,top_p:.95,presence_penalty:0,max_tokens:4096}),N=[{value:"inherit",label:"Theo request gốc",description:"Giữ nguy\xean request gốc, kh\xf4ng inject thinking."},{value:"off",label:"Tắt thinking",description:"Gửi chat_template_kwargs.enable_thinking = false."},{value:"on",label:"Bật thinking",description:"Gửi chat_template_kwargs.enable_thinking = true."}],_=[{value:"inherit",label:"Theo cấu h\xecnh hệ thống",description:"Sử dụng ch\xednh s\xe1ch lưu Prompt Logs chung của hệ thống."},{value:"enabled",label:"Lưu đầy đủ nội dung",description:"Cho ph\xe9p quản trị vi\xean xem lại to\xe0n bộ prompt v\xe0 phản hồi của c\xe1c request thuộc combo n\xe0y."},{value:"disabled",label:"Chỉ lưu thống k\xea",description:"Kh\xf4ng lưu nội dung hội thoại. Chỉ lưu metadata, model, provider, token, thời gian xử l\xfd v\xe0 c\xe1c thống k\xea vận h\xe0nh."}];function C(e){return e&&"object"==typeof e&&!Array.isArray(e)}function w(e,t){return Object.prototype.hasOwnProperty.call(e||{},t)}function O(e,{min:t,max:n,precision:a=3}={}){if(null==e||""===e)return;let r=Number(e);if(Number.isFinite(r))return Number(Math.min(n,Math.max(t,r)).toFixed(a))}function T(e,{min:t,max:n}={}){let a=O(e,{min:t,max:n,precision:0});return void 0===a?void 0:Math.trunc(a)}function S(e){let t=R(e).toLowerCase();return"enabled"===t||"disabled"===t?t:"inherit"}function $(e={}){let t=C(e)?e:{},n={};if(w(t,"temperature")){let e=O(t.temperature,{min:0,max:2});void 0!==e&&(n.temperature=e)}if(w(t,"top_p")||w(t,"topP")){let e=O(t.top_p??t.topP,{min:.01,max:1});void 0!==e&&(n.top_p=e)}let a=t.presence_penalty??t.presencePenalty??t["presence-penalty"];if(w(t,"presence_penalty")||w(t,"presencePenalty")||w(t,"presence-penalty")){let e=O(a,{min:-2,max:2});void 0!==e&&(n.presence_penalty=e)}let r=t.max_tokens??t.maxTokens??t.max_token;if(w(t,"max_tokens")||w(t,"maxTokens")||w(t,"max_token")){let e=T(r,{min:1,max:262144});void 0!==e&&(n.max_tokens=e)}return n}function q(e={}){let t=C(e)?e:{},n={};if(w(t,"temperature")){let e=O(t.temperature,{min:0,max:2});void 0!==e&&(n.temperature=e)}if(w(t,"top_p")){let e=O(t.top_p,{min:.01,max:1});void 0!==e&&(n.top_p=e)}let a=t.presence_penalty??t.presencePenalty??t["presence-penalty"];if(w(t,"presence_penalty")||w(t,"presencePenalty")||w(t,"presence-penalty")){let e=O(a,{min:-2,max:2});void 0!==e&&(n.presence_penalty=e)}let r=t.max_tokens??t.maxTokens??t.max_token;if(w(t,"max_tokens")||w(t,"maxTokens")||w(t,"max_token")){let e=T(r,{min:1,max:262144});void 0!==e&&(n.max_tokens=e)}let s=t.reasoning_budget??t.reasoningBudget??t["reasoning-budget"];if(w(t,"reasoning_budget")||w(t,"reasoningBudget")||w(t,"reasoning-budget")){let e=T(s,{min:0,max:262144});void 0!==e&&(n.reasoning_budget=e)}let l=t.forceThinkingOffAboveChars??t.forceThinkingOffChars??t.force_thinking_off_above_chars;if(w(t,"forceThinkingOffAboveChars")||w(t,"forceThinkingOffChars")||w(t,"force_thinking_off_above_chars")){let e=T(l,{min:0,max:1e6});void 0!==e&&(n.forceThinkingOffAboveChars=e)}let i=t.forceThinkingOffRequestOverrides??t.forceThinkingOffOverrides??t.autoOffRequestOverrides;if(w(t,"forceThinkingOffRequestOverrides")||w(t,"forceThinkingOffOverrides")||w(t,"autoOffRequestOverrides")){let e=$(i);Object.keys(e).length>0&&(n.forceThinkingOffRequestOverrides=e)}let o=t.inheritThinkRequestOverrides??t.thinkRequestOverrides??t.thinkingOnRequestOverrides;if(w(t,"inheritThinkRequestOverrides")||w(t,"thinkRequestOverrides")||w(t,"thinkingOnRequestOverrides")){let e=$(o);Object.keys(e).length>0&&(n.inheritThinkRequestOverrides=e)}let d=t.inheritNoThinkRequestOverrides??t.noThinkRequestOverrides??t.thinkingOffRequestOverrides;if(w(t,"inheritNoThinkRequestOverrides")||w(t,"noThinkRequestOverrides")||w(t,"thinkingOffRequestOverrides")){let e=$(d);Object.keys(e).length>0&&(n.inheritNoThinkRequestOverrides=e)}let c=function(e){if(!0===e)return"on";if(!1===e)return"off";let t=R(e).toLowerCase();return["on","true","1","enable","enabled"].includes(t)?"on":["off","false","0","disable","disabled"].includes(t)?"off":void 0}(t.thinkingMode??t.thinking);return c&&(n.thinkingMode=c),"off"===n.thinkingMode&&delete n.reasoning_budget,n}function M(e={}){let t=$(e||{}),n=[];return void 0!==t.temperature&&n.push(`temp ${t.temperature}`),void 0!==t.top_p&&n.push(`top_p ${t.top_p}`),void 0!==t.presence_penalty&&n.push(`presence ${t.presence_penalty}`),void 0!==t.max_tokens&&n.push(`max ${t.max_tokens}`),n}function R(e){return String(e||"").trim()}function L(e={}){return Array.isArray(e.disabledModels)?[...new Set(e.disabledModels.map(e=>R(e)).filter(Boolean))]:[]}function E(e={}){let t=e.fallbackStrategy||"fallback";return{...e,fallbackStrategy:t,stickyScope:e.stickyScope||"global",stickyTtlMinutes:Number(e.stickyTtlMinutes||120),stickyFallbackToClientIp:!1!==e.stickyFallbackToClientIp,lanHealthEnabled:!1!==e.lanHealthEnabled,healthCheckPath:e.healthCheckPath||"/api/tags",healthCheckIntervalMs:Number(e.healthCheckIntervalMs||15e3),requiredTags:Array.isArray(e.requiredTags)?e.requiredTags:[],modelTagRules:e.modelTagRules||e.modelTags||e.tagRules||{},disabledModels:L(e),requestOverrides:q(e.requestOverrides||{}),contentLoggingMode:S(e.contentLoggingMode)}}function A(e={}){let t={...e};t.disabledModels=L(e),"fallback"===(t.fallbackStrategy||"fallback")&&delete t.fallbackStrategy,t.disabledModels.length||delete t.disabledModels;let n=S(t.contentLoggingMode);"inherit"===n?delete t.contentLoggingMode:t.contentLoggingMode=n,t.requiredTags?.length||delete t.requiredTags;let a=q(t.requestOverrides||{});return Object.keys(a).length?t.requestOverrides=a:delete t.requestOverrides,t.modelTagRules&&0!==Object.keys(t.modelTagRules).length||delete t.modelTagRules,"/api/tags"===t.healthCheckPath&&delete t.healthCheckPath,15e3===Number(t.healthCheckIntervalMs)&&delete t.healthCheckIntervalMs,!0===t.lanHealthEnabled&&delete t.lanHealthEnabled,Object.keys(t).length?t:null}function P(e){return Array.isArray(e)?`[${e.map(P).join(",")}]`:e&&"object"==typeof e?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${P(e[t])}`).join(",")}}`:JSON.stringify(void 0===e?null:e)}function I(e=[]){return Array.isArray(e)?e.join(", "):String(e||"")}function z(e=""){return String(e||"").split(/[\n,;]+/).map(e=>e.trim()).filter(Boolean)}function B(e={}){return e&&"object"==typeof e?Object.entries(e).map(([e,t])=>`${e}: ${Array.isArray(t)?t.join(", "):String(t||"")}`).join("\n"):""}function F(e){return"string"==typeof e?e:e&&"object"==typeof e&&(e.value||e.model||e.id)||""}function D(e={}){let t=R(e.provider);return R(e.providerSpecificData?.prefix)||R(e.prefix)||R((0,u.wG)(t))||t}function K(e={}){return R(e.email)||R(e.accountName)||R(e.displayName)||R(e.name)||R(e.providerSpecificData?.nodeName)||R(e.id)}function G(e){return e&&"object"==typeof e?R(e.connectionId||e.connection_id):""}function H(e){let t=F(e),n=G(e);return t?n?`${t}@@${n}`:t:""}function J(e){return"string"==typeof e?e:e&&"object"==typeof e?R(e.label)||R(e.displayName)||R(e.name)||F(e):""}function X(e){if(!e||"object"!=typeof e)return F(e);let t=F(e);return t?Object.fromEntries(Object.entries({model:t,connectionId:G(e)||void 0,label:J(e)||void 0,provider:R(e.provider)||void 0,accountName:R(e.accountName||e.account_name)||void 0,weight:Number(e.weight||0)>0?Number(e.weight):void 0}).filter(([,e])=>void 0!==e&&""!==e)):""}function U(e,t=!0){let n=X(e),a=H(n);return{value:a,enabled:t,target:n,label:J(n)||a,subtitle:function(e){if(!e||"object"!=typeof e)return"";let t=G(e),n=F(e);return t?`T\xe0i khoản cố định • ${t}${n?` • ${n}`:""}`:""}(n)}}function W(e={}){return R(e.defaultModel)||R(e.providerSpecificData?.defaultModel)||R(e.model)||""}function Q(e,t,n,a=""){let r=R(n);!r||t.has(r)||(t.add(r),e.push({value:r,label:R(a)||r}))}function V(e={},t={}){let n=[],a=new Set,r=R(e.provider),s=[...new Set([D(e),R((0,u.wG)(r)),r].filter(Boolean))];for(let e of(0,m.KC)(r)||[])e?.type&&"llm"!==e.type||Q(n,a,e.id,e.name||e.id);for(let[e,r]of Object.entries(t||{})){let t=R(r),l=s.find(e=>e&&t.startsWith(`${e}/`));if(!l)continue;let i=t.slice(l.length+1);Q(n,a,i,e||i)}return Q(n,a,W(e),"Model mặc định"),n}function Z(e={},{disabledModels:t=[],requestOverrides:n,contentLoggingMode:a}={}){let r={...e},s=[...new Set((t||[]).map(e=>R(e)).filter(Boolean))];if(s.length>0?r.disabledModels=s:delete r.disabledModels,void 0!==n){let e=q(n||{});Object.keys(e).length?r.requestOverrides=e:delete r.requestOverrides}if(void 0!==a){let e=S(a);"inherit"===e?delete r.contentLoggingMode:r.contentLoggingMode=e}return A(r)}function Y(){let[e,t]=(0,r.useState)([]),[n,s]=(0,r.useState)(!0),[l,i]=(0,r.useState)(!1),[o,m]=(0,r.useState)(null),[u,x]=(0,r.useState)([]),[p,h]=(0,r.useState)(!1),[b,g]=(0,r.useState)(!1),[f,y]=(0,r.useState)({}),[v,k]=(0,r.useState)(""),[j,N]=(0,r.useState)(null),{copied:_,copy:C}=(0,c.C)();(0,r.useEffect)(()=>{w()},[]),(0,r.useEffect)(()=>{if(0===e.length){v&&k("");return}let t=e.some(e=>e.name===v);v&&t||k(e[0].name)},[e,v]);let w=async()=>{try{let e=await fetch("/api/dashboard/combos",{cache:"no-store"}),n=await e.json();e.ok&&(t(n.combos||[]),y(n.comboStrategies||{}))}catch(e){console.log("Error fetching combo data:",e)}finally{s(!1)}},O=async()=>{if(!p&&!b){g(!0);try{let e=await fetch("/api/providers",{cache:"no-store"}),t=await e.json();e.ok&&(x(t.connections||[]),h(!0))}catch(e){console.log("Error loading provider accounts:",e)}finally{g(!1)}}},T=async()=>{i(!0),O()},S=async e=>{m(e),O()},$=async e=>{let t=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:e})});if(!t.ok)throw Error(`Save combo strategies failed: ${t.status}`);y(e)},q=async e=>{let{disabledModels:t=[],requestOverrides:n,contentLoggingMode:a,...r}=e;try{let e=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(e.ok){let e=Z({},{disabledModels:t,requestOverrides:n,contentLoggingMode:a});e&&await $({...f,[r.name]:e}),await w(),k(r.name),i(!1)}else{let t=await e.json();alert(t.error||"Tạo combo thất bại")}}catch(e){console.log("Error creating combo:",e)}},M=async(e,t)=>{let{disabledModels:n=[],requestOverrides:a,contentLoggingMode:r,...s}=t,l=o?.name;try{let t=await fetch(`/api/combos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(t.ok){let e={...f};l&&l!==s.name&&e[l]&&(e[s.name]=e[l],delete e[l]);let t=Z(e[s.name]||{},{disabledModels:n,requestOverrides:a,contentLoggingMode:r});t?e[s.name]=t:delete e[s.name],await $(e),await w(),k(s.name),m(null)}else{let e=await t.json();alert(e.error||"Cập nhật combo thất bại")}}catch(e){console.log("Error updating combo:",e)}},R=async n=>{let a=e.find(e=>e.id===n);N({title:"X\xf3a combo",message:"Bạn c\xf3 chắc muốn x\xf3a combo n\xe0y?",onConfirm:async()=>{N(null);try{if((await fetch(`/api/combos/${n}`,{method:"DELETE"})).ok){if(a?.name&&f[a.name]){let e={...f};delete e[a.name],await $(e)}t(e=>{let t=e.filter(e=>e.id!==n);return a?.name===v&&k(t[0]?.name||""),t})}}catch(e){console.log("Error deleting combo:",e)}}})},L=async(e,t)=>{try{let n={...f},a=A({...E(n[e]),...t});return a?n[e]=a:delete n[e],await $(n),!0}catch(e){return console.log("Error updating combo routing settings:",e),!1}},P=e.find(e=>e.name===v)||e[0]||null,I=P?Math.max(0,e.findIndex(e=>e.id===P.id)):0;return n?(0,a.jsx)("div",{className:"grid gap-4",children:[1,2,3].map(e=>(0,a.jsx)("div",{className:"h-36 animate-pulse rounded-2xl border border-border bg-surface"},e))}):(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold text-text-main",children:"Combo model"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"Tạo combo model với fallback, round-robin, độ trễ thấp nhất, P2C v\xe0 routing theo trạng th\xe1i health của LAN Ollama."})]}),(0,a.jsxs)("button",{type:"button",onClick:T,className:"inline-flex items-center justify-center gap-2 rounded-xl bg-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"add"}),"Tạo combo"]})]}),0===e.length?(0,a.jsxs)("div",{className:"rounded-2xl border border-dashed border-border bg-surface p-12 text-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-4xl text-text-muted",children:"layers"}),(0,a.jsx)("h2",{className:"mt-3 text-lg font-semibold text-text-main",children:"Chưa c\xf3 combo n\xe0o"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"Tạo combo model c\xf3 hỗ trợ fallback."}),(0,a.jsx)("button",{type:"button",onClick:T,className:"mt-4 rounded-xl bg-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90",children:"Tạo combo"})]}):(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("div",{className:"rounded-2xl border border-border bg-surface/80 p-4 shadow-sm dark:bg-zinc-950/70",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",children:[(0,a.jsxs)("label",{className:"block min-w-0 flex-1",children:[(0,a.jsx)("span",{className:"mb-1 block text-xs font-semibold uppercase tracking-wide text-text-muted",children:"Combo đang xem"}),(0,a.jsx)("select",{value:P?.name||"",onChange:e=>k(e.target.value),className:"w-full rounded-xl border border-border bg-white px-4 py-2.5 text-sm font-semibold text-text-main outline-none transition focus:border-primary dark:bg-zinc-900",children:e.map(e=>(0,a.jsxs)("option",{value:e.name,children:[e.name," • ",(e.models||[]).length," model"]},e.id))})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-text-muted",children:[(0,a.jsxs)("span",{className:"rounded-full bg-background px-3 py-1 dark:bg-zinc-900",children:["Tổng ",e.length," combo"]}),P?(0,a.jsxs)("span",{className:"rounded-full bg-primary/10 px-3 py-1 font-medium text-primary",children:["Đang hiển thị: ",P.name]}):null]})]})}),P?(0,a.jsx)(ee,{combo:P,comboIndex:I,copied:_,onCopy:C,onEdit:()=>S(P),onDelete:()=>R(P.id),comboStrategy:f[P.name]||{},onUpdateComboStrategy:e=>L(P.name,e)},P.id):null]}),(0,a.jsx)(ei,{isOpen:l,comboStrategy:{},onClose:()=>i(!1),onSave:q,activeProviders:u,providersLoading:b}),(0,a.jsx)(ei,{isOpen:!!o,combo:o,comboStrategy:f[o?.name]||{},onClose:()=>m(null),onSave:e=>M(o.id,e),activeProviders:u,providersLoading:b}),(0,a.jsx)(d.uo,{isOpen:!!j,onClose:()=>N(null),onConfirm:j?.onConfirm,title:j?.title||"X\xe1c nhận",message:j?.message,variant:"danger"})]})}function ee({combo:e,comboIndex:t=0,copied:n,onCopy:s,onEdit:l,onDelete:i,comboStrategy:o={},onUpdateComboStrategy:d}){let[c,m]=(0,r.useState)({}),[u,x]=(0,r.useState)(!1),[g,f]=(0,r.useState)(""),y=E(o||{}),v=E({...o||{},...c}),k=!function(e={},t={}){return P(A(e)||{})===P(A(t)||{})}(v,y),j=v.fallbackStrategy||"fallback",N=h.find(e=>e.value===j)||h[0],_=v.stickyScope||"global",C=p.find(e=>e.value===_)||p[0],w=L(o),O=b[t%b.length],[T,S]=(0,r.useState)(I(v.requiredTags)),[$,R]=(0,r.useState)(B(v.modelTagRules)),F=e=>{f(""),m(t=>({...t,...e}))},D=async()=>{if(!k||u)return;x(!0);let e=await d(c);(x(!1),!1===e)?f("Lưu thất bại, thử lại."):m({})};return(0,r.useEffect)(()=>{m({}),f("")},[e.name]),(0,r.useEffect)(()=>{S(I(v.requiredTags)),R(B(v.modelTagRules))},[e.name,JSON.stringify(v.requiredTags||[]),JSON.stringify(v.modelTagRules||{})]),(0,a.jsxs)("div",{className:`rounded-2xl border p-5 shadow-sm transition-colors ${O.card}`,children:[(0,a.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"layers"}),(0,a.jsx)("h3",{className:"truncate text-lg font-semibold text-text-main",children:e.name})]}),(0,a.jsxs)("p",{className:"mt-1 text-sm text-text-muted",children:[(e.models||[]).length," model đang bật",w.length>0?` • ${w.length} đ\xe3 tắt`:""]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(et,{icon:n===`combo-${e.id}`?"check":"content_copy",title:"Copy t\xean combo",onClick:()=>s(e.name,`combo-${e.id}`)}),(0,a.jsx)(et,{icon:"edit",title:"Chỉnh sửa",onClick:l}),(0,a.jsx)(et,{icon:"delete",title:"X\xf3a",onClick:i,danger:!0})]})]}),(0,a.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[0===(e.models||[]).length?(0,a.jsx)("span",{className:"rounded-lg bg-background px-2 py-1 text-xs text-text-muted",children:"Chưa c\xf3 model đang bật"}):(e.models||[]).slice(0,5).map((e,t)=>(0,a.jsx)("span",{className:"rounded-lg bg-background px-2 py-1 font-mono text-xs text-text-main",children:J(e)},`${H(e)}-${t}`)),(e.models||[]).length>5&&(0,a.jsxs)("span",{className:"rounded-lg bg-background px-2 py-1 text-xs text-text-muted",children:["+",e.models.length-5," model nữa"]}),w.length>0&&(0,a.jsxs)("span",{className:"rounded-lg bg-red-500/10 px-2 py-1 text-xs text-red-500",children:[w.length," đ\xe3 tắt"]}),(function(e={}){let t=q(e),n=[];if(void 0!==t.temperature&&n.push(`temp ${t.temperature}`),void 0!==t.top_p&&n.push(`top_p ${t.top_p}`),void 0!==t.presence_penalty&&n.push(`presence ${t.presence_penalty}`),void 0!==t.max_tokens&&n.push(`max ${t.max_tokens}`),void 0!==t.reasoning_budget&&n.push(`reasoning ${t.reasoning_budget}`),t.forceThinkingOffAboveChars>0){let e=t.forceThinkingOffRequestOverrides||{},a=[];void 0!==e.temperature&&a.push(`temp ${e.temperature}`),void 0!==e.top_p&&a.push(`top_p ${e.top_p}`),void 0!==e.presence_penalty&&a.push(`presence ${e.presence_penalty}`),void 0!==e.max_tokens&&a.push(`max ${e.max_tokens}`),n.push(`auto off >${t.forceThinkingOffAboveChars} chars${a.length?` (${a.join(", ")})`:""}`)}if("off"===t.thinkingMode&&n.push("thinking off"),"on"===t.thinkingMode&&n.push("thinking on"),!t.thinkingMode){let e=M(t.inheritThinkRequestOverrides),a=M(t.inheritNoThinkRequestOverrides);e.length&&n.push(`think: ${e.join(", ")}`),a.length&&n.push(`nothink: ${a.join(", ")}`)}return n})(y.requestOverrides).map(e=>(0,a.jsx)("span",{className:"rounded-lg bg-primary/10 px-2 py-1 text-xs font-medium text-primary",children:e},e)),"inherit"!==y.contentLoggingMode?(0,a.jsxs)("span",{className:`rounded-lg px-2 py-1 text-xs font-medium ${"disabled"===y.contentLoggingMode?"bg-amber-500/10 text-amber-600":"bg-emerald-500/10 text-emerald-600"}`,children:["prompt logs ",y.contentLoggingMode]}):null]}),(0,a.jsxs)("div",{className:`mt-5 rounded-xl border p-4 ${O.panel}`,children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"font-semibold text-text-main",children:"Chiến lược routing"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:N.description})]}),(0,a.jsx)("select",{value:j,onChange:e=>F({fallbackStrategy:e.target.value}),className:"rounded-lg border border-border bg-surface px-3 py-2 text-sm text-text-main outline-none focus:border-primary",children:h.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,a.jsx)(el,{value:v.requestOverrides||{},onChange:e=>F({requestOverrides:e}),compact:!0}),(0,a.jsx)(ea,{value:v.contentLoggingMode,onChange:e=>F({contentLoggingMode:e}),compact:!0}),("least-latency"===j||"p2c"===j)&&(0,a.jsxs)("div",{className:"mt-4 rounded-xl border border-primary/15 bg-surface p-3",children:[(0,a.jsxs)("label",{className:"flex items-start gap-2 text-sm text-text-muted",children:[(0,a.jsx)("input",{type:"checkbox",checked:!1!==v.lanHealthEnabled,onChange:e=>F({lanHealthEnabled:e.target.checked}),className:"mt-0.5 h-3.5 w-3.5 accent-primary"}),(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"font-medium text-text-main",children:"Routing theo trạng th\xe1i health LAN"}),(0,a.jsx)("span",{className:"mt-1 block text-xs",children:"D\xf9ng dữ liệu health v\xe0 circuit breaker khi xếp hạng target trong combo."})]})]}),(0,a.jsxs)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-xs font-medium text-text-muted",children:"Đường dẫn health"}),(0,a.jsx)("input",{value:v.healthCheckPath||"/api/tags",onChange:e=>F({healthCheckPath:e.target.value||"/api/tags"}),placeholder:"/api/tags",className:"w-full rounded-lg border border-border bg-background px-2 py-1.5 font-mono text-xs text-text-main outline-none focus:border-primary"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-xs font-medium text-text-muted",children:"Chu kỳ kiểm tra (ms)"}),(0,a.jsx)("input",{type:"number",min:"1000",value:v.healthCheckIntervalMs||15e3,onChange:e=>F({healthCheckIntervalMs:Number(e.target.value)||15e3}),className:"w-full rounded-lg border border-border bg-background px-2 py-1.5 text-xs text-text-main outline-none focus:border-primary"})]})]}),(0,a.jsxs)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-xs font-medium text-text-muted",children:"Tag endpoint bắt buộc"}),(0,a.jsx)("input",{value:T,onChange:e=>S(e.target.value),onBlur:()=>F({requiredTags:z(T)}),onKeyDown:e=>"Enter"===e.key&&e.currentTarget.blur(),placeholder:"gpu, vram:8gb",className:"w-full rounded-lg border border-border bg-background px-2 py-1.5 font-mono text-xs text-text-main outline-none focus:border-primary"}),(0,a.jsx)("span",{className:"mt-1 block text-[11px] text-text-muted",children:"Mọi endpoint được route đều phải c\xf3 c\xe1c tag n\xe0y."})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-xs font-medium text-text-muted",children:"Quy tắc tag theo model"}),(0,a.jsx)("textarea",{value:$,onChange:e=>R(e.target.value),onBlur:()=>F({modelTagRules:function(e=""){let t={};for(let n of String(e||"").split(/\n+/)){let e=n.trim();if(!e)continue;let a=e.indexOf(":");if(-1===a)continue;let r=e.slice(0,a).trim(),s=z(e.slice(a+1));r&&s.length&&(t[r]=s)}return t}($)}),placeholder:"qwen3:32b: gpu, vram:16gb\nqwen3:8b: model_support:qwen3:8b",rows:3,className:"w-full rounded-lg border border-border bg-background px-2 py-1.5 font-mono text-xs text-text-main outline-none focus:border-primary"})]})]})]}),"round-robin"===j&&(0,a.jsxs)("div",{className:"mt-4 rounded-xl border border-primary/15 bg-surface p-3",children:[(0,a.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm font-semibold text-primary",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"sticky_note_2"}),"Round Robin giữ d\xednh"]}),(0,a.jsxs)("label",{className:"flex items-center gap-2 text-xs text-text-muted",children:[(0,a.jsx)("input",{type:"checkbox",checked:"round-robin"===j,onChange:e=>F({fallbackStrategy:e.target.checked?"round-robin":"fallback"}),className:"h-3.5 w-3.5 accent-primary"}),"Bật"]})]}),(0,a.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-xs font-medium text-text-muted",children:"Chế độ giữ d\xednh"}),(0,a.jsx)("select",{value:_,onChange:e=>F({stickyScope:e.target.value}),className:"w-full rounded-lg border border-border bg-background px-2 py-1.5 text-xs text-text-main outline-none focus:border-primary",children:p.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsx)("span",{className:"mt-1 block text-[11px] text-text-muted",children:C.description})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-xs font-medium text-text-muted",children:"TTL giữ d\xednh (ph\xfat)"}),(0,a.jsx)("input",{type:"number",min:"1",value:v.stickyTtlMinutes||120,onChange:e=>F({stickyTtlMinutes:Number(e.target.value)||120}),className:"w-full rounded-lg border border-border bg-background px-2 py-1.5 text-xs text-text-main outline-none focus:border-primary"})]})]}),(0,a.jsxs)("label",{className:"mt-3 flex items-start gap-2 text-xs text-text-muted",children:[(0,a.jsx)("input",{type:"checkbox",checked:!1!==v.stickyFallbackToClientIp,onChange:e=>F({stickyFallbackToClientIp:e.target.checked}),className:"mt-0.5 h-3.5 w-3.5 accent-primary"}),"Nếu thiếu chat session id, fallback về IP client thay v\xec xoay to\xe0n cục."]})]}),(0,a.jsxs)("div",{className:"mt-4 flex flex-col gap-2 border-t border-border pt-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("span",{className:`text-xs ${g?"text-red-500":k?"text-amber-600":"text-text-muted"}`,children:g||(k?"C\xf3 thay đổi chưa lưu — chỉ \xe1p dụng sau khi bấm Lưu.":"Đang \xe1p dụng cho request mới.")}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{type:"button",onClick:()=>{f(""),m({})},disabled:!k||u,className:"rounded-lg border border-border px-3 py-1.5 text-sm font-medium text-text-muted transition hover:text-text-main disabled:opacity-40",children:"Ho\xe0n t\xe1c"}),(0,a.jsxs)("button",{type:"button",onClick:D,disabled:!k||u,className:"inline-flex items-center gap-1.5 rounded-lg bg-primary px-4 py-1.5 text-sm font-medium text-white transition hover:opacity-90 disabled:opacity-40",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"save"}),u?"Đang lưu…":"Lưu thay đổi"]})]})]})]})]})}function et({icon:e,title:t,onClick:n,danger:r=!1}){return(0,a.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),n?.()},className:`rounded-lg p-2 transition ${r?"text-red-500 hover:bg-red-500/10":"text-text-muted hover:bg-background hover:text-primary"}`,title:t,"aria-label":t,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:e})})}function en({id:e,index:t,model:n,subtitle:s="",enabled:o,isFirst:d,isLast:c,onEdit:m,onMoveUp:u,onMoveDown:x,onRemove:p,onToggleEnabled:h}){let{attributes:b,listeners:g,setNodeRef:f,transform:y,isDragging:v}=(0,l.gl)({id:e}),k={transform:i.Ks.Transform.toString(y),opacity:v?.4:1,zIndex:v?999:void 0},[j,N]=(0,r.useState)(!1),[_,C]=(0,r.useState)(n);(0,r.useEffect)(()=>{C(n)},[n]);let w=()=>{let e=_.trim();e&&e!==n?m(e):C(n),N(!1)};return(0,a.jsxs)("div",{ref:f,style:k,className:`flex items-center gap-3 rounded-xl border p-3 transition ${o?"border-border bg-background":"border-red-200 bg-red-50/70 opacity-75 dark:border-red-500/30 dark:bg-red-500/10"}`,children:[(0,a.jsx)("button",{type:"button",className:"cursor-grab text-text-muted active:cursor-grabbing",...b,...g,title:"K\xe9o để sắp xếp lại",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"drag_indicator"})}),(0,a.jsx)("span",{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-xs font-semibold ${o?"bg-primary/10 text-primary":"bg-red-100 text-red-600 dark:bg-red-500/20 dark:text-red-300"}`,children:t+1}),j?(0,a.jsx)("input",{autoFocus:!0,value:_,onChange:e=>C(e.target.value),onBlur:w,onKeyDown:e=>{"Enter"===e.key&&w(),"Escape"===e.key&&(C(n),N(!1))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-background px-2 py-1 font-mono text-xs text-text-main outline-none"}):(0,a.jsxs)("button",{type:"button",onClick:()=>N(!0),className:"min-w-0 flex-1 text-left",title:"Bấm để sửa model",children:[(0,a.jsx)("span",{className:`block truncate font-mono text-xs ${o?"text-text-main":"text-text-muted line-through"}`,children:n}),s?(0,a.jsx)("span",{className:"mt-0.5 block truncate text-[11px] text-text-muted",children:s}):null]}),(0,a.jsx)("button",{type:"button",onClick:h,className:`rounded-lg p-1.5 transition ${o?"text-green-600 hover:bg-green-500/10":"text-red-500 hover:bg-red-500/10"}`,title:o?"Tắt model trong combo":"Bật model trong combo",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:o?"toggle_on":"toggle_off"})}),(0,a.jsx)("button",{type:"button",onClick:u,disabled:d,className:"rounded-lg p-1.5 text-text-muted transition hover:bg-surface disabled:opacity-30",title:"Di chuyển l\xean",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"arrow_upward"})}),(0,a.jsx)("button",{type:"button",onClick:x,disabled:c,className:"rounded-lg p-1.5 text-text-muted transition hover:bg-surface disabled:opacity-30",title:"Di chuyển xuống",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"arrow_downward"})}),(0,a.jsx)("button",{type:"button",onClick:p,className:"rounded-lg p-1.5 text-red-500 transition hover:bg-red-500/10",title:"X\xf3a",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]})}function ea({value:e="inherit",onChange:t,compact:n=!1}){let r=S(e),s=_.find(e=>e.value===r)||_[0];return(0,a.jsx)("div",{className:n?"mt-4 rounded-xl border border-amber-500/15 bg-surface p-3":"rounded-xl border border-amber-500/15 bg-amber-500/5 p-4",children:(0,a.jsxs)("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_280px] md:items-center",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm font-semibold text-text-main",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-amber-500",children:"manage_search"}),"Prompt Logs cho combo n\xe0y"]}),(0,a.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:s.description}),"disabled"===r?(0,a.jsx)("p",{className:"mt-1 text-[11px] font-medium text-amber-600",children:"Khi chạy request, Prompt Logs sẽ chỉ ghi metadata v\xe0 hiển thị [promptlogs disabled on this combo]."}):null]}),(0,a.jsx)("select",{value:r,onChange:e=>t?.(S(e.target.value)),className:"w-full rounded-lg border border-border bg-surface px-3 py-2 text-sm text-text-main outline-none focus:border-primary",children:_.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))})]})})}function er({icon:e,label:t,children:n,active:r,muted:s=!1,className:l=""}){return(0,a.jsxs)("label",{className:`rounded-lg border p-3 transition ${r?"border-primary/30 bg-background shadow-sm":"border-border bg-background/60"} ${l}`,children:[(0,a.jsxs)("span",{className:"mb-2 flex items-center justify-between gap-2 text-xs font-medium text-text-main",children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] ${r?"text-primary":"text-text-muted"}`,children:e}),(0,a.jsx)("span",{className:"truncate",children:t})]}),n?.toggle]}),n?.control,n?.hint?(0,a.jsx)("span",{className:"mt-1 block text-[11px] text-text-muted",children:n.hint}):null]})}function es({icon:e,title:t,values:n={},defaults:r={},onToggleField:s,onChangeField:l,inputClass:i}){let o=Object.keys(n||{}).length>0;return(0,a.jsxs)("div",{className:`rounded-lg border p-2 transition ${o?"border-primary/30 bg-background":"border-border bg-background/60"}`,children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] font-semibold text-text-main",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[15px] ${o?"text-primary":"text-text-muted"}`,children:e}),(0,a.jsx)("span",{className:"truncate",children:t})]}),(0,a.jsx)("div",{className:"grid gap-2 sm:grid-cols-2",children:k.map(e=>{let t=n?.[e.key]!==void 0;return(0,a.jsxs)("label",{className:"space-y-1",children:[(0,a.jsxs)("span",{className:"flex items-center justify-between gap-1 text-[11px] font-medium text-text-main",children:[(0,a.jsx)("span",{className:"truncate",children:e.label}),(0,a.jsx)("input",{type:"checkbox",checked:t,onChange:t=>s?.(e.key,t.target.checked,r[e.key]),className:"h-3.5 w-3.5 accent-primary"})]}),(0,a.jsx)("input",{type:"number",min:e.min,max:e.max,step:e.step,disabled:!t,value:t?n[e.key]:r[e.key],onChange:t=>l?.(e.key,t.target.value),className:i})]},e.key)})})]})}function el({value:e={},onChange:t,compact:n=!1}){let r=q(e),s=void 0!==r.temperature,l=void 0!==r.top_p,i=void 0!==r.presence_penalty,o=void 0!==r.max_tokens,d=void 0!==r.reasoning_budget,c=void 0!==r.forceThinkingOffAboveChars,m=r.forceThinkingOffRequestOverrides||{},u=void 0!==m.temperature,x=void 0!==m.top_p,p=void 0!==m.presence_penalty,h=void 0!==m.max_tokens,b=u||x||p||h,k=r.thinkingMode||"inherit",_="inherit"!==k,C="off"===k,w=r.inheritThinkRequestOverrides||{},O=r.inheritNoThinkRequestOverrides||{},T=Object.keys(w).length>0||Object.keys(O).length>0,S=s||l||i||o||!_&&T,M=_||d||c||b,R=e=>{t?.(q({...r,...e}))},L=(e,n,a)=>{if(!n){let n={...r};delete n[e],"forceThinkingOffAboveChars"===e&&delete n.forceThinkingOffRequestOverrides,t?.(q(n));return}R({[e]:a})},E=e=>{R({forceThinkingOffRequestOverrides:$({...m,...e})})},A=(e,t,n,a)=>{let s=v[e],l={...r[s]||{}};if(!n){delete l[t],R({[s]:l});return}l[t]=a,R({[s]:$(l)})},P=(e,t,n)=>{let a=v[e];R({[a]:$({...r[a]||{},[t]:n})})},I=(e,t,n)=>{let a={...m};if(!t){delete a[e],R({forceThinkingOffRequestOverrides:a});return}E({[e]:n})},z="w-full rounded-lg border border-border bg-surface px-2 py-1.5 text-sm text-text-main outline-none focus:border-primary disabled:opacity-50";return(0,a.jsxs)("div",{className:n?"mt-4 rounded-xl border border-sky-500/15 bg-surface p-3":"rounded-xl border border-sky-500/15 bg-sky-500/5 p-4",children:[(0,a.jsxs)("div",{className:"mb-3 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm font-semibold text-text-main",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-sky-500",children:"tune"}),"Tham số request Local endpoint"]}),(0,a.jsxs)("p",{className:"mt-1 text-xs text-text-muted",children:["Chỉ inject khi combo route 100% tới local endpoint: ",(0,a.jsx)("span",{className:"font-mono",children:"llama.cpp"}),", ",(0,a.jsx)("span",{className:"font-mono",children:"vLLM"})," hoặc ",(0,a.jsx)("span",{className:"font-mono",children:"Ollama"}),". Nếu combo mix local + cloud/provider kh\xe1c, BlueRouter bỏ qua block n\xe0y v\xe0 giữ nguy\xean request gốc."]})]}),!function(e={}){return Object.keys(q(e)).length>0}(r)?(0,a.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full bg-background px-2 py-1 text-[11px] font-semibold text-text-muted",children:"Kh\xf4ng override"}):(0,a.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full bg-primary/10 px-2 py-1 text-[11px] font-semibold text-primary",children:"C\xf3 override"})]}),(0,a.jsxs)("div",{className:"grid gap-3 xl:grid-cols-2",children:[(0,a.jsxs)("div",{className:`rounded-xl border p-3 ${S?"border-primary/20 bg-primary/5":"border-border bg-background/40"}`,children:[(0,a.jsxs)("div",{className:"mb-3 flex items-center gap-2 text-xs font-semibold text-primary",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"graphic_eq"}),"Sampling ",(0,a.jsx)("span",{className:"font-normal text-text-muted",children:"(điều khiển lựa chọn token)"})]}),(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 2xl:grid-cols-3",children:[(0,a.jsx)(er,{icon:"thermostat",label:"Temperature",active:s,children:{toggle:(0,a.jsx)("input",{type:"checkbox",checked:s,onChange:e=>L("temperature",e.target.checked,g.temperature),className:"h-3.5 w-3.5 accent-primary"}),control:(0,a.jsx)("input",{type:"number",min:"0",max:"2",step:"0.05",disabled:!s,value:s?r.temperature:g.temperature,onChange:e=>R({temperature:e.target.value}),className:z}),hint:"0 = ổn định, 2 = s\xe1ng tạo."}}),(0,a.jsx)(er,{icon:"filter_alt",label:"top_p",active:l,children:{toggle:(0,a.jsx)("input",{type:"checkbox",checked:l,onChange:e=>L("top_p",e.target.checked,g.top_p),className:"h-3.5 w-3.5 accent-primary"}),control:(0,a.jsx)("input",{type:"number",min:"0.01",max:"1",step:"0.01",disabled:!l,value:l?r.top_p:g.top_p,onChange:e=>R({top_p:e.target.value}),className:z}),hint:"0.01–1.0; 0.9–0.95 thường hợp coder/chat."}}),(0,a.jsx)(er,{icon:"repeat",label:"presence_penalty",active:i,children:{toggle:(0,a.jsx)("input",{type:"checkbox",checked:i,onChange:e=>L("presence_penalty",e.target.checked,g.presence_penalty),className:"h-3.5 w-3.5 accent-primary"}),control:(0,a.jsx)("input",{type:"number",min:"-2",max:"2",step:"0.05",disabled:!i,value:i?r.presence_penalty:g.presence_penalty,onChange:e=>R({presence_penalty:e.target.value}),className:z}),hint:"-2–2; coder thường để 0, chỉ tăng nhẹ nếu hay lặp."}}),(0,a.jsx)(er,{icon:"output",label:"max_tokens",active:o,className:"sm:col-span-2 2xl:col-span-1",children:{toggle:(0,a.jsx)("input",{type:"checkbox",checked:o,onChange:e=>L("max_tokens",e.target.checked,g.max_tokens),className:"h-3.5 w-3.5 accent-primary"}),control:(0,a.jsx)("input",{type:"number",min:"1",max:"262144",step:"1",disabled:!o,value:o?r.max_tokens:g.max_tokens,onChange:e=>R({max_tokens:e.target.value}),className:z}),hint:"Giới hạn output cho request."}})]}),_?null:(0,a.jsxs)("div",{className:"mt-3 rounded-lg border border-border bg-surface/70 p-2",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] font-semibold text-text-main",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[15px] text-primary",children:"alt_route"}),"Override ri\xeang theo thinking của request gốc"]}),(0,a.jsxs)("div",{className:"grid gap-2 2xl:grid-cols-2",children:[(0,a.jsx)(es,{icon:"psychology",title:"Khi request bật thinking",values:w,defaults:f,onToggleField:(e,t,n)=>A("think",e,t,n),onChangeField:(e,t)=>P("think",e,t),inputClass:z}),(0,a.jsx)(es,{icon:"bolt",title:"Khi request tắt thinking",values:O,defaults:y,onToggleField:(e,t,n)=>A("nothink",e,t,n),onChangeField:(e,t)=>P("nothink",e,t),inputClass:z})]}),(0,a.jsx)("span",{className:"mt-2 block text-[11px] text-text-muted",children:"Chỉ \xe1p dụng khi Thinking = “Theo request gốc”. Field được tick sẽ ghi đ\xe8 gi\xe1 trị Sampling ph\xeda tr\xean; request kh\xf4ng khai b\xe1o thinking được t\xednh l\xe0 tắt thinking. Khi auto-off k\xedch hoạt th\xec block auto-off thắng."})]})]}),(0,a.jsxs)("div",{className:`rounded-xl border p-3 ${M?"border-primary/20 bg-primary/5":"border-border bg-background/40"}`,children:[(0,a.jsxs)("div",{className:"mb-3 flex items-center gap-2 text-xs font-semibold text-primary",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"psychology"}),"Thinking ",(0,a.jsx)("span",{className:"font-normal text-text-muted",children:"(suy luận nội bộ)"})]}),(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 2xl:grid-cols-3",children:[(0,a.jsxs)("label",{className:`rounded-lg border p-3 transition ${_?"border-primary/30 bg-background shadow-sm":"border-border bg-background/60"}`,children:[(0,a.jsxs)("span",{className:"mb-2 flex items-center gap-1.5 text-xs font-medium text-text-main",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] ${_?"text-primary":"text-text-muted"}`,children:"psychology_alt"}),"Thinking"]}),(0,a.jsx)("select",{value:k,onChange:e=>R({thinkingMode:"inherit"===e.target.value?void 0:e.target.value}),className:"w-full rounded-lg border border-border bg-surface px-2 py-1.5 text-sm text-text-main outline-none focus:border-primary",children:N.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsx)("span",{className:"mt-1 block text-[11px] text-text-muted",children:N.find(e=>e.value===k)?.description||N[0].description})]}),(0,a.jsx)(er,{icon:"account_balance_wallet",label:"reasoning_budget",active:d,className:C?"opacity-60":"",children:{toggle:(0,a.jsx)("input",{type:"checkbox",checked:d,disabled:C,onChange:e=>L("reasoning_budget",e.target.checked,g.reasoning_budget),className:"h-3.5 w-3.5 accent-primary disabled:opacity-50"}),control:(0,a.jsx)("input",{type:"number",min:"0",max:"262144",step:"1",disabled:C||!d,value:d?r.reasoning_budget:g.reasoning_budget,onChange:e=>R({reasoning_budget:e.target.value}),className:z}),hint:C?"Thinking đang tắt n\xean budget kh\xf4ng được gửi.":"Chỉ d\xf9ng cho llama.cpp/vLLM local; runtime sẽ map đ\xfang field."}}),(0,a.jsx)(er,{icon:"speed",label:"Auto tắt thinking nếu prompt chars >=",active:c||b,className:"sm:col-span-2 2xl:col-span-3",children:{toggle:(0,a.jsx)("input",{type:"checkbox",checked:c,onChange:e=>L("forceThinkingOffAboveChars",e.target.checked,g.forceThinkingOffAboveChars),className:"h-3.5 w-3.5 accent-primary"}),control:(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("input",{type:"number",min:"0",max:"1000000",step:"1000",disabled:!c,value:c?r.forceThinkingOffAboveChars:g.forceThinkingOffAboveChars,onChange:e=>R({forceThinkingOffAboveChars:e.target.value}),className:z}),(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-surface/70 p-2",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] font-semibold text-text-main",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[15px] text-primary",children:"tune"}),"Override ri\xeang khi auto-off được k\xedch hoạt"]}),(0,a.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2",children:[(0,a.jsxs)("label",{className:"space-y-1",children:[(0,a.jsxs)("span",{className:"flex items-center justify-between text-[11px] font-medium text-text-main",children:["temp",(0,a.jsx)("input",{type:"checkbox",checked:u,disabled:!c,onChange:e=>I("temperature",e.target.checked,j.temperature),className:"h-3.5 w-3.5 accent-primary disabled:opacity-50"})]}),(0,a.jsx)("input",{type:"number",min:"0",max:"2",step:"0.05",disabled:!c||!u,value:u?m.temperature:j.temperature,onChange:e=>E({temperature:e.target.value}),className:z})]}),(0,a.jsxs)("label",{className:"space-y-1",children:[(0,a.jsxs)("span",{className:"flex items-center justify-between text-[11px] font-medium text-text-main",children:["top_p",(0,a.jsx)("input",{type:"checkbox",checked:x,disabled:!c,onChange:e=>I("top_p",e.target.checked,j.top_p),className:"h-3.5 w-3.5 accent-primary disabled:opacity-50"})]}),(0,a.jsx)("input",{type:"number",min:"0.01",max:"1",step:"0.01",disabled:!c||!x,value:x?m.top_p:j.top_p,onChange:e=>E({top_p:e.target.value}),className:z})]}),(0,a.jsxs)("label",{className:"space-y-1",children:[(0,a.jsxs)("span",{className:"flex items-center justify-between text-[11px] font-medium text-text-main",children:["presence_penalty",(0,a.jsx)("input",{type:"checkbox",checked:p,disabled:!c,onChange:e=>I("presence_penalty",e.target.checked,j.presence_penalty),className:"h-3.5 w-3.5 accent-primary disabled:opacity-50"})]}),(0,a.jsx)("input",{type:"number",min:"-2",max:"2",step:"0.05",disabled:!c||!p,value:p?m.presence_penalty:j.presence_penalty,onChange:e=>E({presence_penalty:e.target.value}),className:z})]}),(0,a.jsxs)("label",{className:"space-y-1",children:[(0,a.jsxs)("span",{className:"flex items-center justify-between text-[11px] font-medium text-text-main",children:["max_tokens",(0,a.jsx)("input",{type:"checkbox",checked:h,disabled:!c,onChange:e=>I("max_tokens",e.target.checked,j.max_tokens),className:"h-3.5 w-3.5 accent-primary disabled:opacity-50"})]}),(0,a.jsx)("input",{type:"number",min:"1",max:"262144",step:"1",disabled:!c||!h,value:h?m.max_tokens:j.max_tokens,onChange:e=>E({max_tokens:e.target.value}),className:z})]})]})]})]}),hint:"Khi prompt vượt ngưỡng, thinking bị tắt trước; c\xe1c field ri\xeang b\xean tr\xean chỉ inject nếu được tick."}})]})]})]})]})}function ei({isOpen:e,combo:t,comboStrategy:n={},onClose:i,onSave:c,activeProviders:m,providersLoading:p=!1,kindFilter:h=null}){let[b,f]=(0,r.useState)(t?.name||""),[y,v]=(0,r.useState)([]),[k,j]=(0,r.useState)(!1),[N,_]=(0,r.useState)(!1),[C,w]=(0,r.useState)(""),[O,T]=(0,r.useState)({}),[$,M]=(0,r.useState)(""),[E,A]=(0,r.useState)(""),[P,I]=(0,r.useState)(()=>t?q(n?.requestOverrides||{}):q(g)),[z,B]=(0,r.useState)(()=>S(n?.contentLoggingMode)),F=n||{},G=(0,s.FR)((0,s.MS)(s.AN,{activationConstraint:{distance:5}}),(0,s.MS)(s.uN,{coordinateGetter:l.JR}));(0,r.useEffect)(()=>{e&&(f(t?.name||""),v(function(e,t={}){let n=(e?.models||[]).map(e=>U(e,!0)).filter(e=>e.value),a=new Set(n.map(e=>e.value));return[...n,...L(t).filter(e=>!a.has(e)).map(e=>U(e,!1)).filter(e=>e.value)]}(t,F)),w(""),M(""),A(""),I(t?q(F.requestOverrides||{}):q(g)),B(S(F.contentLoggingMode)))},[e,t?.id,t?.name,F.contentLoggingMode]),(0,r.useEffect)(()=>{e&&J()},[e]);let J=async()=>{try{let e=await fetch("/api/models/alias",{cache:"no-store"});if(!e.ok)return;let t=await e.json();T(t.aliases||{})}catch(e){console.error("Error fetching modal data:",e)}},Q=y.map((e,t)=>({uid:`item-${t}-${e.value}`,row:e})),Z=y.map(e=>e.value),Y=y.filter(e=>e.enabled).length,ee=y.filter(e=>!e.enabled).length,et=(m||[]).filter(e=>e?.isActive!==!1),er=et.find(e=>e.id===$)||null,es=er?V(er,O):[],eo=es[0]?.value||(er?W(er):""),ed=e=>e.trim()?x.test(e)?(w(""),!0):(w("Chỉ cho ph\xe9p chữ, số, dấu -, _ v\xe0 ."),!1):(w("Bắt buộc nhập t\xean"),!1),ec=async()=>{if(!ed(b))return;let{models:e,disabledModels:t}=function(e=[]){let t=[],n=new Set;for(let a of e){let e=R(a?.value||H(a?.target));!e||n.has(e)||(n.add(e),t.push({...a,value:e,enabled:a?.enabled!==!1,target:X(a?.target||a?.value)}))}return{models:t.filter(e=>e.enabled).map(e=>e.target).filter(Boolean),disabledModels:t.filter(e=>!e.enabled).map(e=>e.value)}}(y);_(!0),await c({name:b.trim(),models:e,disabledModels:t,requestOverrides:q(P),contentLoggingMode:z}),_(!1)};if(!e)return null;let em=!!t;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/45 p-3 backdrop-blur-[1px] sm:p-4",children:(0,a.jsxs)("div",{className:"flex max-h-[92vh] w-full max-w-7xl flex-col overflow-hidden rounded-2xl border border-border bg-white shadow-2xl dark:bg-zinc-950",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between border-b border-border px-5 py-4 sm:px-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-text-main",children:em?"Chỉnh sửa combo":"Tạo combo"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"Chọn model, tắt tạm thời khi cần v\xe0 sắp xếp thứ tự ưu ti\xean fallback đang bật."})]}),(0,a.jsx)("button",{type:"button",onClick:i,className:"rounded-lg p-1 text-text-muted transition hover:bg-surface hover:text-text-main",children:(0,a.jsx)("span",{className:"material-symbols-outlined",children:"close"})})]}),(0,a.jsxs)("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto bg-white px-5 py-4 dark:bg-zinc-950 sm:px-6",children:[(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-2 block text-sm font-semibold text-text-main",children:"T\xean"}),(0,a.jsx)("input",{value:b,onChange:e=>{let t=e.target.value;f(t),t?ed(t):w("")},placeholder:"premium-coding",className:`w-full rounded-xl border bg-white px-4 py-2.5 text-text-main outline-none transition focus:border-primary dark:bg-zinc-900 ${C?"border-red-400":"border-border"}`}),(0,a.jsx)("span",{className:`mt-1 block text-xs ${C?"text-red-500":"text-text-muted"}`,children:C||"Chỉ cho ph\xe9p chữ, số, dấu -, _ v\xe0 ."})]}),(0,a.jsx)(el,{value:P,onChange:I,defaultEnabled:!em}),(0,a.jsx)(ea,{value:z,onChange:B}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:"Danh s\xe1ch model"}),(0,a.jsxs)("p",{className:"mt-1 text-xs text-text-muted",children:[Y," đang bật",ee>0?`, ${ee} đ\xe3 tắt`:"",". Model đ\xe3 tắt vẫn nằm trong combo nhưng kh\xf4ng được route."]})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>j(!0),className:"inline-flex items-center gap-1 rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-primary hover:border-primary/50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"add"}),"Th\xeam model"]})]}),(0,a.jsxs)("div",{className:"mb-4 rounded-xl border border-primary/15 bg-primary/5 p-3",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-primary",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"account_tree"}),"Th\xeam target theo provider account"]}),(0,a.jsx)("p",{className:"mb-3 text-xs text-text-muted",children:"Cố định bước combo n\xe0y v\xe0o một provider account cụ thể. Danh s\xe1ch account chỉ được load khi mở modal để trang combo nhẹ hơn."}),(0,a.jsxs)("div",{className:"grid gap-2 md:grid-cols-[minmax(0,1.5fr)_minmax(0,1fr)_auto]",children:[(0,a.jsxs)("select",{value:$,onChange:e=>{let t=e.target.value,n=et.find(e=>e.id===t),a=n?V(n,O):[];M(t),A(a[0]?.value||W(n||{})||"")},className:"min-w-0 rounded-lg border border-border bg-background px-3 py-2 text-xs text-text-main outline-none focus:border-primary",children:[(0,a.jsx)("option",{value:"",children:p?"Đang tải provider account...":"Chọn provider account"}),et.map(e=>{let t=D(e),n=K(e),r=n&&n!==t?`${t} / ${n}`:t;return(0,a.jsx)("option",{value:e.id,children:r},e.id)})]}),(0,a.jsxs)("select",{value:E,onChange:e=>A(e.target.value),disabled:!$||0===es.length,className:"min-w-0 rounded-lg border border-border bg-background px-3 py-2 font-mono text-xs text-text-main outline-none focus:border-primary disabled:cursor-not-allowed disabled:opacity-60",children:[(0,a.jsx)("option",{value:"",children:$?es.length>0?"Chọn model":"Kh\xf4ng t\xecm thấy model của provider":"Chọn account trước"}),es.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},`${e.value}-${e.label}`))]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{if(!er)return;let e=function(e,t){let n=D(e),a=function(e={}){let t=R(e.provider),n=D(e);return(0,u.mq)(t)||(0,u.gb)(t)?n||t:t||n}(e),r=K(e),s=R(t||W(e));if(!n||!e?.id||!s)return null;let l=s.includes("/"),i=l?s:`${n}/${s}`,o=l&&s.startsWith(`${n}/`)?s.slice(n.length+1):s,d=r&&r!==a?`${a}/${r}/${o}`:`${a}/${o}`;return{model:i,connectionId:e.id,provider:a||n,accountName:r||void 0,label:d}}(er,E||eo);if(!e)return void alert("H\xe3y chọn provider account v\xe0 model cho target cố định n\xe0y.");let t=U(e,!0);v(e=>{let n=e.findIndex(e=>e.value===t.value);if(-1!==n){let a=[...e];return a[n]={...a[n],...t,enabled:!0},a}return[...e,t]}),A("")},disabled:!$||!E,className:"inline-flex items-center justify-center gap-1 rounded-lg bg-primary px-3 py-2 text-xs font-semibold text-white disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"add_link"}),"Th\xeam account"]})]})]}),0===y.length?(0,a.jsxs)("div",{className:"rounded-xl border border-dashed border-border p-8 text-center text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined",children:"layers"}),(0,a.jsx)("p",{className:"mt-2 text-sm",children:"Chưa th\xeam model n\xe0o"})]}):(0,a.jsx)(s.Mp,{sensors:G,collisionDetection:s.fp,modifiers:[o.FN,o.gj],onDragEnd:e=>{let{active:t,over:n}=e;if(n&&t.id!==n.id){let e=Q.findIndex(e=>e.uid===t.id),a=Q.findIndex(e=>e.uid===n.id);-1!==e&&-1!==a&&v(t=>(0,l.be)(t,e,a))}},children:(0,a.jsx)(l.gB,{items:Q.map(e=>e.uid),strategy:l._G,children:(0,a.jsx)("div",{className:"space-y-3",children:Q.map(({uid:e,row:t},n)=>(0,a.jsx)(en,{id:e,index:n,model:t.label||t.value,subtitle:t.subtitle,enabled:t.enabled,isFirst:0===n,isLast:n===y.length-1,onEdit:e=>{let t=e.trim();if(!t)return;let a=[...y],r=a[n];if(r?.target&&"object"==typeof r.target){let e=X({...r.target,model:t});a[n]=U(e,!1!==r.enabled)}else a[n]=U(t,r?.enabled!==!1);v(a)},onMoveUp:()=>{if(0===n)return;let e=[...y];[e[n-1],e[n]]=[e[n],e[n-1]],v(e)},onMoveDown:()=>{if(n===y.length-1)return;let e=[...y];[e[n],e[n+1]]=[e[n+1],e[n]],v(e)},onToggleEnabled:()=>{let e=[...y];e[n]={...e[n],enabled:!e[n].enabled},v(e)},onRemove:()=>v(y.filter((e,t)=>t!==n))},e))})})})]})]}),(0,a.jsxs)("div",{className:"flex justify-end gap-3 border-t border-border bg-white px-5 py-4 dark:bg-zinc-950 sm:px-6",children:[(0,a.jsx)("button",{type:"button",onClick:i,className:"rounded-xl border border-border px-4 py-2 text-sm font-medium text-text-main hover:bg-surface",children:"Hủy"}),(0,a.jsx)("button",{type:"button",onClick:ec,disabled:N,className:"rounded-xl bg-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90 disabled:opacity-50",children:N?"Đang lưu...":em?"Lưu":"Tạo"})]})]})}),(0,a.jsx)(d.rq,{isOpen:k,onClose:()=>j(!1),onSelect:e=>{let t=e.value;v(e=>{let n=e.findIndex(e=>e.value===t);if(-1!==n){let t=[...e];return t[n]={...t[n],enabled:!0},t}return[...e,U(t,!0)]})},onDeselect:e=>{v(t=>t.filter(t=>t.value!==e.value))},activeProviders:m,modelAliases:O,title:"Th\xeam model v\xe0o combo",kindFilter:h,addedModelValues:Z,closeOnSelect:!1})]})}}},e=>{e.O(0,[6373,3862,8500,9893,9959,7050,7055,5564,5263,7033,5497,8441,3794,7358],()=>e(e.s=20061)),_N_E=e.O()}]);
|
|
File without changes
|
/package/app/.next-cli-build/static/{x-Qb8zBG_LMJpbcg7V5kZ → RLHlm_VhJtUy0g062tWk9}/_ssgManifest.js
RENAMED
|
File without changes
|