【新增】AI:新建对话时,不使用默认角色

This commit is contained in:
YunaiV 2024-05-24 20:58:31 +08:00
parent ac18d871ca
commit ca40047f0b

View File

@ -36,10 +36,11 @@
<div class="message-container" > <div class="message-container" >
<MessageLoading v-if="listLoading" /> <MessageLoading v-if="listLoading" />
<MessageNewChat v-if="!activeConversation" @on-new-chat="handlerNewChat" /> <MessageNewChat v-if="!activeConversation" @on-new-chat="handlerNewChat" />
<ChatEmpty v-if="!listLoading && list.length === 0 && activeConversation" @on-prompt="doSend"/> <ChatEmpty v-if="!listLoading && messageList.length === 0 && activeConversation" @on-prompt="doSend"/>
<Message v-if="!listLoading && list.length > 0" <Message v-if="!listLoading && messageList.length > 0"
ref="messageRef" ref="messageRef"
:list="list" :conversation="activeConversation"
:list="messageList"
@on-delete-success="handlerMessageDelete" @on-delete-success="handlerMessageDelete"
@on-edit="handlerMessageEdit" @on-edit="handlerMessageEdit"
@on-refresh="handlerMessageRefresh"/> @on-refresh="handlerMessageRefresh"/>
@ -109,7 +110,6 @@ import {Download, Top} from "@element-plus/icons-vue";
const route = useRoute() // const route = useRoute() //
const message = useMessage() // const message = useMessage() //
const {copy} = useClipboard() // copy
// ref // ref
const activeConversationId = ref<string | null>(null) // const activeConversationId = ref<string | null>(null) //
@ -396,6 +396,23 @@ const stopStream = async () => {
// ============== message ================= // ============== message =================
/** 消息列表 */
const messageList = computed(() => {
if (list.value.length > 0) {
return list.value
}
// systemMessage
// TODO add by
if (activeConversation.value?.systemMessage) {
return [{
id: 0,
type: 'system',
content: activeConversation.value.systemMessage
}]
}
return []
})
/** /**
* 获取 - message 列表 * 获取 - message 列表
*/ */