Files
chatballs/apps/backend/hub_platform/integrations/selectors.py
T
AndreyandClaude Opus 4.8 d95bac7ebc feat: AI->operator handoff + bind connection to channel in UI
Handoff (ADR-HUB-0003): the live runtime instructs the model to append a
<<HANDOFF>> token when a human is needed (asks for a person, out-of-scope,
discount/invoice/legal, complaint). Ingest strips the token, switches the
conversation to PAUSED (expected: operator), posts a system note and notifies
operators — verified the token fires on 'счёт на юрлицо' and not on a price
question.

Binding: integrations now carry a channel; the integration form shows a
'Канал обработки' select for messenger connections and the list shows the bound
channel. Backend create/update/serialize/select handle channel_id.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 18:10:17 +03:00

12 lines
490 B
Python

from django.db.models import QuerySet
from hub_platform.integrations.models import Integration
def integrations_for_organization(organization_id: int) -> QuerySet[Integration]:
return Integration.objects.filter(organization_id=organization_id).select_related("channel").order_by("provider", "name")
def integration_for_organization(*, organization_id: int, integration_id: int) -> Integration:
return Integration.objects.get(id=integration_id, organization_id=organization_id)