feat: feed intelligence sources into analysis contexts (#1709)

* feat: add intelligence source ingestion baseline

* feat: feed local intelligence into analysis contexts

* fix(review-feedback-1708): Reject DNS names that resolve privately and Validate redirect targets

* fix(review-feedback-1709): 处理大盘复盘本地资讯可能被搜索结果截断掉的问题,并澄清结构化检测到的外部模型/API 或运行时配置风险是否为真实变更

* fix(review-feedback-1708): Pin DNS resolution before fetching and Stream feeds before enforcing

* fix(review-feedback-1709): filter by published at for analysis evidence, or keep missing publish

* fix(review-feedback-1708): Sanitize fetch errors before returning them and Normalize nullable

* fix(review-feedback-1709): Normalize symbol scope before lookup

* fix(review-feedback-1708): Avoid rolling back prior item inserts on duplicate races and Reject

* fix(review-feedback-1709): Use the effective news window for local evidence and add the plain

* fix(review-feedback-1708): 落地可配置 RSS/Atom 情报源、存储、查询、retention 和基础安全边界

* fix(review-feedback-1709): 补充“revert 本 PR 或移除本地资讯接入入口/清退本地资讯源配置数据”级别说明即可

* fix(review-feedback-1708): 落地 RSS/Atom 情报源的存储、拉取、查询、retention 和基础安全边界

* fix(review-feedback-1709): 补 Refs 1707

* fix(review-feedback-1709): 解决冲突后再合入

* fix(review-feedback-1709): src/services/intelligence service.py 回退了资讯源 URL 安全防护:移除了 hostname DNS

* fix: harden intelligence source ingestion

* fix(review-feedback-1709): Sanitize upstream fetch errors before returning them

* feat: add NewsNow intelligence sources

* fix(review-feedback-1709): 确认并修复

* fix(review-feedback-1709): 补一个未命中敏感规则的异常回归测试

* fix(review-feedback-1709): 处理

* docs: enhance NEWSNOW_BASE_URL compatibility guidance with official links

- Add official NewsNow GitHub deployment guide link to .env.example
- Include curl-based API contract verification example for production validation
- Update CHANGELOG.md with official repository reference and deployment recommendation
- Clarify risk of public example instance and necessity for self-hosted in production
- All HTTP 500 responses already use sanitize_diagnostic_text for privacy

Ref #1707
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(review-feedback-1709): 补齐官方 NewsNow 实例链接文档或 API 契约确认,明确指出公开实例风险(需结合当前部署指南文档,更新 .env.example

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
mumu
2026-06-19 09:42:42 +08:00
committed by GitHub
parent 0ed601022f
commit 626b63c144
16 changed files with 1820 additions and 386 deletions

View File

@@ -356,7 +356,16 @@ SEARXNG_PUBLIC_INSTANCES_ENABLED=true
# NEWS_INTEL_FETCH_TIMEOUT_SEC=8
# 单次每个资讯源最多采集条数
# NEWS_INTEL_MAX_ITEMS_PER_SOURCE=50
# 注:本节仅控制资讯源采集与清理行为,不会改变 LLM / provider / base URL / 兼容回退语义。
# NewsNow HTTP API 基地址 —— 外部依赖配置
# - 官方项目及部署指南https://github.com/qqhann/newsnow
# - 当前默认值 https://newsnow.busiyi.world 是公开示例实例,存在以下风险:
# * 可能因官方维护或限流而不可用
# * 不保证稳定性或数据可靠性,仅用于演示和测试
# - 生产环境强烈建议改为自建 NewsNow 实例,确保可控和稳定性
# - 部署前建议验证 API 契约兼容性(参见 docs/intelligence-sources.md
# curl -sS "https://newsnow.busiyi.world/api/s?id=cls-hot" | python -c "import sys, json; data=json.load(sys.stdin); assert isinstance(data.get('items'), list)"
# - 本配置仅控制资讯源采集与清理行为,不会改变 LLM / provider / base URL / 兼容回退语义
# NEWSNOW_BASE_URL=https://newsnow.busiyi.world
# 乖离率阈值(%),偏离 MA5 超过此值提示不追高;强势趋势股自动放宽到 1.5 倍
# BIAS_THRESHOLD=5.0