Files
ZNJJ-api-server/.env.example
T
Eric Wang b8008da959 feat(config): configurable conversation history window (B3)
FastGPT maintains full history server-side; LangGraph truncated the
injected history at a hardcoded 50 messages, so long conversations
behaved differently across backends.

- Config.AGENT_HISTORY_MESSAGES (env): max messages injected into the
  model prompt (recent N, both roles counted); default 50 unchanged;
  larger values support long conversations; 0 = no truncation, matching
  FastGPT's full-history semantics. Only the injected window is
  affected - dialogue stays fully persisted in the checkpoint.
- validate(): rejects negative values; 0 and positive accepted
- conversation_history reads the config (import-time class attribute,
  monkeypatched in tests); explicit None-check keeps 0 falsy-safe
- .env.example documents the knob

Verified: 225 unit tests (6 new history-window tests)
2026-10-22 23:01:40 +08:00

41 lines
1.8 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 次,与 FastGPT 客户端 SLA 对齐
# (契约测试 test/backends/test_sla_alignment.py)。
# 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