各位AI小财神的用户,大家好!
-试运行期间,用户可在AI小财神中查看全
-市场数据,每个市场可查看20只股票.
-以下为各个市场可以查看的股票:
- + +各位AI小财神的用户,大家好!
+试运行期间,用户可在AI小财神中查看全
+市场数据,每个市场可查看20只股票.
+以下为各个市场可以查看的股票:
+ +diff --git a/README.md b/README.md index 40e1f82..b015e02 100644 --- a/README.md +++ b/README.md @@ -17,3 +17,4 @@ npm install @coze/api npm install html-to-text npm install echarts npm install lodash 安装 lodash 组件,解决数据处理问题 +npm install vue-device-detect 安装 vue-device-detect 组件,解决移动端适配问题 diff --git a/package-lock.json b/package-lock.json index 0f7efbe..15ec7ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,6 +28,7 @@ "reset-css": "^5.0.2", "vconsole": "^3.15.1", "vue": "^3.2.26", + "vue-device-detect": "^1.0.3", "vue-i18n": "^10.0.3", "vue-request": "^1.2.3", "vue-router": "^4.0.12" @@ -6692,6 +6693,32 @@ "node": ">=4.2.0" } }, + "node_modules/ua-parser-js": { + "version": "1.0.40", + "resolved": "https://mirrors.huaweicloud.com/repository/npm/ua-parser-js/-/ua-parser-js-1.0.40.tgz", + "integrity": "sha512-z6PJ8Lml+v3ichVojCiB8toQJBuwR42ySM4ezjXIqXK3M0HczmKQ3LF4rhU55PfD99KEEXQG6yb7iOMyvYuHew==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/ua-parser-js" + }, + { + "type": "paypal", + "url": "https://paypal.me/faisalman" + }, + { + "type": "github", + "url": "https://github.com/sponsors/faisalman" + } + ], + "license": "MIT", + "bin": { + "ua-parser-js": "script/cli.js" + }, + "engines": { + "node": "*" + } + }, "node_modules/ufo": { "version": "1.5.4", "resolved": "https://mirrors.huaweicloud.com/repository/npm/ufo/-/ufo-1.5.4.tgz", @@ -7687,6 +7714,19 @@ } } }, + "node_modules/vue-device-detect": { + "version": "1.0.3", + "resolved": "https://mirrors.huaweicloud.com/repository/npm/vue-device-detect/-/vue-device-detect-1.0.3.tgz", + "integrity": "sha512-3DzdW88bHReUS9hUaqXvUXFmpa9QsZ0Dmo8EjvteBU1OoaDP9jwEj+LvCXjYSzGBC1fEylTHoOXwvqj4jwBHOQ==", + "license": "ISC", + "dependencies": { + "ua-parser-js": "^1.0.2", + "vue-device-detect": "^1.0.0" + }, + "peerDependencies": { + "vue": "^3.2.32" + } + }, "node_modules/vue-eslint-parser": { "version": "8.3.0", "resolved": "https://registry.npmmirror.com/vue-eslint-parser/-/vue-eslint-parser-8.3.0.tgz", diff --git a/package.json b/package.json index d59fb47..3a451c3 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "reset-css": "^5.0.2", "vconsole": "^3.15.1", "vue": "^3.2.26", + "vue-device-detect": "^1.0.3", "vue-i18n": "^10.0.3", "vue-request": "^1.2.3", "vue-router": "^4.0.12" diff --git a/src/assets/img/Feedback/border.png b/src/assets/img/Feedback/border.png new file mode 100644 index 0000000..2e2460c Binary files /dev/null and b/src/assets/img/Feedback/border.png differ diff --git a/src/assets/img/Feedback/failure.png b/src/assets/img/Feedback/failure.png new file mode 100644 index 0000000..0414a93 Binary files /dev/null and b/src/assets/img/Feedback/failure.png differ diff --git a/src/assets/img/Feedback/save.png b/src/assets/img/Feedback/save.png new file mode 100644 index 0000000..e6fd6b7 Binary files /dev/null and b/src/assets/img/Feedback/save.png differ diff --git a/src/assets/img/Feedback/success.png b/src/assets/img/Feedback/success.png new file mode 100644 index 0000000..5659b61 Binary files /dev/null and b/src/assets/img/Feedback/success.png differ diff --git a/src/store/audio.js b/src/store/audio.js index 8697713..da1c41a 100644 --- a/src/store/audio.js +++ b/src/store/audio.js @@ -5,6 +5,7 @@ export const useAudioStore = defineStore('audio', { soundInstance: null, // Howl 实例 isPlaying: false, // 播放状态 isVoiceEnabled: true, // 新增声音开关状态 + playbackPosition: 0, // 新增播放位置存储 lastVoiceState: null, ttsUrl:'' }), diff --git a/src/views/AIchat.vue b/src/views/AIchat.vue index ff913a4..cf4e105 100644 --- a/src/views/AIchat.vue +++ b/src/views/AIchat.vue @@ -96,11 +96,10 @@ const playAudio = (url) => { const handlePlay = () => { - if (audioStore.soundInstance) { - Howler.unload(); // 添加清理旧实例 - // audioStore.soundInstance.stop() - } - + // if (audioStore.soundInstance) { + // Howler.unload(); // 添加清理旧实例 + // // audioStore.soundInstance.stop() + // } const newSound = new Howl({ src: [url], html5: true, // 强制HTML5 Audio解决iOS兼容问题 @@ -149,11 +148,11 @@ const pauseAudio = () => { } audioStore.isPlaying = false; - // 添加状态同步 - nextTick(() => { - Howler.unload(); - audioStore.soundInstance = null; - }); + // // 添加状态同步 + // nextTick(() => { + // Howler.unload(); + // audioStore.soundInstance = null; + // }); } }; @@ -375,111 +374,6 @@ watch( } } - // if (status === null || status.code == 200) { - // if (ans.value.answerG !== "") { - // AIcontent.value = ans.value.answerG; - // const code = ans.value.code; - // const market = ans.value.market; - // const data = JSON.parse(ans.value.duobaoData); - - // console.log("处理 K 线数据 - 开始"); - // console.log(data, "data"); - - // const Kline20 = { - // name: data.data.HomePage.StockInformation.Name, - // Kline: data.data.AIBull.KLine20 - // } - - // // 打印K线数据结构 - // console.log("K线数据结构:", Kline20); - // console.log("K线数据名称:", Kline20.name); - // console.log("K线数据数组长度:", Kline20.Kline ? Kline20.Kline.length : 0); - - // // 输出第一个数据点作为示例 - // if (Kline20.Kline && Kline20.Kline.length > 0) { - // console.log("K线首个数据点:", Kline20.Kline[0]); - // } - - // // 设置数据有效标志 - // hasValidData.value = true; - // console.log("hasValidData设置为:", hasValidData.value); - - // chatStore.messages.pop(); - - // // 先推送K线图消息 - // const klineMessageId = `kline-${Date.now()}`; - // console.log("生成K线消息ID:", klineMessageId); - - // chatStore.messages.push({ - // sender: "ai", - // type: "kline", - // chartData: Kline20, - // messageId: klineMessageId, - // hasValidData: true // 添加hasValidData标志 - // }); - - // console.log("K线消息已添加到聊天列表"); - - // // 再推送文字分析内容的消息 - // chatStore.messages.push({ - // sender: "ai", - // content: "AI正在思考中..." - // }); - - // // 在渲染完成后初始化图表 - // nextTick(() => { - // console.log("nextTick开始 - 准备渲染图表"); - // console.log("消息列表:", chatStore.messages); - - // // 寻找最新添加的K线消息索引 - // let klineIndex = -1; - // for (let i = 0; i < chatStore.messages.length; i++) { - // if (chatStore.messages[i].messageId === klineMessageId) { - // klineIndex = i; - // break; - // } - // } - - // console.log("找到的K线消息索引:", klineIndex); - - // if (klineIndex !== -1) { - // const containerId = `kline-container-${klineIndex}`; - // console.log("图表容器ID:", containerId); - - // // 确保DOM已经渲染完成 - // setTimeout(() => { - // console.log("延时执行,确保DOM已渲染"); - // KlineCanvsEcharts(containerId); - // }, 100); // 短暂延时确保DOM已渲染 - // } else { - // console.warn("未找到K线消息"); - // } - // }); - - // } else if (ans.value.answerN !== "") { - // AIcontent.value = ans.value.answerN; - // } else if (ans.value.answerO !== "") { - // AIcontent.value = ans.value.answerO; - // } - - // // 使用marked库将Markdown转换为HTML - // AIcontent.value = marked(AIcontent.value,); - // // 使用 KaTeX 渲染数学公式 - // const katexRegex = /\$\$(.*?)\$\$/g; - // AIcontent.value = AIcontent.value.replace(katexRegex, (match, formula) => { - // try { - // return katex.renderToString(formula, { throwOnError: false }); - // } catch (error) { - // console.error('KaTeX 渲染错误:', error); - // return match; - // } - // }); - - // chatStore.messages.push({ - // sender: "ai", - // content: AIcontent.value - // }) - // 修改后的消息处理逻辑 const processedContent = marked(AIcontent.value); const katexRegex = /\$\$(.*?)\$\$/g; @@ -861,13 +755,14 @@ watch( tryPlay(); } else { console.log("关闭语音播放"); + pauseAudio(); // 强制停止并释放资源 - Howler.stop(); - Howler.unload(); - if (audioStore.soundInstance) { - audioStore.soundInstance.off(); // 移除所有事件监听 - audioStore.soundInstance = null; - } + // Howler.stop(); + // Howler.unload(); + // if (audioStore.soundInstance) { + // audioStore.soundInstance.off(); // 移除所有事件监听 + // audioStore.soundInstance = null; + // } } }, { immediate: true } @@ -972,7 +867,8 @@ onUnmounted(() => { {{ questions.title }} -
各位AI小财神的用户,大家好!
-试运行期间,用户可在AI小财神中查看全
-市场数据,每个市场可查看20只股票.
-以下为各个市场可以查看的股票:
- + +各位AI小财神的用户,大家好!
+试运行期间,用户可在AI小财神中查看全
+市场数据,每个市场可查看20只股票.
+以下为各个市场可以查看的股票:
+ +