Commit Graph

463 Commits

Author SHA1 Message Date
Sully
105b50a277 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
Kevin
10d9e13f14 fix docker file 2026-05-25 11:39:38 +08:00
Kevin
07979bfb09 feat(api): use Tencent ASR flash with 16k_zh_large and dev transcript logs
Replace CreateRecTask polling with recording-file flash API, add TENCENT_APP_ID,
remove server-side pydub slicing, and log ASR recognition text at INFO in development.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-25 11:28:22 +08:00
Kevin
22d282dc01 feat(api): use Tencent 16k_zh_large ASR and remove local Whisper
Standardize ASR on Tencent's dialect-capable engine across all environments,
drop faster-whisper from dependencies and deployment images, and add an
expo-sqlite iOS vendor sync plus pod install in prebuild to prevent native
build failures after npm install.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-25 10:21:41 +08:00
Kevin
4f0a314656 fix(deploy): replace staging/production env placeholders blocking CI deploy.
Staging keeps Redis open on the internal compose network; production gets real Redis and Flower credentials.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 17:43:27 +08:00
Kevin
e5205702e1 Merge remote-tracking branch 'origin/development' 2026-05-22 16:03:39 +08:00
Kevin
f4e18f2b9b fix(api): make auth HTTP tests pass in CI without local .env secrets.
Mock COS storage for auth router DI and skip Postgres integration tests when the database is unreachable.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 16:01:03 +08:00
Kevin
6d5c823bdd Merge origin/development into main; resolve conflicts using development. 2026-05-22 15:28:36 +08:00
Kevin
8f66f94a1a fix(app-expo): use brand splash icon on logout replay overlay
Replace Expo template logo and blue gradient with splash-icon.png and

Co-authored-by: Cursor <cursoragent@cursor.com>
#E6F4FE so post-logout splash matches the native cold-start screen.
2026-05-22 14:19:53 +08:00
Sully
53e0065e3e refactor(api): TOML 配置 SSOT、统一错误契约、Auth/事务加固与可观测性 (#33)
配置 SSOT(TOML + .env)
统一错误契约
Auth 与事务边界
Redis / Celery 可靠性:业务 Redis(DB/0)与 Celery broker/backend(DB/1)显式拆分;连接池、sync client
可观测性(OpenTelemetry + LGTM)
2026-05-22 13:44:50 +08:00
Sully
f09ae248f9 feat: OpenTelemetry LGTM observability, dev tooling, and memoir UX fixes (#31) (#32)
* add staging ios app build script

* feat(api): add OpenTelemetry LGTM stack for local observability

Wire OTel traces, metrics, and logs through a collector to Tempo,
Prometheus, and Loki, with custom LLM instrumentation, dev compose overlay,
Grafana provisioning, env templates, and development.sh auto-start.



* feat: expand observability, harden dev tooling, and fix expo staging UX

Add business and LLM Prometheus metrics with Grafana dashboards, alerting,
and a metrics verification script. Wire telemetry through adapters and core
LLM paths, and document the local LGTM workflow.

Fix development.sh for macOS bash 3.2, open Grafana and eval-web in Chrome,
and repair eval-web auto-open (unbound EVAL_WEB_BROWSER_SCHEDULED). Merge
internal-eval into the main dev script with improved compose handling.

Require EXPO_PUBLIC_* at build time, improve iOS HTTP ATS for staging IPs,
show memoir empty state instead of load errors when no chapters exist, and
add jest env setup plus chapter list response normalization.



* chore: enable Grafana Assistant Cursor plugin



* fix: memoir empty state and repair withdrawn 0020_chapters_book_id stamp

Show empty memoir UI when the chapter list succeeds with no items; treat auth/404 as non-fatal. Extend alembic revision repair so local dev DBs stamped with the removed 0020_chapters_book_id migration can roll back and upgrade to 0019.



---------

Co-authored-by: Kevin <kevin@brighteng.org>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-20 15:14:13 +08:00
Sully
96e72700dc Merge branch 'development' into main 2026-05-20 15:13:59 +08:00
Sully
fa42757916 feat: OpenTelemetry LGTM observability, dev tooling, and memoir UX fixes (#31)
* add staging ios app build script

* feat(api): add OpenTelemetry LGTM stack for local observability

Wire OTel traces, metrics, and logs through a collector to Tempo,
Prometheus, and Loki, with custom LLM instrumentation, dev compose overlay,
Grafana provisioning, env templates, and development.sh auto-start.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: expand observability, harden dev tooling, and fix expo staging UX

Add business and LLM Prometheus metrics with Grafana dashboards, alerting,
and a metrics verification script. Wire telemetry through adapters and core
LLM paths, and document the local LGTM workflow.

Fix development.sh for macOS bash 3.2, open Grafana and eval-web in Chrome,
and repair eval-web auto-open (unbound EVAL_WEB_BROWSER_SCHEDULED). Merge
internal-eval into the main dev script with improved compose handling.

Require EXPO_PUBLIC_* at build time, improve iOS HTTP ATS for staging IPs,
show memoir empty state instead of load errors when no chapters exist, and
add jest env setup plus chapter list response normalization.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore: enable Grafana Assistant Cursor plugin

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: memoir empty state and repair withdrawn 0020_chapters_book_id stamp

Show empty memoir UI when the chapter list succeeds with no items; treat auth/404 as non-fatal. Extend alembic revision repair so local dev DBs stamped with the removed 0020_chapters_book_id migration can roll back and upgrade to 0019.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Kevin <kevin@brighteng.org>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-20 15:12:21 +08:00
Kevin
81458c7046 add staging ios app build script 2026-05-20 10:27:40 +08:00
Kevin
0d417331fd fix(api): remove duplicate alembic migrations after merge
Drop legacy 0019_backfill_missing_columns and 0020_backfill_missing_schema
chain so only 0019_align_legacy_schema remains as head.
2026-05-19 16:45:51 +08:00
Kevin
bf2fe0acdf Merge remote-tracking branch 'origin/development' 2026-05-19 16:42:22 +08:00
Kevin
544cc68106 fix alembic migration 2026-05-19 16:40:45 +08:00
Kevin
497223cf4d Merge origin/development into main
Keep origin/main env files (api/.env.staging, app-expo/.env.*); take development branch code changes only.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-19 15:47:21 +08:00
Kevin
6d281c92a5 feat(app-expo): env variants, local iOS prebuild, and About diagnostics
Align staging/production builds with APP_VARIANT bundle IDs, allow staging HTTP on iOS, add ios-prebuild scripts for TestFlight, and show connected API URL on About for non-production builds.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-19 15:43:16 +08:00
Kevin
3921c5ec24 fix(app-expo): allow read-aloud on other split segments while TTS paused
Match playback refs to the correct assistant segment so the interrupt overlay
does not block other bubbles, and preempt local playback when switching segments.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-19 14:55:10 +08:00
Kevin
b22f1cd4c4 feat(app-expo): replay brand splash on logout and route to login
After sign-out or data purge, clear session state reliably, remount the
splash overlay above navigation, and navigate to login instead of tabs so
users no longer briefly land on the chat home screen.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-19 14:31:32 +08:00
Kevin
95856ca11a feat(app-expo): show memoir chapter draft progress on list cards
Explain invite vs. generating state using MemoirState slots, surface remaining
characters to the display gate, refresh memoir-state on pull, and sync i18n.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-19 11:11:58 +08:00
Kevin
897f49f2ab feat(app-expo): tiered large-text presets with English-friendly default
Replace the boolean large-text flag with three global typography tiers,
defaulting new installs to the smallest tier when English is in effect
while preserving legacy storage and Chinese defaults. Add a profile
sub-screen to pick the tier and unit tests for storage resolution.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-18 16:47:29 +08:00
Kevin
8f6c2a6a34 chore(app-expo): regenerate i18n Resources types
Sync generated resources.ts with locale keys (e.g. profile.personalInfo.tapAwayToClose for avatar sheet a11y).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-18 16:19:32 +08:00
Kevin
eabda2c6a9 chore: resolve WIP after merging internal/development
- .gitignore: keep api/uploads ignore and copyright_source_listing.pdf path

- auth: keep COS avatar upload URL; delete prior COS object when applying preset

- i18n: regenerate resources.ts (includes profile tapAwayToClose)

- Avatar/COS tests and personal-info remain from prior local work

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-18 15:34:50 +08:00
Kevin
98802240ac Merge branch 'internal/development' into development 2026-05-18 15:34:05 +08:00
penghanyuan
982033974c refactor(migration): update revision identifier for backfill migration
This commit changes the revision identifier from '0020_backfill_all_missing_columns' to '0020_backfill_missing_schema' to better reflect the purpose of the migration, which focuses on backfilling missing schema elements in the database.
2026-05-17 22:11:02 +02:00
penghanyuan
6b1d63524e refactor(migration): backfill all missing columns in ORM models
This migration updates the database schema by automatically adding all missing columns from the ORM models to the existing tables. It replaces the previous specific addition of 'tts_audio_urls' with a more comprehensive approach that inspects the ORM metadata and synchronizes it with the database schema. The downgrade function has been simplified to a no-op.
2026-05-17 22:06:12 +02:00
penghanyuan
8df6e42a30 feat(migration): add tts_audio_urls column to segments and conversation_messages tables
This migration introduces the 'tts_audio_urls' column to both the 'segments' and 'conversation_messages' tables, addressing a discrepancy between the ORM model and the production database. The upgrade function checks for the existence of these columns and adds them if they are missing, while the downgrade function allows for their removal if necessary.
2026-05-17 21:38:49 +02:00
penghanyuan
4ed3491aea empty commit 2026-05-17 19:37:14 +02:00
Hanyuan
edc3dc9574 Merge pull request #30 from penghanyuan/fix/fix-migration
Fix/fix migration
2026-05-17 17:11:59 +02:00
penghanyuan
3e9dd24cc8 feat(docs): add comprehensive documentation for the "岁月留书" application
Introduced two new markdown files detailing the product overview, core functionalities, data security measures, user experience, and collaboration models for the "岁月留书" application. This documentation aims to provide clear insights for potential users and partners in the elder care sector.
2026-05-17 17:10:46 +02:00
penghanyuan
63632e2fe8 fix(ci): update environment variable checks and enhance staging configuration
Correct the regex in the Docker deployment workflow to properly validate environment variable placeholders. Additionally, update the staging environment configuration by adding specific keys and values for Tencent Cloud services, ensuring proper setup for deployment.
2026-05-17 17:10:30 +02:00
Kevin
ddc701f22d fix(voice): queue split TTS segments after pause without replacing track
Detect consecutive tts_auto items on the same assistant bubble via listKey (uuid_seg_n / uuid_part_n). When paused, skip the 'clear queue and play latest only' path so later segments enqueue instead of wiping playback. Add regression test.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-15 17:25:44 +08:00
Kevin
6452019a1e copy env.staging 2026-05-15 17:24:57 +08:00
Kevin
6f41574bda feat(memoir): persist chapter reading prefs globally
Share font size, font family, and background across all memoir chapters via MemoirReadingSettingsProvider and SecureStore (same app-settings pattern). Add parse/merge helpers and unit tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-15 17:23:02 +08:00
Hanyuan
14fa42eb91 Merge pull request #29 from penghanyuan/fix/fix-migration
feat(migration): add missing columns to segments and conversations tables
2026-05-14 19:17:28 +02:00
penghanyuan
0a9381c711 feat(migration): add missing columns to segments and conversations tables
This migration adds the columns 'audio_duration_seconds' to the 'segments' table and 'deleted_at' to the 'conversations' table, which were previously missing in the production database. The upgrade function checks for the existence of these columns and adds them if they are not present. The downgrade function allows for the removal of these columns if necessary.
2026-05-14 19:16:48 +02:00
Hanyuan
bb0df2bf83 Merge pull request #28 from penghanyuan/fix/deploy-ssh-timeout-retries
fix(ci): retry SSH setup steps in remote candidate preparation
2026-05-14 17:26:03 +02:00
penghanyuan
8bbe6367ae fix(ci): retry SSH setup steps in remote candidate preparation
Retry remote docker login, bootstrap SSH commands, and scp uploads to handle transient connection timeout and banner exchange failures in GitHub runner environments.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-14 17:23:31 +02:00
Hanyuan
3ed270f839 Merge pull request #27 from penghanyuan/fix/deploy-ssh-broken-pipe-retry
fix(ci): reduce SSH broken pipe during remote image pull
2026-05-14 17:18:32 +02:00
penghanyuan
ae7ce72227 fix(ci): reduce SSH broken pipe during remote image pull
Add stable SSH keepalive/connect options and retry the remote docker pull candidate step so transient runner-network disconnects no longer fail deployment immediately.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-14 17:17:48 +02:00
Hanyuan
6c0857da1a Merge pull request #26 from penghanyuan/fix/deploy-ssh-keyscan-retry
Fix/deploy ssh keyscan retry
2026-05-14 17:08:39 +02:00
penghanyuan
6b81e11903 fix(ci): harden SSH host setup in API deploy workflow
Add retries for ssh-keyscan and fall back to non-strict host checking for transient network failures so reruns do not fail early before deployment steps.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-14 15:59:19 +02:00
Hanyuan
182b2f94d2 Merge pull request #25 from penghanyuan/development
Stabilize WS TTS and improve AssistantTypingBubble behavior and add e2e test
2026-05-14 14:49:07 +02:00
Hanyuan
835b8478a9 Merge pull request #24 from penghanyuan/feat/api-enable-mock-sms-login-staging
feat(api): enable mock SMS login on staging
2026-05-14 14:48:16 +02:00
penghanyuan
49133be46e feat(api): enable mock SMS login on staging
Allow staging deployments to expose /api/auth/mock/sms-login by reading APP_ENV from runtime env and setting staging APP_ENV plus MOCK_SMS_LOGIN_ENABLED in staging env config.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-14 14:47:13 +02:00
Kevin
c4d2a38b09 feat(expo): 后台超过 5 分钟才断开会话 WebSocket
- 进入 background 后延迟释放长连,回到前台则取消计时;短切应用保持连接
- 池支持 subscribeConversationPoolSlotDisposed;聊天页在槽位释放时同步状态
- 前台 active 时按需 connect 或重绑会话
- backgroundDisconnectAfterMs 默认 300_000(5 分钟)

未纳入:api/uploads/ 本地文件

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-13 17:12:08 +08:00
Kevin
6f6ac0d550 fix: 头像缓存版本号;移除回忆录撰写入口跳转聊天
- API:上传/预设头像 URL 追加 ?v=time.time_ns(),避免同路径缓存导致「只能换一次头像」
- Expo:回忆录 Tab 去掉撰写中「继续写作」及新建会话跳转;清理 memoir 文案键并更新 i18n 类型

未纳入提交:本地 api/uploads/(开发环境头像文件)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-13 16:15:21 +08:00
Kevin
c45a2c040b fix(expo): 暂停自动朗读后继续播放最新 TTS 片段
- usePlayer:paused 且 tts_auto 时清空队列并重置,再播当前片段
- 用 statusRef 与暂停同步,避免 WS 紧连 enqueue 时状态滞后
- 补充 use-player 单测

- api: 调整 copyright_source_pdf 脚本
- docs: 新增软著《岁月时书》软件设计说明书

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-13 15:01:50 +08:00