Commit Graph

446 Commits

Author SHA1 Message Date
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
Kevin
186375648d 软著pdf源码准备 2026-05-12 15:25:09 +08:00
Kevin
c794fe8ee8 chore(app-expo): bump version to 1.2.0
Align Expo config, package.json, and lockfile root with release tag v1.2.0.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-12 13:44:57 +08:00
Kevin
71bf62166e fix(app-expo): 稳定 WS TTS 与「正在回复」状态
- useRealtimeSession:恢复 uiRef 同步与 AppState 后台/前台重连,收窄长连 effect 依赖,修正 send API 类型
- 会话页:用派生条件控制 AssistantTypingBubble,避免缓存已有助手末条仍显示 typing
- RealtimeSession:在 commit 落缓存时统一 clearAssistantPendingUi,避免漏掉流式完成帧

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-12 13:42:54 +08:00
Sully
ddefb78dc4 Merge pull request #23 from penghanyuan/feat/english-support-and-ws-fix
- 添加英文模式支持
- 修复WS预热机制以及由此引起的语音tts功能异常
2026-05-12 11:31:17 +08:00
Kevin
b97bb64b4a feat(conversation): push topic chips after each assistant turn
- Extract maybe_send_topic_chips_ws for WS connect + pipeline reuse
- Default memoir stage to childhood when empty for chip bank lookup
- Resend suggestions after normal assistant reply (English/Chinese)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-12 11:16:39 +08:00
Kevin
d155e45a44 fix(conversation): topic chips after warmup + English chip copy
- Buffer topic_suggestions until chat UI attaches (uiOwner + callback); replay on attach
- build_topic_chips respects user language for label/text; router passes user_language

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-12 11:10:21 +08:00
Kevin
7e64fc3faf Merge commit e95582a: PR #20 proactive chat, topic chips, low-info turn plan
- Merge staging workflow parent and resolve conflicts with English/i18n and WS pool
- Re-greeting: language-aware fallbacks and prompts; router passes user_language
- RealtimeSession: topic suggestion callbacks + TTS sync path preserved

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-12 11:03:35 +08:00
Kevin
3d01085442 fix(conversation): 修复实时会话 TTS/回复被离屏 WS 抢占
- 列表预热仅预取消息缓存,避免后台 WebSocket 覆盖服务端连接
- RealtimeSession UI 回调按 owner 独占,防止 offscreen 覆盖聊天页
- 列表页聚焦时再 prewarm,会话页 TTS 入队优先 base64
- 管线下发 TTS 同时带 audio_base64 与 audio_url;协议说明同步
- 移除 TTS 排查用前后端调试日志,保留错误/告警
- 补充 WS / RealtimeSession / entry-warmup / 播放器相关单测

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-12 10:42:44 +08:00
Kevin
93be60f74c fix(tts): gate auto reply by ENABLE_TTS; allow on-demand and manual playback
- Pipeline: skip _send_tts_audio only for non-manual when ENABLE_TTS=false;
  remove enable_tts early return from handle_tts_request_on_demand.
- Tencent TTS: PrimaryLanguage/chunking follow user language preference only.
- Expo: let manual tts_audio bypass late-segment playback gate after interrupt.
- Docs: clarify ENABLE_TTS vs tts_request in api/.env.example and TTSProvider port.
- Tests: add manual bypass cases; adjust pipeline language tests for en+Chinese text.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-11 17:15:02 +08:00
Kevin
ccdc4e4277 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
Sully
e95582a5c3 Merge pull request #20 from penghanyuan/claude/agent-proactive-chat-UYHu9
feat: agent proactively re-engages users on returning sessions
2026-05-11 13:07:33 +08:00
Sully
dd2d47289d Merge branch 'development' into claude/agent-proactive-chat-UYHu9 2026-05-11 13:07:18 +08:00
Kevin
705fe951b3 feat(chat): 低信息短答主动续话;修复本地 dev 环境与迁移链
- interview_turn_plan: 识别低信息短回复,引导 AI 承接后主动追问新话题
- development.sh / docker-compose.dev: Postgres/Redis 端口与 .env 对齐,补充宿主机端口监听检查
- Alembic: 补回 0016 memory pipeline status、0017 segment narrative defer
- app-expo: api/ws URL 去掉末尾斜杠,避免 WS 双斜杠;更新 .env.staging

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-11 12:06:17 +08:00
Sully
cb84c00eca 添加staging release workflow (#22)
* update variable name

* update docker port

* fix alembic migration files

* 给远端 SSH 调用加了 keepalive

* fix app-expo code file format

* comment out quality test threshold

---------

Co-authored-by: Kevin <kevin@brighteng.org>
2026-05-11 11:33:07 +08:00
Kevin
5ce29aad64 comment out quality test threshold 2026-05-11 10:53:21 +08:00
Kevin
b9425e806b fix app-expo code file format 2026-05-11 10:25:06 +08:00
Kevin
219c833157 给远端 SSH 调用加了 keepalive 2026-05-11 10:07:07 +08:00