feat: 更新数字人创作页面以支持技能选择功能
- 在节点库项中新增技能选择选项,允许用户为节点指定技能 - 更新API请求路径,统一为'/ai-agent'前缀 - 优化动态表单逻辑,确保根据节点类型正确显示技能选择器 - 移除冗余的文件上传函数,改为导入公共上传函数以简化代码结构
This commit is contained in:
32
src/api/common/upload.ts
Normal file
32
src/api/common/upload.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import request from '/@/utils/request';
|
||||
|
||||
// OSS 上传响应
|
||||
export interface OssUploadResponse {
|
||||
fileName: string;
|
||||
fileURL: string;
|
||||
fileSize: number;
|
||||
fileFormat: string;
|
||||
fileAddressPrefix: string;
|
||||
files: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共文件上传到 OSS
|
||||
* @param file 文件对象
|
||||
* @param config 请求配置
|
||||
* @returns 返回文件名、文件地址、文件大小等信息
|
||||
*/
|
||||
export function uploadFile(file: File, config?: any) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
|
||||
return request<OssUploadResponse>({
|
||||
url: '/oss/file/uploadFile',
|
||||
method: 'post',
|
||||
data: formData,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
...config,
|
||||
});
|
||||
}
|
||||
@@ -22,6 +22,7 @@ export interface NodeLibraryModelConfig {
|
||||
export interface NodeLibraryItem {
|
||||
nodeCode: string;
|
||||
nodeName: string;
|
||||
skillOption: boolean;
|
||||
formConfig: NodeLibraryFormItem[];
|
||||
modelConfig: NodeLibraryModelConfig[];
|
||||
}
|
||||
@@ -106,7 +107,7 @@ export function getCreationList(params: CreationListParams, requestOptions?: Req
|
||||
|
||||
export function getNodeLibraryList(requestOptions?: RequestOptions) {
|
||||
return request({
|
||||
url: '/black-deacon/node/library/list',
|
||||
url: '/ai-agent/node/library/list',
|
||||
method: 'get',
|
||||
requestOptions,
|
||||
}) as Promise<NodeLibraryListResponse>;
|
||||
@@ -134,7 +135,7 @@ export function downloadToFile(data: DownloadToFileParams, requestOptions?: Requ
|
||||
|
||||
export function saveWorkflow(data: { flowName: string; description: string; flowContent: any }, requestOptions?: RequestOptions) {
|
||||
return request({
|
||||
url: '/black-deacon/flow/user/create',
|
||||
url: '/ai-agent/flow/user/create',
|
||||
method: 'post',
|
||||
data,
|
||||
requestOptions,
|
||||
@@ -159,7 +160,7 @@ export interface WorkflowListResponse {
|
||||
|
||||
export function getWorkflowList(requestOptions?: RequestOptions) {
|
||||
return request({
|
||||
url: '/black-deacon/flow/user/list',
|
||||
url: '/ai-agent/flow/user/list',
|
||||
method: 'get',
|
||||
requestOptions,
|
||||
}) as Promise<WorkflowListResponse>;
|
||||
@@ -173,7 +174,7 @@ export interface WorkflowDetailResponse {
|
||||
|
||||
export function getWorkflowDetail(id: string, requestOptions?: RequestOptions) {
|
||||
return request({
|
||||
url: '/black-deacon/flow/user/get',
|
||||
url: '/ai-agent/flow/user/get',
|
||||
method: 'get',
|
||||
params: { id },
|
||||
requestOptions,
|
||||
@@ -182,7 +183,7 @@ export function getWorkflowDetail(id: string, requestOptions?: RequestOptions) {
|
||||
|
||||
export function updateWorkflow(data: { id: string; flowName: string; description: string; flowContent: any }, requestOptions?: RequestOptions) {
|
||||
return request({
|
||||
url: '/black-deacon/flow/user/update',
|
||||
url: '/ai-agent/flow/user/update',
|
||||
method: 'put',
|
||||
data,
|
||||
requestOptions,
|
||||
@@ -191,7 +192,7 @@ export function updateWorkflow(data: { id: string; flowName: string; description
|
||||
|
||||
export function deleteWorkflow(id: string, requestOptions?: RequestOptions) {
|
||||
return request({
|
||||
url: '/black-deacon/flow/user/delete',
|
||||
url: '/ai-agent/flow/user/delete',
|
||||
method: 'delete',
|
||||
params: { id },
|
||||
requestOptions,
|
||||
|
||||
@@ -30,7 +30,7 @@ export interface ModelTypeListResponse {
|
||||
*/
|
||||
export function getModelTypeList(params: ModelTypeListParams) {
|
||||
return request({
|
||||
url: '/api/digital-human/model-config/model-type/list',
|
||||
url: '/api/ai-agent/model-config/model-type/list',
|
||||
method: 'get',
|
||||
params,
|
||||
});
|
||||
@@ -41,7 +41,7 @@ export function getModelTypeList(params: ModelTypeListParams) {
|
||||
*/
|
||||
export function addModelType(data: Partial<ModelTypeItem>) {
|
||||
return request({
|
||||
url: '/api/digital-human/model-config/model-type/add',
|
||||
url: '/api/ai-agent/model-config/model-type/add',
|
||||
method: 'post',
|
||||
data,
|
||||
});
|
||||
@@ -52,7 +52,7 @@ export function addModelType(data: Partial<ModelTypeItem>) {
|
||||
*/
|
||||
export function updateModelType(data: Partial<ModelTypeItem>) {
|
||||
return request({
|
||||
url: '/api/digital-human/model-config/model-type/update',
|
||||
url: '/api/ai-agent/model-config/model-type/update',
|
||||
method: 'put',
|
||||
data,
|
||||
});
|
||||
@@ -63,7 +63,7 @@ export function updateModelType(data: Partial<ModelTypeItem>) {
|
||||
*/
|
||||
export function deleteModelType(id: string) {
|
||||
return request({
|
||||
url: `/api/digital-human/model-config/model-type/delete/${id}`,
|
||||
url: `/api/ai-agent/model-config/model-type/delete/${id}`,
|
||||
method: 'delete',
|
||||
});
|
||||
}
|
||||
@@ -73,7 +73,7 @@ export function deleteModelType(id: string) {
|
||||
*/
|
||||
export function getModelTypeDetail(id: string) {
|
||||
return request({
|
||||
url: `/api/digital-human/model-config/model-type/detail/${id}`,
|
||||
url: `/api/ai-agent/model-config/model-type/detail/${id}`,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
117
src/api/digitalHuman/skill/index.ts
Normal file
117
src/api/digitalHuman/skill/index.ts
Normal file
@@ -0,0 +1,117 @@
|
||||
import request from '/@/utils/request';
|
||||
|
||||
// Skill 技能项
|
||||
export interface SkillItem {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
category: string;
|
||||
fileName: string;
|
||||
fileUrl: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
// Skill 列表响应
|
||||
export interface SkillListResponse {
|
||||
list: SkillItem[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
// 创建 Skill 参数
|
||||
export interface CreateSkillParams {
|
||||
name?: string;
|
||||
description?: string;
|
||||
category?: string;
|
||||
fileName?: string;
|
||||
fileUrl?: string;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
// 系统技能列表查询参数
|
||||
export interface SkillListParams {
|
||||
pageNum?: number;
|
||||
pageSize?: number;
|
||||
keyword?: string;
|
||||
Total?: number;
|
||||
}
|
||||
|
||||
// 用户技能列表查询参数
|
||||
export interface UserSkillListParams {
|
||||
pageNum?: number;
|
||||
pageSize?: number;
|
||||
keyword?: string;
|
||||
Total?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 Skill 系统技能列表
|
||||
*/
|
||||
export function getSkillList(params?: SkillListParams, config?: any) {
|
||||
return request<SkillListResponse>({
|
||||
url: '/ai-agent/skill/template/list',
|
||||
method: 'get',
|
||||
params,
|
||||
...config,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建 Skill 系统技能
|
||||
*/
|
||||
export function createSkill(data: CreateSkillParams, config?: any) {
|
||||
return request({
|
||||
url: '/ai-agent/skill/template/create',
|
||||
method: 'post',
|
||||
data,
|
||||
...config,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除 Skill 系统技能
|
||||
*/
|
||||
export function deleteSkill(id: number, config?: any) {
|
||||
return request({
|
||||
url: '/ai-agent/skill/template/delete',
|
||||
method: 'delete',
|
||||
data: { id },
|
||||
...config,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 Skill 用户技能列表
|
||||
*/
|
||||
export function getUserSkillList(params?: UserSkillListParams, config?: any) {
|
||||
return request<SkillListResponse>({
|
||||
url: '/ai-agent/skill/user/list',
|
||||
method: 'get',
|
||||
params,
|
||||
...config,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建 Skill 用户技能
|
||||
*/
|
||||
export function createUserSkill(data: CreateSkillParams, config?: any) {
|
||||
return request({
|
||||
url: '/ai-agent/skill/user/create',
|
||||
method: 'post',
|
||||
data,
|
||||
...config,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除 Skill 用户技能
|
||||
*/
|
||||
export function deleteUserSkill(id: number, config?: any) {
|
||||
return request({
|
||||
url: '/ai-agent/skill/user/delete',
|
||||
method: 'delete',
|
||||
data: { id },
|
||||
...config,
|
||||
});
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
import request from '/@/utils/request';
|
||||
import { uploadFile } from '/@/api/common/upload';
|
||||
|
||||
// 导出公共上传函数供其他模块使用
|
||||
export { uploadFile };
|
||||
|
||||
// 文档查询参数
|
||||
export interface DocumentQueryParams {
|
||||
@@ -114,18 +118,6 @@ export function updateDocument(data: UpdateDocumentParams) {
|
||||
});
|
||||
}
|
||||
|
||||
// 公共文件上传(OSS),返回文件路径
|
||||
export function uploadFile(file: File) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
return request({
|
||||
url: '/oss/file/uploadFile',
|
||||
method: 'post',
|
||||
data: formData,
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
});
|
||||
}
|
||||
|
||||
// 上传文档
|
||||
export function uploadDocument(data: FormData) {
|
||||
return request({
|
||||
|
||||
Reference in New Issue
Block a user