Conversation
新增 markdown_renderer 工具模块,CLI 输出助手回复时检测 Markdown 结构化 语法(表格/fenced code block/标题/列表),命中则通过 rich.markdown 渲染, 纯文本保持原样打印。 检测为高精度启发式:宁可漏过(Markdown 按纯文本打印,无害),不可误判 (rich 渲染会破坏原文,如 __init__.py 被加粗),因此不检测行内标记。 - 新增 mini_agent/utils/markdown_renderer.py,新增 rich 依赖 - agent.py CLI 输出路径接入 display_assistant_text - ACP 路径保持原文发送,由客户端渲染 - 新增 tests/test_markdown_renderer.py 20 个用例 Closes MiniMax-AI#121 Co-Authored-By: Claude Code <noreply@anthropic.com>
uv.lock 记录每个包的来源 URL,index 配置不属于个人机器环境而应提交到 项目,否则不同成员 lock 会产生来回漂移的 URL diff。 - pyproject.toml 添加 [[tool.uv.index]] 指向 pypi.tuna.tsinghua.edu.cn - 重新 uv lock,全部来源 URL 切换至清华源 Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #121
改动内容
CLI 模式下助手回复原来通过
print()原样输出,Markdown 表格/代码块显示为原始标记。本次新增一个渲染层(仅 2 个提交,基于最新 main):mini_agent/utils/markdown_renderer.py(commit 1)has_markdown(text):高精度启发式检测,宁可漏过、不可误判——只识别结构性、无歧义构造(表格 / fenced code block / ATX 标题 / 列表),不检测行内标记(**加粗**、行内代码、__下划线__),因为它们极易误判(__init__.py被当加粗、2 ** 3吞运算符)。漏检只是按纯文本打印(无害),误检会破坏原文。display_assistant_text(text):命中则用rich.markdown.Markdown渲染,否则原样print()rich>=13.0.0依赖agent.pyCLI 输出路径接入display_assistant_text测试
tests/test_markdown_renderer.py,20 个用例全部通过:__init__.py、__init__/__call__、2 ** 3、孤立反引号、散文中的|、#1、缩进注释等不误判Pull Request 检查清单
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.