fix(web): add WebChannel read fallback + docs and tests + stable skil…#215
Closed
adeyemijosh wants to merge 2 commits intoPanniantong:mainfrom
Closed
fix(web): add WebChannel read fallback + docs and tests + stable skil…#215adeyemijosh wants to merge 2 commits intoPanniantong:mainfrom
adeyemijosh wants to merge 2 commits intoPanniantong:mainfrom
Conversation
Panniantong
requested changes
Mar 31, 2026
Owner
Panniantong
left a comment
There was a problem hiding this comment.
感谢贡献!fallback 机制和 encoding 修复的方向都对,但 read() 的实现与项目设计不符,需要修改:
必须修复:
-
read()应使用 Jina Reader,而非直接requests.get():check()的描述是「通过 Jina Reader 读取任意网页」,但新实现的read()完全绕开了 Jina,直接抓取原始 HTML。这会返回未处理的 HTML 给 agent,与项目定位不符。请改为:def read(self, url: str) -> str: if not url.startswith(('http://', 'https://')): url = 'https://' + url jina_url = f'https://r.jina.ai/{url}' resp = requests.get(jina_url, timeout=30) resp.raise_for_status() return resp.text
-
read()方法缺少测试:新增的功能没有对应的单元测试(应 mockrequests.get测试正常和异常路径)。 -
README.md 的修改位置不合适:在 README 顶部新增「开发快速启动」节会打断现有文档结构,且内容与 CONTRIBUTING.md 重复。建议这部分内容移入 CONTRIBUTING.md 或删除。
可保留的改动(很好):
_install_skill()的 try/except fallback 机制 ✅- 写文件时统一加
encoding="utf-8"✅ - CONTRIBUTING.md 补充 pytest 步骤 ✅
修复以上三条后请重新请求 review!
adeyemijosh
commented
Mar 31, 2026
Author
adeyemijosh
left a comment
There was a problem hiding this comment.
All three requested fixes are now complete:
- ✅ read() now uses Jina Reader API (https://r.jina.ai/)
- ✅ Added comprehensive unit tests with mocking (normal + abnormal paths)
- ✅ Removed duplicate README.md section
All 79 tests pass. Ready for review!
Panniantong
added a commit
that referenced
this pull request
Mar 31, 2026
- WebChannel.read(): reads any URL via Jina Reader (r.jina.ai), returns Markdown - _install_skill(): add fallback from importlib.resources to Path(__file__) for editable installs - Explicit UTF-8 encoding on all file read/write operations Inspired by PR #215, implemented correctly (Jina instead of raw requests). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 task
Panniantong
added a commit
that referenced
this pull request
Mar 31, 2026
- WebChannel.read(): reads any URL via Jina Reader (r.jina.ai), returns Markdown - _install_skill(): add fallback from importlib.resources to Path(__file__) for editable installs - Explicit UTF-8 encoding on all file read/write operations Inspired by PR #215, implemented correctly (Jina instead of raw requests). Co-authored-by: Claude Opus 4.6 (1M context) <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.
Changes
test_web_channel_can_handle_and_checkto verify URL handling and health check.pip install -e .+pytest -qsetup steps and ModuleNotFoundError fix hint._install_skill()fallback reading (importlib.resources → local file) with UTF-8 encoding.Validation
python -m pip install -e .python -m pytest -q --maxfail=1Type
fix/ enhancement to core WebChannel + docs + tests