feat: add account management, email verification, AI fixes, and user guides
- Profile settings, account transfer, delete/leave account flows - Email verification with JWT tokens and Resend integration - AI assistant/copilot fixes: markdown rendering, shared RAG helpers, token tracking, input refocus, model_validate usage - User guides hub + detail pages with 13 topic guides - Sidebar and top bar navigation for guides Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ from typing import Annotated
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Request, status
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.core.rate_limit import limiter
|
||||
@@ -25,6 +26,7 @@ from app.schemas.copilot import (
|
||||
CopilotConversationResponse,
|
||||
SuggestedFlow,
|
||||
)
|
||||
from app.models.copilot_conversation import CopilotConversation
|
||||
from app.services import copilot_service
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -112,7 +114,7 @@ async def post_message(
|
||||
plan = await get_user_plan(current_user.account_id, db)
|
||||
|
||||
try:
|
||||
ai_content, suggested_flows = await copilot_service.send_message(
|
||||
ai_content, suggested_flows, conversation = await copilot_service.send_message(
|
||||
conversation_id=conversation_id,
|
||||
user_id=current_user.id,
|
||||
message=data.message,
|
||||
@@ -150,9 +152,12 @@ async def post_message(
|
||||
conversation_id=None,
|
||||
generation_type="copilot_message",
|
||||
tier=plan,
|
||||
input_tokens=0,
|
||||
output_tokens=0,
|
||||
estimated_cost=0,
|
||||
input_tokens=conversation.total_input_tokens,
|
||||
output_tokens=conversation.total_output_tokens,
|
||||
estimated_cost=(
|
||||
conversation.total_input_tokens * 1.0 / 1_000_000
|
||||
+ conversation.total_output_tokens * 5.0 / 1_000_000
|
||||
),
|
||||
succeeded=True,
|
||||
counts_toward_quota=False,
|
||||
error_code=None,
|
||||
@@ -163,7 +168,7 @@ async def post_message(
|
||||
|
||||
return CopilotMessageResponse(
|
||||
content=ai_content,
|
||||
suggested_flows=[SuggestedFlow(**sf) for sf in suggested_flows],
|
||||
suggested_flows=[SuggestedFlow.model_validate(sf) for sf in suggested_flows],
|
||||
)
|
||||
|
||||
|
||||
@@ -174,9 +179,6 @@ async def get_conversation(
|
||||
db: Annotated[AsyncSession, Depends(get_db)],
|
||||
):
|
||||
"""Get copilot conversation history."""
|
||||
from sqlalchemy import select
|
||||
from app.models.copilot_conversation import CopilotConversation
|
||||
|
||||
result = await db.execute(
|
||||
select(CopilotConversation).where(
|
||||
CopilotConversation.id == conversation_id,
|
||||
|
||||
Reference in New Issue
Block a user