opt: enable use cdn url for mj-plus

This commit is contained in:
RockYang
2024-01-28 21:56:25 +08:00
parent b4501557c9
commit 0ef6955f96
17 changed files with 193 additions and 158 deletions

BIN
web/public/images/mic.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@@ -27,7 +27,11 @@
}
.button-voice {
padding 0 5px
padding 0 2px
.el-icon {
font-size 24px
}
height 30px
}
}
@@ -52,6 +56,16 @@
}
}
.van-overlay {
.mic-wrapper {
display flex
height 100vh
justify-content center
align-items center
flex-flow column
}
}
.van-theme-dark {
.mobile-chat {
.message-list-box {

View File

@@ -19,6 +19,7 @@ import {
List,
NavBar,
Notify,
Overlay,
Picker,
Popup,
Search,
@@ -65,6 +66,7 @@ app.use(Switch);
app.use(Uploader);
app.use(Tag);
app.use(V3waterfall)
app.use(Overlay)
app.use(router).use(ElementPlus).mount('#app')

View File

@@ -716,10 +716,13 @@ const fetchFinishJobs = (userId) => {
if (jobs[i].type === 'upscale' || jobs[i].type === 'swapFace') {
jobs[i]['thumb_url'] = jobs[i]['img_url'] + '?imageView2/1/w/480/h/600/q/75'
} else {
jobs[i]['can_opt'] = true
jobs[i]['thumb_url'] = jobs[i]['img_url'] + '?imageView2/1/w/480/h/480/q/75'
}
}
if (jobs[i].type === 'image' || jobs[i].type === 'variation') {
jobs[i]['can_opt'] = true
}
}
finishedJobs.value = jobs
}).catch(e => {

View File

@@ -64,7 +64,9 @@
>
<template #left-icon>
<van-button round type="success" class="button-voice" @click="inputVoice">
<van-icon name="volume-o"/>
<el-icon>
<Microphone/>
</el-icon>
</van-button>
</template>
@@ -84,6 +86,19 @@
</div>
<button id="copy-link-btn" style="display: none;" :data-clipboard-text="url">复制链接地址</button>
<van-overlay :show="showMic" z-index="100">
<div class="mic-wrapper">
<div class="image">
<van-image
width="100"
height="100"
src="/images/mic.gif"
/>
</div>
<van-button type="success" @click="stopVoice">说完了</van-button>
</div>
</van-overlay>
</div>
</template>
@@ -101,6 +116,7 @@ import ChatReply from "@/components/mobile/ChatReply.vue";
import {getSessionId, getUserToken} from "@/store/session";
import {checkSession} from "@/action/session";
import Clipboard from "clipboard";
import {Microphone} from "@element-plus/icons-vue";
const winHeight = ref(0)
const navBarRef = ref(null)
@@ -114,6 +130,7 @@ const modelValue = chatConfig.modelValue
const title = chatConfig.title
const chatId = chatConfig.chatId
const loginUser = ref(null)
const showMic = ref(false)
const url = location.protocol + '//' + location.host + '/mobile/chat/export?chat_id=' + chatId
@@ -421,25 +438,29 @@ const shareChat = (option) => {
}
}
// eslint-disable-next-line no-undef
const recognition = new webkitSpeechRecognition() || SpeechRecognition();
//recognition.lang = 'zh-CN' // 设置语音识别语言
recognition.onresult = function (event) {
prompt.value = event.results[0][0].transcript
};
recognition.onerror = function (event) {
showNotify({type: 'danger', message: '语音识别错误:' + event.error})
};
recognition.onend = function () {
console.log('语音识别结束');
};
const inputVoice = () => {
const recognition = new webkitSpeechRecognition() || SpeechRecognition();
// recognition.lang = 'zh-CN' // 设置语音识别语言
recognition.onresult = function (event) {
const result = event.results[0][0].transcript;
showToast('你说了: ' + result)
};
recognition.onerror = function (event) {
showNotify({type: 'danger', message: '语音识别错误:' + event.error})
};
recognition.onend = function () {
console.log('语音识别结束');
};
showMic.value = true
recognition.start();
}
const stopVoice = () => {
showMic.value = false
recognition.stop()
}
</script>
<style lang="stylus">