mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +00:00
@@ -2,6 +2,7 @@ import { OperationLogEventEnum } from '@fastgpt/global/support/operationLog/cons
|
||||
import { i18nT } from '../../../web/i18n/utils';
|
||||
|
||||
export const operationLogMap = {
|
||||
//Team
|
||||
[OperationLogEventEnum.LOGIN]: {
|
||||
content: i18nT('account_team:log_login'),
|
||||
typeLabel: i18nT('account_team:login'),
|
||||
@@ -66,6 +67,309 @@ export const operationLogMap = {
|
||||
content: i18nT('account_team:log_assign_permission'),
|
||||
typeLabel: i18nT('account_team:assign_permission'),
|
||||
params: {} as { name?: string; objectName: string; permission: string }
|
||||
},
|
||||
//APP
|
||||
[OperationLogEventEnum.CREATE_APP]: {
|
||||
content: i18nT('account_team:log_create_app'),
|
||||
typeLabel: i18nT('account_team:create_app'),
|
||||
params: {} as { name?: string; appName: string; appType: string }
|
||||
},
|
||||
[OperationLogEventEnum.UPDATE_APP_INFO]: {
|
||||
content: i18nT('account_team:log_update_app_info'),
|
||||
typeLabel: i18nT('account_team:update_app_info'),
|
||||
params: {} as {
|
||||
name?: string;
|
||||
appName: string;
|
||||
newItemNames: string[];
|
||||
newItemValues: string[];
|
||||
appType: string;
|
||||
}
|
||||
},
|
||||
[OperationLogEventEnum.MOVE_APP]: {
|
||||
content: i18nT('account_team:log_move_app'),
|
||||
typeLabel: i18nT('account_team:move_app'),
|
||||
params: {} as { name?: string; appName: string; targetFolderName: string; appType: string }
|
||||
},
|
||||
[OperationLogEventEnum.DELETE_APP]: {
|
||||
content: i18nT('account_team:log_delete_app'),
|
||||
typeLabel: i18nT('account_team:delete_app'),
|
||||
params: {} as { name?: string; appName: string; appType: string }
|
||||
},
|
||||
[OperationLogEventEnum.UPDATE_APP_COLLABORATOR]: {
|
||||
content: i18nT('account_team:log_update_app_collaborator'),
|
||||
typeLabel: i18nT('account_team:update_app_collaborator'),
|
||||
params: {} as {
|
||||
name?: string;
|
||||
appName: string;
|
||||
appType: string;
|
||||
tmbList: string[];
|
||||
groupList: string[];
|
||||
orgList: string[];
|
||||
permission: string;
|
||||
}
|
||||
},
|
||||
[OperationLogEventEnum.DELETE_APP_COLLABORATOR]: {
|
||||
content: i18nT('account_team:log_delete_app_collaborator'),
|
||||
typeLabel: i18nT('account_team:delete_app_collaborator'),
|
||||
params: {} as {
|
||||
name?: string;
|
||||
appName: string;
|
||||
appType: string;
|
||||
itemName: string;
|
||||
itemValueName: string;
|
||||
}
|
||||
},
|
||||
[OperationLogEventEnum.TRANSFER_APP_OWNERSHIP]: {
|
||||
content: i18nT('account_team:log_transfer_app_ownership'),
|
||||
typeLabel: i18nT('account_team:transfer_app_ownership'),
|
||||
params: {} as {
|
||||
name?: string;
|
||||
appName: string;
|
||||
appType: string;
|
||||
oldOwnerName: string;
|
||||
newOwnerName: string;
|
||||
}
|
||||
},
|
||||
[OperationLogEventEnum.CREATE_APP_COPY]: {
|
||||
content: i18nT('account_team:log_create_app_copy'),
|
||||
typeLabel: i18nT('account_team:create_app_copy'),
|
||||
params: {} as { name?: string; appName: string; appType: string }
|
||||
},
|
||||
[OperationLogEventEnum.CREATE_APP_FOLDER]: {
|
||||
content: i18nT('account_team:log_create_app_folder'),
|
||||
typeLabel: i18nT('account_team:create_app_folder'),
|
||||
params: {} as { name?: string; folderName: string }
|
||||
},
|
||||
[OperationLogEventEnum.UPDATE_PUBLISH_APP]: {
|
||||
content: i18nT('account_team:log_update_publish_app'),
|
||||
typeLabel: i18nT('account_team:update_publish_app'),
|
||||
params: {} as {
|
||||
name?: string;
|
||||
operationName: string;
|
||||
appName: string;
|
||||
appId: string;
|
||||
appType: string;
|
||||
}
|
||||
},
|
||||
[OperationLogEventEnum.CREATE_APP_PUBLISH_CHANNEL]: {
|
||||
content: i18nT('account_team:log_create_app_publish_channel'),
|
||||
typeLabel: i18nT('account_team:create_app_publish_channel'),
|
||||
params: {} as { name?: string; appName: string; channelName: string; appType: string }
|
||||
},
|
||||
[OperationLogEventEnum.UPDATE_APP_PUBLISH_CHANNEL]: {
|
||||
content: i18nT('account_team:log_update_app_publish_channel'),
|
||||
typeLabel: i18nT('account_team:update_app_publish_channel'),
|
||||
params: {} as { name?: string; appName: string; channelName: string; appType: string }
|
||||
},
|
||||
[OperationLogEventEnum.DELETE_APP_PUBLISH_CHANNEL]: {
|
||||
content: i18nT('account_team:log_delete_app_publish_channel'),
|
||||
typeLabel: i18nT('account_team:delete_app_publish_channel'),
|
||||
params: {} as { name?: string; appName: string; channelName: string; appType: string }
|
||||
},
|
||||
[OperationLogEventEnum.EXPORT_APP_CHAT_LOG]: {
|
||||
content: i18nT('account_team:log_export_app_chat_log'),
|
||||
typeLabel: i18nT('account_team:export_app_chat_log'),
|
||||
params: {} as { name?: string; appName: string; appType: string }
|
||||
},
|
||||
//Dataset
|
||||
[OperationLogEventEnum.CREATE_DATASET]: {
|
||||
content: i18nT('account_team:log_create_dataset'),
|
||||
typeLabel: i18nT('account_team:create_dataset'),
|
||||
params: {} as { name?: string; datasetName: string; datasetType: string }
|
||||
},
|
||||
[OperationLogEventEnum.UPDATE_DATASET]: {
|
||||
content: i18nT('account_team:log_update_dataset'),
|
||||
typeLabel: i18nT('account_team:update_dataset'),
|
||||
params: {} as { name?: string; datasetName: string; datasetType: string }
|
||||
},
|
||||
[OperationLogEventEnum.DELETE_DATASET]: {
|
||||
content: i18nT('account_team:log_delete_dataset'),
|
||||
typeLabel: i18nT('account_team:delete_dataset'),
|
||||
params: {} as { name?: string; datasetName: string; datasetType: string }
|
||||
},
|
||||
[OperationLogEventEnum.MOVE_DATASET]: {
|
||||
content: i18nT('account_team:log_move_dataset'),
|
||||
typeLabel: i18nT('account_team:move_dataset'),
|
||||
params: {} as {
|
||||
name?: string;
|
||||
datasetName: string;
|
||||
targetFolderName: string;
|
||||
datasetType: string;
|
||||
}
|
||||
},
|
||||
[OperationLogEventEnum.UPDATE_DATASET_COLLABORATOR]: {
|
||||
content: i18nT('account_team:log_update_dataset_collaborator'),
|
||||
typeLabel: i18nT('account_team:update_dataset_collaborator'),
|
||||
params: {} as {
|
||||
name?: string;
|
||||
datasetName: string;
|
||||
datasetType: string;
|
||||
tmbList: string[];
|
||||
groupList: string[];
|
||||
orgList: string[];
|
||||
permission: string;
|
||||
}
|
||||
},
|
||||
[OperationLogEventEnum.DELETE_DATASET_COLLABORATOR]: {
|
||||
content: i18nT('account_team:log_delete_dataset_collaborator'),
|
||||
typeLabel: i18nT('account_team:delete_dataset_collaborator'),
|
||||
params: {} as {
|
||||
name?: string;
|
||||
datasetName: string;
|
||||
datasetType: string;
|
||||
itemName: string;
|
||||
itemValueName: string;
|
||||
}
|
||||
},
|
||||
[OperationLogEventEnum.TRANSFER_DATASET_OWNERSHIP]: {
|
||||
content: i18nT('account_team:log_transfer_dataset_ownership'),
|
||||
typeLabel: i18nT('account_team:transfer_dataset_ownership'),
|
||||
params: {} as {
|
||||
name?: string;
|
||||
datasetName: string;
|
||||
datasetType: string;
|
||||
oldOwnerName: string;
|
||||
newOwnerName: string;
|
||||
}
|
||||
},
|
||||
[OperationLogEventEnum.EXPORT_DATASET]: {
|
||||
content: i18nT('account_team:log_export_dataset'),
|
||||
typeLabel: i18nT('account_team:export_dataset'),
|
||||
params: {} as { name?: string; datasetName: string; datasetType: string }
|
||||
},
|
||||
[OperationLogEventEnum.CREATE_DATASET_FOLDER]: {
|
||||
content: i18nT('account_team:log_create_dataset_folder'),
|
||||
typeLabel: i18nT('account_team:create_dataset_folder'),
|
||||
params: {} as { name?: string; folderName: string }
|
||||
},
|
||||
//Collection
|
||||
[OperationLogEventEnum.CREATE_COLLECTION]: {
|
||||
content: i18nT('account_team:log_create_collection'),
|
||||
typeLabel: i18nT('account_team:create_collection'),
|
||||
params: {} as {
|
||||
name?: string;
|
||||
collectionName: string;
|
||||
datasetName: string;
|
||||
datasetType: string;
|
||||
}
|
||||
},
|
||||
[OperationLogEventEnum.UPDATE_COLLECTION]: {
|
||||
content: i18nT('account_team:log_update_collection'),
|
||||
typeLabel: i18nT('account_team:update_collection'),
|
||||
params: {} as {
|
||||
name?: string;
|
||||
collectionName: string;
|
||||
datasetName: string;
|
||||
datasetType: string;
|
||||
}
|
||||
},
|
||||
[OperationLogEventEnum.DELETE_COLLECTION]: {
|
||||
content: i18nT('account_team:log_delete_collection'),
|
||||
typeLabel: i18nT('account_team:delete_collection'),
|
||||
params: {} as {
|
||||
name?: string;
|
||||
collectionName: string;
|
||||
datasetName: string;
|
||||
datasetType: string;
|
||||
}
|
||||
},
|
||||
[OperationLogEventEnum.RETRAIN_COLLECTION]: {
|
||||
content: i18nT('account_team:log_retrain_collection'),
|
||||
typeLabel: i18nT('account_team:retrain_collection'),
|
||||
params: {} as {
|
||||
name?: string;
|
||||
collectionName: string;
|
||||
datasetName: string;
|
||||
datasetType: string;
|
||||
}
|
||||
},
|
||||
//Data
|
||||
[OperationLogEventEnum.CREATE_DATA]: {
|
||||
content: i18nT('account_team:log_create_data'),
|
||||
typeLabel: i18nT('account_team:create_data'),
|
||||
params: {} as {
|
||||
name?: string;
|
||||
collectionName: string;
|
||||
datasetName: string;
|
||||
datasetType: string;
|
||||
}
|
||||
},
|
||||
[OperationLogEventEnum.UPDATE_DATA]: {
|
||||
content: i18nT('account_team:log_update_data'),
|
||||
typeLabel: i18nT('account_team:update_data'),
|
||||
params: {} as {
|
||||
name?: string;
|
||||
collectionName: string;
|
||||
datasetName: string;
|
||||
datasetType: string;
|
||||
}
|
||||
},
|
||||
[OperationLogEventEnum.DELETE_DATA]: {
|
||||
content: i18nT('account_team:log_delete_data'),
|
||||
typeLabel: i18nT('account_team:delete_data'),
|
||||
params: {} as {
|
||||
name?: string;
|
||||
collectionName: string;
|
||||
datasetName: string;
|
||||
datasetType: string;
|
||||
}
|
||||
},
|
||||
//SearchTest
|
||||
[OperationLogEventEnum.SEARCH_TEST]: {
|
||||
content: i18nT('account_team:log_search_test'),
|
||||
typeLabel: i18nT('account_team:search_test'),
|
||||
params: {} as { name?: string; datasetName: string; datasetType: string }
|
||||
},
|
||||
//Account
|
||||
[OperationLogEventEnum.CHANGE_PASSWORD]: {
|
||||
content: i18nT('account_team:log_change_password'),
|
||||
typeLabel: i18nT('account_team:change_password'),
|
||||
params: {} as { name?: string }
|
||||
},
|
||||
[OperationLogEventEnum.CHANGE_NOTIFICATION_SETTINGS]: {
|
||||
content: i18nT('account_team:log_change_notification_settings'),
|
||||
typeLabel: i18nT('account_team:change_notification_settings'),
|
||||
params: {} as { name?: string }
|
||||
},
|
||||
[OperationLogEventEnum.CHANGE_MEMBER_NAME_ACCOUNT]: {
|
||||
content: i18nT('account_team:log_change_member_name_self'),
|
||||
typeLabel: i18nT('account_team:change_member_name_self'),
|
||||
params: {} as { name?: string; oldName: string; newName: string }
|
||||
},
|
||||
[OperationLogEventEnum.PURCHASE_PLAN]: {
|
||||
content: i18nT('account_team:log_purchase_plan'),
|
||||
typeLabel: i18nT('account_team:purchase_plan'),
|
||||
params: {} as { name?: string }
|
||||
},
|
||||
[OperationLogEventEnum.EXPORT_BILL_RECORDS]: {
|
||||
content: i18nT('account_team:log_export_bill_records'),
|
||||
typeLabel: i18nT('account_team:export_bill_records'),
|
||||
params: {} as { name?: string }
|
||||
},
|
||||
[OperationLogEventEnum.CREATE_INVOICE]: {
|
||||
content: i18nT('account_team:log_create_invoice'),
|
||||
typeLabel: i18nT('account_team:create_invoice'),
|
||||
params: {} as { name?: string }
|
||||
},
|
||||
[OperationLogEventEnum.SET_INVOICE_HEADER]: {
|
||||
content: i18nT('account_team:log_set_invoice_header'),
|
||||
typeLabel: i18nT('account_team:set_invoice_header'),
|
||||
params: {} as { name?: string }
|
||||
},
|
||||
[OperationLogEventEnum.CREATE_API_KEY]: {
|
||||
content: i18nT('account_team:log_create_api_key'),
|
||||
typeLabel: i18nT('account_team:create_api_key'),
|
||||
params: {} as { name?: string; keyName: string }
|
||||
},
|
||||
[OperationLogEventEnum.UPDATE_API_KEY]: {
|
||||
content: i18nT('account_team:log_update_api_key'),
|
||||
typeLabel: i18nT('account_team:update_api_key'),
|
||||
params: {} as { name?: string; keyName: string }
|
||||
},
|
||||
[OperationLogEventEnum.DELETE_API_KEY]: {
|
||||
content: i18nT('account_team:log_delete_api_key'),
|
||||
typeLabel: i18nT('account_team:delete_api_key'),
|
||||
params: {} as { name?: string; keyName: string }
|
||||
}
|
||||
} as const;
|
||||
|
||||
|
36
packages/service/support/operationLog/util.ts
Normal file
36
packages/service/support/operationLog/util.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
|
||||
import { DatasetTypeEnum } from '@fastgpt/global/core/dataset/constants';
|
||||
import { i18nT } from '../../../web/i18n/utils';
|
||||
|
||||
export function getI18nAppType(type: AppTypeEnum): string {
|
||||
if (type === AppTypeEnum.folder) return i18nT('account_team:type.Folder');
|
||||
if (type === AppTypeEnum.simple) return i18nT('account_team:type.Simple bot');
|
||||
if (type === AppTypeEnum.workflow) return i18nT('account_team:type.Workflow bot');
|
||||
if (type === AppTypeEnum.plugin) return i18nT('account_team:type.Plugin');
|
||||
if (type === AppTypeEnum.httpPlugin) return i18nT('account_team:type.Http plugin');
|
||||
if (type === AppTypeEnum.toolSet) return i18nT('account_team:type.Tool set');
|
||||
if (type === AppTypeEnum.tool) return i18nT('account_team:type.Tool');
|
||||
return i18nT('common:UnKnow');
|
||||
}
|
||||
|
||||
export function getI18nCollaboratorItemType(
|
||||
tmbId: string | undefined,
|
||||
groupId: string | undefined,
|
||||
orgId: string | undefined
|
||||
): string {
|
||||
if (tmbId) return i18nT('account_team:member');
|
||||
if (groupId) return i18nT('account_team:group');
|
||||
if (orgId) return i18nT('account_team:department');
|
||||
return i18nT('common:UnKnow');
|
||||
}
|
||||
|
||||
export function getI18nDatasetType(type: DatasetTypeEnum | string): string {
|
||||
if (type === DatasetTypeEnum.folder) return i18nT('account_team:dataset.folder_dataset');
|
||||
if (type === DatasetTypeEnum.dataset) return i18nT('account_team:dataset.common_dataset');
|
||||
if (type === DatasetTypeEnum.websiteDataset) return i18nT('account_team:dataset.website_dataset');
|
||||
if (type === DatasetTypeEnum.externalFile) return i18nT('account_team:dataset.external_file');
|
||||
if (type === DatasetTypeEnum.apiDataset) return i18nT('account_team:dataset.api_file');
|
||||
if (type === DatasetTypeEnum.feishu) return i18nT('account_team:dataset.feishu_dataset');
|
||||
if (type === DatasetTypeEnum.yuque) return i18nT('account_team:dataset.yuque_dataset');
|
||||
return i18nT('common:UnKnow');
|
||||
}
|
Reference in New Issue
Block a user