# Example environment for the formal cloud pipeline.
# Copy to .env locally or configure these values in the cloud runtime.
# Never commit real secrets.

# -----------------------------------------------------------------------------
# Formal creation knowledge database
# -----------------------------------------------------------------------------
CK_DB_HOST=
CK_DB_PORT=5432
CK_DB_NAME=creation_knowledge_prod
CK_DB_USER=ck_app
CK_DB_PASSWORD=
CK_DB_SCHEMA=creation_knowledge
CK_DB_SSH_TUNNEL=
CK_DB_POOL_MIN=1
CK_DB_POOL_MAX=10

# Optional migration/admin path. Runtime writes should use CK_DB_USER above;
# schema migrations should use an owner/admin channel such as root SSH -> postgres.
CK_DB_ADMIN_SSH_USER=root
CK_DB_ADMIN_SSH_HOST=
CK_DB_ADMIN_SSH_KEY=
CK_DB_ADMIN_PG_SYSTEM_USER=postgres
CK_DB_ADMIN_PSQL="runuser -u postgres -- psql -d creation_knowledge_prod -v ON_ERROR_STOP=1"
CK_DB_MIGRATION_APPLY="ssh -i <key> -o BatchMode=yes -o ConnectTimeout=8 -o StrictHostKeyChecking=accept-new root@<host> \"runuser -u postgres -- psql -d creation_knowledge_prod -v ON_ERROR_STOP=1\" < path/to/migration.sql"

# -----------------------------------------------------------------------------
# Pipeline tracing ledger
# -----------------------------------------------------------------------------
CK_TRACE_ENABLED=true
CK_TRACE_CAPTURE_REQUEST=true
CK_TRACE_CAPTURE_RESPONSE=true
CK_TRACE_MAX_PAYLOAD_CHARS=50000

# -----------------------------------------------------------------------------
# Upstream Open AIGC / category-tree database
# Used for scope tree dumping only. Do not use this as the formal state DB.
# -----------------------------------------------------------------------------
OPEN_AIGC_PG_HOST=
OPEN_AIGC_PG_PORT=5432
OPEN_AIGC_PG_USER=
OPEN_AIGC_PG_PASSWORD=
OPEN_AIGC_PG_DB_NAME=open_aigc
CK_PG_SCHEMA=creation_knowledge

# -----------------------------------------------------------------------------
# Crawlers and platform APIs
# -----------------------------------------------------------------------------
AIDDIT_CRAWLER_BASE_URL=http://crawler.aiddit.com
AIDDIT_CRAWLER_TIMEOUT_SECONDS=30
PIAOQUANTV_DOUYIN_BASE_URL=http://crawapi.piaoquantv.com
PIAOQUANTV_DOUYIN_ACCOUNT_ID=
PIAOQUANTV_DOUYIN_COOKIE_BATCH=default

CREATION_SEARCH_DEFAULT_LIMIT=5
CREATION_SEARCH_CONTENT_TYPE=图文
CREATION_SEARCH_SORT_TYPE=综合

# -----------------------------------------------------------------------------
# OSS/CDN media transfer
# -----------------------------------------------------------------------------
CRAWLER_OSS_UPLOAD_URL=http://crawler-upload-v2.aiddit.com/crawler/oss/upload_stream
CRAWLER_OSS_UPLOAD_TIMEOUT_SECONDS=60
CK_VIDEO_OSS_RETRY_DELAYS_SECONDS=5,10

# -----------------------------------------------------------------------------
# External knowledge ingest API
# Leave CK_INGEST_API_URL empty to keep real ingest disabled. Dry-run ingest does
# not call this endpoint.
# -----------------------------------------------------------------------------
CK_INGEST_API_URL=
CK_INGEST_TOKEN=
CK_INGEST_TIMEOUT_SECONDS=30
CK_INGEST_RETRY_DELAYS_SECONDS=1,3

# -----------------------------------------------------------------------------
# LLM providers
# -----------------------------------------------------------------------------
ALIYUN_BAILIAN_API_KEY=
ALIYUN_BAILIAN_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
ALIYUN_BAILIAN_VL_MODEL=qwen-vl-plus
ALIYUN_BAILIAN_TEXT_MODEL=qwen-plus
ALIYUN_BAILIAN_TIMEOUT_SECONDS=120

OPENROUTER_API_KEY=
OPENROUTER_BASE_URL=https://openrouter.ai/api/v1
OPENROUTER_MODEL=google/gemini-3-flash-preview
OPENROUTER_TIMEOUT_SECONDS=90

# Ark is used by query filtering fallback and scope embeddings.
ARK_API_KEY=
ARK_CHAT_MODEL=doubao-seed-1-6-flash-250615
ARK_CHAT_URL=https://ark.cn-beijing.volces.com/api/v3/chat/completions
ARK_EMBEDDING_EP=
ARK_EMBEDDING_URL=https://ark.cn-beijing.volces.com/api/v3/embeddings/multimodal
ARK_EMBEDDING_DIM=2048

# -----------------------------------------------------------------------------
# Local development only
# -----------------------------------------------------------------------------
CK_ENV_FILE=.env
CK_DATA_DIR=data
CK_DEMO_DATA_DIR=data/demo
CK_MAX_CARDS=12
CK_FRAMES_DIR=runtime/frames
CK_DOUYIN_RATIO=540p
