compair-core 0.3.11__tar.gz → 0.3.13__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.3.11 → compair_core-0.3.13}/PKG-INFO +2 -1
- {compair_core-0.3.11 → compair_core-0.3.13}/README.md +1 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/api.py +48 -15
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/server/app.py +8 -2
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/server/routers/capabilities.py +1 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/server/settings.py +1 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core.egg-info/PKG-INFO +2 -1
- {compair_core-0.3.11 → compair_core-0.3.13}/pyproject.toml +1 -1
- {compair_core-0.3.11 → compair_core-0.3.13}/LICENSE +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/__init__.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/compair/__init__.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/compair/celery_app.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/compair/default_groups.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/compair/embeddings.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/compair/feedback.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/compair/logger.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/compair/main.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/compair/models.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/compair/schema.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/compair/tasks.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/compair/utils.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/compair_email/__init__.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/compair_email/email.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/compair_email/email_core.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/compair_email/templates.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/compair_email/templates_core.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/server/__init__.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/server/deps.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/server/local_model/__init__.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/server/local_model/app.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/server/providers/__init__.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/server/providers/console_mailer.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/server/providers/contracts.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/server/providers/local_storage.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/server/providers/noop_analytics.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/server/providers/noop_billing.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/server/providers/noop_ocr.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core/server/routers/__init__.py +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core.egg-info/SOURCES.txt +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core.egg-info/dependency_links.txt +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core.egg-info/requires.txt +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/compair_core.egg-info/top_level.txt +0 -0
- {compair_core-0.3.11 → compair_core-0.3.13}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: compair-core
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.13
|
|
4
4
|
Summary: Open-source foundation of the Compair collaboration platform.
|
|
5
5
|
Author: RocketResearch, Inc.
|
|
6
6
|
License: MIT
|
|
@@ -91,6 +91,7 @@ Key environment variables for the core edition:
|
|
|
91
91
|
- `COMPAIR_EMAIL_BACKEND` – the core mailer logs emails to stdout; cloud overrides this with transactional delivery.
|
|
92
92
|
- `COMPAIR_REQUIRE_AUTHENTICATION` (`true`) – set to `false` to run the API in single-user mode without login or account management. When disabled, Compair auto-provisions a local user, group, and long-lived session token so you can upload documents immediately.
|
|
93
93
|
- `COMPAIR_SINGLE_USER_USERNAME` / `COMPAIR_SINGLE_USER_NAME` – override the email-style username and display name that are used for the auto-provisioned local user in single-user mode.
|
|
94
|
+
- `COMPAIR_INCLUDE_LEGACY_ROUTES` (`false`) – opt-in to the full legacy API surface (used by the hosted product) when running the core edition. Leave unset to expose only the streamlined single-user endpoints in Swagger.
|
|
94
95
|
|
|
95
96
|
See `compair_core/server/settings.py` for the full settings surface.
|
|
96
97
|
|
|
@@ -56,6 +56,7 @@ Key environment variables for the core edition:
|
|
|
56
56
|
- `COMPAIR_EMAIL_BACKEND` – the core mailer logs emails to stdout; cloud overrides this with transactional delivery.
|
|
57
57
|
- `COMPAIR_REQUIRE_AUTHENTICATION` (`true`) – set to `false` to run the API in single-user mode without login or account management. When disabled, Compair auto-provisions a local user, group, and long-lived session token so you can upload documents immediately.
|
|
58
58
|
- `COMPAIR_SINGLE_USER_USERNAME` / `COMPAIR_SINGLE_USER_NAME` – override the email-style username and display name that are used for the auto-provisioned local user in single-user mode.
|
|
59
|
+
- `COMPAIR_INCLUDE_LEGACY_ROUTES` (`false`) – opt-in to the full legacy API surface (used by the hosted product) when running the core edition. Leave unset to expose only the streamlined single-user endpoints in Swagger.
|
|
59
60
|
|
|
60
61
|
See `compair_core/server/settings.py` for the full settings surface.
|
|
61
62
|
|
|
@@ -13,6 +13,7 @@ import psutil
|
|
|
13
13
|
from celery.result import AsyncResult
|
|
14
14
|
from fastapi import APIRouter, Body, Depends, File, Form, Header, HTTPException, Query, Request, UploadFile
|
|
15
15
|
from fastapi.responses import HTMLResponse, RedirectResponse, StreamingResponse
|
|
16
|
+
from fastapi.routing import APIRoute
|
|
16
17
|
from sqlalchemy import distinct, func, select, or_
|
|
17
18
|
from sqlalchemy.orm import joinedload, Session
|
|
18
19
|
|
|
@@ -46,6 +47,7 @@ redis_client = redis.Redis.from_url(redis_url) if (redis and redis_url) else Non
|
|
|
46
47
|
#from compair.main import process_document
|
|
47
48
|
|
|
48
49
|
router = APIRouter()
|
|
50
|
+
core_router = APIRouter()
|
|
49
51
|
WEB_URL = os.environ.get("WEB_URL")
|
|
50
52
|
ADMIN_API_KEY = os.environ.get("ADMIN_API_KEY")
|
|
51
53
|
|
|
@@ -1401,21 +1403,24 @@ def create_doc(
|
|
|
1401
1403
|
datetime_modified=datetime.now(timezone.utc)
|
|
1402
1404
|
)
|
|
1403
1405
|
print('About to assign groups!')
|
|
1404
|
-
|
|
1405
|
-
if groups
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
)
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1406
|
+
target_group_ids = []
|
|
1407
|
+
if groups:
|
|
1408
|
+
target_group_ids = [gid.strip() for gid in groups.split(',') if gid.strip()]
|
|
1409
|
+
|
|
1410
|
+
if target_group_ids:
|
|
1411
|
+
q = select(models.Group).filter(models.Group.group_id.in_(target_group_ids))
|
|
1412
|
+
resolved_groups = session.execute(q).scalars().all()
|
|
1413
|
+
if not resolved_groups:
|
|
1414
|
+
raise HTTPException(status_code=404, detail="No matching groups found for provided IDs.")
|
|
1415
|
+
document.groups = resolved_groups
|
|
1413
1416
|
else:
|
|
1414
|
-
q = select(models.Group).filter(
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
document.groups = [
|
|
1417
|
+
q = select(models.Group).filter(models.Group.name == current_user.username)
|
|
1418
|
+
default_group = session.execute(q).scalars().first()
|
|
1419
|
+
if default_group is None:
|
|
1420
|
+
raise HTTPException(status_code=404, detail="Default group not found for user.")
|
|
1421
|
+
document.groups = [default_group]
|
|
1422
|
+
|
|
1423
|
+
primary_group = document.groups[0]
|
|
1419
1424
|
|
|
1420
1425
|
print(f'doc check!!! {document.content}')
|
|
1421
1426
|
session.add(document)
|
|
@@ -1433,7 +1438,7 @@ def create_doc(
|
|
|
1433
1438
|
log_activity(
|
|
1434
1439
|
session=session,
|
|
1435
1440
|
user_id=document.author_id,
|
|
1436
|
-
group_id=
|
|
1441
|
+
group_id=primary_group.group_id,
|
|
1437
1442
|
action="create",
|
|
1438
1443
|
object_id=document.document_id,
|
|
1439
1444
|
object_name=document.title,
|
|
@@ -3497,6 +3502,34 @@ def submit_deactivate_request(
|
|
|
3497
3502
|
return {"message": f"We’ve received your request and will delete your account and data shortly. If you change your mind, reach out within 24 hours at {EMAIL_USER}."}
|
|
3498
3503
|
|
|
3499
3504
|
|
|
3505
|
+
CORE_PATHS: set[str] = {
|
|
3506
|
+
"/login",
|
|
3507
|
+
"/load_session",
|
|
3508
|
+
"/load_groups",
|
|
3509
|
+
"/load_group",
|
|
3510
|
+
"/create_group",
|
|
3511
|
+
"/join_group",
|
|
3512
|
+
"/load_group_users",
|
|
3513
|
+
"/delete_group",
|
|
3514
|
+
"/load_documents",
|
|
3515
|
+
"/load_document",
|
|
3516
|
+
"/load_document_by_id",
|
|
3517
|
+
"/create_doc",
|
|
3518
|
+
"/process_doc",
|
|
3519
|
+
"/status/{task_id}",
|
|
3520
|
+
"/upload/ocr-file",
|
|
3521
|
+
"/ocr-file-result/{task_id}",
|
|
3522
|
+
"/load_chunks",
|
|
3523
|
+
"/load_references",
|
|
3524
|
+
"/load_feedback",
|
|
3525
|
+
"/documents/{document_id}/feedback",
|
|
3526
|
+
}
|
|
3527
|
+
|
|
3528
|
+
for route in router.routes:
|
|
3529
|
+
if isinstance(route, APIRoute) and route.path in CORE_PATHS:
|
|
3530
|
+
core_router.routes.append(route)
|
|
3531
|
+
|
|
3532
|
+
|
|
3500
3533
|
def create_fastapi_app():
|
|
3501
3534
|
"""Backwards-compatible app factory for running this module directly."""
|
|
3502
3535
|
from fastapi import FastAPI
|
|
@@ -28,9 +28,15 @@ def create_app(settings: Settings | None = None) -> FastAPI:
|
|
|
28
28
|
|
|
29
29
|
app = FastAPI(title="Compair API", version=resolved_settings.version)
|
|
30
30
|
|
|
31
|
-
from ..api import router as legacy_router
|
|
31
|
+
from ..api import core_router, router as legacy_router
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
if edition == "cloud":
|
|
34
|
+
app.include_router(legacy_router)
|
|
35
|
+
else:
|
|
36
|
+
if resolved_settings.include_legacy_routes:
|
|
37
|
+
app.include_router(legacy_router)
|
|
38
|
+
else:
|
|
39
|
+
app.include_router(core_router)
|
|
34
40
|
app.include_router(capabilities_router)
|
|
35
41
|
|
|
36
42
|
# Share the resolved settings with request handlers
|
|
@@ -19,6 +19,7 @@ class Settings(BaseSettings):
|
|
|
19
19
|
require_authentication: bool = False
|
|
20
20
|
single_user_username: str = "compair-local@example.com"
|
|
21
21
|
single_user_name: str = "Compair Local User"
|
|
22
|
+
include_legacy_routes: bool = False
|
|
22
23
|
|
|
23
24
|
# Core/local storage defaults
|
|
24
25
|
local_upload_dir: str = "~/.compair-core/data/uploads"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: compair-core
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.13
|
|
4
4
|
Summary: Open-source foundation of the Compair collaboration platform.
|
|
5
5
|
Author: RocketResearch, Inc.
|
|
6
6
|
License: MIT
|
|
@@ -91,6 +91,7 @@ Key environment variables for the core edition:
|
|
|
91
91
|
- `COMPAIR_EMAIL_BACKEND` – the core mailer logs emails to stdout; cloud overrides this with transactional delivery.
|
|
92
92
|
- `COMPAIR_REQUIRE_AUTHENTICATION` (`true`) – set to `false` to run the API in single-user mode without login or account management. When disabled, Compair auto-provisions a local user, group, and long-lived session token so you can upload documents immediately.
|
|
93
93
|
- `COMPAIR_SINGLE_USER_USERNAME` / `COMPAIR_SINGLE_USER_NAME` – override the email-style username and display name that are used for the auto-provisioned local user in single-user mode.
|
|
94
|
+
- `COMPAIR_INCLUDE_LEGACY_ROUTES` (`false`) – opt-in to the full legacy API surface (used by the hosted product) when running the core edition. Leave unset to expose only the streamlined single-user endpoints in Swagger.
|
|
94
95
|
|
|
95
96
|
See `compair_core/server/settings.py` for the full settings surface.
|
|
96
97
|
|
|
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
|