feat: silent wechat login, marketing tab optimization, admin page foundation
- Add silent WeChat login for MP/browser environments - Fix Python 3.6 compatibility (remove typing.Annotated usage) - Marketing page: tab-based content generation with category support - Translate page: add auto-detect language default - Homepage: add TTS playback, announcement ticker, remove redundant quick-actions - Fix FAB button overlap with custom tabbar on customers/quotation pages - Make openai/anthropic imports lazy for Python 3.6 compat
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from typing import Annotated, Optional
|
||||
from typing import Optional
|
||||
from app.database import get_db
|
||||
from app.services.followup_engine import FollowupEngine
|
||||
from app.api.v1.deps import get_current_user_id
|
||||
@@ -11,7 +11,7 @@ router = APIRouter()
|
||||
@router.get("/strategies")
|
||||
async def list_strategies(
|
||||
user_id: str = Depends(get_current_user_id),
|
||||
db: Annotated[AsyncSession, Depends(get_db)] = None,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
engine = FollowupEngine(db)
|
||||
await engine.ensure_default_strategies()
|
||||
@@ -23,7 +23,7 @@ async def get_pending_followups(
|
||||
page: int = Query(1, ge=1),
|
||||
size: int = Query(20, ge=1, le=100),
|
||||
user_id: str = Depends(get_current_user_id),
|
||||
db: Annotated[AsyncSession, Depends(get_db)] = None,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
engine = FollowupEngine(db)
|
||||
return await engine.get_pending_followups(user_id, page, size)
|
||||
@@ -34,7 +34,7 @@ async def get_followup_logs(
|
||||
page: int = Query(1, ge=1),
|
||||
size: int = Query(20, ge=1, le=100),
|
||||
user_id: str = Depends(get_current_user_id),
|
||||
db: Annotated[AsyncSession, Depends(get_db)] = None,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
engine = FollowupEngine(db)
|
||||
return await engine.get_followup_logs(user_id, page, size)
|
||||
@@ -44,7 +44,7 @@ async def get_followup_logs(
|
||||
async def mark_followup_sent(
|
||||
log_id: str,
|
||||
user_id: str = Depends(get_current_user_id),
|
||||
db: Annotated[AsyncSession, Depends(get_db)] = None,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
engine = FollowupEngine(db)
|
||||
success = await engine.mark_sent(user_id, log_id)
|
||||
@@ -58,7 +58,7 @@ async def edit_and_send_followup(
|
||||
log_id: str,
|
||||
body: dict,
|
||||
user_id: str = Depends(get_current_user_id),
|
||||
db: Annotated[AsyncSession, Depends(get_db)] = None,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
edited_text = body.get("edited_text", "")
|
||||
if not edited_text:
|
||||
@@ -73,7 +73,7 @@ async def edit_and_send_followup(
|
||||
@router.get("/stats")
|
||||
async def get_followup_stats(
|
||||
user_id: str = Depends(get_current_user_id),
|
||||
db: Annotated[AsyncSession, Depends(get_db)] = None,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
engine = FollowupEngine(db)
|
||||
return await engine.get_stats(user_id)
|
||||
@@ -82,7 +82,7 @@ async def get_followup_stats(
|
||||
@router.post("/scan")
|
||||
async def trigger_followup_scan(
|
||||
user_id: str = Depends(get_current_user_id),
|
||||
db: Annotated[AsyncSession, Depends(get_db)] = None,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
engine = FollowupEngine(db)
|
||||
result = await engine.scan_and_followup()
|
||||
|
||||
Reference in New Issue
Block a user