diff --git a/backend/data/crawler_api_test.go b/backend/data/crawler_api_test.go index 2501552..e5c9524 100644 --- a/backend/data/crawler_api_test.go +++ b/backend/data/crawler_api_test.go @@ -105,7 +105,7 @@ func TestGetHtmlWithActions(t *testing.T) { } var messages []string document.Find("div.finance-hover,div.list-date").Each(func(i int, selection *goquery.Selection) { - text := strutil.RemoveNonPrintable(selection.Text()) + text := strutil.RemoveWhiteSpace(selection.Text(), false) messages = append(messages, text) logger.SugaredLogger.Infof("搜索到消息-%s: %s", "", text) }) diff --git a/backend/data/openai_api.go b/backend/data/openai_api.go index cada5e8..4ea4307 100644 --- a/backend/data/openai_api.go +++ b/backend/data/openai_api.go @@ -356,7 +356,7 @@ func SearchGuShiTongStockInfo(stock string, crawlTimeOut int64) *[]string { return &[]string{} } document.Find("div.finance-hover,div.list-date").Each(func(i int, selection *goquery.Selection) { - text := strutil.RemoveNonPrintable(selection.Text()) + text := strutil.RemoveWhiteSpace(selection.Text(), false) messages = append(messages, text) logger.SugaredLogger.Infof("SearchGuShiTongStockInfo搜索到消息-%s: %s", "", text) }) @@ -610,12 +610,13 @@ func (o OpenAi) SaveAIResponseResult(stockCode, stockName, result string) { db.Dao.Create(&models.AIResponseResult{ StockCode: stockCode, StockName: stockName, + ModelName: o.Model, Content: result, }) } func (o OpenAi) GetAIResponseResult(stock string) *models.AIResponseResult { var result models.AIResponseResult - db.Dao.Where("stock_code = ?", stock).Order("id desc").First(&result) + db.Dao.Where("stock_code = ?", stock).Order("id desc").Limit(1).First(&result) return &result } diff --git a/backend/models/models.go b/backend/models/models.go index 3c84710..7420390 100644 --- a/backend/models/models.go +++ b/backend/models/models.go @@ -135,6 +135,7 @@ type Commit struct { type AIResponseResult struct { gorm.Model + ModelName string `json:"modelName"` StockCode string `json:"stockCode"` StockName string `json:"stockName"` Content string `json:"content"` diff --git a/frontend/src/components/stock.vue b/frontend/src/components/stock.vue index e5851e3..97e8d46 100644 --- a/frontend/src/components/stock.vue +++ b/frontend/src/components/stock.vue @@ -55,6 +55,7 @@ const formModel = ref({ }) const data = reactive({ + modelName:"", name: "", code: "", fenshiURL:"", @@ -485,6 +486,7 @@ function SendMessage(result,type){ SendDingDingMessageByType(msg,result["股票代码"],type) } function aiReCheckStock(stock,stockCode) { + data.modelName="" data.airesult="" data.time="" data.name=stock @@ -500,6 +502,7 @@ function aiReCheckStock(stock,stockCode) { function aiCheckStock(stock,stockCode){ GetAIResponseResult(stockCode).then(result => { if(result.content){ + data.modelName=result.modelName data.name=stock data.code=stockCode data.loading=false @@ -515,6 +518,7 @@ function aiCheckStock(stock,stockCode){ const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; data.time=formattedDate }else{ + data.modelName="" data.airesult="" data.time="" data.name=stock @@ -743,7 +747,7 @@ function saveAsMarkdown() { diff --git a/frontend/wailsjs/go/models.ts b/frontend/wailsjs/go/models.ts index 41a4c2f..1c949eb 100644 --- a/frontend/wailsjs/go/models.ts +++ b/frontend/wailsjs/go/models.ts @@ -343,6 +343,7 @@ export namespace models { UpdatedAt: any; // Go type: gorm DeletedAt: any; + modelName: string; stockCode: string; stockName: string; content: string; @@ -358,6 +359,7 @@ export namespace models { this.CreatedAt = this.convertValues(source["CreatedAt"], null); this.UpdatedAt = this.convertValues(source["UpdatedAt"], null); this.DeletedAt = this.convertValues(source["DeletedAt"], null); + this.modelName = source["modelName"]; this.stockCode = source["stockCode"]; this.stockName = source["stockName"]; this.content = source["content"];