|
|
@@ -248,6 +248,18 @@ const stopStream = async () => {
|
|
|
// 发送消息函数
|
|
|
const sendMessage = async() => {
|
|
|
if (uploadedImage.value) {
|
|
|
+ // 如果正在录音,先停止录音
|
|
|
+ if (isVoiceRecording.value) {
|
|
|
+ const voiceInputComponent = document.querySelector('.voice-input-container .speech-btn');
|
|
|
+ if (voiceInputComponent) {
|
|
|
+ voiceInputComponent.click();
|
|
|
+ }
|
|
|
+ // 等待录音结束后再发送
|
|
|
+ setTimeout(() => {
|
|
|
+ sendMessage(inputMessage.value);
|
|
|
+ }, 100);
|
|
|
+ return;
|
|
|
+ }
|
|
|
// 创建 AbortController 实例,以便中止请求
|
|
|
conversationInAbortController.value = new AbortController();
|
|
|
// 标记对话进行中
|