fix bug
This commit is contained in:
@@ -39,7 +39,7 @@ func main() {
|
|||||||
if model.StScore > 0 && model.IndustryScore > 0 && model.GtPrice > 0 && model.GtAmount > 0 && model.GtRoe > 0 && model.ScoreRsi > 0 {
|
if model.StScore > 0 && model.IndustryScore > 0 && model.GtPrice > 0 && model.GtAmount > 0 && model.GtRoe > 0 && model.ScoreRsi > 0 {
|
||||||
stratRule.RunAi(code)
|
stratRule.RunAi(code)
|
||||||
} else {
|
} else {
|
||||||
model.AiScrore = -2
|
model.AiScore = -2
|
||||||
model.AddDesc("无需AI分析")
|
model.AddDesc("无需AI分析")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,14 +20,14 @@ var (
|
|||||||
func (r *RuleFactory) RunAi(code string) {
|
func (r *RuleFactory) RunAi(code string) {
|
||||||
mdPath := MarkdataPath + code + ".md"
|
mdPath := MarkdataPath + code + ".md"
|
||||||
if !utils.PathExists(mdPath) {
|
if !utils.PathExists(mdPath) {
|
||||||
r.Model.AiScrore = -1
|
r.Model.AiScore = -1
|
||||||
r.Model.AddDesc(fmt.Sprintf("%s markdown 文件未找友", mdPath))
|
r.Model.AddDesc(fmt.Sprintf("%s markdown 文件未找友", mdPath))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
content, err := os.ReadFile(mdPath)
|
content, err := os.ReadFile(mdPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
r.Model.AiScrore = -1
|
r.Model.AiScore = -1
|
||||||
r.Model.AddDesc(fmt.Sprintf("%s markdown 读取错误,%v", mdPath, err))
|
r.Model.AddDesc(fmt.Sprintf("%s markdown 读取错误,%v", mdPath, err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ func (r *RuleFactory) RunAi(code string) {
|
|||||||
|
|
||||||
chatResp, err := client.CallChatCompletionsChat(context.Background(), chatReq)
|
chatResp, err := client.CallChatCompletionsChat(context.Background(), chatReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
r.Model.AiScrore = -1
|
r.Model.AiScore = -1
|
||||||
r.Model.AddDesc(fmt.Sprintf("处理失败: %v", err))
|
r.Model.AddDesc(fmt.Sprintf("处理失败: %v", err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ func (r *RuleFactory) RunAi(code string) {
|
|||||||
var result map[string]any
|
var result map[string]any
|
||||||
err = json.Unmarshal([]byte(jsonBodys), &result)
|
err = json.Unmarshal([]byte(jsonBodys), &result)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
r.Model.AiScrore = -1
|
r.Model.AiScore = -1
|
||||||
r.Model.AddDesc(fmt.Sprintf("Unmarshal: %v", err))
|
r.Model.AddDesc(fmt.Sprintf("Unmarshal: %v", err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@ func (r *RuleFactory) RunAi(code string) {
|
|||||||
r.Model.AiSummary2025 = result["summary_2025"].(string)
|
r.Model.AiSummary2025 = result["summary_2025"].(string)
|
||||||
r.Model.AiSummaryBase = result["summary_base"].(string)
|
r.Model.AiSummaryBase = result["summary_base"].(string)
|
||||||
r.Model.AiSummaryTech = result["summary_tech"].(string)
|
r.Model.AiSummaryTech = result["summary_tech"].(string)
|
||||||
r.Model.AiScrore = int(result["score"].(float64))
|
r.Model.AiScore = int(result["score"].(float64))
|
||||||
r.Model.AiSupportLevel = result["support_level"].(float64)
|
r.Model.AiSupportLevel = result["support_level"].(float64)
|
||||||
r.Model.AiResisLevel = result["resis_level"].(float64)
|
r.Model.AiResisLevel = result["resis_level"].(float64)
|
||||||
r.Model.AiAction = result["action"].(string)
|
r.Model.AiAction = result["action"].(string)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ type StratModel struct {
|
|||||||
AiSummary2025 string
|
AiSummary2025 string
|
||||||
AiSummaryBase string
|
AiSummaryBase string
|
||||||
AiSummaryTech string
|
AiSummaryTech string
|
||||||
AiScrore int
|
AiScore int
|
||||||
AiSupportLevel float64
|
AiSupportLevel float64
|
||||||
AiResisLevel float64
|
AiResisLevel float64
|
||||||
AiAction string
|
AiAction string
|
||||||
|
|||||||
Reference in New Issue
Block a user