feat: 去除所有接口中的 vo
parent
2855eb4e08
commit
c59ebbecfd
|
@ -3,7 +3,7 @@ import type { PageResult } from '@vben/request';
|
|||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiChatConversationApi {
|
||||
export interface ChatConversationVO {
|
||||
export interface ChatConversation {
|
||||
id: number; // ID 编号
|
||||
userId: number; // 用户编号
|
||||
title: string; // 对话标题
|
||||
|
@ -26,21 +26,21 @@ export namespace AiChatConversationApi {
|
|||
|
||||
// 获得【我的】聊天对话
|
||||
export function getChatConversationMy(id: number) {
|
||||
return requestClient.get<AiChatConversationApi.ChatConversationVO>(
|
||||
return requestClient.get<AiChatConversationApi.ChatConversation>(
|
||||
`/ai/chat/conversation/get-my?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
// 新增【我的】聊天对话
|
||||
export function createChatConversationMy(
|
||||
data: AiChatConversationApi.ChatConversationVO,
|
||||
data: AiChatConversationApi.ChatConversation,
|
||||
) {
|
||||
return requestClient.post('/ai/chat/conversation/create-my', data);
|
||||
}
|
||||
|
||||
// 更新【我的】聊天对话
|
||||
export function updateChatConversationMy(
|
||||
data: AiChatConversationApi.ChatConversationVO,
|
||||
data: AiChatConversationApi.ChatConversation,
|
||||
) {
|
||||
return requestClient.put(`/ai/chat/conversation/update-my`, data);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ export function deleteChatConversationMyByUnpinned() {
|
|||
|
||||
// 获得【我的】聊天对话列表
|
||||
export function getChatConversationMyList() {
|
||||
return requestClient.get<AiChatConversationApi.ChatConversationVO[]>(
|
||||
return requestClient.get<AiChatConversationApi.ChatConversation[]>(
|
||||
`/ai/chat/conversation/my-list`,
|
||||
);
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ export function getChatConversationMyList() {
|
|||
// 获得【我的】聊天对话列表
|
||||
export function getChatConversationPage(params: any) {
|
||||
return requestClient.get<
|
||||
PageResult<AiChatConversationApi.ChatConversationVO[]>
|
||||
PageResult<AiChatConversationApi.ChatConversation[]>
|
||||
>(`/ai/chat/conversation/page`, { params });
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import { requestClient } from '#/api/request';
|
|||
const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);
|
||||
const accessStore = useAccessStore();
|
||||
export namespace AiChatMessageApi {
|
||||
export interface ChatMessageVO {
|
||||
export interface ChatMessage {
|
||||
id: number; // 编号
|
||||
conversationId: number; // 对话编号
|
||||
type: string; // 消息类型
|
||||
|
@ -36,7 +36,7 @@ export namespace AiChatMessageApi {
|
|||
export function getChatMessageListByConversationId(
|
||||
conversationId: null | number,
|
||||
) {
|
||||
return requestClient.get<AiChatMessageApi.ChatMessageVO[]>(
|
||||
return requestClient.get<AiChatMessageApi.ChatMessage[]>(
|
||||
`/ai/chat/message/list-by-conversation-id?conversationId=${conversationId}`,
|
||||
);
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ export function deleteByConversationId(conversationId: number) {
|
|||
}
|
||||
// 获得消息分页
|
||||
export function getChatMessagePage(params: any) {
|
||||
return requestClient.get<PageResult<AiChatMessageApi.ChatMessageVO>>(
|
||||
return requestClient.get<PageResult<AiChatMessageApi.ChatMessage>>(
|
||||
'/ai/chat/message/page',
|
||||
{ params },
|
||||
);
|
||||
|
|
|
@ -3,14 +3,14 @@ import type { PageParam, PageResult } from '@vben/request';
|
|||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiImageApi {
|
||||
export interface ImageMidjourneyButtonsVO {
|
||||
export interface ImageMidjourneyButtons {
|
||||
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 绘图 VO
|
||||
export interface ImageVO {
|
||||
// AI 绘图
|
||||
export interface Image {
|
||||
id: number; // 编号
|
||||
platform: string; // 平台
|
||||
model: string; // 模型
|
||||
|
@ -23,12 +23,12 @@ export namespace AiImageApi {
|
|||
errorMessage: string; // 错误信息
|
||||
options: any; // 配置 Map<string, string>
|
||||
taskId: number; // 任务编号
|
||||
buttons: ImageMidjourneyButtonsVO[]; // mj 操作按钮
|
||||
buttons: ImageMidjourneyButtons[]; // mj 操作按钮
|
||||
createTime: Date; // 创建时间
|
||||
finishTime: Date; // 完成时间
|
||||
}
|
||||
|
||||
export interface ImageDrawReqVO {
|
||||
export interface ImageDrawReq {
|
||||
prompt: string; // 提示词
|
||||
modelId: number; // 模型
|
||||
style: string; // 图像生成的风格
|
||||
|
@ -37,7 +37,7 @@ export namespace AiImageApi {
|
|||
options: object; // 绘制参数,Map<String, String>
|
||||
}
|
||||
|
||||
export interface ImageMidjourneyImagineReqVO {
|
||||
export interface ImageMidjourneyImagineReq {
|
||||
prompt: string; // 提示词
|
||||
modelId: number; // 模型
|
||||
base64Array?: string[]; // size不能为空
|
||||
|
@ -46,7 +46,7 @@ export namespace AiImageApi {
|
|||
version: string; // 版本
|
||||
}
|
||||
|
||||
export interface ImageMidjourneyActionVO {
|
||||
export interface ImageMidjourneyAction {
|
||||
id: number; // 图片编号
|
||||
customId: string; // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识
|
||||
}
|
||||
|
@ -54,26 +54,25 @@ export namespace AiImageApi {
|
|||
|
||||
// 获取【我的】绘图分页
|
||||
export function getImagePageMy(params: PageParam) {
|
||||
return requestClient.get<PageResult<AiImageApi.ImageVO>>(
|
||||
'/ai/image/my-page',
|
||||
{ params },
|
||||
);
|
||||
return requestClient.get<PageResult<AiImageApi.Image>>('/ai/image/my-page', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
// 获取【我的】绘图记录
|
||||
export function getImageMy(id: number) {
|
||||
return requestClient.get<AiImageApi.ImageVO>(`/ai/image/get-my?id=${id}`);
|
||||
return requestClient.get<AiImageApi.Image>(`/ai/image/get-my?id=${id}`);
|
||||
}
|
||||
|
||||
// 获取【我的】绘图记录列表
|
||||
export function getImageListMyByIds(ids: number[]) {
|
||||
return requestClient.get<AiImageApi.ImageVO[]>(`/ai/image/my-list-by-ids`, {
|
||||
return requestClient.get<AiImageApi.Image[]>(`/ai/image/my-list-by-ids`, {
|
||||
params: { ids: ids.join(',') },
|
||||
});
|
||||
}
|
||||
|
||||
// 生成图片
|
||||
export function drawImage(data: AiImageApi.ImageDrawReqVO) {
|
||||
export function drawImage(data: AiImageApi.ImageDrawReq) {
|
||||
return requestClient.post(`/ai/image/draw`, data);
|
||||
}
|
||||
|
||||
|
@ -84,21 +83,19 @@ export function deleteImageMy(id: number) {
|
|||
|
||||
// ================ midjourney 专属 ================
|
||||
// 【Midjourney】生成图片
|
||||
export function midjourneyImagine(
|
||||
data: AiImageApi.ImageMidjourneyImagineReqVO,
|
||||
) {
|
||||
export function midjourneyImagine(data: AiImageApi.ImageMidjourneyImagineReq) {
|
||||
return requestClient.post(`/ai/image/midjourney/imagine`, data);
|
||||
}
|
||||
|
||||
// 【Midjourney】Action 操作(二次生成图片)
|
||||
export function midjourneyAction(data: AiImageApi.ImageMidjourneyActionVO) {
|
||||
export function midjourneyAction(data: AiImageApi.ImageMidjourneyAction) {
|
||||
return requestClient.post(`/ai/image/midjourney/action`, data);
|
||||
}
|
||||
|
||||
// ================ 绘图管理 ================
|
||||
// 查询绘画分页
|
||||
export function getImagePage(params: any) {
|
||||
return requestClient.get<AiImageApi.ImageVO[]>(`/ai/image/page`, { params });
|
||||
return requestClient.get<AiImageApi.Image[]>(`/ai/image/page`, { params });
|
||||
}
|
||||
|
||||
// 更新绘画发布状态
|
||||
|
|
|
@ -3,7 +3,7 @@ import type { PageParam, PageResult } from '@vben/request';
|
|||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiKnowledgeDocumentApi {
|
||||
export interface KnowledgeDocumentVO {
|
||||
export interface KnowledgeDocument {
|
||||
id: number; // 编号
|
||||
knowledgeId: number; // 知识库编号
|
||||
name: string; // 文档名称
|
||||
|
@ -18,7 +18,7 @@ export namespace AiKnowledgeDocumentApi {
|
|||
// 查询知识库文档分页
|
||||
export function getKnowledgeDocumentPage(params: PageParam) {
|
||||
return requestClient.get<
|
||||
PageResult<AiKnowledgeDocumentApi.KnowledgeDocumentVO>
|
||||
PageResult<AiKnowledgeDocumentApi.KnowledgeDocument>
|
||||
>('/ai/knowledge/document/page', { params });
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import type { PageParam, PageResult } from '@vben/request';
|
|||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiKnowledgeKnowledgeApi {
|
||||
export interface KnowledgeVO {
|
||||
export interface Knowledge {
|
||||
id: number; // 编号
|
||||
name: string; // 知识库名称
|
||||
description: string; // 知识库描述
|
||||
|
@ -15,7 +15,7 @@ export namespace AiKnowledgeKnowledgeApi {
|
|||
|
||||
// 查询知识库分页
|
||||
export function getKnowledgePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<AiKnowledgeKnowledgeApi.KnowledgeVO>>(
|
||||
return requestClient.get<PageResult<AiKnowledgeKnowledgeApi.Knowledge>>(
|
||||
'/ai/knowledge/page',
|
||||
{ params },
|
||||
);
|
||||
|
@ -23,17 +23,17 @@ export function getKnowledgePage(params: PageParam) {
|
|||
|
||||
// 查询知识库详情
|
||||
export function getKnowledge(id: number) {
|
||||
return requestClient.get<AiKnowledgeKnowledgeApi.KnowledgeVO>(
|
||||
return requestClient.get<AiKnowledgeKnowledgeApi.Knowledge>(
|
||||
`/ai/knowledge/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
// 新增知识库
|
||||
export function createKnowledge(data: AiKnowledgeKnowledgeApi.KnowledgeVO) {
|
||||
export function createKnowledge(data: AiKnowledgeKnowledgeApi.Knowledge) {
|
||||
return requestClient.post('/ai/knowledge/create', data);
|
||||
}
|
||||
|
||||
// 修改知识库
|
||||
export function updateKnowledge(data: AiKnowledgeKnowledgeApi.KnowledgeVO) {
|
||||
export function updateKnowledge(data: AiKnowledgeKnowledgeApi.Knowledge) {
|
||||
return requestClient.put('/ai/knowledge/update', data);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ export function deleteKnowledge(id: number) {
|
|||
|
||||
// 获取知识库简单列表
|
||||
export function getSimpleKnowledgeList() {
|
||||
return requestClient.get<AiKnowledgeKnowledgeApi.KnowledgeVO[]>(
|
||||
return requestClient.get<AiKnowledgeKnowledgeApi.Knowledge[]>(
|
||||
'/ai/knowledge/simple-list',
|
||||
);
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@ import type { PageParam, PageResult } from '@vben/request';
|
|||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiKnowledgeSegmentApi {
|
||||
// AI 知识库分段 VO
|
||||
export interface KnowledgeSegmentVO {
|
||||
// AI 知识库分段
|
||||
export interface KnowledgeSegment {
|
||||
id: number; // 编号
|
||||
documentId: number; // 文档编号
|
||||
knowledgeId: number; // 知识库编号
|
||||
|
@ -20,27 +20,28 @@ export namespace AiKnowledgeSegmentApi {
|
|||
|
||||
// 查询知识库分段分页
|
||||
export function getKnowledgeSegmentPage(params: PageParam) {
|
||||
return requestClient.get<
|
||||
PageResult<AiKnowledgeSegmentApi.KnowledgeSegmentVO>
|
||||
>('/ai/knowledge/segment/page', { params });
|
||||
return requestClient.get<PageResult<AiKnowledgeSegmentApi.KnowledgeSegment>>(
|
||||
'/ai/knowledge/segment/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
// 查询知识库分段详情
|
||||
export function getKnowledgeSegment(id: number) {
|
||||
return requestClient.get<AiKnowledgeSegmentApi.KnowledgeSegmentVO>(
|
||||
return requestClient.get<AiKnowledgeSegmentApi.KnowledgeSegment>(
|
||||
`/ai/knowledge/segment/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
// 新增知识库分段
|
||||
export function createKnowledgeSegment(
|
||||
data: AiKnowledgeSegmentApi.KnowledgeSegmentVO,
|
||||
data: AiKnowledgeSegmentApi.KnowledgeSegment,
|
||||
) {
|
||||
return requestClient.post('/ai/knowledge/segment/create', data);
|
||||
}
|
||||
|
||||
// 修改知识库分段
|
||||
export function updateKnowledgeSegment(
|
||||
data: AiKnowledgeSegmentApi.KnowledgeSegmentVO,
|
||||
data: AiKnowledgeSegmentApi.KnowledgeSegment,
|
||||
) {
|
||||
return requestClient.put('/ai/knowledge/segment/update', data);
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import { requestClient } from '#/api/request';
|
|||
const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);
|
||||
const accessStore = useAccessStore();
|
||||
export namespace AiMindmapApi {
|
||||
// AI 思维导图 VO
|
||||
export interface MindMapVO {
|
||||
// AI 思维导图
|
||||
export interface MindMap {
|
||||
id: number; // 编号
|
||||
userId: number; // 用户编号
|
||||
prompt: string; // 生成内容提示
|
||||
|
@ -18,8 +18,8 @@ export namespace AiMindmapApi {
|
|||
errorMessage: string; // 错误信息
|
||||
}
|
||||
|
||||
// AI 思维导图生成 VO
|
||||
export interface AiMindMapGenerateReqVO {
|
||||
// AI 思维导图生成
|
||||
export interface AiMindMapGenerateReq {
|
||||
prompt: string;
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ export function generateMindMap({
|
|||
ctrl,
|
||||
}: {
|
||||
ctrl: AbortController;
|
||||
data: AiMindmapApi.AiMindMapGenerateReqVO;
|
||||
data: AiMindmapApi.AiMindMapGenerateReq;
|
||||
onClose?: (...args: any[]) => void;
|
||||
onError?: (...args: any[]) => void;
|
||||
onMessage?: (res: any) => void;
|
||||
|
|
|
@ -3,7 +3,7 @@ import type { PageParam, PageResult } from '@vben/request';
|
|||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiModelApiKeyApi {
|
||||
export interface ApiKeyVO {
|
||||
export interface ApiKey {
|
||||
id: number; // 编号
|
||||
name: string; // 名称
|
||||
apiKey: string; // 密钥
|
||||
|
@ -15,7 +15,7 @@ export namespace AiModelApiKeyApi {
|
|||
|
||||
// 查询 API 密钥分页
|
||||
export function getApiKeyPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<AiModelApiKeyApi.ApiKeyVO>>(
|
||||
return requestClient.get<PageResult<AiModelApiKeyApi.ApiKey>>(
|
||||
'/ai/api-key/page',
|
||||
{ params },
|
||||
);
|
||||
|
@ -23,24 +23,22 @@ export function getApiKeyPage(params: PageParam) {
|
|||
|
||||
// 获得 API 密钥列表
|
||||
export function getApiKeySimpleList() {
|
||||
return requestClient.get<AiModelApiKeyApi.ApiKeyVO[]>(
|
||||
return requestClient.get<AiModelApiKeyApi.ApiKey[]>(
|
||||
'/ai/api-key/simple-list',
|
||||
);
|
||||
}
|
||||
|
||||
// 查询 API 密钥详情
|
||||
export function getApiKey(id: number) {
|
||||
return requestClient.get<AiModelApiKeyApi.ApiKeyVO>(
|
||||
`/ai/api-key/get?id=${id}`,
|
||||
);
|
||||
return requestClient.get<AiModelApiKeyApi.ApiKey>(`/ai/api-key/get?id=${id}`);
|
||||
}
|
||||
// 新增 API 密钥
|
||||
export function createApiKey(data: AiModelApiKeyApi.ApiKeyVO) {
|
||||
export function createApiKey(data: AiModelApiKeyApi.ApiKey) {
|
||||
return requestClient.post('/ai/api-key/create', data);
|
||||
}
|
||||
|
||||
// 修改 API 密钥
|
||||
export function updateApiKey(data: AiModelApiKeyApi.ApiKeyVO) {
|
||||
export function updateApiKey(data: AiModelApiKeyApi.ApiKey) {
|
||||
return requestClient.put('/ai/api-key/update', data);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import type { PageParam, PageResult } from '@vben/request';
|
|||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiModelChatRoleApi {
|
||||
export interface ChatRoleVO {
|
||||
export interface ChatRole {
|
||||
id: number; // 角色编号
|
||||
modelId: number; // 模型编号
|
||||
name: string; // 角色名称
|
||||
|
@ -19,8 +19,8 @@ export namespace AiModelChatRoleApi {
|
|||
toolIds?: number[]; // 引用的工具 ID 列表
|
||||
}
|
||||
|
||||
// AI 聊天角色 分页请求 vo
|
||||
export interface ChatRolePageReqVO {
|
||||
// AI 聊天角色 分页请求
|
||||
export interface ChatRolePageReq {
|
||||
name?: string; // 角色名称
|
||||
category?: string; // 角色类别
|
||||
publicStatus: boolean; // 是否公开
|
||||
|
@ -31,7 +31,7 @@ export namespace AiModelChatRoleApi {
|
|||
|
||||
// 查询聊天角色分页
|
||||
export function getChatRolePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<AiModelChatRoleApi.ChatRoleVO>>(
|
||||
return requestClient.get<PageResult<AiModelChatRoleApi.ChatRole>>(
|
||||
'/ai/chat-role/page',
|
||||
{ params },
|
||||
);
|
||||
|
@ -39,17 +39,17 @@ export function getChatRolePage(params: PageParam) {
|
|||
|
||||
// 查询聊天角色详情
|
||||
export function getChatRole(id: number) {
|
||||
return requestClient.get<AiModelChatRoleApi.ChatRoleVO>(
|
||||
return requestClient.get<AiModelChatRoleApi.ChatRole>(
|
||||
`/ai/chat-role/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
// 新增聊天角色
|
||||
export function createChatRole(data: AiModelChatRoleApi.ChatRoleVO) {
|
||||
export function createChatRole(data: AiModelChatRoleApi.ChatRole) {
|
||||
return requestClient.post('/ai/chat-role/create', data);
|
||||
}
|
||||
|
||||
// 修改聊天角色
|
||||
export function updateChatRole(data: AiModelChatRoleApi.ChatRoleVO) {
|
||||
export function updateChatRole(data: AiModelChatRoleApi.ChatRole) {
|
||||
return requestClient.put('/ai/chat-role/update', data);
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ export function deleteChatRole(id: number) {
|
|||
|
||||
// ======= chat 聊天
|
||||
// 获取 my role
|
||||
export function getMyPage(params: AiModelChatRoleApi.ChatRolePageReqVO) {
|
||||
export function getMyPage(params: AiModelChatRoleApi.ChatRolePageReq) {
|
||||
return requestClient.get('/ai/chat-role/my-page', { params });
|
||||
}
|
||||
|
||||
|
@ -70,12 +70,12 @@ export function getCategoryList() {
|
|||
}
|
||||
|
||||
// 创建角色
|
||||
export function createMy(data: AiModelChatRoleApi.ChatRoleVO) {
|
||||
export function createMy(data: AiModelChatRoleApi.ChatRole) {
|
||||
return requestClient.post('/ai/chat-role/create-my', data);
|
||||
}
|
||||
|
||||
// 更新角色
|
||||
export function updateMy(data: AiModelChatRoleApi.ChatRoleVO) {
|
||||
export function updateMy(data: AiModelChatRoleApi.ChatRole) {
|
||||
return requestClient.put('/ai/chat-role/update', data);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import type { PageParam, PageResult } from '@vben/request';
|
|||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiModelModelApi {
|
||||
export interface ModelVO {
|
||||
export interface Model {
|
||||
id: number; // 编号
|
||||
keyId: number; // API 秘钥编号
|
||||
name: string; // 模型名字
|
||||
|
@ -20,7 +20,7 @@ export namespace AiModelModelApi {
|
|||
|
||||
// 查询模型分页
|
||||
export function getModelPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<AiModelModelApi.ModelVO>>(
|
||||
return requestClient.get<PageResult<AiModelModelApi.Model>>(
|
||||
'/ai/model/page',
|
||||
{ params },
|
||||
);
|
||||
|
@ -28,7 +28,7 @@ export function getModelPage(params: PageParam) {
|
|||
|
||||
// 获得模型列表
|
||||
export function getModelSimpleList(type?: number) {
|
||||
return requestClient.get<AiModelModelApi.ModelVO[]>('/ai/model/simple-list', {
|
||||
return requestClient.get<AiModelModelApi.Model[]>('/ai/model/simple-list', {
|
||||
params: {
|
||||
type,
|
||||
},
|
||||
|
@ -37,15 +37,15 @@ export function getModelSimpleList(type?: number) {
|
|||
|
||||
// 查询模型详情
|
||||
export function getModel(id: number) {
|
||||
return requestClient.get<AiModelModelApi.ModelVO>(`/ai/model/get?id=${id}`);
|
||||
return requestClient.get<AiModelModelApi.Model>(`/ai/model/get?id=${id}`);
|
||||
}
|
||||
// 新增模型
|
||||
export function createModel(data: AiModelModelApi.ModelVO) {
|
||||
export function createModel(data: AiModelModelApi.Model) {
|
||||
return requestClient.post('/ai/model/create', data);
|
||||
}
|
||||
|
||||
// 修改模型
|
||||
export function updateModel(data: AiModelModelApi.ModelVO) {
|
||||
export function updateModel(data: AiModelModelApi.Model) {
|
||||
return requestClient.put('/ai/model/update', data);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import type { PageParam, PageResult } from '@vben/request';
|
|||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiModelToolApi {
|
||||
export interface ToolVO {
|
||||
export interface Tool {
|
||||
id: number; // 工具编号
|
||||
name: string; // 工具名称
|
||||
description: string; // 工具描述
|
||||
|
@ -13,22 +13,22 @@ export namespace AiModelToolApi {
|
|||
|
||||
// 查询工具分页
|
||||
export function getToolPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<AiModelToolApi.ToolVO>>('/ai/tool/page', {
|
||||
return requestClient.get<PageResult<AiModelToolApi.Tool>>('/ai/tool/page', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
// 查询工具详情
|
||||
export function getTool(id: number) {
|
||||
return requestClient.get<AiModelToolApi.ToolVO>(`/ai/tool/get?id=${id}`);
|
||||
return requestClient.get<AiModelToolApi.Tool>(`/ai/tool/get?id=${id}`);
|
||||
}
|
||||
// 新增工具
|
||||
export function createTool(data: AiModelToolApi.ToolVO) {
|
||||
export function createTool(data: AiModelToolApi.Tool) {
|
||||
return requestClient.post('/ai/tool/create', data);
|
||||
}
|
||||
|
||||
// 修改工具
|
||||
export function updateTool(data: AiModelToolApi.ToolVO) {
|
||||
export function updateTool(data: AiModelToolApi.Tool) {
|
||||
return requestClient.put('/ai/tool/update', data);
|
||||
}
|
||||
|
||||
|
@ -39,5 +39,5 @@ export function deleteTool(id: number) {
|
|||
|
||||
// 获取工具简单列表
|
||||
export function getToolSimpleList() {
|
||||
return requestClient.get<AiModelToolApi.ToolVO[]>('/ai/tool/simple-list');
|
||||
return requestClient.get<AiModelToolApi.Tool[]>('/ai/tool/simple-list');
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@ import type { PageParam, PageResult } from '@vben/request';
|
|||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiMusicApi {
|
||||
// AI 音乐 VO
|
||||
export interface MusicVO {
|
||||
// AI 音乐
|
||||
export interface Music {
|
||||
id: number; // 编号
|
||||
userId: number; // 用户编号
|
||||
title: string; // 音乐名称
|
||||
|
@ -28,7 +28,7 @@ export namespace AiMusicApi {
|
|||
|
||||
// 查询音乐分页
|
||||
export function getMusicPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<AiMusicApi.MusicVO>>(`/ai/music/page`, {
|
||||
return requestClient.get<PageResult<AiMusicApi.Music>>(`/ai/music/page`, {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import { requestClient } from '#/api/request';
|
|||
const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);
|
||||
const accessStore = useAccessStore();
|
||||
export namespace AiWriteApi {
|
||||
export interface WriteVO {
|
||||
export interface Write {
|
||||
type: AiWriteTypeEnum.REPLY | AiWriteTypeEnum.WRITING; // 1:撰写 2:回复
|
||||
prompt: string; // 写作内容提示 1。撰写 2回复
|
||||
originalContent: string; // 原文
|
||||
|
@ -27,14 +27,14 @@ export namespace AiWriteApi {
|
|||
createTime?: Date; // 创建时间
|
||||
}
|
||||
|
||||
export interface AiWritePageReqVO extends PageParam {
|
||||
export interface AiWritePageReq extends PageParam {
|
||||
userId?: number; // 用户编号
|
||||
type?: AiWriteTypeEnum; // 写作类型
|
||||
platform?: string; // 平台
|
||||
createTime?: [string, string]; // 创建时间
|
||||
}
|
||||
|
||||
export interface AiWriteRespVo {
|
||||
export interface AiWriteResp {
|
||||
id: number;
|
||||
userId: number;
|
||||
type: number;
|
||||
|
@ -60,7 +60,7 @@ export function writeStream({
|
|||
ctrl,
|
||||
}: {
|
||||
ctrl: AbortController;
|
||||
data: Partial<AiWriteApi.WriteVO>;
|
||||
data: Partial<AiWriteApi.Write>;
|
||||
onClose?: (...args: any[]) => void;
|
||||
onError?: (...args: any[]) => void;
|
||||
onMessage?: (res: any) => void;
|
||||
|
@ -83,7 +83,7 @@ export function writeStream({
|
|||
|
||||
// 获取写作列表
|
||||
export function getWritePage(params: any) {
|
||||
return requestClient.get<PageResult<AiWriteApi.AiWritePageReqVO>>(
|
||||
return requestClient.get<PageResult<AiWriteApi.AiWritePageReq>>(
|
||||
`/ai/write/page`,
|
||||
{ params },
|
||||
);
|
||||
|
|
|
@ -30,12 +30,12 @@ export const AiModelTypeEnum = {
|
|||
EMBEDDING: 5, // 向量
|
||||
RERANK: 6, // 重排
|
||||
};
|
||||
export interface ImageModelVO {
|
||||
export interface ImageModel {
|
||||
key: string;
|
||||
name: string;
|
||||
image?: string;
|
||||
}
|
||||
export const OtherPlatformEnum: ImageModelVO[] = [
|
||||
export const OtherPlatformEnum: ImageModel[] = [
|
||||
{
|
||||
key: AiPlatformEnum.TONG_YI,
|
||||
name: '通义万相',
|
||||
|
@ -98,7 +98,7 @@ export const ImageHotEnglishWords = [
|
|||
'The Great Wall of China',
|
||||
]; // 图片热词(英文)
|
||||
|
||||
export const StableDiffusionSamplers: ImageModelVO[] = [
|
||||
export const StableDiffusionSamplers: ImageModel[] = [
|
||||
{
|
||||
key: 'DDIM',
|
||||
name: 'DDIM',
|
||||
|
@ -141,7 +141,7 @@ export const StableDiffusionSamplers: ImageModelVO[] = [
|
|||
},
|
||||
];
|
||||
|
||||
export const StableDiffusionStylePresets: ImageModelVO[] = [
|
||||
export const StableDiffusionStylePresets: ImageModel[] = [
|
||||
{
|
||||
key: '3d-model',
|
||||
name: '3d-model',
|
||||
|
@ -213,7 +213,7 @@ export const StableDiffusionStylePresets: ImageModelVO[] = [
|
|||
},
|
||||
];
|
||||
|
||||
export const StableDiffusionClipGuidancePresets: ImageModelVO[] = [
|
||||
export const StableDiffusionClipGuidancePresets: ImageModel[] = [
|
||||
{
|
||||
key: 'NONE',
|
||||
name: 'NONE',
|
||||
|
@ -330,14 +330,14 @@ export const InfraApiErrorLogProcessStatusEnum = {
|
|||
DONE: 1, // 已处理
|
||||
IGNORE: 2, // 已忽略
|
||||
};
|
||||
export interface ImageSizeVO {
|
||||
export interface ImageSize {
|
||||
key: string;
|
||||
name?: string;
|
||||
style: string;
|
||||
width: string;
|
||||
height: string;
|
||||
}
|
||||
export const Dall3SizeList: ImageSizeVO[] = [
|
||||
export const Dall3SizeList: ImageSize[] = [
|
||||
{
|
||||
key: '1024x1024',
|
||||
name: '1:1',
|
||||
|
@ -361,7 +361,7 @@ export const Dall3SizeList: ImageSizeVO[] = [
|
|||
},
|
||||
];
|
||||
|
||||
export const Dall3Models: ImageModelVO[] = [
|
||||
export const Dall3Models: ImageModel[] = [
|
||||
{
|
||||
key: 'dall-e-3',
|
||||
name: 'DALL·E 3',
|
||||
|
@ -374,7 +374,7 @@ export const Dall3Models: ImageModelVO[] = [
|
|||
},
|
||||
];
|
||||
|
||||
export const Dall3StyleList: ImageModelVO[] = [
|
||||
export const Dall3StyleList: ImageModel[] = [
|
||||
{
|
||||
key: 'vivid',
|
||||
name: '清晰',
|
||||
|
@ -386,7 +386,7 @@ export const Dall3StyleList: ImageModelVO[] = [
|
|||
image: `/static/imgs/ai/ziran.jpg`,
|
||||
},
|
||||
];
|
||||
export const MidjourneyModels: ImageModelVO[] = [
|
||||
export const MidjourneyModels: ImageModel[] = [
|
||||
{
|
||||
key: 'midjourney',
|
||||
name: 'MJ',
|
||||
|
@ -428,7 +428,7 @@ export const NijiVersionList = [
|
|||
},
|
||||
];
|
||||
|
||||
export const MidjourneySizeList: ImageSizeVO[] = [
|
||||
export const MidjourneySizeList: ImageSize[] = [
|
||||
{
|
||||
key: '1:1',
|
||||
width: '1',
|
||||
|
|
|
@ -44,7 +44,7 @@ const [Drawer, drawerApi] = useVbenDrawer({
|
|||
const searchName = ref<string>(''); // 对话搜索
|
||||
const activeConversationId = ref<null | number>(null); // 选中的对话,默认为 null
|
||||
const hoverConversationId = ref<null | number>(null); // 悬浮上去的对话
|
||||
const conversationList = ref([] as AiChatConversationApi.ChatConversationVO[]); // 对话列表
|
||||
const conversationList = ref([] as AiChatConversationApi.ChatConversation[]); // 对话列表
|
||||
const conversationMap = ref<any>({}); // 对话分组 (置顶、今天、三天前、一星期前、一个月前)
|
||||
const loading = ref<boolean>(false); // 加载中
|
||||
const loadingTime = ref<any>();
|
||||
|
@ -118,7 +118,7 @@ async function getChatConversationList() {
|
|||
|
||||
/** 按照 creteTime 创建时间,进行分组 */
|
||||
async function getConversationGroupByCreateTime(
|
||||
list: AiChatConversationApi.ChatConversationVO[],
|
||||
list: AiChatConversationApi.ChatConversation[],
|
||||
) {
|
||||
// 排序、指定、时间分组(今天、一天前、三天前、七天前、30天前)
|
||||
// noinspection NonAsciiCharacters
|
||||
|
@ -164,7 +164,7 @@ async function getConversationGroupByCreateTime(
|
|||
async function createConversation() {
|
||||
// 1. 新建对话
|
||||
const conversationId = await createChatConversationMy(
|
||||
{} as unknown as AiChatConversationApi.ChatConversationVO,
|
||||
{} as unknown as AiChatConversationApi.ChatConversation,
|
||||
);
|
||||
// 2. 获取对话内容
|
||||
await getChatConversationList();
|
||||
|
@ -176,7 +176,7 @@ async function createConversation() {
|
|||
|
||||
/** 修改对话的标题 */
|
||||
async function updateConversationTitle(
|
||||
conversation: AiChatConversationApi.ChatConversationVO,
|
||||
conversation: AiChatConversationApi.ChatConversation,
|
||||
) {
|
||||
// 1. 二次确认
|
||||
prompt({
|
||||
|
@ -188,7 +188,7 @@ async function updateConversationTitle(
|
|||
await updateChatConversationMy({
|
||||
id: conversation.id,
|
||||
title: scope.value,
|
||||
} as AiChatConversationApi.ChatConversationVO);
|
||||
} as AiChatConversationApi.ChatConversation);
|
||||
message.success('重命名成功');
|
||||
// 3. 刷新列表
|
||||
await getChatConversationList();
|
||||
|
@ -230,7 +230,7 @@ async function updateConversationTitle(
|
|||
|
||||
/** 删除聊天对话 */
|
||||
async function deleteChatConversation(
|
||||
conversation: AiChatConversationApi.ChatConversationVO,
|
||||
conversation: AiChatConversationApi.ChatConversation,
|
||||
) {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
|
@ -261,7 +261,7 @@ async function handleClearConversation() {
|
|||
|
||||
/** 对话置顶 */
|
||||
async function handleTop(
|
||||
conversation: AiChatConversationApi.ChatConversationVO,
|
||||
conversation: AiChatConversationApi.ChatConversation,
|
||||
) {
|
||||
// 更新对话置顶
|
||||
conversation.pinned = !conversation.pinned;
|
||||
|
|
|
@ -17,7 +17,7 @@ import { $t } from '#/locales';
|
|||
import { useFormSchema } from '../../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<AiChatConversationApi.ChatConversationVO>();
|
||||
const formData = ref<AiChatConversationApi.ChatConversation>();
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
|
@ -41,7 +41,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data =
|
||||
(await formApi.getValues()) as AiChatConversationApi.ChatConversationVO;
|
||||
(await formApi.getValues()) as AiChatConversationApi.ChatConversation;
|
||||
try {
|
||||
await updateChatConversationMy(data);
|
||||
|
||||
|
@ -59,7 +59,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<AiChatConversationApi.ChatConversationVO>();
|
||||
const data = modalApi.getData<AiChatConversationApi.ChatConversation>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -21,11 +21,11 @@ import MessageKnowledge from './MessageKnowledge.vue';
|
|||
// 定义 props
|
||||
const props = defineProps({
|
||||
conversation: {
|
||||
type: Object as PropType<AiChatConversationApi.ChatConversationVO>,
|
||||
type: Object as PropType<AiChatConversationApi.ChatConversation>,
|
||||
required: true,
|
||||
},
|
||||
list: {
|
||||
type: Array as PropType<AiChatMessageApi.ChatMessageVO[]>,
|
||||
type: Array as PropType<AiChatMessageApi.ChatMessage[]>,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
@ -95,12 +95,12 @@ async function onDelete(id: number) {
|
|||
}
|
||||
|
||||
/** 刷新 */
|
||||
async function onRefresh(message: AiChatMessageApi.ChatMessageVO) {
|
||||
async function onRefresh(message: AiChatMessageApi.ChatMessage) {
|
||||
emits('onRefresh', message);
|
||||
}
|
||||
|
||||
/** 编辑 */
|
||||
async function onEdit(message: AiChatMessageApi.ChatMessageVO) {
|
||||
async function onEdit(message: AiChatMessageApi.ChatMessage) {
|
||||
emits('onEdit', message);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ const props = defineProps({
|
|||
required: true,
|
||||
},
|
||||
roleList: {
|
||||
type: Array as PropType<AiModelChatRoleApi.ChatRoleVO[]>,
|
||||
type: Array as PropType<AiModelChatRoleApi.ChatRole[]>,
|
||||
required: true,
|
||||
},
|
||||
showMore: {
|
||||
|
|
|
@ -36,12 +36,12 @@ const myRoleParams = reactive({
|
|||
pageNo: 1,
|
||||
pageSize: 50,
|
||||
});
|
||||
const myRoleList = ref<AiModelChatRoleApi.ChatRoleVO[]>([]); // my 分页大小
|
||||
const myRoleList = ref<AiModelChatRoleApi.ChatRole[]>([]); // my 分页大小
|
||||
const publicRoleParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 50,
|
||||
});
|
||||
const publicRoleList = ref<AiModelChatRoleApi.ChatRoleVO[]>([]); // public 分页大小
|
||||
const publicRoleList = ref<AiModelChatRoleApi.ChatRole[]>([]); // public 分页大小
|
||||
const activeCategory = ref<string>('全部'); // 选择中的分类
|
||||
const categoryList = ref<string[]>([]); // 角色分类类别
|
||||
|
||||
|
@ -55,7 +55,7 @@ async function handleTabsClick(tab: any) {
|
|||
|
||||
/** 获取 my role 我的角色 */
|
||||
async function getMyRole(append?: boolean) {
|
||||
const params: AiModelChatRoleApi.ChatRolePageReqVO = {
|
||||
const params: AiModelChatRoleApi.ChatRolePageReq = {
|
||||
...myRoleParams,
|
||||
name: search.value,
|
||||
publicStatus: false,
|
||||
|
@ -70,7 +70,7 @@ async function getMyRole(append?: boolean) {
|
|||
|
||||
/** 获取 public role 公共角色 */
|
||||
async function getPublicRole(append?: boolean) {
|
||||
const params: AiModelChatRoleApi.ChatRolePageReqVO = {
|
||||
const params: AiModelChatRoleApi.ChatRolePageReq = {
|
||||
...publicRoleParams,
|
||||
category: activeCategory.value === '全部' ? '' : activeCategory.value,
|
||||
name: search.value,
|
||||
|
@ -148,9 +148,9 @@ async function handlerCardPage(type: string) {
|
|||
/** 选择 card 角色:新建聊天对话 */
|
||||
async function handlerCardUse(role: any) {
|
||||
// 1. 创建对话
|
||||
const data: AiChatConversationApi.ChatConversationVO = {
|
||||
const data: AiChatConversationApi.ChatConversation = {
|
||||
roleId: role.id,
|
||||
} as unknown as AiChatConversationApi.ChatConversationVO;
|
||||
} as unknown as AiChatConversationApi.ChatConversation;
|
||||
const conversationId = await createChatConversationMy(data);
|
||||
|
||||
// 2. 跳转页面
|
||||
|
|
|
@ -34,14 +34,14 @@ const [FormModal, formModalApi] = useVbenModal({
|
|||
// 聊天对话
|
||||
const conversationListRef = ref();
|
||||
const activeConversationId = ref<null | number>(null); // 选中的对话编号
|
||||
const activeConversation = ref<AiChatConversationApi.ChatConversationVO | null>(
|
||||
const activeConversation = ref<AiChatConversationApi.ChatConversation | null>(
|
||||
null,
|
||||
); // 选中的 Conversation
|
||||
const conversationInProgress = ref(false); // 对话是否正在进行中。目前只有【发送】消息时,会更新为 true,避免切换对话、删除对话等操作
|
||||
|
||||
// 消息列表
|
||||
const messageRef = ref();
|
||||
const activeMessageList = ref<AiChatMessageApi.ChatMessageVO[]>([]); // 选中对话的消息列表
|
||||
const activeMessageList = ref<AiChatMessageApi.ChatMessage[]>([]); // 选中对话的消息列表
|
||||
const activeMessageListLoading = ref<boolean>(false); // activeMessageList 是否正在加载中
|
||||
const activeMessageListLoadingTimer = ref<any>(); // activeMessageListLoading Timer 定时器。如果加载速度很快,就不进入加载中
|
||||
// 消息滚动
|
||||
|
@ -65,7 +65,7 @@ async function getConversation(id: null | number) {
|
|||
if (!id) {
|
||||
return;
|
||||
}
|
||||
const conversation: AiChatConversationApi.ChatConversationVO =
|
||||
const conversation: AiChatConversationApi.ChatConversation =
|
||||
await getChatConversationMy(id);
|
||||
if (!conversation) {
|
||||
return;
|
||||
|
@ -81,7 +81,7 @@ async function getConversation(id: null | number) {
|
|||
* @return 是否切换成功
|
||||
*/
|
||||
async function handleConversationClick(
|
||||
conversation: AiChatConversationApi.ChatConversationVO,
|
||||
conversation: AiChatConversationApi.ChatConversation,
|
||||
) {
|
||||
// 对话进行中,不允许切换
|
||||
if (conversationInProgress.value) {
|
||||
|
@ -103,7 +103,7 @@ async function handleConversationClick(
|
|||
|
||||
/** 删除某个对话*/
|
||||
async function handlerConversationDelete(
|
||||
delConversation: AiChatConversationApi.ChatConversationVO,
|
||||
delConversation: AiChatConversationApi.ChatConversation,
|
||||
) {
|
||||
// 删除的对话如果是当前选中的,那么就重置
|
||||
if (activeConversationId.value === delConversation.id) {
|
||||
|
@ -303,12 +303,12 @@ async function doSendMessage(content: string) {
|
|||
await doSendMessageStream({
|
||||
conversationId: activeConversationId.value,
|
||||
content,
|
||||
} as AiChatMessageApi.ChatMessageVO);
|
||||
} as AiChatMessageApi.ChatMessage);
|
||||
}
|
||||
|
||||
/** 真正执行【发送】消息操作 */
|
||||
async function doSendMessageStream(
|
||||
userMessage: AiChatMessageApi.ChatMessageVO,
|
||||
userMessage: AiChatMessageApi.ChatMessage,
|
||||
) {
|
||||
// 创建 AbortController 实例,以便中止请求
|
||||
conversationInAbortController.value = new AbortController();
|
||||
|
@ -326,14 +326,14 @@ async function doSendMessageStream(
|
|||
type: 'user',
|
||||
content: userMessage.content,
|
||||
createTime: new Date(),
|
||||
} as AiChatMessageApi.ChatMessageVO,
|
||||
} as AiChatMessageApi.ChatMessage,
|
||||
{
|
||||
id: -2,
|
||||
conversationId: activeConversationId.value,
|
||||
type: 'assistant',
|
||||
content: '思考中...',
|
||||
createTime: new Date(),
|
||||
} as AiChatMessageApi.ChatMessageVO,
|
||||
} as AiChatMessageApi.ChatMessage,
|
||||
);
|
||||
// 1.2 滚动到最下面
|
||||
await nextTick();
|
||||
|
@ -398,12 +398,12 @@ async function stopStream() {
|
|||
}
|
||||
|
||||
/** 编辑 message:设置为 prompt,可以再次编辑 */
|
||||
function handleMessageEdit(message: AiChatMessageApi.ChatMessageVO) {
|
||||
function handleMessageEdit(message: AiChatMessageApi.ChatMessage) {
|
||||
prompt.value = message.content;
|
||||
}
|
||||
|
||||
/** 刷新 message:基于指定消息,再次发起对话 */
|
||||
function handleMessageRefresh(message: AiChatMessageApi.ChatMessageVO) {
|
||||
function handleMessageRefresh(message: AiChatMessageApi.ChatMessage) {
|
||||
doSendMessage(message.content);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ function onRefresh() {
|
|||
}
|
||||
|
||||
/** 删除 */
|
||||
async function handleDelete(row: AiChatConversationApi.ChatConversationVO) {
|
||||
async function handleDelete(row: AiChatConversationApi.ChatConversation) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.id]),
|
||||
key: 'action_key_msg',
|
||||
|
@ -72,7 +72,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<AiChatConversationApi.ChatConversationVO>,
|
||||
} as VxeTableGridOptions<AiChatConversationApi.ChatConversation>,
|
||||
separator: false,
|
||||
});
|
||||
onMounted(async () => {
|
||||
|
|
|
@ -26,7 +26,7 @@ function onRefresh() {
|
|||
}
|
||||
|
||||
/** 删除 */
|
||||
async function handleDelete(row: AiChatConversationApi.ChatConversationVO) {
|
||||
async function handleDelete(row: AiChatConversationApi.ChatConversation) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.id]),
|
||||
key: 'action_key_msg',
|
||||
|
@ -69,7 +69,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<AiChatConversationApi.ChatConversationVO>,
|
||||
} as VxeTableGridOptions<AiChatConversationApi.ChatConversation>,
|
||||
separator: false,
|
||||
});
|
||||
onMounted(async () => {
|
||||
|
|
|
@ -16,7 +16,7 @@ import { AiImageStatusEnum } from '#/utils';
|
|||
|
||||
const props = defineProps({
|
||||
detail: {
|
||||
type: Object as PropType<AiImageApi.ImageVO>,
|
||||
type: Object as PropType<AiImageApi.Image>,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
|
@ -25,13 +25,13 @@ const emits = defineEmits(['onBtnClick', 'onMjBtnClick']);
|
|||
const cardImageRef = ref<any>(); // 卡片 image ref
|
||||
|
||||
/** 处理点击事件 */
|
||||
async function handleButtonClick(type: string, detail: AiImageApi.ImageVO) {
|
||||
async function handleButtonClick(type: string, detail: AiImageApi.Image) {
|
||||
emits('onBtnClick', type, detail);
|
||||
}
|
||||
|
||||
/** 处理 Midjourney 按钮点击事件 */
|
||||
async function handleMidjourneyBtnClick(
|
||||
button: AiImageApi.ImageMidjourneyButtonsVO,
|
||||
button: AiImageApi.ImageMidjourneyButtons,
|
||||
) {
|
||||
// 确认窗体
|
||||
await confirm(`确认操作 "${button.label} ${button.emoji}" ?`);
|
||||
|
|
|
@ -23,7 +23,7 @@ const props = defineProps({
|
|||
required: true,
|
||||
},
|
||||
});
|
||||
const detail = ref<AiImageApi.ImageVO>({} as AiImageApi.ImageVO);
|
||||
const detail = ref<AiImageApi.Image>({} as AiImageApi.Image);
|
||||
|
||||
/** 获取图片详情 */
|
||||
async function getImageDetail(id: number) {
|
||||
|
|
|
@ -35,7 +35,7 @@ const queryParams = reactive({
|
|||
pageSize: 10,
|
||||
});
|
||||
const pageTotal = ref<number>(0); // page size
|
||||
const imageList = ref<AiImageApi.ImageVO[]>([]); // image 列表
|
||||
const imageList = ref<AiImageApi.Image[]>([]); // image 列表
|
||||
const imageListRef = ref<any>(); // ref
|
||||
// 图片轮询相关的参数(正在生成中的)
|
||||
const inProgressImageMap = ref<{}>({}); // 监听的 image 映射,一般是生成中(需要轮询),key 为 image 编号,value 为 image
|
||||
|
@ -85,7 +85,7 @@ async function refreshWatchImages() {
|
|||
if (imageIds.length === 0) {
|
||||
return;
|
||||
}
|
||||
const list = (await getImageListMyByIds(imageIds)) as AiImageApi.ImageVO[];
|
||||
const list = (await getImageListMyByIds(imageIds)) as AiImageApi.Image[];
|
||||
const newWatchImages: any = {};
|
||||
list.forEach((image) => {
|
||||
if (image.status === AiImageStatusEnum.IN_PROGRESS) {
|
||||
|
@ -106,7 +106,7 @@ async function refreshWatchImages() {
|
|||
/** 图片的点击事件 */
|
||||
async function handleImageButtonClick(
|
||||
type: string,
|
||||
imageDetail: AiImageApi.ImageVO,
|
||||
imageDetail: AiImageApi.Image,
|
||||
) {
|
||||
// 详情
|
||||
if (type === 'more') {
|
||||
|
@ -138,14 +138,14 @@ async function handleImageButtonClick(
|
|||
|
||||
/** 处理 Midjourney 按钮点击事件 */
|
||||
async function handleImageMidjourneyButtonClick(
|
||||
button: AiImageApi.ImageMidjourneyButtonsVO,
|
||||
imageDetail: AiImageApi.ImageVO,
|
||||
button: AiImageApi.ImageMidjourneyButtons,
|
||||
imageDetail: AiImageApi.Image,
|
||||
) {
|
||||
// 1. 构建 params 参数
|
||||
const data = {
|
||||
id: imageDetail.id,
|
||||
customId: button.customId,
|
||||
} as AiImageApi.ImageMidjourneyActionVO;
|
||||
} as AiImageApi.ImageMidjourneyAction;
|
||||
// 2. 发送 action
|
||||
await midjourneyAction(data);
|
||||
// 3. 刷新列表
|
||||
|
|
|
@ -17,8 +17,8 @@ import { AiPlatformEnum, ImageHotWords, OtherPlatformEnum } from '#/utils';
|
|||
// 接收父组件传入的模型列表
|
||||
const props = defineProps({
|
||||
models: {
|
||||
type: Array<AiModelModelApi.ModelVO>,
|
||||
default: () => [] as AiModelModelApi.ModelVO[],
|
||||
type: Array<AiModelModelApi.Model>,
|
||||
default: () => [] as AiModelModelApi.Model[],
|
||||
},
|
||||
});
|
||||
const emits = defineEmits(['onDrawStart', 'onDrawComplete']);
|
||||
|
@ -31,7 +31,7 @@ const prompt = ref<string>(''); // 提示词
|
|||
const width = ref<number>(512); // 图片宽度
|
||||
const height = ref<number>(512); // 图片高度
|
||||
const otherPlatform = ref<string>(AiPlatformEnum.TONG_YI); // 平台
|
||||
const platformModels = ref<AiModelModelApi.ModelVO[]>([]); // 模型列表
|
||||
const platformModels = ref<AiModelModelApi.Model[]>([]); // 模型列表
|
||||
const modelId = ref<number>(); // 选中的模型
|
||||
|
||||
/** 选择热词 */
|
||||
|
@ -64,7 +64,7 @@ async function handleGenerateImage() {
|
|||
width: width.value, // 图片宽度
|
||||
height: height.value, // 图片高度
|
||||
options: {},
|
||||
} as unknown as AiImageApi.ImageDrawReqVO;
|
||||
} as unknown as AiImageApi.ImageDrawReq;
|
||||
await drawImage(form);
|
||||
} finally {
|
||||
// 回调
|
||||
|
@ -75,7 +75,7 @@ async function handleGenerateImage() {
|
|||
}
|
||||
|
||||
/** 填充值 */
|
||||
async function settingValues(detail: AiImageApi.ImageVO) {
|
||||
async function settingValues(detail: AiImageApi.Image) {
|
||||
prompt.value = detail.prompt;
|
||||
width.value = detail.width;
|
||||
height.value = detail.height;
|
||||
|
@ -85,7 +85,7 @@ async function settingValues(detail: AiImageApi.ImageVO) {
|
|||
async function handlerPlatformChange(platform: any) {
|
||||
// 根据选择的平台筛选模型
|
||||
platformModels.value = props.models.filter(
|
||||
(item: AiModelModelApi.ModelVO) => item.platform === platform,
|
||||
(item: AiModelModelApi.Model) => item.platform === platform,
|
||||
);
|
||||
modelId.value =
|
||||
platformModels.value.length > 0 && platformModels.value[0]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<script setup lang="ts">
|
||||
import type { AiImageApi } from '#/api/ai/image';
|
||||
import type { AiModelModelApi } from '#/api/ai/model/model';
|
||||
import type { ImageModelVO, ImageSizeVO } from '#/utils';
|
||||
import type { ImageModel, ImageSize } from '#/utils';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
|
@ -22,8 +22,8 @@ import {
|
|||
// 接收父组件传入的模型列表
|
||||
const props = defineProps({
|
||||
models: {
|
||||
type: Array<AiModelModelApi.ModelVO>,
|
||||
default: () => [] as AiModelModelApi.ModelVO[],
|
||||
type: Array<AiModelModelApi.Model>,
|
||||
default: () => [] as AiModelModelApi.Model[],
|
||||
},
|
||||
});
|
||||
const emits = defineEmits(['onDrawStart', 'onDrawComplete']);
|
||||
|
@ -50,7 +50,7 @@ async function handleHotWordClick(hotWord: string) {
|
|||
}
|
||||
|
||||
/** 选择 model 模型 */
|
||||
async function handleModelClick(model: ImageModelVO) {
|
||||
async function handleModelClick(model: ImageModel) {
|
||||
selectModel.value = model.key;
|
||||
// 可以在这里添加模型特定的处理逻辑
|
||||
// 例如,如果未来需要根据不同模型设置不同参数
|
||||
|
@ -76,12 +76,12 @@ async function handleModelClick(model: ImageModelVO) {
|
|||
}
|
||||
|
||||
/** 选择 style 样式 */
|
||||
async function handleStyleClick(imageStyle: ImageModelVO) {
|
||||
async function handleStyleClick(imageStyle: ImageModel) {
|
||||
style.value = imageStyle.key;
|
||||
}
|
||||
|
||||
/** 选择 size 大小 */
|
||||
async function handleSizeClick(imageSize: ImageSizeVO) {
|
||||
async function handleSizeClick(imageSize: ImageSize) {
|
||||
selectSize.value = imageSize.key;
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ async function handleGenerateImage() {
|
|||
emits('onDrawStart', AiPlatformEnum.OPENAI);
|
||||
const imageSize = Dall3SizeList.find(
|
||||
(item) => item.key === selectSize.value,
|
||||
) as ImageSizeVO;
|
||||
) as ImageSize;
|
||||
const form = {
|
||||
platform: AiPlatformEnum.OPENAI,
|
||||
prompt: prompt.value, // 提示词
|
||||
|
@ -118,7 +118,7 @@ async function handleGenerateImage() {
|
|||
options: {
|
||||
style: style.value, // 图像生成的风格
|
||||
},
|
||||
} as AiImageApi.ImageDrawReqVO;
|
||||
} as AiImageApi.ImageDrawReq;
|
||||
// 发送请求
|
||||
await drawImage(form);
|
||||
} finally {
|
||||
|
@ -130,13 +130,13 @@ async function handleGenerateImage() {
|
|||
}
|
||||
|
||||
/** 填充值 */
|
||||
async function settingValues(detail: AiImageApi.ImageVO) {
|
||||
async function settingValues(detail: AiImageApi.Image) {
|
||||
prompt.value = detail.prompt;
|
||||
selectModel.value = detail.model;
|
||||
style.value = detail.options?.style;
|
||||
const imageSize = Dall3SizeList.find(
|
||||
(item) => item.key === `${detail.width}x${detail.height}`,
|
||||
) as ImageSizeVO;
|
||||
) as ImageSize;
|
||||
await handleSizeClick(imageSize);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<script setup lang="ts">
|
||||
import type { AiImageApi } from '#/api/ai/image';
|
||||
import type { AiModelModelApi } from '#/api/ai/model/model';
|
||||
import type { ImageModelVO, ImageSizeVO } from '#/utils';
|
||||
import type { ImageModel, ImageSize } from '#/utils';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
|
@ -33,8 +33,8 @@ import {
|
|||
// 接收父组件传入的模型列表
|
||||
const props = defineProps({
|
||||
models: {
|
||||
type: Array<AiModelModelApi.ModelVO>,
|
||||
default: () => [] as AiModelModelApi.ModelVO[],
|
||||
type: Array<AiModelModelApi.Model>,
|
||||
default: () => [] as AiModelModelApi.Model[],
|
||||
},
|
||||
});
|
||||
const emits = defineEmits(['onDrawStart', 'onDrawComplete']);
|
||||
|
@ -64,12 +64,12 @@ async function handleHotWordClick(hotWord: string) {
|
|||
}
|
||||
|
||||
/** 点击 size 尺寸 */
|
||||
async function handleSizeClick(imageSize: ImageSizeVO) {
|
||||
async function handleSizeClick(imageSize: ImageSize) {
|
||||
selectSize.value = imageSize.key;
|
||||
}
|
||||
|
||||
/** 点击 model 模型 */
|
||||
async function handleModelClick(model: ImageModelVO) {
|
||||
async function handleModelClick(model: ImageModel) {
|
||||
selectModel.value = model.key;
|
||||
versionList.value =
|
||||
model.key === 'niji' ? NijiVersionList : MidjourneyVersions;
|
||||
|
@ -99,7 +99,7 @@ async function handleGenerateImage() {
|
|||
// 发送请求
|
||||
const imageSize = MidjourneySizeList.find(
|
||||
(item) => selectSize.value === item.key,
|
||||
) as ImageSizeVO;
|
||||
) as ImageSize;
|
||||
const req = {
|
||||
prompt: prompt.value,
|
||||
modelId: matchedModel.id,
|
||||
|
@ -107,7 +107,7 @@ async function handleGenerateImage() {
|
|||
height: imageSize.height,
|
||||
version: selectVersion.value,
|
||||
referImageUrl: referImageUrl.value,
|
||||
} as AiImageApi.ImageMidjourneyImagineReqVO;
|
||||
} as AiImageApi.ImageMidjourneyImagineReq;
|
||||
await midjourneyImagine(req);
|
||||
} finally {
|
||||
// 回调
|
||||
|
@ -118,18 +118,18 @@ async function handleGenerateImage() {
|
|||
}
|
||||
|
||||
/** 填充值 */
|
||||
async function settingValues(detail: AiImageApi.ImageVO) {
|
||||
async function settingValues(detail: AiImageApi.Image) {
|
||||
// 提示词
|
||||
prompt.value = detail.prompt;
|
||||
// image size
|
||||
const imageSize = MidjourneySizeList.find(
|
||||
(item) => item.key === `${detail.width}:${detail.height}`,
|
||||
) as ImageSizeVO;
|
||||
) as ImageSize;
|
||||
selectSize.value = imageSize.key;
|
||||
// 选中模型
|
||||
const model = MidjourneyModels.find(
|
||||
(item) => item.key === detail.options?.model,
|
||||
) as ImageModelVO;
|
||||
) as ImageModel;
|
||||
await handleModelClick(model);
|
||||
// 版本
|
||||
selectVersion.value = versionList.value.find(
|
||||
|
|
|
@ -28,8 +28,8 @@ import {
|
|||
// 接收父组件传入的模型列表
|
||||
const props = defineProps({
|
||||
models: {
|
||||
type: Array<AiModelModelApi.ModelVO>,
|
||||
default: () => [] as AiModelModelApi.ModelVO[],
|
||||
type: Array<AiModelModelApi.Model>,
|
||||
default: () => [] as AiModelModelApi.Model[],
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -106,7 +106,7 @@ async function handleGenerateImage() {
|
|||
clipGuidancePreset: clipGuidancePreset.value, // 文本提示相匹配的图像 CLIP
|
||||
stylePreset: stylePreset.value, // 风格
|
||||
},
|
||||
} as unknown as AiImageApi.ImageDrawReqVO;
|
||||
} as unknown as AiImageApi.ImageDrawReq;
|
||||
await drawImage(form);
|
||||
} finally {
|
||||
// 回调
|
||||
|
@ -117,7 +117,7 @@ async function handleGenerateImage() {
|
|||
}
|
||||
|
||||
/** 填充值 */
|
||||
async function settingValues(detail: AiImageApi.ImageVO) {
|
||||
async function settingValues(detail: AiImageApi.Image) {
|
||||
prompt.value = detail.prompt;
|
||||
width.value = detail.width;
|
||||
height.value = detail.height;
|
||||
|
|
|
@ -44,7 +44,7 @@ const platformOptions = [
|
|||
},
|
||||
];
|
||||
|
||||
const models = ref<AiModelModelApi.ModelVO[]>([]); // 模型列表
|
||||
const models = ref<AiModelModelApi.Model[]>([]); // 模型列表
|
||||
|
||||
/** 绘画 start */
|
||||
const handleDrawStart = async () => {};
|
||||
|
@ -55,7 +55,7 @@ const handleDrawComplete = async () => {
|
|||
};
|
||||
|
||||
/** 重新生成:将画图详情填充到对应平台 */
|
||||
const handleRegeneration = async (image: AiImageApi.ImageVO) => {
|
||||
const handleRegeneration = async (image: AiImageApi.Image) => {
|
||||
// 切换平台
|
||||
selectPlatform.value = image.platform;
|
||||
// 根据不同平台填充 image
|
||||
|
|
|
@ -24,7 +24,7 @@ function onRefresh() {
|
|||
}
|
||||
|
||||
/** 删除 */
|
||||
async function handleDelete(row: AiImageApi.ImageVO) {
|
||||
async function handleDelete(row: AiImageApi.Image) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.id]),
|
||||
key: 'action_key_msg',
|
||||
|
@ -41,7 +41,7 @@ async function handleDelete(row: AiImageApi.ImageVO) {
|
|||
}
|
||||
}
|
||||
/** 修改是否发布 */
|
||||
const handleUpdatePublicStatusChange = async (row: AiImageApi.ImageVO) => {
|
||||
const handleUpdatePublicStatusChange = async (row: AiImageApi.Image) => {
|
||||
try {
|
||||
// 修改状态的二次确认
|
||||
const text = row.publicStatus ? '公开' : '私有';
|
||||
|
@ -82,7 +82,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<AiImageApi.ImageVO>,
|
||||
} as VxeTableGridOptions<AiImageApi.Image>,
|
||||
});
|
||||
onMounted(async () => {
|
||||
// 获得下拉数据
|
||||
|
|
|
@ -11,7 +11,7 @@ import { Image, Input, Pagination } from 'ant-design-vue';
|
|||
import { getImagePageMy } from '#/api/ai/image';
|
||||
|
||||
const loading = ref(true); // 列表的加载中
|
||||
const list = ref<AiImageApi.ImageVO[]>([]); // 列表的数据
|
||||
const list = ref<AiImageApi.Image[]>([]); // 列表的数据
|
||||
const total = ref(0); // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
|
|
|
@ -49,7 +49,7 @@ function handleEdit(id: number) {
|
|||
}
|
||||
|
||||
/** 删除 */
|
||||
async function handleDelete(row: AiKnowledgeDocumentApi.KnowledgeDocumentVO) {
|
||||
async function handleDelete(row: AiKnowledgeDocumentApi.KnowledgeDocument) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
key: 'action_key_msg',
|
||||
|
@ -74,7 +74,7 @@ const handleSegment = (id: number) => {
|
|||
};
|
||||
/** 修改是否发布 */
|
||||
const handleStatusChange = async (
|
||||
row: AiKnowledgeDocumentApi.KnowledgeDocumentVO,
|
||||
row: AiKnowledgeDocumentApi.KnowledgeDocument,
|
||||
) => {
|
||||
try {
|
||||
// 修改状态的二次确认
|
||||
|
@ -120,7 +120,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<AiKnowledgeDocumentApi.KnowledgeDocumentVO>,
|
||||
} as VxeTableGridOptions<AiKnowledgeDocumentApi.KnowledgeDocument>,
|
||||
});
|
||||
/** 初始化 */
|
||||
onMounted(() => {
|
||||
|
|
|
@ -34,12 +34,12 @@ function handleCreate() {
|
|||
}
|
||||
|
||||
/** 编辑 */
|
||||
function handleEdit(row: AiKnowledgeKnowledgeApi.KnowledgeVO) {
|
||||
function handleEdit(row: AiKnowledgeKnowledgeApi.Knowledge) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除 */
|
||||
async function handleDelete(row: AiKnowledgeKnowledgeApi.KnowledgeVO) {
|
||||
async function handleDelete(row: AiKnowledgeKnowledgeApi.Knowledge) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
key: 'action_key_msg',
|
||||
|
@ -98,7 +98,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<AiKnowledgeKnowledgeApi.KnowledgeVO>,
|
||||
} as VxeTableGridOptions<AiKnowledgeKnowledgeApi.Knowledge>,
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import { $t } from '#/locales';
|
|||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<AiKnowledgeKnowledgeApi.KnowledgeVO>();
|
||||
const formData = ref<AiKnowledgeKnowledgeApi.Knowledge>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['AI 知识库'])
|
||||
|
@ -47,7 +47,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data =
|
||||
(await formApi.getValues()) as AiKnowledgeKnowledgeApi.KnowledgeVO;
|
||||
(await formApi.getValues()) as AiKnowledgeKnowledgeApi.Knowledge;
|
||||
try {
|
||||
await (formData.value?.id
|
||||
? updateKnowledge(data)
|
||||
|
@ -66,7 +66,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<AiKnowledgeKnowledgeApi.KnowledgeVO>();
|
||||
const data = modalApi.getData<AiKnowledgeKnowledgeApi.Knowledge>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -41,12 +41,12 @@ function handleCreate() {
|
|||
}
|
||||
|
||||
/** 编辑 */
|
||||
function handleEdit(row: AiKnowledgeKnowledgeApi.KnowledgeVO) {
|
||||
function handleEdit(row: AiKnowledgeKnowledgeApi.Knowledge) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除 */
|
||||
async function handleDelete(row: AiKnowledgeKnowledgeApi.KnowledgeVO) {
|
||||
async function handleDelete(row: AiKnowledgeKnowledgeApi.Knowledge) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.id]),
|
||||
key: 'action_key_msg',
|
||||
|
@ -89,12 +89,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<AiKnowledgeKnowledgeApi.KnowledgeVO>,
|
||||
} as VxeTableGridOptions<AiKnowledgeKnowledgeApi.Knowledge>,
|
||||
});
|
||||
|
||||
/** 修改是否发布 */
|
||||
async function handleStatusChange(
|
||||
row: AiKnowledgeSegmentApi.KnowledgeSegmentVO,
|
||||
row: AiKnowledgeSegmentApi.KnowledgeSegment,
|
||||
) {
|
||||
try {
|
||||
// 修改状态的二次确认
|
||||
|
|
|
@ -18,7 +18,7 @@ import { $t } from '#/locales';
|
|||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<AiKnowledgeSegmentApi.KnowledgeSegmentVO>();
|
||||
const formData = ref<AiKnowledgeSegmentApi.KnowledgeSegment>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['分段'])
|
||||
|
@ -47,7 +47,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data =
|
||||
(await formApi.getValues()) as AiKnowledgeSegmentApi.KnowledgeSegmentVO;
|
||||
(await formApi.getValues()) as AiKnowledgeSegmentApi.KnowledgeSegment;
|
||||
try {
|
||||
await (formData.value?.id
|
||||
? updateKnowledgeSegment(data)
|
||||
|
@ -66,7 +66,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<AiKnowledgeSegmentApi.KnowledgeSegmentVO>();
|
||||
const data = modalApi.getData<AiKnowledgeSegmentApi.KnowledgeSegment>();
|
||||
if (!data || !data.id) {
|
||||
await formApi.setValues(data);
|
||||
return;
|
||||
|
|
|
@ -27,7 +27,7 @@ function directGenerate(existPrompt: string) {
|
|||
isEnd.value = true;
|
||||
}
|
||||
/** 提交生成 */
|
||||
function submit(data: AiMindmapApi.AiMindMapGenerateReqVO) {
|
||||
function submit(data: AiMindmapApi.AiMindMapGenerateReq) {
|
||||
isGenerating.value = true;
|
||||
isStart.value = true;
|
||||
isEnd.value = false;
|
||||
|
|
|
@ -31,7 +31,7 @@ function onRefresh() {
|
|||
}
|
||||
|
||||
/** 删除 */
|
||||
async function handleDelete(row: AiMindmapApi.MindMapVO) {
|
||||
async function handleDelete(row: AiMindmapApi.MindMap) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.id]),
|
||||
key: 'action_key_msg',
|
||||
|
@ -73,9 +73,9 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<AiMindmapApi.MindMapVO>,
|
||||
} as VxeTableGridOptions<AiMindmapApi.MindMap>,
|
||||
});
|
||||
async function openPreview(row: AiMindmapApi.MindMapVO) {
|
||||
async function openPreview(row: AiMindmapApi.MindMap) {
|
||||
previewVisible.value = false;
|
||||
drawerApi.open();
|
||||
await nextTick();
|
||||
|
|
|
@ -29,12 +29,12 @@ function handleCreate() {
|
|||
}
|
||||
|
||||
/** 编辑 */
|
||||
function handleEdit(row: AiModelApiKeyApi.ApiKeyVO) {
|
||||
function handleEdit(row: AiModelApiKeyApi.ApiKey) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除 */
|
||||
async function handleDelete(row: AiModelApiKeyApi.ApiKeyVO) {
|
||||
async function handleDelete(row: AiModelApiKeyApi.ApiKey) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
key: 'action_key_msg',
|
||||
|
@ -77,7 +77,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<AiModelApiKeyApi.ApiKeyVO>,
|
||||
} as VxeTableGridOptions<AiModelApiKeyApi.ApiKey>,
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import { $t } from '#/locales';
|
|||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<AiModelApiKeyApi.ApiKeyVO>();
|
||||
const formData = ref<AiModelApiKeyApi.ApiKey>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['API 密钥'])
|
||||
|
@ -42,7 +42,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data = (await formApi.getValues()) as AiModelApiKeyApi.ApiKeyVO;
|
||||
const data = (await formApi.getValues()) as AiModelApiKeyApi.ApiKey;
|
||||
try {
|
||||
await (formData.value?.id ? updateApiKey(data) : createApiKey(data));
|
||||
// 关闭并提示
|
||||
|
@ -59,7 +59,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<AiModelApiKeyApi.ApiKeyVO>();
|
||||
const data = modalApi.getData<AiModelApiKeyApi.ApiKey>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -29,12 +29,12 @@ function handleCreate() {
|
|||
}
|
||||
|
||||
/** 编辑 */
|
||||
function handleEdit(row: AiModelChatRoleApi.ChatRoleVO) {
|
||||
function handleEdit(row: AiModelChatRoleApi.ChatRole) {
|
||||
formModalApi.setData({ formType: 'update', ...row }).open();
|
||||
}
|
||||
|
||||
/** 删除 */
|
||||
async function handleDelete(row: AiModelChatRoleApi.ChatRoleVO) {
|
||||
async function handleDelete(row: AiModelChatRoleApi.ChatRole) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
key: 'action_key_msg',
|
||||
|
@ -77,7 +77,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<AiModelChatRoleApi.ChatRoleVO>,
|
||||
} as VxeTableGridOptions<AiModelChatRoleApi.ChatRole>,
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import { $t } from '#/locales';
|
|||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<AiModelChatRoleApi.ChatRoleVO>();
|
||||
const formData = ref<AiModelChatRoleApi.ChatRole>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['聊天角色'])
|
||||
|
@ -47,7 +47,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data = (await formApi.getValues()) as AiModelChatRoleApi.ChatRoleVO;
|
||||
const data = (await formApi.getValues()) as AiModelChatRoleApi.ChatRole;
|
||||
try {
|
||||
await (formData.value?.id ? updateChatRole(data) : createChatRole(data));
|
||||
// 关闭并提示
|
||||
|
@ -64,7 +64,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<AiModelChatRoleApi.ChatRoleVO>();
|
||||
const data = modalApi.getData<AiModelChatRoleApi.ChatRole>();
|
||||
if (!data || !data.id) {
|
||||
await formApi.setValues(data);
|
||||
return;
|
||||
|
|
|
@ -17,7 +17,7 @@ import { $t } from '#/locales';
|
|||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import Form from './modules/form.vue';
|
||||
|
||||
const apiKeyList = ref([] as AiModelApiKeyApi.ApiKeyVO[]);
|
||||
const apiKeyList = ref([] as AiModelApiKeyApi.ApiKey[]);
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: Form,
|
||||
destroyOnClose: true,
|
||||
|
@ -34,12 +34,12 @@ function handleCreate() {
|
|||
}
|
||||
|
||||
/** 编辑 */
|
||||
function handleEdit(row: AiModelModelApi.ModelVO) {
|
||||
function handleEdit(row: AiModelModelApi.Model) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除 */
|
||||
async function handleDelete(row: AiModelModelApi.ModelVO) {
|
||||
async function handleDelete(row: AiModelModelApi.Model) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
key: 'action_key_msg',
|
||||
|
@ -82,7 +82,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<AiModelModelApi.ModelVO>,
|
||||
} as VxeTableGridOptions<AiModelModelApi.Model>,
|
||||
});
|
||||
onMounted(async () => {
|
||||
// 获得下拉数据
|
||||
|
|
|
@ -15,7 +15,7 @@ import { $t } from '#/locales';
|
|||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<AiModelModelApi.ModelVO>();
|
||||
const formData = ref<AiModelModelApi.Model>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['模型配置'])
|
||||
|
@ -43,7 +43,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data = (await formApi.getValues()) as AiModelModelApi.ModelVO;
|
||||
const data = (await formApi.getValues()) as AiModelModelApi.Model;
|
||||
try {
|
||||
await (formData.value?.id ? updateModel(data) : createModel(data));
|
||||
// 关闭并提示
|
||||
|
@ -60,7 +60,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<AiModelModelApi.ModelVO>();
|
||||
const data = modalApi.getData<AiModelModelApi.Model>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -29,12 +29,12 @@ function handleCreate() {
|
|||
}
|
||||
|
||||
/** 编辑 */
|
||||
function handleEdit(row: AiModelToolApi.ToolVO) {
|
||||
function handleEdit(row: AiModelToolApi.Tool) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除 */
|
||||
async function handleDelete(row: AiModelToolApi.ToolVO) {
|
||||
async function handleDelete(row: AiModelToolApi.Tool) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
key: 'action_key_msg',
|
||||
|
@ -77,7 +77,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<AiModelToolApi.ToolVO>,
|
||||
} as VxeTableGridOptions<AiModelToolApi.Tool>,
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import { $t } from '#/locales';
|
|||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<AiModelToolApi.ToolVO>();
|
||||
const formData = ref<AiModelToolApi.Tool>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['工具'])
|
||||
|
@ -42,7 +42,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data = (await formApi.getValues()) as AiModelToolApi.ToolVO;
|
||||
const data = (await formApi.getValues()) as AiModelToolApi.Tool;
|
||||
try {
|
||||
await (formData.value?.id ? updateTool(data) : createTool(data));
|
||||
// 关闭并提示
|
||||
|
@ -59,7 +59,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<AiModelToolApi.ToolVO>();
|
||||
const data = modalApi.getData<AiModelToolApi.Tool>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ function onRefresh() {
|
|||
}
|
||||
|
||||
/** 删除 */
|
||||
async function handleDelete(row: AiMusicApi.MusicVO) {
|
||||
async function handleDelete(row: AiMusicApi.Music) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.id]),
|
||||
key: 'action_key_msg',
|
||||
|
@ -41,7 +41,7 @@ async function handleDelete(row: AiMusicApi.MusicVO) {
|
|||
}
|
||||
}
|
||||
/** 修改是否发布 */
|
||||
const handleUpdatePublicStatusChange = async (row: AiMusicApi.MusicVO) => {
|
||||
const handleUpdatePublicStatusChange = async (row: AiMusicApi.Music) => {
|
||||
try {
|
||||
// 修改状态的二次确认
|
||||
const text = row.publicStatus ? '公开' : '私有';
|
||||
|
@ -82,7 +82,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<AiMusicApi.MusicVO>,
|
||||
} as VxeTableGridOptions<AiMusicApi.Music>,
|
||||
});
|
||||
onMounted(async () => {
|
||||
// 获得下拉数据
|
||||
|
|
|
@ -17,7 +17,7 @@ import {
|
|||
|
||||
import Tag from './Tag.vue';
|
||||
|
||||
type TabType = AiWriteApi.WriteVO['type'];
|
||||
type TabType = AiWriteApi.Write['type'];
|
||||
|
||||
defineProps<{
|
||||
isWriting: boolean;
|
||||
|
@ -26,7 +26,7 @@ defineProps<{
|
|||
const emit = defineEmits<{
|
||||
(e: 'example', param: 'reply' | 'write'): void;
|
||||
(e: 'reset'): void;
|
||||
(e: 'submit', params: Partial<AiWriteApi.WriteVO>): void;
|
||||
(e: 'submit', params: Partial<AiWriteApi.Write>): void;
|
||||
}>();
|
||||
|
||||
function omit(obj: Record<string, any>, keysToOmit: string[]) {
|
||||
|
@ -74,7 +74,7 @@ const [DefineLabel, ReuseLabel] = createReusableTemplate<{
|
|||
label: string;
|
||||
}>();
|
||||
|
||||
const initData: AiWriteApi.WriteVO = {
|
||||
const initData: AiWriteApi.Write = {
|
||||
type: 1,
|
||||
prompt: '',
|
||||
originalContent: '',
|
||||
|
@ -84,10 +84,10 @@ const initData: AiWriteApi.WriteVO = {
|
|||
format: 1,
|
||||
};
|
||||
|
||||
const formData = ref<AiWriteApi.WriteVO>({ ...initData });
|
||||
const formData = ref<AiWriteApi.Write>({ ...initData });
|
||||
|
||||
/** 用来记录切换之前所填写的数据,切换的时候给赋值回来 */
|
||||
const recordFormData = {} as Record<AiWriteTypeEnum, AiWriteApi.WriteVO>;
|
||||
const recordFormData = {} as Record<AiWriteTypeEnum, AiWriteApi.Write>;
|
||||
/** 切换tab */
|
||||
function switchTab(value: TabType) {
|
||||
if (value !== selectedTab.value) {
|
||||
|
|
|
@ -24,7 +24,7 @@ function stopStream() {
|
|||
/** 执行写作 */
|
||||
const rightRef = ref<InstanceType<typeof Right>>();
|
||||
|
||||
function submit(data: Partial<AiWriteApi.WriteVO>) {
|
||||
function submit(data: Partial<AiWriteApi.Write>) {
|
||||
abortController.value = new AbortController();
|
||||
writeResult.value = '';
|
||||
isWriting.value = true;
|
||||
|
|
|
@ -23,7 +23,7 @@ function onRefresh() {
|
|||
}
|
||||
|
||||
/** 删除 */
|
||||
async function handleDelete(row: AiWriteApi.AiWritePageReqVO) {
|
||||
async function handleDelete(row: AiWriteApi.AiWritePageReq) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.id]),
|
||||
key: 'action_key_msg',
|
||||
|
@ -65,7 +65,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<AiWriteApi.AiWritePageReqVO>,
|
||||
} as VxeTableGridOptions<AiWriteApi.AiWritePageReq>,
|
||||
});
|
||||
onMounted(async () => {
|
||||
// 获得下拉数据
|
||||
|
|
Loading…
Reference in New Issue