Files
life-echo/api/config/default.toml
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

240 lines
6.7 KiB
TOML

# Life Echo API — default configuration (SSOT base layer)
# Environment overlays: config/development.toml | staging.toml | production.toml
[deploy]
alembic_startup_fail_fast = false
access_token_expire_minutes = 120
refresh_token_expire_days = 30
refresh_token_reuse_grace_seconds = 30
mock_sms_login_enabled = false
tencent_sms_sdk_app_id = ""
tencent_sms_sign_name = ""
tencent_sms_template_id = ""
tencent_cos_bucket = ""
tencent_cos_base_url = ""
enable_tts = true
memoir_image_enabled = false
enable_docs = true
wechat_pay_app_id = ""
wechat_pay_mch_id = ""
wechat_pay_private_key_path = "certs/apiclient_key.pem"
wechat_pay_cert_serial_no = ""
wechat_pay_notify_url = ""
wechat_pay_platform_public_key_path = ""
wechat_pay_platform_public_key_id = ""
alipay_app_id = ""
alipay_notify_url = ""
liblib_template_uuid = ""
log_level = "INFO"
otel_enabled = false
otel_exporter_otlp_endpoint = "http://localhost:48317"
api_cors_origins = ""
[chat]
interview_max_tokens = 512
interview_max_segments = 2
interview_max_chars_per_segment = 380
opening_max_tokens = 380
profile_followup_max_tokens = 280
history_max_pairs = 15
history_max_chars = 6000
era_context_enabled = true
stage_detection_enabled = true
stage_detection_max_tokens = 128
interview_persona = "default"
interview_temperature = 0.93
memory_retrieval_enabled = true
memory_top_k = 8
memory_evidence_max_chars = 4096
memory_safe_evidence_format_enabled = true
reply_planner_llm_enabled = false
reply_planner_max_tokens = 256
reply_planner_temperature = 0.2
re_greeting_enabled = true
re_greeting_idle_hours = 6.0
topic_chips_enabled = true
topic_chips_max = 4
input_normalize_enabled = true
input_normalize_mode = "rules"
input_normalize_llm_max_tokens = 512
input_normalize_llm_max_input_chars = 8000
input_normalize_llm_voice_only = true
profile_max_turns = 8
profile_extract_max_tokens = 512
[memoir]
fidelity_check_enabled = true
fidelity_check_max_tokens = 512
oral_normalize_enabled = true
oral_normalize_mode = "rules"
oral_normalize_llm_max_tokens = 512
oral_normalize_llm_max_input_chars = 8000
phase1_batch_llm_enabled = true
phase1_batch_llm_max_tokens = 4096
phase1_batch_llm_chunk_size = 24
pipeline_run_ttl_seconds = 172800
extraction_max_tokens = 1024
classification_max_tokens = 256
narrative_max_tokens = 4096
narrative_merge_max_tokens = 8192
title_max_tokens = 256
story_route_max_tokens = 1024
story_batch_plan_max_tokens = 4096
segment_batch_min_chars = 50
segment_batch_max_wait_seconds = 60.0
narrative_immediate_char_threshold = 50
narrative_batch_min_segments = 3
narrative_batch_min_chars = 80
narrative_batch_max_wait_seconds = 120.0
extraction_updates_current_stage = false
fidelity_fail_open_on_parse_error = false
narrative_evidence_overlap_min_chars = 14
evidence_scene_anchor_check_enabled = true
title_slots_require_body_or_oral_match = true
title_hay_grounding_strict_phrases_enabled = true
recompose_retry_on_lock_contention = true
phase2_singleflight_immediate = true
route_defer_enabled = true
route_defer_seconds = 120.0
route_defer_max_attempts = 3
quality_pass_enabled = true
quality_pass_delay_seconds = 5
story_route_append_guardrail_oral_chars = 1800
min_inline_images_for_chapter_cover = 1
image_poll_interval = 3
image_max_attempts = 20
image_provider = "liblib"
image_style_default = "watercolor"
image_size_default = "1280x720"
image_download_hosts = ""
image_prompt_fallback_disabled = false
[memory]
enrichment_enabled = true
enrichment_max_chars = 12000
compaction_enabled = true
compaction_debounce_seconds = 105
compaction_lock_ttl_seconds = 600
compaction_chunk_similarity_threshold = 0.92
compaction_min_layers_for_exclude = 2
compaction_max_chunks_per_run = 200
compaction_max_excludes_per_run = 50
compaction_max_neighbors_per_chunk = 25
compaction_text_jaccard_min = 0.55
compaction_metadata_event_year_window = 1
compaction_sweep_recent_hours = 24
[story]
image_min_body_chars = 400
image_enqueue_dedup_ttl = 300
recompose_chapter_delay_seconds = 8
chapter_pipeline_lock_ttl_seconds = 360
append_max_canonical_chars = 12000
append_max_versions = 20
route_candidate_body_max_chars = 2200
route_candidate_total_max_chars = 20000
route_long_body_head_chars = 700
route_long_body_tail_chars = 700
route_summary_min_chars = 30
route_index_preview_chars = 140
title_min_body_chars = 60
evidence_top_k_default = 10
evidence_top_k_large_batch = 5
evidence_large_batch_threshold = 3
[eval]
judge_base_url = "https://open.bigmodel.cn/api/paas/v4"
judge_model = "glm-5"
judge_temperature = 0.3
judge_deepseek_model = "deepseek-v4-flash"
judge_deepseek_thinking_enabled = false
judge_deepseek_context_window_tokens = 64000
judge_context_window_tokens = 200000
judge_completion_reserve_tokens = 4096
judge_prompt_budget_safety_tokens = 2048
judge_approx_tokens_per_char = 1.0
judge_max_transcript_chars = 0
judge_max_compare_transcript_chars_each = 0
judge_compare_prompt_overhead_chars = 10000
judge_memoir_chapter_concurrency = 4
judge_memoir_body_max_chars = 36000
judge_memoir_evidence_max_chars = 32000
judge_memoir_completion_max_tokens = 3072
candidate_temperature = 0.7
gate_protected_regression_threshold = 2.0
execution_enabled = true
internal_enable_docs = false
internal_cors_origins = ""
[llm]
deepseek_base_url = "https://api.deepseek.com"
deepseek_model = "deepseek-v4-flash"
deepseek_thinking_enabled = false
temperature = 0.7
fast_model = ""
embedding_base_url = "https://open.bigmodel.cn/api/paas/v4"
embedding_model = "embedding-3"
[asr]
provider = "whisper"
model_size = "small"
device = "auto"
compute_type = "auto"
model_cache_dir = ""
[tts]
provider = "tencent"
voice_type = 501004
voice_type_en = 501004
codec = "mp3"
[redis]
socket_timeout_seconds = 5.0
socket_connect_timeout_seconds = 2.0
health_check_interval_seconds = 30
task_tracker_ttl_seconds = 86400
[celery]
memory_enrichment_queue = "memory_idle"
broker_pool_limit = 10
broker_connection_retry_on_startup = true
memoir_soft_time_limit = 1800
memoir_hard_time_limit = 2400
image_soft_time_limit = 600
image_hard_time_limit = 900
compaction_sweep_soft_time_limit = 300
compaction_sweep_hard_time_limit = 600
enrichment_soft_time_limit = 660
enrichment_hard_time_limit = 960
[alembic]
run_on_startup = true
max_retries = 3
retry_base_seconds = 1.0
[agent_log]
agent_verbose = false
max_chars = 4096
omit_system_message_body = true
json_prompt_prefix_chars = 0
json_prompt_prefix_only_if_len_gt = 4000
prompt_mode = "preview"
prompt_dedup = false
celery_log_level = ""
httpx_log_level = ""
log_json_file = ""
[otel]
exporter_insecure = true
service_name = "life-echo-api"
metric_export_interval_ms = 10000
[misc]
algorithm = "HS256"
redis_session_ttl = 86400
tencent_sms_template_param_count = 2
tencent_cos_region = "ap-shanghai"
liblib_base_url = "https://openapi.liblibai.cloud"
alipay_sign_type = "RSA2"
alipay_under_development = "true"