Compare commits
6 Commits
v2025.7.22
...
v2025.7.25
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4d3c44cf4 | ||
|
|
81a9cc5927 | ||
|
|
3fc89a85da | ||
|
|
0605c8442d | ||
|
|
cf8591c208 | ||
|
|
7607c4356f |
@@ -864,19 +864,25 @@ func (m MarketNewsApi) GetIndustryReportInfo(infoCode string) string {
|
||||
return markdown
|
||||
}
|
||||
|
||||
func (m MarketNewsApi) ReutersNew() {
|
||||
url := "https://www.reuters.com/pf/api/v3/content/fetch/articles-by-section-alias-or-id-v1?query=%7B%22arc-site%22%3A%22reuters%22%2C%22fetch_type%22%3A%22collection%22%2C%22offset%22%3A20%2C%22section_id%22%3A%22%2Fworld%2Fchina%2F%22%2C%22size%22%3A9%2C%22uri%22%3A%22%2Fworld%2Fchina%2F%22%2C%22website%22%3A%22reuters%22%7D&d=300&mxId=00000000&_website=reuters"
|
||||
resp, err := resty.New().SetProxy("http://127.0.0.1:10809").SetTimeout(time.Duration(30)*time.Second).R().
|
||||
func (m MarketNewsApi) ReutersNew() *models.ReutersNews {
|
||||
client := resty.New()
|
||||
config := GetSettingConfig()
|
||||
if config.HttpProxyEnabled && config.HttpProxy != "" {
|
||||
client.SetProxy(config.HttpProxy)
|
||||
}
|
||||
news := &models.ReutersNews{}
|
||||
url := "https://www.reuters.com/pf/api/v3/content/fetch/articles-by-section-alias-or-id-v1?query={\"arc-site\":\"reuters\",\"fetch_type\":\"collection\",\"offset\":0,\"section_id\":\"/world/\",\"size\":9,\"uri\":\"/world/\",\"website\":\"reuters\"}&d=300&mxId=00000000&_website=reuters"
|
||||
_, err := client.SetTimeout(time.Duration(5)*time.Second).R().
|
||||
SetHeader("Host", "www.reuters.com").
|
||||
SetHeader("Origin", "https://www.reuters.com").
|
||||
SetHeader("Referer", "https://www.reuters.com/world/china/").
|
||||
SetHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0").
|
||||
SetResult(news).
|
||||
Get(url)
|
||||
if err != nil {
|
||||
logger.SugaredLogger.Errorf("ReutersNew err:%s", err.Error())
|
||||
return
|
||||
return news
|
||||
}
|
||||
body := resp.Body()
|
||||
logger.SugaredLogger.Debugf("ReutersNew:%s", body)
|
||||
|
||||
logger.SugaredLogger.Infof("Articles:%+v", news.Result.Articles)
|
||||
return news
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ func TestTradingViewNews(t *testing.T) {
|
||||
db.Init("../../data/stock.db")
|
||||
resp := NewMarketNewsApi().TradingViewNews()
|
||||
for _, a := range *resp {
|
||||
logger.SugaredLogger.Debugf("value: %s", a.Title)
|
||||
logger.SugaredLogger.Debugf("value: %+v", a)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,5 +213,6 @@ func TestGetIndustryReportInfo(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestReutersNew(t *testing.T) {
|
||||
db.Init("../../data/stock.db")
|
||||
NewMarketNewsApi().ReutersNew()
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ func (o *OpenAi) NewSummaryStockNewsStreamWithTools(userQuestion string, sysProm
|
||||
"content": "当前本地时间是:" + time.Now().Format("2006-01-02 15:04:05"),
|
||||
})
|
||||
wg := &sync.WaitGroup{}
|
||||
wg.Add(3)
|
||||
wg.Add(5)
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
@@ -219,17 +219,24 @@ func (o *OpenAi) NewSummaryStockNewsStreamWithTools(userQuestion string, sysProm
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
var market strings.Builder
|
||||
market.WriteString(getZSInfo("上证指数", "sh000001", 30) + "\n")
|
||||
market.WriteString(getZSInfo("深证成指", "sz399001", 30) + "\n")
|
||||
market.WriteString(getZSInfo("创业板指数", "sz399006", 30) + "\n")
|
||||
market.WriteString(getZSInfo("上证综合指数", "sh000001", 30) + "\n")
|
||||
market.WriteString(getZSInfo("科创50", "sh000688", 30) + "\n")
|
||||
market.WriteString(getZSInfo("沪深300指数", "sh000300", 30) + "\n")
|
||||
market.WriteString(getZSInfo("中证银行", "sz399986", 30) + "\n")
|
||||
market.WriteString(getZSInfo("科创芯片", "sh000685", 30) + "\n")
|
||||
market.WriteString(getZSInfo("上证医药", "sh000037", 30) + "\n")
|
||||
market.WriteString(getZSInfo("证券龙头", "sz399437", 30) + "\n")
|
||||
market.WriteString(getZSInfo("中证白酒", "sz399997", 30) + "\n")
|
||||
//logger.SugaredLogger.Infof("NewChatStream getZSInfo=\n%s", market.String())
|
||||
msg = append(msg, map[string]interface{}{
|
||||
"role": "user",
|
||||
"content": "当前市场指数行情",
|
||||
"content": "当前市场/大盘/行业/指数行情",
|
||||
})
|
||||
msg = append(msg, map[string]interface{}{
|
||||
"role": "assistant",
|
||||
"content": "当前市场指数行情情况如下:\n" + market.String(),
|
||||
"content": "当前市场/大盘/行业/指数行情如下:\n" + market.String(),
|
||||
})
|
||||
}()
|
||||
|
||||
@@ -264,9 +271,45 @@ func (o *OpenAi) NewSummaryStockNewsStreamWithTools(userQuestion string, sysProm
|
||||
|
||||
}()
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
resp := NewMarketNewsApi().TradingViewNews()
|
||||
var newsText strings.Builder
|
||||
|
||||
for _, a := range *resp {
|
||||
logger.SugaredLogger.Debugf("TradingViewNews: %s", a.Title)
|
||||
newsText.WriteString(a.Title + "\n")
|
||||
}
|
||||
msg = append(msg, map[string]interface{}{
|
||||
"role": "user",
|
||||
"content": "全球新闻资讯",
|
||||
})
|
||||
msg = append(msg, map[string]interface{}{
|
||||
"role": "assistant",
|
||||
"content": newsText.String(),
|
||||
})
|
||||
}()
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
news := NewMarketNewsApi().ReutersNew()
|
||||
messageText := strings.Builder{}
|
||||
for _, article := range news.Result.Articles {
|
||||
messageText.WriteString("## " + article.Title + "\n")
|
||||
messageText.WriteString("### " + article.Description + "\n")
|
||||
}
|
||||
msg = append(msg, map[string]interface{}{
|
||||
"role": "user",
|
||||
"content": "外媒全球新闻资讯",
|
||||
})
|
||||
msg = append(msg, map[string]interface{}{
|
||||
"role": "assistant",
|
||||
"content": messageText.String(),
|
||||
})
|
||||
}()
|
||||
wg.Wait()
|
||||
|
||||
news := NewMarketNewsApi().GetNewsList("财联社电报", random.RandInt(50, 150))
|
||||
news := NewMarketNewsApi().GetNewsList("财联社电报", random.RandInt(100, 500))
|
||||
messageText := strings.Builder{}
|
||||
for _, telegraph := range *news {
|
||||
messageText.WriteString("## " + telegraph.Time + ":" + "\n")
|
||||
@@ -338,13 +381,20 @@ func (o *OpenAi) NewSummaryStockNewsStream(userQuestion string, sysPromptId *int
|
||||
"content": "当前本地时间是:" + time.Now().Format("2006-01-02 15:04:05"),
|
||||
})
|
||||
wg := &sync.WaitGroup{}
|
||||
wg.Add(2)
|
||||
wg.Add(3)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
var market strings.Builder
|
||||
market.WriteString(getZSInfo("上证指数", "sh000001", 30) + "\n")
|
||||
market.WriteString(getZSInfo("深证成指", "sz399001", 30) + "\n")
|
||||
market.WriteString(getZSInfo("创业板指数", "sz399006", 30) + "\n")
|
||||
market.WriteString(getZSInfo("上证综合指数", "sh000001", 30) + "\n")
|
||||
market.WriteString(getZSInfo("科创50", "sh000688", 30) + "\n")
|
||||
market.WriteString(getZSInfo("沪深300指数", "sh000300", 30) + "\n")
|
||||
market.WriteString(getZSInfo("中证银行", "sz399986", 30) + "\n")
|
||||
market.WriteString(getZSInfo("科创芯片", "sh000685", 30) + "\n")
|
||||
market.WriteString(getZSInfo("上证医药", "sh000037", 30) + "\n")
|
||||
market.WriteString(getZSInfo("证券龙头", "sz399437", 30) + "\n")
|
||||
market.WriteString(getZSInfo("中证白酒", "sz399997", 30) + "\n")
|
||||
//logger.SugaredLogger.Infof("NewChatStream getZSInfo=\n%s", market.String())
|
||||
msg = append(msg, map[string]interface{}{
|
||||
"role": "user",
|
||||
@@ -361,7 +411,7 @@ func (o *OpenAi) NewSummaryStockNewsStream(userQuestion string, sysPromptId *int
|
||||
var newsText strings.Builder
|
||||
|
||||
for _, a := range *resp {
|
||||
logger.SugaredLogger.Debugf("value: %s", a.Title)
|
||||
logger.SugaredLogger.Debugf("TradingViewNews: %s", a.Title)
|
||||
newsText.WriteString(a.Title + "\n")
|
||||
}
|
||||
msg = append(msg, map[string]interface{}{
|
||||
@@ -374,6 +424,24 @@ func (o *OpenAi) NewSummaryStockNewsStream(userQuestion string, sysPromptId *int
|
||||
})
|
||||
}()
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
news := NewMarketNewsApi().ReutersNew()
|
||||
messageText := strings.Builder{}
|
||||
for _, article := range news.Result.Articles {
|
||||
messageText.WriteString("## " + article.Title + "\n")
|
||||
messageText.WriteString("### " + article.Description + "\n")
|
||||
}
|
||||
msg = append(msg, map[string]interface{}{
|
||||
"role": "user",
|
||||
"content": "外媒全球新闻资讯",
|
||||
})
|
||||
msg = append(msg, map[string]interface{}{
|
||||
"role": "assistant",
|
||||
"content": messageText.String(),
|
||||
})
|
||||
}()
|
||||
|
||||
wg.Wait()
|
||||
|
||||
news := NewMarketNewsApi().GetNewsList("", 100)
|
||||
|
||||
@@ -57,3 +57,9 @@ func TestSearchGuShiTongStockInfo(t *testing.T) {
|
||||
SearchGuShiTongStockInfo("gb_goog", 60)
|
||||
|
||||
}
|
||||
|
||||
func TestGetZSInfo(t *testing.T) {
|
||||
db.Init("../../data/stock.db")
|
||||
getZSInfo("中证银行", "sz399986", 30)
|
||||
getZSInfo("科创50", "sh000688", 30)
|
||||
}
|
||||
|
||||
@@ -500,3 +500,138 @@ type OldSettings struct {
|
||||
func (receiver OldSettings) TableName() string {
|
||||
return "settings"
|
||||
}
|
||||
|
||||
type ReutersNews struct {
|
||||
StatusCode int `json:"statusCode"`
|
||||
Message string `json:"message"`
|
||||
Result struct {
|
||||
ParentSectionName string `json:"parent_section_name"`
|
||||
Pagination struct {
|
||||
Size int `json:"size"`
|
||||
ExpectedSize int `json:"expected_size"`
|
||||
TotalSize int `json:"total_size"`
|
||||
Orderby string `json:"orderby"`
|
||||
} `json:"pagination"`
|
||||
DateModified time.Time `json:"date_modified"`
|
||||
FetchType string `json:"fetch_type"`
|
||||
Articles []struct {
|
||||
Id string `json:"id"`
|
||||
CanonicalUrl string `json:"canonical_url"`
|
||||
Website string `json:"website"`
|
||||
Web string `json:"web"`
|
||||
Native string `json:"native"`
|
||||
UpdatedTime time.Time `json:"updated_time"`
|
||||
PublishedTime time.Time `json:"published_time"`
|
||||
ArticleType string `json:"article_type"`
|
||||
DisplayMyNews bool `json:"display_my_news"`
|
||||
DisplayNewsletterSignup bool `json:"display_newsletter_signup"`
|
||||
DisplayNotifications bool `json:"display_notifications"`
|
||||
DisplayRelatedMedia bool `json:"display_related_media"`
|
||||
DisplayRelatedOrganizations bool `json:"display_related_organizations"`
|
||||
ContentCode string `json:"content_code"`
|
||||
Source struct {
|
||||
Name string `json:"name"`
|
||||
OriginalName string `json:"original_name"`
|
||||
} `json:"source"`
|
||||
Title string `json:"title"`
|
||||
BasicHeadline string `json:"basic_headline"`
|
||||
Distributor string `json:"distributor"`
|
||||
Description string `json:"description"`
|
||||
PrimaryMediaType string `json:"primary_media_type,omitempty"`
|
||||
PrimaryTag struct {
|
||||
ShortBio string `json:"short_bio"`
|
||||
Description string `json:"description"`
|
||||
Slug string `json:"slug"`
|
||||
Text string `json:"text"`
|
||||
TopicUrl string `json:"topic_url"`
|
||||
CanFollow bool `json:"can_follow,omitempty"`
|
||||
IsTopic bool `json:"is_topic,omitempty"`
|
||||
} `json:"primary_tag"`
|
||||
WordCount int `json:"word_count"`
|
||||
ReadMinutes int `json:"read_minutes"`
|
||||
Kicker struct {
|
||||
Path string `json:"path"`
|
||||
Names []string `json:"names"`
|
||||
Name string `json:"name,omitempty"`
|
||||
} `json:"kicker"`
|
||||
AdTopics []string `json:"ad_topics"`
|
||||
Thumbnail struct {
|
||||
Url string `json:"url"`
|
||||
Caption string `json:"caption,omitempty"`
|
||||
Type string `json:"type"`
|
||||
ResizerUrl string `json:"resizer_url"`
|
||||
Location string `json:"location,omitempty"`
|
||||
Id string `json:"id"`
|
||||
Authors string `json:"authors,omitempty"`
|
||||
AltText string `json:"alt_text"`
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
Subtitle string `json:"subtitle"`
|
||||
Slug string `json:"slug,omitempty"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
Company string `json:"company,omitempty"`
|
||||
PurchaseLicensingPath string `json:"purchase_licensing_path,omitempty"`
|
||||
} `json:"thumbnail"`
|
||||
Authors []struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name"`
|
||||
FirstName string `json:"first_name,omitempty"`
|
||||
LastName string `json:"last_name,omitempty"`
|
||||
Company string `json:"company"`
|
||||
Thumbnail struct {
|
||||
Url string `json:"url"`
|
||||
Type string `json:"type"`
|
||||
ResizerUrl string `json:"resizer_url"`
|
||||
} `json:"thumbnail"`
|
||||
SocialLinks []struct {
|
||||
Site string `json:"site"`
|
||||
Url string `json:"url"`
|
||||
} `json:"social_links,omitempty"`
|
||||
Byline string `json:"byline"`
|
||||
Description string `json:"description,omitempty"`
|
||||
TopicUrl string `json:"topic_url,omitempty"`
|
||||
Role string `json:"role,omitempty"`
|
||||
} `json:"authors"`
|
||||
DisplayTime time.Time `json:"display_time"`
|
||||
ThumbnailDark struct {
|
||||
Url string `json:"url"`
|
||||
Type string `json:"type"`
|
||||
ResizerUrl string `json:"resizer_url"`
|
||||
Id string `json:"id"`
|
||||
AltText string `json:"alt_text"`
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
Subtitle string `json:"subtitle"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
} `json:"thumbnail_dark,omitempty"`
|
||||
} `json:"articles"`
|
||||
Section struct {
|
||||
Id string `json:"id"`
|
||||
AdUnitCode string `json:"ad_unit_code"`
|
||||
Website string `json:"website"`
|
||||
Name string `json:"name"`
|
||||
PageTitle string `json:"page_title"`
|
||||
CanFollow bool `json:"can_follow"`
|
||||
Language string `json:"language"`
|
||||
Type string `json:"type"`
|
||||
Advertising struct {
|
||||
Sponsored string `json:"sponsored"`
|
||||
} `json:"advertising"`
|
||||
VideoPlaylistId string `json:"video_playlistId"`
|
||||
MobileAdUnitPath string `json:"mobile_ad_unit_path"`
|
||||
AdUnitPath string `json:"ad_unit_path"`
|
||||
CollectionAlias string `json:"collection_alias"`
|
||||
SectionAbout string `json:"section_about"`
|
||||
Title string `json:"title"`
|
||||
Personalization struct {
|
||||
Id string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
ShowTags bool `json:"show_tags"`
|
||||
CanFollow bool `json:"can_follow"`
|
||||
} `json:"personalization"`
|
||||
} `json:"section"`
|
||||
AdUnitPath string `json:"ad_unit_path"`
|
||||
ResponseTime int64 `json:"response_time"`
|
||||
} `json:"result"`
|
||||
Id string `json:"_id"`
|
||||
}
|
||||
|
||||
@@ -702,7 +702,7 @@ onMounted(() => {
|
||||
</n-spin>
|
||||
</n-gi>
|
||||
<n-gi style="position: fixed;bottom:0;z-index: 9;width: 100%;">
|
||||
<n-card size="small" style="--wails-draggable:drag">
|
||||
<n-card size="small" style="--wails-draggable:no-drag">
|
||||
<n-menu style="font-size: 18px;"
|
||||
v-model:value="activeKey"
|
||||
mode="horizontal"
|
||||
|
||||
@@ -104,7 +104,7 @@ EventsOn("updateVersion",async (msg) => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<n-space vertical size="large" style="--wails-draggable:drag">
|
||||
<n-space vertical size="large" style="--wails-draggable:no-drag">
|
||||
<!-- 软件描述 -->
|
||||
<n-card size="large">
|
||||
<n-divider title-placement="center">关于软件</n-divider>
|
||||
|
||||
@@ -102,6 +102,7 @@ onBeforeMount(() => {
|
||||
|
||||
GetAiConfigs().then(res=>{
|
||||
aiConfigs.value = res
|
||||
aiConfigId.value = res[0].ID
|
||||
})
|
||||
|
||||
GetTelegraphList("财联社电报").then((res) => {
|
||||
@@ -317,7 +318,7 @@ function ReFlesh(source) {
|
||||
|
||||
<template>
|
||||
<n-card>
|
||||
<n-tabs type="line" animated @update-value="updateTab" :value="nowTab" style="--wails-draggable:drag">
|
||||
<n-tabs type="line" animated @update-value="updateTab" :value="nowTab" style="--wails-draggable:no-drag">
|
||||
<n-tab-pane name="市场快讯" tab="市场快讯">
|
||||
<n-grid :cols="2" :y-gap="0">
|
||||
<n-gi>
|
||||
|
||||
@@ -291,7 +291,7 @@ function deletePrompt(ID) {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<n-flex justify="left" style="text-align: left; --wails-draggable:drag">
|
||||
<n-flex justify="left" style="text-align: left; --wails-draggable:no-drag">
|
||||
<n-form ref="formRef" :label-placement="'left'" :label-align="'left'">
|
||||
<n-space vertical size="large">
|
||||
<n-card :title="() => h(NTag, { type: 'primary', bordered: false }, () => '基础设置')" size="small">
|
||||
|
||||
@@ -220,6 +220,7 @@ onBeforeMount(() => {
|
||||
|
||||
GetAiConfigs().then(res=>{
|
||||
aiConfigs.value = res
|
||||
data.aiConfigId =res[0].ID
|
||||
})
|
||||
|
||||
})
|
||||
@@ -1722,7 +1723,7 @@ function searchStockReport(stockCode) {
|
||||
</n-gradient-text>
|
||||
</template>
|
||||
</vue-danmaku>
|
||||
<n-tabs type="card" style="--wails-draggable:drag" animated addable :data-currentGroupId="currentGroupId"
|
||||
<n-tabs type="card" style="--wails-draggable:no-drag" animated addable :data-currentGroupId="currentGroupId"
|
||||
:value="currentGroupId" @add="addTab" @update-value="updateTab" placement="top" @close="(key)=>{delTab(key)}">
|
||||
<n-tab-pane :name="0" :tab="'全部'">
|
||||
<n-grid :x-gap="8" :cols="3" :y-gap="8">
|
||||
|
||||
Reference in New Issue
Block a user