Import 9 alphaear finance skills
- alphaear-deepear-lite: DeepEar Lite API integration - alphaear-logic-visualizer: Draw.io XML finance diagrams - alphaear-news: Real-time finance news (10+ sources) - alphaear-predictor: Kronos time-series forecasting - alphaear-reporter: Professional financial reports - alphaear-search: Web search + local RAG - alphaear-sentiment: FinBERT/LLM sentiment analysis - alphaear-signal-tracker: Signal evolution tracking - alphaear-stock: A-Share/HK/US stock data Updates: - All scripts updated to use universal .env path - Added JINA_API_KEY, LLM_*, DEEPSEEK_API_KEY to .env.example - Updated load_dotenv() to use ~/.config/opencode/.env
This commit is contained in:
127
skills/alphaear-predictor/scripts/prompts/fin_agent.py
Normal file
127
skills/alphaear-predictor/scripts/prompts/fin_agent.py
Normal file
@@ -0,0 +1,127 @@
|
||||
from datetime import datetime
|
||||
from .isq_prompt_generator import generate_isq_prompt_section
|
||||
|
||||
def get_fin_researcher_instructions() -> str:
|
||||
"""生成金融研究员 (Researcher) 的系统指令"""
|
||||
current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
return f"""你是一名资深金融研究员,当前时间是 {current_time}。
|
||||
你的任务是针对给定的“原始信号”进行详尽的背景调查,为后续的深度分析提供素材。
|
||||
|
||||
### 1. 核心职责
|
||||
1. **标的识别**: 识别信号中涉及的具体上市公司。必须调用 `search_ticker` 确认代码,并调用 `get_stock_price` 获取最新价格和近 30 天走势。
|
||||
2. **事实核查**: 使用 `web_search` 或 `fetch_news_content` 验证信号的真实性,并寻找更多细节(如公告原文、行业研报摘要)。
|
||||
3. **产业链梳理**: 补充该信号涉及的上下游环节及竞争格局。
|
||||
|
||||
### 2. 工具使用规范 (CRITICAL)
|
||||
- **每个提到的公司都需要调用工具**: 不能依赖记忆,必须实时查询。
|
||||
- **完整呈现工具结果**: 包括具体的股价数字、代码、技术面数据等,不要缩略。
|
||||
- **股价数据必需**: 当前价格、近期最高最低、技术面支撑阻力等数据是后续预测的基础。
|
||||
- **信息交叉验证**: 多个来源验证关键事实。
|
||||
|
||||
### 3. 输出要求
|
||||
你必须输出结构化的研究报告,涵盖标的基本面、股价走势、行业背景及最新进展。
|
||||
"""
|
||||
|
||||
def get_fin_analyst_instructions(template_id: str = "default_isq_v1") -> str:
|
||||
"""生成金融分析师 (Analyst) 的系统指令
|
||||
|
||||
Args:
|
||||
template_id: 使用的 ISQ 模板 ID
|
||||
"""
|
||||
current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
isq_block = generate_isq_prompt_section(template_id=template_id)
|
||||
|
||||
return f"""你是一位深耕二级市场的资深金融分析师 (FinAgent),当前时间是 {current_time}。
|
||||
你的核心任务是执行“信号解析”,将研究员搜集的素材转化为具有可操作性的投资情报(ISQ 框架)。
|
||||
|
||||
{isq_block}
|
||||
|
||||
### 2. 分析约束
|
||||
- **严格基于具体数据**: 必须使用研究员提供的股价、技术面、新闻等具体数据进行分析。
|
||||
- **数据驱动的预测**: impact_tickers 中的权重应基于事件影响程度,不能随意赋值。
|
||||
- **逻辑严密**: 传导链条必须符合金融常识,能够自圆其说。
|
||||
- **技术面参考**: 如果研究员提供了股价走势,请分析当前位置相对于支撑/阻力位的关系。
|
||||
|
||||
### 3. 关键要求
|
||||
- **title**: 必须生成一个简练、准确概括信号核心内容的标题(不超过 15 字)。
|
||||
- **impact_tickers**: 必须填充具体的公司代码(6位数字)和名称,权重应该有区分。
|
||||
- **transmission_chain**: 必须是对象列表,每个对象包含:
|
||||
- `node_name`: 节点名称(如“上游原材料”、“中游制造”)
|
||||
- `impact_type`: 影响类型(“利好”、“利空”、“中性”)
|
||||
- `logic`: 具体的传导逻辑描述
|
||||
- **summary**: 基于分析结果总结核心观点,包含具体数字(如股价目标、预期涨跌幅等)。
|
||||
- **reasoning**: 必须详细阐述推演逻辑,解释为什么得出上述结论(<200字)。
|
||||
|
||||
### 4. 输出格式 (严格 JSON 块)
|
||||
你必须输出一个符合 InvestmentSignal 结构的 JSON 块,包含所有必需字段。
|
||||
"""
|
||||
|
||||
def get_fin_agent_instructions() -> str:
|
||||
# 保持兼容性,但内部调用 analyst 指令
|
||||
return get_fin_analyst_instructions()
|
||||
|
||||
def get_fin_research_task(signal_text: str) -> str:
|
||||
"""生成研究员的任务描述"""
|
||||
return f"请针对以下信号进行背景调查,搜集相关标的的股价、最新进展和行业背景:\n\n{signal_text}"
|
||||
|
||||
def format_research_context(research_data: dict) -> str:
|
||||
"""将研究员搜集的结构化数据格式化为分析师可读的文本"""
|
||||
if not research_data:
|
||||
return "(未能搜集到额外背景信息)"
|
||||
|
||||
return f"""
|
||||
### 研究背景
|
||||
- **相关标的**: {research_data.get('tickers_found', [])}
|
||||
- **行业背景**: {research_data.get('industry_background', '未知')}
|
||||
- **最新进展**: {', '.join(research_data.get('latest_developments', []))}
|
||||
- **关键风险**: {', '.join(research_data.get('key_risks', []))}
|
||||
- **综合摘要**: {research_data.get('search_results_summary', '无')}
|
||||
"""
|
||||
|
||||
def get_fin_analysis_task(signal_text: str, research_context_str: str) -> str:
|
||||
"""生成分析师的任务描述"""
|
||||
return f"""请基于以下信息进行深度 ISQ 分析。关键是:必须使用研究员搜集的具体数据(股价、技术面、新闻、代码等)进行分析。
|
||||
|
||||
=== 原始信号 ===
|
||||
{signal_text}
|
||||
|
||||
=== 研究员搜集的背景信息 (CRITICAL DATA) ===
|
||||
{research_context_str}
|
||||
|
||||
=== 分析要求 ===
|
||||
1. 必须生成 title:简练概括信号核心(<15字)
|
||||
2. 基于研究员提供的具体股价数据,分析当前定价状态(已定价/未定价/部分定价)
|
||||
3. impact_tickers 中填充具体的公司代码和权重,权重基于事件影响程度
|
||||
4. transmission_chain 必须是包含 node_name, impact_type, logic 的对象列表
|
||||
5. summary 中包含具体数字(预期目标价、涨跌幅范围等)
|
||||
6. reasoning 必须详细解释推演逻辑,不要空泛,要言之有物
|
||||
|
||||
请严格按 InvestmentSignal JSON 格式输出。"""
|
||||
|
||||
def get_tracking_analysis_task(old_signal: dict, new_research_str: str) -> str:
|
||||
"""生成信号追踪更新的任务描述"""
|
||||
import json
|
||||
old_sig_str = json.dumps(old_signal, ensure_ascii=False, indent=2)
|
||||
return f"""你正在执行“信号逻辑演变追踪”任务。请基于最新的市场信息,重新评估之前的投资信号。
|
||||
|
||||
=== 基准信号 (上次分析) ===
|
||||
{old_sig_str}
|
||||
|
||||
=== 最新市场追踪 (NEWS & PRICE) ===
|
||||
{new_research_str}
|
||||
|
||||
=== 追踪分析要求 ===
|
||||
1. **逻辑演变检测**:
|
||||
- 对比新旧信息,判断原逻辑 (`transmission_chain` 和 `reasoning`) 是否依然成立?
|
||||
- 如果逻辑发生变化(如利好落空、逻辑证伪、新利好出现),请在新的 `reasoning` 中明确指出“逻辑演变:...”
|
||||
- 如果逻辑未变且得到验证,请标记“逻辑维持:...”
|
||||
|
||||
2. **参数修正**:
|
||||
- 根据最新股价和新闻,更新 `sentiment_score` (情绪)、`confidence` (置信度) 和 `expectation_gap` (预期差)。
|
||||
- 例如:如果股价已经大涨反映了利好,`expectation_gap` 应该显著降低。
|
||||
|
||||
3. **输出更新后的信号**:
|
||||
- 保留原 `signal_id` 和 `title`(除非有重大变化需要改名)。
|
||||
- 输出完整的 InvestmentSignal JSON。
|
||||
|
||||
请重点关注:为什么变了?还是为什么没变?理由要充分。"""
|
||||
@@ -0,0 +1,49 @@
|
||||
from typing import List, Dict, Any
|
||||
from ..schema.models import KLinePoint
|
||||
|
||||
def get_forecast_adjustment_instructions(ticker: str, news_context: str, model_forecast: List[KLinePoint]):
|
||||
"""
|
||||
生成 LLM 预测调整指令
|
||||
"""
|
||||
forecast_str = "\n".join([f"- {p.date}: O:{p.open}, C:{p.close}" for p in model_forecast])
|
||||
|
||||
return f"""你是一位资深的量化策略分析师。
|
||||
你的任务是:根据给定的【Kronos 模型预测结果】和【最新的基本面/新闻背景】,对模型预测进行“主观/逻辑调整”。
|
||||
|
||||
股票代码: {ticker}
|
||||
|
||||
【Kronos 模型原始预测 (OHLC)】:
|
||||
{forecast_str}
|
||||
|
||||
【最新情报背景】:
|
||||
{news_context}
|
||||
|
||||
调整原则:
|
||||
1. 原始预测是基于历史的技术面推演。
|
||||
2. 情报背景中可能包含【Kronos模型定量修正预测】,这是基于历史新闻训练的专用模型计算出的量化结果。
|
||||
3. 如果存在“定量修正预测”,请**高度参考**该数值作为基础,除非你有非常确凿的逻辑认为该量化模型失效(例如遇到模型未见过的极端黑天鹅)。
|
||||
4. 你的核心任务是:结合定性分析(新闻及其逻辑)来验证或微调这些数字,并给出合理的解释(Rationale)。
|
||||
5. 如果没有“定量修正预测”,则你需要根据新闻信号手动大幅调整趋势。
|
||||
|
||||
输出要求 (严格 JSON 格式):
|
||||
```json
|
||||
{{
|
||||
"adjusted_forecast": [
|
||||
{{
|
||||
"date": "YYYY-MM-DD",
|
||||
"open": float,
|
||||
"high": float,
|
||||
"low": float,
|
||||
"close": float,
|
||||
"volume": float
|
||||
}},
|
||||
...
|
||||
],
|
||||
"rationale": "详细说明调整的逻辑依据,例如:考虑到[事件A],预期短线将突破压力位..."
|
||||
}}
|
||||
```
|
||||
注意:必须输出与原始预测相同数量的数据点,且日期一一对应。
|
||||
"""
|
||||
|
||||
def get_forecast_task():
|
||||
return "请根据以上背景和模型预测,给出调整后的 K 线数据并说明理由。"
|
||||
45
skills/alphaear-predictor/scripts/prompts/intent_agent.py
Normal file
45
skills/alphaear-predictor/scripts/prompts/intent_agent.py
Normal file
@@ -0,0 +1,45 @@
|
||||
def get_intent_analysis_instructions() -> str:
|
||||
"""生成意图分析 Agent 的系统指令,专注于金融市场影响分析"""
|
||||
return """你是一个资深的金融市场意图分析专家。你的任务是将用户的自然语言查询转化为结构化的 JSON 分析结果,重点挖掘该查询与金融市场(尤其是股市)的潜在关联。
|
||||
|
||||
### 核心任务:
|
||||
深入分析用户查询,识别核心金融实体、行业板块及潜在的市场影响点,生成利于搜索引擎抓取深度金融分析信息的查询词。
|
||||
|
||||
### 输出格式(严格 JSON):
|
||||
```json
|
||||
{
|
||||
"keywords": ["实体/行业/事件"],
|
||||
"search_queries": ["针对市场影响的搜索词1", "针对行业变动的搜索词2"],
|
||||
"affected_sectors": ["相关板块1", "相关板块2"],
|
||||
"is_market_moving": true/false,
|
||||
"time_range": "recent/all/specific_date",
|
||||
"intent_summary": "一句话描述其金融市场分析意图"
|
||||
}
|
||||
```
|
||||
|
||||
### 字段说明:
|
||||
1. **keywords**: 核心公司实体、所属行业、宏观经济事件或政策概念。
|
||||
2. **search_queries**: 优化后的搜索词,必须包含“股市影响”、“股价波动”、“行业逻辑”或“估值”等金融维度。
|
||||
3. **affected_sectors**: 可能受此事件或信息影响的二级市场板块(如:保险、半导体、房地产)。
|
||||
4. **is_market_moving**: 该事件是否具有显著的市场驱动潜力或属于重大基本面变化。
|
||||
5. **intent_summary**: 简述用户查询背后的金融研究目的。
|
||||
|
||||
### 示例:
|
||||
用户输入:"帮我研究一下香港火灾的影响"
|
||||
输出:
|
||||
```json
|
||||
{
|
||||
"keywords": ["香港", "火灾", "保险行业", "房地产"],
|
||||
"search_queries": ["香港火灾对当地保险股股价影响", "香港大火对相关上市物业公司估值冲击", "近期香港火灾带来的市场避险情绪分析"],
|
||||
"affected_sectors": ["保险", "房地产", "物业管理"],
|
||||
"is_market_moving": true,
|
||||
"time_range": "recent",
|
||||
"intent_summary": "评估香港近期火灾对相关板块上市公司的潜在经济损失及股价冲击"
|
||||
}
|
||||
```
|
||||
"""
|
||||
|
||||
def get_intent_task(query: str) -> str:
|
||||
"""生成意图分析任务描述"""
|
||||
return f"Process this query and extract financial market intent: {query}"
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
"""
|
||||
ISQ prompt helpers to render dimension guidance directly from the template.
|
||||
Any change in the template propagates to prompts automatically.
|
||||
"""
|
||||
|
||||
from typing import List, Optional
|
||||
from ..schema.isq_template import get_isq_template, ISQTemplate
|
||||
|
||||
|
||||
def _ordered_dimension_keys(template: ISQTemplate, order: Optional[List[str]] = None) -> List[str]:
|
||||
if order:
|
||||
return [k for k in order if k in template.dimensions]
|
||||
# fallback to template insertion order
|
||||
return list(template.dimensions.keys())
|
||||
|
||||
|
||||
def generate_isq_prompt_section(template_id: str = "default_isq_v1", order: Optional[List[str]] = None, include_header: bool = True) -> str:
|
||||
"""Render ISQ dimension text block based on the template.
|
||||
This allows prompt text to stay in sync with template edits.
|
||||
"""
|
||||
template = get_isq_template(template_id)
|
||||
keys = _ordered_dimension_keys(template, order)
|
||||
|
||||
lines: List[str] = []
|
||||
if include_header:
|
||||
lines.append("### 1. ISQ 评估框架 (Investment Signal Quality)")
|
||||
lines.append(f"参考模板: {template.template_name} (id: {template.template_id})")
|
||||
lines.append("")
|
||||
lines.append("你需要对信号进行以下维度的评分:")
|
||||
lines.append("")
|
||||
|
||||
for idx, key in enumerate(keys, start=1):
|
||||
spec = template.dimensions[key]
|
||||
examples = ";".join([f"{k}: {v}" for k, v in spec.examples.items()]) if spec.examples else ""
|
||||
lines.append(f"{idx}. **{spec.key} ({spec.name})**: {spec.range_type}")
|
||||
lines.append(f" - 描述: {spec.description}")
|
||||
if spec.scale_factor and spec.scale_factor != 1.0:
|
||||
lines.append(f" - 缩放因子: {spec.scale_factor}")
|
||||
if examples:
|
||||
lines.append(f" - 示例: {examples}")
|
||||
lines.append("")
|
||||
|
||||
return "\n".join(lines).rstrip()
|
||||
415
skills/alphaear-predictor/scripts/prompts/report_agent.py
Normal file
415
skills/alphaear-predictor/scripts/prompts/report_agent.py
Normal file
@@ -0,0 +1,415 @@
|
||||
# src/prompts/report_agent.py
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from .isq_prompt_generator import generate_isq_prompt_section
|
||||
|
||||
def get_report_planner_base_instructions() -> str:
|
||||
"""生成报告策划员 (Planner) 的基础系统指令"""
|
||||
return """你是一名资深的金融研报主编。你的任务是规划报告的结构,将零散的信号聚类成有逻辑的主题。
|
||||
你拥有 RAG 搜索工具,可以检索已生成的章节内容以确保逻辑连贯性。
|
||||
在规划时,应重点关注信号之间的关联性、产业链的完整性以及用户特定的关注点。"""
|
||||
|
||||
def get_report_writer_base_instructions() -> str:
|
||||
"""生成报告撰写员 (Writer) 的基础系统指令"""
|
||||
return """你是一名资深金融分析师。你的任务是根据策划员提供的信号簇撰写深度研报章节。
|
||||
你应当运用专业的金融知识,将信号转化为深刻的洞察。
|
||||
注意:你没有外部搜索工具,你的分析必须基于提供给你的信号内容和行情数据。"""
|
||||
|
||||
def get_report_editor_base_instructions() -> str:
|
||||
"""生成报告编辑 (Editor) 的基础系统指令"""
|
||||
return """你是一名严谨的金融研报编辑。你的任务是审核和润色撰写员生成的章节。
|
||||
你拥有 RAG 搜索工具,可以检索其他章节的内容,以消除重复、修正逻辑冲突并确保术语一致性。
|
||||
你应当确保报告符合专业的金融写作规范,且标题层级正确。"""
|
||||
|
||||
# 1. 策划阶段 (Structural Planning)
|
||||
def format_signal_for_report(signal: any, index: int, cite_keys: Optional[list] = None) -> str:
|
||||
"""格式化单个信号供研报生成使用"""
|
||||
# 这里的逻辑从 ReportAgent._format_signal_input 迁移过来
|
||||
from ..schema.models import InvestmentSignal
|
||||
|
||||
if isinstance(signal, dict):
|
||||
try:
|
||||
sig_obj = InvestmentSignal(**signal)
|
||||
except:
|
||||
return f"--- 信号 [{index}] ---\n标题: {signal.get('title')}\n内容: {signal.get('content', '')[:500]}"
|
||||
else:
|
||||
sig_obj = signal
|
||||
|
||||
chain_str = " -> ".join([f"{n.node_name}({n.impact_type})" for n in sig_obj.transmission_chain])
|
||||
|
||||
text = f"--- 信号 [{index}] ---\n"
|
||||
text += f"标题: {sig_obj.title}\n"
|
||||
text += f"逻辑摘要: {sig_obj.summary}\n"
|
||||
text += f"传导链条: {chain_str}\n"
|
||||
text += f"ISQ 评分: 情绪({sig_obj.sentiment_score}), 确定性({sig_obj.confidence}), 强度({sig_obj.intensity})\n"
|
||||
text += f"预期博弈: 时窗({sig_obj.expected_horizon}), 预期差({sig_obj.price_in_status})\n"
|
||||
|
||||
tickers = ", ".join([f"{t.get('name')}({t.get('ticker')})" for t in sig_obj.impact_tickers])
|
||||
if tickers:
|
||||
text += f"受影响标的: {tickers}\n"
|
||||
|
||||
# Stable bibliography-style citation keys (LaTeX/BibTeX-like)
|
||||
if cite_keys:
|
||||
joined = " ".join([f"[@{k}]" for k in cite_keys if k])
|
||||
if joined:
|
||||
text += f"引用: {joined}\n"
|
||||
|
||||
return text
|
||||
|
||||
def get_cluster_planner_instructions(signals_text: str, user_query: str = None) -> str:
|
||||
"""生成信号聚类指令 - 将零散信号组织成逻辑主题"""
|
||||
query_context = f"用户重点关注:{user_query}" if user_query else ""
|
||||
return f"""你是一位资深的金融研报主编。你的任务是将以下零散的金融信号聚类成 3-5 个核心逻辑主题,以便撰写一份结构清晰的研报。
|
||||
|
||||
{query_context}
|
||||
|
||||
### 输入信号列表
|
||||
{signals_text}
|
||||
|
||||
### 聚类要求
|
||||
1. **主题聚合**: 将相关性强的信号归为一组(例如:都涉及“建筑安全法规”或“某产业链上下游”)。
|
||||
2. **叙事逻辑**: 只需要生成主题名称和包含的信号 ID。
|
||||
3. **控制数量**: 将所有信号归类到 3-5 个主要主题中,不要遗漏。
|
||||
|
||||
### 输出格式 (JSON)
|
||||
请仅输出以下 JSON 格式,不要包含 Markdown 标记:
|
||||
{{
|
||||
"clusters": [
|
||||
{{
|
||||
"theme_title": "主题名称(如:建筑安全法规收紧引发的产业链重构)",
|
||||
"signal_ids": [1, 3, 5],
|
||||
"rationale": "这些信号都指向政府对高层建筑防火标准的政策调整..."
|
||||
}},
|
||||
...
|
||||
]
|
||||
}}
|
||||
"""
|
||||
|
||||
def get_report_planner_instructions(toc: str, signal_count: int, user_query: str = None) -> str:
|
||||
"""生成报告规划指令 - 重点在于逻辑关联与分歧识别"""
|
||||
# ... (原有逻辑保持不变,但实际在新的聚类流程后这个可能作为备用或二次优化)
|
||||
query_context = f"用户重点关注:{user_query}" if user_query else ""
|
||||
return f"""你是一位资深的金融研报主编。你的任务是根据现有的草稿章节,规划出一份逻辑严密、穿透力强的终稿结构。
|
||||
|
||||
### 任务核心:
|
||||
1. **识别主线**: 从草稿中识别出贯穿多个章节的“核心逻辑主线”(如:产业链共振、货币政策转向)。
|
||||
2. **分歧评估 (Entropy)**: 识别各章节中观点冲突或确定性不一之处,规划如何在正文中呈现这些“分歧点”。
|
||||
3. **结构蓝图**:
|
||||
- 定义一级标题(逻辑主题)。
|
||||
- 归类章节:哪些信号应放入同一主题下深度解析?
|
||||
- 排序:将 ISQ 强度最高、与{query_context}最相关的信号置前。
|
||||
|
||||
### 现有草稿目录 (TOC)
|
||||
{toc}
|
||||
|
||||
请输出你的【终稿修订大纲】(Markdown 格式)。
|
||||
"""
|
||||
|
||||
# 2. 撰写阶段 (Section Writing)
|
||||
def get_report_writer_instructions(theme_title: str, signal_cluster_text: str, signal_indices: list, price_context: str = "", user_query: str = None) -> str:
|
||||
"""生成 Writer Agent 指令 - 基于主题聚类撰写综合分析"""
|
||||
|
||||
price_info = f"\n### 近期价格参考\n{price_context}\n" if price_context else ""
|
||||
query_context = f"\n**用户意图**: \"{user_query}\"\n请确保分析内容回应了用户的关注点。\n" if user_query else ""
|
||||
isq_block = generate_isq_prompt_section(include_header=False)
|
||||
|
||||
# Keep citation scheme stable across re-ordering / edits.
|
||||
# Cite keys are provided in each signal block as: 引用: [@KEY]
|
||||
|
||||
return f"""你是一位资深金融分析师。请针对核心主题 **"{theme_title}"** 撰写一篇深度研报章节。
|
||||
{query_context}
|
||||
|
||||
### 输入信号集 (本章节需综合的信号)
|
||||
{signal_cluster_text}
|
||||
{price_info}
|
||||
|
||||
### ISQ 评分说明
|
||||
{isq_block}
|
||||
|
||||
### 写作要求
|
||||
1. **叙事逻辑**: 不要罗列信号,要将这些信号编织成一个连贯的故事。先讲宏观/行业背景,再讲具体事件传导,最后落脚到个股/标的影响。
|
||||
2. **量化支撑**: 引用 ISQ 评分(确定性、强度、预期差)来佐证你的观点。关键观点必须关联相应的 ISQ 分值。
|
||||
3. **引用规范(稳定 CiteKey)**: 关键论断必须标注来源引用,使用 `[@CITE_KEY]` 格式。
|
||||
- CiteKey 已在输入信号块中以 `引用: [@KEY]` 提供,请直接复制使用。
|
||||
- 不要使用 `[[1]]` 这类不稳定编号。
|
||||
4. **关联标的预测**: **必须**在章节末尾明确给出受影响标的的预测分析,包括:
|
||||
- 至少列出 1-2 个相关上市公司代码(如 600519.SH)
|
||||
- 给出短期(T+3或T+5)的方向性判断
|
||||
- 如果可能,给出预期价格区间或涨跌幅预测
|
||||
|
||||
### 【重要】标题层级规范
|
||||
|
||||
❌ **错误示例**(绝对不要这样):
|
||||
```markdown
|
||||
# {theme_title}
|
||||
|
||||
### 宏观背景
|
||||
...
|
||||
```
|
||||
|
||||
✅ **正确示例**(必须这样):
|
||||
```markdown
|
||||
## {theme_title}
|
||||
|
||||
### 宏观背景
|
||||
|
||||
近期全球经济环境...
|
||||
|
||||
### 具体传导机制分析
|
||||
|
||||
...
|
||||
|
||||
### 核心标的分析
|
||||
|
||||
建议关注:贵州茅台(600519.SH)...
|
||||
```
|
||||
|
||||
**关键要求**:
|
||||
- 章节主标题使用 `##` (H2)
|
||||
- 章节子标题使用 `###` (H3)
|
||||
- **绝对禁止**使用 `#` (H1)
|
||||
- 第一行必须是 `## {theme_title}` 开头
|
||||
|
||||
### 核心:图表叙事 (Visual Storytelling)
|
||||
**必须**在文中插入至少 1-2 个图表,且图表必须与上下文紧密结合(不要堆砌在末尾)。
|
||||
|
||||
### 宏观背景
|
||||
...
|
||||
```
|
||||
|
||||
✅ **正确示例**(必须这样):
|
||||
```markdown
|
||||
## {theme_title}
|
||||
|
||||
### 宏观背景
|
||||
|
||||
近期全球经济环境...
|
||||
|
||||
### 具体传导机制分析
|
||||
|
||||
...
|
||||
|
||||
### 核心标的分析
|
||||
|
||||
建议关注:贵州茅台(600519.SH)...
|
||||
```
|
||||
|
||||
**关键要求**:
|
||||
- 章节主标题使用 `##` (H2)
|
||||
- 章节子标题使用 `###` (H3)
|
||||
- **绝对禁止**使用 `#` (H1)
|
||||
- 第一行必须是 `## {theme_title}` 开头
|
||||
|
||||
### 核心:图表叙事 (Visual Storytelling)
|
||||
**必须**在文中插入至少 1-2 个图表,且图表必须与上下文紧密结合(不要堆砌在末尾)。
|
||||
|
||||
**可选图表类型 (请根据内容选择最合适的 1-2 种):**
|
||||
|
||||
**A. AI 预测 + 走势 (Forecast) - 【强烈推荐 / 最新规范】**
|
||||
*适用*: 当文中明确提及某上市公司时,**必须**使用此图表展示股价走势与 AI 预测。
|
||||
*必填字段*:
|
||||
- `ticker`: 股票代码,A股 6 位 / 港股 5 位,允许带后缀(如 "002371.SZ"、"9868.HK")
|
||||
- `pred_len`: 预测交易日长度(建议 3 或 5)
|
||||
*代码示例*:
|
||||
```json-chart
|
||||
{{"type": "forecast", "ticker": "002371.SZ", "title": "北方华创(002371)T+5 预测", "pred_len": 5}}
|
||||
```
|
||||
**重要**:禁止手写 `prediction` 数组(预测由系统自动生成并渲染)。
|
||||
*注意*: 如果提及多只股票,应为每只生成独立的 forecast 图表。
|
||||
|
||||
**【推荐写法:多情景 → 最终归因 → 产出唯一预测图】**
|
||||
你可以在正文里描述多种情景(如:基准/乐观/悲观),但在插入预测图之前,必须明确给出“本报告最终选择的最可能情景”及其归因,然后用 `forecast` 图表做最终总结。
|
||||
为了让系统把“最终归因”可靠地传递给预测模块,请在 `forecast` JSON 中可选补充以下字段(字段均为可选,越完整越好):
|
||||
- `selected_scenario`: 最可能情景名称(如 "基准" / "乐观" / "悲观")
|
||||
- `selection_reason`: 选择该情景的归因理由(1-3 句)
|
||||
- `scenarios`: 情景列表(数组),每个元素可包含 `name`、`description`、`probability`(0-1)
|
||||
*示例*:
|
||||
```json-chart
|
||||
{{
|
||||
"type": "forecast",
|
||||
"ticker": "002371.SZ",
|
||||
"title": "北方华创(002371)T+5 预测(基准情景)",
|
||||
"pred_len": 5,
|
||||
"selected_scenario": "基准",
|
||||
"selection_reason": "结合订单能见度与行业景气,基准情景概率最高;短期扰动主要来自估值与市场风险偏好。",
|
||||
"scenarios": [
|
||||
{{"name": "乐观", "description": "国产替代与资本开支超预期", "probability": 0.25}},
|
||||
{{"name": "基准", "description": "订单稳健、利润率小幅波动", "probability": 0.55}},
|
||||
{{"name": "悲观", "description": "需求回落或交付节奏放缓", "probability": 0.20}}
|
||||
]
|
||||
}}
|
||||
```
|
||||
|
||||
**B. 历史走势 (Stock) - 仅作为兼容兜底**
|
||||
*适用*: 当你无法给出预测时(例如无法确定标的),可仅展示历史走势。
|
||||
*代码示例*:
|
||||
```json-chart
|
||||
{{"type": "stock", "ticker": "002371", "title": "北方华创历史走势"}}
|
||||
```
|
||||
|
||||
**C. 舆情情绪演变 (Sentiment Trend)**
|
||||
*适用*: 当讨论行业政策、突发事件(如“火灾”、“新规”)的民意变化时。
|
||||
*注意*: `keywords` 必须是事件核心词。
|
||||
*代码*:
|
||||
```json-chart
|
||||
{{"type": "sentiment", "keywords": ["建筑安全", "防火标准"], "title": "市场对防火新规的情绪演变"}}
|
||||
```
|
||||
|
||||
**D. 逻辑传导链条 (Transmission Chain)**
|
||||
*适用*: 复杂的蝴蝶效应分析(支持分支结构)。
|
||||
*代码*:
|
||||
```json-chart
|
||||
{{
|
||||
"type": "transmission",
|
||||
"nodes": [
|
||||
{{"node_name": "突发火灾", "impact_type": "中性", "logic": "事件发端"}},
|
||||
{{"node_name": "监管收紧", "impact_type": "利空", "logic": "合规成本上升", "source": "突发火灾"}},
|
||||
{{"node_name": "设备升级", "impact_type": "利好", "logic": "采购需求释放", "source": "突发火灾"}},
|
||||
{{"node_name": "龙头受益", "impact_type": "利好", "logic": "市占率提升", "source": "设备升级"}}
|
||||
],
|
||||
"title": "火灾事件的逻辑传导与分支"
|
||||
}}
|
||||
```
|
||||
*说明*: 使用 `source` 字段指定父节点名称以创建分支结构。
|
||||
|
||||
**E. 信号质量评估 (ISQ Radar)**
|
||||
*适用*: 对某个关键信号进行多维度(确定性、预期差等)定性评估时。
|
||||
*代码*:
|
||||
```json-chart
|
||||
{{"type": "isq", "sentiment": 0.8, "confidence": 0.9, "intensity": 4, "expectation_gap": 0.7, "timeliness": 0.9, "title": "核心信号质量评估"}}
|
||||
```
|
||||
"""
|
||||
|
||||
# 3. 整合阶段 (Final Assembly) - 原版,保留用于 fallback
|
||||
def get_report_editor_instructions(draft_sections: str, plan: str, sources_list: str) -> str:
|
||||
"""生成最终编辑指令 - 根据规划蓝图重组内容"""
|
||||
return f"""你是一位专业的研报编辑。请将以下基于主题撰写的草稿章节整合成最终研报。
|
||||
|
||||
### 原始草稿内容
|
||||
{draft_sections}
|
||||
|
||||
### 原始引用来源
|
||||
{sources_list}
|
||||
|
||||
### 任务与要求
|
||||
1. **结构化**: 为每个草稿章节添加合适的 Markdown 标题 (## 级别)。
|
||||
2. **连贯性**: 确保章节之间过渡自然。
|
||||
3. **完整性**:
|
||||
- 必须保留所有 `json-chart` 代码块(图表配置)。
|
||||
- 必须保留引用标注 `[@CITE_KEY]`。
|
||||
- 生成 `## 核心观点摘要`、`## 参考文献` 和 `## 风险提示`。
|
||||
|
||||
### 输出
|
||||
只输出最终的 Markdown 研报内容。
|
||||
"""
|
||||
|
||||
|
||||
# 4. 单节编辑 (Incremental Section Editing with RAG)
|
||||
def get_section_editor_instructions(section_index: int, total_sections: int, toc: str) -> str:
|
||||
"""生成单节编辑 prompt,支持 RAG 工具调用"""
|
||||
return f"""你是一位研报编辑。你正在编辑报告的第 {section_index}/{total_sections} 节。
|
||||
|
||||
### 当前目录 (TOC)
|
||||
{toc}
|
||||
|
||||
### 你的任务
|
||||
1. 润色当前章节内容,确保逻辑清晰、语言专业。
|
||||
2. 保留所有 `[@CITE_KEY](#ref-CITE_KEY)` 或 `[@CITE_KEY]` 格式的引用。
|
||||
3. 保留所有 `json-chart` 代码块,不做修改。
|
||||
4. 如果需要参考其他章节内容,使用 `search_context` 工具搜索。
|
||||
5. 只输出编辑后的章节内容,不要输出其他章节。
|
||||
|
||||
### 【关键】标题层级规范
|
||||
**严格遵守以下规则:**
|
||||
- 章节主标题使用 `##` (H2)
|
||||
- 章节子标题使用 `###` (H3)
|
||||
- **禁止使用** `#` (H1) - 只有报告大标题可以使用 H1
|
||||
- 如果原文中有 H1,必须将其降级为 H2
|
||||
- 不要输出与 "参考文献"、"风险提示" 相同的标题
|
||||
|
||||
直接输出编辑后的 Markdown 内容。
|
||||
"""
|
||||
|
||||
|
||||
# 5. 摘要生成 (Summary Generation)
|
||||
def get_summary_generator_instructions(toc: str, section_summaries: str) -> str:
|
||||
"""生成报告摘要指令 - 包含市场分歧度分析"""
|
||||
return f"""你是一位资深研报主笔。请生成今日报告的核心观点摘要的**正文内容**。
|
||||
|
||||
### 章节摘要
|
||||
{section_summaries}
|
||||
|
||||
### 任务:
|
||||
1. **核心逻辑提炼**: 用 150 字以内总结今日最核心的投资主线。
|
||||
2. **分歧识别**: 如果不同信号对同一板块有冲突观点,请明确指出"市场分歧点"。
|
||||
3. **确定性排序**: 标记出今日确定性最高的前两个机会(需列出具体标的代码)。
|
||||
|
||||
### 【重要】输出格式规范:
|
||||
|
||||
❌ **错误示例**(不要遗漏二级标题):
|
||||
```markdown
|
||||
### 核心逻辑提炼
|
||||
...
|
||||
```
|
||||
|
||||
✅ **正确示例**(应该这样输出):
|
||||
```markdown
|
||||
## 核心观点摘要
|
||||
|
||||
### 核心逻辑提炼
|
||||
|
||||
科技自立战略加速半导体设备国产化,叠加AI算力需求爆发...
|
||||
|
||||
### 市场分歧点
|
||||
|
||||
资本市场波动显示医药、新能源等板块估值逻辑受政策敏感性增强...
|
||||
|
||||
### 确定性排序
|
||||
|
||||
1. **网络安全替代需求**(ISQ确定性0.85,推荐标的:深信服 300454.SZ)
|
||||
2. **半导体设备材料**(ISQ确定性0.75,推荐标的:北方华创 002371.SZ)
|
||||
```
|
||||
|
||||
### 关键要求:
|
||||
- 第一行必须是 `## 核心观点摘要`
|
||||
- 主体部分使用 H3 (`###`) 和 H4 (`####`) 级别标题
|
||||
- **必须**包含 `## 核心观点摘要` 这一级标题
|
||||
|
||||
现在请按照正确示例的格式输出摘要内容。
|
||||
"""
|
||||
|
||||
|
||||
# 6. 最终组装 (Final Assembly with Sections)
|
||||
def get_final_assembly_instructions(sources_list: str) -> str:
|
||||
"""生成最终报告组装的 prompt"""
|
||||
return f"""你是一位研报主笔。请完成以下任务:
|
||||
|
||||
### 任务
|
||||
1. 生成 "## 参考文献" 章节(需要按照顺序,顺序不对时进行调整):
|
||||
- 原始来源:
|
||||
{sources_list}
|
||||
- 格式:`<a id="ref-CITE_KEY"></a>[@CITE_KEY] 标题 (来源), [链接地址]`
|
||||
2. 生成 "## 风险提示" (标准免责声明)。
|
||||
3. 生成 "## 快速扫描" 表格,汇总各主题的核心观点。
|
||||
- 表格列:**主题**, **核心观点**, **强度(Intensity)**, **确定性(Confidence)**。
|
||||
- 强度和确定性请参考原章节中的 ISQ 评分。
|
||||
|
||||
只输出上述三个章节的 Markdown 内容。
|
||||
"""
|
||||
|
||||
def get_cluster_task(signals_preview: str) -> str:
|
||||
"""生成聚类任务描述"""
|
||||
return f"请对以下信号进行主题聚类:\n\n{signals_preview}"
|
||||
|
||||
def get_writer_task(theme_title: str) -> str:
|
||||
"""生成撰写任务描述"""
|
||||
return f"请依据主题 '{theme_title}' 和 输入信号集 开始撰写深度分析章节。"
|
||||
|
||||
def get_planner_task() -> str:
|
||||
"""生成规划任务描述"""
|
||||
return "请阅读现有草稿并规划终稿大纲,识别核心逻辑主线和市场分歧点。"
|
||||
|
||||
def get_editor_task() -> str:
|
||||
"""生成编辑任务描述"""
|
||||
return "请根据规划大纲和草稿内容,生成最终研报。确保逻辑连贯,保留所有图表和引用。"
|
||||
|
||||
156
skills/alphaear-predictor/scripts/prompts/trend_agent.py
Normal file
156
skills/alphaear-predictor/scripts/prompts/trend_agent.py
Normal file
@@ -0,0 +1,156 @@
|
||||
from typing import Any
|
||||
from datetime import datetime
|
||||
from .isq_prompt_generator import generate_isq_prompt_section
|
||||
|
||||
def get_trend_scanner_instructions() -> str:
|
||||
"""生成趋势扫描员 (Scanner) 的系统指令"""
|
||||
current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
return f"""你是一名专业的数据扫描员,当前时间是 {current_time}。
|
||||
你的任务是利用各种工具从互联网和数据库中获取最新的金融新闻、热点趋势和市场数据。
|
||||
|
||||
### 1. 核心职责
|
||||
1. **多源采集**: 使用 `news_toolkit` 获取最新新闻,使用 `stock_toolkit` 获取行情,使用 `polymarket_toolkit` 获取预测市场数据。
|
||||
2. **情绪感知**: 使用 `sentiment_toolkit` 对关键新闻进行情绪分析。
|
||||
3. **深度搜索**: 针对模糊的热点,使用 `search_toolkit` 进行全网搜索补充细节。
|
||||
|
||||
### 2. 工具使用规范
|
||||
- **广度优先**: 尽可能覆盖多个数据源。
|
||||
- **数据新鲜度**: 优先获取最近 24 小时内的信息。
|
||||
- **结构化输出**: 整理搜集到的原始数据,为后续评估提供清晰的素材。
|
||||
"""
|
||||
|
||||
def get_trend_evaluator_instructions() -> str:
|
||||
"""生成趋势评估员 (Evaluator) 的系统指令"""
|
||||
current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
isq_block = generate_isq_prompt_section(include_header=True)
|
||||
|
||||
return f"""
|
||||
你是一名顶级的金融情报专家 (TrendAgent),擅长从海量信息中识别具有深度价值的"二级市场投资信号"。
|
||||
当前时间:{current_time}
|
||||
|
||||
### 核心使命:
|
||||
不仅是发现"热点",更要解析"信号"。你需要识别那些能触发**传导链条 (Transmission Chain)** 且具有**高确定性 (Confidence)** 的事件。
|
||||
|
||||
{isq_block}
|
||||
|
||||
### 核心能力与标准:
|
||||
1. **信号识别 (Signal Discovery)**: 基于扫描员提供的素材,识别具有投资价值的信号。优先关注政策、产业变革、重大诉求及跨境套利机会。
|
||||
2. **逻辑相干性**: 是否具备清晰的"原因-结果"传导?
|
||||
3. **影响力系数**: 是否会引发板块性的联动或财务指标的实质性扰动?
|
||||
4. **市场认知差**: 市场是否已提前消化(Price-in)?寻找尚未被充分交易的"Alpha"。
|
||||
5. **实体穿透**: 必须关联到具体的 Ticker 或核心产业链节点。
|
||||
|
||||
### 严禁事项:
|
||||
- 严禁编造数据。
|
||||
- 严禁仅输出情绪极性(Positive/Negative),必须带有逻辑依据。
|
||||
- 严禁将纯娱乐或单纯的社会负面事件(除非具有宏观破坏性)视为金融信号。
|
||||
|
||||
### 输出要求:
|
||||
你发现的每个信号应包含:
|
||||
- **核心摘要**: 穿透表象的逻辑总结。
|
||||
- **传导节点**: A -> B -> C 的逻辑推导。
|
||||
- **推荐关注**: 板块或 Ticker。
|
||||
- **ISQ 评估**: 基于模板的 5 个维度进行初步评分(具体评分由后续 FinAgent 完成)。
|
||||
"""
|
||||
|
||||
def get_trend_agent_instructions() -> str:
|
||||
# 保持兼容性
|
||||
return get_trend_evaluator_instructions()
|
||||
|
||||
def get_trend_scan_task(task_description: str) -> str:
|
||||
"""生成扫描员的任务描述"""
|
||||
return f"请根据以下任务描述,搜集相关的原始数据和新闻:\n\n{task_description}"
|
||||
|
||||
def format_scan_context(scan_data: dict) -> str:
|
||||
"""将扫描员搜集的结构化数据格式化为评估员可读的文本"""
|
||||
if not scan_data:
|
||||
return "(未能搜集到原始数据)"
|
||||
|
||||
return f"""
|
||||
### 扫描数据概览
|
||||
- **热点话题**: {', '.join(scan_data.get('hot_topics', []))}
|
||||
- **情绪概览**: {scan_data.get('sentiment_overview', '未知')}
|
||||
- **关键新闻**: {len(scan_data.get('news_summaries', []))} 条
|
||||
- **数据摘要**: {scan_data.get('raw_data_summary', '无')}
|
||||
"""
|
||||
|
||||
def get_trend_eval_task(task_description: str, raw_data_str: str) -> str:
|
||||
"""生成评估员的任务描述"""
|
||||
return f"""请基于以下搜集到的原始数据,完成最终的分析任务:
|
||||
|
||||
任务描述: {task_description}
|
||||
|
||||
原始数据:
|
||||
{raw_data_str}
|
||||
|
||||
请识别出最具金融价值的信号,并给出评估理由。"""
|
||||
|
||||
def get_news_filter_instructions(news_count: int, depth: Any, user_query: str = None) -> str:
|
||||
"""生成新闻筛选 prompt,使用 FilterResult schema 加快推理并减少 token 消耗
|
||||
|
||||
Args:
|
||||
news_count: 输入新闻总数
|
||||
depth: 目标筛选数量,若为 auto 则由 LLM 自主判断
|
||||
user_query: 用户输入的查询/关注点(可选)
|
||||
"""
|
||||
|
||||
# 1. 深度控制逻辑
|
||||
if str(depth).lower() == 'auto':
|
||||
depth_guide = "的数量不设固定限制(建议 3-10 条),根据新闻含金量自动判断"
|
||||
limit_instruction = "宁缺毋滥,如果高价值信息很少,可以只选 1-2 条;如果都很重要,可以多选。"
|
||||
else:
|
||||
try:
|
||||
d_int = int(depth)
|
||||
depth_guide = f"约 {d_int} 条"
|
||||
limit_instruction = f"请尽量凑满 {d_int} 条,但如果剩余新闻全是噪音,则不必强行凑数。"
|
||||
except:
|
||||
depth_guide = "适量"
|
||||
limit_instruction = "根据内容价值判断。"
|
||||
|
||||
target_desc = f"筛选出最具投资分析价值的新闻({depth_guide})。"
|
||||
|
||||
# 2. 用户意图逻辑
|
||||
query_instruction = ""
|
||||
if user_query:
|
||||
target_desc = f"筛选出与用户意图【{user_query}】最相关的新闻。"
|
||||
query_instruction = f"""
|
||||
### 核心任务(High Priority):
|
||||
用户明确关注:"{user_query}"。
|
||||
1. **第一优先级**:必须包含所有与"{user_query}"直接或间接相关的新闻,不要遗漏。
|
||||
- 即使这些新闻看起来"价值不高",只要相关都要保留。
|
||||
2. **第二优先级**:在满足第一优先级后,如果名额未满,再补充其他重大的市场热点。
|
||||
"""
|
||||
|
||||
return f"""你是一名专业的金融情报精排师。你需要从给定的 {news_count} 条原始新闻流中,{target_desc}
|
||||
|
||||
{query_instruction}
|
||||
|
||||
### FSD (Financial Signal Density) 筛选准则:
|
||||
1. **逻辑传导性 (Transmission)**: 该新闻是否预示着一个明确的产业链传导逻辑?(如:上游涨价 -> 中游成本压力 -> 下游提价预期)
|
||||
2. **预期差 (Alpha Potential)**: 是否包含尚未被市场充分Price-in的新突发情况?
|
||||
3. **确定性 (Confidence)**: 信息来源是否权威?是否包含具体的财务数据、订单金额或明确的政策日期?
|
||||
4. **排除噪音**: 坚决剔除明星八卦、鸡汤文、以及无实质增量的"口号式"新闻。
|
||||
|
||||
### {limit_instruction}
|
||||
|
||||
### 快速有效性检查(TOKEN 优化):
|
||||
在开始详细筛选前,先快速判断:这 {news_count} 条新闻中是否至少包含 1 条有效的金融信号?
|
||||
- 如果全是无关内容(如体育、娱乐、纯生活信息),直接返回 "has_valid_signals": false
|
||||
- 如果有至少 1 条金融相关的新闻,再进行详细 FSD 筛选
|
||||
|
||||
### 输出格式(必须为 JSON,使用 FilterResult schema):
|
||||
```json
|
||||
{{
|
||||
"has_valid_signals": true/false,
|
||||
"selected_ids": ["id_1", "id_2", ...],
|
||||
"themes": [
|
||||
{{
|
||||
"name": "高概括性主题",
|
||||
"news_ids": ["相关id_1", ...],
|
||||
"fsd_reason": "基于 FSD 准则的筛选理由,重点描述传导逻辑和预期差。"
|
||||
}}
|
||||
],
|
||||
"reason": "如果 has_valid_signals=false,简要说明原因。否则可为空。"
|
||||
}}
|
||||
```
|
||||
"""
|
||||
47
skills/alphaear-predictor/scripts/prompts/visualizer.py
Normal file
47
skills/alphaear-predictor/scripts/prompts/visualizer.py
Normal file
@@ -0,0 +1,47 @@
|
||||
def get_drawio_system_prompt():
|
||||
return """You are an expert at creating Draw.io (MxGraph) diagrams in XML format.
|
||||
Your task is to generate a valid MXGraphModel XML based on the user's description.
|
||||
|
||||
### Rules:
|
||||
1. Output ONLY the XML code. Start with <mxGraphModel> and end with </mxGraphModel>.
|
||||
2. Do not use compressed XML. Use plain XML.
|
||||
3. Use standard shapes: 'rounded=1;whiteSpace=wrap;html=1;' for boxes.
|
||||
4. Auto-layout Strategy:
|
||||
- Identify "layers" or "stages" in the logic.
|
||||
- Assign X coordinates based on layers (e.g., 0, 200, 400).
|
||||
- Assign Y coordinates to distribute nodes vertically (e.g., 0, 100, 200).
|
||||
- Ensure nodes do not overlap.
|
||||
5. Edges: Connect nodes logically using <mxCell edge="1" ...>.
|
||||
|
||||
### Template:
|
||||
<mxGraphModel dx="1000" dy="1000" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0"/>
|
||||
<mxCell id="1" parent="0"/>
|
||||
|
||||
<!-- Node -->
|
||||
<mxCell id="n1" value="Node Label" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1">
|
||||
<mxGeometry x="100" y="100" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
|
||||
<!-- Edge -->
|
||||
<mxCell id="e1" value="Connection" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="n1" target="n2">
|
||||
<mxGeometry relative="1" as="geometry"/>
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
"""
|
||||
|
||||
def get_drawio_task(nodes_data: list, title: str) -> str:
|
||||
import json
|
||||
nodes_json = json.dumps(nodes_data, ensure_ascii=False, indent=2)
|
||||
return f"""Please generate a Draw.io XML diagram for the following logic flow:
|
||||
|
||||
**Title**: {title}
|
||||
|
||||
**Nodes and Logic**:
|
||||
{nodes_json}
|
||||
|
||||
Ensure the layout flows logically from Left to Right (or Top to Bottom for hierarchies).
|
||||
Use different colors for 'Positive' (Greenish), 'Negative' (Reddish), and 'Neutral' (Grey/Blue) impacts if described.
|
||||
"""
|
||||
Reference in New Issue
Block a user