chat: 改进聊天内容基于角色的显示逻辑

在[index.vue](file://src/pages/chats/[id]/index.vue)中,根据消息的`role`属性调整消息的显示方式,以区分不同角色(`assistant`、`system`和`user`)的消息显示。

同时,移除了无用的注释代码,并对界面布局进行了微调,以优化用户阅读体验。
This commit is contained in:
ivamp 2024-08-04 23:28:33 +08:00
parent 2b5262f1c3
commit 0eba9aaa37
2 changed files with 19 additions and 2 deletions

View File

@ -72,6 +72,18 @@ const chats = computed<ApiV1ChatsGet200Response>(() => {
});
chatStore.getChats();
let waitUpdate = false;
chatStore.$subscribe(() => {
if (waitUpdate) {
return;
}
waitUpdate = true;
setTimeout(() => {
chatStore.getChats();
waitUpdate = false;
}, 1000);
});
//
// setInterval(() => {
// chats.value.data = chatStore.chats.data

View File

@ -22,8 +22,13 @@
</template>
<v-card-text class="bg-surface-light pt-4">
<!-- {{ message.content }} -->
<div v-if="message.role == 'assistant' || message.role == 'system'">
<vue-markdown :source="message.content" />
</div>
<div v-else-if="message.role == 'user'" class="text-right">
<vue-markdown :source="message.content" />
</div>
</v-card-text>
</v-card>