Fix market review catalyst snippets - #1241
Conversation
🤖 自动审查报告
📁 修改的文件
🧠 AI 代码审查意见结论Ready to Merge 结构化结果
必改项无。 建议项
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec7028e06a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| snippet = self._compact_news_text(self._get_news_field(n, "snippet"), limit=220) | ||
| source = self._compact_news_text(self._get_news_field(n, "source"), limit=60) | ||
| published_date = self._compact_news_text(self._get_news_field(n, "published_date"), limit=30) | ||
| url = self._get_news_field(n, "url") |
There was a problem hiding this comment.
Bound raw news URLs before prompting
When a search provider returns long tracking URLs or redirect URLs with large query strings, this now copies the raw URL into the LLM prompt for up to six news items. The title and snippet are capped, but the URL is not, so a few long result URLs can dominate or exceed the model context and increase cost or cause generation failures; please cap or omit the prompt URL while still preserving the rendered report metadata.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR fixes the market review “近三日催化线索” catalyst news block rendering so that snippets are clearly labeled as excerpts and the report/prompt preserves more source metadata (source, date, URL), addressing #1216.
Changes:
- Updated the rendered catalyst table headers (ZH/EN) and widened title/snippet limits to reduce misleading truncation.
- Added source/date/URL formatting in the rendered table and expanded the LLM prompt-side news context to include metadata.
- Added a regression test for the catalyst table rendering and updated
docs/CHANGELOG.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/market_analyzer.py |
Reworks catalyst table rendering and prompt news context; adds helpers for field extraction, compaction, and source cell formatting. |
tests/test_market_analyzer_generate_text.py |
Adds a regression test ensuring snippet column label and source/date/URL link rendering are correct. |
docs/CHANGELOG.md |
Records the user-visible fix to catalyst snippet/source/URL presentation. |
| label = " / ".join(label_parts) or "source" | ||
| if url: | ||
| return f"[{label}]({url})" |
ZhuLinsen
left a comment
There was a problem hiding this comment.
评审结论
- 必要性:通过。该 PR 针对 #1216 中大盘复盘催化线索表格语义不清、摘要被硬截断的问题做定向修复,范围合理。
- 是否有对应 issue:有,Fixes #1216。
- PR 类型:fix。修复报告渲染与 prompt 新闻上下文中的摘要/来源展示问题,并补充回归测试。
- description 完整性:完整。已包含 Summary、Root Cause、Validation、Risks、Rollback,符合本仓库对 fix 类 PR 的说明要求。
- 是否可直接合入:可。当前 CI 成功,
docs/CHANGELOG.md已按[Unreleased]扁平格式补充变更记录,未发现需要阻断合入的行为或兼容性问题;mergeable_state=blocked不单独构成阻断点。
🤖 此回复由 OpenReview Bot 自动生成,仅供参考。如有疑问请 @维护者。
* fix: preserve market review catalyst details
* fix: preserve market review catalyst details
* fix: preserve market review catalyst details
Summary
Fixes #1216.
近三日催化线索table explicitly label search content as摘要/线索片段.Root Cause
The rendered market-review news table used a generic
关注点column and hard-truncated search-result snippets, which could make partial search summaries look like complete event text and hide useful source context.Validation
python -m py_compile src/market_analyzer.pypython -m pytest tests/test_market_analyzer_generate_text.py::TestMarketAnalyzerBypassFix::test_news_block_labels_snippets_and_preserves_source_urlRisks
Rollback
Revert this PR to restore the previous compact catalyst table rendering.