@lastbrain/module-ai 2.0.26 → 2.0.30
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/README.md +52 -1
- package/dist/ai.build.config.d.ts.map +1 -1
- package/dist/ai.build.config.js +508 -9
- package/dist/api/admin/ai-provider-models/[id].d.ts +18 -0
- package/dist/api/admin/ai-provider-models/[id].d.ts.map +1 -0
- package/dist/api/admin/ai-provider-models/[id].js +58 -0
- package/dist/api/admin/ai-provider-models.d.ts +20 -0
- package/dist/api/admin/ai-provider-models.d.ts.map +1 -0
- package/dist/api/admin/ai-provider-models.js +26 -0
- package/dist/api/admin/ai-providers/[key].d.ts +18 -0
- package/dist/api/admin/ai-providers/[key].d.ts.map +1 -0
- package/dist/api/admin/ai-providers/[key].js +55 -0
- package/dist/api/admin/ai-providers.d.ts +20 -0
- package/dist/api/admin/ai-providers.d.ts.map +1 -0
- package/dist/api/admin/ai-providers.js +26 -0
- package/dist/api/admin/billing-analytics.d.ts +43 -0
- package/dist/api/admin/billing-analytics.d.ts.map +1 -0
- package/dist/api/admin/billing-analytics.js +144 -0
- package/dist/api/admin/global-ai-settings.d.ts +14 -0
- package/dist/api/admin/global-ai-settings.d.ts.map +1 -0
- package/dist/api/admin/global-ai-settings.js +63 -0
- package/dist/api/admin/token-packs/[id].d.ts.map +1 -1
- package/dist/api/admin/token-packs/[id].js +3 -2
- package/dist/api/admin/token-packs.d.ts.map +1 -1
- package/dist/api/admin/token-packs.js +3 -2
- package/dist/api/admin/user-monthly-details.d.ts +49 -0
- package/dist/api/admin/user-monthly-details.d.ts.map +1 -0
- package/dist/api/admin/user-monthly-details.js +140 -0
- package/dist/api/admin/user-quota.d.ts +21 -0
- package/dist/api/admin/user-quota.d.ts.map +1 -0
- package/dist/api/admin/user-quota.js +59 -0
- package/dist/api/admin/user-token/[id].d.ts.map +1 -1
- package/dist/api/admin/user-token/[id].js +2 -1
- package/dist/api/admin/user-token.d.ts +5 -2
- package/dist/api/admin/user-token.d.ts.map +1 -1
- package/dist/api/admin/user-token.js +91 -17
- package/dist/api/admin/user-usage-by-model.d.ts +22 -0
- package/dist/api/admin/user-usage-by-model.d.ts.map +1 -0
- package/dist/api/admin/user-usage-by-model.js +78 -0
- package/dist/api/admin/user-wallet-analytics.d.ts +15 -0
- package/dist/api/admin/user-wallet-analytics.d.ts.map +1 -0
- package/dist/api/admin/user-wallet-analytics.js +67 -0
- package/dist/api/admin/wallet-repair/route.d.ts +30 -0
- package/dist/api/admin/wallet-repair/route.d.ts.map +1 -0
- package/dist/api/admin/wallet-repair/route.js +63 -0
- package/dist/api/auth/ai-model-settings.d.ts +21 -0
- package/dist/api/auth/ai-model-settings.d.ts.map +1 -0
- package/dist/api/auth/ai-model-settings.js +86 -0
- package/dist/api/auth/ai-settings.d.ts +17 -0
- package/dist/api/auth/ai-settings.d.ts.map +1 -0
- package/dist/api/auth/ai-settings.js +87 -0
- package/dist/api/auth/api-keys/[id].d.ts +17 -0
- package/dist/api/auth/api-keys/[id].d.ts.map +1 -0
- package/dist/api/auth/api-keys/[id].js +66 -0
- package/dist/api/auth/api-keys.d.ts +19 -0
- package/dist/api/auth/api-keys.d.ts.map +1 -0
- package/dist/api/auth/api-keys.js +94 -0
- package/dist/api/auth/create-checkout.d.ts +1 -1
- package/dist/api/auth/create-checkout.d.ts.map +1 -1
- package/dist/api/auth/create-checkout.js +8 -6
- package/dist/api/auth/generate-image.d.ts +2 -2
- package/dist/api/auth/generate-image.d.ts.map +1 -1
- package/dist/api/auth/generate-image.js +404 -104
- package/dist/api/auth/generate-text.d.ts +3 -2
- package/dist/api/auth/generate-text.d.ts.map +1 -1
- package/dist/api/auth/generate-text.js +130 -58
- package/dist/api/auth/process-ocr.d.ts +9 -0
- package/dist/api/auth/process-ocr.d.ts.map +1 -0
- package/dist/api/auth/process-ocr.js +43 -0
- package/dist/api/auth/prompts/stats.d.ts +14 -0
- package/dist/api/auth/prompts/stats.d.ts.map +1 -0
- package/dist/api/auth/prompts/stats.js +46 -0
- package/dist/api/auth/prompts.d.ts +26 -0
- package/dist/api/auth/prompts.d.ts.map +1 -0
- package/dist/api/auth/prompts.js +175 -0
- package/dist/api/auth/token-balance.d.ts +26 -0
- package/dist/api/auth/token-balance.d.ts.map +1 -0
- package/dist/api/auth/token-balance.js +47 -0
- package/dist/api/auth/token-checkout.d.ts.map +1 -1
- package/dist/api/auth/token-checkout.js +22 -4
- package/dist/api/auth/token-packs.d.ts.map +1 -1
- package/dist/api/auth/token-packs.js +2 -1
- package/dist/api/auth/usage-by-model.d.ts +25 -0
- package/dist/api/auth/usage-by-model.d.ts.map +1 -0
- package/dist/api/auth/usage-by-model.js +95 -0
- package/dist/api/auth/usage.d.ts +26 -0
- package/dist/api/auth/usage.d.ts.map +1 -0
- package/dist/api/auth/usage.js +127 -0
- package/dist/api/auth/user-tokens.d.ts.map +1 -1
- package/dist/api/auth/user-tokens.js +36 -2
- package/dist/api/auth/wallet/route.d.ts +17 -0
- package/dist/api/auth/wallet/route.d.ts.map +1 -0
- package/dist/api/auth/wallet/route.js +68 -0
- package/dist/api/auth/wallet.d.ts +16 -0
- package/dist/api/auth/wallet.d.ts.map +1 -0
- package/dist/api/auth/wallet.js +71 -0
- package/dist/api/public/gateway-models.d.ts +25 -0
- package/dist/api/public/gateway-models.d.ts.map +1 -0
- package/dist/api/public/gateway-models.js +49 -0
- package/dist/api/public/pricing-summary.d.ts +46 -0
- package/dist/api/public/pricing-summary.d.ts.map +1 -0
- package/dist/api/public/pricing-summary.js +70 -0
- package/dist/api/public/prompts/[id]/stats.d.ts +15 -0
- package/dist/api/public/prompts/[id]/stats.d.ts.map +1 -0
- package/dist/api/public/prompts/[id]/stats.js +37 -0
- package/dist/api/public/prompts/[id]/view.d.ts +15 -0
- package/dist/api/public/prompts/[id]/view.d.ts.map +1 -0
- package/dist/api/public/prompts/[id]/view.js +41 -0
- package/dist/api/public/prompts/slug/[slug].d.ts +15 -0
- package/dist/api/public/prompts/slug/[slug].d.ts.map +1 -0
- package/dist/api/public/prompts/slug/[slug].js +40 -0
- package/dist/api/public/prompts/user/[username].d.ts +17 -0
- package/dist/api/public/prompts/user/[username].d.ts.map +1 -0
- package/dist/api/public/prompts/user/[username].js +51 -0
- package/dist/api/public/prompts.d.ts +15 -0
- package/dist/api/public/prompts.d.ts.map +1 -0
- package/dist/api/public/prompts.js +45 -0
- package/dist/api/public/token-packs.d.ts +11 -0
- package/dist/api/public/token-packs.d.ts.map +1 -0
- package/dist/api/public/token-packs.js +25 -0
- package/dist/api/public/token-pricing.d.ts +44 -0
- package/dist/api/public/token-pricing.d.ts.map +1 -0
- package/dist/api/public/token-pricing.js +168 -0
- package/dist/api/public/v1/_lib/artifacts.d.ts +52 -0
- package/dist/api/public/v1/_lib/artifacts.d.ts.map +1 -0
- package/dist/api/public/v1/_lib/artifacts.js +217 -0
- package/dist/api/public/v1/_lib/auth.d.ts +43 -0
- package/dist/api/public/v1/_lib/auth.d.ts.map +1 -0
- package/dist/api/public/v1/_lib/auth.js +108 -0
- package/dist/api/public/v1/_lib/errors.d.ts +17 -0
- package/dist/api/public/v1/_lib/errors.d.ts.map +1 -0
- package/dist/api/public/v1/_lib/errors.js +16 -0
- package/dist/api/public/v1/_lib/log.d.ts +29 -0
- package/dist/api/public/v1/_lib/log.d.ts.map +1 -0
- package/dist/api/public/v1/_lib/log.js +68 -0
- package/dist/api/public/v1/_lib/quota.d.ts +24 -0
- package/dist/api/public/v1/_lib/quota.d.ts.map +1 -0
- package/dist/api/public/v1/_lib/quota.js +118 -0
- package/dist/api/public/v1/_lib/router.d.ts +54 -0
- package/dist/api/public/v1/_lib/router.d.ts.map +1 -0
- package/dist/api/public/v1/_lib/router.js +119 -0
- package/dist/api/public/v1/connect.d.ts +20 -0
- package/dist/api/public/v1/connect.d.ts.map +1 -0
- package/dist/api/public/v1/connect.js +119 -0
- package/dist/api/public/v1/doc.d.ts +239 -0
- package/dist/api/public/v1/doc.d.ts.map +1 -0
- package/dist/api/public/v1/doc.js +253 -0
- package/dist/api/public/v1/history/[id].d.ts +92 -0
- package/dist/api/public/v1/history/[id].d.ts.map +1 -0
- package/dist/api/public/v1/history/[id].js +176 -0
- package/dist/api/public/v1/history.d.ts +30 -0
- package/dist/api/public/v1/history.d.ts.map +1 -0
- package/dist/api/public/v1/history.js +142 -0
- package/dist/api/public/v1/image-ai.d.ts +24 -0
- package/dist/api/public/v1/image-ai.d.ts.map +1 -0
- package/dist/api/public/v1/image-ai.js +233 -0
- package/dist/api/public/v1/prompts.d.ts +19 -0
- package/dist/api/public/v1/prompts.d.ts.map +1 -0
- package/dist/api/public/v1/prompts.js +107 -0
- package/dist/api/public/v1/provider.d.ts +16 -0
- package/dist/api/public/v1/provider.d.ts.map +1 -0
- package/dist/api/public/v1/provider.js +130 -0
- package/dist/api/public/v1/purchase.d.ts +11 -0
- package/dist/api/public/v1/purchase.d.ts.map +1 -0
- package/dist/api/public/v1/purchase.js +18 -0
- package/dist/api/public/v1/status.d.ts +35 -0
- package/dist/api/public/v1/status.d.ts.map +1 -0
- package/dist/api/public/v1/status.js +163 -0
- package/dist/api/public/v1/text-ai.d.ts +26 -0
- package/dist/api/public/v1/text-ai.d.ts.map +1 -0
- package/dist/api/public/v1/text-ai.js +239 -0
- package/dist/api/public/webhook.d.ts.map +1 -1
- package/dist/api/public/webhook.js +50 -39
- package/dist/api/track-usage.d.ts +12 -0
- package/dist/api/track-usage.d.ts.map +1 -0
- package/dist/api/track-usage.js +37 -0
- package/dist/components/Doc.d.ts.map +1 -1
- package/dist/components/Doc.js +1 -1
- package/dist/components/DocUsageCustom.js +6 -6
- package/dist/components/admin/UserTokenTab.d.ts.map +1 -1
- package/dist/components/admin/UserTokenTab.js +170 -23
- package/dist/components/auth/AuthDashboardAi.d.ts +2 -0
- package/dist/components/auth/AuthDashboardAi.d.ts.map +1 -0
- package/dist/components/auth/AuthDashboardAi.js +53 -0
- package/dist/docs/REFACTORING_BILLING_GUIDE.d.ts +277 -0
- package/dist/docs/REFACTORING_BILLING_GUIDE.d.ts.map +1 -0
- package/dist/docs/REFACTORING_BILLING_GUIDE.js +276 -0
- package/dist/index.d.ts +15 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -1
- package/dist/scripts/migrate-tokens-to-wallet.d.ts +13 -0
- package/dist/scripts/migrate-tokens-to-wallet.d.ts.map +1 -0
- package/dist/scripts/migrate-tokens-to-wallet.js +165 -0
- package/dist/server/__tests__/billing.test.d.ts +5 -0
- package/dist/server/__tests__/billing.test.d.ts.map +1 -0
- package/dist/server/__tests__/billing.test.js +223 -0
- package/dist/server/ai-client.d.ts +59 -0
- package/dist/server/ai-client.d.ts.map +1 -0
- package/dist/server/ai-client.js +111 -0
- package/dist/server/ai-generation-service.d.ts +66 -0
- package/dist/server/ai-generation-service.d.ts.map +1 -0
- package/dist/server/ai-generation-service.js +274 -0
- package/dist/server/billing.d.ts +200 -0
- package/dist/server/billing.d.ts.map +1 -0
- package/dist/server/billing.js +488 -0
- package/dist/server/gateway-service.d.ts +13 -0
- package/dist/server/gateway-service.d.ts.map +1 -0
- package/dist/server/gateway-service.js +161 -0
- package/dist/server/global-settings.d.ts +16 -0
- package/dist/server/global-settings.d.ts.map +1 -0
- package/dist/server/global-settings.js +42 -0
- package/dist/server/model-filter.d.ts +25 -0
- package/dist/server/model-filter.d.ts.map +1 -0
- package/dist/server/model-filter.js +240 -0
- package/dist/server/ocr.d.ts +39 -0
- package/dist/server/ocr.d.ts.map +1 -0
- package/dist/server/ocr.js +280 -0
- package/dist/server/openai-client.d.ts +19 -0
- package/dist/server/openai-client.d.ts.map +1 -0
- package/dist/server/openai-client.js +26 -0
- package/dist/server/pricing-config.d.ts +18 -0
- package/dist/server/pricing-config.d.ts.map +1 -0
- package/dist/server/pricing-config.js +94 -0
- package/dist/server/pricing-validator.d.ts +41 -0
- package/dist/server/pricing-validator.d.ts.map +1 -0
- package/dist/server/pricing-validator.js +113 -0
- package/dist/server/pricing.d.ts +121 -0
- package/dist/server/pricing.d.ts.map +1 -0
- package/dist/server/pricing.js +225 -0
- package/dist/server/quota.d.ts +66 -0
- package/dist/server/quota.d.ts.map +1 -0
- package/dist/server/quota.js +538 -0
- package/dist/server/wallet-repair.d.ts +32 -0
- package/dist/server/wallet-repair.d.ts.map +1 -0
- package/dist/server/wallet-repair.js +189 -0
- package/dist/server.d.ts +13 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +87 -16
- package/dist/sitemap/handlers/prompts.d.ts +6 -0
- package/dist/sitemap/handlers/prompts.d.ts.map +1 -0
- package/dist/sitemap/handlers/prompts.js +72 -0
- package/dist/sitemap/handlers/users.d.ts +6 -0
- package/dist/sitemap/handlers/users.d.ts.map +1 -0
- package/dist/sitemap/handlers/users.js +80 -0
- package/dist/sitemap/manifest.d.ts +8 -0
- package/dist/sitemap/manifest.d.ts.map +1 -0
- package/dist/sitemap/manifest.js +27 -0
- package/dist/types/gateway.d.ts +40 -0
- package/dist/types/gateway.d.ts.map +1 -0
- package/dist/types/gateway.js +4 -0
- package/dist/types/quota.d.ts +74 -0
- package/dist/types/quota.d.ts.map +1 -0
- package/dist/types/quota.js +11 -0
- package/dist/utils/date.d.ts +7 -0
- package/dist/utils/date.d.ts.map +1 -0
- package/dist/utils/date.js +17 -0
- package/dist/web/admin/AdminTokenPacksPage.js +1 -1
- package/dist/web/admin/BillingAnalyticsPage.d.ts +2 -0
- package/dist/web/admin/BillingAnalyticsPage.d.ts.map +1 -0
- package/dist/web/admin/BillingAnalyticsPage.js +141 -0
- package/dist/web/admin/GlobalAISettingsPage.d.ts +2 -0
- package/dist/web/admin/GlobalAISettingsPage.d.ts.map +1 -0
- package/dist/web/admin/GlobalAISettingsPage.js +93 -0
- package/dist/web/admin/UserTokenPage.d.ts.map +1 -1
- package/dist/web/admin/UserTokenPage.js +20 -7
- package/dist/web/auth/AISettingsPage.d.ts +2 -0
- package/dist/web/auth/AISettingsPage.d.ts.map +1 -0
- package/dist/web/auth/AISettingsPage.js +258 -0
- package/dist/web/auth/APIKeysPage.d.ts +2 -0
- package/dist/web/auth/APIKeysPage.d.ts.map +1 -0
- package/dist/web/auth/APIKeysPage.js +154 -0
- package/dist/web/auth/HistoryPage.d.ts +2 -0
- package/dist/web/auth/HistoryPage.d.ts.map +1 -0
- package/dist/web/auth/HistoryPage.js +279 -0
- package/dist/web/auth/PromptsPage.d.ts +5 -0
- package/dist/web/auth/PromptsPage.d.ts.map +1 -0
- package/dist/web/auth/PromptsPage.js +137 -0
- package/dist/web/auth/TokenPage.d.ts.map +1 -1
- package/dist/web/auth/TokenPage.js +88 -31
- package/dist/web/auth/UsageAndTokensPage.d.ts +2 -0
- package/dist/web/auth/UsageAndTokensPage.d.ts.map +1 -0
- package/dist/web/auth/UsageAndTokensPage.js +157 -0
- package/dist/web/auth/UsagePage.d.ts +2 -0
- package/dist/web/auth/UsagePage.d.ts.map +1 -0
- package/dist/web/auth/UsagePage.js +62 -0
- package/dist/web/auth/components/ApiKeyFilterSelect.d.ts +13 -0
- package/dist/web/auth/components/ApiKeyFilterSelect.d.ts.map +1 -0
- package/dist/web/auth/components/ApiKeyFilterSelect.js +16 -0
- package/dist/web/auth/components/ModelUsageTable.d.ts +19 -0
- package/dist/web/auth/components/ModelUsageTable.d.ts.map +1 -0
- package/dist/web/auth/components/ModelUsageTable.js +37 -0
- package/dist/web/auth/components/PurchaseButton.d.ts +7 -0
- package/dist/web/auth/components/PurchaseButton.d.ts.map +1 -0
- package/dist/web/auth/components/PurchaseButton.js +13 -0
- package/dist/web/auth/components/TokenHistoryCard.d.ts +20 -0
- package/dist/web/auth/components/TokenHistoryCard.d.ts.map +1 -0
- package/dist/web/auth/components/TokenHistoryCard.js +76 -0
- package/dist/web/auth/components/TokenKpiGrid.d.ts +24 -0
- package/dist/web/auth/components/TokenKpiGrid.d.ts.map +1 -0
- package/dist/web/auth/components/TokenKpiGrid.js +38 -0
- package/dist/web/auth/components/UsageByDayChart.d.ts +11 -0
- package/dist/web/auth/components/UsageByDayChart.d.ts.map +1 -0
- package/dist/web/auth/components/UsageByDayChart.js +32 -0
- package/dist/web/auth/components/UsageByModelBarChart.d.ts +12 -0
- package/dist/web/auth/components/UsageByModelBarChart.d.ts.map +1 -0
- package/dist/web/auth/components/UsageByModelBarChart.js +32 -0
- package/dist/web/auth/components/WalletStatusCard.d.ts +9 -0
- package/dist/web/auth/components/WalletStatusCard.d.ts.map +1 -0
- package/dist/web/auth/components/WalletStatusCard.js +50 -0
- package/dist/web/components/ImageGenerative.d.ts +3 -1
- package/dist/web/components/ImageGenerative.d.ts.map +1 -1
- package/dist/web/components/ImageGenerative.js +139 -52
- package/dist/web/components/TextareaGenerative.d.ts +3 -1
- package/dist/web/components/TextareaGenerative.d.ts.map +1 -1
- package/dist/web/components/TextareaGenerative.js +10 -5
- package/dist/web/public/PromptDetailPage.d.ts +25 -0
- package/dist/web/public/PromptDetailPage.d.ts.map +1 -0
- package/dist/web/public/PromptDetailPage.js +71 -0
- package/dist/web/public/PromptDetailPageServer.d.ts +15 -0
- package/dist/web/public/PromptDetailPageServer.d.ts.map +1 -0
- package/dist/web/public/PromptDetailPageServer.js +68 -0
- package/dist/web/public/PublicPromptsPage.d.ts +5 -0
- package/dist/web/public/PublicPromptsPage.d.ts.map +1 -0
- package/dist/web/public/PublicPromptsPage.js +110 -0
- package/dist/web/public/PurchaseTokensPage.d.ts +2 -0
- package/dist/web/public/PurchaseTokensPage.d.ts.map +1 -0
- package/dist/web/public/PurchaseTokensPage.js +98 -0
- package/dist/web/public/UserAvatar.d.ts +13 -0
- package/dist/web/public/UserAvatar.d.ts.map +1 -0
- package/dist/web/public/UserAvatar.js +13 -0
- package/dist/web/public/UserDetailPageServer.d.ts +15 -0
- package/dist/web/public/UserDetailPageServer.d.ts.map +1 -0
- package/dist/web/public/UserDetailPageServer.js +31 -0
- package/dist/web/public/UserPromptsPage.d.ts +9 -0
- package/dist/web/public/UserPromptsPage.d.ts.map +1 -0
- package/dist/web/public/UserPromptsPage.js +112 -0
- package/dist/web/public/UserPromptsPageServer.d.ts +15 -0
- package/dist/web/public/UserPromptsPageServer.d.ts.map +1 -0
- package/dist/web/public/UserPromptsPageServer.js +31 -0
- package/package.json +18 -9
- package/supabase/migrations/20251125000000_ai_tokens.sql +7 -0
- package/supabase/migrations/20260123100002_user_token_quota_monthly copy.sql +173 -0
- package/supabase/migrations/20260128100003_update_and_add_table.sql +368 -0
- package/supabase/migrations/20260128120000_seed_providers_models.sql +78 -0
- package/supabase/migrations/20260128131405_add_api_key_id_to_ledgers.sql +41 -0
- package/supabase/migrations/20260128140000_ai_artifacts_storage.sql +99 -0
- package/supabase/migrations/20260128140002_ai_user_settings.sql +57 -0
- package/supabase/migrations/20260128150000_drop_ai_user_settings.sql +21 -0
- package/supabase/migrations/20260128160000_wallet_billing_system.sql +192 -0
- package/supabase/migrations/20260128160001_wallet_rpc_functions.sql +165 -0
- package/supabase/migrations/20260128170000_add_pack_coef_to_token_packs.sql +30 -0
- package/supabase/migrations/20260129120000_wallet_view_rpc.sql +41 -0
- package/supabase/migrations/20260129220003_update_pack_margins.sql +31 -0
- package/supabase/migrations/20260129330004_ai_user_prompts.sql +151 -0
- package/supabase/migrations/20260129330005_ai_prompts_ip_tracking.sql +92 -0
- package/supabase/migrations/20260129330006_ai_prompts_slug.sql +64 -0
- package/supabase/migrations/20260129330007_ai_prompts_view_slug.sql +26 -0
- package/supabase/migrations/20260129440000_ai_prompts_view_username.sql +33 -0
- package/supabase/migrations/20260129450000_ai_prompts_add_lang.sql +40 -0
- package/supabase/migrations/20260131000000_extract_model_prompt_in_ledger.sql +92 -0
- package/supabase/migrations/20260131140000_fix_duplicate_purchases.sql +64 -0
- package/supabase/migrations/20260201120000_module-ai_default_models.sql +63 -0
- package/supabase/migrations/20260201130000_module-ai_remove_provider_tables.sql +17 -0
- package/supabase/migrations-down/20251217120000_user_token_quota_monthly.sql +34 -0
- package/supabase/migrations-down/20260128131405_add_api_key_id_to_ledgers.sql +25 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 📦 Module ai
|
|
2
2
|
|
|
3
|
-
> @lastbrain/module-ai
|
|
3
|
+
> Module @lastbrain/module-ai
|
|
4
4
|
|
|
5
5
|
## 📋 Informations
|
|
6
6
|
|
|
@@ -19,6 +19,36 @@
|
|
|
19
19
|
- **GET** `/user-token` - UserTokenPage
|
|
20
20
|
- **GET** `/token-packs` - AdminTokenPacksPage
|
|
21
21
|
|
|
22
|
+
## 🔌 API Routes
|
|
23
|
+
|
|
24
|
+
### `/api/ai/generate-text`
|
|
25
|
+
|
|
26
|
+
**Méthodes supportées**: POST
|
|
27
|
+
|
|
28
|
+
### `/api/ai/generate-image`
|
|
29
|
+
|
|
30
|
+
**Méthodes supportées**: POST
|
|
31
|
+
|
|
32
|
+
### `/api/ai/process-ocr`
|
|
33
|
+
|
|
34
|
+
**Méthodes supportées**: POST
|
|
35
|
+
|
|
36
|
+
### `/api/ai/user/tokens`
|
|
37
|
+
|
|
38
|
+
**Méthodes supportées**: GET
|
|
39
|
+
|
|
40
|
+
### `/api/ai/auth/token-packs`
|
|
41
|
+
|
|
42
|
+
**Méthodes supportées**: GET
|
|
43
|
+
|
|
44
|
+
### `/api/ai/auth/token-checkout`
|
|
45
|
+
|
|
46
|
+
**Méthodes supportées**: POST
|
|
47
|
+
|
|
48
|
+
### `/api/ai/admin/token-packs`
|
|
49
|
+
|
|
50
|
+
**Méthodes supportées**: GET, POST
|
|
51
|
+
|
|
22
52
|
## 🗄️ Base de Données
|
|
23
53
|
|
|
24
54
|
### Tables
|
|
@@ -53,10 +83,31 @@
|
|
|
53
83
|
/>
|
|
54
84
|
```
|
|
55
85
|
|
|
86
|
+
#### `user_token_quota_monthly`
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
<TableStructure
|
|
90
|
+
tableName="user_token_quota_monthly"
|
|
91
|
+
title="user_token_quota_monthly"
|
|
92
|
+
description="Table user_token_quota_monthly du module ai"
|
|
93
|
+
/>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### `user_token_quota_ledger`
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
<TableStructure
|
|
100
|
+
tableName="user_token_quota_ledger"
|
|
101
|
+
title="user_token_quota_ledger"
|
|
102
|
+
description="Table user_token_quota_ledger du module ai"
|
|
103
|
+
/>
|
|
104
|
+
```
|
|
105
|
+
|
|
56
106
|
### Migrations
|
|
57
107
|
|
|
58
108
|
- `20251125000000_ai_tokens.sql`
|
|
59
109
|
- `20251201000000_token_packs.sql`
|
|
110
|
+
- `20260123100002_user_token_quota_monthly.sql`
|
|
60
111
|
|
|
61
112
|
## 📦 Installation
|
|
62
113
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai.build.config.d.ts","sourceRoot":"","sources":["../src/ai.build.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,QAAA,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"ai.build.config.d.ts","sourceRoot":"","sources":["../src/ai.build.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,QAAA,MAAM,WAAW,EAAE,iBA0pBlB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
package/dist/ai.build.config.js
CHANGED
|
@@ -1,10 +1,61 @@
|
|
|
1
1
|
const buildConfig = {
|
|
2
2
|
moduleName: "@lastbrain/module-ai",
|
|
3
3
|
pages: [
|
|
4
|
+
{
|
|
5
|
+
section: "public",
|
|
6
|
+
path: "/purchase-tokens",
|
|
7
|
+
componentExport: "PurchaseTokensPage",
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
section: "auth",
|
|
11
|
+
path: "/tokens",
|
|
12
|
+
componentExport: "UsageAndTokensPage",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
section: "auth",
|
|
16
|
+
path: "/settings",
|
|
17
|
+
componentExport: "AISettingsPage",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
section: "auth",
|
|
21
|
+
path: "/api-keys",
|
|
22
|
+
componentExport: "APIKeysPage",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
section: "auth",
|
|
26
|
+
path: "/history",
|
|
27
|
+
componentExport: "HistoryPage",
|
|
28
|
+
},
|
|
4
29
|
{
|
|
5
30
|
section: "auth",
|
|
6
|
-
path: "/
|
|
7
|
-
componentExport: "
|
|
31
|
+
path: "/prompts",
|
|
32
|
+
componentExport: "PromptsPage",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
section: "public",
|
|
36
|
+
path: "/prompts",
|
|
37
|
+
componentExport: "PublicPromptsPage",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
section: "public",
|
|
41
|
+
path: "/user/[username]",
|
|
42
|
+
componentExport: "UserDetailPageServer",
|
|
43
|
+
metadataExport: "generateMetadata",
|
|
44
|
+
entryPoint: "server",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
section: "public",
|
|
48
|
+
path: "/prompts/user/[username]",
|
|
49
|
+
componentExport: "UserPromptsPageServer",
|
|
50
|
+
metadataExport: "generateMetadata",
|
|
51
|
+
entryPoint: "server",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
section: "public",
|
|
55
|
+
path: "/prompts/[slug]",
|
|
56
|
+
componentExport: "PromptDetailPageServer",
|
|
57
|
+
metadataExport: "generateMetadata",
|
|
58
|
+
entryPoint: "server",
|
|
8
59
|
},
|
|
9
60
|
{
|
|
10
61
|
section: "admin",
|
|
@@ -16,6 +67,16 @@ const buildConfig = {
|
|
|
16
67
|
path: "/token-packs",
|
|
17
68
|
componentExport: "AdminTokenPacksPage",
|
|
18
69
|
},
|
|
70
|
+
{
|
|
71
|
+
section: "admin",
|
|
72
|
+
path: "/billing-analytics",
|
|
73
|
+
componentExport: "BillingAnalyticsPage",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
section: "admin",
|
|
77
|
+
path: "/global-ai-settings",
|
|
78
|
+
componentExport: "GlobalAISettingsPage",
|
|
79
|
+
},
|
|
19
80
|
],
|
|
20
81
|
apis: [
|
|
21
82
|
// Routes de génération IA
|
|
@@ -33,6 +94,13 @@ const buildConfig = {
|
|
|
33
94
|
entryPoint: "api/auth/generate-image",
|
|
34
95
|
authRequired: true,
|
|
35
96
|
},
|
|
97
|
+
{
|
|
98
|
+
method: "POST",
|
|
99
|
+
path: "/api/ai/process-ocr",
|
|
100
|
+
handlerExport: "POST",
|
|
101
|
+
entryPoint: "api/auth/process-ocr",
|
|
102
|
+
authRequired: true,
|
|
103
|
+
},
|
|
36
104
|
// Route utilisateur pour les tokens
|
|
37
105
|
{
|
|
38
106
|
method: "GET",
|
|
@@ -49,6 +117,14 @@ const buildConfig = {
|
|
|
49
117
|
entryPoint: "api/auth/token-packs",
|
|
50
118
|
authRequired: true,
|
|
51
119
|
},
|
|
120
|
+
// Token packs - Public route
|
|
121
|
+
{
|
|
122
|
+
method: "GET",
|
|
123
|
+
path: "/api/public/token-packs",
|
|
124
|
+
handlerExport: "GET",
|
|
125
|
+
entryPoint: "api/public/token-packs",
|
|
126
|
+
authRequired: false,
|
|
127
|
+
},
|
|
52
128
|
{
|
|
53
129
|
method: "POST",
|
|
54
130
|
path: "/api/ai/auth/token-checkout",
|
|
@@ -56,6 +132,50 @@ const buildConfig = {
|
|
|
56
132
|
entryPoint: "api/auth/token-checkout",
|
|
57
133
|
authRequired: true,
|
|
58
134
|
},
|
|
135
|
+
// Wallet route
|
|
136
|
+
{
|
|
137
|
+
method: "GET",
|
|
138
|
+
path: "/api/ai/auth/wallet",
|
|
139
|
+
handlerExport: "GET",
|
|
140
|
+
entryPoint: "api/auth/wallet/route",
|
|
141
|
+
authRequired: true,
|
|
142
|
+
},
|
|
143
|
+
// User prompts - Auth routes
|
|
144
|
+
{
|
|
145
|
+
method: "GET",
|
|
146
|
+
path: "/api/ai/auth/prompts",
|
|
147
|
+
handlerExport: "GET",
|
|
148
|
+
entryPoint: "api/auth/prompts",
|
|
149
|
+
authRequired: true,
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
method: "POST",
|
|
153
|
+
path: "/api/ai/auth/prompts",
|
|
154
|
+
handlerExport: "POST",
|
|
155
|
+
entryPoint: "api/auth/prompts",
|
|
156
|
+
authRequired: true,
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
method: "PUT",
|
|
160
|
+
path: "/api/ai/auth/prompts",
|
|
161
|
+
handlerExport: "PUT",
|
|
162
|
+
entryPoint: "api/auth/prompts",
|
|
163
|
+
authRequired: true,
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
method: "DELETE",
|
|
167
|
+
path: "/api/ai/auth/prompts",
|
|
168
|
+
handlerExport: "DELETE",
|
|
169
|
+
entryPoint: "api/auth/prompts",
|
|
170
|
+
authRequired: true,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
method: "POST",
|
|
174
|
+
path: "/api/ai/auth/prompts/stats",
|
|
175
|
+
handlerExport: "POST",
|
|
176
|
+
entryPoint: "api/auth/prompts/stats",
|
|
177
|
+
authRequired: true,
|
|
178
|
+
},
|
|
59
179
|
// Token packs - Admin routes
|
|
60
180
|
{
|
|
61
181
|
method: "GET",
|
|
@@ -107,6 +227,52 @@ const buildConfig = {
|
|
|
107
227
|
entryPoint: "api/admin/user-token/[id]",
|
|
108
228
|
authRequired: true,
|
|
109
229
|
},
|
|
230
|
+
// Billing analytics admin route
|
|
231
|
+
{
|
|
232
|
+
method: "GET",
|
|
233
|
+
path: "/api/ai/admin/billing-analytics",
|
|
234
|
+
handlerExport: "GET",
|
|
235
|
+
entryPoint: "api/admin/billing-analytics",
|
|
236
|
+
authRequired: true,
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
method: "GET",
|
|
240
|
+
path: "/api/ai/admin/user-monthly-details",
|
|
241
|
+
handlerExport: "GET",
|
|
242
|
+
entryPoint: "api/admin/user-monthly-details",
|
|
243
|
+
authRequired: true,
|
|
244
|
+
},
|
|
245
|
+
// Global AI settings admin route
|
|
246
|
+
{
|
|
247
|
+
method: "GET",
|
|
248
|
+
path: "/api/ai/admin/global-ai-settings",
|
|
249
|
+
handlerExport: "GET",
|
|
250
|
+
entryPoint: "api/admin/global-ai-settings",
|
|
251
|
+
authRequired: true,
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
method: "PUT",
|
|
255
|
+
path: "/api/ai/admin/global-ai-settings",
|
|
256
|
+
handlerExport: "PUT",
|
|
257
|
+
entryPoint: "api/admin/global-ai-settings",
|
|
258
|
+
authRequired: true,
|
|
259
|
+
},
|
|
260
|
+
// User wallet analytics admin route
|
|
261
|
+
{
|
|
262
|
+
method: "GET",
|
|
263
|
+
path: "/api/ai/admin/user-wallet-analytics",
|
|
264
|
+
handlerExport: "GET",
|
|
265
|
+
entryPoint: "api/admin/user-wallet-analytics",
|
|
266
|
+
authRequired: true,
|
|
267
|
+
},
|
|
268
|
+
// Wallet repair admin route
|
|
269
|
+
{
|
|
270
|
+
method: "POST",
|
|
271
|
+
path: "/api/ai/admin/wallet-repair",
|
|
272
|
+
handlerExport: "POST",
|
|
273
|
+
entryPoint: "api/admin/wallet-repair/route",
|
|
274
|
+
authRequired: true,
|
|
275
|
+
},
|
|
110
276
|
// Webhook for token purchase payments
|
|
111
277
|
{
|
|
112
278
|
method: "POST",
|
|
@@ -115,24 +281,331 @@ const buildConfig = {
|
|
|
115
281
|
entryPoint: "api/public/webhook",
|
|
116
282
|
authRequired: false,
|
|
117
283
|
},
|
|
284
|
+
// Public gateway models (no auth required)
|
|
285
|
+
{
|
|
286
|
+
method: "GET",
|
|
287
|
+
path: "/api/ai/public/gateway-models",
|
|
288
|
+
handlerExport: "GET",
|
|
289
|
+
entryPoint: "api/public/gateway-models",
|
|
290
|
+
authRequired: false,
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
method: "GET",
|
|
294
|
+
path: "/api/ai/public/token-pricing",
|
|
295
|
+
handlerExport: "GET",
|
|
296
|
+
entryPoint: "api/public/token-pricing",
|
|
297
|
+
authRequired: false,
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
method: "GET",
|
|
301
|
+
path: "/api/ai/public/prompts",
|
|
302
|
+
handlerExport: "GET",
|
|
303
|
+
entryPoint: "api/public/prompts",
|
|
304
|
+
authRequired: false,
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
method: "GET",
|
|
308
|
+
path: "/api/ai/public/prompts/slug/[slug]",
|
|
309
|
+
handlerExport: "GET",
|
|
310
|
+
entryPoint: "api/public/prompts/slug/[slug]",
|
|
311
|
+
authRequired: false,
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
method: "GET",
|
|
315
|
+
path: "/api/ai/public/prompts/user/[username]",
|
|
316
|
+
handlerExport: "GET",
|
|
317
|
+
entryPoint: "api/public/prompts/user/[username]",
|
|
318
|
+
authRequired: false,
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
method: "GET",
|
|
322
|
+
path: "/api/ai/public/prompts/[id]/view",
|
|
323
|
+
handlerExport: "GET",
|
|
324
|
+
entryPoint: "api/public/prompts/[id]/view",
|
|
325
|
+
authRequired: false,
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
method: "POST",
|
|
329
|
+
path: "/api/ai/public/prompts/[id]/stats",
|
|
330
|
+
handlerExport: "POST",
|
|
331
|
+
entryPoint: "api/public/prompts/[id]/stats",
|
|
332
|
+
authRequired: false,
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
method: "POST",
|
|
336
|
+
path: "/api/ai/track-usage",
|
|
337
|
+
handlerExport: "POST",
|
|
338
|
+
entryPoint: "api/track-usage",
|
|
339
|
+
authRequired: false,
|
|
340
|
+
},
|
|
341
|
+
// Public API v1 routes
|
|
342
|
+
{
|
|
343
|
+
method: "GET",
|
|
344
|
+
path: "/api/public/v1/doc",
|
|
345
|
+
handlerExport: "GET",
|
|
346
|
+
entryPoint: "api/public/v1/doc",
|
|
347
|
+
authRequired: false,
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
method: "GET",
|
|
351
|
+
path: "/api/public/v1/status",
|
|
352
|
+
handlerExport: "GET",
|
|
353
|
+
entryPoint: "api/public/v1/status",
|
|
354
|
+
authRequired: false,
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
method: "POST",
|
|
358
|
+
path: "/api/public/v1/connect",
|
|
359
|
+
handlerExport: "POST",
|
|
360
|
+
entryPoint: "api/public/v1/connect",
|
|
361
|
+
authRequired: false,
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
method: "GET",
|
|
365
|
+
path: "/api/public/v1/provider",
|
|
366
|
+
handlerExport: "GET",
|
|
367
|
+
entryPoint: "api/public/v1/provider",
|
|
368
|
+
authRequired: false,
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
method: "POST",
|
|
372
|
+
path: "/api/public/v1/text-ai",
|
|
373
|
+
handlerExport: "POST",
|
|
374
|
+
entryPoint: "api/public/v1/text-ai",
|
|
375
|
+
authRequired: false,
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
method: "POST",
|
|
379
|
+
path: "/api/public/v1/image-ai",
|
|
380
|
+
handlerExport: "POST",
|
|
381
|
+
entryPoint: "api/public/v1/image-ai",
|
|
382
|
+
authRequired: false,
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
method: "GET",
|
|
386
|
+
path: "/api/public/v1/purchase",
|
|
387
|
+
handlerExport: "GET",
|
|
388
|
+
entryPoint: "api/public/v1/purchase",
|
|
389
|
+
authRequired: false,
|
|
390
|
+
},
|
|
391
|
+
// Public API v1 - History routes
|
|
392
|
+
{
|
|
393
|
+
method: "GET",
|
|
394
|
+
path: "/api/public/v1/history",
|
|
395
|
+
handlerExport: "GET",
|
|
396
|
+
entryPoint: "api/public/v1/history",
|
|
397
|
+
authRequired: false,
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
method: "GET",
|
|
401
|
+
path: "/api/public/v1/history/[id]",
|
|
402
|
+
handlerExport: "GET",
|
|
403
|
+
entryPoint: "api/public/v1/history/[id]",
|
|
404
|
+
authRequired: false,
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
method: "DELETE",
|
|
408
|
+
path: "/api/public/v1/history/[id]",
|
|
409
|
+
handlerExport: "DELETE",
|
|
410
|
+
entryPoint: "api/public/v1/history/[id]",
|
|
411
|
+
authRequired: false,
|
|
412
|
+
},
|
|
413
|
+
// Public API v1 - Prompts routes
|
|
414
|
+
{
|
|
415
|
+
method: "GET",
|
|
416
|
+
path: "/api/public/v1/prompts",
|
|
417
|
+
handlerExport: "GET",
|
|
418
|
+
entryPoint: "api/public/v1/prompts",
|
|
419
|
+
authRequired: false,
|
|
420
|
+
},
|
|
421
|
+
// Token balance (quota + purchased)
|
|
422
|
+
{
|
|
423
|
+
method: "GET",
|
|
424
|
+
path: "/api/ai/auth/token-balance",
|
|
425
|
+
handlerExport: "GET",
|
|
426
|
+
entryPoint: "api/auth/token-balance",
|
|
427
|
+
authRequired: true,
|
|
428
|
+
},
|
|
429
|
+
// User usage stats
|
|
430
|
+
{
|
|
431
|
+
method: "GET",
|
|
432
|
+
path: "/api/ai/auth/usage",
|
|
433
|
+
handlerExport: "GET",
|
|
434
|
+
entryPoint: "api/auth/usage",
|
|
435
|
+
authRequired: true,
|
|
436
|
+
},
|
|
437
|
+
// User usage by model (detailed)
|
|
438
|
+
{
|
|
439
|
+
method: "GET",
|
|
440
|
+
path: "/api/ai/auth/usage-by-model",
|
|
441
|
+
handlerExport: "GET",
|
|
442
|
+
entryPoint: "api/auth/usage-by-model",
|
|
443
|
+
authRequired: true,
|
|
444
|
+
},
|
|
445
|
+
// User API keys management
|
|
446
|
+
{
|
|
447
|
+
method: "GET",
|
|
448
|
+
path: "/api/ai/auth/api-keys",
|
|
449
|
+
handlerExport: "GET",
|
|
450
|
+
entryPoint: "api/auth/api-keys",
|
|
451
|
+
authRequired: true,
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
method: "POST",
|
|
455
|
+
path: "/api/ai/auth/api-keys",
|
|
456
|
+
handlerExport: "POST",
|
|
457
|
+
entryPoint: "api/auth/api-keys",
|
|
458
|
+
authRequired: true,
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
method: "DELETE",
|
|
462
|
+
path: "/api/ai/auth/api-keys/[id]",
|
|
463
|
+
handlerExport: "DELETE",
|
|
464
|
+
entryPoint: "api/auth/api-keys/[id]",
|
|
465
|
+
authRequired: true,
|
|
466
|
+
},
|
|
467
|
+
// Admin quota management
|
|
468
|
+
{
|
|
469
|
+
method: "GET",
|
|
470
|
+
path: "/api/ai/admin/user-quota",
|
|
471
|
+
handlerExport: "GET",
|
|
472
|
+
entryPoint: "api/admin/user-quota",
|
|
473
|
+
authRequired: true,
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
method: "POST",
|
|
477
|
+
path: "/api/ai/admin/user-quota",
|
|
478
|
+
handlerExport: "POST",
|
|
479
|
+
entryPoint: "api/admin/user-quota",
|
|
480
|
+
authRequired: true,
|
|
481
|
+
},
|
|
482
|
+
// AI Settings
|
|
483
|
+
{
|
|
484
|
+
method: "GET",
|
|
485
|
+
path: "/api/ai/auth/ai-settings",
|
|
486
|
+
handlerExport: "GET",
|
|
487
|
+
entryPoint: "api/auth/ai-settings",
|
|
488
|
+
authRequired: true,
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
method: "PUT",
|
|
492
|
+
path: "/api/ai/auth/ai-settings",
|
|
493
|
+
handlerExport: "PUT",
|
|
494
|
+
entryPoint: "api/auth/ai-settings",
|
|
495
|
+
authRequired: true,
|
|
496
|
+
},
|
|
497
|
+
// AI Model Settings (Gateway)
|
|
498
|
+
{
|
|
499
|
+
method: "GET",
|
|
500
|
+
path: "/api/ai/auth/ai-model-settings",
|
|
501
|
+
handlerExport: "GET",
|
|
502
|
+
entryPoint: "api/auth/ai-model-settings",
|
|
503
|
+
authRequired: true,
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
method: "POST",
|
|
507
|
+
path: "/api/ai/auth/ai-model-settings",
|
|
508
|
+
handlerExport: "POST",
|
|
509
|
+
entryPoint: "api/auth/ai-model-settings",
|
|
510
|
+
authRequired: true,
|
|
511
|
+
},
|
|
512
|
+
// User usage by model (Analytics)
|
|
513
|
+
{
|
|
514
|
+
method: "GET",
|
|
515
|
+
path: "/api/ai/admin/user-usage-by-model",
|
|
516
|
+
handlerExport: "GET",
|
|
517
|
+
entryPoint: "api/admin/user-usage-by-model",
|
|
518
|
+
authRequired: true,
|
|
519
|
+
},
|
|
118
520
|
],
|
|
119
521
|
migrations: {
|
|
120
522
|
enabled: true,
|
|
121
523
|
priority: 30,
|
|
122
524
|
path: "supabase/migrations",
|
|
123
|
-
files: [
|
|
525
|
+
files: [
|
|
526
|
+
"20251125000000_ai_tokens.sql",
|
|
527
|
+
"20251201000000_token_packs.sql",
|
|
528
|
+
"20260123100002_user_token_quota_monthly.sql",
|
|
529
|
+
"20260128100003_update_and_add_table.sql",
|
|
530
|
+
"20260128120000_seed_providers_models.sql",
|
|
531
|
+
"20260128131405_add_api_key_id_to_ledgers.sql",
|
|
532
|
+
"20260128140000_ai_artifacts_storage.sql",
|
|
533
|
+
"20260128140002_ai_user_settings.sql",
|
|
534
|
+
"20260128150000_drop_ai_user_settings.sql",
|
|
535
|
+
"20260128160000_wallet_billing_system.sql",
|
|
536
|
+
"20260128160001_wallet_rpc_functions.sql",
|
|
537
|
+
"20260128170000_add_pack_coef_to_token_packs.sql",
|
|
538
|
+
"20260129120000_wallet_view_rpc.sql",
|
|
539
|
+
"20260129220003_update_pack_margins.sql",
|
|
540
|
+
"20260129330004_ai_user_prompts.sql",
|
|
541
|
+
"20260129330005_ai_prompts_ip_tracking.sql",
|
|
542
|
+
"20260129330006_ai_prompts_slug.sql",
|
|
543
|
+
"20260129330007_ai_prompts_view_slug.sql",
|
|
544
|
+
"20260129440000_ai_prompts_view_username.sql",
|
|
545
|
+
"20260129450000_ai_prompts_add_lang.sql",
|
|
546
|
+
"20260131000000_extract_model_prompt_in_ledger.sql",
|
|
547
|
+
"20260131140000_fix_duplicate_purchases.sql",
|
|
548
|
+
"20260201120000_module-ai_default_models.sql",
|
|
549
|
+
"20260201130000_module-ai_remove_provider_tables.sql"
|
|
550
|
+
],
|
|
124
551
|
migrationsDownPath: "supabase/migrations-down",
|
|
125
552
|
},
|
|
126
553
|
menu: {
|
|
554
|
+
public: [
|
|
555
|
+
{
|
|
556
|
+
title: "module-ai.menu.pricing",
|
|
557
|
+
description: "module-ai.menu.pricing_desc",
|
|
558
|
+
icon: "Coins",
|
|
559
|
+
path: "/purchase-tokens",
|
|
560
|
+
order: 99,
|
|
561
|
+
shortcut: "cmd+shift+p",
|
|
562
|
+
shortcutDisplay: "⌘⇧P",
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
title: "module-ai.menu.prompts",
|
|
566
|
+
description: "module-ai.menu.prompts_desc",
|
|
567
|
+
icon: "Sparkles",
|
|
568
|
+
path: "/prompts",
|
|
569
|
+
order: 98,
|
|
570
|
+
}
|
|
571
|
+
],
|
|
127
572
|
auth: [
|
|
128
573
|
{
|
|
129
|
-
title: "module-ai.menu.
|
|
130
|
-
description: "module-ai.menu.
|
|
574
|
+
title: "module-ai.menu.tokens_and_usage",
|
|
575
|
+
description: "module-ai.menu.tokens_and_usage_desc",
|
|
131
576
|
icon: "Coins",
|
|
132
|
-
path: "/auth/ai/
|
|
133
|
-
order:
|
|
134
|
-
shortcut: "cmd+shift+
|
|
135
|
-
shortcutDisplay: "⌘⇧
|
|
577
|
+
path: "/auth/ai/tokens",
|
|
578
|
+
order: 102,
|
|
579
|
+
shortcut: "cmd+shift+t",
|
|
580
|
+
shortcutDisplay: "⌘⇧T",
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
title: "module-ai.menu.settings",
|
|
584
|
+
description: "module-ai.menu.settings_desc",
|
|
585
|
+
icon: "Settings",
|
|
586
|
+
path: "/auth/ai/settings",
|
|
587
|
+
order: 104,
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
title: "module-ai.menu.api_keys",
|
|
591
|
+
description: "module-ai.menu.api_keys_desc",
|
|
592
|
+
icon: "Key",
|
|
593
|
+
path: "/auth/ai/api-keys",
|
|
594
|
+
order: 101,
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
title: "module-ai.menu.history",
|
|
598
|
+
description: "module-ai.menu.history_desc",
|
|
599
|
+
icon: "History",
|
|
600
|
+
path: "/auth/ai/history",
|
|
601
|
+
order: 103,
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
title: "module-ai.menu.my_prompts",
|
|
605
|
+
description: "module-ai.menu.my_prompts_desc",
|
|
606
|
+
icon: "Sparkles",
|
|
607
|
+
path: "/auth/ai/prompts",
|
|
608
|
+
order: 105,
|
|
136
609
|
},
|
|
137
610
|
],
|
|
138
611
|
admin: [
|
|
@@ -152,8 +625,32 @@ const buildConfig = {
|
|
|
152
625
|
path: "/admin/ai/token-packs",
|
|
153
626
|
order: 101,
|
|
154
627
|
},
|
|
628
|
+
{
|
|
629
|
+
title: "module-ai.menu.billing_analytics",
|
|
630
|
+
description: "module-ai.menu.billing_analytics_desc",
|
|
631
|
+
icon: "TrendingUp",
|
|
632
|
+
path: "/admin/ai/billing-analytics",
|
|
633
|
+
order: 102,
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
title: "module-ai.menu.global_ai_settings",
|
|
637
|
+
description: "module-ai.menu.global_ai_settings_desc",
|
|
638
|
+
icon: "Settings",
|
|
639
|
+
path: "/admin/ai/global-ai-settings",
|
|
640
|
+
order: 103,
|
|
641
|
+
}
|
|
155
642
|
],
|
|
156
643
|
},
|
|
644
|
+
authDashboard: [
|
|
645
|
+
{
|
|
646
|
+
key: "ai",
|
|
647
|
+
title: "Token",
|
|
648
|
+
icon: "Coins",
|
|
649
|
+
componentExport: "AuthDashboardAi",
|
|
650
|
+
entryPoint: "components/auth/AuthDashboardAi",
|
|
651
|
+
order: 50,
|
|
652
|
+
},
|
|
653
|
+
],
|
|
157
654
|
userTabs: [
|
|
158
655
|
{
|
|
159
656
|
key: "tokens",
|
|
@@ -164,5 +661,7 @@ const buildConfig = {
|
|
|
164
661
|
order: 100,
|
|
165
662
|
},
|
|
166
663
|
],
|
|
664
|
+
// Sitemaps are now managed via src/sitemap/manifest.ts
|
|
665
|
+
// See docs/SITEMAP_GUIDE.md for details
|
|
167
666
|
};
|
|
168
667
|
export default buildConfig;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DEPRECATED: Admin API for single ai_provider_model CRUD
|
|
3
|
+
* @deprecated Tables ai_providers and ai_provider_models have been removed.
|
|
4
|
+
* Use /api/ai/admin/global-ai-settings instead.
|
|
5
|
+
*
|
|
6
|
+
* PUT /api/ai/admin/ai-provider-models/[id] - Update model
|
|
7
|
+
* DELETE /api/ai/admin/ai-provider-models/[id] - Delete model
|
|
8
|
+
*/
|
|
9
|
+
import { NextRequest, NextResponse } from "next/server";
|
|
10
|
+
export declare function PUT(request: NextRequest, { params }: {
|
|
11
|
+
params: Promise<{
|
|
12
|
+
id: string;
|
|
13
|
+
}>;
|
|
14
|
+
}): Promise<NextResponse<{
|
|
15
|
+
error: string;
|
|
16
|
+
deprecated: boolean;
|
|
17
|
+
}>>;
|
|
18
|
+
//# sourceMappingURL=%5Bid%5D.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"[id].d.ts","sourceRoot":"","sources":["../../../../src/api/admin/ai-provider-models/[id].ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGxD,wBAAsB,GAAG,CACvB,OAAO,EAAE,WAAW,EACpB,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;IAUhD"}
|