mirror of
https://gitee.com/hhyykk/ipms-sjy-ui.git
synced 2025-08-01 03:34:07 +08:00
Merge branch 'master' of https://gitee.com/yudaocode/yudao-ui-admin-vue3 into feature/bpm
This commit is contained in:
@@ -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 // 是否置顶
|
||||
@@ -12,6 +12,7 @@ export interface ChatConversationVO {
|
||||
temperature: number // 温度参数
|
||||
maxTokens: number // 单条回复的最大 Token 数量
|
||||
maxContexts: number // 上下文的最大 Message 数量
|
||||
createTime?: Date // 创建时间
|
||||
// 额外字段
|
||||
systemMessage?: string // 角色设定
|
||||
modelName?: string // 模型名字
|
||||
@@ -23,7 +24,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}` })
|
||||
},
|
||||
|
||||
@@ -43,8 +44,8 @@ export const ChatConversationApi = {
|
||||
},
|
||||
|
||||
// 删除【我的】所有对话,置顶除外
|
||||
deleteMyAllExceptPinned: async () => {
|
||||
return await request.delete({ url: `/ai/chat/conversation/delete-my-all-except-pinned` })
|
||||
deleteChatConversationMyByUnpinned: async () => {
|
||||
return await request.delete({ url: `/ai/chat/conversation/delete-by-unpinned` })
|
||||
},
|
||||
|
||||
// 获得【我的】聊天对话列表
|
||||
|
@@ -19,23 +19,18 @@ 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/
|
||||
sendStream: async (
|
||||
// 发送 Stream 消息
|
||||
// 为什么不用 axios 呢?因为它不支持 SSE 调用
|
||||
sendChatMessageStream: async (
|
||||
conversationId: number,
|
||||
content: string,
|
||||
ctrl,
|
||||
@@ -65,12 +60,12 @@ export const ChatMessageApi = {
|
||||
},
|
||||
|
||||
// 删除消息
|
||||
delete: async (id: string) => {
|
||||
deleteChatMessage: async (id: string) => {
|
||||
return await request.delete({ url: `/ai/chat/message/delete?id=${id}` })
|
||||
},
|
||||
|
||||
// 删除消息 - 对话所有消息
|
||||
deleteByConversationId: async (conversationId: string) => {
|
||||
// 删除指定对话的消息
|
||||
deleteByConversationId: async (conversationId: number) => {
|
||||
return await request.delete({
|
||||
url: `/ai/chat/message/delete-by-conversation-id?conversationId=${conversationId}`
|
||||
})
|
||||
|
@@ -1,49 +1,22 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// AI API 密钥 VO
|
||||
// TODO @fan:要不前端不弄太多 VO,就用这个 ImageDetailVO?!
|
||||
export interface ImageDetailVO {
|
||||
// AI 绘图 VO
|
||||
export interface ImageVO {
|
||||
id: number // 编号
|
||||
prompt: string // 提示词
|
||||
status: number // 状态
|
||||
errorMessage: string // 错误信息
|
||||
type: string // 模型下分不同的类型(清晰、真实...)
|
||||
taskId: number // dr 任务id
|
||||
picUrl: string // 任务地址
|
||||
originalPicUrl: string // 绘制图片地址
|
||||
platform: string // 平台
|
||||
model: string // 模型
|
||||
style: string // 图像生成的风格
|
||||
size: string // 图片尺寸
|
||||
buttons: ImageMjButtonsVO[] // mj 操作按钮
|
||||
createTime: string // 创建时间
|
||||
updateTime: string // 更新事件
|
||||
}
|
||||
|
||||
export interface ImageMjButtonsVO {
|
||||
customId: string // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识
|
||||
emoji: string // 图标 emoji
|
||||
label: string // Make Variations 文本
|
||||
style: number // 样式: 2(Primary)、3(Green)
|
||||
}
|
||||
|
||||
export interface ImageMjActionVO {
|
||||
id: string // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识
|
||||
customId: string // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识
|
||||
}
|
||||
|
||||
|
||||
export interface ImagePageReqVO {
|
||||
pageNo: number // 分页编号
|
||||
pageSize: number // 分页大小
|
||||
}
|
||||
|
||||
export interface ImageDallReqVO {
|
||||
prompt: string // 提示词
|
||||
model: string // 模型
|
||||
style: string // 图像生成的风格
|
||||
width: string // 图片宽度
|
||||
height: string // 图片高度
|
||||
width: number // 图片宽度
|
||||
height: number // 图片高度
|
||||
status: number // 状态
|
||||
publicStatus: boolean // 公开状态
|
||||
picUrl: string // 任务地址
|
||||
errorMessage: string // 错误信息
|
||||
options: any // 配置 Map<string, string>
|
||||
taskId: number // 任务编号
|
||||
buttons: ImageMidjourneyButtonsVO[] // mj 操作按钮
|
||||
createTime: Date // 创建时间
|
||||
finishTime: Date // 完成时间
|
||||
}
|
||||
|
||||
export interface ImageDrawReqVO {
|
||||
@@ -65,34 +38,66 @@ export interface ImageMidjourneyImagineReqVO {
|
||||
version: string // 版本
|
||||
}
|
||||
|
||||
// TODO 芋艿:review 下整体注释、方法名
|
||||
// AI API 密钥 API
|
||||
export interface ImageMidjourneyActionVO {
|
||||
id: number // 图片编号
|
||||
customId: string // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识
|
||||
}
|
||||
|
||||
export interface ImageMidjourneyButtonsVO {
|
||||
customId: string // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识
|
||||
emoji: string // 图标 emoji
|
||||
label: string // Make Variations 文本
|
||||
style: number // 样式: 2(Primary)、3(Green)
|
||||
}
|
||||
|
||||
// AI 图片 API
|
||||
export const ImageApi = {
|
||||
// 获取 image 列表
|
||||
getImageList: async (params: ImagePageReqVO) => {
|
||||
// 获取【我的】绘图分页
|
||||
getImagePageMy: async (params: any) => {
|
||||
return await request.get({ url: `/ai/image/my-page`, params })
|
||||
},
|
||||
// 获取 image 详细信息
|
||||
getImageDetail: async (id: number) => {
|
||||
return await request.get({ url: `/ai/image/get-my?id=${id}`})
|
||||
// 获取【我的】绘图记录
|
||||
getImageMy: async (id: number) => {
|
||||
return await request.get({ url: `/ai/image/get-my?id=${id}` })
|
||||
},
|
||||
// 获取【我的】绘图记录列表
|
||||
getImageListMyByIds: async (ids: number[]) => {
|
||||
return await request.get({ url: `/ai/image/my-list-by-ids`, params: { ids: ids.join(',') } })
|
||||
},
|
||||
// 生成图片
|
||||
drawImage: async (data: ImageDrawReqVO)=> {
|
||||
drawImage: async (data: ImageDrawReqVO) => {
|
||||
return await request.post({ url: `/ai/image/draw`, data })
|
||||
},
|
||||
// 删除
|
||||
deleteImage: async (id: number)=> {
|
||||
return await request.delete({ url: `/ai/image/delete-my?id=${id}`})
|
||||
// 删除【我的】绘画记录
|
||||
deleteImageMy: async (id: number) => {
|
||||
return await request.delete({ url: `/ai/image/delete-my?id=${id}` })
|
||||
},
|
||||
|
||||
// ------------ midjourney
|
||||
// ================ midjourney 专属 ================
|
||||
|
||||
// midjourney - imagine
|
||||
midjourneyImagine: async (data: ImageMidjourneyImagineReqVO)=> {
|
||||
// 【Midjourney】生成图片
|
||||
midjourneyImagine: async (data: ImageMidjourneyImagineReqVO) => {
|
||||
return await request.post({ url: `/ai/image/midjourney/imagine`, data })
|
||||
},
|
||||
// midjourney - action
|
||||
midjourneyAction: async (params: ImageMjActionVO)=> {
|
||||
return await request.get({ url: `/ai/image/midjourney/action`, params })
|
||||
// 【Midjourney】Action 操作(二次生成图片)
|
||||
midjourneyAction: async (data: ImageMidjourneyActionVO) => {
|
||||
return await request.post({ url: `/ai/image/midjourney/action`, data })
|
||||
},
|
||||
|
||||
// ================ 绘图管理 ================
|
||||
|
||||
// 查询绘画分页
|
||||
getImagePage: async (params: any) => {
|
||||
return await request.get({ url: `/ai/image/page`, params })
|
||||
},
|
||||
|
||||
// 更新绘画发布状态
|
||||
updateImage: async (data: any) => {
|
||||
return await request.put({ url: '/ai/image/update', data })
|
||||
},
|
||||
|
||||
// 删除绘画
|
||||
deleteImage: async (id: number) => {
|
||||
return await request.delete({ url: `/ai/image/delete?id=` + id })
|
||||
}
|
||||
}
|
||||
|
60
src/api/ai/mindmap/index.ts
Normal file
60
src/api/ai/mindmap/index.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import { getAccessToken } from '@/utils/auth'
|
||||
import { fetchEventSource } from '@microsoft/fetch-event-source'
|
||||
import { config } from '@/config/axios/config'
|
||||
import request from '@/config/axios'
|
||||
|
||||
// AI 思维导图 VO
|
||||
export interface MindMapVO {
|
||||
id: number // 编号
|
||||
userId: number // 用户编号
|
||||
prompt: string // 生成内容提示
|
||||
generatedContent: string // 生成的思维导图内容
|
||||
platform: string // 平台
|
||||
model: string // 模型
|
||||
errorMessage: string // 错误信息
|
||||
}
|
||||
|
||||
// AI 思维导图生成 VO
|
||||
export interface AiMindMapGenerateReqVO {
|
||||
prompt: string
|
||||
}
|
||||
|
||||
export const AiMindMapApi = {
|
||||
generateMindMap: ({
|
||||
data,
|
||||
onClose,
|
||||
onMessage,
|
||||
onError,
|
||||
ctrl
|
||||
}: {
|
||||
data: AiMindMapGenerateReqVO
|
||||
onMessage?: (res: any) => void
|
||||
onError?: (...args: any[]) => void
|
||||
onClose?: (...args: any[]) => void
|
||||
ctrl: AbortController
|
||||
}) => {
|
||||
const token = getAccessToken()
|
||||
return fetchEventSource(`${config.base_url}/ai/mind-map/generate-stream`, {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${token}`
|
||||
},
|
||||
openWhenHidden: true,
|
||||
body: JSON.stringify(data),
|
||||
onmessage: onMessage,
|
||||
onerror: onError,
|
||||
onclose: onClose,
|
||||
signal: ctrl.signal
|
||||
})
|
||||
},
|
||||
|
||||
// 查询思维导图分页
|
||||
getMindMapPage: async (params: any) => {
|
||||
return await request.get({ url: `/ai/mind-map/page`, params })
|
||||
},
|
||||
// 删除思维导图
|
||||
deleteMindMap: async (id: number) => {
|
||||
return await request.delete({ url: `/ai/mind-map/delete?id=` + id })
|
||||
}
|
||||
}
|
41
src/api/ai/music/index.ts
Normal file
41
src/api/ai/music/index.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// AI 音乐 VO
|
||||
export interface MusicVO {
|
||||
id: number // 编号
|
||||
userId: number // 用户编号
|
||||
title: string // 音乐名称
|
||||
lyric: string // 歌词
|
||||
imageUrl: string // 图片地址
|
||||
audioUrl: string // 音频地址
|
||||
videoUrl: string // 视频地址
|
||||
status: number // 音乐状态
|
||||
gptDescriptionPrompt: string // 描述词
|
||||
prompt: string // 提示词
|
||||
platform: string // 模型平台
|
||||
model: string // 模型
|
||||
generateMode: number // 生成模式
|
||||
tags: string // 音乐风格标签
|
||||
duration: number // 音乐时长
|
||||
publicStatus: boolean // 是否发布
|
||||
taskId: string // 任务id
|
||||
errorMessage: string // 错误信息
|
||||
}
|
||||
|
||||
// AI 音乐 API
|
||||
export const MusicApi = {
|
||||
// 查询音乐分页
|
||||
getMusicPage: async (params: any) => {
|
||||
return await request.get({ url: `/ai/music/page`, params })
|
||||
},
|
||||
|
||||
// 更新音乐
|
||||
updateMusic: async (data: any) => {
|
||||
return await request.put({ url: '/ai/music/update', data })
|
||||
},
|
||||
|
||||
// 删除音乐
|
||||
deleteMusic: async (id: number) => {
|
||||
return await request.delete({ url: `/ai/music/delete?id=` + id })
|
||||
}
|
||||
}
|
85
src/api/ai/write/index.ts
Normal file
85
src/api/ai/write/index.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
import { fetchEventSource } from '@microsoft/fetch-event-source'
|
||||
|
||||
import { getAccessToken } from '@/utils/auth'
|
||||
import { config } from '@/config/axios/config'
|
||||
import { AiWriteTypeEnum } from '@/views/ai/utils/constants'
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface WriteVO {
|
||||
type: AiWriteTypeEnum.WRITING | AiWriteTypeEnum.REPLY // 1:撰写 2:回复
|
||||
prompt: string // 写作内容提示 1。撰写 2回复
|
||||
originalContent: string // 原文
|
||||
length: number // 长度
|
||||
format: number // 格式
|
||||
tone: number // 语气
|
||||
language: number // 语言
|
||||
userId?: number // 用户编号
|
||||
platform?: string // 平台
|
||||
model?: string // 模型
|
||||
generatedContent?: string // 生成的内容
|
||||
errorMessage?: string // 错误信息
|
||||
createTime?: Date // 创建时间
|
||||
}
|
||||
|
||||
export interface AiWritePageReqVO extends PageParam {
|
||||
userId?: number // 用户编号
|
||||
type?: AiWriteTypeEnum // 写作类型
|
||||
platform?: string // 平台
|
||||
createTime?: [string, string] // 创建时间
|
||||
}
|
||||
|
||||
export interface AiWriteRespVo {
|
||||
id: number
|
||||
userId: number
|
||||
type: number
|
||||
platform: string
|
||||
model: string
|
||||
prompt: string
|
||||
generatedContent: string
|
||||
originalContent: string
|
||||
length: number
|
||||
format: number
|
||||
tone: number
|
||||
language: number
|
||||
errorMessage: string
|
||||
createTime: string
|
||||
}
|
||||
|
||||
export const WriteApi = {
|
||||
writeStream: ({
|
||||
data,
|
||||
onClose,
|
||||
onMessage,
|
||||
onError,
|
||||
ctrl
|
||||
}: {
|
||||
data: WriteVO
|
||||
onMessage?: (res: any) => void
|
||||
onError?: (...args: any[]) => void
|
||||
onClose?: (...args: any[]) => void
|
||||
ctrl: AbortController
|
||||
}) => {
|
||||
const token = getAccessToken()
|
||||
return fetchEventSource(`${config.base_url}/ai/write/generate-stream`, {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${token}`
|
||||
},
|
||||
openWhenHidden: true,
|
||||
body: JSON.stringify(data),
|
||||
onmessage: onMessage,
|
||||
onerror: onError,
|
||||
onclose: onClose,
|
||||
signal: ctrl.signal
|
||||
})
|
||||
},
|
||||
// 获取写作列表
|
||||
getWritePage: (params: AiWritePageReqVO) => {
|
||||
return request.get<PageResult<AiWriteRespVo[]>>({ url: `/ai/write/page`, params })
|
||||
},
|
||||
// 删除写作
|
||||
deleteWrite(id: number) {
|
||||
return request.delete({ url: `/ai/write/delete`, params: { id } })
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export const getProcessDefinition = async (id: number, key: string) => {
|
||||
export const getProcessDefinition = async (id?: string, key?: string) => {
|
||||
return await request.get({
|
||||
url: '/bpm/process-definition/get',
|
||||
params: { id, key }
|
||||
|
@@ -5,6 +5,7 @@ export type ProcessDefinitionVO = {
|
||||
version: number
|
||||
deploymentTIme: string
|
||||
suspensionState: number
|
||||
formType?: number
|
||||
}
|
||||
|
||||
export type ModelVO = {
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import request from '@/config/axios'
|
||||
import { ProcessDefinitionVO } from '@/api/bpm/model'
|
||||
|
||||
export type Task = {
|
||||
id: string
|
||||
@@ -18,17 +19,7 @@ export type ProcessInstanceVO = {
|
||||
businessKey: string
|
||||
createTime: string
|
||||
endTime: string
|
||||
}
|
||||
|
||||
export type ProcessInstanceCopyVO = {
|
||||
type: number
|
||||
taskName: string
|
||||
taskKey: string
|
||||
processInstanceName: string
|
||||
processInstanceKey: string
|
||||
startUserId: string
|
||||
options: string[]
|
||||
reason: string
|
||||
processDefinition?: ProcessDefinitionVO
|
||||
}
|
||||
|
||||
export const getProcessInstanceMyPage = async (params: any) => {
|
||||
|
@@ -12,6 +12,7 @@ export interface JobLogVO {
|
||||
duration: string
|
||||
status: number
|
||||
createTime: string
|
||||
result: string
|
||||
}
|
||||
|
||||
// 任务日志列表
|
||||
|
10
src/api/mall/product/history.ts
Normal file
10
src/api/mall/product/history.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
/**
|
||||
* 获得商品浏览记录分页
|
||||
*
|
||||
* @param params 请求参数
|
||||
*/
|
||||
export const getBrowseHistoryPage = (params: any) => {
|
||||
return request.get({ url: '/product/browse-history/page', params })
|
||||
}
|
35
src/api/mall/promotion/kefu/conversation/index.ts
Normal file
35
src/api/mall/promotion/kefu/conversation/index.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface KeFuConversationRespVO {
|
||||
id: number // 编号
|
||||
userId: number // 会话所属用户
|
||||
userAvatar: string // 会话所属用户头像
|
||||
userNickname: string // 会话所属用户昵称
|
||||
lastMessageTime: Date // 最后聊天时间
|
||||
lastMessageContent: string // 最后聊天内容
|
||||
lastMessageContentType: number // 最后发送的消息类型
|
||||
adminPinned: boolean // 管理端置顶
|
||||
userDeleted: boolean // 用户是否可见
|
||||
adminDeleted: boolean // 管理员是否可见
|
||||
adminUnreadMessageCount: number // 管理员未读消息数
|
||||
createTime?: string // 创建时间
|
||||
}
|
||||
|
||||
// 客服会话 API
|
||||
export const KeFuConversationApi = {
|
||||
// 获得客服会话列表
|
||||
getConversationList: async () => {
|
||||
return await request.get({ url: '/promotion/kefu-conversation/list' })
|
||||
},
|
||||
// 客服会话置顶
|
||||
updateConversationPinned: async (data: any) => {
|
||||
return await request.put({
|
||||
url: '/promotion/kefu-conversation/update-conversation-pinned',
|
||||
data
|
||||
})
|
||||
},
|
||||
// 删除客服会话
|
||||
deleteConversation: async (id: number) => {
|
||||
return await request.get({ url: '/promotion/kefu-conversation/delete?id' + id })
|
||||
}
|
||||
}
|
36
src/api/mall/promotion/kefu/message/index.ts
Normal file
36
src/api/mall/promotion/kefu/message/index.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface KeFuMessageRespVO {
|
||||
id: number // 编号
|
||||
conversationId: number // 会话编号
|
||||
senderId: number // 发送人编号
|
||||
senderAvatar: string // 发送人头像
|
||||
senderType: number // 发送人类型
|
||||
receiverId: number // 接收人编号
|
||||
receiverType: number // 接收人类型
|
||||
contentType: number // 消息类型
|
||||
content: string // 消息
|
||||
readStatus: boolean // 是否已读
|
||||
createTime: Date // 创建时间
|
||||
}
|
||||
|
||||
// 客服会话 API
|
||||
export const KeFuMessageApi = {
|
||||
// 发送客服消息
|
||||
sendKeFuMessage: async (data: any) => {
|
||||
return await request.post({
|
||||
url: '/promotion/kefu-message/send',
|
||||
data
|
||||
})
|
||||
},
|
||||
// 更新客服消息已读状态
|
||||
updateKeFuMessageReadStatus: async (conversationId: number) => {
|
||||
return await request.put({
|
||||
url: '/promotion/kefu-message/update-read-status?conversationId=' + conversationId
|
||||
})
|
||||
},
|
||||
// 获得消息分页数据
|
||||
getKeFuMessagePage: async (params: any) => {
|
||||
return await request.get({ url: '/promotion/kefu-message/page', params })
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user