## MODIFIED Requirements ### Requirement: 热点探测函数迁移至独立模块 系统 SHALL 将热点搜索与分析相关函数从 `main.py` 提取至 `services/hotspot.py`,包括:`search_hotspots`、`analyze_and_suggest`、`generate_from_hotspot`、`_set_cache`、`_get_cache`、`_fetch_and_cache`、`_pick_from_cache`、`fetch_proactive_notes`、`on_proactive_note_selected`。 新增对外接口:`get_last_analysis`、`set_last_analysis`、`feed_hotspot_to_engine`。 #### Scenario: 模块导入成功 - **WHEN** `main.py` 执行 `from services.hotspot import search_hotspots, analyze_and_suggest` 等导入 - **THEN** 所有函数可正常调用 #### Scenario: 线程安全缓存随模块迁移 - **WHEN** `_cache_lock`(`threading.RLock`)随函数一起迁移至 `services/hotspot.py` - **THEN** `_set_cache` / `_get_cache` / `get_last_analysis` / `set_last_analysis` 的线程安全行为保持不变 #### Scenario: analyze_and_suggest 写入分析状态 - **WHEN** `analyze_and_suggest` 成功获得 LLM 分析结果 - **THEN** SHALL 在渲染 Markdown 之前调用 `set_last_analysis(analysis)` 缓存结构化数据 - **AND** 返回值格式不变(status, summary, keyword) #### Scenario: generate_from_hotspot 支持增强上下文 - **WHEN** 调用 `generate_from_hotspot` 生成文案 - **THEN** 函数 SHALL 自动从 `get_last_analysis()` 获取结构化摘要,与 `search_result` 拼接后传入 `svc.generate_copy_with_reference()`,总参考文本限制在 3000 字符以内