clearai-dsh 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -0
- package/README.md +38 -13
- package/README.zh-CN.md +38 -13
- package/bin/clearai.mjs +29 -231
- package/cordis.patch.yml +3 -3
- package/lib/client.js +575 -205
- package/lib/domain-language.js +71 -9
- package/lib/fold.js +271 -15
- package/lib/knowledge-view.js +135 -42
- package/package.json +2 -2
- package/presets/clearai/agent.cordis.yml +11 -3
- package/presets/clearai/clearai.patch.yml +11 -3
- package/presets/clearai/plugins/clearai-kernel.js +910 -77
- package/presets/clearai/plugins/ontology.js +21 -7
- package/presets/clearai/plugins/prompts.js +26 -22
- package/presets/clearai/skills/clearai-loop/SKILL.md +12 -4
package/lib/client.js
CHANGED
|
@@ -82,11 +82,11 @@ var Wt=Object.create;var Le=Object.defineProperty;var Pt=Object.getOwnPropertyDe
|
|
|
82
82
|
* clearai-dsh —— 浏览器半(ClearAI 的面板)。
|
|
83
83
|
*
|
|
84
84
|
* 它注册三个座位:
|
|
85
|
-
* 中栏 `conversation.view`
|
|
86
|
-
*
|
|
87
|
-
* 输入框 `conversation.input` 计划芯片(
|
|
85
|
+
* 中栏 `conversation.view` 探索(问题 → 候选假设 → 下一步;过程记录里有判断列表与计划的世界树)
|
|
86
|
+
* 中栏 `conversation.view` 本体(结论四部分 + 本体图 / 实体图 + 已确立的事实 + 经验)
|
|
87
|
+
* 输入框 `conversation.input` 计划芯片(「问题 1/2 · 待检验假设 N 个」+ 「待处理 N」,点击打开探索货架)
|
|
88
88
|
* 交付与文件改动走 DSH 原生的卡片,技能走原生技能目录,这里都不另做一份。
|
|
89
|
-
*
|
|
89
|
+
* 面板**只读**:没有写入口。要人拍板的事由开门的那次工具调用当场问人;「立为问题 / 暂缓」只替人往对话里发一句话。
|
|
90
90
|
*
|
|
91
91
|
* 面板自己不取数、不重算:宿主半注册的**会话投影单元** `clearai`(见 `lib/index.js`)把算好的
|
|
92
92
|
* 视图推下来,`useProjection('clearai')` 读它。投影为空(`undefined`)时渲染平静的空态,
|
|
@@ -185,8 +185,8 @@ window.__ModuleLoader__.load({
|
|
|
185
185
|
|
|
186
186
|
/** 语言命名空间。表按**源文**索引:键就是中文原文,所以漏翻译一条只会退回中文,不会把 key 显示给人。 */
|
|
187
187
|
const LOCALE_NS = 'clearai'
|
|
188
|
-
const LOCALE_ZH = {":":":","
|
|
189
|
-
const LOCALE_EN = {":":": "," ·
|
|
188
|
+
const LOCALE_ZH = {"待执行":"待执行","已交付":"已交付","已作废":"已作废","支持":"支持","推翻":"推翻","不确定":"不确定","第 n 步":"第 n 步","判据:":"判据:","判据":"判据"," · 已修订 ":" · 已修订 "," 次":" 次"," · 最近一次修订的独立裁决:":" · 最近一次修订的独立裁决:","打开目标文档(原生预览)":"打开目标文档(原生预览)","全文在 ":"全文在 ","背景(不参与判定):":"背景(不参与判定):","目标":"目标","命题":"命题","计划":"计划","验证":"验证","观测":"观测","评估":"评估","证据":"证据","事实":"事实","批准":"批准","未解释":"未解释","评估卡":"评估卡","查看评估者":"查看评估者","审批记录":"审批记录","产物":"产物","已验证":"已验证","待核验":"待核验","验证中":"验证中","已推翻":"已推翻","已替换":"已替换","自行检验":"自行检验","独立核验":"独立核验","人工批准":"人工批准","判断":"判断","检验":"检验","纳入本体":"纳入本体","下一步:安排步骤对其进行检验":"下一步:安排步骤对其进行检验","下一步:通过独立核验后标记为已验证":"下一步:通过独立核验后标记为已验证","下一步:改用其他方法重新检验":"下一步:改用其他方法重新检验","下一步:结案时写入长期知识":"下一步:结案时写入长期知识","陈述":"陈述","数值":"数值","公式":"公式","代码":"代码","引用":"引用","概念":"概念","取值形态":"取值形态","实例":"实例","取值":"取值","关系":"关系","在检验阶段被推翻,不再推进。":"在检验阶段被推翻,不再推进。","已被替换,不再推进。":"已被替换,不再推进。","提出":"提出","单步检验":"单步检验",":":":","写入长期知识":"写入长期知识","人工撤回":"人工撤回","进度":"进度","可信度变化":"可信度变化","补充说明":"补充说明","依据":"依据","查看核验":"查看核验","查看记录":"查看记录","范围":"范围","推翻条件":"推翻条件","相关":"相关","在图中定位":"在图中定位","来源":"来源","收起":"收起","点击查看进度与来源":"点击查看进度与来源","暂无结论。模型提出判断后,将在此逐条列出。":"暂无结论。模型提出判断后,将在此逐条列出。","尚未设立目标":"尚未设立目标","暂无内容。发送第一条消息后,此处将显示本体图与结论。":"暂无内容。发送第一条消息后,此处将显示本体图与结论。","仅显示与「":"仅显示与「","」相关的内容":"」相关的内容","清除":"清除","已确立的事实":"已确立的事实","暂无已确立的事实。判断经检验与独立核验后,将在此列出;检验过程见探索货架。":"暂无已确立的事实。判断经检验与独立核验后,将在此列出;检验过程见探索货架。","经验(":"经验(",")":")","广度调研":"广度调研","定向求解":"定向求解","先调研后求解":"先调研后求解","考察中":"考察中","已排除":"已排除","已采纳":"已采纳","暂不考察":"暂不考察","未开始":"未开始","调研中":"调研中","已厘清":"已厘清","常见误区":"常见误区","前置核查":"前置核查","不可取的捷径":"不可取的捷径","先验知识":"先验知识","提出依据":"提出依据","未注明(直觉)":"未注明(直觉)","直觉":"直觉","本体关系「":"本体关系「","」":"」","主张":"主张","预测":"预测","排除依据":"排除依据","采纳依据":"采纳依据","关联记录":"关联记录","支持 ":"支持 "," 条 · 推翻 ":" 条 · 推翻 "," 条 · 无法判定 ":" 条 · 无法判定 "," 条":" 条","在本体货架中展开此结论":"在本体货架中展开此结论","已得出结论 · 查看结论":"已得出结论 · 查看结论","已暂缓":"已暂缓","新发现,待您决定":"新发现,待您决定","尚无候选假设":"尚无候选假设","候选假设 ":"候选假设 "," 个:":" 个:","问题 ":"问题 ","候选假设":"候选假设","展开":"展开","已请求立为问题,待模型修订立题后生效。":"已请求立为问题,待模型修订立题后生效。","已请求暂缓,结案时列入「尚未确定的事项」。":"已请求暂缓,结案时列入「尚未确定的事项」。","无法自动发送,请在对话中说明。":"无法自动发送,请在对话中说明。","新发现的问题":"新发现的问题","请将新发现的问题「":"请将新发现的问题「","」立为问题深入研究(问题 ":"」立为问题深入研究(问题 ",")。":")。","立为问题":"立为问题","请暂缓问题「":"请暂缓问题「","」(问题 ":"」(问题 ","),结案时列入「尚未确定的事项」。":"),结案时列入「尚未确定的事项」。","暂缓":"暂缓","调研板块":"调研板块","判断 ":"判断 "," 条 · 已采纳 ":" 条 · 已采纳 ","未解释的现象 ":"未解释的现象 "," 项":" 项","下一步":"下一步","预测:":"预测:","若「":"若「","」成立,预测":"」成立,预测","各候选假设的预测相同,此步骤无法区分它们。":"各候选假设的预测相同,此步骤无法区分它们。","如需调整计划,请在对话中说明。":"如需调整计划,请在对话中说明。","未解释的现象(":"未解释的现象(","结案前须解释、排除或写入「尚未确定的事项」":"结案前须解释、排除或写入「尚未确定的事项」","独立评估发现":"独立评估发现","涉及:":"涉及:","、":"、","暂无内容。发送第一条消息后,此处将显示问题、候选假设与下一步。":"暂无内容。发送第一条消息后,此处将显示问题、候选假设与下一步。","尚未设立目标。模型立题后,此处将显示问题、候选假设与下一步。":"尚未设立目标。模型立题后,此处将显示问题、候选假设与下一步。","阶段 · ":"阶段 · ","调研板块 ":"调研板块 "," 个 · 已厘清 ":" 个 · 已厘清 "," 个":" 个","当前问题 ":"当前问题 "," / 共 ":" / 共 ","计划 已完成 ":"计划 已完成 "," / ":" / "," 步":" 步","独立评估 ":"独立评估 ","计划共 ":"计划共 ","(":"(","进行中)":"进行中)","课题":"课题","待您处理(":"待您处理(","过程记录":"过程记录","结论":"结论","未能回答:":"未能回答:","查看探索记录":"查看探索记录","尚未确定的事项":"尚未确定的事项","待您决策":"待您决策","不适用:":"不适用:","暂无计划。建立计划后,此处将显示计划的步骤与闸门。":"暂无计划。建立计划后,此处将显示计划的步骤与闸门。","切换到以前的计划(计划均保留,文档归档在 clear/goals/plans/)":"切换到以前的计划(计划均保留,文档归档在 clear/goals/plans/)","计划 ":"计划 ","已完成 · 可查看存档":"已完成 · 可查看存档","步 ":"步 ","打开计划文档(原生预览)":"打开计划文档(原生预览)","计划文档":"计划文档","点击查看详情":"点击查看详情","查看步骤详情":"查看步骤详情"," 轮":" 轮","已派出评估者 ":"已派出评估者 ","收起详情":"收起详情","任务内容":"任务内容","状态":"状态","未声明":"未声明","磁盘上未找到该文件":"磁盘上未找到该文件","(缺失)":"(缺失)","在原生预览中打开":"在原生预览中打开","在原生预览中打开(计划声明的产物)":"在原生预览中打开(计划声明的产物)","查看此步骤的证据":"查看此步骤的证据","检验结果:":"检验结果:","独立核验:":"独立核验:","正在裁决":"正在裁决"," 查看核验过程":" 查看核验过程"," 查看核验记录":" 查看核验记录","待处理":"待处理","板块 ":"板块 "," · ":" · "," 个问题待您决定":" 个问题待您决定"," · 待检验假设 ":" · 待检验假设 ","计划受阻,待人工处理":"计划受阻,待人工处理","计划已收尾(":"计划已收尾("," 步)":" 步)","计划已交付 ":"计划已交付 ","待处理 ":"待处理 ","(点击打开探索货架)":"(点击打开探索货架)","仅显示相关项":"仅显示相关项","关闭":"关闭","正在加载…":"正在加载…","无法获取":"无法获取","该项已不在当前词表中(可能已被废止)。":"该项已不在当前词表中(可能已被废止)。","释义":"释义","上位":"上位","下位":"下位","主体":"主体","类型":"类型","该术语已废止,既有结论中的用法仍可查看。":"该术语已废止,既有结论中的用法仍可查看。","引用此项的结论":"引用此项的结论","有矛盾":"有矛盾","范围:":"范围:","展开下一层":"展开下一层","收起下一层":"收起下一层","共 ":"共 "," 条断言的主体尚未建立实体文件。":" 条断言的主体尚未建立实体文件。","实体图暂无内容。":"实体图暂无内容。","clear/ontology/entities/ 下的实体文件与写入长期知识的断言将在此显示。":"clear/ontology/entities/ 下的实体文件与写入长期知识的断言将在此显示。","本体图暂无内容。模型在 clear/ontology/concepts/ 与 relations/ 下建立概念与关系文件后,将在此显示。":"本体图暂无内容。模型在 clear/ontology/concepts/ 与 relations/ 下建立概念与关系文件后,将在此显示。","本体图":"本体图","实体图":"实体图","矛盾":"矛盾","适配":"适配","退出全屏":"退出全屏","全屏":"全屏","图组件不可用":"图组件不可用","结论仍可正常查看。":"结论仍可正常查看。","本体文件有 ":"本体文件有 "," 项问题(不纳入图中)":" 项问题(不纳入图中)","已提出":"已提出","探索":"探索","本体":"本体","clearai-loop: 席位跟着会话预设进出":"clearai-loop: 席位跟着会话预设进出"}
|
|
189
|
+
const LOCALE_EN = {"待执行":"to do","已交付":"delivered","已作废":"voided","支持":"Support","推翻":"Refute","不确定":"Uncertain","第 n 步":"Step n","判据:":"Criterion: ","判据":"Criterion"," · 已修订 ":" · revised "," 次":" times"," · 最近一次修订的独立裁决:":" · latest revision decided by an independent verdict: ","打开目标文档(原生预览)":"Open the goal document (native preview)","全文在 ":"Full text at ","背景(不参与判定):":"Background (not part of the verdict): ","目标":"Goal","命题":"Propositions","计划":"Plan","验证":"Verification","观测":"Observation","评估":"Evaluation","证据":"Evidence","事实":"Facts","批准":"approval","未解释":"Unexplained","评估卡":"evaluation card","查看评估者":"view evaluator","审批记录":"approval record","产物":"Deliverables","已验证":"Verified","待核验":"Awaiting check","验证中":"Testing","已推翻":"Refuted","已替换":"Replaced","自行检验":"Self-tested","独立核验":"Independent check","人工批准":"Approved by a person","判断":"Judgment","检验":"Test","纳入本体":"In ontology","下一步:安排步骤对其进行检验":"Next: schedule a step to test it","下一步:通过独立核验后标记为已验证":"Next: marked Verified after an independent check","下一步:改用其他方法重新检验":"Next: test it again by another method","下一步:结案时写入长期知识":"Next: written to long-term knowledge at close","陈述":"Statement","数值":"Quantity","公式":"Formula","代码":"Code","引用":"Reference","概念":"concepts","取值形态":"Value form","实例":"Instances","取值":"Value","关系":"Relation","在检验阶段被推翻,不再推进。":"Refuted at the test stage; it goes no further.","已被替换,不再推进。":"Replaced; it goes no further.","提出":"Proposed","单步检验":"A single test",":":": ","写入长期知识":"Written to long-term knowledge","人工撤回":"Withdrawn by a person","进度":"Progress","可信度变化":"Trust history","补充说明":"Details","依据":"Basis","查看核验":"View check","查看记录":"View record","范围":"Scope","推翻条件":"Refuted if","相关":"Related","在图中定位":"Locate on the graph","来源":"Source","收起":"Collapse","点击查看进度与来源":"Click to view progress and source","暂无结论。模型提出判断后,将在此逐条列出。":"No judgments yet. Each judgment the model proposes is listed here.","尚未设立目标":"No goal set yet","暂无内容。发送第一条消息后,此处将显示本体图与结论。":"Nothing yet. After the first message, the ontology graph and conclusions appear here.","仅显示与「":"Showing only items related to \"","」相关的内容":"\"","清除":"Clear","已确立的事实":"ESTABLISHED FACTS","暂无已确立的事实。判断经检验与独立核验后,将在此列出;检验过程见探索货架。":"No established facts yet. Judgments appear here once tested and independently checked; the testing process is in the Explore shelf.","经验(":"LESSONS (",")":")","广度调研":"Broad survey","定向求解":"Targeted solving","先调研后求解":"Survey, then solve","考察中":"Being examined","已排除":"Excluded","已采纳":"Adopted","暂不考察":"Set aside","未开始":"Not started","调研中":"In progress","已厘清":"Clarified","常见误区":"Common pitfall","前置核查":"Check first","不可取的捷径":"Misleading shortcut","先验知识":"Prior knowledge","提出依据":"Proposed from","未注明(直觉)":"Not stated (intuition)","直觉":"Intuition","本体关系「":"Ontology relation \"","」":"\"","主张":"Claim","预测":"Prediction","排除依据":"Grounds for exclusion","采纳依据":"Grounds for adoption","关联记录":"Related records","支持 ":"Support "," 条 · 推翻 ":" · refute "," 条 · 无法判定 ":" · inconclusive "," 条":"","在本体货架中展开此结论":"Expand this conclusion in the Ontology shelf","已得出结论 · 查看结论":"Concluded · view the conclusion","已暂缓":"Parked","新发现,待您决定":"Newly found, awaiting your decision","尚无候选假设":"No candidate hypotheses yet","候选假设 ":"Candidate hypotheses: "," 个:":" — ","问题 ":"Question ","候选假设":"Candidate hypotheses","展开":"Expand","已请求立为问题,待模型修订立题后生效。":"Requested as a question; it takes effect once the model revises the framing.","已请求暂缓,结案时列入「尚未确定的事项」。":"Requested to park; it will be listed under open points at conclusion.","无法自动发送,请在对话中说明。":"Could not send automatically; please say it in the conversation.","新发现的问题":"Newly found question","请将新发现的问题「":"Please make the newly found question \"","」立为问题深入研究(问题 ":"\" a question to pursue (question ",")。":").","立为问题":"Make it a question","请暂缓问题「":"Please park the question \"","」(问题 ":"\" (question ","),结案时列入「尚未确定的事项」。":") and list it under open points at conclusion.","暂缓":"Park","调研板块":"Survey areas","判断 ":"Judgments: "," 条 · 已采纳 ":" · adopted ","未解释的现象 ":"Unexplained observations: "," 项":"","下一步":"Next step","预测:":"Prediction: ","若「":"If \"","」成立,预测":"\" holds, the prediction is","各候选假设的预测相同,此步骤无法区分它们。":"All candidate hypotheses predict the same result, so this step cannot tell them apart.","如需调整计划,请在对话中说明。":"To change the plan, say so in the conversation.","未解释的现象(":"Unexplained observations (","结案前须解释、排除或写入「尚未确定的事项」":"Before concluding, each must be explained, ruled out, or written into the open points","独立评估发现":"Found by the independent evaluator","涉及:":"Concerns: ","、":", ","暂无内容。发送第一条消息后,此处将显示问题、候选假设与下一步。":"Nothing yet. After the first message, questions, candidate hypotheses and the next step appear here.","尚未设立目标。模型立题后,此处将显示问题、候选假设与下一步。":"No goal set yet. Once the model frames the goal, questions, candidate hypotheses and the next step appear here.","阶段 · ":"Mode · ","调研板块 ":"Survey areas: "," 个 · 已厘清 ":" · clarified "," 个":"","当前问题 ":"Current question "," / 共 ":" of ","计划 已完成 ":"Plan: completed "," / ":" / "," 步":" steps","独立评估 ":"Independent evaluations: ","计划共 ":"Plan: ","(":" (","进行中)":" in progress)","课题":"Topic","待您处理(":"Awaiting you (","过程记录":"Process record","结论":"Conclusion","未能回答:":"Could not be answered: ","查看探索记录":"View the exploration record","尚未确定的事项":"Open points","待您决策":"For you to decide","不适用:":"Does not apply: ","暂无计划。建立计划后,此处将显示计划的步骤与闸门。":"No plan yet. Once a plan is created, its steps and gates appear here.","切换到以前的计划(计划均保留,文档归档在 clear/goals/plans/)":"Switch to an earlier plan (all plans are kept; documents are archived under clear/goals/plans/)","计划 ":"Plan ","已完成 · 可查看存档":"closed · archive available","步 ":"step ","打开计划文档(原生预览)":"Open the plan document (native preview)","计划文档":"Plan document","点击查看详情":"click for details","查看步骤详情":"view step details"," 轮":" rounds","已派出评估者 ":"Evaluators dispatched: ","收起详情":"Collapse details","任务内容":"Task","状态":"Status","未声明":"not declared","磁盘上未找到该文件":"this file was not found on disk","(缺失)":" (missing)","在原生预览中打开":"Open in the native preview","在原生预览中打开(计划声明的产物)":"Open in the native preview (an artifact declared by the plan)","查看此步骤的证据":"see the evidence for this step","检验结果:":"Result: ","独立核验:":"Independent check: ","正在裁决":"Deciding"," 查看核验过程":" View the review"," 查看核验记录":" View the review record","待处理":"To handle","板块 ":"Areas "," · ":" · "," 个问题待您决定":" question(s) awaiting your decision"," · 待检验假设 ":" · hypotheses to test: ","计划受阻,待人工处理":"plan blocked, awaiting a person","计划已收尾(":"Plan closed ("," 步)":" steps)","计划已交付 ":"Plan delivered ","待处理 ":"to handle ","(点击打开探索货架)":" (click to open the Explore shelf)","仅显示相关项":"Related only","关闭":"Close","正在加载…":"Loading…","无法获取":"Unavailable","该项已不在当前词表中(可能已被废止)。":"This item is no longer in the vocabulary (it may have been deprecated).","释义":"Gloss","上位":"Broader","下位":"Narrower","主体":"Subject","类型":"Type","该术语已废止,既有结论中的用法仍可查看。":"This term is deprecated; its use in existing conclusions remains readable.","引用此项的结论":"Conclusions citing it","有矛盾":"Conflicting","范围:":"Scope: ","展开下一层":"Expand the next level","收起下一层":"Collapse the next level","共 ":""," 条断言的主体尚未建立实体文件。":" assertion subjects have no entity file yet. ","实体图暂无内容。":"The entity graph is empty. ","clear/ontology/entities/ 下的实体文件与写入长期知识的断言将在此显示。":"Entity files under clear/ontology/entities/ and assertions in long-term knowledge appear here.","本体图暂无内容。模型在 clear/ontology/concepts/ 与 relations/ 下建立概念与关系文件后,将在此显示。":"The ontology graph is empty. Concepts and relations appear once the model creates files under clear/ontology/concepts/ and relations/.","本体图":"Ontology graph","实体图":"Entity graph","矛盾":"Conflicts","适配":"Fit","退出全屏":"Exit full screen","全屏":"Full screen","图组件不可用":"The graph component is unavailable","结论仍可正常查看。":"conclusions remain readable.","本体文件有 ":"Ontology files have "," 项问题(不纳入图中)":" problems (kept off the graph)","已提出":"proposed","探索":"Explore","本体":"Ontology","clearai-loop: 席位跟着会话预设进出":"clearai-loop: seats come and go with the session's preset"}
|
|
190
190
|
|
|
191
191
|
/**
|
|
192
192
|
* 翻译函数:**由原生 locale 座位绑定**(`ctx.locale.bind`),不是我们自建的一套 i18n。
|
|
@@ -220,7 +220,7 @@ window.__ModuleLoader__.load({
|
|
|
220
220
|
* 依赖的客户端服务,**必须全部声明在这里**。
|
|
221
221
|
*
|
|
222
222
|
* 这不是洁癖,是行为约束:客户端模块在 `slots` 一出现就被激活
|
|
223
|
-
* (`slots` 是平台 seed,启动时就有),而 `sessions` / `
|
|
223
|
+
* (`slots` 是平台 seed,启动时就有),而 `sessions` / `sidebarRight` 是**后来**
|
|
224
224
|
* 才由各自的插件 `provide` 的。只声明 `slots` 的话,我们的 `apply()` 会在它们之前跑,
|
|
225
225
|
* 读不到会话服务 → 早退 → **一个插座都不注册**,而且不报错:右栏只剩宿主自带的「文件」,
|
|
226
226
|
* 中栏没有「产物」。宿主那侧一切正常(模块图里有我们、bundle 正常送达),
|
|
@@ -229,9 +229,9 @@ window.__ModuleLoader__.load({
|
|
|
229
229
|
* 声明之后 Cordis 会把插件**挂起**到这些服务就位再激活(原生插件同样是这么写的,
|
|
230
230
|
* 例如 `dsh-client-ui-sidebar-files` 声明 slots + sidebarRightTabs + remote + locale)。
|
|
231
231
|
*/
|
|
232
|
-
const inject = ['slots', 'sessions', '
|
|
232
|
+
const inject = ['slots', 'sessions', 'sidebarRight']
|
|
233
233
|
|
|
234
|
-
const STEP = lazyTable(() => ({ open: t('
|
|
234
|
+
const STEP = lazyTable(() => ({ open: t('待执行'), advanced: t('已交付'), void: t('已作废') }))
|
|
235
235
|
const VERDICT = lazyTable(() => ({ support: t('支持'), refute: t('推翻'), inconclusive: t('不确定') }))
|
|
236
236
|
|
|
237
237
|
/** 「第 n 步」:整句做一个词条,英文才排得成 Step n。 */
|
|
@@ -392,6 +392,75 @@ window.__ModuleLoader__.load({
|
|
|
392
392
|
.clearai-kv>span:nth-child(odd){color:var(--dsw-alias-label-tertiary)}
|
|
393
393
|
.clearai-chips{display:inline-flex;gap:6px;flex-wrap:wrap}
|
|
394
394
|
.clearai-quiet{color:var(--dsw-alias-label-secondary);font-size:12.5px;padding:6px 0}
|
|
395
|
+
/* ── 探索货架:问题 → 候选假设 → 下一步;过程记录默认折叠。颜色只用主题令牌。 ── */
|
|
396
|
+
.clearai-head-kind{font-size:11.5px;color:var(--dsw-alias-label-tertiary)}
|
|
397
|
+
.clearai-pills{display:flex;flex-wrap:wrap;gap:6px;font-size:12px}
|
|
398
|
+
.clearai-pill{padding:1px 10px;border-radius:999px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary)}
|
|
399
|
+
.clearai-waiting{display:flex;flex-wrap:wrap;gap:6px 12px;align-items:baseline;padding:8px 12px;margin-bottom:14px;border-radius:8px;border:.5px solid var(--dsw-alias-state-warn-primary);background:var(--dsw-alias-bg-layer-1);font-size:12.5px}
|
|
400
|
+
.clearai-waiting b{color:var(--dsw-alias-state-warn-primary);font-weight:600}
|
|
401
|
+
.clearai-box{display:flex;flex-direction:column;margin-bottom:14px;border:.5px solid var(--dsw-alias-border-l2);border-radius:10px;overflow:hidden}
|
|
402
|
+
.clearai-box-head{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 14px;padding:10px 14px;background:var(--dsw-alias-bg-layer-1)}
|
|
403
|
+
.clearai-box[data-compact="1"] .clearai-box-head{background:transparent}
|
|
404
|
+
.clearai-box-kind{font-size:11.5px;color:var(--dsw-alias-label-tertiary)}
|
|
405
|
+
.clearai-box-title{flex:1 1 220px;font-size:14px;font-weight:600}
|
|
406
|
+
.clearai-box-note{font-size:12px;color:var(--dsw-alias-label-secondary)}
|
|
407
|
+
.clearai-box-foot{display:flex;flex-direction:column;gap:4px;padding:8px 14px;font-size:12px;color:var(--dsw-alias-label-tertiary);border-top:.5px solid var(--dsw-alias-border-l1)}
|
|
408
|
+
.clearai-parked{display:inline-flex;gap:8px;align-items:baseline}
|
|
409
|
+
.clearai-cand{border-top:.5px solid var(--dsw-alias-border-l1)}
|
|
410
|
+
.clearai-cand-head{width:100%;display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px;padding:9px 14px;border:0;background:transparent;text-align:left;font:inherit;color:inherit;cursor:pointer}
|
|
411
|
+
.clearai-cand-head[data-static="1"]{cursor:default}
|
|
412
|
+
.clearai-cand-head:not([data-static="1"]):hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
413
|
+
.clearai-cand-name{font-weight:500}
|
|
414
|
+
.clearai-cand[data-s="excluded"] .clearai-cand-name{text-decoration:line-through;color:var(--dsw-alias-label-tertiary)}
|
|
415
|
+
.clearai-cand-note{flex:1 1 220px;min-width:0;font-size:12px;color:var(--dsw-alias-label-secondary)}
|
|
416
|
+
.clearai-cand-chevron{margin-left:auto;font-size:11.5px;color:var(--dsw-alias-label-tertiary)}
|
|
417
|
+
.clearai-cand-detail{display:flex;flex-direction:column;gap:3px;padding:0 14px 12px}
|
|
418
|
+
.clearai-kvrow{display:grid;grid-template-columns:64px 1fr;gap:10px;font-size:12.5px}
|
|
419
|
+
.clearai-kvrow>span:first-child{color:var(--dsw-alias-label-tertiary)}
|
|
420
|
+
.clearai-state{flex:0 0 auto;display:inline-block;font-size:11px;line-height:16px;padding:0 7px;border-radius:6px;border:.5px solid var(--dsw-alias-border-l3);color:var(--dsw-alias-label-secondary);white-space:nowrap}
|
|
421
|
+
.clearai-state[data-s="examining"],.clearai-state[data-s="in_progress"]{border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary)}
|
|
422
|
+
.clearai-state[data-s="excluded"]{border-color:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-state-error-primary)}
|
|
423
|
+
.clearai-state[data-s="adopted"],.clearai-state[data-s="clear"]{background:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-primary);color:var(--dsw-alias-label-primary-inverted)}
|
|
424
|
+
.clearai-state[data-s="set_aside"]{border-style:dashed}
|
|
425
|
+
.clearai-emergent{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;margin:0 14px 10px;padding:8px 10px;border-radius:8px;border:.5px solid var(--dsw-alias-brand-primary);background:var(--dsw-alias-bg-layer-1)}
|
|
426
|
+
.clearai-emergent-kind{font-size:11.5px;font-weight:600;color:var(--dsw-alias-brand-primary)}
|
|
427
|
+
.clearai-emergent-text{flex:1 1 200px;font-weight:500}
|
|
428
|
+
.clearai-emergent-actions{display:inline-flex;gap:8px}
|
|
429
|
+
.clearai-emergent-done{margin:0 14px 10px;font-size:12px;color:var(--dsw-alias-label-secondary)}
|
|
430
|
+
.clearai-btn{min-height:30px;padding:0 12px;border-radius:8px;border:.5px solid var(--dsw-alias-border-l3);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font:inherit;font-size:12.5px;cursor:pointer}
|
|
431
|
+
.clearai-btn[data-primary="1"]{background:var(--dsw-alias-brand-primary);border-color:var(--dsw-alias-brand-primary);color:#fff}
|
|
432
|
+
.clearai-next{display:flex;flex-direction:column;gap:8px;margin-bottom:14px;padding:12px 14px;border-radius:10px;border:.5px solid var(--dsw-alias-brand-primary);background:var(--dsw-alias-bg-layer-1)}
|
|
433
|
+
.clearai-next-head{display:flex;flex-wrap:wrap;gap:4px 12px;align-items:baseline}
|
|
434
|
+
.clearai-next-kind{font-size:11.5px;font-weight:600;color:var(--dsw-alias-brand-primary)}
|
|
435
|
+
.clearai-next-title{font-size:14px;font-weight:600}
|
|
436
|
+
.clearai-preds{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:8px}
|
|
437
|
+
.clearai-pred{padding:8px 10px;border-radius:8px;border:.5px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base)}
|
|
438
|
+
.clearai-pred-if{font-size:11.5px;color:var(--dsw-alias-label-secondary)}
|
|
439
|
+
.clearai-pred-value{font-size:13.5px;font-weight:600}
|
|
440
|
+
.clearai-next-note{font-size:12px;color:var(--dsw-alias-label-secondary)}
|
|
441
|
+
.clearai-next-warn{font-size:12px;color:var(--dsw-alias-state-warn-primary);font-weight:600}
|
|
442
|
+
.clearai-anomaly{display:flex;flex-wrap:wrap;gap:4px 12px;padding:7px 14px;border-top:.5px solid var(--dsw-alias-border-l1);font-size:12.5px}
|
|
443
|
+
.clearai-anomaly-meta{font-size:11.5px;color:var(--dsw-alias-label-tertiary)}
|
|
444
|
+
.clearai-process{border-top:.5px solid var(--dsw-alias-border-l2);padding-top:4px}
|
|
445
|
+
.clearai-process-head{width:100%;min-height:38px;display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px;padding:0;border:0;background:transparent;text-align:left;font:inherit;color:inherit;cursor:pointer}
|
|
446
|
+
.clearai-process-head span{font-size:12px;color:var(--dsw-alias-label-secondary)}
|
|
447
|
+
.clearai-process-body{display:flex;flex-direction:column;gap:14px;padding:6px 0}
|
|
448
|
+
.clearai-judgments-head{display:flex;flex-direction:column;gap:4px}
|
|
449
|
+
/* 本体货架的结论卡:四部分 */
|
|
450
|
+
.clearai-answers{display:flex;flex-direction:column;gap:8px;margin-bottom:18px}
|
|
451
|
+
.clearai-qtab{min-height:28px;padding:0 12px;border-radius:999px;border:.5px solid var(--dsw-alias-border-l3);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-secondary);font:inherit;font-size:12px;cursor:pointer}
|
|
452
|
+
.clearai-qtab[aria-pressed="true"]{background:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-primary);color:var(--dsw-alias-label-primary-inverted)}
|
|
453
|
+
.clearai-answer{display:flex;flex-direction:column;border:.5px solid var(--dsw-alias-border-l2);border-radius:10px;overflow:hidden}
|
|
454
|
+
.clearai-answer-part{display:flex;flex-direction:column;gap:4px;padding:10px 14px;border-top:.5px solid var(--dsw-alias-border-l1)}
|
|
455
|
+
.clearai-answer-part:first-child{border-top:0}
|
|
456
|
+
.clearai-answer-part[data-warm="1"]{background:var(--dsw-alias-bg-layer-1)}
|
|
457
|
+
.clearai-answer-label{font-size:11.5px;font-weight:600;color:var(--dsw-alias-label-tertiary)}
|
|
458
|
+
.clearai-answer-part[data-warm="1"] .clearai-answer-label{color:var(--dsw-alias-state-warn-primary)}
|
|
459
|
+
.clearai-answer-main{font-size:15px;font-weight:600}
|
|
460
|
+
.clearai-answer-lines{display:flex;flex-direction:column;gap:3px;font-size:12.5px}
|
|
461
|
+
.clearai-lesson{display:flex;flex-wrap:wrap;gap:4px 10px;align-items:baseline;font-size:12.5px}
|
|
462
|
+
.clearai-lesson-kind{font-size:11px;padding:0 7px;border-radius:6px;border:.5px solid var(--dsw-alias-border-l3);color:var(--dsw-alias-label-secondary)}
|
|
463
|
+
.clearai-lesson-meta{font-size:11.5px;color:var(--dsw-alias-label-tertiary)}
|
|
395
464
|
`
|
|
396
465
|
/** 把上面那段 CSS 挂进页面(带 data-plugin 标记,宿主按包名记账,卸载时收掉)。 */
|
|
397
466
|
function installStyles() {
|
|
@@ -583,7 +652,7 @@ window.__ModuleLoader__.load({
|
|
|
583
652
|
h(
|
|
584
653
|
'div',
|
|
585
654
|
{ style: S.head },
|
|
586
|
-
`${t('判据')} · ${criteriaLines.length}${history.length === 0 ? '' : `${t(' ·
|
|
655
|
+
`${t('判据')} · ${criteriaLines.length}${history.length === 0 ? '' : `${t(' · 已修订 ')}${history.length}${t(' 次')}${lastAudit === null || lastAudit === undefined ? '' : `${t(' · 最近一次修订的独立裁决:')}${String(lastAudit)}`}`}`,
|
|
587
656
|
),
|
|
588
657
|
...criteriaLines.map((line, index) => h('div', { key: `criteria-${index}`, style: S.criteriaRow }, `${index + 1}. ${line}`)),
|
|
589
658
|
// 全文的家与卡上那句指针是同一个路径(不各自拼一遍);沿用计划文档那条既有做法
|
|
@@ -606,7 +675,8 @@ window.__ModuleLoader__.load({
|
|
|
606
675
|
evaluation: t('评估'),
|
|
607
676
|
evidence: t('证据'),
|
|
608
677
|
fact: t('事实'),
|
|
609
|
-
release: t('
|
|
678
|
+
release: t('批准'),
|
|
679
|
+
anomaly: t('未解释'),
|
|
610
680
|
}))
|
|
611
681
|
|
|
612
682
|
/**
|
|
@@ -747,22 +817,22 @@ window.__ModuleLoader__.load({
|
|
|
747
817
|
*/
|
|
748
818
|
const TRUST_ORDER = ['credible', 'pending', 'testing', 'unclear', 'refuted', 'replaced']
|
|
749
819
|
const TRUST_WORD = lazyTable(() => ({ credible: t('已验证'), pending: t('待核验'), testing: t('验证中'), unclear: t('不确定'), refuted: t('已推翻'), replaced: t('已替换') }))
|
|
750
|
-
const LEVEL_WORD = lazyTable(() => ({ L0: t('
|
|
820
|
+
const LEVEL_WORD = lazyTable(() => ({ L0: t('自行检验'), L1: t('自行检验'), L2: t('自行检验'), L3: t('独立核验'), L4: t('人工批准') }))
|
|
751
821
|
/** 进度轨的四站。顺序即一条结论要走的路。 */
|
|
752
|
-
const STATIONS = () => [t('判断'), t('检验'), t('已验证'), t('
|
|
822
|
+
const STATIONS = () => [t('判断'), t('检验'), t('已验证'), t('纳入本体')]
|
|
753
823
|
/** 还没走完时,下一步是什么(时间线末尾那条虚点)。 */
|
|
754
824
|
const NEXT_STEP = lazyTable(() => ({
|
|
755
|
-
testing: t('
|
|
756
|
-
pending: t('
|
|
757
|
-
unclear: t('
|
|
758
|
-
credible: t('
|
|
825
|
+
testing: t('下一步:安排步骤对其进行检验'),
|
|
826
|
+
pending: t('下一步:通过独立核验后标记为已验证'),
|
|
827
|
+
unclear: t('下一步:改用其他方法重新检验'),
|
|
828
|
+
credible: t('下一步:结案时写入长期知识'),
|
|
759
829
|
}))
|
|
760
830
|
/** 值的形态(本体图上的小方块):内部词换成人话。 */
|
|
761
|
-
const FORM_WORD = lazyTable(() => ({ statement: t('
|
|
762
|
-
const KIND_WORD = lazyTable(() => ({ concept: t('概念'), value_type: t('
|
|
831
|
+
const FORM_WORD = lazyTable(() => ({ statement: t('陈述'), quantity: t('数值'), formula: t('公式'), code: t('代码'), reference: t('引用') }))
|
|
832
|
+
const KIND_WORD = lazyTable(() => ({ concept: t('概念'), value_type: t('取值形态'), instance: t('实例'), literal: t('取值'), edge: t('关系') }))
|
|
763
833
|
|
|
764
834
|
/** 一步检验是怎么做的:独立核验直接说;自己做的,说到了哪一级(可复算 / 引用材料 / 推了一遍)。 */
|
|
765
|
-
const howOf = (row) => (row.evaluator === 'independent' ? t('独立核验') : (LEVEL_WORD[row.level] ?? t('
|
|
835
|
+
const howOf = (row) => (row.evaluator === 'independent' ? t('独立核验') : (LEVEL_WORD[row.level] ?? t('自行检验')))
|
|
766
836
|
|
|
767
837
|
/**
|
|
768
838
|
* **结论行的模型**(纯函数,导出给测试)。
|
|
@@ -855,7 +925,7 @@ window.__ModuleLoader__.load({
|
|
|
855
925
|
...names.map((_, index) => h('span', { key: `seg-${index}`, 'data-state': index < reached ? (stopped && index === reached - 1 ? 'broken' : 'done') : index === reached && !stopped ? 'next' : 'todo' })),
|
|
856
926
|
),
|
|
857
927
|
h('div', { className: 'clearai-stations-names' }, ...names.map((name, index) => h('span', { key: `name-${index}`, 'data-now': index === reached - 1 ? '1' : '0' }, name))),
|
|
858
|
-
stopped ? h('div', { className: 'clearai-stations-note' }, props.trust === 'refuted' ? t('
|
|
928
|
+
stopped ? h('div', { className: 'clearai-stations-note' }, props.trust === 'refuted' ? t('在检验阶段被推翻,不再推进。') : t('已被替换,不再推进。')) : null,
|
|
859
929
|
)
|
|
860
930
|
}
|
|
861
931
|
|
|
@@ -865,9 +935,9 @@ window.__ModuleLoader__.load({
|
|
|
865
935
|
const lines = rows.map((row, index) => {
|
|
866
936
|
let text = ''
|
|
867
937
|
if (row.kind === 'proposed') text = t('提出')
|
|
868
|
-
else if (row.kind === 'evidence') text = `${row.ordinal === null || row.ordinal === undefined ? t('
|
|
869
|
-
else if (row.kind === 'promoted') text = t('
|
|
870
|
-
else if (row.kind === 'retracted') text = `${t('
|
|
938
|
+
else if (row.kind === 'evidence') text = `${row.ordinal === null || row.ordinal === undefined ? t('单步检验') : `${nth(row.ordinal)}`}${t(':')}${VERDICT[row.verdict] ?? row.verdict} · ${howOf(row)}`
|
|
939
|
+
else if (row.kind === 'promoted') text = t('写入长期知识')
|
|
940
|
+
else if (row.kind === 'retracted') text = `${t('人工撤回')}${row.reason ? `:${brief(row.reason, 40)}` : ''}`
|
|
871
941
|
const moved = row.from !== undefined && row.from !== row.to
|
|
872
942
|
return h(
|
|
873
943
|
'div',
|
|
@@ -894,10 +964,10 @@ window.__ModuleLoader__.load({
|
|
|
894
964
|
'div',
|
|
895
965
|
{ className: 'clearai-detail' },
|
|
896
966
|
part(1, t('进度'), h(StationBar, { station: row.station, trust: row.trust })),
|
|
897
|
-
part(2, t('
|
|
967
|
+
part(2, t('可信度变化'), h(TrustTimeline, { history: row.history, station: row.station, trust: row.trust })),
|
|
898
968
|
part(
|
|
899
969
|
3,
|
|
900
|
-
t('
|
|
970
|
+
t('补充说明'),
|
|
901
971
|
h(
|
|
902
972
|
'div',
|
|
903
973
|
{ className: 'clearai-kv' },
|
|
@@ -922,20 +992,20 @@ window.__ModuleLoader__.load({
|
|
|
922
992
|
onClick: () => (origin.session !== null && origin.kind === 'evaluator-session' ? data.openSpectator?.(origin.session) : data.openPreview?.(origin.path)),
|
|
923
993
|
title: origin.path ?? '',
|
|
924
994
|
},
|
|
925
|
-
origin.kind === 'audit-card' || origin.kind === 'evaluator-session' ? t('
|
|
995
|
+
origin.kind === 'audit-card' || origin.kind === 'evaluator-session' ? t('查看核验') : t('查看记录'),
|
|
926
996
|
),
|
|
927
997
|
),
|
|
928
998
|
),
|
|
929
999
|
),
|
|
930
1000
|
...kv(t('范围'), row.scope === row.refuteWhen ? null : row.scope),
|
|
931
|
-
...kv(t('
|
|
1001
|
+
...kv(t('推翻条件'), row.refuteWhen),
|
|
932
1002
|
...kv(
|
|
933
1003
|
t('相关'),
|
|
934
1004
|
subjects.length === 0
|
|
935
1005
|
? null
|
|
936
|
-
: h('span', { className: 'clearai-chips' }, ...subjects.map((id) => h('span', { key: id, className: 'clearai-chip', onClick: () => props.onFocus?.(id), title: t('
|
|
1006
|
+
: h('span', { className: 'clearai-chips' }, ...subjects.map((id) => h('span', { key: id, className: 'clearai-chip', onClick: () => props.onFocus?.(id), title: t('在图中定位') }, labelOfEntity(data, id)))),
|
|
937
1007
|
),
|
|
938
|
-
...kv(t('
|
|
1008
|
+
...kv(t('来源'), row.step === null ? null : `${nth(row.step)}`),
|
|
939
1009
|
),
|
|
940
1010
|
),
|
|
941
1011
|
)
|
|
@@ -953,7 +1023,7 @@ window.__ModuleLoader__.load({
|
|
|
953
1023
|
{ className: 'clearai-row', 'data-open': open ? '1' : '0', 'data-trust': row.trust },
|
|
954
1024
|
h(
|
|
955
1025
|
'div',
|
|
956
|
-
{ className: 'clearai-row-head', onClick: () => props.onToggle(row.key), title: open ? t('收起') : t('
|
|
1026
|
+
{ className: 'clearai-row-head', onClick: () => props.onToggle(row.key), title: open ? t('收起') : t('点击查看进度与来源') },
|
|
957
1027
|
h(TrustTag, { trust: row.trust }),
|
|
958
1028
|
h('span', { className: 'clearai-row-title' }, title),
|
|
959
1029
|
sub === null ? null : h('span', { className: 'clearai-row-sub' }, sub),
|
|
@@ -966,7 +1036,7 @@ window.__ModuleLoader__.load({
|
|
|
966
1036
|
/** 结论列表:按可信度分组,空组不出现。 */
|
|
967
1037
|
function ConclusionList(props) {
|
|
968
1038
|
const rows = props.rows
|
|
969
|
-
if (rows.length === 0) return h('div', { className: 'clearai-quiet' }, t('
|
|
1039
|
+
if (rows.length === 0) return h('div', { className: 'clearai-quiet' }, props.empty ?? t('暂无结论。模型提出判断后,将在此逐条列出。'))
|
|
970
1040
|
return h(
|
|
971
1041
|
'div',
|
|
972
1042
|
{ className: 'clearai-list' },
|
|
@@ -983,31 +1053,13 @@ window.__ModuleLoader__.load({
|
|
|
983
1053
|
)
|
|
984
1054
|
}
|
|
985
1055
|
|
|
986
|
-
/** 页眉:在回答什么
|
|
1056
|
+
/** 页眉:在回答什么(计数、待处理与进度轨归探索货架)。 */
|
|
987
1057
|
function AtlasHeader(props) {
|
|
988
|
-
const { data
|
|
989
|
-
const live = rows.filter((row) => row.trust !== 'replaced')
|
|
990
|
-
const counts = TRUST_ORDER.filter((trust) => trust !== 'replaced')
|
|
991
|
-
.map((trust) => [trust, rows.filter((row) => row.trust === trust).length])
|
|
992
|
-
.filter(([, count]) => count > 0)
|
|
993
|
-
const stations = STATIONS().map((name, index) => [name, live.filter((row) => row.station >= index + 1).length])
|
|
994
|
-
const needYou = Array.isArray(data?.needYou) ? data.needYou : []
|
|
1058
|
+
const { data } = props
|
|
995
1059
|
return h(
|
|
996
1060
|
'div',
|
|
997
1061
|
{ className: 'clearai-head' },
|
|
998
|
-
h('div', { className: 'clearai-question', title: String(data?.goal?.claim ?? '') }, data?.goal ? String(data.knowledgeView?.goal?.headline ?? data.goal.claim ?? '') : t('
|
|
999
|
-
counts.length === 0 ? null : h('div', { className: 'clearai-counts' }, counts.map(([trust, count]) => `${TRUST_WORD[trust]} ${count}`).join(' · ')),
|
|
1000
|
-
...needYou.map((item, index) => h('div', { key: `need-${index}`, className: 'clearai-need' }, h('b', null, t('待处理')), String(item?.text ?? ''))),
|
|
1001
|
-
live.length === 0
|
|
1002
|
-
? null
|
|
1003
|
-
: h(
|
|
1004
|
-
'div',
|
|
1005
|
-
{ className: 'clearai-track' },
|
|
1006
|
-
...stations.flatMap(([name, count], index) => [
|
|
1007
|
-
index === 0 ? null : h('span', { key: `line-${index}`, className: 'clearai-track-line', 'data-on': count > 0 ? '1' : '0' }),
|
|
1008
|
-
h('span', { key: `st-${index}`, className: 'clearai-track-stop', 'data-on': count > 0 ? '1' : '0' }, h('i', null), `${name} ${count}`),
|
|
1009
|
-
]),
|
|
1010
|
-
),
|
|
1062
|
+
h('div', { className: 'clearai-question', title: String(data?.goal?.claim ?? '') }, data?.goal ? String(data.knowledgeView?.goal?.headline ?? data.goal.claim ?? '') : t('尚未设立目标')),
|
|
1011
1063
|
)
|
|
1012
1064
|
}
|
|
1013
1065
|
|
|
@@ -1030,10 +1082,11 @@ window.__ModuleLoader__.load({
|
|
|
1030
1082
|
installStyles()
|
|
1031
1083
|
}, [])
|
|
1032
1084
|
if (projected === undefined || projected === null) {
|
|
1033
|
-
return h('div', { className: 'clearai-atlas' }, h(Empty, null, t('
|
|
1085
|
+
return h('div', { className: 'clearai-atlas' }, h(Empty, null, t('暂无内容。发送第一条消息后,此处将显示本体图与结论。')))
|
|
1034
1086
|
}
|
|
1035
|
-
const data = { ...projected, openPreview: props.openPreview,
|
|
1036
|
-
|
|
1087
|
+
const data = { ...projected, openPreview: props.openPreview, openSpectator: props.openSpectator }
|
|
1088
|
+
/** 本体货架只放结果:已确立的事实(判断的全部过程在探索货架的「过程记录」里)。 */
|
|
1089
|
+
const rows = conclusionsOf(data).filter((row) => row.trust === 'credible')
|
|
1037
1090
|
const lexicon = data.lexicon ?? null
|
|
1038
1091
|
/** 世界树那边点进来的聚焦优先;手动点行仍然有效。 */
|
|
1039
1092
|
const focused = incoming === null || incoming === undefined ? null : propositionForStep(data, incoming.step)
|
|
@@ -1045,7 +1098,8 @@ window.__ModuleLoader__.load({
|
|
|
1045
1098
|
return h(
|
|
1046
1099
|
'div',
|
|
1047
1100
|
{ className: 'clearai-atlas' },
|
|
1048
|
-
h(AtlasHeader, { data
|
|
1101
|
+
h(AtlasHeader, { data }),
|
|
1102
|
+
h(AnswerCards, { data, openExplore: props.openExplore }),
|
|
1049
1103
|
h(GraphBand, {
|
|
1050
1104
|
lexicon,
|
|
1051
1105
|
layer,
|
|
@@ -1062,12 +1116,13 @@ window.__ModuleLoader__.load({
|
|
|
1062
1116
|
: h(
|
|
1063
1117
|
'div',
|
|
1064
1118
|
{ className: 'clearai-filter' },
|
|
1065
|
-
`${t('
|
|
1119
|
+
`${t('仅显示与「')}${String(filterTerm.label ?? filterTerm.id)}${t('」相关的内容')}${t(':')}${shown.length}/${rows.length}`,
|
|
1066
1120
|
h('span', { className: 'clearai-link', onClick: () => setFilter(null) }, t('清除')),
|
|
1067
1121
|
),
|
|
1068
|
-
h('div', { className: 'clearai-section-head' }, t('
|
|
1122
|
+
h('div', { className: 'clearai-section-head' }, t('已确立的事实')),
|
|
1069
1123
|
h(ConclusionList, {
|
|
1070
1124
|
rows: shown,
|
|
1125
|
+
empty: t('暂无已确立的事实。判断经检验与独立核验后,将在此列出;检验过程见探索货架。'),
|
|
1071
1126
|
open,
|
|
1072
1127
|
data,
|
|
1073
1128
|
onToggle: (key) => {
|
|
@@ -1082,6 +1137,378 @@ window.__ModuleLoader__.load({
|
|
|
1082
1137
|
}
|
|
1083
1138
|
},
|
|
1084
1139
|
}),
|
|
1140
|
+
(data.lessons ?? []).length === 0 ? null : h('div', { className: 'clearai-section-head' }, `${t('经验(')}${data.lessons.length}${t(')')}`),
|
|
1141
|
+
h(LessonList, { data }),
|
|
1142
|
+
)
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
/**
|
|
1146
|
+
* **探索货架**(中栏视图,紧挨「本体」):过程在这里,结果在本体货架。
|
|
1147
|
+
*
|
|
1148
|
+
* 主轴是 问题 → 候选假设(定向求解)或 调研板块 → 新发现的问题(广度调研),
|
|
1149
|
+
* 读的是宿主算好的 `exploration`(与运行态卡上「当前位置」同一份派生)。
|
|
1150
|
+
* 候选的状态只从证据来;界面不写任何状态。「立为问题 / 暂缓」两个按钮只是**替人发一句话**
|
|
1151
|
+
* 给模型,由模型用 Frame 修订落账——与「要改什么就在对话里说」是同一条路。
|
|
1152
|
+
*/
|
|
1153
|
+
const MODE_WORD = lazyTable(() => ({ survey: t('广度调研'), solve: t('定向求解'), survey_then_solve: t('先调研后求解') }))
|
|
1154
|
+
const CANDIDATE_WORD = lazyTable(() => ({ examining: t('考察中'), excluded: t('已排除'), adopted: t('已采纳'), set_aside: t('暂不考察') }))
|
|
1155
|
+
const AREA_WORD = lazyTable(() => ({ not_started: t('未开始'), in_progress: t('调研中'), clear: t('已厘清') }))
|
|
1156
|
+
const LESSON_WORD = lazyTable(() => ({ trap: t('常见误区'), check: t('前置核查'), shortcut: t('不可取的捷径'), prior: t('先验知识') }))
|
|
1157
|
+
|
|
1158
|
+
/** 关系 id → 名字(本体里登记的 label);找不到就如实给 id。 */
|
|
1159
|
+
const relationLabel = (data, id) => String((data?.lexicon?.predicates ?? []).find((item) => item.id === id)?.label ?? id)
|
|
1160
|
+
|
|
1161
|
+
/** 一条候选最近一条某种结论的依据(排除依据 / 采纳依据都从证据里来)。 */
|
|
1162
|
+
const latestBasis = (data, hypothesis, verdict) => {
|
|
1163
|
+
const rows = (Array.isArray(data?.evidence) ? data.evidence : []).filter((item) => item.hypothesis === hypothesis && item.verdict === verdict)
|
|
1164
|
+
return rows.length === 0 ? null : String(rows[rows.length - 1].basis ?? '') || null
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
/** 候选假设展开后的几行(标签按界面用语规范:提出依据 / 推翻条件 / 预测 / 排除依据 / 采纳依据 / 关联记录)。 */
|
|
1168
|
+
function candidateDetail(data, candidate, prediction) {
|
|
1169
|
+
const rows = []
|
|
1170
|
+
const push = (label, value) => {
|
|
1171
|
+
if (value !== null && value !== undefined && value !== '') rows.push([label, value])
|
|
1172
|
+
}
|
|
1173
|
+
push(t('提出依据'), candidate.from === null ? t('未注明(直觉)') : candidate.from === '直觉' || candidate.from === 'intuition' ? t('直觉') : `${t('本体关系「')}${relationLabel(data, candidate.from)}${t('」')}`)
|
|
1174
|
+
push(t('主张'), candidate.claim !== candidate.name ? candidate.claim : null)
|
|
1175
|
+
push(t('推翻条件'), candidate.refuteWhen)
|
|
1176
|
+
push(t('预测'), prediction)
|
|
1177
|
+
if (candidate.state === 'excluded') push(t('排除依据'), latestBasis(data, candidate.id, 'refute'))
|
|
1178
|
+
if (candidate.state === 'adopted') push(t('采纳依据'), latestBasis(data, candidate.id, 'support'))
|
|
1179
|
+
const support = (Array.isArray(data?.evidence) ? data.evidence : []).filter((item) => item.hypothesis === candidate.id && item.verdict === 'support').length
|
|
1180
|
+
push(t('关联记录'), `${t('支持 ')}${support}${t(' 条 · 推翻 ')}${candidate.refutations}${t(' 条 · 无法判定 ')}${candidate.inconclusive}${t(' 条')}`)
|
|
1181
|
+
return rows
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
/** 状态小签:候选与板块各用自己的一套词,颜色按状态族走(进行中 / 否定 / 肯定 / 搁置)。 */
|
|
1185
|
+
function StateTag(props) {
|
|
1186
|
+
return h('span', { className: 'clearai-state', 'data-s': props.state }, props.children)
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
/** 一个问题:标题、计数、候选列表(可展开)、暂不考察的放在页脚。 */
|
|
1190
|
+
function QuestionBox(props) {
|
|
1191
|
+
const { data, question, index, next, open, onToggle } = props
|
|
1192
|
+
const shown = question.candidates.filter((candidate) => candidate.state !== 'set_aside')
|
|
1193
|
+
const parked = question.candidates.filter((candidate) => candidate.state === 'set_aside')
|
|
1194
|
+
const counts = ['examining', 'excluded', 'adopted'].filter((key) => (question.counts?.[key] ?? 0) > 0).map((key) => `${CANDIDATE_WORD[key]} ${question.counts[key]}`)
|
|
1195
|
+
const predictionOf = (id) => (next?.predictions ?? []).find((item) => item.hypothesis === id)?.expect ?? null
|
|
1196
|
+
const status =
|
|
1197
|
+
question.status === 'answered'
|
|
1198
|
+
? h('span', { className: 'clearai-link', onClick: () => props.openFacts?.(), title: t('在本体货架中展开此结论') }, t('已得出结论 · 查看结论'))
|
|
1199
|
+
: question.status === 'parked'
|
|
1200
|
+
? h('span', null, t('已暂缓'))
|
|
1201
|
+
: question.status === 'emergent'
|
|
1202
|
+
? h('span', null, t('新发现,待您决定'))
|
|
1203
|
+
: h('span', null, shown.length === 0 ? t('尚无候选假设') : `${t('候选假设 ')}${question.candidates.length}${t(' 个:')}${counts.join(' · ')}`)
|
|
1204
|
+
const compact = shown.length === 0 && question.status !== 'emergent'
|
|
1205
|
+
return h(
|
|
1206
|
+
'section',
|
|
1207
|
+
{ className: 'clearai-box', 'data-compact': compact ? '1' : '0', 'data-current': props.current ? '1' : '0' },
|
|
1208
|
+
h(
|
|
1209
|
+
'div',
|
|
1210
|
+
{ className: 'clearai-box-head' },
|
|
1211
|
+
question.implicit ? null : h('span', { className: 'clearai-box-kind' }, `${t('问题 ')}${index + 1}`),
|
|
1212
|
+
h('span', { className: 'clearai-box-title' }, question.implicit ? t('候选假设') : question.text),
|
|
1213
|
+
h('span', { className: 'clearai-box-note' }, status),
|
|
1214
|
+
),
|
|
1215
|
+
question.status === 'emergent' ? h(EmergentActions, { question, send: props.send, sent: props.sent, onSent: props.onSent }) : null,
|
|
1216
|
+
...shown.map((candidate) => {
|
|
1217
|
+
const isOpen = open === candidate.id
|
|
1218
|
+
return h(
|
|
1219
|
+
'div',
|
|
1220
|
+
{ key: candidate.id, className: 'clearai-cand', 'data-open': isOpen ? '1' : '0', 'data-s': candidate.state },
|
|
1221
|
+
h(
|
|
1222
|
+
'button',
|
|
1223
|
+
{ type: 'button', className: 'clearai-cand-head', 'aria-expanded': isOpen ? 'true' : 'false', onClick: () => onToggle(isOpen ? null : candidate.id) },
|
|
1224
|
+
h(StateTag, { state: candidate.state }, CANDIDATE_WORD[candidate.state] ?? candidate.state),
|
|
1225
|
+
h('span', { className: 'clearai-cand-name' }, candidate.name),
|
|
1226
|
+
candidate.claim !== candidate.name ? h('span', { className: 'clearai-cand-note' }, brief(candidate.claim, 80)) : null,
|
|
1227
|
+
h('span', { className: 'clearai-cand-chevron', 'aria-hidden': 'true' }, isOpen ? t('收起') : t('展开')),
|
|
1228
|
+
),
|
|
1229
|
+
isOpen
|
|
1230
|
+
? h(
|
|
1231
|
+
'div',
|
|
1232
|
+
{ className: 'clearai-cand-detail' },
|
|
1233
|
+
...candidateDetail(data, candidate, predictionOf(candidate.id)).map(([label, value]) => h('div', { key: label, className: 'clearai-kvrow' }, h('span', null, label), h('span', null, value))),
|
|
1234
|
+
)
|
|
1235
|
+
: null,
|
|
1236
|
+
)
|
|
1237
|
+
}),
|
|
1238
|
+
parked.length === 0
|
|
1239
|
+
? null
|
|
1240
|
+
: h(
|
|
1241
|
+
'div',
|
|
1242
|
+
{ className: 'clearai-box-foot' },
|
|
1243
|
+
...parked.map((candidate) => h('span', { key: candidate.id, className: 'clearai-parked' }, h(StateTag, { state: 'set_aside' }, CANDIDATE_WORD.set_aside), h('s', null, candidate.name))),
|
|
1244
|
+
),
|
|
1245
|
+
)
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
/**
|
|
1249
|
+
* 「立为问题 / 暂缓」:替人发一句话给模型(模型用 Frame 修订落账),界面自己不写状态。
|
|
1250
|
+
* 发不出去(拿不到会话的对话服务)就如实说请在对话中说明,不假装发了。
|
|
1251
|
+
*/
|
|
1252
|
+
function EmergentActions(props) {
|
|
1253
|
+
const { question } = props
|
|
1254
|
+
const sent = props.sent?.[question.id] ?? null
|
|
1255
|
+
if (sent === 'pursue') return h('div', { className: 'clearai-emergent-done' }, t('已请求立为问题,待模型修订立题后生效。'))
|
|
1256
|
+
if (sent === 'park') return h('div', { className: 'clearai-emergent-done' }, t('已请求暂缓,结案时列入「尚未确定的事项」。'))
|
|
1257
|
+
if (sent === 'failed') return h('div', { className: 'clearai-emergent-done' }, t('无法自动发送,请在对话中说明。'))
|
|
1258
|
+
const ask = (kind, text) => props.onSent?.(question.id, typeof props.send === 'function' && props.send(text) === true ? kind : 'failed')
|
|
1259
|
+
return h(
|
|
1260
|
+
'div',
|
|
1261
|
+
{ className: 'clearai-emergent' },
|
|
1262
|
+
h('span', { className: 'clearai-emergent-kind' }, t('新发现的问题')),
|
|
1263
|
+
h('span', { className: 'clearai-emergent-text' }, question.text),
|
|
1264
|
+
h(
|
|
1265
|
+
'span',
|
|
1266
|
+
{ className: 'clearai-emergent-actions' },
|
|
1267
|
+
h('button', { type: 'button', className: 'clearai-btn', 'data-primary': '1', onClick: () => ask('pursue', `${t('请将新发现的问题「')}${question.text}${t('」立为问题深入研究(问题 ')}${question.id}${t(')。')}`) }, t('立为问题')),
|
|
1268
|
+
h('button', { type: 'button', className: 'clearai-btn', onClick: () => ask('park', `${t('请暂缓问题「')}${question.text}${t('」(问题 ')}${question.id}${t('),结案时列入「尚未确定的事项」。')}`) }, t('暂缓')),
|
|
1269
|
+
),
|
|
1270
|
+
)
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
/** 广度调研:调研板块一行一个,板块下挂新发现的问题。 */
|
|
1274
|
+
function AreaBox(props) {
|
|
1275
|
+
const { exploration } = props
|
|
1276
|
+
const areas = exploration.areas ?? []
|
|
1277
|
+
const counts = ['clear', 'in_progress', 'not_started'].map((key) => [key, areas.filter((area) => area.state === key).length]).filter(([, count]) => count > 0)
|
|
1278
|
+
return h(
|
|
1279
|
+
'section',
|
|
1280
|
+
{ className: 'clearai-box' },
|
|
1281
|
+
h('div', { className: 'clearai-box-head' }, h('span', { className: 'clearai-box-title' }, t('调研板块')), h('span', { className: 'clearai-box-note' }, counts.map(([key, count]) => `${AREA_WORD[key]} ${count}`).join(' · '))),
|
|
1282
|
+
...areas.map((area) => {
|
|
1283
|
+
const emergent = (exploration.questions ?? []).filter((question) => question.area === area.id && question.status === 'emergent')
|
|
1284
|
+
const note = [`${t('判断 ')}${area.judgments}${t(' 条 · 已采纳 ')}${area.verified}${t(' 条')}`, area.openAnomalies > 0 ? `${t('未解释的现象 ')}${area.openAnomalies}${t(' 项')}` : null].filter((item) => item !== null).join(' · ')
|
|
1285
|
+
return h(
|
|
1286
|
+
'div',
|
|
1287
|
+
{ key: area.id, className: 'clearai-cand', 'data-s': area.state },
|
|
1288
|
+
h('div', { className: 'clearai-cand-head', 'data-static': '1' }, h(StateTag, { state: area.state }, AREA_WORD[area.state] ?? area.state), h('span', { className: 'clearai-cand-name' }, area.name), h('span', { className: 'clearai-cand-note' }, note)),
|
|
1289
|
+
...emergent.map((question) => h(EmergentActions, { key: question.id, question, send: props.send, sent: props.sent, onSent: props.onSent })),
|
|
1290
|
+
)
|
|
1291
|
+
}),
|
|
1292
|
+
)
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
/** 下一步:做什么,以及各候选的预测;预测相同就如实说这一步区分不了。 */
|
|
1296
|
+
function NextBox(props) {
|
|
1297
|
+
const next = props.next
|
|
1298
|
+
if (next === null || next === undefined) return null
|
|
1299
|
+
const predictions = Array.isArray(next.predictions) ? next.predictions : []
|
|
1300
|
+
return h(
|
|
1301
|
+
'section',
|
|
1302
|
+
{ className: 'clearai-next' },
|
|
1303
|
+
h('div', { className: 'clearai-next-head' }, h('span', { className: 'clearai-next-kind' }, t('下一步')), h('span', { className: 'clearai-next-title' }, `${nth(next.ordinal)}${t(':')}${next.do}`)),
|
|
1304
|
+
predictions.length === 0
|
|
1305
|
+
? next.expect
|
|
1306
|
+
? h('div', { className: 'clearai-next-note' }, `${t('预测:')}${next.expect}`)
|
|
1307
|
+
: null
|
|
1308
|
+
: h(
|
|
1309
|
+
'div',
|
|
1310
|
+
{ className: 'clearai-preds' },
|
|
1311
|
+
...predictions.map((item, index) => h('div', { key: `p-${index}`, className: 'clearai-pred' }, h('div', { className: 'clearai-pred-if' }, `${t('若「')}${item.name}${t('」成立,预测')}`), h('div', { className: 'clearai-pred-value' }, item.expect))),
|
|
1312
|
+
),
|
|
1313
|
+
next.indistinct === true
|
|
1314
|
+
? h('div', { className: 'clearai-next-warn' }, t('各候选假设的预测相同,此步骤无法区分它们。'))
|
|
1315
|
+
: h('div', { className: 'clearai-next-note' }, t('如需调整计划,请在对话中说明。')),
|
|
1316
|
+
)
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
/** 未解释的现象:开着的逐条列出(结案时必须写进「尚未确定的事项」或先有去处)。 */
|
|
1320
|
+
function AnomalyBox(props) {
|
|
1321
|
+
const open = (Array.isArray(props.data?.anomalies) ? props.data.anomalies : []).filter((item) => item.status === 'open')
|
|
1322
|
+
if (open.length === 0) return null
|
|
1323
|
+
return h(
|
|
1324
|
+
'section',
|
|
1325
|
+
{ className: 'clearai-box' },
|
|
1326
|
+
h('div', { className: 'clearai-box-head' }, h('span', { className: 'clearai-box-title' }, `${t('未解释的现象(')}${open.length}${t(')')}`), h('span', { className: 'clearai-box-note' }, t('结案前须解释、排除或写入「尚未确定的事项」'))),
|
|
1327
|
+
...open.map((item) =>
|
|
1328
|
+
h(
|
|
1329
|
+
'div',
|
|
1330
|
+
{ key: item.id, className: 'clearai-anomaly' },
|
|
1331
|
+
h('span', null, item.what),
|
|
1332
|
+
item.by === 'evaluator' ? h('span', { className: 'clearai-anomaly-meta' }, t('独立评估发现')) : null,
|
|
1333
|
+
(item.touches ?? []).length > 0 ? h('span', { className: 'clearai-anomaly-meta' }, `${t('涉及:')}${item.touches.join(t('、'))}`) : null,
|
|
1334
|
+
),
|
|
1335
|
+
),
|
|
1336
|
+
)
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
/** 判断的计数与四站进度轨(原在本体货架页眉;过程信息归探索货架)。 */
|
|
1340
|
+
function JudgmentSummary(props) {
|
|
1341
|
+
const rows = props.rows
|
|
1342
|
+
const live = rows.filter((row) => row.trust !== 'replaced')
|
|
1343
|
+
const counts = TRUST_ORDER.filter((trust) => trust !== 'replaced')
|
|
1344
|
+
.map((trust) => [trust, rows.filter((row) => row.trust === trust).length])
|
|
1345
|
+
.filter(([, count]) => count > 0)
|
|
1346
|
+
const stations = STATIONS().map((name, index) => [name, live.filter((row) => row.station >= index + 1).length])
|
|
1347
|
+
return h(
|
|
1348
|
+
'div',
|
|
1349
|
+
{ className: 'clearai-judgments-head' },
|
|
1350
|
+
counts.length === 0 ? null : h('div', { className: 'clearai-counts' }, counts.map(([trust, count]) => `${TRUST_WORD[trust]} ${count}`).join(' · ')),
|
|
1351
|
+
live.length === 0
|
|
1352
|
+
? null
|
|
1353
|
+
: h(
|
|
1354
|
+
'div',
|
|
1355
|
+
{ className: 'clearai-track' },
|
|
1356
|
+
...stations.flatMap(([name, count], index) => [
|
|
1357
|
+
index === 0 ? null : h('span', { key: `line-${index}`, className: 'clearai-track-line', 'data-on': count > 0 ? '1' : '0' }),
|
|
1358
|
+
h('span', { key: `st-${index}`, className: 'clearai-track-stop', 'data-on': count > 0 ? '1' : '0' }, h('i', null), `${name} ${count}`),
|
|
1359
|
+
]),
|
|
1360
|
+
),
|
|
1361
|
+
)
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
function ExploreView(props) {
|
|
1365
|
+
const projected = typeof props.useProjection === 'function' ? props.useProjection('clearai') : undefined
|
|
1366
|
+
const [open, setOpen] = React.useState(null)
|
|
1367
|
+
const [processOpen, setProcessOpen] = React.useState(false)
|
|
1368
|
+
const [manual, setManual] = React.useState(null)
|
|
1369
|
+
const [sent, setSent] = React.useState({})
|
|
1370
|
+
const incoming = useFocus(factsFocus)
|
|
1371
|
+
React.useEffect(() => {
|
|
1372
|
+
installStyles()
|
|
1373
|
+
}, [])
|
|
1374
|
+
if (projected === undefined || projected === null) return h('div', { className: 'clearai-atlas' }, h(Empty, null, t('暂无内容。发送第一条消息后,此处将显示问题、候选假设与下一步。')))
|
|
1375
|
+
const data = { ...projected, openPreview: props.openPreview, openSpectator: props.openSpectator }
|
|
1376
|
+
const exploration = data.exploration ?? null
|
|
1377
|
+
const goal = data.goal ?? null
|
|
1378
|
+
const rows = conclusionsOf(data)
|
|
1379
|
+
const openFacts = () => props.openFacts?.()
|
|
1380
|
+
const onSent = (id, kind) => setSent({ ...sent, [id]: kind })
|
|
1381
|
+
const focused = incoming === null || incoming === undefined ? null : propositionForStep(data, incoming.step)
|
|
1382
|
+
const opened = focused ?? manual
|
|
1383
|
+
const showProcess = processOpen || focused !== null
|
|
1384
|
+
if (goal === null) {
|
|
1385
|
+
return h('div', { className: 'clearai-atlas' }, h(Empty, null, t('尚未设立目标。模型立题后,此处将显示问题、候选假设与下一步。')))
|
|
1386
|
+
}
|
|
1387
|
+
const questions = Array.isArray(exploration?.questions) ? exploration.questions : []
|
|
1388
|
+
const declared = questions.filter((question) => !question.implicit)
|
|
1389
|
+
const areas = Array.isArray(exploration?.areas) ? exploration.areas : []
|
|
1390
|
+
const currentIndex = declared.findIndex((question) => question.id === exploration?.current)
|
|
1391
|
+
const plan = data.plan ?? null
|
|
1392
|
+
const steps = plan === null ? [] : (plan.steps ?? []).filter((step) => step.status !== 'void')
|
|
1393
|
+
const doneSteps = steps.filter((step) => step.status === 'advanced').length
|
|
1394
|
+
const chips = [
|
|
1395
|
+
exploration?.mode ? `${t('阶段 · ')}${MODE_WORD[exploration.mode] ?? exploration.mode}` : null,
|
|
1396
|
+
areas.length > 0 ? `${t('调研板块 ')}${areas.length}${t(' 个 · 已厘清 ')}${areas.filter((area) => area.state === 'clear').length}${t(' 个')}` : null,
|
|
1397
|
+
declared.length > 0 && currentIndex >= 0 ? `${t('当前问题 ')}${currentIndex + 1}${t(' / 共 ')}${declared.length}` : null,
|
|
1398
|
+
steps.length > 0 ? `${t('计划 已完成 ')}${doneSteps}${t(' / ')}${steps.length}${t(' 步')}` : null,
|
|
1399
|
+
].filter((item) => item !== null)
|
|
1400
|
+
const needYou = Array.isArray(data.needYou) ? data.needYou : []
|
|
1401
|
+
const audits = (Array.isArray(data.audits) ? data.audits : []).length
|
|
1402
|
+
const openAnomalies = (Array.isArray(data.anomalies) ? data.anomalies : []).filter((item) => item.status === 'open').length
|
|
1403
|
+
const running = steps.find((step) => step.status === 'open') ?? null
|
|
1404
|
+
const summary = [`${t('判断 ')}${rows.length}${t(' 条')}`, `${t('独立评估 ')}${audits}${t(' 次')}`, `${t('未解释的现象 ')}${openAnomalies}${t(' 项')}`, steps.length > 0 ? `${t('计划共 ')}${steps.length}${t(' 步')}${running === null ? '' : `${t('(')}${nth(running.ordinal)}${t('进行中)')}`}` : null].filter((item) => item !== null).join(' · ')
|
|
1405
|
+
const questionList = questions.filter((question) => question.implicit || question.area === null || question.area === undefined || question.status !== 'emergent')
|
|
1406
|
+
return h(
|
|
1407
|
+
'div',
|
|
1408
|
+
{ className: 'clearai-atlas' },
|
|
1409
|
+
h(
|
|
1410
|
+
'div',
|
|
1411
|
+
{ className: 'clearai-head' },
|
|
1412
|
+
h('div', { className: 'clearai-head-kind' }, t('课题')),
|
|
1413
|
+
h('div', { className: 'clearai-question', title: String(goal.claim ?? '') }, String(goal.headline ?? data.knowledgeView?.goal?.headline ?? goal.claim ?? '')),
|
|
1414
|
+
chips.length === 0 ? null : h('div', { className: 'clearai-pills' }, ...chips.map((chip, index) => h('span', { key: `c-${index}`, className: 'clearai-pill' }, chip))),
|
|
1415
|
+
),
|
|
1416
|
+
needYou.length === 0
|
|
1417
|
+
? null
|
|
1418
|
+
: h(
|
|
1419
|
+
'section',
|
|
1420
|
+
{ className: 'clearai-waiting' },
|
|
1421
|
+
h('b', null, `${t('待您处理(')}${needYou.length}${t(')')}`),
|
|
1422
|
+
...needYou.map((item, index) => h('span', { key: `need-${index}` }, String(item?.text ?? ''))),
|
|
1423
|
+
),
|
|
1424
|
+
areas.length > 0 ? h(AreaBox, { exploration, send: props.send, sent, onSent }) : null,
|
|
1425
|
+
...questionList.map((question) => h(QuestionBox, { key: question.id, data, question, index: declared.indexOf(question), current: question.id === exploration?.current, next: exploration?.next ?? null, open, onToggle: setOpen, openFacts, send: props.send, sent, onSent })),
|
|
1426
|
+
h(NextBox, { next: exploration?.next ?? null }),
|
|
1427
|
+
h(AnomalyBox, { data }),
|
|
1428
|
+
h(
|
|
1429
|
+
'section',
|
|
1430
|
+
{ className: 'clearai-process' },
|
|
1431
|
+
h(
|
|
1432
|
+
'button',
|
|
1433
|
+
{ type: 'button', className: 'clearai-process-head', 'aria-expanded': showProcess ? 'true' : 'false', onClick: () => {
|
|
1434
|
+
factsFocus.set(null)
|
|
1435
|
+
setProcessOpen(!showProcess)
|
|
1436
|
+
} },
|
|
1437
|
+
h('b', null, t('过程记录')),
|
|
1438
|
+
h('span', null, summary),
|
|
1439
|
+
h('span', { className: 'clearai-cand-chevron', 'aria-hidden': 'true' }, showProcess ? t('收起') : t('展开')),
|
|
1440
|
+
),
|
|
1441
|
+
showProcess
|
|
1442
|
+
? h(
|
|
1443
|
+
'div',
|
|
1444
|
+
{ className: 'clearai-process-body' },
|
|
1445
|
+
h(JudgmentSummary, { rows }),
|
|
1446
|
+
h(ConclusionList, {
|
|
1447
|
+
rows,
|
|
1448
|
+
open: opened,
|
|
1449
|
+
data,
|
|
1450
|
+
onToggle: (key) => {
|
|
1451
|
+
factsFocus.set(null)
|
|
1452
|
+
setManual(opened === key ? null : key)
|
|
1453
|
+
},
|
|
1454
|
+
onFocus: () => openFacts(),
|
|
1455
|
+
}),
|
|
1456
|
+
h(WorldTree, { data, openPreview: props.openPreview, openSpectator: props.openSpectator, openFacts: (stepId) => factsFocus.set({ step: stepId }) }),
|
|
1457
|
+
)
|
|
1458
|
+
: null,
|
|
1459
|
+
),
|
|
1460
|
+
)
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
/** 本体货架的结论卡:按问题切换,四部分(结论 / 依据 / 尚未确定的事项 / 待您决策)。 */
|
|
1464
|
+
function AnswerCards(props) {
|
|
1465
|
+
const answers = Array.isArray(props.data?.goal?.answers) ? props.data.goal.answers : []
|
|
1466
|
+
const [picked, setPicked] = React.useState(null)
|
|
1467
|
+
if (answers.length === 0) return null
|
|
1468
|
+
const questions = Array.isArray(props.data?.exploration?.questions) ? props.data.exploration.questions : []
|
|
1469
|
+
const textOf = (id) => questions.find((question) => question.id === id && !question.implicit)?.text ?? null
|
|
1470
|
+
const chosen = answers.find((answer) => answer.question === picked) ?? answers[0]
|
|
1471
|
+
const part = (label, body, warm = false) => h('div', { className: 'clearai-answer-part', 'data-warm': warm ? '1' : '0' }, h('span', { className: 'clearai-answer-label' }, label), body)
|
|
1472
|
+
const open = Array.isArray(chosen.open) ? chosen.open : []
|
|
1473
|
+
const decide = Array.isArray(chosen.decide) ? chosen.decide : []
|
|
1474
|
+
const basis = Array.isArray(chosen.basis) ? chosen.basis : []
|
|
1475
|
+
return h(
|
|
1476
|
+
'div',
|
|
1477
|
+
{ className: 'clearai-answers' },
|
|
1478
|
+
answers.length < 2
|
|
1479
|
+
? null
|
|
1480
|
+
: h(
|
|
1481
|
+
'div',
|
|
1482
|
+
{ className: 'clearai-pills' },
|
|
1483
|
+
...answers.map((answer, index) =>
|
|
1484
|
+
h(
|
|
1485
|
+
'button',
|
|
1486
|
+
{ key: `q-${index}`, type: 'button', className: 'clearai-qtab', 'aria-pressed': answer === chosen ? 'true' : 'false', onClick: () => setPicked(answer.question) },
|
|
1487
|
+
`${t('问题 ')}${index + 1}${textOf(answer.question) ? ` · ${brief(textOf(answer.question), 16)}` : ''}`,
|
|
1488
|
+
),
|
|
1489
|
+
),
|
|
1490
|
+
),
|
|
1491
|
+
h(
|
|
1492
|
+
'section',
|
|
1493
|
+
{ className: 'clearai-answer' },
|
|
1494
|
+
part(t('结论'), h('span', { className: 'clearai-answer-main' }, chosen.conclusion || `${t('未能回答:')}${chosen.unanswered ?? ''}`)),
|
|
1495
|
+
basis.length === 0 ? null : part(t('依据'), h('div', { className: 'clearai-answer-lines' }, ...basis.map((line, index) => h('div', { key: `b-${index}` }, h('span', null, line), ' ', h('span', { className: 'clearai-link', onClick: () => props.openExplore?.() }, t('查看探索记录')))))),
|
|
1496
|
+
open.length === 0 ? null : part(t('尚未确定的事项'), h('div', { className: 'clearai-answer-lines' }, ...open.map((entry, index) => h('div', { key: `o-${index}` }, entry.effect)))),
|
|
1497
|
+
decide.length === 0 ? null : part(t('待您决策'), h('div', { className: 'clearai-answer-lines' }, ...decide.map((line, index) => h('div', { key: `d-${index}` }, line))), true),
|
|
1498
|
+
),
|
|
1499
|
+
)
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
/** 经验:以前结案时核过的「下次怎么做」(含别的会话留下的)。 */
|
|
1503
|
+
function LessonList(props) {
|
|
1504
|
+
const lessons = Array.isArray(props.data?.lessons) ? props.data.lessons : []
|
|
1505
|
+
if (lessons.length === 0) return null
|
|
1506
|
+
return h(
|
|
1507
|
+
'div',
|
|
1508
|
+
{ className: 'clearai-list' },
|
|
1509
|
+
...lessons.map((lesson) =>
|
|
1510
|
+
h('div', { key: lesson.id, className: 'clearai-lesson' }, h('span', { className: 'clearai-lesson-kind' }, LESSON_WORD[lesson.kind] ?? lesson.kind), h('span', null, lesson.text), lesson.boundary ? h('span', { className: 'clearai-lesson-meta' }, `${t('不适用:')}${lesson.boundary}`) : null),
|
|
1511
|
+
),
|
|
1085
1512
|
)
|
|
1086
1513
|
}
|
|
1087
1514
|
|
|
@@ -1292,10 +1719,13 @@ window.__ModuleLoader__.load({
|
|
|
1292
1719
|
function WorldTree(props) {
|
|
1293
1720
|
const sessions = props.useSessions
|
|
1294
1721
|
const sessionId = props.sessionId
|
|
1722
|
+
/** 探索货架里直接把投影交下来(`data`);旧的独立挂法仍按会话快照取。 */
|
|
1295
1723
|
const data =
|
|
1296
|
-
|
|
1297
|
-
?
|
|
1298
|
-
:
|
|
1724
|
+
props.data !== undefined
|
|
1725
|
+
? props.data
|
|
1726
|
+
: typeof sessions === 'function' && typeof sessionId === 'string'
|
|
1727
|
+
? sessions((snapshot) => snapshot?.byId?.[sessionId]?.projectionValues?.clearai)
|
|
1728
|
+
: undefined
|
|
1299
1729
|
const [manual, setManual] = React.useState(null)
|
|
1300
1730
|
const [picked, setPicked] = React.useState(null)
|
|
1301
1731
|
const focus = useFocus(treeFocus)
|
|
@@ -1309,7 +1739,7 @@ window.__ModuleLoader__.load({
|
|
|
1309
1739
|
const chosen = wanted === null ? null : plans.find((item) => item.id === wanted) ?? null
|
|
1310
1740
|
const plan = chosen ?? (data === null || data === undefined ? null : data.plan)
|
|
1311
1741
|
if (plan === null || plan === undefined) {
|
|
1312
|
-
return h('div', { style: S.wrap }, h('div', { style: S.bar }, h('span', { style: S.title }, t('
|
|
1742
|
+
return h('div', { style: S.wrap }, h('div', { style: S.bar }, h('span', { style: S.title }, t('计划'))), h(Empty, null, t('暂无计划。建立计划后,此处将显示计划的步骤与闸门。')))
|
|
1313
1743
|
}
|
|
1314
1744
|
const rows = treeRows(plan)
|
|
1315
1745
|
/** 页眉那一句:计划的首个非空行,过长再截(整篇在 tooltip 与「计划文档」里)。 */
|
|
@@ -1382,7 +1812,7 @@ window.__ModuleLoader__.load({
|
|
|
1382
1812
|
h(
|
|
1383
1813
|
'div',
|
|
1384
1814
|
{ style: S.bar },
|
|
1385
|
-
h('span', { style: S.title }, t('
|
|
1815
|
+
h('span', { style: S.title }, t('计划')),
|
|
1386
1816
|
/**
|
|
1387
1817
|
* 页眉只放**一句话**:`brief` 常常是整篇 markdown 计划(真数据里这一行渲染出 1794 字 ✗),
|
|
1388
1818
|
* 全文进 tooltip,要读整篇点「打开计划」(原生预览 `clear/goals/plans/<id>.md`)——
|
|
@@ -1404,7 +1834,7 @@ window.__ModuleLoader__.load({
|
|
|
1404
1834
|
setPicked(event.target.value)
|
|
1405
1835
|
setManual(null)
|
|
1406
1836
|
},
|
|
1407
|
-
title: t('
|
|
1837
|
+
title: t('切换到以前的计划(计划均保留,文档归档在 clear/goals/plans/)'),
|
|
1408
1838
|
style: { font: 'inherit', fontSize: 11.5, color: 'var(--dsw-alias-label-secondary)', background: 'transparent', border: '.5px solid var(--dsw-alias-border-l2)', borderRadius: 6, padding: '1px 4px' },
|
|
1409
1839
|
},
|
|
1410
1840
|
...plans.map((item, index) =>
|
|
@@ -1413,7 +1843,7 @@ window.__ModuleLoader__.load({
|
|
|
1413
1843
|
),
|
|
1414
1844
|
chosen === null
|
|
1415
1845
|
? null
|
|
1416
|
-
: h('span', { style: { ...S.faint, opacity: 0.8 } }, t('
|
|
1846
|
+
: h('span', { style: { ...S.faint, opacity: 0.8 } }, t('已完成 · 可查看存档')),
|
|
1417
1847
|
h(
|
|
1418
1848
|
'span',
|
|
1419
1849
|
{ style: S.faint },
|
|
@@ -1482,7 +1912,7 @@ window.__ModuleLoader__.load({
|
|
|
1482
1912
|
stat.marks.loops.rounds > 1
|
|
1483
1913
|
? h('span', { title: `${stat.marks.loops.rounds}${t(' 轮')}${stat.marks.loops.fails > 0 ? ` · 其中 ${stat.marks.loops.fails} 次被驳回` : ''}` }, `${stat.marks.loops.rounds}${t(' 轮')}`)
|
|
1484
1914
|
: null,
|
|
1485
|
-
stat.judges > 0 ? h('span', { title: `${t('
|
|
1915
|
+
stat.judges > 0 ? h('span', { title: `${t('已派出评估者 ')}${stat.judges}${t(' 次')}` }, t('独立核验')) : null,
|
|
1486
1916
|
),
|
|
1487
1917
|
)
|
|
1488
1918
|
}),
|
|
@@ -1513,7 +1943,7 @@ window.__ModuleLoader__.load({
|
|
|
1513
1943
|
: h(
|
|
1514
1944
|
'div',
|
|
1515
1945
|
{ style: S.kv },
|
|
1516
|
-
h('span', { style: S.faint }, t('
|
|
1946
|
+
h('span', { style: S.faint }, t('任务内容')), h('span', null, step.do),
|
|
1517
1947
|
h('span', { style: S.faint }, t('判据')), h('span', null, `${step.doneCriteria}${step.voidReason === null || step.voidReason === undefined ? '' : `(作废:${step.voidReason})`}`),
|
|
1518
1948
|
h('span', { style: S.faint }, t('状态')), h('span', null, `${gloss(STEP, step.status)}${step.level === null || step.level === undefined ? '' : ` · ${step.level}`}`),
|
|
1519
1949
|
h(
|
|
@@ -1539,8 +1969,8 @@ window.__ModuleLoader__.load({
|
|
|
1539
1969
|
'span',
|
|
1540
1970
|
{ key: `${path}-${index}`, style: { marginRight: 8 } },
|
|
1541
1971
|
exists === false
|
|
1542
|
-
? h('span', { style: { ...S.mono, opacity: 0.6 }, title: t('
|
|
1543
|
-
: h(Link, { onClick: () => props.openPreview?.(path), title: exists === true ? t('
|
|
1972
|
+
? h('span', { style: { ...S.mono, opacity: 0.6 }, title: t('磁盘上未找到该文件') }, `${path}${t('(缺失)')}`)
|
|
1973
|
+
: h(Link, { onClick: () => props.openPreview?.(path), title: exists === true ? t('在原生预览中打开') : t('在原生预览中打开(计划声明的产物)') }, h('span', { style: S.mono }, path)),
|
|
1544
1974
|
)
|
|
1545
1975
|
}),
|
|
1546
1976
|
),
|
|
@@ -1561,7 +1991,7 @@ window.__ModuleLoader__.load({
|
|
|
1561
1991
|
Link,
|
|
1562
1992
|
{
|
|
1563
1993
|
onClick: () => props.openFacts(step.id),
|
|
1564
|
-
title: t('
|
|
1994
|
+
title: t('在本体货架中展开此结论'),
|
|
1565
1995
|
},
|
|
1566
1996
|
t('查看此步骤的证据'),
|
|
1567
1997
|
),
|
|
@@ -1578,8 +2008,8 @@ window.__ModuleLoader__.load({
|
|
|
1578
2008
|
'div',
|
|
1579
2009
|
{ key: item.id, style: S.faint },
|
|
1580
2010
|
`${t('独立核验:')}${item.verdict === null || item.verdict === undefined ? t('正在裁决') : (VERDICT[item.verdict] ?? item.verdict)}`,
|
|
1581
|
-
item.evaluatorSession === null || item.evaluatorSession === undefined ? null : h(Link, { onClick: () => props.openSpectator?.(item.evaluatorSession) }, h('span', null, t('
|
|
1582
|
-
item.cardPath === null || item.cardPath === undefined ? null : h(Link, { onClick: () => props.openPreview?.(item.cardPath) }, h('span', null, t('
|
|
2011
|
+
item.evaluatorSession === null || item.evaluatorSession === undefined ? null : h(Link, { onClick: () => props.openSpectator?.(item.evaluatorSession) }, h('span', null, t(' 查看核验过程'))),
|
|
2012
|
+
item.cardPath === null || item.cardPath === undefined ? null : h(Link, { onClick: () => props.openPreview?.(item.cardPath) }, h('span', null, t(' 查看核验记录'))),
|
|
1583
2013
|
),
|
|
1584
2014
|
),
|
|
1585
2015
|
),
|
|
@@ -1652,9 +2082,24 @@ window.__ModuleLoader__.load({
|
|
|
1652
2082
|
* 「待处理 N」就在这一格(`waiting`):门开着是**事实面**上最要紧的一句,
|
|
1653
2083
|
* 而它可点——点一下开世界树,那里才看得到要裁什么。
|
|
1654
2084
|
*/
|
|
1655
|
-
|
|
2085
|
+
/**
|
|
2086
|
+
* 符号说**探索到了哪**:调研时是「板块 已厘清/总数」,求解时是「问题 当前/总数 · 待检验假设 N 个」;
|
|
2087
|
+
* 没列问题也没列板块的目标(旧会话、单问题)退回步数 `N/M`。
|
|
2088
|
+
*/
|
|
2089
|
+
const exploration = data?.exploration ?? null
|
|
2090
|
+
const areas = Array.isArray(exploration?.areas) ? exploration.areas : []
|
|
2091
|
+
const declared = (Array.isArray(exploration?.questions) ? exploration.questions : []).filter((question) => !question.implicit)
|
|
2092
|
+
const current = (Array.isArray(exploration?.questions) ? exploration.questions : []).find((question) => question.id === exploration?.current) ?? null
|
|
2093
|
+
const emergent = declared.filter((question) => question.status === 'emergent').length
|
|
2094
|
+
const examining = current === null ? 0 : (current.counts?.examining ?? 0)
|
|
2095
|
+
const symbol =
|
|
2096
|
+
areas.length > 0
|
|
2097
|
+
? `${t('板块 ')}${areas.filter((area) => area.state === 'clear').length}/${areas.length}${emergent > 0 ? `${t(' · ')}${emergent}${t(' 个问题待您决定')}` : ''}`
|
|
2098
|
+
: declared.length > 0 && current !== null
|
|
2099
|
+
? `${t('问题 ')}${declared.indexOf(current) + 1}/${declared.length}${t(' · 待检验假设 ')}${examining}${t(' 个')}`
|
|
2100
|
+
: `${done}/${total}`
|
|
1656
2101
|
const brief = typeof plan.brief === 'string' && plan.brief.trim() !== '' ? plan.brief.trim() : null
|
|
1657
|
-
const meaning = blocked ? t('
|
|
2102
|
+
const meaning = blocked ? t('计划受阻,待人工处理') : plan.status === 'closed' ? `${t('计划已收尾(')}${done}/${total}${t(' 步)')}` : `${t('计划已交付 ')}${done}/${total}${t(' 步')}`
|
|
1658
2103
|
/**
|
|
1659
2104
|
* 等人时**只说一句**:先「待处理 N」(人门计数),没有门才说续跑停着的原因。
|
|
1660
2105
|
* 两者是同一根轴(为什么在等人)⇒ 一格只放一个,不并列。
|
|
@@ -1667,11 +2112,11 @@ window.__ModuleLoader__.load({
|
|
|
1667
2112
|
type: 'button',
|
|
1668
2113
|
className: 'clearai-toolctl',
|
|
1669
2114
|
disabled: props.locked === true,
|
|
1670
|
-
title: `${meaning}${waiting === null ? '' : ` · ${waiting}`} · ${plan.id}${brief === null ? '' : ` · ${brief}`}${t('(
|
|
1671
|
-
'aria-label': `${meaning}${waiting === null ? '' : ` · ${waiting}`}${t('(
|
|
2115
|
+
title: `${meaning}${waiting === null ? '' : ` · ${waiting}`} · ${plan.id}${brief === null ? '' : ` · ${brief}`}${t('(点击打开探索货架)')}`,
|
|
2116
|
+
'aria-label': `${meaning}${waiting === null ? '' : ` · ${waiting}`}${t('(点击打开探索货架)')}`,
|
|
1672
2117
|
// 「要人注意」用与世界树同一族的琥珀(同一套主题令牌,不新造颜色)。
|
|
1673
2118
|
style: attentionNow ? { color: 'rgb(var(--dsw-color-warning, 245 158 11))', fontWeight: 600 } : undefined,
|
|
1674
|
-
onClick: () => props.
|
|
2119
|
+
onClick: () => props.openExplore?.(),
|
|
1675
2120
|
},
|
|
1676
2121
|
h(PlanGlyph, null),
|
|
1677
2122
|
h('span', { style: { minWidth: 14, textAlign: 'center' } }, symbol),
|
|
@@ -1859,12 +2304,12 @@ window.__ModuleLoader__.load({
|
|
|
1859
2304
|
h('span', { className: 'clearai-card-kind' }, KIND_WORD[selection.kind] ?? t('关系')),
|
|
1860
2305
|
h('span', { className: 'clearai-card-title' }, title),
|
|
1861
2306
|
h('span', { style: { flex: '1 1 auto' } }),
|
|
1862
|
-
h('span', { className: 'clearai-link', onClick: onFilter }, t('
|
|
2307
|
+
h('span', { className: 'clearai-link', onClick: onFilter }, t('仅显示相关项')),
|
|
1863
2308
|
h('span', { className: 'clearai-link', onClick: onClose }, t('关闭')),
|
|
1864
2309
|
),
|
|
1865
|
-
busy === true ? h('div', { className: 'clearai-quiet' }, t('
|
|
1866
|
-
failure !== null ? h('div', { className: 'clearai-quiet' }, `${t('
|
|
1867
|
-
busy === false && failure === null && data === null ? h('div', { className: 'clearai-quiet' }, t('
|
|
2310
|
+
busy === true ? h('div', { className: 'clearai-quiet' }, t('正在加载…')) : null,
|
|
2311
|
+
failure !== null ? h('div', { className: 'clearai-quiet' }, `${t('无法获取')}${t(':')}${failure}`) : null,
|
|
2312
|
+
busy === false && failure === null && data === null ? h('div', { className: 'clearai-quiet' }, t('该项已不在当前词表中(可能已被废止)。')) : null,
|
|
1868
2313
|
data === null
|
|
1869
2314
|
? null
|
|
1870
2315
|
: h(
|
|
@@ -1873,20 +2318,20 @@ window.__ModuleLoader__.load({
|
|
|
1873
2318
|
...kv(t('释义'), definition.gloss),
|
|
1874
2319
|
...kv(t('上位'), definition.parentLabel ?? definition.parent),
|
|
1875
2320
|
...kv(t('下位'), (relations.children ?? []).map((item) => item.label).join('、')),
|
|
1876
|
-
...kv(t('
|
|
2321
|
+
...kv(t('主体'), definition.domainLabel ?? definition.domain),
|
|
1877
2322
|
...kv(t('类型'), definition.typeLabel ?? definition.type),
|
|
1878
2323
|
...kv(t('取值'), value),
|
|
1879
2324
|
...kv(t('依据'), definition.basis),
|
|
1880
2325
|
...kv(t('关系'), (relations.edges ?? []).slice(0, 6).map((edge) => named(edge.chip)).join('、')),
|
|
1881
2326
|
...kv(t('实例'), (relations.instances ?? []).slice(0, 6).map((item) => item.label).join('、')),
|
|
1882
|
-
definition.status === 'deprecated' ? h('span', { key: 'dep', style: { gridColumn: '1 / -1' }, className: 'clearai-quiet' }, t('
|
|
2327
|
+
definition.status === 'deprecated' ? h('span', { key: 'dep', style: { gridColumn: '1 / -1' }, className: 'clearai-quiet' }, t('该术语已废止,既有结论中的用法仍可查看。')) : null,
|
|
1883
2328
|
),
|
|
1884
2329
|
facts.length === 0
|
|
1885
2330
|
? null
|
|
1886
2331
|
: h(
|
|
1887
2332
|
'div',
|
|
1888
2333
|
{ className: 'clearai-card-facts' },
|
|
1889
|
-
h('div', { className: 'clearai-group-head' }, t('
|
|
2334
|
+
h('div', { className: 'clearai-group-head' }, t('引用此项的结论'), h('span', null, `${facts.length}${data.factsTruncated > 0 ? '+' : ''}`)),
|
|
1890
2335
|
...facts.slice(0, 4).map((fact, index) =>
|
|
1891
2336
|
h(
|
|
1892
2337
|
'div',
|
|
@@ -2145,8 +2590,8 @@ window.__ModuleLoader__.load({
|
|
|
2145
2590
|
const sideBySide = fullscreen === true
|
|
2146
2591
|
const empty =
|
|
2147
2592
|
layer === 'entity'
|
|
2148
|
-
? `${typeof unlanded === 'number' && unlanded > 0 ? `${t('
|
|
2149
|
-
: t('
|
|
2593
|
+
? `${typeof unlanded === 'number' && unlanded > 0 ? `${t('共 ')}${unlanded}${t(' 条断言的主体尚未建立实体文件。')}` : t('实体图暂无内容。')}${t('clear/ontology/entities/ 下的实体文件与写入长期知识的断言将在此显示。')}`
|
|
2594
|
+
: t('本体图暂无内容。模型在 clear/ontology/concepts/ 与 relations/ 下建立概念与关系文件后,将在此显示。')
|
|
2150
2595
|
return h(
|
|
2151
2596
|
'div',
|
|
2152
2597
|
{ className: 'clearai-graph', 'data-full': fullscreen === true ? '1' : '0' },
|
|
@@ -2174,7 +2619,7 @@ window.__ModuleLoader__.load({
|
|
|
2174
2619
|
'div',
|
|
2175
2620
|
{ className: 'clearai-graph-body', 'data-side': sideBySide ? '1' : '0' },
|
|
2176
2621
|
XYFlow === null || XYFlow.ReactFlow === undefined || XYFlow.ReactFlow === null
|
|
2177
|
-
? h('div', { className: 'clearai-graph-empty' }, `${t('图组件不可用')}(${String(XYFLOW_LOAD.reason ?? '')}):${t('
|
|
2622
|
+
? h('div', { className: 'clearai-graph-empty' }, `${t('图组件不可用')}(${String(XYFLOW_LOAD.reason ?? '')}):${t('结论仍可正常查看。')}`)
|
|
2178
2623
|
: allNodes.length === 0
|
|
2179
2624
|
? h('div', { className: 'clearai-graph-empty' }, empty)
|
|
2180
2625
|
: h(
|
|
@@ -2222,7 +2667,7 @@ window.__ModuleLoader__.load({
|
|
|
2222
2667
|
: h(
|
|
2223
2668
|
'details',
|
|
2224
2669
|
{ className: 'clearai-graph-problems' },
|
|
2225
|
-
h('summary', null, `${t('本体文件有 ')}${problems.length}${t('
|
|
2670
|
+
h('summary', null, `${t('本体文件有 ')}${problems.length}${t(' 项问题(不纳入图中)')}`),
|
|
2226
2671
|
...problems.slice(0, 12).map((item, index) =>
|
|
2227
2672
|
h('div', { key: `${item.path ?? ''}#${index}`, 'data-sev': item.severity === 'error' ? 'error' : item.severity === 'info' ? 'info' : 'warning' }, h('code', null, String(item.path ?? '')), ` ${String(item.detail ?? item.code ?? '')}`),
|
|
2228
2673
|
),
|
|
@@ -2232,7 +2677,7 @@ window.__ModuleLoader__.load({
|
|
|
2232
2677
|
}
|
|
2233
2678
|
|
|
2234
2679
|
const LocalizedFacts = withLocale(Atlas)
|
|
2235
|
-
const
|
|
2680
|
+
const LocalizedExplore = withLocale(ExploreView)
|
|
2236
2681
|
|
|
2237
2682
|
/** 会话预设的 id:面板只在这个模式的会话里出现。 */
|
|
2238
2683
|
const PRESET_ID = 'clearai'
|
|
@@ -2240,7 +2685,7 @@ window.__ModuleLoader__.load({
|
|
|
2240
2685
|
function apply(ctx) {
|
|
2241
2686
|
// 这四个服务都声明在 `inject` 里,所以这里直接用属性读(Cordis 保证就位);
|
|
2242
2687
|
// 用 `ctx.get()` 也读得到,但属性形式同时受 inject 的「服务重载后重新激活」保护。
|
|
2243
|
-
const { slots, sessions,
|
|
2688
|
+
const { slots, sessions, sidebarRight } = ctx
|
|
2244
2689
|
/**
|
|
2245
2690
|
* 语言:接 DSH 原生的 locale 座位(可选 —— 老宿主或测试桩里没有它,面板退化成中文)。
|
|
2246
2691
|
* 词典以**源文**为键注册进那个座位,于是 `t('已提出')` 走的是宿主那条查找链:
|
|
@@ -2343,113 +2788,43 @@ window.__ModuleLoader__.load({
|
|
|
2343
2788
|
}
|
|
2344
2789
|
|
|
2345
2790
|
/**
|
|
2346
|
-
*
|
|
2347
|
-
*
|
|
2348
|
-
* 为什么在右栏而不是中栏:`conversation.view` 是「一次看一个」的视图——看树时看不到对话;
|
|
2349
|
-
* 而右栏能与对话并排,还能拖出成浮窗、能全屏(树的车道是横向铺开的)。
|
|
2350
|
-
*
|
|
2351
|
-
* 注册契约(照抄 `dsh-client-ui-sidebar-files` 的写法):
|
|
2352
|
-
* · `sidebarRightTabs.register({id, kind, title, guide})` 注册**页签类型**;
|
|
2353
|
-
* · 体与标题各自注册在 `sidebar.right.pane.tab` / `sidebar.right.pane.tab.title`(keyed,钥匙是类型 id);
|
|
2354
|
-
* · `sidebarRight.openTab(kind)` 程序化打开(跨面跳转靠它)。
|
|
2355
|
-
*/
|
|
2356
|
-
/**
|
|
2357
|
-
* 图标挑法(原生那 75 个里选,语义要对得上):
|
|
2358
|
-
* · 世界树 = `IconBranchOutline16`(计划拓扑与分叉,原生就用它画分支)
|
|
2359
|
-
* · 技能 · 记忆 = `IconSkillOutline16`(原生专门有一枚技能图标)
|
|
2360
|
-
* 拿不到就留空 ⇒ 原生默认字形。
|
|
2361
|
-
*/
|
|
2362
|
-
/**
|
|
2363
|
-
* 右栏只剩两格:**世界树**(计划的一切:脊柱、车道、闸门、要你拍板的那一下)
|
|
2364
|
-
* 与 **技能 · 记忆**(外脑)。
|
|
2791
|
+
* **右栏不再注册页签**:世界树(计划的步骤与闸门)并入探索货架的「过程记录」。
|
|
2792
|
+
* 过程与结果各占中栏一格(探索 / 本体),人不必在右栏与中栏之间来回找。
|
|
2365
2793
|
*
|
|
2366
|
-
*
|
|
2367
|
-
*
|
|
2368
|
-
* 而"当下什么状态"由工具行那颗**计划芯片**回答(它一直在,不用切页签)。
|
|
2369
|
-
* 页签越少,越不需要向人解释每个页签该在什么时候看。
|
|
2370
|
-
*/
|
|
2371
|
-
/**
|
|
2372
|
-
* 标签与说明必须是**函数**:页签类型只在预设生效时注册一次,而语言座位是**随后**才切到
|
|
2373
|
-
* 用户偏好的——写成 `label: t('世界树')` 就把注册那一刻的语言固化了(界面中文、
|
|
2374
|
-
* 右栏页签却是 Worldlines)。惰性取值让原生每次渲染现问一次,切换语言立刻跟上。
|
|
2794
|
+
* 切中栏视图走原生正门 `layout.selectPanel`;座位自己的 props 里有 `openView` 时优先用它。
|
|
2795
|
+
* `selectPanel` 对未注册的 key 会抛 ⇒ 包起来,点不动也不把面板带下水。
|
|
2375
2796
|
*/
|
|
2376
|
-
const
|
|
2377
|
-
|
|
2378
|
-
]
|
|
2379
|
-
const shown = new Set()
|
|
2380
|
-
const syncRail = () => {
|
|
2381
|
-
const wanted = isCurrentPreset()
|
|
2382
|
-
if (!wanted) {
|
|
2383
|
-
for (const id of [...shown]) {
|
|
2384
|
-
const entry = railDisposers.get(id)
|
|
2385
|
-
if (entry !== undefined) entry()
|
|
2386
|
-
railDisposers.delete(id)
|
|
2387
|
-
shown.delete(id)
|
|
2388
|
-
}
|
|
2389
|
-
return
|
|
2390
|
-
}
|
|
2391
|
-
for (const tab of rightRail) {
|
|
2392
|
-
if (shown.has(tab.id)) continue
|
|
2393
|
-
shown.add(tab.id)
|
|
2394
|
-
const own = []
|
|
2797
|
+
const openPanel = (props, id) => {
|
|
2798
|
+
if (typeof props?.openView === 'function') {
|
|
2395
2799
|
try {
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
guide: [{ order: tab.order, title: tab.label, description: tab.description, icon: tab.icon }],
|
|
2401
|
-
}), `clearai: rail type ${tab.id}`))
|
|
2402
|
-
} catch (error) {
|
|
2403
|
-
// 类型已注册(同名同 layer)不是致命:如实记一笔,继续。
|
|
2404
|
-
console.warn?.(`${t('clearai 面板:右栏页签类型注册失败 ')}${String(error?.message ?? error)}`)
|
|
2800
|
+
props.openView(id)
|
|
2801
|
+
return true
|
|
2802
|
+
} catch {
|
|
2803
|
+
/* 退到 layout 那一路 */
|
|
2405
2804
|
}
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
* 反向跳:记住要展开哪条命题,再用**原生正门**切中栏视图。
|
|
2415
|
-
* `layout` 走可选读法(契约里就给了 `ctx.get('layout')` 这一路);
|
|
2416
|
-
* `selectPanel` 对未注册的 key 会抛 ⇒ 包起来,别把整棵树带下水。
|
|
2417
|
-
*/
|
|
2418
|
-
openFacts: (stepId) => {
|
|
2419
|
-
factsFocus.set({ step: stepId })
|
|
2420
|
-
const layout = ctx.get('layout')
|
|
2421
|
-
if (layout === undefined || typeof layout.selectPanel !== 'function') return false
|
|
2422
|
-
try {
|
|
2423
|
-
layout.selectPanel('clearai-facts')
|
|
2424
|
-
return true
|
|
2425
|
-
} catch {
|
|
2426
|
-
return false
|
|
2427
|
-
}
|
|
2428
|
-
},
|
|
2429
|
-
}))
|
|
2430
|
-
own.push(ctx.effect(() => slots.inject('sidebar.right.pane.tab', () => slots.register({ name: 'sidebar.right.pane.tab', key: tab.id }, body)), `clearai: rail body ${tab.id}`))
|
|
2431
|
-
own.push(ctx.effect(() => slots.inject('sidebar.right.pane.tab.title', () => slots.register({ name: 'sidebar.right.pane.tab.title', key: tab.id }, () => tab.label)), `clearai: rail title ${tab.id}`))
|
|
2432
|
-
railDisposers.set(tab.id, () => {
|
|
2433
|
-
for (const dispose of own) {
|
|
2434
|
-
try {
|
|
2435
|
-
dispose()
|
|
2436
|
-
} catch {
|
|
2437
|
-
/* 已经放过的不重复处理 */
|
|
2438
|
-
}
|
|
2439
|
-
}
|
|
2440
|
-
})
|
|
2805
|
+
}
|
|
2806
|
+
const layout = ctx.get('layout')
|
|
2807
|
+
if (layout === undefined || typeof layout.selectPanel !== 'function') return false
|
|
2808
|
+
try {
|
|
2809
|
+
layout.selectPanel(id)
|
|
2810
|
+
return true
|
|
2811
|
+
} catch {
|
|
2812
|
+
return false
|
|
2441
2813
|
}
|
|
2442
2814
|
}
|
|
2443
|
-
const railDisposers = new Map()
|
|
2444
|
-
|
|
2445
2815
|
/**
|
|
2446
|
-
*
|
|
2447
|
-
*
|
|
2448
|
-
*
|
|
2816
|
+
* 「立为问题 / 暂缓」:替人往这个会话里发一句话(与人在输入框里打字同一条路)。
|
|
2817
|
+
* 对话服务按会话作用域取(`sessions.scope(id)` 上的 `conversation`);拿不到就返回 false,
|
|
2818
|
+
* 界面如实说「请在对话中说明」。这里不写任何账:状态由模型的 Frame 修订落下。
|
|
2449
2819
|
*/
|
|
2450
|
-
const
|
|
2820
|
+
const sendFor = (props) => (text) => {
|
|
2821
|
+
const id = sessionIdFor(props)
|
|
2822
|
+
if (typeof id !== 'string' || typeof sessions.scope !== 'function') return false
|
|
2451
2823
|
try {
|
|
2452
|
-
|
|
2824
|
+
const scoped = sessions.scope(id)
|
|
2825
|
+
const conversation = typeof scoped?.get === 'function' ? scoped.get('conversation') : scoped?.conversation
|
|
2826
|
+
if (conversation === undefined || conversation === null || typeof conversation.send !== 'function') return false
|
|
2827
|
+
Promise.resolve(conversation.send(text)).catch(() => {})
|
|
2453
2828
|
return true
|
|
2454
2829
|
} catch {
|
|
2455
2830
|
return false
|
|
@@ -2482,19 +2857,16 @@ window.__ModuleLoader__.load({
|
|
|
2482
2857
|
const openPreviewFor = (props) => (path) => openNativePreview(sidebarRight, sessionIdFor(props), path)
|
|
2483
2858
|
|
|
2484
2859
|
/**
|
|
2485
|
-
*
|
|
2486
|
-
*
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
* 注册时必须把**打开器**交下去:这一格的证据出处、事实原件、跳世界树
|
|
2490
|
-
* 全靠这两个回调。漏了它们,界面看着能点、点了什么也不会发生——
|
|
2491
|
-
* 漏了它,「点击证据没反应」。
|
|
2492
|
-
*/
|
|
2493
|
-
/**
|
|
2494
|
-
* 注册时必须把**打开器**都交下去:证据的四类出处、事实原件、跳世界树全靠它们。
|
|
2860
|
+
* 中栏两格:**探索**(过程:问题、候选假设、下一步、过程记录)与**本体**(结果:结论、本体图、
|
|
2861
|
+
* 已确立的事实、经验)。本体货架与模型读的 `clear/knowledge/facts/INDEX.md` 是**同一张表**。
|
|
2862
|
+
*
|
|
2863
|
+
* 注册时必须把**打开器**都交下去:证据的出处、事实原件、两格之间的跳转全靠它们。
|
|
2495
2864
|
* 漏了它们,界面看着能点、点了什么也不会发生。
|
|
2496
2865
|
*/
|
|
2497
|
-
occupy('conversation.view', () => ({ id: 'clearai-
|
|
2866
|
+
occupy('conversation.view', () => ({ id: 'clearai-explore', order: 19, label: t('探索') }), (props) =>
|
|
2867
|
+
h(LocalizedExplore, { ...props, openSpectator, openPreview: openPreviewFor(props), send: sendFor(props), openFacts: () => openPanel(props, 'clearai-facts') }),
|
|
2868
|
+
)
|
|
2869
|
+
occupy('conversation.view', () => ({ id: 'clearai-facts', order: 20, label: t('本体') }), (props) => h(LocalizedFacts, { ...props, openSpectator, openPreview: openPreviewFor(props), openExplore: () => openPanel(props, 'clearai-explore') }))
|
|
2498
2870
|
/**
|
|
2499
2871
|
* **计划面坐在原生 plan 那个座位上**。
|
|
2500
2872
|
*
|
|
@@ -2511,18 +2883,16 @@ window.__ModuleLoader__.load({
|
|
|
2511
2883
|
* · 遮蔽的代价是零——原生那个 occupant 在本模式下本来 `return null`。
|
|
2512
2884
|
* 而我们只在**当前会话是本预设**时占座(`occupy`),会话切走就还给它。
|
|
2513
2885
|
*/
|
|
2514
|
-
occupy('conversation.input.plan', { priority: -1 }, (props) => h(PlanChip, { ...props,
|
|
2886
|
+
occupy('conversation.input.plan', { priority: -1 }, (props) => h(PlanChip, { ...props, openExplore: () => openPanel(props, 'clearai-explore') }))
|
|
2515
2887
|
// 输入框下方的常驻派生条(运行态卡在人这一侧的对应物)
|
|
2516
2888
|
/**
|
|
2517
2889
|
* **输入框下那一条不再注册**:它说的话(阶段 / 完成度 / 当前步)与原生目标提示、
|
|
2518
2890
|
* 与工具行那颗计划 chip 重复 ✗,却**独占一行把输入框顶上去** ✗。
|
|
2519
|
-
* 唯一可点、且只有我们知道的那件事(「待处理 N」)已经并进计划 chip(
|
|
2891
|
+
* 唯一可点、且只有我们知道的那件事(「待处理 N」)已经并进计划 chip(同一行,一点直达探索货架)。
|
|
2520
2892
|
*/
|
|
2521
2893
|
ctx.effect(() => sessions.list.subscribe(() => {
|
|
2522
2894
|
for (const sync of seats) sync()
|
|
2523
|
-
syncRail()
|
|
2524
2895
|
}), t('clearai-loop: 席位跟着会话预设进出'))
|
|
2525
|
-
syncRail()
|
|
2526
2896
|
}
|
|
2527
2897
|
|
|
2528
2898
|
exports.apply = apply
|
|
@@ -2538,7 +2908,7 @@ window.__ModuleLoader__.load({
|
|
|
2538
2908
|
* 真的跑一遍渲染路径(捕 undefined 字段访问这类只有渲染时才炸的错)。
|
|
2539
2909
|
* 仍然不是给别的包用的接口。
|
|
2540
2910
|
*/
|
|
2541
|
-
exports.__components = { PlanChip, WorldTree, GraphBand, GraphInspector, NeedYou, TreeDetail, Atlas, AtlasHeader, ConclusionList, ConclusionRow, ConclusionDetail, StationBar, TrustTimeline, ClearAIMark, LOOP_LABEL }
|
|
2911
|
+
exports.__components = { PlanChip, WorldTree, ExploreView, AnswerCards, QuestionBox, NextBox, EmergentActions, GraphBand, GraphInspector, NeedYou, TreeDetail, Atlas, AtlasHeader, ConclusionList, ConclusionRow, ConclusionDetail, StationBar, TrustTimeline, ClearAIMark, LOOP_LABEL }
|
|
2542
2912
|
/**
|
|
2543
2913
|
* 测试缝之三:命题那一列的**派生**是纯函数(分组、处境、来路、证据链),
|
|
2544
2914
|
* 渲染本身没法在没浏览器的地方细究——把它导出去,让测试直接断言派生结果。
|