update pay promo

This commit is contained in:
2026-02-05 13:01:30 +08:00
parent 4d06611234
commit ede84b3290

View File

@@ -342,7 +342,7 @@ TOOLS: List[ToolDefinition] = [
parameters={ parameters={
"type": "object", "type": "object",
"properties": { "properties": {
"stock_code": { "code": {
"type": "string", "type": "string",
"description": "股票代码或名称" "description": "股票代码或名称"
}, },
@@ -361,7 +361,7 @@ TOOLS: List[ToolDefinition] = [
"default": True "default": True
} }
}, },
"required": ["stock_code"] "required": ["code"]
} }
), ),
ToolDefinition( ToolDefinition(
@@ -532,12 +532,12 @@ TOOLS: List[ToolDefinition] = [
parameters={ parameters={
"type": "object", "type": "object",
"properties": { "properties": {
"seccode": { "code": {
"type": "string", "type": "string",
"description": "股票代码例如600519" "description": "股票代码例如600519"
} }
}, },
"required": ["seccode"] "required": ["code"]
} }
), ),
ToolDefinition( ToolDefinition(
@@ -546,7 +546,7 @@ TOOLS: List[ToolDefinition] = [
parameters={ parameters={
"type": "object", "type": "object",
"properties": { "properties": {
"seccode": { "code": {
"type": "string", "type": "string",
"description": "股票代码" "description": "股票代码"
}, },
@@ -564,7 +564,7 @@ TOOLS: List[ToolDefinition] = [
"default": 10 "default": 10
} }
}, },
"required": ["seccode"] "required": ["code"]
} }
), ),
ToolDefinition( ToolDefinition(
@@ -573,7 +573,7 @@ TOOLS: List[ToolDefinition] = [
parameters={ parameters={
"type": "object", "type": "object",
"properties": { "properties": {
"seccode": { "code": {
"type": "string", "type": "string",
"description": "股票代码" "description": "股票代码"
}, },
@@ -591,7 +591,7 @@ TOOLS: List[ToolDefinition] = [
"default": 30 "default": 30
} }
}, },
"required": ["seccode"] "required": ["code"]
} }
), ),
ToolDefinition( ToolDefinition(
@@ -600,7 +600,7 @@ TOOLS: List[ToolDefinition] = [
parameters={ parameters={
"type": "object", "type": "object",
"properties": { "properties": {
"seccode": { "code": {
"type": "string", "type": "string",
"description": "股票代码" "description": "股票代码"
}, },
@@ -618,7 +618,7 @@ TOOLS: List[ToolDefinition] = [
"default": 8 "default": 8
} }
}, },
"required": ["seccode"] "required": ["code"]
} }
), ),
ToolDefinition( ToolDefinition(
@@ -627,7 +627,7 @@ TOOLS: List[ToolDefinition] = [
parameters={ parameters={
"type": "object", "type": "object",
"properties": { "properties": {
"seccode": { "code": {
"type": "string", "type": "string",
"description": "股票代码" "description": "股票代码"
}, },
@@ -645,7 +645,7 @@ TOOLS: List[ToolDefinition] = [
"default": 8 "default": 8
} }
}, },
"required": ["seccode"] "required": ["code"]
} }
), ),
ToolDefinition( ToolDefinition(
@@ -685,7 +685,7 @@ TOOLS: List[ToolDefinition] = [
parameters={ parameters={
"type": "object", "type": "object",
"properties": { "properties": {
"seccodes": { "codes": {
"type": "array", "type": "array",
"items": {"type": "string"}, "items": {"type": "string"},
"description": "股票代码列表至少2个" "description": "股票代码列表至少2个"
@@ -697,7 +697,7 @@ TOOLS: List[ToolDefinition] = [
"default": "financial" "default": "financial"
} }
}, },
"required": ["seccodes"] "required": ["codes"]
} }
), ),
ToolDefinition( ToolDefinition(
@@ -1555,10 +1555,7 @@ async def handle_get_concept_details(args: Dict[str, Any]) -> Any:
async def handle_get_stock_concepts(args: Dict[str, Any]) -> Any: async def handle_get_stock_concepts(args: Dict[str, Any]) -> Any:
"""处理股票概念获取(适配 concept_api_v4""" """处理股票概念获取(适配 concept_api_v4"""
# 兼容不同的参数名: stock_code, seccode, code stock_code = args["code"]
stock_code = args.get("stock_code") or args.get("seccode") or args.get("code")
if not stock_code:
raise ValueError("缺少股票代码参数 (stock_code/seccode/code)")
params = { params = {
"size": args.get("size", 50), "size": args.get("size", 50),
@@ -1676,10 +1673,7 @@ async def handle_get_stock_code_by_name(args: Dict[str, Any]) -> Any:
async def handle_get_stock_basic_info(args: Dict[str, Any]) -> Any: async def handle_get_stock_basic_info(args: Dict[str, Any]) -> Any:
"""处理股票基本信息查询""" """处理股票基本信息查询"""
# 兼容不同的参数名: seccode, stock_code, code seccode = args["code"]
seccode = args.get("seccode") or args.get("stock_code") or args.get("code")
if not seccode:
return {"success": False, "error": "缺少股票代码参数 (seccode/stock_code/code)"}
result = await db.get_stock_basic_info(seccode) result = await db.get_stock_basic_info(seccode)
if result: if result:
@@ -1689,7 +1683,7 @@ async def handle_get_stock_basic_info(args: Dict[str, Any]) -> Any:
async def handle_get_stock_financial_index(args: Dict[str, Any]) -> Any: async def handle_get_stock_financial_index(args: Dict[str, Any]) -> Any:
"""处理股票财务指标查询""" """处理股票财务指标查询"""
seccode = args["seccode"] seccode = args["code"]
start_date = args.get("start_date") start_date = args.get("start_date")
end_date = args.get("end_date") end_date = args.get("end_date")
limit = args.get("limit", 10) limit = args.get("limit", 10)
@@ -1703,7 +1697,7 @@ async def handle_get_stock_financial_index(args: Dict[str, Any]) -> Any:
async def handle_get_stock_trade_data(args: Dict[str, Any]) -> Any: async def handle_get_stock_trade_data(args: Dict[str, Any]) -> Any:
"""处理股票交易数据查询""" """处理股票交易数据查询"""
seccode = args["seccode"] seccode = args["code"]
start_date = args.get("start_date") start_date = args.get("start_date")
end_date = args.get("end_date") end_date = args.get("end_date")
limit = args.get("limit", 30) limit = args.get("limit", 30)
@@ -1717,7 +1711,7 @@ async def handle_get_stock_trade_data(args: Dict[str, Any]) -> Any:
async def handle_get_stock_balance_sheet(args: Dict[str, Any]) -> Any: async def handle_get_stock_balance_sheet(args: Dict[str, Any]) -> Any:
"""处理资产负债表查询""" """处理资产负债表查询"""
seccode = args["seccode"] seccode = args["code"]
start_date = args.get("start_date") start_date = args.get("start_date")
end_date = args.get("end_date") end_date = args.get("end_date")
limit = args.get("limit", 8) limit = args.get("limit", 8)
@@ -1731,7 +1725,7 @@ async def handle_get_stock_balance_sheet(args: Dict[str, Any]) -> Any:
async def handle_get_stock_cashflow(args: Dict[str, Any]) -> Any: async def handle_get_stock_cashflow(args: Dict[str, Any]) -> Any:
"""处理现金流量表查询""" """处理现金流量表查询"""
seccode = args["seccode"] seccode = args["code"]
start_date = args.get("start_date") start_date = args.get("start_date")
end_date = args.get("end_date") end_date = args.get("end_date")
limit = args.get("limit", 8) limit = args.get("limit", 8)
@@ -1762,10 +1756,10 @@ async def handle_search_stocks_by_criteria(args: Dict[str, Any]) -> Any:
async def handle_get_stock_comparison(args: Dict[str, Any]) -> Any: async def handle_get_stock_comparison(args: Dict[str, Any]) -> Any:
"""处理股票对比分析""" """处理股票对比分析"""
seccodes = args["seccodes"] codes = args["codes"]
metric = args.get("metric", "financial") metric = args.get("metric", "financial")
result = await db.get_stock_comparison(seccodes, metric) result = await db.get_stock_comparison(codes, metric)
return { return {
"success": True, "success": True,
"data": result "data": result
@@ -2202,8 +2196,8 @@ class MCPAgentIntegrated:
"goal": "对比分析两只股票的投资价值", "goal": "对比分析两只股票的投资价值",
"reasoning": "需要分别获取两只股票的数据,然后对比分析", "reasoning": "需要分别获取两只股票的数据,然后对比分析",
"steps": [ "steps": [
{{"tool": "get_stock_basic_info", "arguments": {{"stock_code": "600519"}}, "reason": "获取茅台基本信息"}}, {{"tool": "get_stock_basic_info", "arguments": {{"code": "600519"}}, "reason": "获取茅台基本信息"}},
{{"tool": "get_stock_basic_info", "arguments": {{"stock_code": "000858"}}, "reason": "获取五粮液基本信息"}}, {{"tool": "get_stock_basic_info", "arguments": {{"code": "000858"}}, "reason": "获取五粮液基本信息"}},
{{"tool": "search_china_news", "arguments": {{"query": "茅台 五粮液 对比", "top_k": 5}}, "reason": "搜索对比分析文章"}}, {{"tool": "search_china_news", "arguments": {{"query": "茅台 五粮液 对比", "top_k": 5}}, "reason": "搜索对比分析文章"}},
{{"tool": "summarize_news", "arguments": {{"data": "新闻", "focus": "投资价值对比"}}, "reason": "总结对比结论"}} {{"tool": "summarize_news", "arguments": {{"data": "新闻", "focus": "投资价值对比"}}, "reason": "总结对比结论"}}
] ]