World's first open-source enterprise world model.
Rust agent-memorybitemporalgraphragknowledge-baseknowledge-graphllmontologypgvectorpostgresqlragrustself-hostedsemantic-searchtemporal-knowledge-graphworld-model
Every model call uses the workspace's reasoning effort, and none is a value: alignment no longer thinks on its own (#1066)
WaylandYangfce1f8e09467
diff --git a/crates/utopia-cli/src/main.rs b/crates/utopia-cli/src/main.rsindex 58515eb0..3408e257 100644--- a/crates/utopia-cli/src/main.rs+++ b/crates/utopia-cli/src/main.rs@@ -82,7 +82,7 @@ struct ManifestDataDir {/// not a side effect of a code change.// 是迁移文件的**个数**,不是最大的编号(守卫 `schema_version_policy_compares_against_current`// 按个数比):编号有空缺时两者不同——0071 由一个开放 PR 占着,0072 先落,个数是 71-const CURRENT_SCHEMA_VERSION: u32 = 95;+const CURRENT_SCHEMA_VERSION: u32 = 96;fn main() -> anyhow::Result<()> {dotenvy::dotenv().ok();diff --git a/crates/utopia-core/src/models.rs b/crates/utopia-core/src/models.rsindex e811cdf4..058e4536 100644--- a/crates/utopia-core/src/models.rs+++ b/crates/utopia-core/src/models.rs@@ -472,8 +472,9 @@ pub struct LlmSettings {#[serde(skip_serializing)]pub transcribe_api_key: Option<String>,pub transcribe_model: Option<String>,- /// 对话模型的推理强度(OpenAI 兼容口的 `reasoning_effort`):minimal | low | medium | high;- /// 空 = 不带字段。照原文写 JSON 的任务用 minimal,思考 token 归零、答案不变+ /// 对话模型的推理强度(OpenAI 兼容口的 `reasoning_effort`):none | minimal | low | medium |+ /// high;空 = 不带字段。**每一种调用都用它**:抽取、对齐、提规则、本体代理、勘误——没有哪一步+ /// 另外定一个。哪个值把思考关掉看端点:有的认 minimal,有的(DeepSeek)只认 nonepub chat_reasoning_effort: Option<String>,}diff --git a/crates/utopia-llm/src/lib.rs b/crates/utopia-llm/src/lib.rsindex 853a45ac..d14dc5ba 100644--- a/crates/utopia-llm/src/lib.rs+++ b/crates/utopia-llm/src/lib.rs@@ -476,7 +476,8 @@ impl LlmClient {}/// 推理强度(`reasoning_effort`)。推理模型默认边想边答,抽取一次调用出的 token 九成是- /// 思考;minimal 把它归零而答案不变(bench README,2026-09-24)。空 = 不带字段+ /// 思考;minimal 把它归零而答案不变(bench README,2026-09-24)。有的端点 minimal 关不掉,+ /// 要 none(DeepSeek)。空 = 不带字段pub fn with_reasoning_effort(mut self, effort: Option<String>) -> Self {self.reasoning_effort = effort.filter(|e| !e.trim().is_empty());selfdiff --git a/crates/utopia-server/src/api/settings_routes.rs b/crates/utopia-server/src/api/settings_routes.rsindex 42e1c239..d79302b2 100644--- a/crates/utopia-server/src/api/settings_routes.rs+++ b/crates/utopia-server/src/api/settings_routes.rs@@ -84,10 +84,10 @@ pub async fn put(if let Some(effort) = &req.chat_reasoning_effort {let effort = nonempty(&Some(effort.clone()));if let Some(e) = effort.as_deref() {- if !matches!(e, "minimal" | "low" | "medium" | "high") {+ if !matches!(e, "none" | "minimal" | "low" | "medium" | "high") {return Err(utopia_core::AppError::invalid("bad_reasoning_effort",- "reasoning effort is one of minimal, low, medium, high, or empty",+ "reasoning effort is one of none, minimal, low, medium, high, or empty",).into());}diff --git a/crates/utopia-server/src/implication.rs b/crates/utopia-server/src/implication.rsindex 1ac1833a..8295b717 100644--- a/crates/utopia-server/src/implication.rs+++ b/crates/utopia-server/src/implication.rs@@ -41,9 +41,6 @@ pub async fn propose_rules(class_key: &HashMap<Uuid, &str>,by_key: &HashMap<&str, &RelationTypeView>,) -> anyhow::Result<(usize, usize)> {- // 提规则按 low 想:它问的是「这种形状还蕴含什么」,默认强度一次答 4.6k 思考 token,- // 是所有阶段里最贵的一种调用(bench README,2026-09-24),而答案多半是「无」- let client = &client.clone().with_reasoning_effort(Some("low".into()));let pool = &state.pool;let keys_of = |ids: &[Uuid]| -> Vec<&str> {ids.iter()diff --git a/crates/utopia-server/src/llm_util.rs b/crates/utopia-server/src/llm_util.rsindex f0bc07e8..448c7125 100644--- a/crates/utopia-server/src/llm_util.rs+++ b/crates/utopia-server/src/llm_util.rs@@ -128,18 +128,6 @@ pub async fn acquire(.ok()}-/// 要模型**想过再答**的那几处用这个:对齐与提规则是判断题,几十次调用,思考 token-/// 值得付;抽取、读数、勘误是照原文写 JSON 的活,按工作区设的推理强度(多半是 minimal)。-/// 第一次真跑里把对齐也压到 minimal,裁判判 misworded 的从 4% 涨到 31%(bench README,-/// 2026-09-24)——它挑了「相近」而不是「就是」的属性-pub fn chat_client_thinking(s: &LlmSettings) -> Option<LlmClient> {- chat_client(s).map(|c| c.with_reasoning_effort(JUDGEMENT_EFFORT.map(String::from)))-}--/// 判断题(对齐两票)用的推理强度。`None` = 端点默认;`Some("low")` 是省一半思考 token 的-/// 折中,精度差多少由 bench 量:全关(minimal)时 misworded 31%,默认强度 12%-pub const JUDGEMENT_EFFORT: Option<&str> = Some("low");-/// `acquire` 的便捷形式:直接从工作区设置取 chat 模型的身份。pub async fn acquire_chat(state: &AppState, s: &LlmSettings) -> Option<OwnedSemaphorePermit> {let (base, model) = (s.chat_base_url.as_deref()?, s.chat_model.as_deref()?);diff --git a/crates/utopia-server/src/ontology_agent.rs b/crates/utopia-server/src/ontology_agent.rsindex e00e7d98..5c777e76 100644--- a/crates/utopia-server/src/ontology_agent.rs+++ b/crates/utopia-server/src/ontology_agent.rs@@ -73,7 +73,7 @@ pub async fn propose_with(.await?.ok_or_else(|| anyhow::anyhow!("Chat model not configured; cannot propose ontology"))?;// 提本体是判断题:按端点默认的强度想- let client = llm_util::chat_client_thinking(&settings)+ let client = llm_util::chat_client(&settings).ok_or_else(|| anyhow::anyhow!("Chat model not configured; cannot propose ontology"))?;let mut guard = pool.acquire().await?;let locked: bool = sqlx::query_scalar(@@ -1102,7 +1102,7 @@ pub async fn propose_questions(state: &AppState, kb_id: Uuid) -> anyhow::Result<let settings = utopia_store::settings::get(pool, kb.workspace_id).await?.ok_or_else(|| anyhow::anyhow!("Chat model not configured; cannot propose questions"))?;- let client = llm_util::chat_client_thinking(&settings)+ let client = llm_util::chat_client(&settings).ok_or_else(|| anyhow::anyhow!("Chat model not configured; cannot propose questions"))?;propose_questions_with(state, kb_id, &settings, &client).await}diff --git a/crates/utopia-server/src/phrase_alignment.rs b/crates/utopia-server/src/phrase_alignment.rsindex b6ed98b3..e5e9d4c2 100644--- a/crates/utopia-server/src/phrase_alignment.rs+++ b/crates/utopia-server/src/phrase_alignment.rs@@ -439,7 +439,7 @@ pub async fn align_phrases_reasking(.await?.ok_or_else(|| anyhow::anyhow!("Chat model not configured; cannot align phrases"))?;// 对齐是判断题:让模型按端点默认的强度想,不用工作区给抽取设的 minimal- let client = llm_util::chat_client_thinking(&settings)+ let client = llm_util::chat_client(&settings).ok_or_else(|| anyhow::anyhow!("Chat model not configured; cannot align phrases"))?;// 类别词对齐还排着或跑着:两端的类还没定,现在判的签名指纹马上就变,判了也是重判。// 等它收尾再来——排一份半分钟后的,排着的至多一份。别的入口(本体页、审核页、每篇文档diff --git a/crates/utopia-server/src/type_alignment.rs b/crates/utopia-server/src/type_alignment.rsindex 06847fc0..4d0da08a 100644--- a/crates/utopia-server/src/type_alignment.rs+++ b/crates/utopia-server/src/type_alignment.rs@@ -115,7 +115,7 @@ pub async fn align_types_reasking(state: &AppState, kb_id: Uuid, reask: u32) ->let settings = utopia_store::settings::get(pool, kb.workspace_id).await?.ok_or_else(|| anyhow::anyhow!("Chat model not configured; cannot align kind words"))?;- let client = llm_util::chat_client_thinking(&settings)+ let client = llm_util::chat_client(&settings).ok_or_else(|| anyhow::anyhow!("Chat model not configured; cannot align kind words"))?;// 本体向量还在补:编辑器建了类先排 `embed_ontology` 再排这个任务,候选类按向量检索// (`candidates_for`),没向量的类检索不到,现在判了它也不在候选里。等它收尾再来——diff --git a/migrations/0105_thinking_can_be_turned_off_by_none.sql b/migrations/0105_thinking_can_be_turned_off_by_none.sqlnew file mode 100644index 00000000..29ce4f47--- /dev/null+++ b/migrations/0105_thinking_can_be_turned_off_by_none.sql@@ -0,0 +1,9 @@+-- 推理强度多认一个值:none。+--+-- 0075 认的是 minimal / low / medium / high,照的是 minimal 能把思考归零的端点。DeepSeek 不是:+-- minimal 关不掉,只有 none 关得掉(bench README,2026-09-30 的第九次真跑是在测量库上去掉这条+-- CHECK 直接写的)。这一列从这里起也是对齐、提规则、本体代理用的强度——它们从前固定用 low,+-- 在 DeepSeek 上每次调用想七八千 token,占了每篇文档 token 的一半——所以要关得掉。+ALTER TABLE llm_settings DROP CONSTRAINT IF EXISTS llm_settings_chat_reasoning_effort_check;+ALTER TABLE llm_settings ADD CONSTRAINT llm_settings_chat_reasoning_effort_check+ CHECK (chat_reasoning_effort IN ('none', 'minimal', 'low', 'medium', 'high'));diff --git a/scripts/bench/README.md b/scripts/bench/README.mdindex db8546e8..0006aa9c 100644--- a/scripts/bench/README.md+++ b/scripts/bench/README.md@@ -701,6 +701,7 @@ bound / none / undecided。0044 的门槛:裁判精度不低于完整原型的586 条因此判成坏票。标签唯一对上就认它的键。- **推理强度按任务分**:抽取、读数、勘误照原文写 JSON,用工作区设的 `minimal`(思考 token 归零、答案不变);对齐是判断题,全关时 misworded 31%,默认强度 12%,low 折中在 76% 精度;提规则按 low。+ (2026-10-03 起不再按任务分,每一种调用都用工作区设的强度,见「对齐不再另外想」一节。)- **批次并行**:对齐与提规则四批同飞,20 篇的对齐从 29 分钟到 5 分钟;台子的裁判也四篇并行。- **只问绑上的签名提规则**、**基准库关掉治理 agent**(它在第三轮花了约 500 次调用)、**勘误只带文档最近的 24 条属性**。@@ -1088,3 +1089,42 @@ bound / none / undecided。0044 的门槛:裁判精度不低于完整原型的46 次),判定数前后是接着涨的(2664 → 3236),没有看到重问。费用:180 万输入、239 万输出,约 $1.70(余额少了 ¥10.6);裁判约 400 次调用,$2 上下。用时 98 分。++### 对齐不再另外想:每一种调用都跟工作区的推理强度(2026-10-03,deepseek-flash,20 篇,全关两组对 `low` 一组)++从 2026-09-24 起对齐、提规则、本体代理固定用 `low`(上面「推理强度按任务分」那一条):gemini 上全关时+misworded 从 4% 到 31%。在 deepseek-flash 上这条规矩的账是另一个样:`low` 每次调用想七八千 token,对齐+三项占每篇 token 的六成、其中八成是思考(温库那一节)。这一刀把固定的 `low` 去掉,这几种调用和抽取一样+用工作区设的强度;设置接口和库多认一个 `none`(迁移 0105),DeepSeek 只有它关得掉思考。++量法:`--corpus redocred-20 --judge 200 --errata`,新库。全关两组是这一刀的二进制、工作区设 `none`;+`low` 那一组是 2026-09-30 的试跑(dev @ 798fb24,抽取 `none`、对齐固定 `low`,裁判重新打分的那一次)。+两边的抽取设置相同,差别只在对齐、提规则这几步想不想。++| | 对齐 `low`(09-30) | 全关 组 1 | 全关 组 2 |+|---|---|---|---|+| 签名 bound / none / undecided | 75 / 120 / 10 | 80 / 107 / 23 | 52 / 131 / 24 |+| 类型化 勘误前 → 后 | 113 → 157 | 119 → 156 | 78 → 107 |+| 裁判精度 勘误后(判了) | 91.7%(157) | 83.3%(156) | 89.7%(107) |+| misworded(勘误后) | 9 条,5.7% | 24 条,15.4% | 8 条,7.5% |+| 同句召回 勘误后 | 19.2% | 14.3% | 12.0% |+| entity-pair recall(开放层,对齐碰不到) | 14.0% | 11.0% | 12.9% |+| 每篇 token | 4.7 万 | 2.2 万 | 1.9 万 |+| 其中短语对齐 / 类别词对齐 / 提规则 | 2.1 万 / 1.0 万 / 0.65 万 | 0.60 万 / 0.18 万 / 0.21 万 | 0.43 万 / 0.18 万 / 0.12 万 |+| 用时 | 28 分 | 6 分 | 4 分 |++- **每篇 token 少了一半多,对齐三项从 3.8 万到 0.7–1.0 万。** 短语对齐的输出从 32 万 token 到 4 千:+ 输入几乎没变(10 万对 12 万),少掉的全是思考。全关那两组里本体代理占了每篇 0.27 万,`low` 那一组+ 的时间窗里没有它;去掉它是 1.6–1.9 万。用时四到六分钟对二十八分钟。+- **精度两组 83.3% / 89.7%,`low` 是 91.7%**,都过 75.3% 的门槛。misworded 一组 15%、一组 7.5%,`low` 是+ 5.7%:方向和 gemini 上量到的一样(不想的时候它挑「相近」而不是「就是」的属性),幅度小得多——gemini+ 是 4% 到 31%。+- **全关之后两组之间差得更大**:绑上的签名 80 对 52,同句召回 14.3% 对 12.0%。两票都不想的时候,同一条+ 签名这一次绑上、下一次判无的更多。`low` 只有一组,它自己的波动没量。+- 同句召回 `low` 那一组高出五到七个点,一半在抽取(实体对 14.0% 对 11.0% / 12.9%,对齐碰不到这一层),+ 100 篇上 `low` 是 12.3% / 13.2%——20 篇的召回要这样读。++这是用精度和稳定换 token 和时间,换不换是工作区的选择:设 `low`,这几步和从前一样想;设 `none` 或+`minimal`,全关。没有哪一步再替工作区另定一个强度。按 0044 的 token 门槛读,1.9–2.2 万仍是门槛的三倍多。++费用:全关两组共 ¥1.0,裁判约 $1。diff --git a/web/src/api.ts b/web/src/api.tsindex 4f4a9f49..eaf8c9a1 100644--- a/web/src/api.ts+++ b/web/src/api.ts@@ -282,7 +282,7 @@ export interface Readiness {export interface LlmSettingsView {chat_base_url?: string | null;chat_model?: string | null;- /** 推理强度:minimal | low | medium | high;空 = 端点默认 */+ /** 推理强度:none | minimal | low | medium | high;空 = 端点默认 */chat_reasoning_effort?: string | null;has_chat_key?: boolean;embed_base_url?: string | null;diff --git a/web/src/i18n/en.ts b/web/src/i18n/en.tsindex 674d4963..20394dad 100644--- a/web/src/i18n/en.ts+++ b/web/src/i18n/en.ts@@ -1306,7 +1306,7 @@ export const en = {reasoningEffort: "Reasoning effort",reasoningDefault: "endpoint default",reasoningHint:- "Reasoning models think before they answer; for extraction nine tenths of the output was thinking. minimal turns it off without changing the answer.",+ "Reasoning models think before they answer, and most of what they output is that thinking. Every call uses this one setting. Which value turns thinking off depends on the endpoint: minimal on some, none on others (DeepSeek).",embedModel: "Embedding model (optional, enables semantic search)",baseUrl: "Base URL",model: "Model",diff --git a/web/src/i18n/zh.ts b/web/src/i18n/zh.tsindex 6de81b81..c530be00 100644--- a/web/src/i18n/zh.ts+++ b/web/src/i18n/zh.ts@@ -1156,7 +1156,7 @@ export const zh: Strings = {chatModel: "对话模型",reasoningEffort: "推理强度",reasoningDefault: "端点默认",- reasoningHint: "推理模型先想再答,抽取一次调用九成的输出是思考;minimal 关掉它,答案不变。",+ reasoningHint: "推理模型先想再答,输出的大半是思考。每一种调用都用这一个值;哪个值关得掉思考看端点:有的认 minimal,有的(DeepSeek)只认 none。",embedModel: "向量模型(可选,启用语义检索)",baseUrl: "接口地址",model: "模型",diff --git a/web/src/pages/Settings.tsx b/web/src/pages/Settings.tsxindex e937e939..76a341f1 100644--- a/web/src/pages/Settings.tsx+++ b/web/src/pages/Settings.tsx@@ -1214,7 +1214,8 @@ export function Settings() {</div><div><label className={label}>{S.settings.reasoningEffort}</label>- {/* 推理模型默认边想边答,抽取一次调用九成的输出是思考;照原文写 JSON 的活用 minimal。+ {/* 推理模型默认边想边答,抽取一次调用九成的输出是思考。每一种调用都用这一个值;+ 哪个值关得掉思考看端点(有的认 minimal,有的只认 none)。小而有界的枚举:Dropdown(web/DESIGN.md 规矩 5,页面上没有原生 select) */}<DropdownclassName="w-full"@@ -1225,6 +1226,7 @@ export function Settings() {}}options={[{ value: "", label: S.settings.reasoningDefault },+ { value: "none", label: "none" },{ value: "minimal", label: "minimal" },{ value: "low", label: "low" },{ value: "medium", label: "medium" },