feat: AI chat session conclusion + survey completion & management

AI Assistant - Conclude Session:
- 3-step modal: select outcome (resolved/escalated/paused), add notes, AI-generated summary
- AI generates structured ticket notes from conversation transcript (PSA-ready format)
- Copy to clipboard for pasting into ticketing systems
- "Resume in New Chat" for paused sessions (pre-loads context into new chat)
- Backend: POST /chats/{id}/conclude endpoint, conclusion_summary/outcome/concluded_at fields
- Migration 048: add conclusion fields to assistant_chats

Survey Completion Flow:
- Email-to-self option after submission (branded HTML email with formatted responses)
- Finish button navigates to /survey/thank-you page
- Thank you page with close-window message and feedback email callout
- Already-submitted state updated with same messaging
- Backend: POST /survey/email-copy public endpoint

Survey Admin Management:
- Read/unread indicators (cyan dot, bold name, auto-mark on expand)
- Unread count stat card
- Per-row context menu: mark read/unread, archive/unarchive, delete
- Bulk actions bar: select all, mark read/unread, archive, delete
- Show Archived toggle to filter archived responses
- Backend: 7 new admin endpoints (read, unread, archive, unarchive, delete, bulk)
- Migration 049: add is_read, archived_at to survey_responses

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Michael Chihlas
2026-03-05 20:00:28 -05:00
parent e4c5948fbd
commit 882f67f42e
20 changed files with 1627 additions and 63 deletions

View File

@@ -0,0 +1,36 @@
"""Add conclusion fields to assistant_chats.
Revision ID: 048
Revises: 047
Create Date: 2026-03-05
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
revision: str = "048"
down_revision: str = "047"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.add_column(
"assistant_chats",
sa.Column("conclusion_outcome", sa.String(20), nullable=True),
)
op.add_column(
"assistant_chats",
sa.Column("conclusion_summary", sa.String, nullable=True),
)
op.add_column(
"assistant_chats",
sa.Column("concluded_at", sa.DateTime(timezone=True), nullable=True),
)
def downgrade() -> None:
op.drop_column("assistant_chats", "concluded_at")
op.drop_column("assistant_chats", "conclusion_summary")
op.drop_column("assistant_chats", "conclusion_outcome")

View File

@@ -0,0 +1,31 @@
"""Add is_read and archived_at to survey_responses.
Revision ID: 049
Revises: 048
Create Date: 2026-03-05
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
revision: str = "049"
down_revision: str = "048"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.add_column(
"survey_responses",
sa.Column("is_read", sa.Boolean(), nullable=False, server_default="false"),
)
op.add_column(
"survey_responses",
sa.Column("archived_at", sa.DateTime(timezone=True), nullable=True),
)
def downgrade() -> None:
op.drop_column("survey_responses", "archived_at")
op.drop_column("survey_responses", "is_read")