2026-03-18 17:18:23 +08:00
|
|
|
from typing import Literal, Optional
|
|
|
|
|
|
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
feat(i18n): persist language preference and thread through chat, memoir, TTS
- Add users.language_preference (Alembic 0018, default zh); capture at signup/SMS
only; expose on auth and profile APIs
- Lite English prompts for chat and memoir; localized stage labels and agent
names (Life Echo / 岁月知己)
- Tencent TTS: language-aware synthesis, ModelType=1 for 501004, English chunking
- WebSocket pipeline: emit all AGENT_RESPONSE segments when TTS cancels; INFO logs
for tts_this_turn and TTS decisions; on-demand TTS logging
- Expo: device language on auth, i18n tiers/agent name, [SPLIT] streaming UX fixes
- Tests for migration, prompts, pipeline, router tts_this_turn, reply segments
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-11 16:16:49 +08:00
|
|
|
LanguagePreference = Literal["zh", "en"]
|
|
|
|
|
|
2026-03-18 17:18:23 +08:00
|
|
|
|
|
|
|
|
class UserProfileResponse(BaseModel):
|
|
|
|
|
id: str
|
|
|
|
|
phone: str
|
|
|
|
|
email: Optional[str] = None
|
|
|
|
|
nickname: str
|
|
|
|
|
avatar_url: Optional[str] = None
|
|
|
|
|
subscription_type: str
|
|
|
|
|
created_at: str
|
|
|
|
|
birth_year: Optional[int] = None
|
|
|
|
|
birth_place: Optional[str] = None
|
|
|
|
|
grew_up_place: Optional[str] = None
|
|
|
|
|
occupation: Optional[str] = None
|
feat(i18n): persist language preference and thread through chat, memoir, TTS
- Add users.language_preference (Alembic 0018, default zh); capture at signup/SMS
only; expose on auth and profile APIs
- Lite English prompts for chat and memoir; localized stage labels and agent
names (Life Echo / 岁月知己)
- Tencent TTS: language-aware synthesis, ModelType=1 for 501004, English chunking
- WebSocket pipeline: emit all AGENT_RESPONSE segments when TTS cancels; INFO logs
for tts_this_turn and TTS decisions; on-demand TTS logging
- Expo: device language on auth, i18n tiers/agent name, [SPLIT] streaming UX fixes
- Tests for migration, prompts, pipeline, router tts_this_turn, reply segments
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-11 16:16:49 +08:00
|
|
|
language_preference: LanguagePreference = "zh"
|
2026-03-18 17:18:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class UpdateUserProfileRequest(BaseModel):
|
|
|
|
|
birth_year: Optional[int] = None
|
|
|
|
|
birth_place: Optional[str] = None
|
|
|
|
|
grew_up_place: Optional[str] = None
|
|
|
|
|
occupation: Optional[str] = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestSubscriptionRequest(BaseModel):
|
|
|
|
|
action: Literal["activate", "deactivate"]
|
|
|
|
|
plan_id: Optional[str] = "pro"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestSubscriptionResponse(BaseModel):
|
|
|
|
|
success: bool
|
|
|
|
|
message: str
|
|
|
|
|
subscription_type: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SubmitFeedbackRequest(BaseModel):
|
|
|
|
|
"""提交反馈请求"""
|
2026-03-19 14:36:14 +08:00
|
|
|
|
2026-05-22 13:44:50 +08:00
|
|
|
content: str = Field(min_length=1, max_length=2000, description="反馈内容")
|
2026-03-18 17:18:23 +08:00
|
|
|
contact: Optional[str] = Field(None, max_length=100, description="联系方式(可选)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FeedbackResponse(BaseModel):
|
|
|
|
|
"""反馈响应"""
|
2026-03-19 14:36:14 +08:00
|
|
|
|
2026-03-18 17:18:23 +08:00
|
|
|
id: str
|
|
|
|
|
message: str
|
2026-03-20 15:15:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# 与前端约定:请求体必须携带该固定口令,防止误触清空。
|
|
|
|
|
PURGE_USER_DATA_CONFIRMATION = "我确认永久删除我的全部回忆与对话数据"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PurgeUserDataRequest(BaseModel):
|
2026-03-27 16:01:28 +08:00
|
|
|
"""清空账号下全部业务数据(保留登录账号与手机号等;并清空出生年/出生地等档案字段)。"""
|
2026-03-20 15:15:35 +08:00
|
|
|
|
|
|
|
|
confirmation: str = Field(
|
|
|
|
|
...,
|
|
|
|
|
min_length=1,
|
|
|
|
|
description=f"必须为「{PURGE_USER_DATA_CONFIRMATION}」",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PurgeUserDataResponse(BaseModel):
|
|
|
|
|
success: bool
|
|
|
|
|
message: str
|