feat: auto translate and rewrite prompt for midjourney and stable-diffusion

This commit is contained in:
RockYang
2024-03-27 13:45:52 +08:00
parent b60a639312
commit 9794d67eaa
18 changed files with 162 additions and 355 deletions

View File

@@ -103,7 +103,7 @@
</template>
<script setup>
import {nextTick, onMounted, ref} from "vue";
import {nextTick, onMounted, onUnmounted, ref} from "vue";
import {showImagePreview, showNotify, showToast} from "vant";
import {onBeforeRouteLeave, useRouter} from "vue-router";
import {dateFormat, processContent, randString, renderInputText, UUID} from "@/utils/libs";
@@ -147,6 +147,10 @@ onMounted(() => {
})
})
onUnmounted(() => {
socket.value = null
})
const chatData = ref([])
const loading = ref(false)
const finished = ref(false)
@@ -347,12 +351,11 @@ const connect = function (chat_id, role_id) {
});
_socket.addEventListener('close', () => {
if (activelyClose.value) { // 忽略主动关闭
if (activelyClose.value || socket.value === null) { // 忽略主动关闭
return;
}
// 停止发送消息
canSend.value = true;
socket.value = null;
// 重连
checkSession().then(() => {
connect(chat_id, role_id)