@@ -4,11 +4,11 @@ import {
44 Follow , GetConfig ,
55 GetFollowList ,
66 GetStockList ,
7- Greet , NewChat , NewChatStream ,
7+ Greet , SaveAIResponseResult , NewChatStream ,
88 SendDingDingMessage , SendDingDingMessageByType ,
99 SetAlarmChangePercent ,
1010 SetCostPriceAndVolume , SetStockSort ,
11- UnFollow
11+ UnFollow , GetAIResponseResult
1212} from ' ../../wailsjs/go/main/App'
1313import {
1414 NAvatar ,
@@ -152,6 +152,7 @@ EventsOn("newChatStream",async (msg) => {
152152 // console.log("newChatStream:->",data.airesult)
153153 data .loading = false
154154 if (msg === " DONE" ) {
155+ SaveAIResponseResult (data .code , data .name , data .airesult )
155156 message .info (" AI分析完成!" )
156157 message .destroyAll ()
157158 } else {
@@ -448,9 +449,9 @@ function SendMessage(result,type){
448449 // SendDingDingMessage(msg,result["股票代码"])
449450 SendDingDingMessageByType (msg,result[" 股票代码" ],type)
450451}
451-
452- function aiCheckStock (stock ,stockCode ){
452+ function aiReCheckStock (stock ,stockCode ) {
453453 data .airesult = " "
454+ data .time = " "
454455 data .name = stock
455456 data .code = stockCode
456457 data .loading = true
@@ -461,6 +462,38 @@ function aiCheckStock(stock,stockCode){
461462 NewChatStream (stock,stockCode)
462463}
463464
465+ function aiCheckStock (stock ,stockCode ){
466+ GetAIResponseResult (stockCode).then (result => {
467+ if (result .content ){
468+ data .name = stock
469+ data .code = stockCode
470+ data .loading = false
471+ modalShow4 .value = true
472+ data .airesult = result .content
473+ const date = new Date (result .CreatedAt );
474+ const year = date .getFullYear ();
475+ const month = String (date .getMonth () + 1 ).padStart (2 , ' 0' );
476+ const day = String (date .getDate ()).padStart (2 , ' 0' );
477+ const hours = String (date .getHours ()).padStart (2 , ' 0' );
478+ const minutes = String (date .getMinutes ()).padStart (2 , ' 0' );
479+ const seconds = String (date .getSeconds ()).padStart (2 , ' 0' );
480+ const formattedDate = ` ${ year} -${ month} -${ day} ${ hours} :${ minutes} :${ seconds} ` ;
481+ data .time = formattedDate
482+ }else {
483+ data .airesult = " "
484+ data .time = " "
485+ data .name = stock
486+ data .code = stockCode
487+ data .loading = true
488+ modalShow4 .value = true
489+ message .loading (" ai检测中..." ,{
490+ duration: 0 ,
491+ })
492+ NewChatStream (stock,stockCode)
493+ }
494+ })
495+ }
496+
464497function getTypeName (type ){
465498 switch (type)
466499 {
@@ -518,7 +551,9 @@ function getHeight() {
518551 < n- button size= " tiny" secondary type= " primary" @click= " removeMonitor(result['股票代码'],result['股票名称'],result.key)" >
519552 取消关注
520553 < / n- button> & nbsp;
521- < n- button size= " tiny" v- if = " data.openAiEnable" secondary type= " warning" @click= " aiCheckStock(result['股票名称'],result['股票代码'])" > AI 分析 < / n- button>
554+ < n- button size= " tiny" v- if = " data.openAiEnable" secondary type= " warning" @click= " aiCheckStock(result['股票名称'],result['股票代码'])" >
555+ AI 分析
556+ < / n- button>
522557
523558 < / template>
524559 < template #footer>
@@ -609,18 +644,28 @@ function getHeight() {
609644 < n- image : src= " data.kURL" / >
610645 < / n- modal>
611646
612- < n- modal transform- origin= " center" v- model: show= " modalShow4" preset= " card" style= " width: 800px;height: 480px " : title= " '['+data.name+']AI分析结果'" >
647+ < n- modal transform- origin= " center" v- model: show= " modalShow4" preset= " card" style= " width: 800px;height: 500px " : title= " '['+data.name+']AI分析结果'" >
613648 < n- spin size= " small" : show= " data.loading" >
614649 < MdPreview ref= " mdPreviewRef" style= " height: 380px;text-align: left" : modelValue= " data.airesult" : theme= " 'dark'" / >
615650 < / n- spin>
651+ < template #header- extra>
652+
653+ < / template>
654+ < template #footer>
655+ < n- flex justify= " space-between" >
656+ < n- text type= " error" v- if = " data.time" > 分析时间: {{data .time }}< / n- text>
657+ < n- button size= " tiny" type= " warning" @click= " aiReCheckStock(data.name,data.code)" > 再次分析< / n- button>
658+ < / n- flex>
659+ < / template>
616660 < / n- modal>
617661< / template>
618662
619663< style scoped>
620- h3 {
621- text- align: center;
622- }
623- #总结 {
624- text- align: center;
625- }
664+ .md - editor- preview h3{
665+ text- align: center ! important;
666+ }
667+
668+ .md - editor- preview p{
669+ text- align: left ! important;
670+ }
626671< / style>
0 commit comments