compair-core 0.4.1__tar.gz → 0.4.2__tar.gz
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.
Potentially problematic release.
This version of compair-core might be problematic. Click here for more details.
- {compair_core-0.4.1 → compair_core-0.4.2}/PKG-INFO +1 -1
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/api.py +23 -10
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/main.py +10 -3
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core.egg-info/PKG-INFO +1 -1
- {compair_core-0.4.1 → compair_core-0.4.2}/pyproject.toml +1 -1
- {compair_core-0.4.1 → compair_core-0.4.2}/LICENSE +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/README.md +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/__init__.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/__init__.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/celery_app.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/default_groups.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/embeddings.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/feedback.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/logger.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/models.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/schema.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/tasks.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/utils.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair_email/__init__.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair_email/email.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair_email/email_core.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair_email/templates.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair_email/templates_core.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/__init__.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/app.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/deps.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/local_model/__init__.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/local_model/app.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/local_model/ocr.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/providers/__init__.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/providers/console_mailer.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/providers/contracts.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/providers/local_storage.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/providers/noop_analytics.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/providers/noop_billing.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/providers/noop_ocr.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/routers/__init__.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/routers/capabilities.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/settings.py +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core.egg-info/SOURCES.txt +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core.egg-info/dependency_links.txt +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core.egg-info/requires.txt +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/compair_core.egg-info/top_level.txt +0 -0
- {compair_core-0.4.1 → compair_core-0.4.2}/setup.cfg +0 -0
|
@@ -1373,22 +1373,35 @@ def create_doc(
|
|
|
1373
1373
|
current_user.status_change_date = datetime.now(timezone.utc)
|
|
1374
1374
|
session.commit()
|
|
1375
1375
|
|
|
1376
|
-
# Enforce document limits
|
|
1376
|
+
# Enforce document limits (cloud plans) – core runs are unrestricted unless explicitly configured
|
|
1377
1377
|
team = _user_team(current_user)
|
|
1378
|
+
document_limit: int | None = None
|
|
1378
1379
|
if IS_CLOUD and HAS_TEAM and team and current_user.status == "active":
|
|
1379
1380
|
document_limit = team.total_documents_limit # type: ignore[union-attr]
|
|
1381
|
+
elif IS_CLOUD and _user_plan(current_user) == "individual" and current_user.status == "active":
|
|
1382
|
+
document_limit = 100
|
|
1380
1383
|
else:
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1384
|
+
raw_core_limit = os.getenv("COMPAIR_CORE_DOCUMENT_LIMIT")
|
|
1385
|
+
if raw_core_limit:
|
|
1386
|
+
try:
|
|
1387
|
+
document_limit = int(raw_core_limit)
|
|
1388
|
+
except ValueError:
|
|
1389
|
+
document_limit = None
|
|
1390
|
+
|
|
1385
1391
|
document_count = session.query(models.Document).filter(models.Document.user_id == current_user.user_id).count()
|
|
1386
1392
|
|
|
1387
|
-
if document_count >= document_limit:
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1393
|
+
if document_limit is not None and document_count >= document_limit:
|
|
1394
|
+
if IS_CLOUD:
|
|
1395
|
+
detail_msg = (
|
|
1396
|
+
"Document limit reached. Individual plan users can have 100, team plans have 100 times "
|
|
1397
|
+
"the number of users (pooled); other plans can have 10"
|
|
1398
|
+
)
|
|
1399
|
+
else:
|
|
1400
|
+
detail_msg = (
|
|
1401
|
+
f"Document limit of {document_limit} reached. Adjust COMPAIR_CORE_DOCUMENT_LIMIT to raise "
|
|
1402
|
+
"or unset it to remove limits in core deployments."
|
|
1403
|
+
)
|
|
1404
|
+
raise HTTPException(status_code=403, detail=detail_msg)
|
|
1392
1405
|
|
|
1393
1406
|
if not authorid:
|
|
1394
1407
|
authorid = current_user.user_id
|
|
@@ -41,7 +41,11 @@ def process_document(
|
|
|
41
41
|
if prev_content:
|
|
42
42
|
prev_chunks = chunk_text(prev_content[-1])
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
feedback_limit_env = os.getenv("COMPAIR_CORE_FEEDBACK_LIMIT")
|
|
45
|
+
try:
|
|
46
|
+
feedback_limit = int(feedback_limit_env) if feedback_limit_env else None
|
|
47
|
+
except ValueError:
|
|
48
|
+
feedback_limit = None
|
|
45
49
|
time_cutoff = datetime.now(timezone.utc) - timedelta(hours=24)
|
|
46
50
|
|
|
47
51
|
recent_feedback_count = session.query(Feedback).filter(
|
|
@@ -59,8 +63,11 @@ def process_document(
|
|
|
59
63
|
if generate_feedback:
|
|
60
64
|
prioritized_chunk_indices = detect_significant_edits(prev_chunks=prev_chunks, new_chunks=new_chunks)
|
|
61
65
|
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
if feedback_limit is None:
|
|
67
|
+
indices_to_generate_feedback = prioritized_chunk_indices
|
|
68
|
+
else:
|
|
69
|
+
num_chunks_can_generate_feedback = max((feedback_limit - recent_feedback_count), 0)
|
|
70
|
+
indices_to_generate_feedback = prioritized_chunk_indices[:num_chunks_can_generate_feedback]
|
|
64
71
|
|
|
65
72
|
for i, chunk in enumerate(new_chunks):
|
|
66
73
|
should_generate_feedback = i in indices_to_generate_feedback
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|