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
|
|
|
|
from typing import Literal, Optional
|
2026-03-18 17:18:23 +08:00
|
|
|
|
|
|
|
|
|
|
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 RegisterRequest(BaseModel):
|
2026-05-22 13:44:50 +08:00
|
|
|
|
phone: str = Field(min_length=11, max_length=11, description="手机号(11位)")
|
|
|
|
|
|
password: str = Field(min_length=6, description="密码(至少6位)")
|
|
|
|
|
|
nickname: str = Field(min_length=1, max_length=50, description="昵称")
|
2026-03-18 17:18:23 +08:00
|
|
|
|
email: Optional[str] = Field(None, description="邮箱(可选)")
|
2026-05-22 13:44:50 +08:00
|
|
|
|
agreed_to_terms: bool = Field(description="是否同意用户协议和隐私政策")
|
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: Optional[LanguagePreference] = Field(
|
|
|
|
|
|
None,
|
|
|
|
|
|
description="device language at signup; only used when creating a new user",
|
|
|
|
|
|
)
|
2026-03-18 17:18:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LoginRequest(BaseModel):
|
2026-05-22 13:44:50 +08:00
|
|
|
|
phone: str = Field(min_length=11, max_length=11, description="手机号(11位)")
|
|
|
|
|
|
password: str = Field(min_length=1, description="密码")
|
|
|
|
|
|
agreed_to_terms: bool = Field(description="是否同意用户协议和隐私政策")
|
2026-03-18 17:18:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TokenResponse(BaseModel):
|
|
|
|
|
|
access_token: str
|
|
|
|
|
|
refresh_token: str
|
|
|
|
|
|
token_type: str = "bearer"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RefreshTokenRequest(BaseModel):
|
2026-05-22 13:44:50 +08:00
|
|
|
|
refresh_token: str = Field(description="刷新令牌")
|
2026-03-18 17:18:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class UserResponse(BaseModel):
|
|
|
|
|
|
id: str
|
|
|
|
|
|
phone: str
|
|
|
|
|
|
email: Optional[str] = None
|
|
|
|
|
|
nickname: str
|
|
|
|
|
|
avatar_url: Optional[str] = None
|
|
|
|
|
|
subscription_type: str
|
|
|
|
|
|
created_at: str
|
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 SendSmsRequest(BaseModel):
|
2026-05-22 13:44:50 +08:00
|
|
|
|
phone: str = Field(min_length=11, max_length=11, description="手机号(11位)")
|
2026-03-19 14:36:14 +08:00
|
|
|
|
purpose: str = Field(
|
|
|
|
|
|
..., description="用途:register/login/reset_password/change_phone"
|
|
|
|
|
|
)
|
2026-03-18 17:18:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SendSmsResponse(BaseModel):
|
|
|
|
|
|
success: bool
|
|
|
|
|
|
message: str
|
|
|
|
|
|
expires_in: Optional[int] = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SmsLoginRequest(BaseModel):
|
2026-05-22 13:44:50 +08:00
|
|
|
|
phone: str = Field(min_length=11, max_length=11, description="手机号(11位)")
|
|
|
|
|
|
code: str = Field(min_length=6, max_length=6, description="验证码(6位)")
|
|
|
|
|
|
agreed_to_terms: bool = Field(description="是否同意用户协议和隐私政策")
|
2026-03-19 14:36:14 +08:00
|
|
|
|
nickname: Optional[str] = Field(
|
|
|
|
|
|
None, max_length=50, description="昵称(注册时必填,登录时可选)"
|
|
|
|
|
|
)
|
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: Optional[LanguagePreference] = Field(
|
|
|
|
|
|
None,
|
|
|
|
|
|
description="device language at signup; only used when creating a new user",
|
|
|
|
|
|
)
|
2026-03-18 17:18:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
merge dark mode and google OAuth (#35)
* feat(api): implement Google OAuth login and user management
- Added Google OpenID Connect login functionality, allowing users to authenticate using their Google accounts.
- Created new endpoints for Google login, including user registration and linking existing accounts.
- Introduced Google token verification logic and error handling for authentication failures.
- Updated environment configuration to include Google OAuth client IDs and verification settings.
- Enhanced user model to support OpenID and linked Google accounts.
This feature improves user experience by enabling seamless sign-in with Google, while maintaining security and integrity of user data.
* fix(auth): wire staging Google token verifier
* chore(deps): update expo to version 55.0.6 and adjust @expo/env dependency in pnpm-lock.yaml
* chore(deps): update Babel dependencies to version 7.29.7 in package-lock.json
* feat(auth): enhance phone login for China users
- Updated phone login functionality to support only mainland China (+86) mobile numbers.
- Added user prompts and descriptions for phone login, including confirmation and cancellation options.
- Adjusted translations for both English and Chinese to reflect the new phone login requirements.
- Updated Google OAuth client IDs in configuration files for production and staging environments.
* chore(deps): add peer flag to use-sync-external-store in package-lock.json
* chore(deps): add @emnapi/core and @emnapi/runtime to package-lock.json
* fix(app-expo): align Android native dependencies
* fix(app-expo): normalize lockfile for npm 10
* fix(config): update environment variable handling to use static access
- Introduced a static mapping for public environment variables to ensure proper access during the release bundle.
- Updated the `requirePublicEnv` and `optionalPublicEnv` functions to reference the new `PUBLIC_ENV` object instead of directly accessing `process.env`.
- Added comments to clarify the necessity of static access for certain environment variables.
* feat(app-expo): dark mode, FAQ i18n, eval ASR, and theme cleanup (#34)
* feat(app-expo): dark mode, FAQ i18n, version CI, and theme cleanup
Implement light/dark scene colors across chat, reading, and headers; remove
default/brand theme picker and ThemeVariablesProvider. Localize FAQ in-app,
fix dark-mode text visibility, and remove the unused /api/faqs endpoint.
Align About/version with Expo config and inject APP_VERSION in CI builds.
Also includes phone E164 auth/SMS updates, eval ASR page, and related API work.
* revert: remove phone E.164 changes from dark-mode branch
These auth/SMS internationalization updates were accidentally bundled into
the dark-mode commit; restore 11-digit CN phone flow and drop related API,
migration, and Expo UI work from this branch.
* fix: address PR review issues for dark mode and eval ASR
Use light foreground colors for sepia reading in dark mode, fix chat send
button contrast, stream-limit eval ASR uploads, restore LiveTester phone
validation, and remove unused AudioSegmenter code.
* fix(app-expo): improve chat send button contrast in light and dark mode
Add dedicated send button colors (accent fill in dark, primary fill in
light), use RNText to avoid NativeWind overrides, and restore dark labels
in light mode for readable composer actions.
---------
Co-authored-by: Kevin <kevin@brighteng.org>
---------
Co-authored-by: penghanyuan <penghanyuan@gmail.com>
Co-authored-by: Kevin <kevin@brighteng.org>
2026-06-09 11:14:36 +08:00
|
|
|
|
class GoogleLoginRequest(BaseModel):
|
|
|
|
|
|
id_token: str = Field(min_length=20, description="Google OpenID Connect ID token")
|
|
|
|
|
|
agreed_to_terms: bool = Field(description="是否同意用户协议和隐私政策")
|
|
|
|
|
|
language: Optional[LanguagePreference] = Field(
|
|
|
|
|
|
None,
|
|
|
|
|
|
description="device language at signup; only used when creating a new user",
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-04-20 11:58:32 +08:00
|
|
|
|
class MockSmsLoginRequest(BaseModel):
|
|
|
|
|
|
"""开发/评测专用:与 MOCK_SMS_LOGIN_ENABLED 联用,跳过短信校验。"""
|
|
|
|
|
|
|
2026-05-22 13:44:50 +08:00
|
|
|
|
phone: str = Field(min_length=11, max_length=11, description="手机号(11位)")
|
|
|
|
|
|
agreed_to_terms: bool = Field(description="是否同意用户协议和隐私政策")
|
2026-04-20 11:58:32 +08:00
|
|
|
|
nickname: Optional[str] = Field(
|
|
|
|
|
|
None, max_length=50, description="新用户昵称(可选)"
|
|
|
|
|
|
)
|
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: Optional[LanguagePreference] = Field(
|
|
|
|
|
|
None,
|
|
|
|
|
|
description="device language at signup; only used when creating a new user",
|
|
|
|
|
|
)
|
2026-04-20 11:58:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-03-18 17:18:23 +08:00
|
|
|
|
class SmsRegisterRequest(BaseModel):
|
2026-05-22 13:44:50 +08:00
|
|
|
|
phone: str = Field(min_length=11, max_length=11, description="手机号(11位)")
|
|
|
|
|
|
code: str = Field(min_length=6, max_length=6, description="验证码(6位)")
|
|
|
|
|
|
password: str = Field(min_length=6, description="密码(至少6位)")
|
|
|
|
|
|
nickname: str = Field(min_length=1, max_length=50, description="昵称")
|
2026-03-18 17:18:23 +08:00
|
|
|
|
email: Optional[str] = Field(None, description="邮箱(可选)")
|
2026-05-22 13:44:50 +08:00
|
|
|
|
agreed_to_terms: bool = Field(description="是否同意用户协议和隐私政策")
|
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: Optional[LanguagePreference] = Field(
|
|
|
|
|
|
None,
|
|
|
|
|
|
description="device language at signup; only used when creating a new user",
|
|
|
|
|
|
)
|
2026-03-18 17:18:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ResetPasswordRequest(BaseModel):
|
2026-05-22 13:44:50 +08:00
|
|
|
|
phone: str = Field(min_length=11, max_length=11, description="手机号(11位)")
|
|
|
|
|
|
code: str = Field(min_length=6, max_length=6, description="验证码(6位)")
|
|
|
|
|
|
new_password: str = Field(min_length=6, description="新密码(至少6位)")
|
2026-03-18 17:18:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ChangePasswordRequest(BaseModel):
|
2026-05-22 13:44:50 +08:00
|
|
|
|
old_password: str = Field(min_length=1, description="旧密码")
|
|
|
|
|
|
new_password: str = Field(min_length=6, description="新密码(至少6位)")
|
2026-03-18 17:18:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ChangePhoneRequest(BaseModel):
|
2026-03-19 14:36:14 +08:00
|
|
|
|
new_phone: str = Field(
|
|
|
|
|
|
..., min_length=11, max_length=11, description="新手机号(11位)"
|
|
|
|
|
|
)
|
2026-05-22 13:44:50 +08:00
|
|
|
|
code: str = Field(min_length=6, max_length=6, description="验证码(6位)")
|
2026-03-18 17:18:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class UpdateNicknameRequest(BaseModel):
|
2026-03-19 14:36:14 +08:00
|
|
|
|
nickname: str = Field(
|
|
|
|
|
|
..., min_length=1, max_length=50, description="昵称(1-50个字符)"
|
|
|
|
|
|
)
|
2026-03-18 17:18:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AvatarUploadResponse(BaseModel):
|
|
|
|
|
|
avatar_url: str
|
feat(profile): avatar presets, upload, nickname editing
- FastAPI: preset assets 01–08, GET list/static, PUT /me/avatar/preset,
safer uploaded-avatar path validation, preset_avatars + HTTP tests.
- Expo: personal-info (library + presets), profile tab avatar,
resolveApiMediaUrl, auth hooks cache sync, Web multipart helper,
partial-save messaging + profile i18n.
- Includes existing edits to conversation screen and voice use-player.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-06 13:51:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SetAvatarPresetRequest(BaseModel):
|
|
|
|
|
|
preset_id: str = Field(
|
|
|
|
|
|
...,
|
|
|
|
|
|
min_length=2,
|
|
|
|
|
|
max_length=2,
|
|
|
|
|
|
pattern=r"^\d{2}$",
|
|
|
|
|
|
description="预设编号,如 01–08",
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AvatarPresetItem(BaseModel):
|
|
|
|
|
|
id: str
|
|
|
|
|
|
url: str
|