【增加】拉去对话信息,选中切换的模型

This commit is contained in:
cherishsince 2024-05-14 17:58:06 +08:00
parent 8d907a76bf
commit 175f9d58ad
2 changed files with 22 additions and 18 deletions

View File

@ -27,7 +27,7 @@ export interface ChatConversationUpdateVO {
// AI chat 聊天
export const ChatConversationApi = {
// 获取 Conversation
get: async (id: number) => {
get: async (id: string) => {
return await request.get({ url: `/ai/chat/conversation/get?id=${id}`})
},
// 更新 Conversation

View File

@ -179,7 +179,11 @@
<script setup lang="ts">
import {ChatMessageApi, ChatMessageSendVO, ChatMessageVO} from "@/api/ai/chat/message"
import {ChatConversationApi, ChatConversationUpdateVO} from "@/api/ai/chat/conversation"
import {
ChatConversationApi,
ChatConversationUpdateVO,
ChatConversationVO
} from "@/api/ai/chat/conversation"
import {ChatModelApi, ChatModelVO} from "@/api/ai/model/chatModel"
import {formatDate} from "@/utils/formatTime"
import {useClipboard} from "@vueuse/core";
@ -237,6 +241,7 @@ const isComposing = ref(false) // 判断用户是否在输入
// defineOptions({ name: 'chatMessageList' })
const list = ref<ChatMessageVO[]>([]) //
const useModal = ref<ChatModelVO>() // 使modal
const useConversation = ref<ChatConversationVO>() // 使 Conversation
const modalList = ref<ChatModelVO[]>([]) //
@ -437,10 +442,6 @@ const modalClick = async (command) => {
const getModalList = async () => {
// as unknown as ChatModelVO
modalList.value = await ChatModelApi.getChatModelSimpleList(0) as unknown as ChatModelVO[]
//
if (modalList.value.length) {
useModal.value = modalList.value[0]
}
}
//
@ -477,25 +478,28 @@ const onPromptInput = (event) => {
console.log('setTimeout 输入结束...')
isComposing.value = false
}, 400)
// isComposing.value= false
// setTimeout(() => {
// console.log('...')
// isComposing.value = false
// }, 200)
// isComposing.value = event.data && event.data === event.target.value.slice(-1);
//
// if (isComposing.value) {
// console.log('使');
// } else {
// console.log('');
// }
}
const getConversation = async (conversationId: string) => {
//
useConversation.value = await ChatConversationApi.get(conversationId)
console.log('useConversation.value', useConversation.value)
// modal
if (useConversation.value) {
modalList.value.forEach(item => {
if (useConversation.value?.modelId === item.id) {
useModal.value = item
}
})
}
}
/** 初始化 **/
onMounted(async () => {
//
getModalList();
//
getConversation(conversationId.value);
//
messageList();
// scrollToBottom();