Commit Graph

151 Commits

Author SHA1 Message Date
zhulinsen
a3e1b9e3ba fix: normalize watchlist separators (#1912) 2026-07-04 11:57:43 +08:00
Alfred
7b39b73b9d feat: add generation backend status diagnostics (#1883) 2026-07-03 19:34:43 +08:00
Wenyu Chiou
9433f610cc fix(market-phase): detect the tw closing auction (13:25-13:30) (#1869)
_CLOSING_AUCTION_WINDOW_MINUTES had no tw entry, so `.get(market, 0)` gave a
zero-width window and infer_market_phase("tw") could never return CLOSING_AUCTION:
the last tick before 13:30 stayed INTRADAY and 13:30 flipped straight to POSTMARKET.

TWSE/TPEx run a 5-minute closing call auction (13:25-13:30), so add "tw": 5.
+ a phase-boundary regression test (no lunch break, 13:30 half-hour close):
13:24 INTRADAY / 13:25-13:29 CLOSING_AUCTION / 13:30 POSTMARKET.
2026-07-01 19:11:55 +08:00
zhulinsen
fc895e3124 fix: 提升 Discord 长报告分片发送可靠性 (#1861)
* fix: improve Discord long report delivery

* fix(review-feedback-1861): Catch all requests exceptions per chunk
2026-07-01 19:07:52 +08:00
Alfred
4c678850e2 feat: add Claude Code and OpenCode generation backends (#1850)
Co-authored-by: zhulinsen <42829555+ZhuLinsen@users.noreply.github.com>
2026-06-30 22:33:02 +08:00
Wenyu Chiou
b939f7579f feat(market): surface tw 三大法人 in the tw report institution block (Refs #1777) (#1863)
* feat(market): surface tw 三大法人 (institutional flows) in the tw report institution block

Wire the merged TwInstitutionalFetcher (#1829/#1841/#1855) into the tw analysis
report: in _build_offshore_fundamental_context, for market == "tw" only, the
institution block now carries the raw 三大法人 net buy/sell figures (foreign /
trust / dealer / total, unit=shares) from TWSE T86 / TPEx instead of the hardcoded
not_supported. v2 scope confirmed by the maintainer on issue #1777.

- tw-only + strictly additive: cn/hk/us/jp/kr offshore flows are byte-identical
  (the not_supported loop just excludes institution; non-tw still gets the same
  not_supported block). Pinned by tests for us/hk/jp/kr.
- fail-open + default-on: any error or no-data -> not_supported, never interrupts
  the analysis. Wiring (import/construct) failures log at error (visible) but still
  fail open; fetch failures log at warning.
- status "ok" only when all four core nets are present (a genuine 0 is kept).
- raw figures only: no capital_flow_signal / scoring / weight / schema / Web.

Tests: tests/test_tw_institution_report_wiring.py (9) covers data->ok, genuine-zero,
None/raise/init-raise fail-open, missing-core-net->not_supported, us/hk/jp/kr
byte-identical + fetcher-unused, and no-derived-key. + CHANGELOG.

Dual review (code-reviewer + silent-failure-hunter): the hunter caught the combined
try swallowing wiring (import/construct) errors silently at info -> split into
loud-but-fail-open (error log + still not_supported, honoring #1777's
never-interrupt rule) and guarded "ok" against a null core net.

* fix(market): address Codex review on tw institution wiring (#1863) — stage timeout, overall status, docs

- P1: run the tw institution fetch under the fundamental stage/fetch budget via
  _run_with_retry (like the other offshore blocks), so a slow / rate-limited TWSE/TPEx
  call fails open at the deadline instead of pushing the analysis past it.
- P2: count a present tw institution toward the OVERALL fundamental status so a report
  with only 三大法人 data still surfaces fundamentals (consumers key off the top-level
  status). missing_fields keeps the original three blocks, so offshore markets without
  institution data stay byte-identical.
- P2 (docs): sync docs/market-support.md (drop the now-false "data-layer only / not
  wired into report" clause) + add a tw institution note to docs/full-guide.md and
  docs/full-guide_EN.md (AGENTS.md requires user-visible report changes to update guides).

Tests: + stage-timeout (a 2s fetch is abandoned at the ~0.3s budget, fail-open) +
overall-status surfacing assertion. 10 tw-wiring tests + offshore/tw/jp-kr suites green.
2026-06-30 22:31:56 +08:00
HyunRyeol Park
043c60378e feat: 报告输出语言新增韩语支持 (Korean report language, ko) (#1614) (#1844)
* feat(i18n): add Korean to report language label maps

Extend the report language layer with a third code `ko` so reports can
render deterministic labels in Korean. Adds `ko` to the supported list,
aliases (korean/kr/ko-kr), every translation map, the full report label
set, sentiment bands, the config registry enum and `.env.example`.
`zh`/`en` behavior is unchanged and unknown languages still fall back to
the default. Prompt and Web surfaces follow in later changes.

Refs #1614

* feat(i18n): emit Korean output directives in analysis prompts

Make the analysis and market-review prompts produce Korean output when
REPORT_LANGUAGE=ko. The decision agent now appends a Korean
output-language directive (JSON keys and decision_type enum unchanged),
and the market-review prompt reuses the English structural scaffolding
while instructing the model to write the shell, headings and conclusion
in Korean. Market-phase and context-pack prompt sections route ko to the
English structural base. The market-review payload keeps the truthful
language code via a dedicated output-language helper, leaving zh/en
behavior unchanged.

Refs #1614

* fix(i18n): localize phase and market-context guardrails for Korean

Route Korean reports through the English structural scaffolding for
market-phase and market-context prompt sections, and add Korean output,
detection markers, negations and recap patterns to the phase-decision and
daily-market-context guardrails so they operate on Korean model output.
Confidence and operation labels now flow through the shared localize
helpers. zh/en behavior is unchanged.

Refs #1614

* feat(i18n): localize Korean fallback output across analysis pipeline

Add Korean output to the deterministic strings emitted outside the LLM:
per-stock and executor output-language directives, no-API-key / backend
/ parse error fallbacks, hold-watch advice and reasons, market-review
titles and summaries, and history and notification report labels. Fund
flow, trend and confidence values now flow through the shared localize
helpers, and language-keyed advice tables no longer raise KeyError for a
third language. Structural prompt sections route ko to the English
scaffolding. zh/en output is unchanged.

Refs #1614

* feat(web): add Korean report language rendering

Extend the Web ReportLanguage type with ko and add Korean copy to the
report detail surfaces: report text, sentiment labels, market-phase
labels, analysis-context summary, market-review view, diagnostics and
news source. Run-flow chrome that is keyed by UI language falls back to
English for ko. The report-language selector is driven by the backend
config schema, so Korean appears automatically. zh/en rendering is
unchanged.

Refs #1614

* docs(i18n): document Korean report language support

Note that REPORT_LANGUAGE accepts ko in the bilingual guides and the
analyze / market-review request-language parameters, and add a
CHANGELOG entry for Korean report output.

Refs #1614

* fix(i18n): canonicalize Korean values and accept ko in API schemas

Add Korean aliases to the operation-advice, trend, confidence, chip and
bias canonical maps so Korean model output (매수/매도/보유/관망 etc.)
resolves to the correct decision_type and signal level instead of
falling back to hold or a score-band signal. Accept ko in the
analyze, market-review and decision-signal request schemas (and the
static API spec) so the typed client and backend agree and per-request
Korean analysis is not rejected with 422.

Refs #1614
2026-06-30 19:02:46 +08:00
zhulinsen
3fddbd8fbc fix: clarify JP KR service boundaries (#1823)
* feat: add JP KR market review support

* fix: clarify JP KR service boundaries

* fix(review-feedback-1823): add the fields to the response schema and cover the endpoint path, not

* fix(review-feedback-1823): Avoid routing JP/KR reviews through MarketLight schema

* fix(review-feedback-1823): add JP/KR to that resolver when accepting these values

* fix(review-feedback-1823): Keep JP/KR daily contexts from normalizing to CN and add JP/KR labels

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

* fix(review-feedback-1823): 解决冲突并确认最终 diff 后再评审合入

* fix(review-feedback-1823): 澄清或补齐验证证据

* fix(review-feedback-1823): 解决冲突,并在冲突解决后的 head 上重新确认关键验证结果

* fix(review-feedback-1823): Make the Chinese JP/KR prompt shell region-aware

* fix(review-feedback-1823): 解决冲突后再判断最终 head 是否可合入

* fix(review-feedback-1823): 基于目标分支解决冲突,并在冲突后的最终 diff 上重新确认相关后端/Web 检查

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

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

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

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

* fix(review-feedback-1823): Make the all-markets checkbox exclusive

* fix(review-feedback-1823): 解决冲突,并在冲突解决后的最新 head 上重新确认关键测试和 Web 构建结果

* fix(review-feedback-1823): 解决冲突并确保解决后的 head 重新通过对应验证

* fix(review-feedback-1823): 解决冲突,并在冲突解决后重新确认受影响的后端、Web 与文档改动仍一致

* fix(review-feedback-1823): 解决冲突,再基于最新 base 复核完整 diff,并重新确认相关后端/Web 验证结果仍成立

* fix(review-feedback-1823): 解决冲突后重新确认最终 diff 与 CI 结果

* fix(review-feedback-1823): 收敛

* fix(review-feedback-1823): 基于目标分支解决冲突并重新确认关键验证结果

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

* fix(review-feedback-1823): 收敛

* fix(review-feedback-1823): 解决冲突后重新确认 diff 与 CI

* fix(review-feedback-1823): 补充本次未改变哪些配置契约、对应测试覆盖和回退方式

* fix(review-feedback-1823): 收敛

* fix(review-feedback-1823): PR 描述与实际 diff scope 仍不完全对齐:完整改动包含

* fix(review-feedback-1823): 解决冲突并在冲突后的最终 diff 上重新确认 CI/关键测试结果

* fix(review-feedback-1823): 解决冲突并确认解决后的 diff 与现有 43 个文件 scope 仍一致

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

* fix(review-feedback-1823): 解决冲突,并在最终 head 上重新确认受影响的后端与 Web 验证结果

* fix(review-feedback-1823): 解决冲突并确认冲突解决后的最终 head 仍通过对应验证

* fix(review-feedback-1823): 处理旧 both 历史记录在 JP/KR 复盘上下文匹配中的语义兼容风险
2026-06-28 18:53:39 +08:00
zariba
94cd2a4d96 feat(data): 接入 TickFlow 核心 A 股数据源 (#1790)
* feat(data): integrate TickFlow core A-share provider

* fix(data): harden TickFlow daily kline contract

* fix(web): localize TickFlow settings and run-flow coverage

* fix(web): clarify TickFlow priority settings

* chore(deps): require verified TickFlow SDK

---------

Co-authored-by: timeance <timeance@users.noreply.github.com>
2026-06-28 17:09:28 +08:00
zhulinsen
ade3b4cb6e feat: add JP KR market review support (#1822)
* feat: add JP KR market review support

* fix(review-feedback-1822): update the Market Light schema/service support before accepting these

* fix(review-feedback-1822): add JP/KR to daily market context before accepting them and update

* fix(review-feedback-1822): add English JP/KR strategy text or make the renderer language-aware

* fix(review-feedback-1822): update the prompt role/shell alongside the new accepted regions

* fix(review-feedback-1822): 修正 PR 描述中的过期验证结论,并补充/澄清 JP/KR Yahoo Finance 指数兼容性证据或在线验证边界

* fix(review-feedback-1822): 收敛 Market Light 告警契约与用户文档同步问题

* fix(review-feedback-1822): 修正后再合入

* fix(review-feedback-1822): 补齐外部 Yahoo Finance 指数接入与运行时配置变更的兼容性/迁移证据,并修正 PR 描述中与当前 CI 状态不一致的内容

* fix(review-feedback-1822): 当前 CI 状态为 failure,且阻断型 backend-gate 失败

* fix(review-feedback-1822): 修复 MARKET REVIEW REGION 逗号值在交易日过滤与配置 schema 中的契约漂移,并补充对应回归测试

* fix(review-feedback-1822): 收敛 PR 描述中的验证状态与用户可见 Web 改动证据

* fix(review-feedback-1822): 修正 PR 描述中的过期验证结论,并补充 Web 设置变更的截图或无法截图时的替代可视证据说明

* fix(review-feedback-1822): 收敛 PR 描述中的验证状态,并补齐 Web 设置变更的截图或替代可视证据

* fix(review-feedback-1822): 收敛 PR 描述后再合入

* fix(review-feedback-1822): 收敛 PR 描述中的验证状态,并补充 Web 设置变更截图或无法截图时的替代可视证据说明

* fix(review-feedback-1822): 收敛验证状态和 Web UI 可视证据,避免合入记录与实际 head 不一致

* fix(review-feedback-1822): 收敛 PR 描述中的验证状态与 Web 可视证据

* fix(review-feedback-1822): 收敛 PR 描述中的验证状态,并补齐 Web 设置变更的截图或替代可视证据说明

* fix(review-feedback-1822): 修正 PR 描述与当前 CI 事实不一致的问题,补充 Web 设置可视证据,并收敛或拆出 PR 模板改动

* fix(review-feedback-1822): 收敛 PR 描述与证据

* fix(review-feedback-1822): 修正 PR 描述与证据,使验证状态、用户可见变更证据、模板改动范围和当前 head 保持一致

* fix(review-feedback-1822): 收敛 PR 描述、补齐可视证据,并澄清/补充外部模型/API 与运行时配置迁移相关兼容性证据

* fix(review-feedback-1822): 收敛 Web/文档契约不一致、同步残留测试,并更新 PR 描述与可视证据
2026-06-28 17:03:15 +08:00
Alfred
62adb5c4ee feat: add Hermes local HTTP generation (#1824) 2026-06-28 17:02:17 +08:00
zhulinsen
03fe7a00a9 feat: 补齐大盘报告与 Web 个股页的概念板块展示 (#1764) (#1778)
* feat(issue-1764): feat:-补齐大盘报告与-web-个股页的概念板块展示

* fix(review-feedback-1778): 确认历史报告 fallback 路径是否完整透传 conceptRankings,否则会出现新字段在部分历史详情/API 场景中静默丢失

* fix: render market review industry and concept rankings side-by-side

* fix: refine related board display and concept ranking cache
2026-06-27 23:07:18 +08:00
hsms4710-pixel
743ca5b1b4 feat: 添加信号归因分析功能 (Issue #1742) (#1796)
* feat: 修复 reviewer blocker 问题

- 同步 agent 路径(executor.py, decision_agent.py)
- 添加 SignalAttribution 字段验证器(自动转换、归零、归一化)
- 更新 docs/CHANGELOG.md
- 添加回归测试(tests/test_signal_attribution.py)
- 修复 notification.py 和模板的 None 值显示问题

Closes #1742

* fix: 修复 signal_attribution 完整契约

Reviewer feedback 指出的完整契约收敛:

## 1. [Correctness] 归一化接入真实 parse 路径
- 问题:Pydantic validator 没有进入主分析路径(dashboard 是 raw dict)
- 修复:将归一化函数移到 src/utils/data_processing.py,
  在 _parse_response() 和 agent runner.py 的 parse_dashboard_json() 中调用
- 确保 LLM 返回的字符串/负数/总和≠100 被正确处理

## 2. [Correctness] 同步 HistoryService 路径
- 问题:_generate_single_stock_markdown() 不读取 signal_attribution
- 修复:在 history_service.py 中添加信号归因展示代码

## 3. [Process] 修复 CHANGELOG.md 格式
- 问题:两行 [Unreleased] 条目拼在同一行
- 修复:分割成独立行

## 4. [验证] 添加真实路径回归测试
- tests/test_signal_attribution_real_paths.py:
  - 归一化函数测试(9个)
  - _parse_response 集成测试(1个)
  - HistoryService 展示测试(2个)

## 5. [Process] 修复 executor.py prompt 模板格式
- 问题:signal_attribution JSON 例子没转义花括号,导致 .format() 报错
- 修复:将 { 转成 {{,} 转成 }}

Co-authored-by: qyj <jiangqiyuan@tencent.com>

* fix: remove trailing whitespace in notification.py and report_schema.py

* fix: converge signal_attribution contract across all paths

- Add signal_attribution to check_content_integrity() as recommended field
- Normalize signal_attribution in _parse_response() and parse_dashboard_json()
- Sync HistoryService._generate_single_stock_markdown() to render signal_attribution
- Update CHANGELOG.md to reflect actual implementation (explicit normalization, not schema-level)
- Add end-to-end tests covering all paths: _parse_response, notification, Jinja2, HistoryService
- Fix tests to accept signal_attribution as recommended field (missing does not fail integrity check)

* fix: address all reviewer blockers

- Fix generate_single_stock_report() to render signal_attribution
- Fix normalization: clamp values to [0, 100], keep all-zero as 0 (not 25)
- Update docs/full-guide.md and docs/full-guide_EN.md with signal_attribution description
- Add supplement tests covering generate_single_stock_report, normalization edge cases, and _parse_response integration

* fix: 修复 CI 静态检查失败和文档表述不一致

- 修复 tests/test_signal_attribution_supplement.py 的 flake8 错误(F821 undefined name 'AnalysisResult')
- 将 AnalysisResult import 移到文件顶部
- 更新 docs/CHANGELOG.md 表述,反映实际行为(all-zero 保留为 0,有效贡献度归一化到 100)
- 所有 40 个 signal_attribution 测试通过

* fix: converge signal attribution runtime contract

* fix: hide empty signal attribution blocks

* fix: reject non-finite signal attribution weights

---------

Co-authored-by: qiyuanjiang <qiyuanjiang@tencent.com>
Co-authored-by: qyj <jiangqiyuan@tencent.com>
Co-authored-by: hsms4710-pixel <228664208+hsms4710-pixel@users.noreply.github.com>
Co-authored-by: zhulinsen <zhuls97@163.com>
2026-06-27 22:41:44 +08:00
zhulinsen
b308e44827 fix: repair backtest empty result handling (#1779) 2026-06-24 21:52:07 +08:00
Alfred
1f91024dec feat: 新增 codex_cli 本地生成后端 Phase2 (#1769)
* feat: add codex cli generation backend

* fix: harden local CLI backend phase 2

* fix: harden local cli output file handling

* fix: tighten codex cli backend contracts

* fix: support codex cli windows smoke path

* fix: make local cli tests portable on windows

* fix: avoid duplicate codex final output accounting
2026-06-24 20:19:19 +08:00
mumu
cca629ff24 fix(issue-1771): chore(docker):-raise-default-compose-mem (#1774) 2026-06-24 20:17:20 +08:00
Alfred
2f75e832e3 feat: 添加 GenerationBackend Phase 1 抽象 (#1751)
* feat: add generation backend abstraction

* fix: tighten generation backend phase1 contract

* fix: preserve market review backend config errors
2026-06-22 22:42:53 +08:00
mumu
ecd026e958 fix: docker重新部署时,.env设置里的通知变量$content_jso… (#1739) (#1741)
* fix(issue-1739): [bug]-docker重新部署时,.env设置里的通知变量$content_j

* fix(review-feedback-1741): escape/unescape the braced forms too, or reject them before persisting

* fix(review-feedback-1741): preserve braced templates during env import

* fix(review-feedback-1741): 澄清外部模型/API 配置风险提示是否命中真实 diff

* fix(review-feedback-1741): limit raw parsing to CUSTOM WEBHOOK BODY TEMPLATE or re-apply the
2026-06-22 20:49:37 +08:00
mumu
f2e778c058 feat: 支持客户端多时间定时推送 (#1731)
* feat: support runtime multi-time scheduling

* fix(review-feedback-1731): 修复 and add the missing workers value here, likely None to preserve the

* fix: refine scheduler settings UI

* fix: compact scheduler time inputs

* fix(review-feedback-1731): Refresh scheduler status after saving changes

* fix(review-feedback-1731): Refresh scheduler status after env imports

* fix(review-feedback-1731): Do not mark swallowed analysis failures as success

* fix: align serve scheduler ownership

* fix: preserve runtime scheduler startup semantics

* fix: ignore immediate run when cli owns schedule

* fix(review-feedback-1731): main.py + api/app.py:--serve-only 下虽然 runtime schedule requested 被置为

* fix(review-feedback-1731): apps/dsa-desktop/main.js / main.py / api/app.py / src/services/runtime

* fix: preserve runtime scheduler ownership semantics

* fix(review-feedback-1731): 修正 Desktop 启动会自动分析/调度,以及 Web 调度开关在 runtime 状态与持久配置不一致时无法触发 reconcile 的问题

* fix: remove duplicate scheduler save diff variable

* fix: allow empty schedule times config

* fix: reject busy scheduler run-now requests

* fix(review-feedback-1731): 确认并修正 runtime scheduler 重建时可能重复注册 AGENT EVENT MONITOR ENABLED 后台任务的问题

* fix: keep runtime event monitor idempotent

* fix: preserve runtime scheduler CLI flags

* fix(review-feedback-1731): preserve schedule CLI flags in runtime runs

* fix(review-feedback-1731): 修正 --serve --schedule / --serve + SCHEDULE ENABLED=true 下 API

* fix(review-feedback-1731): 修复当前 diff 引入的运行时并发风险和 Uvicorn 兼容风险
2026-06-21 22:24:19 +08:00
mumu
e1faabaa62 fix: limit decision signals to AI page (#1737)
* fix: limit decision signals to AI page

* fix: preserve report signal lookup

* docs: sync decision signal guide

* fix(review-feedback-1737): add a report-id filter or deep link on /decision-signals before
2026-06-21 16:45:12 +08:00
mumu
a1cae3e614 docs: 补充日韩股票支持说明 (#1729)
* docs: update supported market coverage

* fix(review-feedback-1729): add 日股/韩股 to this homepage capability row, it now reads as though
2026-06-20 13:10:00 +08:00
Alfred
bc673b0ddb docs: close out decision signal p7 (#1727) 2026-06-20 10:37:35 +08:00
Alfred
a7876fe11c feat: link decision signals with alerts and portfolio risk (#1715)
Co-authored-by: mumu <42829555+ZhuLinsen@users.noreply.github.com>
2026-06-19 09:43:40 +08:00
Alfred
1f9ce289d2 feat: 新增 DecisionSignal 反馈、后验验证与统计 P5 (#1710)
* feat: add decision signal outcomes and feedback

* fix: align outcome filters and retry rotation
2026-06-18 21:23:11 +08:00
Alfred
ee14c3972f feat: add decision signal web surfaces (#1703) 2026-06-17 18:47:57 +08:00
Alfred
4fa81a421c feat: add legacy LLM usage telemetry (#1698) 2026-06-17 18:46:01 +08:00
Amorend
ef7264f76a feat: add token usage dashboard (#1667)
* feat: add token usage dashboard

* fix: correct usage metadata inference

* refactor: scope token usage dashboard

* fix: guard token usage period refresh

* fix: polish token usage dashboard i18n

---------

Co-authored-by: knight0940 <evilgenius0256@gmail.com>
Co-authored-by: zhulinsen <zhuls97@163.com>
2026-06-15 22:33:01 +08:00
Alfred
c0321de3f5 feat: 补齐 #1390 P3 决策信号生命周期与去重 (#1692)
* Implement decision signal lifecycle deduplication

* Fix API router prefix compatibility

* Fix null decision signal expiry defaults
2026-06-15 20:32:54 +08:00
Alfred
6d4c93d2b7 feat: extract decision signals from analysis reports (#1686) 2026-06-14 18:26:30 +08:00
mumu
89fab774f6 fix: 过滤低质量股票新闻结果 (#1674)
* fix: filter low-quality stock news results

* fix: filter adult spam news results

* fix(review-feedback-1674): Require content evidence before dropping URL-only hits and Match

* fix(review-feedback-1674): Move admission filtering before dimension limiting

* fix(review-feedback-1674): Match app/download terms as tokens before filtering

* fix(review-feedback-1674): Recognize Chinese numeric ratings in app-page filter

* fix(review-feedback-1674): 收敛后再合入

* fix(review-feedback-1674): 收敛后再合入

* fix: tighten stock news admission signals

* fix: narrow noisy news admission heuristics

* fix: handle app metric news admission

* fix: require context for app listing spam

* fix: preserve app metric news results

* fix: require strong app spam evidence

* fix: honor official source labels

* fix: preserve official labels and app metrics

* fix: detect separated adult contact ids

* fix: preserve app metrics and service news

* fix: match alphanumeric adult contacts

* fix: require adult spam solicitation signals

* fix: preserve neutral mobile app metrics

* fix: reduce app and adult false positives
2026-06-13 15:19:44 +08:00
mumu
a82ae51ca8 feat: enable daily market context by default (#1673) 2026-06-13 10:58:18 +08:00
mumu
0db0c78da8 feat: 个股分析接入当日大盘上下文 (#1623)
* feat: add daily market context for stock analysis

* fix(review-feedback-1623): Share the market context service across worker threads and Use the

* fix(review-feedback-1623): Avoid overwriting per-region context reports and Expand history lookup

* fix(review-feedback-1623): add position even though the guardrail supposedly softened the

* fix(review-feedback-1623): Avoid generating the CLI market review twice

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

* fix(review-feedback-1623): 修复普通 CLI/调度运行中大盘复盘被上下文预热摘要替代的问题,并收敛 PR 描述与当前实现范围

* fix(review-feedback-1623): 修正保守护栏的误判风险,并同步收敛 PR 描述范围

* fix(review-feedback-1623): 处理并发生成大盘上下文的锁语义风险,并澄清/补充外部模型或运行时配置风险检测的依据

* fix(review-feedback-1623): 收敛大盘上下文预热对用户可见大盘复盘的行为影响,并补齐外部模型/API 与运行时配置检测风险的澄清或验证证据

* fix(review-feedback-1623): Do not skip multi-market reviews after one cached context and Do not

* fix(review-feedback-1623): Prime context with the effective trading date

* fix(review-feedback-1623): 收敛 PR 描述与实际 diff 的范围不一致,并澄清结构化检测提示的 provider/model/base

* fix(review-feedback-1623): 补一句“本 PR 不修改 LLM provider/model/base url、默认模型、配置清理或迁移逻辑”,避免后续审查继续误判

* fix(review-feedback-1623): 收敛 PR 描述与实际 diff 的范围矛盾

* fix(review-feedback-1623): 补齐这些承诺的实现

* fix(review-feedback-1623): 收敛 PR 描述与实际 diff 范围,避免以未实现能力作为验收项

* fix(review-feedback-1623): 收敛 PR 描述与实际范围,并澄清外部模型/API 与运行时配置检测风险

* fix(review-feedback-1623): Match freshly saved reviews to the target trade date

* fix(review-feedback-1623): preserve structured market-light risk signals

* fix(review-feedback-1623): Escape market-summary sentinels before prompting

* fix(review-feedback-1623): 修复同日缓存复用时把低敏摘要当完整大盘复盘输出的行为风险,并收敛 PR 描述与实际 diff

* fix(review-feedback-1623): 收敛

* fix(review-feedback-1623): 收敛 PR 描述与实际 scope

* fix(review-feedback-1623): 修正大盘复盘复用语义,并让 PR 描述与实际 scope 对齐

* fix(review-feedback-1623): 修正同日大盘上下文缓存复用语义,并让 PR 描述与实际 scope 对齐

* fix(review-feedback-1623): Disable cached market context when skipping market review

* fix(review-feedback-1623): 收敛 PR 描述与实际 scope,并补充外部模型/API 与运行时配置语义未变化的可核验证据

* fix(review-feedback-1623): 修正 PR 描述与实际 scope 的实质性不一致,并补齐或澄清 LLM/provider/model/base URL

* fix(review-feedback-1623): 修正 operation advice 契约漂移,并让 PR 描述/验收范围与当前实际 diff 对齐

* fix(review-feedback-1623): 收敛 main.py 中大盘复盘复用导致的通知/执行语义变化,并补对应回归测试

* fix(review-feedback-1623): 修复生成型大盘上下文未绑定当前 query id 的行为风险,并收敛 PR body 与实际 diff 范围

* fix(review-feedback-1623): 修复缓存语言匹配问题,并收敛 PR 描述与实际 diff/验收范围的一致性

* fix(review-feedback-1623): 收敛当前实现与描述/文档中的验收边界,并澄清 schedule/CLI 首次运行无历史大盘复盘时是否应生成并注入上下文

* fix(review-feedback-1623): 收敛 PR 描述与 docs/CHANGELOG.md 中关于验收边界的表述,避免与实际 diff 实质性矛盾

* fix(review-feedback-1623): 修正 PR 描述与实际 diff 的范围漂移

* fix(review-feedback-1623): Reuse the cached runtime market context on fallback

* fix(review-feedback-1623): PR 描述:当前完整改动文件列表没有 api/ 、apps/dsa-web/ 、日报状态表或四阶段日报持久化相关实现,但 PR

* fix(review-feedback-1623): 收敛描述范围

* fix(review-feedback-1623): 收敛并发生成复用路径的正确性风险,并修正 PR 描述的实际范围与验收项

* fix(review-feedback-1623): 收敛描述和验收范围

* fix(review-feedback-1623): PR 描述的 Background / Acceptance Criteria 仍包含独立 API、Web

* fix(review-feedback-1623): 收敛 PR 描述与实际实现边界,并补齐 LLM/provider/base url 相关兼容性说明或验证证据

* fix(review-feedback-1623): PR 描述与实际 diff 范围不一致:描述和验收项仍写有独立 API、Web

* fix(review-feedback-1623): Wait long enough for in-flight market reviews

* fix(review-feedback-1623): 修复共享 market review lock 释放后仍不生成匹配上下文的行为风险,并同步收敛 PR description 的实际范围

* fix(review-feedback-1623): 修复锁竞争 fallback 下丢失运行时服务的问题,并同步收敛 PR description 与实际 diff 范围

* fix(review-feedback-1623): 收敛 PR description 与实际改动范围

* fix(review-feedback-1623): PR 描述与实际 diff 存在实质性矛盾:描述声称提供独立 API、Web

* fix(review-feedback-1623): reuse runtime market context and handle English negations

* fix: honor daily market context config

* docs: remove unrelated changelog entries

* fix(review-feedback-1623): preserve the skipped market-review artifact

* fix(review-feedback-1623): add low position cap and are not in CONSERVATIVE TEXT MARKERS , so an
2026-06-13 10:33:04 +08:00
volcanoAlbert
f587459ed1 feat: add portfolio account archive action 持仓管理页面添加账户删除功能 (#1647)
* feat: add portfolio account archive action

* fix: exclude archived accounts from risk snapshots
2026-06-10 22:48:08 +08:00
Alfred
ad15ebcec5 feat: 新增 DecisionSignal 持久化 API(#1390 P1) (#1645)
* feat: add decision signal persistence api

Refs #1390

* fix: handle HK decision signal filters without market
2026-06-10 22:46:33 +08:00
Alfred
da274f7061 fix: 锁定问股追问的当前标的上下文 P2 (#1619)
* fix: keep ask-stock follow-ups scoped

* fix: normalize watchlist stock comparisons

* docs: document watchlist stock code equivalence

* fix: tighten ask-stock tool scope guard

* fix: close ask-stock review gaps

* fix: close ask-stock review gaps
2026-06-10 22:45:58 +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
12a7e6d3c7 fix: make AlphaSift screening recoverable (#1628)
* fix: make AlphaSift screening recoverable

* fix(review-feedback-1628): Keep polling state across transient status errors
2026-06-07 16:22:36 +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
Delicious233
3471afbd98 feat: add Feishu App Bot notification sender with P2P and group support (#1553)
* feat: add Feishu App Bot notification sender with P2P and group support

The existing FeishuSender only supports custom robot Webhook mode.
This commit extends it to support App Bot (lark-oapi SDK) mode, auto-routing
between webhook (priority) and App Bot when FEISHU_APP_ID + FEISHU_APP_SECRET
+ FEISHU_CHAT_ID are configured.

Design:
- send_to_feishu() routes: webhook if URL set, else App Bot
- DCLP lazy client init with thread-safe sentinel guard
- Retry (3 attempts, exponential backoff) with fixed UUID for idempotency
- Card-first / text-fallback content strategy
- Chunking for long messages
- Runtime enum validation for FEISHU_RECEIVE_ID_TYPE and FEISHU_DOMAIN
- Safe SDK defaults (FEISHU_DOMAIN/LARK_DOMAIN) before import try-block
  so Webhook path never depends on lark-oapi SDK presence
- Config, diagnostics, setup check, notification test, and CI workflow
  all consistent with the new App Bot channel semantics
- lark-oapi>=1.0.0 already in requirements.txt (line 23)

Verification:
- 20/20 unit tests pass (help metadata + FeishuSender)
- E2E: real Feishu API — SDK import, token, client init, P2P text+card send all PASS
- Webhook regression: verified no SDK dependency for existing Webhook path

* fix: add missing Feishu App Bot locale entries and env table keys, harden sender error handling

CI fix 1 (test_registry_help_keys_exist_in_locales):
- Add zh-CN and en-US locale entries for FEISHU_CHAT_ID,
  FEISHU_RECEIVE_ID_TYPE, FEISHU_DOMAIN in settingsHelp.ts

CI fix 2 (test_notification_actions_env_table_matches_generated_output):
- Add FEISHU_RECEIVE_ID_TYPE, FEISHU_DOMAIN to feishu advanced_keys
  in CHANNEL_SPECS so they appear in KEY_SPECS
- Regenerate managed env table in docs/notifications.md

feishu_sender.py hardening:
- Catch network exceptions in webhook _post_payload so card-to-text
  fallback actually executes on transient failures
- Guard response.json() and isinstance(result, dict) against
  non-JSON / non-dict HTTP 200 responses
- Extract shared _build_card_body() to de-duplicate card payload
  construction between webhook and App Bot paths
- Rename module-level lark -> _lark to avoid shadowing
- Guard resp.get_log_id() with try/except
- Add None guard on send_to_feishu content parameter

e2e script improvements:
- Support FEISHU_OPEN_ID for P2P test, FEISHU_DOMAIN for Lark
- Add FEISHU_TEST_SEND_TEXT=1 for plain-text-only path testing
- Clarify docstring: setup validation + smoke test, not full e2e

* fix: consolidate Feishu App Bot notification contract

* fix: align Feishu domain help scope

---------

Co-authored-by: mumu <42829555+ZhuLinsen@users.noreply.github.com>
2026-06-05 08:56:42 +08:00
mumu
8df69fe036 feat: 完善大盘复盘历史聚合、查看与删除能力 (#1580) (#1598)
* feat(issue-1580): feat:-完善大盘复盘历史聚合、查看与删除能力

* fix(review-feedback-1598): resetting the paged window or deduping the merged list before storing it

* fix(review-feedback-1598): 补齐 AGENTS.md 要求的用户可见能力文档同步
2026-06-04 22:29:20 +08:00
Alfred
e6302a0b9c docs: add #1386 P7 market-phase guide (#1597) 2026-06-04 20:30:38 +08:00
mumu
d6234cd7f0 fix: clarify Docker env runtime config (#1586)
* fix: clarify Docker env runtime config

* fix(review-feedback-1586): 确认并修复启动环境变量兜底对 switch 类型配置的展示正确性,否则 Docker 用户仍可能在关键布尔配置上看到错误状态

* fix(review-feedback-1586): 修正 docs/CHANGELOG.md 的范围漂移和重复内容

* fix(review-feedback-1586): 补充说明这些值仅作为已有配置键的展示 fallback,不新增默认 provider/model/Base URL,也不会静默迁移或清空用户配置

* fix(review-feedback-1586): 确认并修复运行时注入的 LLM channel 支持键在 Settings 保存/校验路径中的一致性问题

* fix(review-feedback-1586): 修复下述运行时配置静默持久化风险

* fix(review-feedback-1586): 修复 runtime-only LLM support key 过滤逻辑对“同一 channel 部分字段来自

* fix(review-feedback-1586): apps/dsa-web/src/components/settings/LLMChannelEditor.tsx、src/services/s

* fix(review-feedback-1586): Avoid migrating runtime-only secrets on rename

* fix(review-feedback-1586): 补充该说明

* fix(review-feedback-1586): docs/CHANGELOG.md 新增说明直接引用 litellm =1.80.10,!=1.82.7,!=1.82.8,<2.0.0

* fix(review-feedback-1586): 补齐“持久化 API KEY + runtime-only API KEYS

* fix(review-feedback-1586): 收敛
2026-06-04 19:17:36 +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
3281d96788 docs: close analysis context pack P6 (#1592) 2026-06-04 12:37:48 +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
44ea049530 feat: add web market phase labels (#1582) 2026-06-03 22:44:59 +08:00
mumu
5cd968b411 fix: improve Windows first-run encoding compatibility (#1583) 2026-06-03 22:36:50 +08:00
mumu
14d666bccd fix: avoid agent daily bars missing false positive (#1578) 2026-06-03 21:30:07 +08:00
Alfred
7e54c6c3ba feat: add analysis phase API plumbing (#1573) 2026-06-03 19:51:07 +08:00