|
|
|
@ -378,24 +378,27 @@ export const useAppStore = defineStore('app', () => { |
|
|
|
const reqAndResType = String(payload.reqAndResType || '') |
|
|
|
const reqAndResType = String(payload.reqAndResType || '') |
|
|
|
const msgType = String(payload.msgType || '') |
|
|
|
const msgType = String(payload.msgType || '') |
|
|
|
const fromFlag = String(payload.fromFlag || '') |
|
|
|
const fromFlag = String(payload.fromFlag || '') |
|
|
|
const hasExplicitImageField = Boolean( |
|
|
|
const isProtocolImage = |
|
|
|
|
|
|
|
(reqAndResType === '2' && fromFlag === '1' && msgType !== '01') || |
|
|
|
|
|
|
|
(reqAndResType === '08' && msgType === '02') |
|
|
|
|
|
|
|
const isTextAnswer = Boolean(payload.msgText) && (msgType === '01' || fromFlag !== '1') && !isProtocolImage |
|
|
|
|
|
|
|
const hasExplicitImageField = !isTextAnswer && Boolean( |
|
|
|
payload.imgUrl || payload.imgKey || payload.fileKey || |
|
|
|
payload.imgUrl || payload.imgKey || payload.fileKey || |
|
|
|
(payload.imageUrl && !payload.msgText), |
|
|
|
(payload.imageUrl && !payload.msgText), |
|
|
|
) |
|
|
|
) |
|
|
|
const isProtocolImage = |
|
|
|
|
|
|
|
(reqAndResType === '2' && (fromFlag === '1' || msgType === '02')) || |
|
|
|
|
|
|
|
(reqAndResType === '08' && msgType === '02') |
|
|
|
|
|
|
|
const isImageMessage = |
|
|
|
const isImageMessage = |
|
|
|
|
|
|
|
!isTextAnswer && ( |
|
|
|
payload.message?.[0]?.type === 'image' || |
|
|
|
payload.message?.[0]?.type === 'image' || |
|
|
|
isProtocolImage || |
|
|
|
isProtocolImage || |
|
|
|
hasExplicitImageField |
|
|
|
hasExplicitImageField |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
if (!isImageMessage) { |
|
|
|
if (!isImageMessage) { |
|
|
|
return payload.imageUrl || options.imageUrl || '' |
|
|
|
return payload.imageUrl || options.imageUrl || '' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// liics may return an image URL/key in any of these fields. For the
|
|
|
|
// liics may return an image URL/key in any of these fields. For a
|
|
|
|
// legacy reqAndResType=2 response, msgText is the image key.
|
|
|
|
// user upload record (fromFlag=1, reqAndResType=2), msgText is the key.
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
payload.imageUrl || |
|
|
|
payload.imageUrl || |
|
|
|
payload.imgUrl || |
|
|
|
payload.imgUrl || |
|
|
|
@ -415,10 +418,11 @@ export const useAppStore = defineStore('app', () => { |
|
|
|
const msgType = String(payload.msgType || '') |
|
|
|
const msgType = String(payload.msgType || '') |
|
|
|
const fromFlag = String(payload.fromFlag || '') |
|
|
|
const fromFlag = String(payload.fromFlag || '') |
|
|
|
const isProtocolImage = |
|
|
|
const isProtocolImage = |
|
|
|
(reqAndResType === '2' && (fromFlag === '1' || msgType === '02')) || |
|
|
|
(reqAndResType === '2' && fromFlag === '1' && msgType !== '01') || |
|
|
|
(reqAndResType === '08' && msgType === '02') |
|
|
|
(reqAndResType === '08' && msgType === '02') |
|
|
|
|
|
|
|
const isTextAnswer = Boolean(payload.msgText) && (msgType === '01' || fromFlag !== '1') && !isProtocolImage |
|
|
|
return Boolean( |
|
|
|
return Boolean( |
|
|
|
imageUrl && ( |
|
|
|
!isTextAnswer && imageUrl && ( |
|
|
|
payload.message?.[0]?.type === 'image' || |
|
|
|
payload.message?.[0]?.type === 'image' || |
|
|
|
isProtocolImage || |
|
|
|
isProtocolImage || |
|
|
|
payload.imgUrl || |
|
|
|
payload.imgUrl || |
|
|
|
@ -643,9 +647,13 @@ export const useAppStore = defineStore('app', () => { |
|
|
|
|
|
|
|
|
|
|
|
// 消息列表
|
|
|
|
// 消息列表
|
|
|
|
function setChatList(payload) { |
|
|
|
function setChatList(payload) { |
|
|
|
const normalizedItem = utils.normalizeMessage(payload) |
|
|
|
const payloadList = Array.isArray(payload) ? payload : [payload] |
|
|
|
|
|
|
|
payloadList.forEach((item) => { |
|
|
|
|
|
|
|
if (!item) return |
|
|
|
|
|
|
|
const normalizedItem = utils.normalizeMessage(item) |
|
|
|
chatList.value.push(normalizedItem) |
|
|
|
chatList.value.push(normalizedItem) |
|
|
|
pushConversationMessage(normalizedItem, 'bot') |
|
|
|
pushConversationMessage(normalizedItem, 'bot') |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function delChatList(index) { |
|
|
|
function delChatList(index) { |
|
|
|
|