删除不再使用的数字人创作和模型配置相关文件,优化项目结构,提升代码可维护性。

This commit is contained in:
2026-05-13 16:00:52 +08:00
parent bd2195ee06
commit 812b11bb68
13 changed files with 16 additions and 608 deletions

View File

@@ -0,0 +1,327 @@
import request, { type RequestOptions } from '/@/utils/request';
export interface CreationListParams {
pageNum: number;
pageSize: number;
keyword?: string;
}
export interface NodeLibraryFormItem {
field: string;
label: string;
type: 'input' | 'number' | 'textarea' | 'switch' | string;
required: boolean;
default?: string | number | boolean;
}
export interface NodeLibraryModelConfig {
modelName: string;
modelForm: NodeLibraryFormItem[];
}
export interface NodeLibraryItem {
nodeCode: string;
nodeName: string;
modelType: number;
skillOption: boolean;
formConfig: NodeLibraryFormItem[];
modelConfig: NodeLibraryModelConfig[];
}
export interface NodeLibraryGroup {
group: string;
label: string;
items: NodeLibraryItem[];
}
export interface NodeLibraryListResponse {
code: number;
message: string;
data: {
groups: NodeLibraryGroup[];
};
}
export interface CreationImageItem {
name: string;
url: string;
}
export interface CreationTitleItem {
title: string;
htmlFileUrl: string;
imageUrls: CreationImageItem[] | null;
}
export interface CreationThemeItem {
theme: string;
titles: CreationTitleItem[];
}
export interface CreationContentTypeItem {
contentType: string;
themes: CreationThemeItem[];
}
export interface CreationTreeItem {
createdDate: string;
contentTypes: CreationContentTypeItem[];
}
// 新的执行列表数据结构
export interface ExecutionItem {
timestamp: string;
content: string;
label: string;
}
export interface ExecutionFlowItem {
flowName: string;
Id?: number | string;
sessionId?: string;
items: ExecutionItem[];
}
export interface ExecutionTreeItem {
createDate: string;
flows: ExecutionFlowItem[];
}
export interface CreationListData {
list: unknown[] | null;
total: number;
Tree: CreationTreeItem[];
imgAddressPrefix: string;
}
export interface ExecutionListData {
tree: ExecutionTreeItem[];
imgAddressPrefix: string;
}
export interface CreationListResponse {
code: number;
message: string;
data: CreationListData;
}
export interface ExecutionListResponse {
code: number;
message: string;
data: ExecutionListData;
}
export interface CreationSubmitParams {
mode: string;
content_type: string;
theme: string;
title: string;
description?: string;
style: string;
count: number;
image_per_post: number;
image_ratio: string;
}
export interface DownloadToFileParams {
fileURL: string;
}
export function getCreationList(params: CreationListParams, requestOptions?: RequestOptions) {
return request({
url: '/black-deacon/creation/info/list',
method: 'get',
params,
requestOptions,
}) as Promise<CreationListResponse>;
}
export function getExecutionList(requestOptions?: RequestOptions) {
return request({
url: '/ai-agent/flow/execution/list',
method: 'get',
requestOptions,
}) as Promise<ExecutionListResponse>;
}
export function getNodeLibraryList(requestOptions?: RequestOptions) {
return request({
url: '/ai-agent/node/library/list',
method: 'get',
requestOptions,
}) as Promise<NodeLibraryListResponse>;
}
export function createCreation(data: CreationSubmitParams, requestOptions?: RequestOptions) {
return request({
url: '/black-deacon/creation/info/creation',
method: 'post',
data,
timeout: 0,
requestOptions,
});
}
export function downloadToFile(data: DownloadToFileParams, requestOptions?: RequestOptions) {
return request({
url: '/oss/file/downloadToBrowser',
method: 'post',
data,
responseType: 'blob',
requestOptions,
});
}
export function saveWorkflow(data: { flowName: string; description: string; flowContent: any }, requestOptions?: RequestOptions) {
return request({
url: '/ai-agent/flow/user/create',
method: 'post',
data,
requestOptions,
});
}
export interface WorkflowItem {
id: string;
flowName?: string;
flowTemplateName?: string;
description: string;
flowContent: any;
nodeInputParams?: any[];
}
export interface WorkflowListResponse {
code: number;
message: string;
data: {
listFlowUserRes: {
list: WorkflowItem[];
total: number;
};
listFlowTemplateRes: {
list: WorkflowItem[];
total: number;
};
isAdmin?: boolean;
};
}
export function getWorkflowList(requestOptions?: RequestOptions) {
return request({
url: '/ai-agent/flow/user/list',
method: 'get',
requestOptions,
}) as Promise<WorkflowListResponse>;
}
export interface WorkflowDetailResponse {
code: number;
message: string;
data: WorkflowItem;
}
export function getWorkflowDetail(id: string, requestOptions?: RequestOptions) {
return request({
url: '/ai-agent/flow/user/get',
method: 'get',
params: { id },
requestOptions,
}) as Promise<WorkflowDetailResponse>;
}
export function getExecutionDetail(id: string, requestOptions?: RequestOptions) {
return request({
url: '/ai-agent/flow/execution/get',
method: 'get',
params: { id },
requestOptions,
}) as Promise<WorkflowDetailResponse>;
}
export function updateWorkflow(data: { id: string; flowName: string; description: string; flowContent: any }, requestOptions?: RequestOptions) {
return request({
url: '/ai-agent/flow/user/update',
method: 'put',
data,
requestOptions,
});
}
export function deleteWorkflow(id: string, requestOptions?: RequestOptions) {
return request({
url: '/ai-agent/flow/user/delete',
method: 'delete',
params: { id },
requestOptions,
});
}
// 执行工作流相关类型定义
export interface FlowNodeFormField {
default?: any;
field?: string;
label?: string;
options?: { label?: string; value?: string }[];
required?: boolean;
type?: string;
value?: string;
}
export interface FlowNodeInputSource {
field?: string[];
nodeId?: string;
quoteOutput?: boolean;
}
export interface FlowNodeModelItem {
modelApiKey?: string;
modelForm?: FlowNodeFormField[];
modelName?: string;
}
export interface FlowNode {
config?: { [key: string]: any };
formConfig?: FlowNodeFormField[];
id?: string;
inputSource?: FlowNodeInputSource[];
modelConfig?: FlowNodeModelItem;
name?: string;
nodeCode?: string;
outputResult?: FlowNodeFormField[];
skillName?: string;
}
export interface FlowEdge {
from?: string;
id?: string;
to?: string;
}
export interface FlowInfo {
edges?: FlowEdge[];
nodes?: FlowNode[];
startNodeId?: string;
version?: string;
}
export interface ExecuteFlowParams {
desc?: string;
fileUrl?: string[];
flowContent?: FlowInfo;
flowId?: string;
flowName?: string;
nodeInputParams?: FlowNode[];
sessionId?: string;
skillName?: string;
}
export function executeFlow(data: ExecuteFlowParams | FormData, requestOptions?: RequestOptions) {
return request({
url: '/ai-agent/flow/execution/execute',
method: 'post',
data,
headers: data instanceof FormData ? { 'Content-Type': 'multipart/form-data' } : undefined,
timeout: 0,
requestOptions,
});
}

View File

@@ -0,0 +1,236 @@
import request from '/@/utils/request';
export interface ModelModuleListParams {
pageNum?: number;
pageSize?: number;
modelName?: string;
modelType?: number | string;
}
export interface ModelFormItem {
field: string;
label: string;
required: boolean;
type: 'input' | 'number' | 'textarea' | 'switch' | string;
}
export interface ModelFormEntry {
key: string;
value: string;
}
/** 模型类型listType 接口项,字段名以后端为准,前端做兼容解析) */
export interface ModelTypeListItem {
id?: number | string;
typeId?: number | string;
modelType?: number | string;
name?: string;
typeName?: string;
label?: string;
}
/** listType 标准返回data.type 为 Record<id, 名称>,如 { "1": "推理模型", "2": "图片模型" } */
export function normalizeModelTypeOptions(res: { data?: unknown }): Array<{ id: number | string; label: string }> {
const data = res?.data as { type?: Record<string, string> } | undefined;
const typeMap = data?.type;
if (typeMap && typeof typeMap === 'object' && !Array.isArray(typeMap)) {
return Object.entries(typeMap)
.map(([key, label]) => {
const n = Number(key);
const id = Number.isNaN(n) ? key : n;
return { id, label: String(label ?? '') };
})
.sort((a, b) => {
const na = Number(a.id);
const nb = Number(b.id);
if (!Number.isNaN(na) && !Number.isNaN(nb)) {
return na - nb;
}
return String(a.id).localeCompare(String(b.id));
});
}
/** 兼容旧结构data 为数组或 data.list */
const raw = res?.data;
const arr: ModelTypeListItem[] = Array.isArray(raw) ? raw : ((raw as { list?: ModelTypeListItem[] })?.list ?? []);
return arr
.map((item) => {
const id = item.id ?? item.typeId ?? item.modelType;
const label = item.name ?? item.typeName ?? item.label ?? (id != null && id !== '' ? String(id) : '');
return { id: id as number | string, label: label || String(id) };
})
.filter((x) => x.id !== undefined && x.id !== null && x.id !== '');
}
export interface ModelModuleItem {
id: number | string;
tenantId?: number;
creator?: string;
createdAt?: string;
updater?: string;
updatedAt?: string;
deletedAt?: string | null;
isDeleted?: boolean;
modelName: string;
/** 模型类型 ID与 listType 返回项对应 */
modelType?: number | string;
baseUrl: string;
route?: string;
httpMethod: string;
apiKey?: string;
isPrivate?: number;
isChatModel?: number;
/** 会话开关状态列表接口返回0 关 1 开;会话开关接口就绪后生效) */
chatSessionEnabled?: number;
enabled: number;
maxConcurrency: number;
queueLimit: number;
timeoutMs?: number;
timeoutSeconds?: number;
expectedSeconds?: number;
retryTimes: number;
retryQueueMaxSeconds: number;
autoCleanSeconds: number;
remark?: string;
headMsg?: string;
form?: ModelFormEntry[] | Record<string, { value: string }>;
requestMapping?: Record<string, unknown>;
responseMapping?: Record<string, unknown>;
}
export interface ModelModuleListResponse {
code: number;
message: string;
data: {
list: ModelModuleItem[];
total: number;
};
}
export interface CreateModelParams {
modelName: string;
/** 与 listType 返回的类型 id 一致,可能为数字或字符串 */
modelType: number | string;
baseUrl: string;
httpMethod?: string;
headMsg?: string;
isPrivate: number;
enabled: number;
isChatModel: number;
apiKey?: string;
form: ModelFormEntry[];
requestMapping?: Record<string, unknown>;
responseMapping?: Record<string, unknown>;
maxConcurrency?: number;
queueLimit?: number;
timeoutSeconds: number;
expectedSeconds: number;
retryTimes?: number;
retryQueueMaxSeconds: number;
autoCleanSeconds: number;
remark?: string;
}
export interface ModelConfigTypeItem {
id: number | string;
name: string;
form: ModelFormItem[];
}
export interface ModelConfigGroup {
typeId: number;
type: string;
items: ModelConfigTypeItem[];
}
export interface ModelConfigResponse {
code: number;
message: string;
data: ModelConfigGroup[];
}
/**
* 获取模型列表
*/
export function getModelModuleList(params?: ModelModuleListParams) {
return request({
url: '/model-gateway/model/listModel',
method: 'get',
params,
});
}
/**
* 获取模型类型列表(用于下拉与列表回显)
*/
export function getModelTypeList() {
return request({
url: '/model-gateway/model/listType',
method: 'get',
});
}
/**
* 新增模型配置
*/
export function addModelModule(data: CreateModelParams) {
return request({
url: '/model-gateway/model/createModel',
method: 'post',
data,
});
}
/**
* 修改模型配置
*/
export function updateModelModule(data: Partial<CreateModelParams> & { id: number | string }) {
return request({
url: '/model-gateway/model/updateModel',
method: 'put',
data,
});
}
/**
* 删除模型配置
*/
export function deleteModelModule(id: number | string) {
return request({
url: '/model-gateway/model/deleteModel',
method: 'delete',
data: { id },
});
}
/**
* 获取单条模型配置详情(编辑用,需传 id
*/
export function getModelModuleDetail(id: number | string) {
return request({
url: '/model-gateway/model/getModel',
method: 'get',
params: { id },
});
}
/**
* 更新模型会话开关状态
*/
export function updateChatModel(data: { id: number | string; isChatModel: 0 | 1 }) {
return request({
url: '/model-gateway/model/updateChatModel',
method: 'post',
data,
});
}
/**
* 获取当前会话模型
*/
export function getIsChatModel() {
return request({
url: '/model-gateway/model/getIsChatModel',
method: 'get',
});
}

View File

@@ -0,0 +1,79 @@
import request from '/@/utils/request';
export interface ModelTypeListParams {
pageNum: number;
pageSize: number;
keyword?: string;
}
export interface ModelTypeItem {
id: string;
typeName: string;
typeCode: string;
description?: string;
status: number;
createTime?: string;
updateTime?: string;
}
export interface ModelTypeListResponse {
code: number;
message: string;
data: {
list: ModelTypeItem[];
total: number;
};
}
/**
* 获取模型类型列表
*/
export function getModelTypeList(params: ModelTypeListParams) {
return request({
url: '/api/ai-agent/model-config/model-type/list',
method: 'get',
params,
});
}
/**
* 新增模型类型
*/
export function addModelType(data: Partial<ModelTypeItem>) {
return request({
url: '/api/ai-agent/model-config/model-type/add',
method: 'post',
data,
});
}
/**
* 修改模型类型
*/
export function updateModelType(data: Partial<ModelTypeItem>) {
return request({
url: '/api/ai-agent/model-config/model-type/update',
method: 'put',
data,
});
}
/**
* 删除模型类型
*/
export function deleteModelType(id: string) {
return request({
url: `/api/ai-agent/model-config/model-type/delete/${id}`,
method: 'delete',
});
}
/**
* 获取模型类型详情
*/
export function getModelTypeDetail(id: string) {
return request({
url: `/api/ai-agent/model-config/model-type/detail/${id}`,
method: 'get',
});
}

View File

@@ -0,0 +1,152 @@
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 getUserSkilllistUser(params?: UserSkillListParams, config?: any) {
return request<SkillListResponse>({
url: '/ai-agent/skill/user/listUser',
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,
});
}
/**
* 获取 Skill 用户技能详情
*/
export function getUserSkillDetail(id: number, config?: any) {
return request<SkillItem>({
url: '/ai-agent/skill/user/get',
method: 'get',
params: { id },
...config,
});
}
/**
* 更新 Skill 用户技能
*/
export function updateUserSkill(data: CreateSkillParams & { id: number }, config?: any) {
return request({
url: '/ai-agent/skill/user/update',
method: 'put',
data,
...config,
});
}