39 Commits
Author SHA1 Message Date
青玉案andMach-Chan d0e66a1dc3 feat: 新闻检索为空时在报告中如实标注 (#2229)
* feat: 新闻检索为空时在报告中如实标注

消息面章节此前是「有内容才渲染」,检索一条没拿到时整段直接消失,
读报告的人无从判断是确实没新闻,还是检索静默失败了(搜索源限流、
未配置可用渠道等)。这把「抓取失败」呈现成了「确实没有新闻」。

- src/analyzer.py: AnalysisResult 新增 news_result_count,默认 None
- src/core/pipeline.py: 把 Step 4 已算好的计数交给结果对象
  (此前只进了 diagnostic context snapshot,报告层拿不到)
- src/notification.py: news_lines 为空且计数为 0 时,渲染明确提示,
  并说明结论未纳入新闻维度证据
- tests: 新增 5 条用例,含两条负例——计数为 None 时不得报警
  (那是未配置搜索渠道,不是失败)、拿到新闻时行为与改动前一致

不触碰任何检索路径,纯展示层增量。

* fix: 把新闻缺失提示放进真实渲染路径,并独立于模型输出判定

按 review 三条意见修正:

P1-1 提示只存在于 generate_daily_report,而正常流程从不调用它——
_send_single_stock_notification 与聚合报告走的是 dashboard / brief /
single_stock。原实现对所有标准 REPORT_TYPE 都不生效。
改为抽出共享判定 _empty_news_disclosure,四个渲染器统一接入。

P2 检索零命中但模型按 schema 写出了 market_sentiment / hot_topics 时,
原 elif 分支被跳过,报告会展示模型生成的情绪判断却隐瞒无新闻证据。
改为独立判定 news_result_count == 0,与模型是否产出文字无关。

P1-2 补 docs/CHANGELOG.md [Unreleased] 条目,并在
docs/data-source-stability.md 的「用户可见提示建议」一节记录该行为,
含 None / 0 / >0 三态语义表。

测试从 5 条增至 10 条,新增覆盖 dashboard、brief、single_stock 三个真实
渲染器,以及「模型有输出但检索为空」这一最糟组合。39 passed

* fix: 把新闻零命中披露覆盖到模板链路与企业微信入口

按 review 指出的 blocker 修正。此前只接了字符串拼接分支,遗漏两类活路径:

1. REPORT_RENDERER_ENABLED=true 时,generate_dashboard_report /
   generate_brief_report / generate_wechat_dashboard 会先 return render(...),
   模板链路一路不渲染披露;
2. generate_wechat_dashboard 的非模板 fallback 从未接入,而 pipeline 在
   企业微信非 brief 场景会直接调用它。

后果是同一份分析结果在部分渠道披露、在另一些渠道沉默。

改法不再逐点打补丁,而是抽出单一事实来源:

- 新增 src/services/empty_news.py 持有判定与中英文案
- src/notification.py 的 _empty_news_disclosure 改为委托该模块
- src/services/report_renderer.py 为每条结果预计算 empty_news_disclosure,
  三个平台模板共用
- templates/report_markdown.j2 / report_brief.j2 / report_wechat.j2 各加渲染分支
- generate_wechat_dashboard 的 fallback 正文接入披露

新增 6 条回归测试:模板链路三个平台各一条、企业微信入口一条,
外加两条负例(未执行检索时模板与企业微信均不得提示)。

本文件测试 10 → 16 全过;全量 5824 passed,9 个既有失败与本 PR 无关
(干净 main 上同样失败,属测试顺序依赖)。

* fix: 修正计数源头的两处缺口(自查发现)

按 review 的 merge-base..HEAD 方法自查全链路,发现此前几轮都只盯着渲染出口,
从未核对计数源头,而源头本身在两条路径上是错的:

1. src/core/pipeline.py: news_result_count 只在 intel_results 非空时赋值,
   搜索服务整体失败(正是所有搜索源限流全挂的场景)时停留在 None,
   语义为「未执行检索」,于是本 PR 想解决的头号场景反而不提示。
   改为检索一发起即置 0。

2. _analyze_with_agent: Agent 模式自行调用 search_stock_news 完成检索,
   却从不回写计数,该路径下零命中永远静默。改为按检索结果回写 0 或实际条数。

渲染层再周全,源头数据不对则全部落空。

新增 2 条测试锁住这两处语义(18 passed,此前 16)。
全量 5826 passed,9 个既有失败与本 PR 无关。

* fix: disclose missing news search configuration

* chore: remove unrelated agent guidance

* test: run all empty news tests directly

* fix: preserve empty news disclosure across reports

* fix: 让 Agent 模式的新闻披露跟随实际消费的证据

原问题:agent_arch=multi 等受支持的 Agent 配置下,报告可能声称「未纳入新闻
面证据」而分析其实用了新闻,或反过来该提示而不提示。

根因:news_result_count 取自 executor.run() 结束后为持久化情报补打的一次
search_stock_news()。真实情报由 IntelAgent 通过 search_comprehensive_intel
取得,两者不等价,因此披露与真实证据链可能相反。

修复点:新增 src/agent/news_evidence.py,以运行期证据作用域收集 Agent 搜索
工具的真实返回条数;搜索渠道不可用为 None(未执行检索),可用则从 0 起步、
拿到多少算多少。pipeline 在 executor.run() 前后开启并读取该作用域,事后的
持久化补查不再回写计数。

回归风险:工具在 ThreadPoolExecutor 中执行,runner.py 以
contextvars.copy_context() 提交,故作用域中必须是可变累加器对象,换成不可变
值会让父线程读不到;已加回归测试锁住该机制。原 test_agent_path_records_count
断言的正是被修复的错误行为,已替换为反向断言。

Refs #2225

* fix: 让新闻披露以实际证据为准而非搜索命中数

原问题:本地已落库的资讯池或社交情绪进入 news_context 参与分析后,报告仍可能
声称「未配置搜索渠道,本次分析未纳入新闻面证据」或「零命中」。

根因:news_context 由三路来源拼成——实时检索、社交情绪(美股)、本地资讯池,
但只有实时检索会更新 news_result_count。披露断言的是「结论有没有用到新闻面
证据」,而计数只是「搜索命中了几条」,两者是不同命题,后两路参与时必然失真。

修复点:AnalysisResult 新增 news_evidence_present,由 news_context 是否非空
得出,pipeline 两条路径共用 src/services/empty_news.news_evidence_present()
这一个判定函数。披露改为先看有无证据;确无证据时才用计数解释原因
(None=未配置渠道,0=检索零命中)。历史重建同步恢复该字段。

回归风险:旧记录没有该字段,按计数回退推断,与该记录当时的报告表现一致,不会
追溯改变旧报告;已有用例锁住。review 只点名了本地资讯池,社交情绪属同一缺陷类,
本次一并修复并加测试。另加源码断言:任一 pipeline 路径改回只传计数即失败。

Refs #2225

* fix: 按来源登记新闻证据,不让零命中占位文本冒充证据

原问题:普通分析链路在「搜索已执行但一条证据都没拿到」时,报告不再显示零命中
披露——正是本 PR 要修的核心场景,反而比改动前更差。

根因:src/search_service.py 的 format_intel_report() 即使所有维度失败或为空,
也会输出「【XX 情报搜索结果】」标题和每个维度的「未找到相关信息」占位文本,
整段永远非空。上一版把拼好的 news_context 整段交给 news_evidence_present()
判定,于是 news_result_count == 0 时 evidence 被翻成 true,披露被吞掉,错误
状态还会经 to_dict() 持久化,继续影响历史、详情 API 与 Web。

修复点:判定改为按来源逐个登记——实时检索的真实命中数、社交情绪内容、本地
资讯池内容,任一为真才算有证据;两条 pipeline 路径都不再传拼好的整段。
news_evidence_present() 的契约随之改为接收各来源,并在文档串里写明为什么不能
传整段。

回归风险:新增反例用真实的 format_intel_report() 产出占位文本(不用 mock),
断言其不得被判成证据、且报告必须出现零命中披露。另有源码断言:谁把整段
news_context 交回判定函数即失败。上一版两条测试实际在保护该缺陷(一条名为
「任何非空 context 都算证据」,一条要求必须传入 news_context),已一并纠正。

Refs #2225

---------

Co-authored-by: Mach-Chan <zz-b240@zz-b240deMacBook-Air.local>
2026-08-22 21:27:04 +08:00
lyl2104626211andzhulinsen 68fc575f15 feat: 支持 Web/API 按市场触发大盘复盘 (#2074)
* feat: add request-scoped market review regions

* fix: keep server default runtime-resolved

* fix: trace market review regions through task lifecycle

---------

Co-authored-by: zhulinsen <42829555+ZhuLinsen@users.noreply.github.com>
2026-07-25 22:14:15 +08:00
zhulinsen 6da1360a0b feat: 重建市场结构上下文 (#1981)
* feat: rebuild market structure context

* fix(review-feedback-1981): apps/dsa-web/src/components/report/MarketStructureCard.tsx 新增用户可见界面,但

* fix(review-feedback-1981): apps/dsa-web/src/components/report/MarketStructureCard.tsx 新增用户可见界面,但

* fix(review-feedback-1981): Scope in-flight ranking keys to each fetcher manager

* fix(review-feedback-1981): 修正无证据情况下的个股层级判定,并按仓库规范补充可访问的 Web 页面截图、更新 PR 描述事实

* fix(review-feedback-1981): apps/dsa-web/src/components/report/MarketStructureCard.tsx 新增用户可见界面,但

* fix(review-feedback-1981): 按 AGENTS.md 为新增市场结构卡片补充可直接查看的截图,并同步 PR 描述中的 diff 与 CI 事实

* fix(review-feedback-1981): apps/dsa-web/src/components/report/MarketStructureCard.tsx 新增用户可见界面,但

* fix(review-feedback-1981): 按仓库规范补充可直接审查的市场结构卡片截图,并同步 PR 描述中的 diff 与 CI 事实

* fix(review-feedback-1981): apps/dsa-web/e2e/market-structure-card-visual.spec.ts:276 在

* fix(review-feedback-1981): apps/dsa-web/e2e/market-structure-card-visual.spec.ts 将本 PR

* fix(review-feedback-1981): 同步当前 Head 的 diff/CI 结论,并按仓库规范在 PR 描述或评论中附可访问的市场结构卡片截图

* fix(review-feedback-1981): apps/dsa-web/e2e/market-structure-card-visual.spec.ts:261 新增 async 空对象解构

* fix(review-feedback-1981): 按仓库规范在 PR 描述或评论中附市场结构卡片的可访问截图,并同步当前 diff 统计和 CI 结果

* fix(review-feedback-1981): 消除当前运行结果对历史持久化成功的依赖,补充对应回归测试,并补齐可访问的 UI 截图及更新失真的 PR 描述

* fix(review-feedback-1981): src/utils/data processing.py 提取榜单时丢弃了上游 boards / concept boards 的

* fix(review-feedback-1981): 修正 PR 描述并补齐可访问的视觉证据

* fix(review-feedback-1981): 关闭市场结构前置数据获取可能阻塞主分析的问题,并同步修正 PR 描述、范围清单和视觉证据

* fix(review-feedback-1981): 将 PR 描述、完整范围、当前 CI 证据、视觉证据及回滚表述同步到最新 Head

* fix(review-feedback-1981): PR 描述与最新 Head 不一致:完整 diff 包含 38 个文件及 src/services/analysis

* fix(review-feedback-1981): 按最新 Head 同步 PR 描述,并补充可访问的市场结构卡片截图证据

* fix(review-feedback-1981): 统一即时响应与历史响应的 details.raw result 契约并补最终 API 回归测试,同时更新 PR 描述和可访问的视觉证据

* fix(review-feedback-1981): 将 PR 描述、完整范围、CI 结果及可访问的 UI 截图同步到最新 Head,消除描述与实际改动的实质性不一致

* fix(review-feedback-1981): 同步 PR 描述与最新 Head,并补充可访问的 Web 页面截图

* fix(review-feedback-1981): 同步 PR 描述并按仓库规范附上可访问的 Web 页面截图

* fix(review-feedback-1981): 代码结论 :不可。已按 origin/main...76b5b596fdff 的完整 38 文件 diff 重新建立基线。上次 6 个

* fix(review-feedback-1981): 代码结论 :不可。最新修复已正确收窄无成分股、无龙头证据的原生榜单路径:该路径现在返回 edge/partial,不再直接输出
2026-07-12 11:30:59 +08:00
zhulinsen 282efa18e1 fix: preserve zero sentiment score alignment (#1900)
* fix: preserve zero sentiment score alignment

* fix(review-feedback-1900): 修正 docs/CHANGELOG.md 中与本 PR 无关的条目,避免把未包含在当前 diff 的功能/修复写入本 PR and
2026-07-04 09:23:18 +08:00
zhulinsen 83b8154d0a fix: 评分建议过度归为持有,需收敛 hold/watch/buy/sell… (#1885) (#1887)
* fix(issue-1885): [bug]-评分建议过度归为持有,需收敛-hold/watch/buy/sell

* fix(review-feedback-1887): 澄清/修正评分与 action 的契约一致性问题,并补齐高风险路径的验证说明

* fix(review-feedback-1887): 补一句排除说明,避免和 AGENTS 对外部依赖/运行时配置变更需说明兼容、迁移与回退路径的要求产生歧义

* fix(review-feedback-1887): CI 当前未通过:结构化事实显示 backend-gate:failure,PR 描述中的本地验证也写明 test:TIMEOUT
2026-07-03 20:24:13 +08:00
ZhuLinsen dbfd8c1fb8 chore: prepare v3.24.0 release 2026-06-28 21:08:26 +08:00
zhulinsen ef9371003c feat: harden JP/KR suffix market support (#1817)
* feat: harden JP/KR suffix market support

* fix: define yfinance index quote metadata

* fix(review-feedback-1817): Handle JP 4-digit bare-code lookup in analysis paths

* fix(review-feedback-1817): Route 4-digit JP bases through API normalization

* fix(review-feedback-1817): 补齐外部 API/provider/运行时配置风险说明或证明该检测为误报
2026-06-27 22:10:08 +08:00
mumu 0ab94a8c3e fix: support KR stock autocomplete suggestions (#1723)
* fix: support KR stock autocomplete suggestions

* fix(review-feedback-1723): 补充自动补全 JP/KR 建议渲染截图、前后对比或无法截图说明

* fix(review-feedback-1723): 补充 Web 自动补全 JP/KR 建议渲染的截图或无法截图说明

* fix(review-feedback-1723): docs/review-evidence-kr-autocomplete-ui.md 是针对本 PR

* fix(review-feedback-1723): 修正 PR 描述与当前 head 的实际改动、验证范围不一致问题

* fix(review-feedback-1723): 修正 PR 描述与当前 diff 的实质性不一致,避免合入记录误导后续维护者

* fix(review-feedback-1723): 收敛 PR 描述与实际 diff 的契约不一致,避免用户误以为裸 005930 已会解析为 005930.KS

* fix(review-feedback-1723): 把描述、验证证据和兼容性说明收敛到当前 6 个改动文件真实范围,或补齐描述中声称的后端/历史链路实现与测试

* fix(review-feedback-1723): 收敛 PR 描述与实际 diff,避免把未实现的 bare-code/历史展示能力作为本 PR 已交付内容合入

* fix(review-feedback-1723): 补上相应真实代码与测试后再审

* fix(review-feedback-1723): 补齐所声称的后端实现与测试后再评审

* fix(review-feedback-1723): PR description 与当前完整 diff 不一致:描述声称新增 bare JP/KR code

* fix(review-feedback-1723): PR 描述与当前完整 diff 不一致

* fix(review-feedback-1723): 补充 Refs 1718,方便后续追踪

* fix(review-feedback-1723): 收敛描述与验证证据

* fix: resolve JP KR bare stock codes

* fix: backfill JP KR daily analysis context

* fix(review-feedback-1723): preserve persisted phase timing

* fix: align JP KR history lookup keys

* fix(review-feedback-1723): preserve raw code for snapshot lookups

* fix(review-feedback-1723): 收敛
2026-06-20 10:39:40 +08:00
LouisHong efa41e0ada feat: [issue #1652] add live run-flow diagnostics (#1656)
* feat: add live run-flow updates and diagnostics

* feat: update task status filter to include 'cancel_requested'

* feat: enhance run-flow diagnostics and task management with cancel-requested status handling

* fix: stabilize run flow live updates

* fix: align live run-flow review contracts

* fix: sanitize live run-flow events
2026-06-12 20:58:58 +08:00
LouisHong 4f536026f8 fix: clarify runtime logging context (#1643)
* fix: clarify market review logging context

* docs: update changelog for logging context
2026-06-09 01:08:55 +08:00
Alfred ff6494b5d7 feat: 新增建议动作 taxonomy 字段边界 P0 (#1631)
* feat: add decision action taxonomy fields

* fix: tighten decision action fallback handling

* fix: align legacy decision action guard fallback

* fix: tighten legacy decision action word boundaries

* fix: align decision action compound parsing

* fix: clean decision action residue

* fix: align web action label contract

* fix: classify avoided sell actions as hold
2026-06-08 07:24:07 +08:00
mumu 8909168a64 fix: run manual market review on non-trading days (#1627) 2026-06-07 09:39:00 +08:00
mumu d704fe377d feat: add Web UI language switch (#1621)
* feat: add Web UI language switch

* fix(review-feedback-1621): 补充 zh/en 切换后的登录页、首页、设置页和侧边导航截图或可访问构建预览证据

* fix(review-feedback-1621): 补对应回归测试

* fix(review-feedback-1621): Pin the smoke test's initial language

* fix(review-feedback-1621): Web UI 改动缺少截图或等价可视证据

* fix(review-feedback-1621): 补一个 storage accessor 抛错时 fallback 到 zh 或 navigator 语言的回归测试

* fix(review-feedback-1621): 修复前端 lint/build 失败并补齐 Web 验证证据

* fix(review-feedback-1621): apps/dsa-web/ :本 PR 新增语言切换入口并改动

* fix(review-feedback-1621): 解决冲突

* fix(review-feedback-1621): 解决冲突,并补齐 Web UI 变更的可视证据与 Web 侧验证说明

* fix(review-feedback-1621): 解决冲突并重新确认 diff 与 CI 结果

* fix(review-feedback-1621): 解决冲突

* fix(review-feedback-1621): add a file-level test

* fix: complete Web UI language switch evidence

* fix(review-feedback-1621): 确认设置页英文字段 label 语义回归、Playwright smoke locale 稳定性,以及结构化检测命中的外部模型/API

* fix(review-feedback-1621): 修正 PR 描述与实际实现不一致,并补齐 Playwright smoke 验证结果或明确未执行原因

* fix: complete web language behavior

* fix(review-feedback-1621): src/services/task queue.py / src/services/analysis service.py /

* fix: honor market review request language

* fix(review-feedback-1621): Keep UI language from overriding report language and Use localized

* fix(review-feedback-1621): docs/full-guide.md / docs/full-guide EN.md 把 PR 评审证据、执行命令、沙箱

* fix(review-feedback-1621): 修正 PR 描述与当前实现不一致的问题,并补齐运行时模型配置相关的兼容性/迁移证据

* fix(review-feedback-1621): 收敛后再合入
2026-06-06 21:45:20 +08:00
mumu b612fb23e4 fix: 结构化大盘复盘报告展示 (#1576)
* feat: add dedicated market review report view

* fix(review-feedback-1576): Use localized labels for English market reviews

* fix: structure market review payload rendering

* fix(review-feedback-1576): preserve market labels when rendering combined reviews and Use the

* fix(review-feedback-1576): Render structured data for every combined market and Localize

* fix: dedupe market review rendering

* test: align market review language prompt expectation

* fix(review-feedback-1576): 澄清并补足 LLM/运行时配置相关检测命中的兼容性证据

* fix(review-feedback-1576): 解决冲突并重新确认 CI

* fix(review-feedback-1576): docs/CHANGELOG.md:[Unreleased] 新增内容中除 1555 大盘复盘展示外,还包含 Agent

* fix(review-feedback-1576): 修复

* fix(review-feedback-1576): 修复美股中文大盘复盘仍混入英文策略/市场标签的问题,并补齐对应回归测试
2026-06-04 13:40:42 +08:00
Alfred 9b76f8d240 feat: #1386 P6 联动告警、持仓和历史阶段摘要 (#1589)
* feat: link phase summaries across P6 surfaces

* fix: align portfolio analysis response status

* fix: stabilize backtest phase filtering

* fix: normalize portfolio analysis symbols
2026-06-04 09:17:39 +08:00
Alfred 7e54c6c3ba feat: add analysis phase API plumbing (#1573) 2026-06-03 19:51:07 +08:00
Alfred 3e98dfd9bc feat: add analysis context data quality scoring (#1539) 2026-05-31 23:10:30 +08:00
Alfred f42b395745 feat: add market phase summary metadata (#1532) 2026-05-31 09:24:58 +08:00
Alfred 0295f9d709 feat: expose analysis context pack overview (#1515)
Refs #1389
2026-05-30 09:20:11 +08:00
mumu 8a23124d01 feat: add #1391 Phase 2 run diagnostic summaries (#1444)
* fix(issue-1412): [bug]-stock_list格式问题

* fix(review-feedback-1413): preserve exchange hint for dotted A-share inputs

* fix(review-feedback-1413): Keep normalized A-share codes usable by market routing and preserve

* fix(review-feedback-1413): Limit raw dotted codes to fetchers that can parse them

* fix(review-feedback-1413): Keep Tushare daily input normalized for ETF detection

* fix(review-feedback-1413): 澄清结构化检测中的外部模型/API 与运行时配置迁移风险

* fix(review-feedback-1413): 处理或明确确认该失败与本 PR 无关且已有维护者豁免依据

* fix: keep stock list input as bare codes

* docs: add phase-0 run diagnostics contract

* fix(review-feedback-1435): 修正描述并澄清/补齐运行时代码变更的验证证据

* fix(review-feedback-1435): 补齐前缀提示识别,并增加对应回归测试

* fix(review-feedback-1435): 修正

* fix(review-feedback-1435): 解决冲突并更新描述/验证记录后再合入

* fix(review-feedback-1435): 解决冲突,并在最终 head 上重新确认 python -m pytest tests/test a share fetcher code

* fix(review-feedback-1435): 修复并补齐回归覆盖后再复核最终 head

* fix(review-feedback-1435): data provider/baostock fetcher.py 的 convert stock code 只从 .SH/.SS/.SZ

* fix: preserve A-share exchange hints

* fix(review-feedback-1435): 修正 docs/run-diagnostics-p0.md 对 Tushare 本轮范围的矛盾描述

* feat: add phase 1 run diagnostics trace plumbing

* feat: add phase 2 run diagnostic summaries

* fix(review-feedback-1441): 打通 trace id 与数据源运行快照,改动目标明确

* fix(review-feedback-1444): 修复 Agent 模式新报告通过历史诊断 API 返回 unknown 的正确性问题

* fix(review-feedback-1444): Propagate diagnostics lookup errors instead of masking them

* fix(review-feedback-1444): 补对应回归断言

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

* fix(review-feedback-1444): 解决冲突

* fix(review-feedback-1444): 解决冲突

* fix(review-feedback-1444): 解决

* fix(review-feedback-1444): 解决

* fix(review-feedback-1444): 解决冲突

* fix(review-feedback-1444): 解决

* fix(review-feedback-1444): 解决

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

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

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

* fix(review-feedback-1444): 解决冲突

* fix(review-feedback-1444): Derive news diagnostics from retrieval evidence

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

* fix(review-feedback-1444): 解决冲突并基于解决后的最终 diff 重新确认 docs/CHANGELOG.md、诊断链路和测试结果

* fix(review-feedback-1444): 解决冲突

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

* fix(review-feedback-1444): 解决冲突并重新跑阻断型 CI,尤其是 backend-gate 和相关诊断/API/history 回归

* fix(review-feedback-1444): preserve report timestamp when enriching task results

* fix: address run diagnostics review feedback

* fix: redact diagnostic copy text secrets

* fix(review-feedback-1444): 补一条多渠道部分失败的回归测试
2026-05-26 00:05:24 +08:00
zbl-96andZhuLinsen 639796f982 fix: restore board linkage for compatible history snapshots (#1416)
* fix: restore board linkage from compatible snapshots

* chore: drop local review artifact from pr

* fix: enrich in-memory status board details

* fix: merge partial fundamental snapshots

* fix: preserve fallback fields on empty snapshots

---------

Co-authored-by: ZhuLinsen <zhuls97@163.com>
2026-05-24 19:20:25 +08:00
mumu 1f58b63936 fix(issue-1382): [bug]-/api/v1/analysis/status/{task_id} (#1385) 2026-05-21 22:29:40 +08:00
mumu 0a987086d3 feat: Web 个股分析支持选择策略 (#1331)
* feat: support strategy selection in web analysis

* fix(review-feedback-1331): The worker receives the original skills list, while TaskInfo stores a

* fix(review-feedback-1331): 补充对应 Web/API 文档,或在 PR 中明确说明现有哪份文档已覆盖且本次无需更新的依据
2026-05-17 22:59:49 +08:00
mumu fb98a62938 fix: 大盘分析的历史执行记录丢失 (#1306) (#1307)
* fix(issue-1306): 大盘分析的历史执行记录丢失

* fix(review-feedback-1307): also special-case the history detail/client path to surface the saved

* fix(review-feedback-1307): 补齐大盘复盘历史记录的 Web/API 契约闭环与对应文档落点

* fix(review-feedback-1307): Disable stock rerun for market-review history rows

* fix(review-feedback-1307): Disable follow-up for market-review history rows

* fix(review-feedback-1307): 避免大盘复盘历史被整体回测当作普通股票分析记录处理

* fix(review-feedback-1307): 澄清结构化检测提示中的外部模型/API 与运行时配置迁移风险是否为误报,或补齐对应兼容性证据

* fix(review-feedback-1307): 修复普通个股历史不回归问题
2026-05-16 13:36:17 +08:00
mumu d0bb619f5c fix: normalize report strategy price fields (#1264) 2026-05-11 23:14:45 +08:00
mumu c325a14b8f Add web market review trigger (#1242)
* feat: add web market review trigger
2026-05-10 15:05:31 +08:00
mumu d6e4699627 fix: 北交所股票处理差异,异常 (#1234) (#1235)
* fix(issue-1234): [bug]-北交所股票处理差异,异常
2026-05-09 21:48:37 +08:00
@aaronjmarsandaeonframework c7f01cf6ad fix(security): block path traversal in SPA fallback route (#1160)
The serve_spa handler at /{full_path:path} joined static_dir / full_path
without containment checks before serving the result via FileResponse.
Starlette's :path converter does not normalize `..` segments and uvicorn
does not collapse them either, so an unauthenticated request such as
GET /%2e%2e/%2e%2e/%2e%2e/etc/passwd (or with literal `..`) caused
pathlib's .is_file() and FileResponse to resolve outside the bundle
root and return arbitrary files readable by the server process — env
files, secrets under data/, source code, SSH keys, etc.

The repo already has _resolve_asset_path for this exact concern on the
/assets/{asset_path:path} route (rejects null bytes, leading `/` or `\`,
backslashes, drive letters, and any candidate that is not
is_relative_to the base directory after .resolve()). The fix reuses
that helper for serve_spa, so requests that escape static_dir now fall
through to index.html instead of leaking files.

Added a regression test that creates a temp static_dir, drops a sibling
secret.txt, and asserts that ../secret.txt, ../../secret.txt, and
foo/../../secret.txt all return the SPA index instead of the secret.

Vulnerability: Path traversal / arbitrary file read
Severity: high (unauthenticated; SPA fallback is not behind the auth
middleware, which only guards /api/v1/*)
Location: api/app.py:299-315 (pre-fix line numbers)
Impact: any file readable by the server process can be exfiltrated by an
attacker who can reach the HTTP port.

Co-authored-by: aeonframework <aeonframework@proton.me>
2026-04-30 21:57:41 +08:00
mumu 04933583a9 fix: inject REPORT_LANGUAGE into workflow and add current_price to status API (#1013, #983) (#1028)
* fix: inject REPORT_LANGUAGE into workflow and add current_price to status API (#1013, #983)
* fix: preserve status API snapshot change pct fallbacks
* fix: keep status change pct scoped to intraday data
2026-04-10 20:36:28 +08:00
mumu e8862d5331 feat: 让普通股票分析链路在尽量不破坏现有接口契约的前提下支持 LiteLLM 流式输出… (#865) (#924) 2026-04-04 14:16:51 +08:00
mumu 5d23998a48 fix: 在 api/v1/endpoints/analysis.py 的 SSE 生成器 except… (#967) (#971)
* fix(issue-967): [bug]-sse-任务流断开时-cancellederror-被静默吞掉,缺少
2026-04-03 22:11:35 +08:00
LouisHong 65e28e1faa fix: accept HK autocomplete codes on home analysis input. [fix #813] (#828)
* fix: accept HK autocomplete codes on home analysis input

The home page stock input accepted plain A-share codes but rejected Hong Kong stocks selected from autocomplete. The root cause was that autocomplete submits the suggestion canonicalCode (for example 00700.HK), while the backend stock code utility only recognized .SH/.SZ/.SS suffixes. As a result, 00700.HK was treated as mixed alphanumeric noise and rejected with the generic validation error before analysis dispatch.

Extend shared stock code recognition and normalization to accept .HK suffixes alongside existing A-share suffixes. This keeps the existing manual input behavior for 00700 and makes the backend consistent with the canonicalCode format already used by the web stock index and autocomplete flow.

Add regression coverage on both sides of the boundary: backend contract tests now verify that trigger_analysis accepts 00700.HK from autocomplete and HK00700 from manual input, and frontend tests now verify that highlighted HK suggestions submit the canonical .HK code and are not rejected by local store validation.

* update CHANGELOG.md

* fix: align HK code validation with existing market rules

Follow up the home page HK autocomplete fix by tightening the shared stock code validator so exchange suffixes and prefixes no longer reuse the same generic 5-6 digit rule.

This change keeps SH/SZ/SS suffixes restricted to 6-digit mainland codes, treats HK suffixes and HK prefixes as 1-5 digit Hong Kong codes with zero-padding during normalization, and rejects invalid cross-market combinations such as 600519.HK, HK600519, and 00700.SH.

Add regression coverage for valid short HK forms like 1810.HK and HK700, plus negative tests for invalid suffix and prefix lengths, so the shared backend utility stays consistent with the existing web validation and data-provider normalization rules.
2026-03-25 09:29:12 +08:00
LouisHong 6a070eb479 #602 [PR 8] 问股与回测接入优化及 Web 交互回归修复 (#824)
* feat(web): consolidate dashboard, chat, and backtest UI improvements

- polish dashboard follow-up pages and shared UI states across home, chat, and backtest flows
- consolidate chat and backtest page layout, styling, and interaction improvements into a single web UI update
- improve follow-up context handling in chat and add broader regression coverage for dashboard and chat components
- refine text color and opacity usage across shared components for more consistent readability
- restore home page mobile scrolling after the broader UI refactor changed page overflow behavior
- update related tests and changelog entries to reflect the finalized web interaction and styling changes

* feat(ui): optimize light theme shadows, navigation, alerts, and chat bubble styles

- Soften light mode box-shadows globally, replacing hardcoded grays with dynamic CSS variables for a cleaner, non-muddy depth effect.
- Unify SidebarNav active item style: remove inset shadow, apply primary background, and use bold font for better visibility.
- Fix ApiErrorAlert and InlineAlert contrast in light mode: use deep red text for high legibility, and robust dark/light theme CSS variables.
- Fix ThemeToggle menu z-index (z-40) in Shell to prevent overlap by main content pages (e.g., Settings, Backtest).
- Refactor ChatPage avatars and message bubbles to use dedicated dual-theme CSS classes (.chat-avatar-*, .chat-bubble-*).
- Add distinct borders to User/AI chat avatars with lowered opacity in dark mode to prevent visual glare.
- Add subtle borders to AI message bubbles in light mode to enhance separation, preserving semi-transparent borders in dark mode.

* fix(web): restore picker flows and align chat/report interactions

- restore intelligent import file picker behavior and add regression coverage
- align report markdown E2E expectations with the current UI
- improve markdown plain-text extraction used by report export flows
- fix chat session history deletion accessibility by separating row selection and delete actions into independent native buttons
- add chat history regression tests for keyboard-accessible deletion behavior
- deduplicate shared action button variant styles without changing the public Button variant API
- keep user-facing web interactions consistent after recent UI updates

* fix(web): resolve dashboard build issue and speed resolver benchmarks

- remove duplicate notify fields from useHomeDashboardState to fix the dsa-web TypeScript build
- keep the theme toggle button disabled in the current UI state
- cache local name-to-code indexes and fast-return on ambiguous local stock names
- split resolver performance coverage into fast-path and typo-fallback benchmarks with warm-up steps and smaller iteration budgets

* update README.md
2026-03-24 20:03:05 +08:00
mumu 929521aefc fix: complete trading philosophy injection across analyzer paths (#810)
* fix: complete trading philosophy injection across analyzer paths

* fix: preserve legacy prompts for default bull trend

* fix: tighten legacy prompt fallback rules

* fix: scope legacy prompt fallback to builtin bull trend

* fix: align notify flow with async analysis contract

* fix: expose notify controls to home dashboard hook
2026-03-23 23:17:14 +08:00
Alfredandmumu e1dbee3318 feat: 在个股分析页展示个股所属板块及其与当日板块强弱的关系 (#669) (#800)
* feat: show related boards in stock reports (#669)

* fix: preserve unavailable related board states

---------

Co-authored-by: mumu <42829555+ZhuLinsen@users.noreply.github.com>
2026-03-22 20:52:40 +08:00
LouisHong 73d524a186 #730 [PR1] 首页股票分析输入框自动补全 AutoComplete (#775)
* feat(autocomplete): rebuild web autocomplete mvp

* feat(autocomplete): add error boundary and runtime fallback

Add error boundary and runtime error handling to improve autocomplete stability:

- Add StockAutocompleteBoundary class component to catch render errors
- Add FallbackInput component for graceful degradation
- Add runtimeFallback state and error handling in useAutocomplete hook
- Wrap search logic with try-catch to prevent crashes
- Add comprehensive tests for error scenarios

This ensures the autocomplete degrades to a plain input when:
- Index loading fails (existing behavior)
- Runtime search throws (new)
- Component tree throws during render (new)

* feat(autocomplete): add input validation and optimize name resolution

- Add early rejection for obviously invalid mixed alphanumeric input
- Skip expensive AkShare/fuzzy fallback for non-CJK free text
- Enhance frontend validation with isObviouslyInvalidStockQuery
- Increase minimum query length from 1 to 2 characters
- Add comprehensive test coverage for validation logic
- Update E2E test placeholder text to reflect new capabilities

These changes address code review feedback about:
- Preventing abuse from invalid input patterns
- Improving performance by avoiding unnecessary network calls
- Ensuring consistent validation between frontend and backend

* fix(autocomplete): harden input validation and runtime guards

* update doc

* style(autocomplete): adjust suggestion item hover effect

- Reduce hover background opacity from 35% to 25% for lighter visual effect
- Brighten hover color in dark theme from #257280 to #2dcae6

* fix(autocomplete): do not auto-highlight first suggestion to preserve raw input on Enter

* test(home): align report fixture with report language metadata

* fix: unify task queue stock dedupe key
2026-03-20 11:35:00 +08:00
mumu ef328e906b feat: add configurable report language (#764)
* feat: add configurable report language

* Fix review follow-ups for history and fallback localization

* fix: prefer .env report language at startup

* fix: address report language review feedback

* fix: address latest report language review feedback
2026-03-19 22:55:17 +08:00
Alfredandmumu 274720234a fix: add A-share financial/dividend context outputs (#710) (#731)
Co-authored-by: mumu <42829555+ZhuLinsen@users.noreply.github.com>
2026-03-17 21:38:31 +08:00
mumu d42952ef5e Improve analysis API async contracts and startup helpers (#656)
* Improve analysis API async contracts and startup helpers

* Fix rebased analysis API contract regressions

* fix: align frontend report type union with full responses
2026-03-15 20:54:04 +08:00