diff --git a/backend/data/openai_api.go b/backend/data/openai_api.go
index 487afe0..a8f4122 100644
--- a/backend/data/openai_api.go
+++ b/backend/data/openai_api.go
@@ -301,7 +301,7 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[
"content": question,
})
client := resty.New()
- client.SetBaseURL(o.BaseUrl)
+ client.SetBaseURL(strutil.Trim(o.BaseUrl))
client.SetHeader("Authorization", "Bearer "+o.ApiKey)
client.SetHeader("Content-Type", "application/json")
//client.SetRetryCount(3)
diff --git a/backend/data/settings_api.go b/backend/data/settings_api.go
index b52c4eb..ec9ef96 100644
--- a/backend/data/settings_api.go
+++ b/backend/data/settings_api.go
@@ -28,6 +28,7 @@ type Settings struct {
QuestionTemplate string `json:"questionTemplate"`
CrawlTimeOut int64 `json:"crawlTimeOut"`
KDays int64 `json:"kDays"`
+ EnableDanmu bool `json:"enableDanmu"`
}
func (receiver Settings) TableName() string {
@@ -67,6 +68,7 @@ func (s SettingsApi) UpdateConfig() string {
"question_template": s.Config.QuestionTemplate,
"crawl_time_out": s.Config.CrawlTimeOut,
"k_days": s.Config.KDays,
+ "enable_danmu": s.Config.EnableDanmu,
})
} else {
logger.SugaredLogger.Infof("未找到配置,创建默认配置:%+v", s.Config)
@@ -89,6 +91,7 @@ func (s SettingsApi) UpdateConfig() string {
QuestionTemplate: s.Config.QuestionTemplate,
CrawlTimeOut: s.Config.CrawlTimeOut,
KDays: s.Config.KDays,
+ EnableDanmu: s.Config.EnableDanmu,
})
}
return "保存成功!"
diff --git a/frontend/src/components/settings.vue b/frontend/src/components/settings.vue
index f25b75e..9515d69 100644
--- a/frontend/src/components/settings.vue
+++ b/frontend/src/components/settings.vue
@@ -32,7 +32,8 @@ const formValue = ref({
questionTemplate: "{{stockName}}分析和总结",
crawlTimeOut:30,
kDays:30,
- }
+ },
+ enableDanmu:false,
})
onMounted(()=>{
@@ -61,6 +62,7 @@ onMounted(()=>{
crawlTimeOut:res.crawlTimeOut,
kDays:res.kDays,
}
+ formValue.value.enableDanmu = res.enableDanmu
console.log(res)
})
//message.info("加载完成")
@@ -86,7 +88,8 @@ function saveConfig(){
openAiApiTimeOut:formValue.value.openAI.timeout,
questionTemplate:formValue.value.openAI.questionTemplate,
crawlTimeOut:formValue.value.openAI.crawlTimeOut,
- kDays:formValue.value.openAI.kDays
+ kDays:formValue.value.openAI.kDays,
+ enableDanmu:formValue.value.enableDanmu
})
//console.log("Settings",config)
@@ -157,6 +160,7 @@ function importConfig(){
crawlTimeOut:config.crawlTimeOut,
kDays:config.kDays
}
+ formValue.value.enableDanmu = config.enableDanmu
// formRef.value.resetFields()
};
reader.readAsText(file);
@@ -191,10 +195,10 @@ window.onerror = function (event, source, lineno, colno, error) {
-
+
-
+
秒
@@ -213,6 +217,9 @@ window.onerror = function (event, source, lineno, colno, error) {
+
+
+
发送测试通知
diff --git a/frontend/src/components/stock.vue b/frontend/src/components/stock.vue
index b1db7b1..b359322 100644
--- a/frontend/src/components/stock.vue
+++ b/frontend/src/components/stock.vue
@@ -50,7 +50,7 @@ import html2canvas from "html2canvas";
import {asBlob} from 'html-docx-js-typescript';
import vueDanmaku from 'vue3-danmaku'
-const danmus = ref(['欢迎回来~'])
+const danmus = ref([])
const ws = ref(null)
const toolbars = [0];
@@ -100,6 +100,7 @@ const data = reactive({
airesult: "",
openAiEnable: false,
loading: true,
+ enableDanmu: false,
})
const icon = ref('https://raw.githubusercontent.com/ArvinLovegood/go-stock/master/build/appicon.png');
@@ -137,6 +138,9 @@ onBeforeMount(()=>{
if (result.openAiEnable) {
data.openAiEnable = true
}
+ if (result.enableDanmu) {
+ data.enableDanmu = true
+ }
})
})
@@ -163,8 +167,9 @@ onMounted(() => {
};
ws.value.onmessage = (event) => {
- const message = event.data;
- danmus.value.push(message);
+ if(data.enableDanmu){
+ danmus.value.push(event.data);
+ }
};
ws.value.onerror = (error) => {
diff --git a/frontend/wailsjs/go/models.ts b/frontend/wailsjs/go/models.ts
index 103352b..da29070 100644
--- a/frontend/wailsjs/go/models.ts
+++ b/frontend/wailsjs/go/models.ts
@@ -79,6 +79,7 @@ export namespace data {
questionTemplate: string;
crawlTimeOut: number;
kDays: number;
+ enableDanmu: boolean;
static createFrom(source: any = {}) {
return new Settings(source);
@@ -108,6 +109,7 @@ export namespace data {
this.questionTemplate = source["questionTemplate"];
this.crawlTimeOut = source["crawlTimeOut"];
this.kDays = source["kDays"];
+ this.enableDanmu = source["enableDanmu"];
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
diff --git a/main.go b/main.go
index 1bee905..fff7f8e 100644
--- a/main.go
+++ b/main.go
@@ -121,7 +121,7 @@ func main() {
err = wails.Run(&options.App{
Title: "go-stock",
Width: width * 4 / 5,
- Height: height * 2 / 3,
+ Height: height * 4 / 5,
MinWidth: 1024,
MinHeight: 768,
MaxWidth: width,