mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-24 14:42:25 +00:00
界面文案整改:口语改书面、术语统一、不再露出实现细节;修掉几处说错的提示;新增文案检查防回潮
一、文案(前端约 1600 处,后端传到界面的约 880 处) - 术语统一:工作流层面用「运行」(继续运行、重新运行、试运行),节点和工具层面用「执行」,不再用「跑」; 总时长 / 执行时长 / 等待审批;服务端;助手;Agent;token;工作流;固定版本;模型接入;系统提示;批准 / 驳回;受管级别 - 口语改书面:取不到、没取回来、读不懂、连不上、多半、照样、兜底、揉成这类说法改成「无法 / 未能 / 失败 / 请」;去掉拟人写法 - 不再露出实现细节:界面上不写 checkpoint、同一拍、哈希(凭证处除外),不写改版历史(「以前…」「老数据」); 报错、校验、门禁、自动修复里裸写的配置键名和枚举值换成界面上的中文标签,由新的 backend/app/engine/labels.py 统一提供; 发布弹窗里结论句的选项不再是 off / require_citation - 同一件事只留一种说法:生成阶段文案、出具档位说明、画布锁定提示各合成一份 - 去掉界面上的工业场景示例(MES、ERP、「张工」「王工」)和真实产品名,换成通用示例 二、说错的提示(都有测试证明) - 数据库测连接失败时的专用提示以前从不出现(按报错文字全等比较,永远比不上):改为按错误类型判断,不再拼出重复的前缀 - 「设置 → 供应商」改指「设置 → 模型接入」;「在设置里建数据源」改指「数据」页 - 缺少 API Key、模型接入已停用的报错不再夹英文,写明去哪里填 - 两处原因说错(「这种引用在后续版本支持」「这一版还不支持」)改成真实原因 - 节点说明里不准确的说法改正:代码节点在 microVM 或系统沙箱中执行;报告撰写、口径卡的说明不再说过头 - 导出的证据 CSV 里两列同名,第三列改为「片段编号」 三、前后端对齐 - 前端按后端原文识别日志、报错的地方,新旧两种写法都认得(历史运行里存的是旧文字),逐条补了新旧原文的核对 - 后端交回模型的原指令放进单独的 for_model 字段,前端在解析响应时去掉,不会显示到界面上 四、检查 - 检查脚本里按原文匹配的断言改成新文案;改完会变成永远成立的反向断言逐条修正,并做了变异验证 - 新增 check-copy(静态扫描前端界面字符串和后端上界面的文案):再出现「跑」「后端」「多半」「令牌」、 界面上的 Copilot、裸写的配置键名、半角标点等就报错;确需保留的写进 scripts/copy-allow.json 并注明理由
This commit is contained in:
@@ -24,7 +24,7 @@ from app.engine.schema import GraphSpec, validate_graph
|
||||
|
||||
#: 「他说"好的"」:字符串里的英文引号没转义,json.loads 在「好」那里要逗号
|
||||
BAD = '{"summary": "他说"好的"然后走了", "count": 3}'
|
||||
TEMPLATE_HINT = "检查模板里的引号、逗号,字符串值要用 | json 过滤器输出"
|
||||
TEMPLATE_HINT = "请检查模板中的引号和逗号,字符串值需使用 | json 过滤器输出"
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
@@ -91,7 +91,7 @@ async def test_unescaped_quotes_in_model_text_blame_the_upstream(monkeypatch, te
|
||||
|
||||
assert error.startswith("上游「查询日志」输出的不是合法 JSON"), error
|
||||
assert "第 17 列附近" in error, error # 在上游那段文字里的位置,不是在整段模板里的
|
||||
assert "没转义的英文引号" in error and "output_schema + cite_fields" in error
|
||||
assert "未转义的英文引号" in error and "「按出处核对字段」" in error
|
||||
assert TEMPLATE_HINT not in error and "| json" not in error
|
||||
# 原文只进技术细节:首行不带模型写的内容
|
||||
assert "他说" not in error
|
||||
@@ -179,14 +179,14 @@ async def test_a_missing_comma_next_to_valid_model_json_keeps_the_template_hint(
|
||||
async def test_a_json_filtered_value_wrapped_in_quotes_says_to_drop_the_quotes(monkeypatch):
|
||||
script(monkeypatch, "好的")
|
||||
error = template_error(await failure(weekly('{"summary": "{{ nodes.query_logs.text | json }}"}')))
|
||||
assert "{{ nodes.query_logs.text | json }} 出来的已经是合法的 JSON(文字自带引号)" in error, error
|
||||
assert "{{ nodes.query_logs.text | json }} 的结果已是合法的 JSON(文字自带引号)" in error, error
|
||||
assert error.endswith("外面不要再加引号"), error
|
||||
|
||||
|
||||
async def test_an_empty_value_in_a_value_slot_names_the_span(monkeypatch):
|
||||
script(monkeypatch, "好的")
|
||||
error = template_error(await failure(weekly('{"summary": {{ input.missing }} , "n": 1}')))
|
||||
assert "{{ input.missing }} 取出来是空的" in error, error
|
||||
assert "{{ input.missing }} 的取值为空" in error, error
|
||||
|
||||
|
||||
async def test_plain_text_that_is_not_from_a_model_also_gets_the_json_filter_hint(monkeypatch):
|
||||
@@ -196,7 +196,7 @@ async def test_plain_text_that_is_not_from_a_model_also_gets_the_json_filter_hin
|
||||
|
||||
|
||||
@pytest.mark.parametrize("text, reason", [
|
||||
('{"week": "2026-W37", "rows": [1, 2', "没有收尾"),
|
||||
('{"week": "2026-W37", "rows": [1, 2', "不完整"),
|
||||
('```json\n{"gmv": 1}\n```', "代码块"),
|
||||
("好的,本周销售额是 5 万", "一段文字"),
|
||||
])
|
||||
@@ -205,7 +205,7 @@ async def test_model_text_parsed_as_a_whole_says_what_is_wrong_with_it(monkeypat
|
||||
script(monkeypatch, text)
|
||||
error = (await failure(weekly("{{ nodes.query_logs.text }}"))).data["error"]
|
||||
assert error.startswith("上游「查询日志」输出的不是合法 JSON"), error
|
||||
assert reason in error and "没转义的英文引号" not in error and "output_schema" in error, error
|
||||
assert reason in error and "未转义的英文引号" not in error and "「结构化输出 Schema」" in error, error
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
@@ -215,7 +215,7 @@ async def test_model_text_parsed_as_a_whole_says_what_is_wrong_with_it(monkeypat
|
||||
|
||||
def warnings_of(graph, node_id="parse"):
|
||||
return [i for i in validate_graph(GraphSpec.model_validate(graph)).issues
|
||||
if i.node_id == node_id and "cite_fields" in i.message]
|
||||
if i.node_id == node_id and "按出处核对字段" in i.message]
|
||||
|
||||
|
||||
CARD = node("card", "metrics", "口径卡", caliber="周报口径", metrics=[{"id": "gmv", "expression": "vars.q.gmv"}])
|
||||
@@ -236,7 +236,7 @@ def agent_graph(template, *, parse_mode="json", after=(CARD,), **agent):
|
||||
def test_validate_warns_when_a_transform_parses_agent_text_into_a_caliber():
|
||||
[issue] = warnings_of(agent_graph("{{ nodes.query_logs.text }}"))
|
||||
assert issue.level == "warning" and issue.field == "template"
|
||||
assert "「查询日志」" in issue.message and "output_schema" in issue.message
|
||||
assert "「查询日志」" in issue.message and "「结构化输出 Schema」" in issue.message
|
||||
# 按 JSON 解析的,不经过口径卡也要说
|
||||
assert warnings_of(agent_graph("{{ vars.answer }}", after=()))
|
||||
# 表达式模式读文字、流向口径卡
|
||||
@@ -266,6 +266,6 @@ def test_validate_points_quoted_model_text_at_the_json_filter():
|
||||
if i.node_id == "parse" and "| json" in i.message]
|
||||
assert issue.level == "warning" and issue.field == "template"
|
||||
assert "{{ nodes.query_logs.text | json }}" in issue.message and "外面不要再加引号" in issue.message
|
||||
assert "cite_fields" not in issue.message and "「查询日志」" in issue.message
|
||||
assert "按出处核对字段" not in issue.message and "「查询日志」" in issue.message
|
||||
# 值的位置、整段解析:仍然指向结构化输出
|
||||
assert warnings_of(agent_graph('{"summary": {{ nodes.query_logs.text }}}', after=()))
|
||||
|
||||
Reference in New Issue
Block a user