feat:增加几种长文本组件
This commit is contained in:
@@ -53,6 +53,9 @@ export const CompName = {
|
|||||||
mapCard: "mapCard",
|
mapCard: "mapCard",
|
||||||
// 回答卡片
|
// 回答卡片
|
||||||
longTextCard: "longTextCard",
|
longTextCard: "longTextCard",
|
||||||
|
longTextCardSnap: "longTextCardSnap",
|
||||||
|
longTextCardRoute: "longTextCardRoute",
|
||||||
|
longTextCardScenicSpot: "longTextCardScenicSpot",
|
||||||
// 生成合成图片
|
// 生成合成图片
|
||||||
aigcPhotoGeneratorCard: "aigcPhotoGeneratorCard",
|
aigcPhotoGeneratorCard: "aigcPhotoGeneratorCard",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
class="flex flex-justify-start"
|
class="flex flex-justify-start"
|
||||||
:key="`ai-${item.msgId}-${item.msg ? item.msg.length : 0}`"
|
:key="`ai-${item.msgId}-${item.msg ? item.msg.length : 0}`"
|
||||||
:text="
|
:text="
|
||||||
item.componentName && item.componentName === CompName.longTextCard
|
item.componentName && isLongTextCard(item.componentName)
|
||||||
? ''
|
? ''
|
||||||
: item.msg || ''
|
: item.msg || ''
|
||||||
"
|
"
|
||||||
@@ -70,12 +70,11 @@
|
|||||||
#content
|
#content
|
||||||
v-if="
|
v-if="
|
||||||
item.toolCall ||
|
item.toolCall ||
|
||||||
(item.componentName &&
|
(item.componentName && isLongTextCard(item.componentName))
|
||||||
item.componentName === CompName.longTextCard)
|
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<AnswerComponent
|
<AnswerComponent
|
||||||
v-if="item.componentName === CompName.longTextCard"
|
v-if="isLongTextCard(item.componentName)"
|
||||||
:longTextData="item.longTextData"
|
:longTextData="item.longTextData"
|
||||||
:finish="item.finish"
|
:finish="item.finish"
|
||||||
/>
|
/>
|
||||||
@@ -844,7 +843,7 @@ const handleWebSocketMessage = (data) => {
|
|||||||
const aiItem = chatMsgList.value[aiMsgIndex];
|
const aiItem = chatMsgList.value[aiMsgIndex];
|
||||||
if (data.componentName) {
|
if (data.componentName) {
|
||||||
aiItem.componentName = data.componentName;
|
aiItem.componentName = data.componentName;
|
||||||
if (data.componentName === CompName.longTextCard) {
|
if (isLongTextCard(data.componentName)) {
|
||||||
aiItem.longTextData = aiItem.longTextData || createLongTextData();
|
aiItem.longTextData = aiItem.longTextData || createLongTextData();
|
||||||
if (aiItem.msg && aiItem.msg.length > 0) {
|
if (aiItem.msg && aiItem.msg.length > 0) {
|
||||||
if (!aiItem.isLoading) {
|
if (!aiItem.isLoading) {
|
||||||
@@ -855,9 +854,7 @@ const handleWebSocketMessage = (data) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const isLongText =
|
const isLongText = isLongTextCard(aiItem.componentName) || isLongTextCard(data.componentName);
|
||||||
aiItem.componentName === CompName.longTextCard ||
|
|
||||||
data.componentName === CompName.longTextCard;
|
|
||||||
|
|
||||||
if (isLongText && data.contentKey) {
|
if (isLongText && data.contentKey) {
|
||||||
aiItem.longTextData = aiItem.longTextData || createLongTextData();
|
aiItem.longTextData = aiItem.longTextData || createLongTextData();
|
||||||
@@ -949,6 +946,15 @@ const handleWebSocketMessage = (data) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isLongTextCard = (componentName) => {
|
||||||
|
return (
|
||||||
|
componentName === CompName.longTextCard ||
|
||||||
|
componentName === CompName.longTextCardSnap ||
|
||||||
|
componentName === CompName.longTextCardRoute ||
|
||||||
|
componentName === CompName.longTextCardScenicSpot
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
// 重置消息状态
|
// 重置消息状态
|
||||||
const resetMessageState = () => {
|
const resetMessageState = () => {
|
||||||
// 重置当前会话消息ID
|
// 重置当前会话消息ID
|
||||||
|
|||||||
Reference in New Issue
Block a user