Files
ZNJJ-api-server/.env.example
T
Eric Wang 24e2cfbe10 fix(backends): make streamed replies and session state consistent
- Validate stage prefixes before forwarding model tokens. Invalid prefixes
  may use the existing repair budget; once output starts, validation failure
  aborts the turn without appending a regenerated reply. Bound the token
  queue and close inner streams when consumption stops.
- Replace delete-time lock eviction with reference-counted session locks
  covering holders and waiters. Serialize set/get with chat/stream/delete
  and release cancelled waiters without replacing a live lock.
- Store person synonyms under workflow-native driver keys and expose
  consistent alias views to single/group reads and graph prompt injection.
- Separate committed field patches from public formUpdate visibility.
  Commit callbacks keep repository fields synchronized even when updates
  are hidden or the consumer closes after graph completion.
- Disable OpenAI SDK automatic retries. Own bounded retry attempts in the
  application, use 1/2/4 second backoff, retry streams only before text is
  emitted, enforce attempt timeouts, and close upstream/client resources.
- Translate FastGPT SDK max_retries (total attempts) from the configured
  extra-retry count, and verify the real SDK loop uses four attempts.
- Document the per-LLM budget and streaming failure semantics without
  claiming the whole multi-call HTTP turn has the same timeout.

Validation: 267 offline tests passed, including actual SDK requests through
MockTransport, stream repair/abort, timeout/close, lock races, aliases and
formUpdate visibility; existing four dependency deprecation warnings.
2026-10-23 15:54:51 +08:00

42 lines
1.9 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
DATABASE_URL=sqlite:///./test.db
SECRET_KEY=your_secret_key
DEBUG=True
ANALYSIS_SERVICE_URL=http://127.0.0.1:3030
ANALYSIS_AUTH_TOKEN=replace-with-fastgpt-api-key
APP_ID=replace-with-fastgpt-app-id
# Voice demo (Pipecat /ws-product). Relative to project root, or an absolute path.
VOICE_CONFIG=config/voice.json
# LangGraph chat backend(作业 2)
# AGENT_BACKEND=langgraph
#
# 命名 LLM 提供商组(均为 OpenAI 兼容接口):LLM_PROVIDERS 声明名单,
# LLM_PROVIDER 选择当前生效组;缺省或 fake = 离线脚本模型。
# 每组 LLM_<名>_BASE_URL / _API_KEY / _MODEL 必填;
# 可选 _TIMEOUT_SECONDS / _MAX_RETRIES / _TEMPERATURE / _EXTRA_BODY(JSON 字符串,
# 如思考开关 KIMI 网关为 {"reasoning_effort":"none"})。
# 超时/重试缺省:每次尝试 60 秒,最多额外重试 3 次,退避 1、2、4 秒。
# SDK 自动重试关闭;流式发出首个文本 token 后不重试。
# 单次 LLM 调用预算最多 247 秒(另加响应关闭清理);不是整轮聊天总超时。
# AGENT_HISTORY_MESSAGES=50:注入模型的对话历史上限(最近 N 条,
# 双向计数);调大支持长对话;0 = 不截断(对齐 FastGPT 全量历史)。
# AGENT_HISTORY_MESSAGES=0
# LLM_PROVIDERS=deepseek,kimi,gpt6luna
# LLM_PROVIDER=deepseek
# LLM_DEEPSEEK_BASE_URL=https://api.openai.com/v1
# LLM_DEEPSEEK_API_KEY=replace-with-llm-api-key
# LLM_DEEPSEEK_MODEL=gpt-4o-mini
# LLM_DEEPSEEK_EXTRA_BODY={"reasoning_effort":"none"}
# LLM_KIMI_BASE_URL=http://127.0.0.1:3425/v1
# LLM_KIMI_API_KEY=magpie
# LLM_KIMI_MODEL=kimi-code-cn/kimi-for-coding
# LLM_KIMI_EXTRA_BODY={"reasoning_effort":"none"}
# LLM_GPT6LUNA_BASE_URL=http://127.0.0.1:3425/v1
# LLM_GPT6LUNA_API_KEY=magpie
# LLM_GPT6LUNA_MODEL=codex/gpt-6-luna
# LLM_GPT6LUNA_EXTRA_BODY={"reasoning_effort":"none"}
# 本地网关需直连(系统代理会导致 5xx);外部网关如需代理:
# LLM_HTTP_TRUST_ENV=true