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.

Files changed (44) hide show
  1. {compair_core-0.4.1 → compair_core-0.4.2}/PKG-INFO +1 -1
  2. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/api.py +23 -10
  3. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/main.py +10 -3
  4. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core.egg-info/PKG-INFO +1 -1
  5. {compair_core-0.4.1 → compair_core-0.4.2}/pyproject.toml +1 -1
  6. {compair_core-0.4.1 → compair_core-0.4.2}/LICENSE +0 -0
  7. {compair_core-0.4.1 → compair_core-0.4.2}/README.md +0 -0
  8. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/__init__.py +0 -0
  9. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/__init__.py +0 -0
  10. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/celery_app.py +0 -0
  11. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/default_groups.py +0 -0
  12. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/embeddings.py +0 -0
  13. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/feedback.py +0 -0
  14. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/logger.py +0 -0
  15. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/models.py +0 -0
  16. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/schema.py +0 -0
  17. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/tasks.py +0 -0
  18. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair/utils.py +0 -0
  19. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair_email/__init__.py +0 -0
  20. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair_email/email.py +0 -0
  21. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair_email/email_core.py +0 -0
  22. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair_email/templates.py +0 -0
  23. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/compair_email/templates_core.py +0 -0
  24. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/__init__.py +0 -0
  25. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/app.py +0 -0
  26. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/deps.py +0 -0
  27. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/local_model/__init__.py +0 -0
  28. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/local_model/app.py +0 -0
  29. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/local_model/ocr.py +0 -0
  30. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/providers/__init__.py +0 -0
  31. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/providers/console_mailer.py +0 -0
  32. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/providers/contracts.py +0 -0
  33. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/providers/local_storage.py +0 -0
  34. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/providers/noop_analytics.py +0 -0
  35. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/providers/noop_billing.py +0 -0
  36. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/providers/noop_ocr.py +0 -0
  37. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/routers/__init__.py +0 -0
  38. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/routers/capabilities.py +0 -0
  39. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core/server/settings.py +0 -0
  40. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core.egg-info/SOURCES.txt +0 -0
  41. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core.egg-info/dependency_links.txt +0 -0
  42. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core.egg-info/requires.txt +0 -0
  43. {compair_core-0.4.1 → compair_core-0.4.2}/compair_core.egg-info/top_level.txt +0 -0
  44. {compair_core-0.4.1 → compair_core-0.4.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compair-core
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: Open-source foundation of the Compair collaboration platform.
5
5
  Author: RocketResearch, Inc.
6
6
  License: MIT
@@ -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
- if IS_CLOUD and _user_plan(current_user) == 'individual' and current_user.status == "active":
1382
- document_limit = 100
1383
- else:
1384
- document_limit = int(os.getenv("COMPAIR_CORE_DOCUMENT_LIMIT", "10"))
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
- raise HTTPException(
1389
- status_code=403,
1390
- detail=f"Document limit reached. Individual plan users can have 100, team plans have 100 times the number of users (pooled); other plans can have 10",
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
- feedback_limit = int(os.getenv("COMPAIR_CORE_FEEDBACK_LIMIT", "5"))
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
- num_chunks_can_generate_feedback = max((feedback_limit - recent_feedback_count), 0)
63
- indices_to_generate_feedback = prioritized_chunk_indices[:num_chunks_can_generate_feedback]
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compair-core
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: Open-source foundation of the Compair collaboration platform.
5
5
  Author: RocketResearch, Inc.
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "compair-core"
7
- version = "0.4.1"
7
+ version = "0.4.2"
8
8
  description = "Open-source foundation of the Compair collaboration platform."
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
File without changes
File without changes
File without changes