remove chat debug log

This commit is contained in:
RockYang
2024-07-28 18:55:17 +08:00
parent abdf5298fe
commit 1bcbf74883
4 changed files with 16 additions and 21 deletions

View File

@@ -94,7 +94,7 @@
</template>
<script setup>
import {nextTick, onMounted, onUnmounted, ref} from 'vue';
import {nextTick, onUnmounted, ref} from 'vue';
import {Markmap} from 'markmap-view';
import {Transformer} from 'markmap-lib';
import {checkSession} from "@/action/session";
@@ -209,7 +209,6 @@ window.onresize = () => {
}
const socket = ref(null)
const heartbeatHandle = ref(0)
const connect = (userId) => {
if (socket.value !== null) {
socket.value.close()
@@ -224,24 +223,9 @@ const connect = (userId) => {
}
}
// 心跳函数
const sendHeartbeat = () => {
clearTimeout(heartbeatHandle.value)
new Promise((resolve, reject) => {
if (socket.value !== null) {
socket.value.send(JSON.stringify({type: "heartbeat", content: "ping"}))
}
resolve("success")
}).then(() => {
heartbeatHandle.value = setTimeout(() => sendHeartbeat(), 5000)
});
}
const _socket = new WebSocket(host + `/api/markMap/client?user_id=${userId}&model_id=${modelID.value}`);
_socket.addEventListener('open', () => {
socket.value = _socket;
// 发送心跳消息
sendHeartbeat()
});
_socket.addEventListener('message', event => {

View File

@@ -283,6 +283,7 @@ import {formatTime} from "@/utils/libs";
import Clipboard from "clipboard";
import BlackDialog from "@/components/ui/BlackDialog.vue";
import Compressor from "compressorjs";
import {useSharedStore} from "@/store/sharedata";
const winHeight = ref(window.innerHeight - 50)
const custom = ref(false)
@@ -329,6 +330,8 @@ const btnText = ref("开始创作")
const refSong = ref(null)
const showDialog = ref(false)
const editData = ref({title:"",cover:"",id:0})
const isLogin = ref(false)
const store = useSharedStore();
const socket = ref(null)
const userId = ref(0)
@@ -381,9 +384,10 @@ onMounted(() => {
checkSession().then(user => {
userId.value = user.id
fetchData(1)
isLogin.value = true
connect()
})
fetchData(1)
})
onUnmounted(() => {
@@ -411,6 +415,8 @@ const fetchData = (_page) => {
noData.value = list.value.length === 0
}).catch(e => {
showMessageError("获取作品列表失败:"+e.message)
loading.value = false
noData.value = true
})
}
@@ -436,6 +442,10 @@ const create = () => {
return showMessageError("续写开始时间不能超过原歌曲长度")
}
if (!isLogin.value) {
store.setShowLoginDialog(true)
return
}
httpPost("/api/suno/create", data.value).then(() => {
fetchData(1)
showMessageOK("创建任务成功")