2026-03-23 13:21:07 +08:00
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# Life Echo API — staging(预发)
|
|
|
|
|
|
#
|
2026-05-17 17:10:30 +02:00
|
|
|
|
# 基于 .env.production 生成;staging 发布时 workflow 会上传并复制为运行时 .env。
|
|
|
|
|
|
# 不要把生产密钥误填进本文件(当前与 production 共用同一套三方密钥)。
|
2026-03-23 13:21:07 +08:00
|
|
|
|
# =============================================================================
|
|
|
|
|
|
|
2026-05-17 17:10:30 +02:00
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# Docker Compose(宿主机独立 Caddy 反代到本 API)
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
LIFE_ECHO_API_HOST_BIND=0.0.0.0
|
|
|
|
|
|
LIFE_ECHO_API_HOST_PORT=8000
|
|
|
|
|
|
POSTGRES_HOST_PORT=15432
|
|
|
|
|
|
|
2026-03-23 13:21:07 +08:00
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# Logging(loguru sink 最低级别:TRACE / DEBUG / INFO / WARNING / ERROR / CRITICAL)
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
LOG_LEVEL=INFO
|
feat(eval): memoir A/B chapter judging and eval-web parity with dialogue
- Judge baseline excerpt and library chapter separately; build_memoir_compare_summary for gate, nine-dim and leaf deltas.
- Memoir SSE chapter payload: baseline_judge, compare_summary, baseline_judge_error.
- MemoirJudgeOutput: loose score coercion and post-validate clamp; memoir judge prompt caps from settings.
- app-eval-web: two-column MemoirScoreCard layout, MemoirCompareSummary, chapter blocks and CSS.
- Add memoir_compare_summary, log_events, celery_log_context, memoir_pipeline_progress; tests and migration 0014.
- Misc: memory/evidence and enrichment paths, task/orchestrator updates, internal-eval docs, env examples.
2026-04-10 10:23:43 +08:00
|
|
|
|
# Agent 单行 INFO 摘要;与 LOG_LEVEL 独立
|
2026-04-03 13:49:24 +08:00
|
|
|
|
# LOG_AGENT_VERBOSE=0
|
feat(eval): memoir A/B chapter judging and eval-web parity with dialogue
- Judge baseline excerpt and library chapter separately; build_memoir_compare_summary for gate, nine-dim and leaf deltas.
- Memoir SSE chapter payload: baseline_judge, compare_summary, baseline_judge_error.
- MemoirJudgeOutput: loose score coercion and post-validate clamp; memoir judge prompt caps from settings.
- app-eval-web: two-column MemoirScoreCard layout, MemoirCompareSummary, chapter blocks and CSS.
- Add memoir_compare_summary, log_events, celery_log_context, memoir_pipeline_progress; tests and migration 0014.
- Misc: memory/evidence and enrichment paths, task/orchestrator updates, internal-eval docs, env examples.
2026-04-10 10:23:43 +08:00
|
|
|
|
# DEBUG 下预览上限(默认 4096);0=全文
|
2026-04-03 13:49:24 +08:00
|
|
|
|
# AGENT_LOG_MAX_CHARS=4096
|
feat(eval): memoir A/B chapter judging and eval-web parity with dialogue
- Judge baseline excerpt and library chapter separately; build_memoir_compare_summary for gate, nine-dim and leaf deltas.
- Memoir SSE chapter payload: baseline_judge, compare_summary, baseline_judge_error.
- MemoirJudgeOutput: loose score coercion and post-validate clamp; memoir judge prompt caps from settings.
- app-eval-web: two-column MemoirScoreCard layout, MemoirCompareSummary, chapter blocks and CSS.
- Add memoir_compare_summary, log_events, celery_log_context, memoir_pipeline_progress; tests and migration 0014.
- Misc: memory/evidence and enrichment paths, task/orchestrator updates, internal-eval docs, env examples.
2026-04-10 10:23:43 +08:00
|
|
|
|
# DEBUG 下 *.prompt:preview | hash_only
|
|
|
|
|
|
# AGENT_LOG_PROMPT_MODE=preview
|
|
|
|
|
|
# AGENT_LOG_PROMPT_DEDUP=0
|
2026-04-03 13:49:24 +08:00
|
|
|
|
# DEBUG 下访谈/资料:省略 SystemMessage 正文(仅 total_len+sha12);0/false=打出全文
|
|
|
|
|
|
# AGENT_LOG_OMIT_SYSTEM_MESSAGE_BODY=1
|
feat(eval): memoir A/B chapter judging and eval-web parity with dialogue
- Judge baseline excerpt and library chapter separately; build_memoir_compare_summary for gate, nine-dim and leaf deltas.
- Memoir SSE chapter payload: baseline_judge, compare_summary, baseline_judge_error.
- MemoirJudgeOutput: loose score coercion and post-validate clamp; memoir judge prompt caps from settings.
- app-eval-web: two-column MemoirScoreCard layout, MemoirCompareSummary, chapter blocks and CSS.
- Add memoir_compare_summary, log_events, celery_log_context, memoir_pipeline_progress; tests and migration 0014.
- Misc: memory/evidence and enrichment paths, task/orchestrator updates, internal-eval docs, env examples.
2026-04-10 10:23:43 +08:00
|
|
|
|
# DEBUG 下超长单段 *.prompt:先跳过前 N 字符再预览
|
2026-04-03 13:49:24 +08:00
|
|
|
|
# AGENT_LOG_JSON_PROMPT_PREFIX_CHARS=0
|
|
|
|
|
|
# AGENT_LOG_JSON_PROMPT_PREFIX_ONLY_IF_LEN_GT=4000
|
|
|
|
|
|
# 第三方 stdlib logging(空=自动)
|
|
|
|
|
|
# CELERY_LOG_LEVEL=
|
|
|
|
|
|
# HTTPX_LOG_LEVEL=
|
2026-03-23 13:21:07 +08:00
|
|
|
|
|
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
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# OpenTelemetry(预发;compose 接入 LGTM 后设 OTEL_ENABLED=true,见 docs/observability.md)
|
|
|
|
|
|
# API/Celery 容器内 endpoint 用服务名;Grafana 宿主机端口见 observability compose(默认 48300 等)
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
OTEL_ENABLED=false
|
|
|
|
|
|
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
|
|
|
|
|
|
OTEL_EXPORTER_OTLP_INSECURE=true
|
|
|
|
|
|
OTEL_SERVICE_NAME=life-echo-api
|
|
|
|
|
|
OTEL_TRACES_SAMPLER=parentbased_traceidratio
|
|
|
|
|
|
OTEL_TRACES_SAMPLER_ARG=0.1
|
|
|
|
|
|
# OTEL_METRIC_EXPORT_INTERVAL_MS=10000
|
|
|
|
|
|
|
2026-03-23 13:21:07 +08:00
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# LLM / DeepSeek
|
|
|
|
|
|
# =============================================================================
|
2026-05-17 17:10:30 +02:00
|
|
|
|
DEEPSEEK_API_KEY=sk-09f17fb61c5a4299a3afc2a01de7af75
|
2026-03-23 13:21:07 +08:00
|
|
|
|
DEEPSEEK_BASE_URL=https://api.deepseek.com
|
2026-04-27 14:34:30 +08:00
|
|
|
|
DEEPSEEK_MODEL=deepseek-v4-flash
|
2026-03-23 13:21:07 +08:00
|
|
|
|
|
2026-05-17 17:10:30 +02:00
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# Memory 向量(智谱 BigModel 国内 embedding-3;与 DeepSeek/OpenAI 用途分离)
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
ZHIPU_API_KEY=524eda18eb3848e881eefe4c7ef17ec2.xBmGUabYDEa44m3M
|
|
|
|
|
|
EMBEDDING_MODEL=embedding-3
|
|
|
|
|
|
|
|
|
|
|
|
# Chat 访谈
|
|
|
|
|
|
CHAT_ERA_CONTEXT_ENABLED=true
|
|
|
|
|
|
CHAT_INTERVIEW_PERSONA=warm_listener
|
|
|
|
|
|
CHAT_INTERVIEW_TEMPERATURE=0.65
|
|
|
|
|
|
CHAT_MEMORY_TOP_K=4
|
|
|
|
|
|
CHAT_MEMORY_EVIDENCE_MAX_CHARS=1400
|
|
|
|
|
|
CHAT_REPLY_PLANNER_LLM_ENABLED=true
|
|
|
|
|
|
|
|
|
|
|
|
# Memoir:叙事前口述归一
|
|
|
|
|
|
MEMOIR_ORAL_NORMALIZE_ENABLED=true
|
|
|
|
|
|
MEMOIR_ORAL_NORMALIZE_MODE=llm
|
|
|
|
|
|
MEMOIR_ORAL_NORMALIZE_LLM_MAX_TOKENS=512
|
|
|
|
|
|
MEMOIR_ORAL_NORMALIZE_LLM_MAX_INPUT_CHARS=8000
|
|
|
|
|
|
|
2026-03-23 13:21:07 +08:00
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# Database
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
DATABASE_URL=postgresql://postgres:postgres@postgres:5432/life_echo
|
|
|
|
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# Redis
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
REDIS_URL=redis://redis:6379/0
|
|
|
|
|
|
REDIS_SESSION_TTL=86400
|
|
|
|
|
|
|
2026-04-03 11:43:16 +08:00
|
|
|
|
# =============================================================================
|
2026-05-17 17:10:30 +02:00
|
|
|
|
# Memory compaction
|
2026-04-03 11:43:16 +08:00
|
|
|
|
# =============================================================================
|
|
|
|
|
|
MEMORY_COMPACTION_ENABLED=true
|
|
|
|
|
|
|
2026-03-23 13:21:07 +08:00
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# Auth
|
|
|
|
|
|
# =============================================================================
|
2026-05-17 17:10:30 +02:00
|
|
|
|
SECRET_KEY=cf47555c7ecbe5ddb7fd2113c59e08a8bcb110810c42f7c644e06a5acc898608
|
2026-03-23 13:21:07 +08:00
|
|
|
|
ALGORITHM=HS256
|
|
|
|
|
|
ACCESS_TOKEN_EXPIRE_MINUTES=120
|
2026-05-14 14:47:13 +02:00
|
|
|
|
APP_ENV=staging
|
|
|
|
|
|
MOCK_SMS_LOGIN_ENABLED=1
|
2026-03-23 13:21:07 +08:00
|
|
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# Tencent Cloud — 短信
|
|
|
|
|
|
# =============================================================================
|
2026-05-17 17:10:30 +02:00
|
|
|
|
TENCENT_SMS_SECRET_ID=AKIDa2ILCwUr56uVt31oU0JOHxPfGhvvkLiq
|
|
|
|
|
|
TENCENT_SMS_SECRET_KEY=xiFbjlZ9XheS2NWYLvHRPAh2A5nGYcR2
|
|
|
|
|
|
TENCENT_SMS_SDK_APP_ID=1401010099
|
|
|
|
|
|
TENCENT_SMS_SIGN_NAME=上海华嘎科技有限公司
|
|
|
|
|
|
TENCENT_SMS_TEMPLATE_ID=2592163
|
2026-03-23 13:21:07 +08:00
|
|
|
|
TENCENT_SMS_TEMPLATE_PARAM_COUNT=1
|
|
|
|
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# ASR Provider(whisper | tencent)
|
|
|
|
|
|
# =============================================================================
|
2026-05-17 17:10:30 +02:00
|
|
|
|
ASR_PROVIDER=tencent
|
2026-03-23 13:21:07 +08:00
|
|
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# Whisper ASR(ASR_PROVIDER=whisper 时使用)
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
ASR_MODEL_SIZE=small
|
|
|
|
|
|
ASR_DEVICE=cpu
|
|
|
|
|
|
ASR_COMPUTE_TYPE=int8
|
|
|
|
|
|
|
|
|
|
|
|
# =============================================================================
|
2026-05-17 17:10:30 +02:00
|
|
|
|
# Tencent Cloud — 一句话 ASR + TTS
|
2026-03-23 13:21:07 +08:00
|
|
|
|
# =============================================================================
|
2026-05-17 17:10:30 +02:00
|
|
|
|
TENCENT_SECRET_ID=AKIDa2ILCwUr56uVt31oU0JOHxPfGhvvkLiq
|
|
|
|
|
|
TENCENT_SECRET_KEY=xiFbjlZ9XheS2NWYLvHRPAh2A5nGYcR2
|
2026-03-23 13:21:07 +08:00
|
|
|
|
|
|
|
|
|
|
# =============================================================================
|
2026-05-17 17:10:30 +02:00
|
|
|
|
# TTS
|
2026-03-23 13:21:07 +08:00
|
|
|
|
# =============================================================================
|
|
|
|
|
|
ENABLE_TTS=true
|
|
|
|
|
|
TTS_PROVIDER=tencent
|
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
|
|
|
|
TTS_VOICE_TYPE=501004
|
2026-03-23 13:21:07 +08:00
|
|
|
|
TTS_CODEC=mp3
|
|
|
|
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# WeChat Pay
|
|
|
|
|
|
# =============================================================================
|
2026-05-17 17:10:30 +02:00
|
|
|
|
WECHAT_PAY_APP_ID=wx1df508452e06cfb8
|
|
|
|
|
|
WECHAT_PAY_MCH_ID=1662979099
|
|
|
|
|
|
WECHAT_PAY_API_V3_KEY=xjvGSJLGJAJfjgskfjslafjsajsdjals
|
2026-03-23 13:21:07 +08:00
|
|
|
|
WECHAT_PAY_PRIVATE_KEY_PATH=certs/apiclient_key.pem
|
2026-05-17 17:10:30 +02:00
|
|
|
|
WECHAT_PAY_CERT_SERIAL_NO=1AA82328AC1456C6F115B014606F22CD621D2032
|
|
|
|
|
|
WECHAT_PAY_NOTIFY_URL=https://lifecho.worldsplats.com/api/payment/notify/wechat
|
2026-03-23 13:21:07 +08:00
|
|
|
|
|
|
|
|
|
|
# =============================================================================
|
2026-05-17 17:10:30 +02:00
|
|
|
|
# Alipay(未接入时保持空字符串)
|
2026-03-23 13:21:07 +08:00
|
|
|
|
# =============================================================================
|
2026-05-17 17:10:30 +02:00
|
|
|
|
ALIPAY_APP_ID=
|
|
|
|
|
|
ALIPAY_PRIVATE_KEY=
|
|
|
|
|
|
ALIPAY_PUBLIC_KEY=
|
|
|
|
|
|
ALIPAY_NOTIFY_URL=https://lifecho.worldsplats.com/api/payment/notify/alipay
|
2026-03-23 13:21:07 +08:00
|
|
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# Misc
|
|
|
|
|
|
# =============================================================================
|
2026-05-17 17:10:30 +02:00
|
|
|
|
ENABLE_TEST_SUBSCRIPTION=1
|
2026-03-23 13:21:07 +08:00
|
|
|
|
|
|
|
|
|
|
# =============================================================================
|
2026-05-17 17:10:30 +02:00
|
|
|
|
# Memoir image generation
|
2026-03-23 13:21:07 +08:00
|
|
|
|
# =============================================================================
|
2026-05-17 17:10:30 +02:00
|
|
|
|
MEMOIR_IMAGE_ENABLED=true
|
2026-03-23 13:21:07 +08:00
|
|
|
|
MEMOIR_IMAGE_POLL_INTERVAL=3
|
|
|
|
|
|
MEMOIR_IMAGE_MAX_ATTEMPTS=20
|
|
|
|
|
|
MEMOIR_IMAGE_PROVIDER=liblib
|
|
|
|
|
|
MEMOIR_IMAGE_STYLE_DEFAULT=watercolor
|
|
|
|
|
|
MEMOIR_IMAGE_SIZE_DEFAULT=1280x720
|
2026-04-16 20:42:54 +08:00
|
|
|
|
MEMOIR_MIN_INLINE_IMAGES_FOR_CHAPTER_COVER=1
|
2026-05-17 17:10:30 +02:00
|
|
|
|
STORY_IMAGE_MIN_BODY_CHARS=800
|
|
|
|
|
|
MEMOIR_NARRATIVE_FALLBACK_BODY_RATIO=0.5
|
|
|
|
|
|
MEMOIR_NARRATIVE_FALLBACK_MIN_CHARS=20
|
2026-03-23 13:21:07 +08:00
|
|
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# Liblib image provider
|
|
|
|
|
|
# =============================================================================
|
2026-05-17 17:10:30 +02:00
|
|
|
|
LIBLIB_ACCESS_KEY=zrDp6quCOKlLwcewOEfrog
|
|
|
|
|
|
LIBLIB_SECRET_KEY=iTVHo5Nf3KA-xpC1Mja80bC93u6chJem
|
2026-03-23 13:21:07 +08:00
|
|
|
|
LIBLIB_BASE_URL=https://openapi.liblibai.cloud
|
2026-05-17 17:10:30 +02:00
|
|
|
|
LIBLIB_TEMPLATE_UUID=5d7e67009b344550bc1aa6ccbfa1d7f4
|
2026-03-23 13:21:07 +08:00
|
|
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# Tencent Cloud — COS(回忆录图片存储)
|
|
|
|
|
|
# =============================================================================
|
2026-05-17 17:10:30 +02:00
|
|
|
|
TENCENT_COS_SECRET_ID=AKIDa2ILCwUr56uVt31oU0JOHxPfGhvvkLiq
|
|
|
|
|
|
TENCENT_COS_SECRET_KEY=xiFbjlZ9XheS2NWYLvHRPAh2A5nGYcR2
|
2026-03-23 13:21:07 +08:00
|
|
|
|
TENCENT_COS_REGION=ap-shanghai
|
2026-05-17 17:10:30 +02:00
|
|
|
|
TENCENT_COS_BUCKET=life-echo-dev-1319381411
|
|
|
|
|
|
TENCENT_COS_BASE_URL=https://life-echo-dev-1319381411.cos.ap-shanghai.myqcloud.com
|