mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-08-16 18:00:23 +03:00
fix: Add integration brain to subscription route
This commit is contained in:
parent
68db4e0361
commit
15cefd0f6e
@ -21,7 +21,13 @@ from repository.brain_subscription import (
|
||||
SubscriptionInvitationService,
|
||||
resend_invitation_email,
|
||||
)
|
||||
from modules.brain.repository import (
|
||||
IntegrationBrain,
|
||||
)
|
||||
from routes.headers.get_origin_header import get_origin_header
|
||||
from logger import get_logger
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
subscription_router = APIRouter()
|
||||
subscription_service = SubscriptionInvitationService()
|
||||
@ -30,6 +36,7 @@ prompt_service = PromptService()
|
||||
brain_user_service = BrainUserService()
|
||||
brain_service = BrainService()
|
||||
api_brain_definition_service = ApiBrainDefinitionService()
|
||||
integration_brains_repository = IntegrationBrain()
|
||||
|
||||
|
||||
@subscription_router.post(
|
||||
@ -249,7 +256,18 @@ async def accept_invitation(
|
||||
rights=invitation["rights"],
|
||||
is_default_brain=False,
|
||||
)
|
||||
shared_brain = brain_service.get_brain_by_id(brain_id)
|
||||
integration_brain = integration_brains_repository.get_integration_brain(
|
||||
brain_id=brain_id,
|
||||
)
|
||||
integration_brains_repository.add_integration_brain(
|
||||
brain_id=brain_id,
|
||||
user_id=current_user.id,
|
||||
integration_id=integration_brain.integration_id,
|
||||
settings=integration_brain.settings,
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(f"Error adding user to brain: {e}")
|
||||
raise HTTPException(status_code=400, detail=f"Error adding user to brain: {e}")
|
||||
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user