Skip to content

Commit 8fe79ad

Browse files
committed
feat(stock):增加股票搜索结果数量并优化搜索条件
- 将随机返回的股票数量从5-10支增加到5-20支 - 更新测试用例中的搜索关键词,提高筛选条件准确性 - 调整搜索逻辑以适应新的数据范围和质量要求
1 parent 1d81fdb commit 8fe79ad

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

backend/agent/tools/choice_stock_by_indicators_tool.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import (
44
"context"
55
"encoding/json"
66
"fmt"
7+
"go-stock/backend/data"
8+
79
"github.com/cloudwego/eino/components/tool"
810
"github.com/cloudwego/eino/schema"
911
"github.com/duke-git/lancet/v2/convertor"
1012
"github.com/duke-git/lancet/v2/random"
11-
"go-stock/backend/data"
1213
)
1314

1415
// @Author spark
@@ -55,7 +56,7 @@ func (c ChoiceStockByIndicators) InvokableRun(ctx context.Context, argumentsInJS
5556
}
5657
content := "无符合条件的数据"
5758
words := parms["words"].(string)
58-
res := data.NewSearchStockApi(words).SearchStock(random.RandInt(5, 10))
59+
res := data.NewSearchStockApi(words).SearchStock(random.RandInt(5, 20))
5960
if convertor.ToString(res["code"]) == "100" {
6061
resData := res["data"].(map[string]any)
6162
result := resData["result"].(map[string]any)

backend/data/openai_api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ func AskAiWithTools(o *OpenAi, err error, messages []map[string]interface{}, ch
11551155
}
11561156

11571157
content := "无符合条件的数据"
1158-
res := NewSearchStockApi(words).SearchStock(random.RandInt(5, 10))
1158+
res := NewSearchStockApi(words).SearchStock(random.RandInt(5, 20))
11591159
if convertor.ToString(res["code"]) == "100" {
11601160
resData := res["data"].(map[string]any)
11611161
result := resData["result"].(map[string]any)

backend/data/search_stock_api_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
func TestSearchStock(t *testing.T) {
1313
db.Init("../../data/stock.db")
1414

15-
res := NewSearchStockApi("算力股;净利润连续3年增长").SearchStock(10)
15+
res := NewSearchStockApi("量比大于2,基本面优秀,2025年三季报已披露,主力连续3日净流入,非创业板非科创板非ST").SearchStock(20)
1616
logger.SugaredLogger.Infof("res:%+v", res)
1717
data := res["data"].(map[string]any)
1818
result := data["result"].(map[string]any)

0 commit comments

Comments
 (0)