Skip to content

Commit defb1ec

Browse files
committed
fix(config): disable caching for all flow configurations
- Set enable_cache to false for history_calculate, crawl_url, extract_entities_code, execute_code, execute_shell, dashscope_search, tavily_search, mock_search flows - Update react_agent flow to use qwen3_30b_instruct LLM - Modify THS crawler flows to disable caching - Refine history calculate prompt to specify tushare pro.daily function usage - Add BaseException handling in common utilities
1 parent 0c93e58 commit defb1ec

4 files changed

Lines changed: 27 additions & 24 deletions

File tree

finance_mcp/config/default.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ http:
1313
flow:
1414
history_calculate:
1515
flow_content: HistoryCalculateOp()
16-
enable_cache: true
16+
enable_cache: false
1717
cache_expire_hours: 1
1818

1919
crawl_url:
2020
flow_content: Crawl4aiLongTextOp() >> ExtractLongTextOp()
21-
enable_cache: true
21+
enable_cache: false
2222
cache_expire_hours: 1
2323
description: "Web content parsing tool: retrieves and formats web page content based on the provided URL."
2424
input_schema:
@@ -29,37 +29,37 @@ flow:
2929

3030
extract_entities_code:
3131
flow_content: ExtractEntitiesCodeOp() << DashscopeSearchOp()
32-
enable_cache: true
32+
enable_cache: false
3333
cache_expire_hours: 1
3434

3535
execute_code:
3636
flow_content: ExecuteCodeOp()
37-
enable_cache: true
37+
enable_cache: false
3838
cache_expire_hours: 1
3939

4040
execute_shell:
4141
flow_content: ExecuteShellOp()
42-
enable_cache: true
42+
enable_cache: false
4343
cache_expire_hours: 1
4444

4545
dashscope_search:
4646
flow_content: DashscopeSearchOp()
47-
enable_cache: true
47+
enable_cache: false
4848
cache_expire_hours: 1
4949

5050
tavily_search:
5151
flow_content: TavilySearchOp()
52-
enable_cache: true
52+
enable_cache: false
5353
cache_expire_hours: 1
5454

5555
mock_search:
5656
flow_content: MockSearchOp()
57-
enable_cache: true
57+
enable_cache: false
5858
cache_expire_hours: 1
5959

6060
react_agent:
6161
flow_content: |
62-
ops = [HistoryCalculateOp(), ExtractEntitiesCodeOp() << DashscopeSearchOp(), DashscopeSearchOp()]
62+
ops = [HistoryCalculateOp(llm="qwen3_30b_instruct"), ExtractEntitiesCodeOp() << DashscopeSearchOp(), DashscopeSearchOp()]
6363
ReactAgentOp(add_think_tool=True) << ops
6464
6565
llm:

finance_mcp/config/ths.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ flow:
22
crawl_ths_company:
33
flow_content: |
44
ThsUrlOp(tag="company") >> Crawl4aiLongTextOp() >> ExtractLongTextOp()
5-
enable_cache: true
5+
enable_cache: false
66
cache_expire_hours: 1
77
description: "通过A股股票代码获取公司资料信息,例如:详细情况,高管介绍,发行相关,参控股公司,最后返回和query相关的信息。"
88
input_schema:
@@ -18,7 +18,7 @@ flow:
1818
crawl_ths_holder:
1919
flow_content: |
2020
ThsUrlOp(tag="holder") >> Crawl4aiLongTextOp() >> ExtractLongTextOp()
21-
enable_cache: true
21+
enable_cache: false
2222
cache_expire_hours: 1
2323
description: "通过A股股票代码获取股东研究信息,例如:股东人数、十大流通股东、十大股东、十大债券持有人、控股层级关系,最后返回和query相关的信息。"
2424
input_schema:
@@ -34,7 +34,7 @@ flow:
3434
crawl_ths_operate:
3535
flow_content: |
3636
ThsUrlOp(tag="operate") >> Crawl4aiLongTextOp() >> ExtractLongTextOp()
37-
enable_cache: true
37+
enable_cache: false
3838
cache_expire_hours: 1
3939
description: "通过A股股票代码获取经营分析信息,例如:主营介绍、运营业务数据、主营构成分析、主要客户及供应商、董事会经营评述、产品价格,最后返回和query相关的信息。"
4040
input_schema:
@@ -50,7 +50,7 @@ flow:
5050
crawl_ths_equity:
5151
flow_content: |
5252
ThsUrlOp(tag="equity") >> Crawl4aiLongTextOp() >> ExtractLongTextOp()
53-
enable_cache: true
53+
enable_cache: false
5454
cache_expire_hours: 1
5555
description: "通过A股股票代码获取股本结构信息,例如:解禁时间表、总股本构成、A股结构图、历次股本变动,最后返回和query相关的信息。"
5656
input_schema:
@@ -66,7 +66,7 @@ flow:
6666
crawl_ths_capital:
6767
flow_content: |
6868
ThsUrlOp(tag="capital") >> Crawl4aiLongTextOp() >> ExtractLongTextOp()
69-
enable_cache: true
69+
enable_cache: false
7070
cache_expire_hours: 1
7171
description: "通过A股股票代码获取资本运作信息,例如:募集资金来源、项目投资、收购兼并、股权投资、参股IPO、股权转让、关联交易、质押解冻,最后返回和query相关的信息。"
7272
input_schema:
@@ -82,7 +82,7 @@ flow:
8282
crawl_ths_worth:
8383
flow_content: |
8484
ThsUrlOp(tag="worth") >> Crawl4aiLongTextOp() >> ExtractLongTextOp()
85-
enable_cache: true
85+
enable_cache: false
8686
cache_expire_hours: 1
8787
description: "通过A股股票代码获取盈利预测信息,例如:业绩预测、业绩预测详表、研报评级,最后返回和query相关的信息。"
8888
input_schema:
@@ -98,7 +98,7 @@ flow:
9898
crawl_ths_news:
9999
flow_content: |
100100
ThsUrlOp(tag="news") >> Crawl4aiLongTextOp() >> ExtractLongTextOp()
101-
enable_cache: true
101+
enable_cache: false
102102
cache_expire_hours: 1
103103
description: "通过A股股票代码获取新闻公告信息,例如:新闻与股价联动、公告列表、热点新闻列表、研报列表,最后返回和query相关的信息。"
104104
input_schema:
@@ -114,7 +114,7 @@ flow:
114114
crawl_ths_concept:
115115
flow_content: |
116116
ThsUrlOp(tag="concept") >> Crawl4aiLongTextOp() >> ExtractLongTextOp()
117-
enable_cache: true
117+
enable_cache: false
118118
cache_expire_hours: 1
119119
description: "通过A股股票代码获取概念题材信息,例如:常规概念、其他概念、题材要点、概念对比,最后返回和query相关的信息。"
120120
input_schema:
@@ -130,7 +130,7 @@ flow:
130130
crawl_ths_position:
131131
flow_content: |
132132
ThsUrlOp(tag="position") >> Crawl4aiLongTextOp() >> ExtractLongTextOp()
133-
enable_cache: true
133+
enable_cache: false
134134
cache_expire_hours: 1
135135
description: "通过A股股票代码获取主力持仓信息,例如:机构持股汇总、机构持股明细、被举牌情况、IPO获配机构,最后返回和query相关的信息。"
136136
input_schema:
@@ -146,7 +146,7 @@ flow:
146146
crawl_ths_finance:
147147
flow_content: |
148148
ThsUrlOp(tag="finance") >> Crawl4aiLongTextOp() >> ExtractLongTextOp()
149-
enable_cache: true
149+
enable_cache: false
150150
cache_expire_hours: 1
151151
description: "通过A股股票代码获取财务分析信息,例如:财务诊断、财务指标、指标变动说明、资产负债构成、财务报告、杜邦分析,最后返回和query相关的信息。"
152152
input_schema:
@@ -162,7 +162,7 @@ flow:
162162
crawl_ths_bonus:
163163
flow_content: |
164164
ThsUrlOp(tag="bonus") >> Crawl4aiLongTextOp() >> ExtractLongTextOp()
165-
enable_cache: true
165+
enable_cache: false
166166
cache_expire_hours: 1
167167
description: "通过A股股票代码获取分红融资信息,例如:分红诊断、分红情况、增发机构获配明细、增发概况、配股概况,最后返回和query相关的信息。"
168168
input_schema:
@@ -178,7 +178,7 @@ flow:
178178
crawl_ths_event:
179179
flow_content: |
180180
ThsUrlOp(tag="event") >> Crawl4aiLongTextOp() >> ExtractLongTextOp()
181-
enable_cache: true
181+
enable_cache: false
182182
cache_expire_hours: 1
183183
description: "通过A股股票代码获取公司大事信息,例如:高管持股变动、股东持股变动、担保明细、违规处理、机构调研、投资者互动,最后返回和query相关的信息。"
184184
input_schema:
@@ -194,7 +194,7 @@ flow:
194194
crawl_ths_field:
195195
flow_content: |
196196
ThsUrlOp(tag="field") >> Crawl4aiLongTextOp() >> ExtractLongTextOp()
197-
enable_cache: true
197+
enable_cache: false
198198
cache_expire_hours: 1
199199
description: "通过A股股票代码获取行业对比信息,例如:行业地位、行业新闻,最后返回和query相关的信息。"
200200
input_schema:

finance_mcp/core/findata/history_calculate_prompt.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ code_prompt: |
3232
{current_date}
3333
3434
# 你的任务:写代码回答用户问题
35-
1. **通过A股股票代码和tushare工具获取数据**,该数据包含股票每日前复权行情(字段包括:日期、开盘、收盘、最高、最低、成交量、成交额、振幅、涨跌幅、涨跌额、换手率)。
35+
1. **通过A股股票代码和tushare工具(只有pro.daily函数)获取数据**,该数据包含股票每日前复权行情(字段包括:日期、开盘、收盘、最高、最低、成交量、成交额、振幅、涨跌幅、涨跌额、换手率)。
3636
2. **根据用户问题编写后续数据处理或分析代码**,使用 pandas 或其他必要库进行计算、筛选、统计等操作。
3737
3. **必须通过 `print(...)` 输出一个清晰、简洁、直接回答用户问题的结论**。输出内容应为人类可读的自然语言句子,不能仅输出DataFrame或原始数据。例如:根据前复权行情分析,该股票最近五日成交量相比前期有明显放量,平均成交量增长35%。MACD指标在最近五日出现金叉信号,DIF线上穿DEA线,显示短期趋势向好。
3838
@@ -53,7 +53,7 @@ code_prompt: |
5353
```
5454
5555
# 注意事项
56-
- 请使用tushare工具填入code等参数获取数据
56+
- 请使用tushare工具的pro.daily函数(不要使用别的函数),并填入code等参数获取数据
5757
- 所有代码必须可直接运行(请导入所需库);
5858
- 结论必须通过 `print()` 输出;
5959
- 请考虑提供的当前日期,如需计算“最近N天”或“今年以来”等时间范围,请以该日期为基准;

finance_mcp/core/utils/common_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,6 @@ def exec_code(code: str) -> str:
122122

123123
except Exception as e: # noqa: BLE001
124124
return str(e)
125+
126+
except BaseException as e:
127+
return str(e)

0 commit comments

Comments
 (0)