青鸟ai,pc版仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

148 lines
2.9 KiB

import { defHttp } from '@/utils/axios/index'
import type { MenuTypeEnum } from '@/enums/menuEnum'
import type { ModelTypeEnum } from '@/enums/messageEnum'
/**
* @description 新建会话
*/
export async function addMessage(data: {
type: MenuTypeEnum
title: string
sort: number
roleId?: string
modelType: ModelTypeEnum
}) {
return defHttp.post({
url: `/open-chat/chat/conversation/save`,
data,
})
}
/**
* @description 编辑会话名称
*/
export async function updateMessage(data: any) {
return defHttp.post({
url: `/open-chat/chat/conversation/update`,
data,
})
}
/**
* @description 根据id删除会话
*/
export async function removeMessage(ids: string) {
return defHttp.post({
url: `/open-chat/chat/conversation/remove?ids=${ids}`,
})
}
/**
* @description 对话列表
*/
export async function conversationList(type: number) {
return defHttp.get({
url: `/open-chat/chat/conversation/list?type=${type}`,
})
}
/**
* @description 对话列表置顶
*/
export async function conversationToTop(conversationId: string) {
return defHttp.post({
url: `/open-chat/chat/conversation/top?id=${conversationId}`,
})
}
/**
* @description 对话历史记录
*/
export async function historyMessage(params: {
conversationId: string
current: number
size: number
}) {
return defHttp.get({
url: `/open-chat/chat/chatMessageLog/page`,
params,
})
}
/**
* @description 停止对话
*/
export async function stopMessage(data: { conversationId: string }) {
return defHttp.post({
url: `/open-chat/chat/stopGenerate`,
data,
})
}
/**
* @description 发送消息(文生文)要带modelType,区分gpt3.5和gpt4
*/
export async function sendTextToText(data: {
conversationId: string
question: string
modelType: ModelTypeEnum
roleId?: number
}) {
return defHttp.post({
url: `/open-chat/chat/session`,
data,
timeout: 120 * 1000,
})
}
/**
* @description 发送消息(文生图)不需要带modelType
*/
export async function sendTextToImage(data: {
conversationId: string
question: string
}) {
return defHttp.post({
url: `/open-chat/gpts/getDallEImages`,
data,
timeout: 120 * 1000,
})
}
/**
* @description 发送消息(知识库)
*/
export async function sendRepository(data: {
conversationId: string
question: string
}) {
return defHttp.post({
url: `/open-chat/gpts/getQanythingStreamChat`,
data,
timeout: 120 * 1000,
})
}
/**
* @description 发送消息(图像分析)不需要带modelType
*/
export async function sendVisualAnalysis(data: {
conversationId: string
question: string
fileUrl: string
}) {
return defHttp.post({
url: `/open-chat/gpts/getImageVision`,
data,
timeout: 120 * 1000,
})
}
/**
* @description 获取chat信息
*/
export async function chatInfo() {
return defHttp.get({
url: `/open-chat/chat/ai/getWxUserInfo`,
})
}