refactor: 移除bot消息组件中的mentionedItems相关代码,简化组件逻辑

This commit is contained in:
wizardchen
2025-12-22 12:21:36 +08:00
committed by lyingbug
parent 1ac663fc3f
commit 86347d4c16
2 changed files with 1 additions and 87 deletions
@@ -92,11 +92,6 @@ const props = defineProps({
required: false,
default: ''
},
mentionedItems: {
type: Array,
required: false,
default: () => []
},
isFirstEnter: {
type: Boolean,
required: false
@@ -271,75 +266,6 @@ onBeforeUnmount(() => {
<style lang="less" scoped>
@import '../../../components/css/markdown.less';
// @提及的知识库和文件标签样式
.mentioned_items {
display: flex;
flex-wrap: wrap;
gap: 6px;
justify-content: flex-start;
max-width: 100%;
margin-bottom: 2px;
}
.mentioned_tag {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 4px 8px;
border-radius: 6px;
font-size: 12px;
font-weight: 500;
max-width: 200px;
cursor: default;
transition: all 0.15s;
background: var(--td-bg-color-secondarycontainer, #f3f3f3);
border: 1px solid transparent;
color: var(--td-text-color-primary, #333);
/* KB - Document (Greenish tint) */
&.kb-tag {
background: rgba(16, 185, 129, 0.08);
color: #059669;
.tag_icon {
color: #10b981;
}
}
/* KB - FAQ (Blueish tint) */
&.faq-tag {
background: rgba(0, 82, 217, 0.08);
color: #0052d9;
.tag_icon {
color: #0052d9;
}
}
/* File (Orange tint) */
&.file-tag {
background: rgba(237, 123, 47, 0.08);
color: #e65100;
.tag_icon {
color: #ed7b2f;
}
}
.tag_icon {
font-size: 14px;
display: flex;
align-items: center;
}
.tag_name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: currentColor;
}
}
// 内容包装器 - 与 Agent 模式的 answer 样式一致
.content-wrapper {
background: #ffffff;
+1 -13
View File
@@ -7,7 +7,7 @@
<usermsg :content="session.content" :mentioned_items="session.mentioned_items"></usermsg>
</div>
<div v-if="session.role == 'assistant'">
<botmsg :content="session.content" :session="session" :user-query="getUserQuery(id)" :mentioned-items="getUserMentionedItems(id)" @scroll-bottom="scrollToBottom"
<botmsg :content="session.content" :session="session" :user-query="getUserQuery(id)" @scroll-bottom="scrollToBottom"
:isFirstEnter="isFirstEnter"></botmsg>
</div>
</div>
@@ -93,18 +93,6 @@ const getUserQuery = (index) => {
}
return '';
};
// 获取用户消息的 mentioned_items(用于 bot 消息显示)
const getUserMentionedItems = (index) => {
if (index <= 0) {
return [];
}
const previous = messagesList[index - 1];
if (previous && previous.role === 'user') {
return previous.mentioned_items || [];
}
return [];
};
watch([() => route.params], (newvalue) => {
isFirstEnter.value = true;
if (newvalue[0].chatid) {