|
16 | 16 | import kubechat.chat.message |
17 | 17 | from config import settings |
18 | 18 | from config.celery import app |
19 | | -from kubechat.apps import DefaultQuota, QuotaType |
| 19 | +from kubechat.apps import QuotaType |
20 | 20 | from kubechat.chat.history.redis import RedisChatMessageHistory |
21 | 21 | from kubechat.llm.base import Predictor |
22 | 22 | from kubechat.llm.prompts import DEFAULT_MODEL_PROMPT_TEMPLATES, DEFAULT_CHINESE_PROMPT_TEMPLATE_V2, \ |
@@ -225,10 +225,10 @@ async def create_collection(request, collection: CollectionIn): |
225 | 225 | return fail(HTTPStatus.BAD_REQUEST, error_msg) |
226 | 226 |
|
227 | 227 | # there is quota limit on collection |
228 | | - if DefaultQuota.MAX_COLLECTION_COUNT: |
| 228 | + if settings.MAX_COLLECTION_COUNT: |
229 | 229 | collection_limit = await query_user_quota(user, QuotaType.MAX_COLLECTION_COUNT) |
230 | 230 | if collection_limit is None: |
231 | | - collection_limit = DefaultQuota.MAX_COLLECTION_COUNT |
| 231 | + collection_limit = settings.MAX_COLLECTION_COUNT |
232 | 232 | if collection_limit and await query_collections_count(user) >= collection_limit: |
233 | 233 | return fail(HTTPStatus.FORBIDDEN, f"collection number has reached the limit of {collection_limit}") |
234 | 234 |
|
@@ -353,10 +353,10 @@ async def create_document(request, collection_id, file: List[UploadedFile] = Fil |
353 | 353 | return fail(HTTPStatus.NOT_FOUND, "Collection not found") |
354 | 354 |
|
355 | 355 | # there is quota limit on document |
356 | | - if DefaultQuota.MAX_DOCUMENT_COUNT: |
| 356 | + if settings.MAX_DOCUMENT_COUNT: |
357 | 357 | document_limit = await query_user_quota(user, QuotaType.MAX_DOCUMENT_COUNT) |
358 | 358 | if document_limit is None: |
359 | | - document_limit = DefaultQuota.MAX_DOCUMENT_COUNT |
| 359 | + document_limit = settings.MAX_DOCUMENT_COUNT |
360 | 360 | if await query_documents_count(user, collection_id) >= document_limit: |
361 | 361 | return fail(HTTPStatus.FORBIDDEN, f"document number has reached the limit of {document_limit}") |
362 | 362 |
|
@@ -399,10 +399,10 @@ async def create_url_document(request, collection_id): |
399 | 399 | return fail(HTTPStatus.NOT_FOUND, "Collection not found") |
400 | 400 |
|
401 | 401 | # there is quota limit on document |
402 | | - if DefaultQuota.MAX_DOCUMENT_COUNT: |
| 402 | + if settings.MAX_DOCUMENT_COUNT: |
403 | 403 | document_limit = await query_user_quota(user, QuotaType.MAX_DOCUMENT_COUNT) |
404 | 404 | if document_limit is None: |
405 | | - document_limit = DefaultQuota.MAX_DOCUMENT_COUNT |
| 405 | + document_limit = settings.MAX_DOCUMENT_COUNT |
406 | 406 | if await query_documents_count(user, collection_id) >= document_limit: |
407 | 407 | return fail(HTTPStatus.FORBIDDEN, f"document number has reached the limit of {document_limit}") |
408 | 408 |
|
@@ -603,10 +603,10 @@ async def create_bot(request, bot_in: BotIn): |
603 | 603 | user = get_user(request) |
604 | 604 |
|
605 | 605 | # there is quota limit on bot |
606 | | - if DefaultQuota.MAX_BOT_COUNT: |
| 606 | + if settings.MAX_BOT_COUNT: |
607 | 607 | bot_limit = await query_user_quota(user, QuotaType.MAX_BOT_COUNT) |
608 | 608 | if bot_limit is None: |
609 | | - bot_limit = DefaultQuota.MAX_BOT_COUNT |
| 609 | + bot_limit = settings.MAX_BOT_COUNT |
610 | 610 | if await query_bots_count(user) >= bot_limit: |
611 | 611 | return fail(HTTPStatus.FORBIDDEN, f"bot number has reached the limit of {bot_limit}") |
612 | 612 |
|
|
0 commit comments