bug fixed

This commit is contained in:
GatlinHa
2025-05-30 22:28:21 +08:00
parent 70afd3ae7e
commit 33fe4936b4
5 changed files with 19 additions and 29 deletions

View File

@@ -10,7 +10,7 @@ const documentData = useDocumentStore()
export const showSimplifyMsgContent = (content) => { export const showSimplifyMsgContent = (content) => {
const arr = jsonParseSafe(content) const arr = jsonParseSafe(content)
if (!arr) { if (!arr || !Array.isArray(arr) || arr.length === 0) {
return content return content
} }

View File

@@ -65,7 +65,7 @@ const loadRelatedMsg = async () => {
for (const msg of props.msgs) { for (const msg of props.msgs) {
const content = msg.content const content = msg.content
const arr = jsonParseSafe(content) const arr = jsonParseSafe(content)
if (!arr) { if (!arr || !Array.isArray(arr) || arr.length === 0) {
continue continue
} }
@@ -131,7 +131,7 @@ const renderContent = ({ msg }) => {
const msgId = msg.msgId const msgId = msg.msgId
const arr = jsonParseSafe(content) const arr = jsonParseSafe(content)
// 不允许非结构化的content // 不允许非结构化的content
if (!arr) { if (!arr || !Array.isArray(arr) || arr.length === 0) {
return <span></span> return <span></span>
} }
@@ -191,8 +191,7 @@ const renderAudio = (audioId) => {
<MsgBoxAudio <MsgBoxAudio
url={url} url={url}
fileName={audioData.audio[audioId].fileName} fileName={audioData.audio[audioId].fileName}
size={audioData.audio[audioId].size} size={audioData.audio[audioId].size}></MsgBoxAudio>
></MsgBoxAudio>
) )
} else { } else {
return <span>{`[${audioId}]`}</span> return <span>{`[${audioId}]`}</span>
@@ -217,8 +216,7 @@ const renderImage = (imgId, isScreenShot = false) => {
imgId={imgId} imgId={imgId}
isScreenShot={isScreenShot} isScreenShot={isScreenShot}
thumbWidth={imageData.image[imgId].thumbWidth} thumbWidth={imageData.image[imgId].thumbWidth}
thumbHeight={imageData.image[imgId].thumbHeight} thumbHeight={imageData.image[imgId].thumbHeight}></MsgBoxImage>
></MsgBoxImage>
) )
} else { } else {
return <span>{`[${imgId}]`}</span> return <span>{`[${imgId}]`}</span>
@@ -236,8 +234,7 @@ const renderVideo = (videoId, msgId) => {
fileName={videoData.video[videoId].fileName} fileName={videoData.video[videoId].fileName}
size={videoData.video[videoId].size} size={videoData.video[videoId].size}
width={videoData.video[videoId].width} width={videoData.video[videoId].width}
height={videoData.video[videoId].height} height={videoData.video[videoId].height}></MsgBoxVideo>
></MsgBoxVideo>
) )
} else { } else {
return <span>{`[${videoId}]`}</span> return <span>{`[${videoId}]`}</span>
@@ -252,8 +249,7 @@ const renderDocument = (documentId) => {
url={url} url={url}
fileName={documentData.document[documentId].fileName} fileName={documentData.document[documentId].fileName}
fileSize={documentData.document[documentId].size} fileSize={documentData.document[documentId].size}
contentType={documentData.document[documentId].documentType} contentType={documentData.document[documentId].documentType}></MsgBoxDocument>
></MsgBoxDocument>
) )
} else { } else {
return <span>{`[${documentId}]`}</span> return <span>{`[${documentId}]`}</span>
@@ -316,8 +312,7 @@ const renderForwardTogether = (forwardContent, msgId) => {
}) })
// 挂载到新创建的容器 // 挂载到新创建的容器
app.mount(container) app.mount(container)
}} }}>
>
<div class={'main'}> <div class={'main'}>
<span class={'title'}>{title}</span> <span class={'title'}>{title}</span>
<div class={'msg-list'}> <div class={'msg-list'}>

View File

@@ -232,7 +232,7 @@ const historyMsgsShow = computed(() => {
data = historyMsgs.value.filter((msg) => { data = historyMsgs.value.filter((msg) => {
const arr = jsonParseSafe(msg.content) const arr = jsonParseSafe(msg.content)
// 不允许非结构化的content // 不允许非结构化的content
if (!arr) { if (!arr || !Array.isArray(arr) || arr.length === 0) {
return false return false
} }
@@ -320,7 +320,7 @@ const loadRelatedMsg = async () => {
for (const msg of historyMsgs.value) { for (const msg of historyMsgs.value) {
const content = msg.content const content = msg.content
const arr = jsonParseSafe(content) const arr = jsonParseSafe(content)
if (!arr) { if (!arr || !Array.isArray(arr) || arr.length === 0) {
continue continue
} }
@@ -404,7 +404,7 @@ const renderContent = ({ msg }) => {
const msgId = msg.msgId const msgId = msg.msgId
const arr = jsonParseSafe(content) const arr = jsonParseSafe(content)
// 不允许非结构化的content // 不允许非结构化的content
if (!arr) { if (!arr || !Array.isArray(arr) || arr.length === 0) {
return <span></span> return <span></span>
} }
@@ -464,8 +464,7 @@ const renderAudio = (audioId) => {
<MsgBoxAudio <MsgBoxAudio
url={url} url={url}
fileName={audioData.audio[audioId].fileName} fileName={audioData.audio[audioId].fileName}
size={audioData.audio[audioId].size} size={audioData.audio[audioId].size}></MsgBoxAudio>
></MsgBoxAudio>
) )
} else { } else {
return <span>{`[${audioId}]`}</span> return <span>{`[${audioId}]`}</span>
@@ -490,8 +489,7 @@ const renderImage = (imgId, isScreenShot = false) => {
imgId={imgId} imgId={imgId}
isScreenShot={isScreenShot} isScreenShot={isScreenShot}
thumbWidth={imageData.image[imgId].thumbWidth} thumbWidth={imageData.image[imgId].thumbWidth}
thumbHeight={imageData.image[imgId].thumbHeight} thumbHeight={imageData.image[imgId].thumbHeight}></MsgBoxImage>
></MsgBoxImage>
) )
} else { } else {
return <span>{`[${imgId}]`}</span> return <span>{`[${imgId}]`}</span>
@@ -509,8 +507,7 @@ const renderVideo = (videoId, msgId) => {
fileName={videoData.video[videoId].fileName} fileName={videoData.video[videoId].fileName}
size={videoData.video[videoId].size} size={videoData.video[videoId].size}
width={videoData.video[videoId].width} width={videoData.video[videoId].width}
height={videoData.video[videoId].height} height={videoData.video[videoId].height}></MsgBoxVideo>
></MsgBoxVideo>
) )
} else { } else {
return <span>{`[${videoId}]`}</span> return <span>{`[${videoId}]`}</span>
@@ -525,8 +522,7 @@ const renderDocument = (documentId) => {
url={url} url={url}
fileName={documentData.document[documentId].fileName} fileName={documentData.document[documentId].fileName}
fileSize={documentData.document[documentId].size} fileSize={documentData.document[documentId].size}
contentType={documentData.document[documentId].documentType} contentType={documentData.document[documentId].documentType}></MsgBoxDocument>
></MsgBoxDocument>
) )
} else { } else {
return <span>{`[${documentId}]`}</span> return <span>{`[${documentId}]`}</span>
@@ -589,8 +585,7 @@ const renderForward = (forwardContent, msgId) => {
}) })
// 挂载到新创建的容器 // 挂载到新创建的容器
app.mount(container) app.mount(container)
}} }}>
>
<div class={'main'}> <div class={'main'}>
<span class={'title'}>{title}</span> <span class={'title'}>{title}</span>
<div class={'msg-list'}> <div class={'msg-list'}>

View File

@@ -731,7 +731,7 @@ const renderContent = async (content) => {
const arr = jsonParseSafe(content) const arr = jsonParseSafe(content)
// 不允许非结构化的content // 不允许非结构化的content
if (!arr) { if (!arr || !Array.isArray(arr) || arr.length === 0) {
quill.value.setText('') quill.value.setText('')
return return
} }

View File

@@ -79,7 +79,7 @@ onMounted(async () => {
*/ */
const loadRelatedMsg = async () => { const loadRelatedMsg = async () => {
const arr = jsonParseSafe(msg.value.content) const arr = jsonParseSafe(msg.value.content)
if (!arr) { if (!arr || !Array.isArray(arr) || arr.length === 0) {
return return
} }
@@ -151,7 +151,7 @@ const renderComponent = (content) => {
const arr = jsonParseSafe(content) const arr = jsonParseSafe(content)
// 不允许非结构化的content // 不允许非结构化的content
if (!arr) { if (!arr || !Array.isArray(arr) || arr.length === 0) {
return h('span', '') return h('span', '')
} }