mirror of
https://gitee.com/hhyykk/ipms-sjy-ui.git
synced 2025-07-15 03:15:07 +08:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@ -13,6 +13,7 @@ export interface ChatConversationVO {
|
||||
maxTokens: number // 单条回复的最大 Token 数量
|
||||
maxContexts: number // 上下文的最大 Message 数量
|
||||
// 额外字段
|
||||
modelName?: string // 模型名字
|
||||
roleAvatar?: string // 角色头像
|
||||
modelMaxTokens?: string // 模型的单条回复的最大 Token 数量
|
||||
modelMaxContexts?: string // 模型的上下文的最大 Message 数量
|
||||
@ -21,19 +22,25 @@ 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}` })
|
||||
},
|
||||
// 更新【我的】聊天会话
|
||||
updateChatConversationMy: async (data: ChatConversationVO) => {
|
||||
return await request.put({ url: `/ai/chat/conversation/update-my`, data })
|
||||
},
|
||||
|
||||
// 新增【我的】聊天会话
|
||||
createChatConversationMy: async (data?: ChatConversationVO) => {
|
||||
return await request.post({ url: `/ai/chat/conversation/create-my`, data })
|
||||
},
|
||||
|
||||
// 更新【我的】聊天会话
|
||||
updateChatConversationMy: async (data: ChatConversationVO) => {
|
||||
return await request.put({ url: `/ai/chat/conversation/update-my`, data })
|
||||
},
|
||||
|
||||
// 删除【我的】聊天会话
|
||||
deleteChatConversationMy: async (id: number) => {
|
||||
return await request.delete({ url: `/ai/chat/conversation/delete-my?id=${id}` })
|
||||
},
|
||||
|
||||
// 获得【我的】聊天会话列表
|
||||
getChatConversationMyList: async () => {
|
||||
return await request.get({ url: `/ai/chat/conversation/my-list` })
|
||||
|
@ -31,19 +31,16 @@ export const ChatMessageApi = {
|
||||
})
|
||||
},
|
||||
|
||||
// 发送 add 消息
|
||||
add: async (data: ChatMessageSendVO) => {
|
||||
return await request.post({ url: `/ai/chat/message/add`, data })
|
||||
},
|
||||
|
||||
// 发送 send 消息
|
||||
send: async (data: ChatMessageSendVO) => {
|
||||
return await request.post({ url: `/ai/chat/message/send`, data })
|
||||
},
|
||||
|
||||
// 发送 send stream 消息
|
||||
// TODO axios 可以么? https://apifox.com/apiskills/how-to-create-axios-stream/
|
||||
sendStream: async (id: string, ctrl, onMessage, onError, onClose) => {
|
||||
sendStream: async (
|
||||
conversationId: number,
|
||||
content: string,
|
||||
ctrl,
|
||||
onMessage,
|
||||
onError,
|
||||
onClose
|
||||
) => {
|
||||
const token = getAccessToken()
|
||||
return fetchEventSource(`${config.base_url}/ai/chat/message/send-stream`, {
|
||||
method: 'post',
|
||||
@ -53,7 +50,8 @@ export const ChatMessageApi = {
|
||||
},
|
||||
openWhenHidden: true,
|
||||
body: JSON.stringify({
|
||||
id: id
|
||||
conversationId,
|
||||
content
|
||||
}),
|
||||
onmessage: onMessage,
|
||||
onerror: onError,
|
||||
|
Reference in New Issue
Block a user