diff --git a/src/api/ai/chat/conversation/index.ts b/src/api/ai/chat/conversation/index.ts index 9f5f70f2..acc21fc6 100644 --- a/src/api/ai/chat/conversation/index.ts +++ b/src/api/ai/chat/conversation/index.ts @@ -2,7 +2,7 @@ import request from '@/config/axios' // AI 聊天对话 VO export interface ChatConversationVO { - id: string // ID 编号 + id: number // ID 编号 userId: number // 用户编号 title: string // 对话标题 pinned: boolean // 是否置顶 @@ -23,7 +23,7 @@ export interface ChatConversationVO { // AI 聊天对话 API export const ChatConversationApi = { // 获得【我的】聊天对话 - getChatConversationMy: async (id: string) => { + getChatConversationMy: async (id: number) => { return await request.get({ url: `/ai/chat/conversation/get-my?id=${id}` }) }, diff --git a/src/api/ai/chat/message/index.ts b/src/api/ai/chat/message/index.ts index f9e807a1..90736266 100644 --- a/src/api/ai/chat/message/index.ts +++ b/src/api/ai/chat/message/index.ts @@ -19,22 +19,17 @@ export interface ChatMessageVO { userAvatar: string // 创建时间 } -export interface ChatMessageSendVO { - conversationId: string // 对话编号 - content: number // 聊天内容 -} - // AI chat 聊天 export const ChatMessageApi = { // 消息列表 - messageList: async (conversationId: string | null) => { + getChatMessageListByConversationId: async (conversationId: number | null) => { return await request.get({ url: `/ai/chat/message/list-by-conversation-id?conversationId=${conversationId}` }) }, - // 发送 send stream 消息 - // TODO axios 可以么? https://apifox.com/apiskills/how-to-create-axios-stream/ + // 发送 Stream 消息 + // 为什么不用 axios 呢?因为它不支持 SSE 调用 sendStream: async ( conversationId: number, content: string, @@ -70,7 +65,7 @@ export const ChatMessageApi = { }, // 删除消息 - 对话所有消息 - deleteByConversationId: async (conversationId: string) => { + deleteByConversationId: async (conversationId: number) => { return await request.delete({ url: `/ai/chat/message/delete-by-conversation-id?conversationId=${conversationId}` }) diff --git a/src/views/ai/chat/index/MessageNewChat.vue b/src/views/ai/chat/index/MessageNewChat.vue index aac5f905..727fb282 100644 --- a/src/views/ai/chat/index/MessageNewChat.vue +++ b/src/views/ai/chat/index/MessageNewChat.vue @@ -1,15 +1,16 @@