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:
TradeMate Dev
2026-05-14 00:30:48 +08:00
parent f70dd24c7d
commit 23a31f7c00
30 changed files with 485 additions and 269 deletions
+4 -5
View File
@@ -1,6 +1,5 @@
from fastapi import APIRouter, Depends
from sqlalchemy.ext.asyncio import AsyncSession
from typing import Annotated
from app.database import get_db
from app.services.corpus_trainer import CorpusTrainer
from app.api.v1.deps import get_current_user_id
@@ -10,7 +9,7 @@ router = APIRouter()
@router.post("/corpus/run")
async def run_corpus_training(
db: Annotated[AsyncSession, Depends(get_db)] = None,
db: AsyncSession = Depends(get_db),
):
trainer = CorpusTrainer(db)
result = await trainer.run_pipeline()
@@ -20,7 +19,7 @@ async def run_corpus_training(
@router.post("/corpus/embeddings")
async def compute_embeddings(
batch_size: int = 50,
db: Annotated[AsyncSession, Depends(get_db)] = None,
db: AsyncSession = Depends(get_db),
):
trainer = CorpusTrainer(db)
result = await trainer.compute_embeddings(batch_size)
@@ -29,7 +28,7 @@ async def compute_embeddings(
@router.get("/corpus/stats")
async def corpus_stats(
db: Annotated[AsyncSession, Depends(get_db)] = None,
db: AsyncSession = Depends(get_db),
):
trainer = CorpusTrainer(db)
return await trainer.get_stats()
@@ -37,7 +36,7 @@ async def corpus_stats(
@router.post("/corpus/deduplicate")
async def deduplicate_corpus(
db: Annotated[AsyncSession, Depends(get_db)] = None,
db: AsyncSession = Depends(get_db),
):
trainer = CorpusTrainer(db)
result = await trainer.deduplicate()