diff --git a/backend/data/openai_api.go b/backend/data/openai_api.go index 96e0151..92b219e 100644 --- a/backend/data/openai_api.go +++ b/backend/data/openai_api.go @@ -158,7 +158,7 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[ } K := NewTushareApi(getConfig()).GetDaily(code, startDate, endDate, o.CrawlTimeOut) msg = append(msg, map[string]interface{}{ - "role": "assistant", + "role": "user", "content": stock + "日K数据如下:\n" + K, }) }() @@ -182,7 +182,7 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[ price += message + ";" } msg = append(msg, map[string]interface{}{ - "role": "assistant", + "role": "user", "content": stock + time.Now().Format(time.DateOnly) + "价格:" + price, }) }() @@ -208,7 +208,7 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[ } for _, message := range *messages { msg = append(msg, map[string]interface{}{ - "role": "assistant", + "role": "user", "content": stock + message, }) } @@ -225,7 +225,7 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[ } for _, message := range *messages { msg = append(msg, map[string]interface{}{ - "role": "assistant", + "role": "user", "content": message, }) } @@ -238,7 +238,7 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[ } for _, message := range *messages { msg = append(msg, map[string]interface{}{ - "role": "assistant", + "role": "user", "content": message, }) } @@ -255,7 +255,7 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[ // } // for _, message := range *messages { // msg = append(msg, map[string]interface{}{ - // "role": "assistant", + // "role": "user", // "content": message, // }) // } @@ -271,7 +271,7 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[ } for _, message := range *messages { msg = append(msg, map[string]interface{}{ - "role": "assistant", + "role": "user", "content": message, }) } @@ -293,7 +293,7 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[ } for _, message := range *messages { msg = append(msg, map[string]interface{}{ - "role": "assistant", + "role": "user", "content": message, }) } @@ -341,8 +341,8 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[ for scanner.Scan() { line := scanner.Text() logger.SugaredLogger.Infof("Received data: %s", line) - if strings.HasPrefix(line, "data: ") { - data := strings.TrimPrefix(line, "data: ") + if strings.HasPrefix(line, "data:") { + data := strutil.Trim(strings.TrimPrefix(line, "data:")) if data == "[DONE]" { return } diff --git a/frontend/src/components/fund.vue b/frontend/src/components/fund.vue index 0c9359e..35ac351 100644 --- a/frontend/src/components/fund.vue +++ b/frontend/src/components/fund.vue @@ -16,7 +16,7 @@ const danmus = ref([]) const ws = ref(null) const icon = ref(null) const message = useMessage() - +const modalShow = ref(false) const data = reactive({ modelName:"", chatId: "", @@ -142,6 +142,20 @@ function formatterTitle(title){ },{default: () => title,} ) } + +function search(code,name){ + setTimeout(() => { + window.open("https://fund.eastmoney.com/"+code+".html","_blank","noreferrer,width=1000,top=100,left=100,status=no,toolbar=no,location=no,scrollbars=no") + //window.open("https://finance.sina.com.cn/fund/quotes/"+code+"/bc.shtml","_blank","width=1000,height=800,top=100,left=100,toolbar=no,location=no") + }, 500) +} + +function newchart(code,name){ + modalShow.value=true + data.name=name + data.code=code + data.fenshiURL='https://image.sinajs.cn/newchart/v5/fund/nav/ss/'+code+'.gif'+"?t="+Date.now() +} - + + 估算净值:{{info.netEstimatedUnit}}  {{info.netEstimatedRate}} %    - ({{info.netEstimatedUnitTime}}) - - - 单位净值:{{info.netUnitValue}} ({{info.netUnitValueDate}}) - - + ({{info.netEstimatedUnitTime}}) +
+ + 单位净值:{{info.netUnitValue}}    ({{info.netUnitValueDate}}) +
+ 近一月:{{info.fundBasic.netGrowth1}}% 近三月:{{info.fundBasic.netGrowth3}}% 近六月:{{info.fundBasic.netGrowth6}}% @@ -173,20 +188,26 @@ function formatterTitle(title){ 成立来:{{info.fundBasic.netGrowthAll}}% - + + + + + +