Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -230,7 +230,7 @@ def query_financial_data(company_name, query_type):
|
|
| 230 |
# 先搜索公司(使用 advanced_search_company)
|
| 231 |
try:
|
| 232 |
search_resp = session.post(
|
| 233 |
-
f"{MCP_URL}/
|
| 234 |
json={
|
| 235 |
"jsonrpc": "2.0",
|
| 236 |
"method": "tools/call",
|
|
@@ -277,7 +277,7 @@ def query_financial_data(company_name, query_type):
|
|
| 277 |
# 根据查询类型获取数据
|
| 278 |
if internal_query_type == "最新财务数据":
|
| 279 |
data_resp = session.post(
|
| 280 |
-
f"{MCP_URL}/
|
| 281 |
json={
|
| 282 |
"jsonrpc": "2.0",
|
| 283 |
"method": "tools/call",
|
|
@@ -325,7 +325,7 @@ def query_financial_data(company_name, query_type):
|
|
| 325 |
|
| 326 |
elif internal_query_type == "3年趋势":
|
| 327 |
metrics_resp = session.post(
|
| 328 |
-
f"{MCP_URL}/
|
| 329 |
json={
|
| 330 |
"jsonrpc": "2.0",
|
| 331 |
"method": "tools/call",
|
|
@@ -409,7 +409,7 @@ def query_financial_data(company_name, query_type):
|
|
| 409 |
|
| 410 |
elif internal_query_type == "5年趋势":
|
| 411 |
metrics_resp = session.post(
|
| 412 |
-
f"{MCP_URL}/
|
| 413 |
json={
|
| 414 |
"jsonrpc": "2.0",
|
| 415 |
"method": "tools/call",
|
|
@@ -493,7 +493,7 @@ def query_financial_data(company_name, query_type):
|
|
| 493 |
elif internal_query_type == "公司报表列表":
|
| 494 |
# 查询公司所有报表
|
| 495 |
filings_resp = session.post(
|
| 496 |
-
f"{MCP_URL}/
|
| 497 |
json={
|
| 498 |
"jsonrpc": "2.0",
|
| 499 |
"method": "tools/call",
|
|
@@ -555,9 +555,9 @@ def query_financial_data(company_name, query_type):
|
|
| 555 |
def call_mcp_tool(tool_name, arguments):
|
| 556 |
"""调用 MCP 工具并返回结果"""
|
| 557 |
try:
|
| 558 |
-
# FastMCP
|
| 559 |
response = session.post(
|
| 560 |
-
f"{MCP_URL}/
|
| 561 |
json={
|
| 562 |
"jsonrpc": "2.0",
|
| 563 |
"method": "tools/call",
|
|
|
|
| 230 |
# 先搜索公司(使用 advanced_search_company)
|
| 231 |
try:
|
| 232 |
search_resp = session.post(
|
| 233 |
+
f"{MCP_URL}/mcp",
|
| 234 |
json={
|
| 235 |
"jsonrpc": "2.0",
|
| 236 |
"method": "tools/call",
|
|
|
|
| 277 |
# 根据查询类型获取数据
|
| 278 |
if internal_query_type == "最新财务数据":
|
| 279 |
data_resp = session.post(
|
| 280 |
+
f"{MCP_URL}/mcp",
|
| 281 |
json={
|
| 282 |
"jsonrpc": "2.0",
|
| 283 |
"method": "tools/call",
|
|
|
|
| 325 |
|
| 326 |
elif internal_query_type == "3年趋势":
|
| 327 |
metrics_resp = session.post(
|
| 328 |
+
f"{MCP_URL}/mcp",
|
| 329 |
json={
|
| 330 |
"jsonrpc": "2.0",
|
| 331 |
"method": "tools/call",
|
|
|
|
| 409 |
|
| 410 |
elif internal_query_type == "5年趋势":
|
| 411 |
metrics_resp = session.post(
|
| 412 |
+
f"{MCP_URL}/mcp",
|
| 413 |
json={
|
| 414 |
"jsonrpc": "2.0",
|
| 415 |
"method": "tools/call",
|
|
|
|
| 493 |
elif internal_query_type == "公司报表列表":
|
| 494 |
# 查询公司所有报表
|
| 495 |
filings_resp = session.post(
|
| 496 |
+
f"{MCP_URL}/mcp",
|
| 497 |
json={
|
| 498 |
"jsonrpc": "2.0",
|
| 499 |
"method": "tools/call",
|
|
|
|
| 555 |
def call_mcp_tool(tool_name, arguments):
|
| 556 |
"""调用 MCP 工具并返回结果"""
|
| 557 |
try:
|
| 558 |
+
# FastMCP HTTP Server 使用 /mcp 端点
|
| 559 |
response = session.post(
|
| 560 |
+
f"{MCP_URL}/mcp",
|
| 561 |
json={
|
| 562 |
"jsonrpc": "2.0",
|
| 563 |
"method": "tools/call",
|