refactor(api): remove AI worker, add ai api route, add usage tiers

- Remove separate AI worker service
- Added generation limits:
  FREE: 1000/month (For the beta version)
  PRO: 500/month
  ENTERPRISE: 1000/month
- Integrate AI functionality into main API routes
- Added monthly generations reset and usage tier upgrade API routes
- Upgrade tier page to be added along with profile page section
This commit is contained in:
Akhileshrangani4
2024-11-23 20:31:24 -05:00
parent 4db378b5f1
commit 34994a8c69
29 changed files with 590 additions and 4049 deletions

View File

@ -1,7 +1,7 @@
{
"version": "5",
"dialect": "sqlite",
"id": "afe10bff-362b-402c-bdb5-038341692f35",
"id": "3241d14f-687f-4134-94ab-88bf36e8611e",
"prevId": "00000000-0000-0000-0000-000000000000",
"tables": {
"sandbox": {
@ -140,13 +140,6 @@
"autoincrement": false,
"default": "CURRENT_TIMESTAMP"
},
"image": {
"name": "image",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"generations": {
"name": "generations",
"type": "integer",

View File

@ -1,8 +1,8 @@
{
"version": "5",
"dialect": "sqlite",
"id": "e570d5ac-700d-4e62-8a46-482b21ae1fe1",
"prevId": "afe10bff-362b-402c-bdb5-038341692f35",
"id": "7eafd85c-d63d-43be-aa26-1a0eb2ca1805",
"prevId": "3241d14f-687f-4134-94ab-88bf36e8611e",
"tables": {
"sandbox": {
"name": "sandbox",
@ -147,6 +147,28 @@
"notNull": false,
"autoincrement": false,
"default": 0
},
"tier": {
"name": "tier",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "'FREE'"
},
"tierExpiresAt": {
"name": "tierExpiresAt",
"type": "integer",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"lastResetDate": {
"name": "lastResetDate",
"type": "integer",
"primaryKey": false,
"notNull": false,
"autoincrement": false
}
},
"indexes": {

View File

@ -5,29 +5,15 @@
{
"idx": 0,
"version": "5",
"when": 1731288423588,
"tag": "0000_cuddly_patriot",
"when": 1732400315508,
"tag": "0000_milky_hardball",
"breakpoints": true
},
{
"idx": 1,
"version": "5",
"when": 1731290863632,
"tag": "0001_opposite_newton_destine",
"breakpoints": true
},
{
"idx": 2,
"version": "5",
"when": 1731296235880,
"tag": "0002_rainy_fantastic_four",
"breakpoints": true
},
{
"idx": 3,
"version": "5",
"when": 1731297339306,
"tag": "0003_lying_snowbird",
"when": 1732408530094,
"tag": "0001_freezing_supreme_intelligence",
"breakpoints": true
}
]