.env 完成。复制 example.env 并填入你的值:
配置级别
每个集成都有一个配置级别,表示其重要性:注意:管理员配置的模型(管理员 → 模型页面)可以替代 LLM 环境变量。健康检查会考虑两个来源。
前端(仅本地开发)
前端有一个仅用于本地开发的独立环境文件:frontend/.env.local。
此文件在 Docker 中不使用。 在 Docker 容器内,Next.js 在内部将 /api/* 代理到 Python 后端(端口 8000 是容器内部的),因此不需要前端环境文件。
对于本地开发,默认设置开箱即用 — 除非你的后端运行在非默认端口,否则不需要创建 frontend/.env.local。
如果需要覆盖,请手动创建 frontend/.env.local:
构建时注意:NEXT_PUBLIC_*变量在pnpm build时被烘焙到 JS 包中。在运行时更改它们(例如通过根目录.env)无效 — 这就是为什么它们仅存在于本地开发的frontend/.env.local中。
LLM (Required)
Resolution order: User Preference → Admin Models (DB) → ENV Fallback. If an admin model with role “General” is configured in Admin → Models, these ENV vars serve as fallback only. The health check considers both sources.
让 ENV 回退与管理面板保持同步
在管理面板 → 模型中启用模型组后,运行时会从该模型组获取模型,上面的LLM_*/FAST_LLM_*/REASONING_LLM_*值仅作为回退。不会打开数据库的旁路仍会直接读取这些值:scripts/translate.py(i18n 预提交钩子)、evals/、Jina/OpenAI 重排器以及图像生成。为避免它们切换到过时的提供商,请将活动模型组复制到环境变量文件中:
MarkItDown OCR Resolution
Theconvert_to_markdown built-in tool and the RAG ingestion pipeline both use Microsoft’s MarkItDown + the official markitdown-ocr plugin to extract text from documents — including OCR on embedded images and scanned PDF pages when a vision-capable LLM is available.
The tool reads two kinds of source: a file the calling user uploaded, named by its file_id, and an http:// or https:// URL. URLs are downloaded with the same restrictions as web_fetch and http_request (no private, loopback, link-local or metadata addresses, redirects included). Local paths, file://, data: and other schemes are refused.
Vision LLM resolution order (first match wins):
Reasoning models are never preferred for OCR. Reasoning tiers (
o1, o3-mini, DeepSeek-R1) historically lack vision support and are the wrong tool for OCR anyway — OCR is a perception task, not deliberation. If a workspace has only a reasoning model with supports_vision=True it will still be picked up via the primary-LLM path, but the resolver does not actively rank it above fast/general.
Zero-regression fallback: when no vision-capable model is found at any level, OCR is silently disabled and MarkItDown runs in text-only mode. Word/PowerPoint/Excel embedded-image OCR becomes unavailable (same as before this feature shipped), but all other text extraction (headings, tables, paragraph text) continues to work unchanged. There is never a case where adding this feature made extraction worse than the previous behavior.
Non-OpenAI providers (Anthropic, Google Gemini, etc.) are supported transparently: the resolved LLM is wrapped in a LiteLLMOpenAIShim that routes chat.completions.create(...) calls through litellm.completion(), which handles the provider-specific message format translation (e.g. Anthropic’s source.type="base64" image block). One shim covers every provider LiteLLM supports — adding a new provider costs zero code changes in FIM One.
扩展思维(推理)
当设置LLM_REASONING_EFFORT 时,FIM One 启用模型的扩展思维能力,使内部思维链在 UI 的”思维”步骤中显示。FIM One 使用 LiteLLM 自动将推理努力参数转换为每个提供商的原生格式。
支持的提供商
哪些提供商接受思考、如何启用每个提供商、它采用哪些effort值,以及推理文本最终出现在哪里,这些信息都记录在提供商能力矩阵的表C中,并带有代码锚点。该表是权威列表;本页面仅记录变量。
FIM One从LLM_BASE_URL解析提供商(加上配置时的显式提供商字段),并将请求映射到正确的API格式。未知的URL被视为OpenAI兼容。
重要注意事项
推理时的温度约束
某些提供商在启用推理时会限制temperature。这些限制都会自动强制执行;请根据您的工作负载需求设置LLM_TEMPERATURE。
- Anthropic:启用扩展思考时需要
temperature=1。请求构建器会在Anthropic路由上固定该值,因此您配置的温度会被这些调用覆盖,而不是被拒绝。 - Anthropic、严格模型(Opus 4.7和4.8、Fable 5、Mythos 5):无论是否启用思考,都会直接拒绝
temperature、top_p和top_k。FIM One会从这些模型的请求中移除temperature。 - OpenAI GPT-5.x:仅支持
temperature=1。LiteLLM的drop_params过滤会移除不支持的值。
LLM_TEMPERATURE=1来满足Anthropic的要求是不必要的,这样做会让您无法在每个非思考调用上运行更低的温度。
LLM_REASONING_BUDGET_TOKENS 的工作原理
此变量仅在旧版 Anthropic 思考路径上有意义(Claude 4.5 及更早版本,路由为 anthropic/)。在该路径上,它会覆盖自动计算的预算,并作为 budget_tokens 在 thinking 参数内发送。自适应思考模型(Opus 4.6 及更新版本、Sonnet 4.6、Fable 5、Mythos 5)采用努力级别而非预算,完全忽略此变量。未设置时,预算从 LLM_MAX_OUTPUT_TOKENS × 努力比率推导:
最小预算为 1,024 tokens(Anthropic 的硬性最低值)。
对于 OpenAI 和 Gemini,提供商根据
reasoning_effort 级别在内部处理令牌分配——LLM_REASONING_BUDGET_TOKENS 无效。
智能体执行
ReAct Agent
DAG Planner
领域分类
控制独立的基于LLM的领域检测层,在ReAct和DAG执行之前运行。当查询被分类为专家领域时,系统激活领域感知功能:升级到推理模型、领域特定的SOP指令和引用验证(仅DAG)。Context Guard
Controls the automatic context window management that prevents conversations from exceeding the model’s limit.内容护栏
逗号分隔的护栏名称,用于检查内容的输入或输出。独立于工具权限闸门(core/hooks/*)和安全层(core/security/*)。详见内容护栏。
智能体工作区
System
Web Tools (Optional)
Quick start tip: Setting justJINA_API_KEYenables the default web search stack, plus web fetch, embedding, and reranking — one key, four services. Switch search to Tavily, Brave, or Exa withWEB_SEARCH_PROVIDERand the matching API key.
RAG 与知识库(推荐)
嵌入
嵌入将文本转换为向量以进行知识库搜索。FIM One 使用标准的 OpenAI 兼容/v1/embeddings 端点,因此它适用于任何公开此接口的提供商 — 不仅仅是 Jina。
提供商示例 — 只需设置这三个变量即可切换:
检索
Reranker
Reranker re-scores retrieved documents to improve relevance. Three providers are supported — select viaRERANKER_PROVIDER or let the system auto-detect from available API keys.
Jina usesJINA_API_KEY(from Web Tools above). OpenAI reusesLLM_API_KEY/LLM_BASE_URL— no extra key needed (OPENAI_API_KEY, when set, takes precedence overLLM_API_KEYfor the reranker). Cohere requires its ownCOHERE_API_KEY.
Reranker is optional — knowledge base search works without it using fusion scoring. Embedding is recommended for knowledge base features.
向量存储
Code Execution
Security:localruns AI-generated code inside the application container, as the application’s user: every user who can use the code tools can read and change what the application can. Its Python restrictions and shell word list are not a security boundary. Use it for single-user or development setups only. The application container is never given the Docker socket; if it can reach a container runtime anyway (a Docker, Podman or containerd socket, or aDOCKER_HOSTthat is a daemon),localcode execution and stdio MCP servers refuse to start. See Security → Code execution and the Docker socket.
Tool Output Truncation
Limits applied to what a built-in tool returns to the model.Tool Artifacts
Size limits for files produced by tool execution (code execution, template rendering, image generation).文档处理(可选)
控制上传的 PDF/DOCX 文件如何被处理以供 LLM 使用。具有视觉能力的模型(GPT-4o、Claude 3/4、Gemini)可以接收渲染后的 PDF 页面作为图像,以获得更高的保真度。
注意:每个模型的视觉支持通过管理员 → 模型中的 supports_vision 开关进行配置。未明确设置时,系统会从模型名称自动检测视觉能力。
Image Generation (Optional)
Email (SMTP) (Recommended)
Used for login codes and email notifications. Theemail_send built-in tool is offered when SMTP_HOST, SMTP_USER, and SMTP_PASS are set and a recipient allowlist (SMTP_ALLOWED_DOMAINS or SMTP_ALLOWED_ADDRESSES) is configured, or EMAIL_TOOL_ENABLED=true. Without either, any user could mail any address from this account, so the tool is not offered.
Verification code limits
Emailed codes (sign-in, registration, password reset) allow five tries each. These settings bound how many codes are issued and tried;0 switches a rule off. Counting is done in the database, so the limits hold across workers and under simultaneous requests. Windows are aligned to the clock.
Addresses are compared without case and without a trailing dot of the domain (
name@example.com. counts as name@example.com). A request over a limit is answered with HTTP 429 (verification_rate_limited) before the address is looked up, so the answer is the same whether or not the address has an account. A signed-in request for a reset code is counted under the account, separately from anonymous requests for the same address. The client address is the one the application server sees: behind a reverse proxy, run the server so that it trusts the proxy’s forwarded address, otherwise all clients share one count.
Requests for a sign-in or reset code are answered the same way whether or not the address has an account; a code is mailed only to an active account’s address.
Password sign-in limits
0 switches a rule off. A locked account answers a password attempt exactly as a wrong password does; the lock is written to the server log and to the login history (account_locked_now, then account_locked for each refused attempt). A successful password or emailed-code sign-in, and any password reset (by the user, through the forgotten-password flow or by an administrator), clears the count; signing in with an emailed code is not blocked by a lock.
Connectors
Database connectors on internal networks
A database connector dials the host and port its creator entered, from the application server. So that a connector cannot be pointed at the application’s own database, at other services on the server’s network or at a cloud metadata address, the host is resolved by the application and every address it resolves to must be public. The check runs when a connector is saved, when a connection is tested and each time a connection pool is opened, and the driver then connects to the address that was checked. Private deployments usually do need internal databases. Allow them explicitly:- An address or network entry allows a target when all the internal addresses it resolves to fall inside the entry.
- A host-name entry allows that name as it is typed in the connector, whatever it resolves to.
*.suffixmatches any name ending in.suffix. - A
:portsuffix limits the entry to that port. - The rule applies to every user, administrators included: the allow-list is the one place where internal reach is granted.
- The hosts of
DATABASE_URLand ofREDIS_URL(also a?host=parameter and each host of a multi-host URL) are refused on every port, even when an entry covers them. They are compared by the addresses they resolve to; if one of them cannot be resolved, every database connector is refused and the server log names the host. - One entry that cannot be parsed refuses every database connector, public targets included, until it is corrected. Users are told that the setting is invalid; the entry itself is written to the server log.
- List the networks and hosts your databases are on. An entry such as
0.0.0.0/0or::/0allows every internal address, cloud metadata addresses included, and turns the check off.
user:password@, port, path or list of hosts.
Platform
Workflow Human Intervention Steps
A Human Intervention (approval) step stops the run until someone decides. The run is stored aswaiting and continued when the approval is decided, also after a restart and with several server processes. The step is off unless you enable it.
Workflow Run Recovery
Every server process stamps the runs it is executing. A run stillrunning whose stamp is stale was being executed by a process that no longer exists: it is closed as failed, its open approval requests are closed and its working directory is removed. The same sweep, which also runs at startup, continues waiting runs whose approval was decided or expired while no process was listening.
工作流运行保留
自动清理旧工作流运行的后台任务。按工作流的覆盖设置(在工作流设置UI中配置)优先于这些全局默认值。Audit Record Retention
A daily background sweep removes audit records older than their retention period, in small batches. Every sweep leaves oneaudit.retention_sweep entry in the audit log with the number of rows removed from each table. With several replicas, one of them sweeps: on PostgreSQL they agree through a session-level advisory lock, so DATABASE_URL must reach the database directly or through a pooler in session mode. Behind a pooler in transaction mode (PgBouncer’s pool_mode = transaction, a Supabase or Neon pooled port) the lock is taken and released on different server sessions; the sweeper then logs a warning and closes the connection. The usage ledger is never swept. The first sweep runs within ten minutes of the first start on a version that has it: set a variable to 0 beforehand to keep older records.
Channel Confirmation Request Expiry
Background sweeper that marks pending approval requests (chat confirmations, workflow approvals, Approval Playground cards) as expired once their own deadline has passed, so a click days later on a forgotten card doesn’t flip agent state that has already been torn down. The TTL applies only to requests recorded before the deadline column existed.OAuth (Optional)
When bothCLIENT_ID and CLIENT_SECRET are set for a provider, the login page automatically shows the corresponding OAuth button.
Prod = optional locally (defaults work), but required for any internet-facing deployment.
需要向每个提供商注册的 OAuth 回调 URL
后端构造回调 URL 为:{API_BASE_URL}/api/auth/oauth/{provider}/callback
Cloudflare Tunnel(可选)
通过 Cloudflare 的网络路由所有流量,而不是直接暴露端口。无需 Nginx、SSL 证书和开放防火墙规则。有关设置说明,请参阅生产部署部分。分析(可选)
所有分析提供商都是可选的。设置任意组合——所有活跃的提供商同时加载。全部留空可禁用分析(建议用于本地开发)。
所有 NEXT_PUBLIC_* 分析变量都是构建时的——更改需要前端重新构建才能生效。
Stripe Billing (Optional)
Stripe powers paid subscriptions. Leave all three variables blank to disable billing — the rest of FIM One works unchanged. BothSTRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET must be set together; partial config raises an error at first use. Which access posture applies (no subscriptions, included + paid, or paid only) is chosen in the admin panel; see Billing.