chore: replace all cn comments of fe to en version by volc api (#320)

This commit is contained in:
tecvan
2025-07-31 10:32:15 +08:00
committed by GitHub
parent 716ec0cba8
commit 71f6245a01
2960 changed files with 15545 additions and 15545 deletions

View File

@@ -19,7 +19,7 @@ import { I18n } from '@coze-arch/i18n';
import { WORKFLOW_LIST_STATUS_ALL } from '@/workflow-modal/type';
/** 流程所有者选项, 全部/我的 */
/** Process Owner Options, All/Mine */
export const scopeOptions = [
{
label: I18n.t('workflow_list_scope_all'),
@@ -31,7 +31,7 @@ export const scopeOptions = [
},
];
/** 流程状态选项, 全部/已发布/未发布 */
/** Process Status Options, All/Published/Unpublished */
export const statusOptions = [
{
label: I18n.t('workflow_list_status_all'),
@@ -47,7 +47,7 @@ export const statusOptions = [
},
];
/** 流程排序选项, 创建时间/更新时间 */
/** Process sorting options, creation time/update time */
export const sortOptions = [
{
label: I18n.t('workflow_list_sort_create_time'),

View File

@@ -98,7 +98,7 @@ export const WorkflowBotButton: FC<WorkflowBotButtonProps> = ({
}
}
// 如果已添加,展示已添加按钮
// If added, display the Added button
if (isAdded) {
return (
<Popconfirm
@@ -117,8 +117,8 @@ export const WorkflowBotButton: FC<WorkflowBotButtonProps> = ({
</Popconfirm>
);
}
// 未添加,判断发布状态
// 未发布,展示下面的按钮
// Not added, judge the release status
// Unpublished, show the button below
if (!canAdd) {
let key: I18nKeysNoOptionsType = 'workflow_add_not_allow_before_publish';
if (isFromWorkflow) {
@@ -143,7 +143,7 @@ export const WorkflowBotButton: FC<WorkflowBotButtonProps> = ({
</Tooltip>
);
}
// 已发布并且未添加,展示添加按钮
// Published and not added, show the add button
if (!isAdded) {
return (
<LoadingButton

View File

@@ -36,7 +36,7 @@ export const DeleteButton = ({
};
const handleDelete = () =>
// 使用 promise 让按钮出现 loading 的效果,参见
// Use promises to make the button appear loading, see
// https://semi.design/zh-CN/feedback/popconfirm
new Promise((resolve, reject) => {
onDelete?.()
@@ -45,7 +45,7 @@ export const DeleteButton = ({
resolve(true);
})
.catch(error => {
// 处理错误
// Handle errors
logger.error({
error: error as Error,
eventName: 'delete workflow error',

View File

@@ -120,7 +120,7 @@ export const WorkflowCard: FC<WorkflowCardProps> = props => {
: undefined;
const renderStatusValue = () => {
// 添加项目里的工作流节点、官方示例不展示发布状态
// Add workflow nodes in the project, official examples do not show release status
if (
isSelectProjectCategory(context?.modalState) ||
workflowCategory === WorkflowCategory.Example
@@ -138,7 +138,7 @@ export const WorkflowCard: FC<WorkflowCardProps> = props => {
return null;
};
const renderBottomLeftDesc = () => {
// 商品底部
// bottom of the product
if (!isTypeWorkflow(data)) {
const timeRender = `${I18n.t('workflow_add_list_updated')} ${formatTime(
data.meta_info.listed_at,
@@ -175,7 +175,7 @@ export const WorkflowCard: FC<WorkflowCardProps> = props => {
);
}
// 用户创建的,展示修改时间
// User-created, showing modification time
if (isSpaceWorkflow || workflowCategory === WorkflowCategory.Example) {
const showCreator =
(creator !== MineActiveEnum.Mine && isTeam) ||
@@ -214,7 +214,7 @@ export const WorkflowCard: FC<WorkflowCardProps> = props => {
);
}
// 官方模板,展示创作者
// Official template, showcasing creators
if (!isSpaceWorkflow) {
return (
<div className={styles.creator}>

View File

@@ -148,7 +148,7 @@ export const WorkflowParameters: FC<WorkflowParametersProps> = ({
return context?.modalState.dataSourceType === DataSourceType.Workflow;
}
const getParameters = (): Array<WorkflowParameterItem> => {
// 这么拆分虽然有点冗余, 但是可以正确进行类型推导
// Although this split is a bit redundant, it allows for correct type derivation
if (isTypeWorkflow(data)) {
return (
data.start_node?.node_param?.input_parameters?.map(item => {

View File

@@ -97,7 +97,7 @@ const WorkflowModalContent: FC<WorkFlowModalModeProps> = props => {
pageSize: 10,
enabled: context?.modalState.dataSourceType === DataSourceType.Product,
});
// 转换筛选参数
// conversion filter parameters
useEffect(() => {
if (!context) {
return;
@@ -127,7 +127,7 @@ const WorkflowModalContent: FC<WorkFlowModalModeProps> = props => {
let status: WorkflowModalState['status'] | undefined = undefined;
if (modalState.isSpaceWorkflow) {
status =
// isAddProjectWorkflow:项目里添加子工作流,没有发布状态概念,筛选状态传 undefined
// isAddProjectWorkflow: Add sub-workflow to the project, no release state concept, filter state pass undefined
modalState.status === WORKFLOW_LIST_STATUS_ALL || isAddProjectWorkflow
? undefined
: modalState.status;
@@ -188,7 +188,7 @@ const WorkflowModalContent: FC<WorkFlowModalModeProps> = props => {
})),
);
// 子流程节点 map例如 { 'workflowId': [node1, node2, ...] }
// Subprocess node map, e.g. {'workflowId': [node1, node2,...]}
const workflowNodesMap = useMemo(() => {
const subFlowNodes = nodes.filter(
v => v.type === StandardNodeType.SubWorkflow,
@@ -209,28 +209,28 @@ const WorkflowModalContent: FC<WorkFlowModalModeProps> = props => {
);
}, [excludedWorkflowIds, workflowList]);
/** scrollcontainer */
/** Scroll container */
const scrollContainerRef = useRef<HTMLDivElement | null>(null);
/** 监听触底的observer */
/** Monitor the bottom observer */
const intersectionObserverDom = useRef<HTMLDivElement>(null);
// 是否触底
// Is it bottoming out?
const [inViewPort] = useInViewport(intersectionObserverDom, {
root: () => scrollContainerRef.current,
threshold: 0.8,
});
// 首次effect不执行这个是切换状态的effect
// The first effect is not executed, this is the effect of switching the state
useUpdateEffect(() => {
// 当筛选项改变时,回到顶部
// When the filter item changes, return to the top
if (scrollContainerRef.current) {
scrollContainerRef.current.scrollTo({
top: 0,
});
}
// 只要是query中非page改变就执行此effect
// Perform this effect whenever a non-page change is made in the query
}, [context?.modalState]);
// 获取下一页逻辑
// Get next page logic
useEffect(() => {
if (!inViewPort) {
return;
@@ -339,7 +339,7 @@ const WorkflowModalContent: FC<WorkFlowModalModeProps> = props => {
wrapperClassName={s.spin}
style={{ height: '100%', width: '100%' }}
>
{/* Workflow as agent 支持添加带自定义入参的对话流 */}
{/* Workflow as agent support for adding dialog flows with custom imported parameters */}
{/* {isAgentWorkflow ? (
<div className="coz-mg-hglt px-[36px] py-[8px] mx-[24px] my-[0] rounded-[8px]">
{I18n.t('wf_chatflow_133')}
@@ -349,7 +349,7 @@ const WorkflowModalContent: FC<WorkFlowModalModeProps> = props => {
className={`${s['workflow-content']} new-workflow-modal-content`}
ref={scrollContainerRef}
>
{/* 内容渲染 */}
{/* content rendering */}
{targetLoadingStatus !== 'pending' && targetList.length > 0 && (
<UICompositionModalMain.Content
style={{
@@ -357,7 +357,7 @@ const WorkflowModalContent: FC<WorkFlowModalModeProps> = props => {
paddingBottom: isAgentWorkflow ? '60px' : 0,
}}
>
{/* 数据呈现样式, 列表样式/卡片样式. 展示图像流商品列表时使用卡片样式 */}
{/* Data rendering style, list style/card style. Use card style when displaying image stream item lists */}
<>
{targetList.map((item: WorkflowInfo | ProductInfo) => (
<WorkflowCard

View File

@@ -56,7 +56,7 @@ const flowModeOptions = [
value: WorkflowMode.ChatFlow,
},
].filter(item => {
// 开源版本暂不支持对话流
// The open-source version does not currently support conversation streaming
if (item.value === WorkflowMode.ChatFlow && IS_OPEN_SOURCE) {
return false;
}

View File

@@ -39,17 +39,17 @@ export enum ModalI18nKey {
}
/**
* i18n 文案有变量时使用这个结构
* Use this structure when the i18n text has variables
*/
interface I18nKeyWithOptions {
/* i18n 文案的 key */
/* I18n copy key */
key: string;
/* 变量参数对象 */
/* variable parameter object */
options?: Record<string, ReactNode>;
}
export type I18nKey = string | I18nKeyWithOptions;
// 用于存放 workflow imageflow 的各个 i18n 文案的 key
// The key to each i18n copy used to store workflow and imageflow
export const WORKFLOW_MODAL_I18N_KEY_MAP: {
[WorkflowMode.Workflow]: Record<ModalI18nKey, I18nKey>;
[WorkflowMode.Imageflow]: Record<ModalI18nKey, I18nKey>;
@@ -102,7 +102,7 @@ export const WORKFLOW_MODAL_I18N_KEY_MAP: {
[ModalI18nKey.TabMine]: 'workflow_add_created_tab_mine',
[ModalI18nKey.ListEmptyTitle]: 'scene_workflow_popup_search_empty',
[ModalI18nKey.CreatedListEmptyTitle]: 'scene_workflow_popup_list_empty',
// 场景工作流没有描述
// Scenario workflow not described
[ModalI18nKey.CreatedListEmptyDescription]: '',
[ModalI18nKey.NavigationCreate]: 'workflow_add_navigation_create',
[ModalI18nKey.ListError]: 'workflow_add_list_added_id_empty',
@@ -122,7 +122,7 @@ export const WORKFLOW_MODAL_I18N_KEY_MAP: {
};
/**
* 自动根据 flowMode 返回对应国际化文案
* Automatically returns the corresponding internationalization copy according to flowMode
*/
export function useI18nText() {
const context = useContext(WorkflowModalContext);

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @coze-arch/max-line-per-function */
import { useNavigate, useParams } from 'react-router-dom';
import { useContext, useEffect } from 'react';
@@ -51,9 +51,9 @@ import {
import { reporter, wait } from '../../utils';
/**
* 特殊错误码
* - 788664021: 由于模型原因,暂不支持复制商店中的工作流
* - 788664024: 模板未购买,请前往模板详情页购买后再复制
* special error code
* - 788664021: Due to model reasons, replicating workflows in the store is not currently supported
* - 788664024: The template has not been purchased, please go to the template details page to buy and then copy it.
*/
const copyProductErrorCodes = ['788664021', '788664024'];
@@ -70,7 +70,7 @@ export interface WorkflowCardProps extends WorkFlowModalModeProps {
pluginId: string;
}>;
/**
* workflow 删除按钮点击时触发的 handler
* Workflow delete the handler that is triggered when the button is clicked
* @param row
*/
handleDeleteWorkflow?: (row: WorkflowInfo) => Promise<{
@@ -81,25 +81,25 @@ export interface WorkflowCardProps extends WorkFlowModalModeProps {
| undefined;
}>;
/**
* 是否为专业版特供
* Is it a special offer for the professional version?
*/
isProfessionalTemplate?: boolean;
}
interface UseWorkflowActionReturn {
/** 复制官方流程模板 */
/** Copy the official process template */
dupWorkflowTpl: () => Promise<void>;
/** 复制流程商品 */
/** Copy process product */
dupProduct: () => Promise<void>;
/** 添加流程 */
/** Add process */
addWorkflow: () => Promise<boolean>;
/** 移除流程 */
/** removal process */
removeWorkflow: () => void;
/**
* 删除流程
* delete process
*/
deleteWorkflow: () => Promise<void>;
/** 流程项点击 */
/** Process item click */
itemClick: () => void;
}
@@ -159,7 +159,7 @@ export function useWorkflowAction({
},
);
// 先获取工作流的信息
// Get the workflow information first
const workflowInfos = resp.data ?? [];
if (!workflowInfos?.length) {
Toast.error(I18n.t('workflow_add_list_added_id_empty'));
@@ -168,7 +168,7 @@ export function useWorkflowAction({
return workflowInfos.at(0) as BotPluginWorkFlowItem;
}
/**
* 通过插件 ID 构造新 workflowItem
* Construct a new workflowItem by plugin ID
*/
// eslint-disable-next-line complexity
async function getWorkflowItemByPluginId(config: {
@@ -199,7 +199,7 @@ export function useWorkflowAction({
},
);
// 先获取工作流的信息
// Get the workflow information first
const pluginInfos = resp.data?.plugin_list ?? [];
if (!pluginInfos?.length) {
Toast.error(
@@ -236,7 +236,7 @@ export function useWorkflowAction({
return context?.modalState.dataSourceType === DataSourceType.Workflow;
}
/** 打开流程详情页 */
/** Open the process details page */
function openWorkflowDetailPage(workflow: WorkflowInfo | ProductInfo) {
const flowData = workflow as Workflow;
const wId = (flowData as WorkflowInfo).workflow_id ?? '';
@@ -258,7 +258,7 @@ export function useWorkflowAction({
}
if (isProfessionalTemplate && !isCozePro) {
// 跳转到专业版登录
// Jump to professional version login
navigate(
`/sign/oauth?redirect=${encodeURIComponent(
'/store/bot',
@@ -288,7 +288,7 @@ export function useWorkflowAction({
return;
}
// 延迟刷新列表, 兜底服务端主从延迟导致问题
// Delayed refresh list, server level leader/follower delay caused problems
await wait(100);
try {
@@ -301,14 +301,14 @@ export function useWorkflowAction({
ProductEntityType.ImageflowTemplateV2,
});
// 构造新的绑定的工作流列表
// Construct a new bound workflow list
onWorkFlowListChange?.([...(workFlowList ?? []), newWorkflow]);
onAdd?.(newWorkflow, { isDup: true, spaceId: context.spaceId });
if (onDupSuccess) {
onDupSuccess(newWorkflow);
} else {
// 复制商品成功
// Copy product successfully
Toast.success({
content: (
<Space spacing={6}>
@@ -383,7 +383,7 @@ export function useWorkflowAction({
return;
}
// 延迟刷新列表, 兜底服务端主从延迟导致问题
// Delayed refresh list, server level leader/follower delay caused problems
await wait(100);
try {
@@ -400,7 +400,7 @@ export function useWorkflowAction({
newWorkflow.flow_mode = sourceFlowMode;
}
// 构造新的绑定的工作流列表
// Construct a new bound workflow list
onWorkFlowListChange?.([...(workFlowList ?? []), newWorkflow]);
onAdd?.(newWorkflow, { isDup: true, spaceId: context.spaceId });
@@ -475,14 +475,14 @@ export function useWorkflowAction({
newWorkflow.flow_mode = data?.flow_mode;
}
// 构造新的绑定的工作流列表
// Construct a new bound workflow list
onWorkFlowListChange?.([...(workFlowList ?? []), newWorkflow]);
const addResult = await onAdd?.(newWorkflow, {
isDup: false,
spaceId: context.spaceId,
});
/**
* 允许外部业务逻辑添加失败
* Allow external business logic to add failure
*/
if (isBoolean(addResult)) {
return addResult as unknown as boolean;
@@ -536,7 +536,7 @@ export function useWorkflowAction({
reporter.info({ message: 'workflow_modal: itemClick' });
if (onItemClick) {
// @ts-expect-error 符合预期
// @ts-expect-error meets expectations
const item: WorkflowItemType = {
item: data,
type: context.modalState.dataSourceType,

View File

@@ -58,8 +58,8 @@ import { WorkflowModalContent } from '../content';
import { reporter } from '../../utils';
import { ModalI18nKey, WORKFLOW_MODAL_I18N_KEY_MAP } from './use-i18n-text';
/**
* 返回流程弹窗的各部分组件, 内容,侧边,筛选组件, 拆分组件可用于不同布局
* 本用于流程选择
* Return to the parts of the process pop-up window Components, content, sides, filter components, split components can be used for different layouts
* This is for process selection
*/
// eslint-disable-next-line @coze-arch/max-line-per-function
export const useWorkflowModalParts = (props: WorkFlowModalModeProps) => {
@@ -102,7 +102,7 @@ export const useWorkflowModalParts = (props: WorkFlowModalModeProps) => {
[modalState],
);
// 排序规则(流程数据源)
// Sorting rules (process data sources)
const [orderBy, setOrderBy] = useState(OrderBy.UpdateTime);
const [createModalVisible, setCreateModalVisible] = useState(false);
@@ -162,7 +162,7 @@ export const useWorkflowModalParts = (props: WorkFlowModalModeProps) => {
const isBindDouyin = bindBizType === BindBizType.DouYinBot;
const hideSidebar = hideSider || isBindDouyin;
/** 侧边栏组件 */
/** Sidebar Component */
const sider = hideSidebar ? null : (
<QueryClientProvider client={workflowQueryClient}>
<WorkflowModalContext.Provider value={contextValue}>
@@ -171,7 +171,7 @@ export const useWorkflowModalParts = (props: WorkFlowModalModeProps) => {
</QueryClientProvider>
);
/** 流程列表组件 */
/** process list component */
const content = (
<QueryClientProvider client={workflowQueryClient}>
<WorkflowModalContext.Provider value={contextValue}>
@@ -215,7 +215,7 @@ export const useWorkflowModalParts = (props: WorkFlowModalModeProps) => {
</QueryClientProvider>
);
/** 筛选组件 */
/** filter component */
let filter = (
<QueryClientProvider client={workflowQueryClient}>
<WorkflowModalContext.Provider value={contextValue}>
@@ -228,7 +228,7 @@ export const useWorkflowModalParts = (props: WorkFlowModalModeProps) => {
</QueryClientProvider>
);
// 隐藏 sider 后,把 title 放到 filter 上边
// After hiding the sider, put the title on the filter
if (hideSidebar && !isBindDouyin) {
const title = I18n.t(
WORKFLOW_MODAL_I18N_KEY_MAP[flowMode]?.[

View File

@@ -200,7 +200,7 @@ export function useWorkflowProductList({
return { workflowId, pluginId };
};
return {
// 筛选条件
// filter criteria
updatePageParam,
//
@@ -213,7 +213,7 @@ export function useWorkflowProductList({
isFetchingNextPage,
hasNextPage,
// 操作
// operation
copyProduct,
} as const;
}

View File

@@ -28,7 +28,7 @@ export function useWorkflowSearch() {
const context = useContext(WorkflowModalContext);
const { run: debounceChangeSearch, cancel } = useDebounceFn(
(search: string) => {
/** 搜索最大字符数 */
/** Search maximum number of characters */
const maxCount = 100;
if (search.length > maxCount) {
updateSearchQuery(search.substring(0, maxCount));
@@ -49,7 +49,7 @@ export function useWorkflowSearch() {
const updateSearchQuery = (search?: string) => {
const newState: Partial<WorkflowModalState> = { query: search ?? '' };
if (dataSourceType === DataSourceType.Workflow) {
// 搜索时如果有标签, 重置全部
// If there are tags when searching, reset all
newState.workflowTag = isSpaceWorkflow ? 0 : 1;
newState.sortType = undefined;
}
@@ -73,11 +73,11 @@ export function useWorkflowSearch() {
data-testid="workflow.modal.search"
onSearch={search => {
if (!search) {
// 如果search清空了那么立即更新query
// If the search is empty, update the query immediately
cancel();
updateSearchQuery('');
} else {
// 如果search有值,那么防抖更新
// If search has a value, then anti-shake update
debounceChangeSearch(search);
}
}}

View File

@@ -53,12 +53,12 @@ export const CreateWorkflowBtn: FC<
}
const { createModalVisible, setCreateModalVisible, bindBizType } = context;
// 如果是抖音分身场景,此时只展示一个【创建工作流】按钮
// If it is a Douyin doppelganger scene, only one [Create Workflow] button will be displayed at this time.
const showSingleButton =
bindBizType === BindBizType.DouYinBot ||
from === WorkflowModalFrom.WorkflowAgent;
/** 打开流程详情页 */
/** Open the process details page */
const menuConfig = [
{
label: I18n.t('workflow_add_navigation_create'),
@@ -148,7 +148,7 @@ export const CreateWorkflowBtn: FC<
'create workflow failed, no workflow id',
);
}
// 由于服务端创建 workflow 的主备数据同步有延迟,所以在创建完后如果直接跳转,有可能查不到 workflowId所以前端延迟下降低问题触发的概率
// Due to the delay in the synchronization of the main and standby data of the workflow created by the server level, if you jump directly after the creation, the workflowId may not be found, so the front-end delay reduces the probability of the problem triggering
await wait(500);
if (onCreateSuccess) {

View File

@@ -105,7 +105,7 @@ const WorkflowFilter = forwardRef<
}
const resp = await ProductApi.PublicGetProductCategoryList({
// 模版分类对于 工作流 / 图像流 通用
// Template classification, for workflow/image circulation
entity_type: ProductEntityType.TemplateCommon,
need_empty_category: false,
});
@@ -172,7 +172,7 @@ const WorkflowFilter = forwardRef<
useImperativeHandle(ref, () => ({
getCurrent: () => tags?.data.find(item => item.type === currentValue),
}));
/** 展示空间流程, 我的/团队的 */
/** Showcase space flow, my/team's */
const clickSpaceContent = (category?: WorkflowCategory) => {
context?.updateModalState({
isSpaceWorkflow: category !== WorkflowCategory.Example,

View File

@@ -41,9 +41,9 @@ export interface BotPluginWorkFlowItem extends WorkflowDetailData {
export type GetProductListRequest = public_api.GetProductListRequest;
/**
* 商品类型
* Product type
*
* 由于类型同名问题, 直接导出 ProductInfo 指向的是后台的类型不是目标类型,需要使用本方法转一下
* Due to the problem of the same name of the type, the direct export of ProductInfo points to the type in the background, not the target type. You need to use this method to transfer it.
*/
export type ProductInfo = public_api.ProductInfo;
@@ -52,11 +52,11 @@ export enum MineActiveEnum {
Mine = '2',
}
/** 数据来源 */
/** data source */
export enum DataSourceType {
/** 流程 */
/** process */
Workflow = 'workflow',
/** @deprecated 流程商店 */
/** @deprecated process store */
Product = 'product',
}
@@ -66,136 +66,136 @@ export type WorkflowItemType =
export const WORKFLOW_LIST_STATUS_ALL = 'all';
/**
* 项目内的工作流添加子流程时的分类中,资源库/项目工作流分类
* In the category of workflows within a project when subprocesses are added, the resource library/project workflow category
*/
export enum WorkflowCategory {
/**
* 项目工作流
* project workflow
*/
Project = 'project',
/**
* 资源库工作流
* repository workflow
*/
Library = 'library',
/**
* 官方示例
* official example
*/
Example = 'example',
}
/** 流程弹窗状态 */
/** Process pop-up status */
export interface WorkflowModalState {
/** 流程状态 */
/** process state */
status: WorkFlowListStatus | typeof WORKFLOW_LIST_STATUS_ALL;
/** @deprecated 数据类型, 当前请求的是流程数据还是商店数据 */
/** @Deprecated data type, is the process data or store data being requested? */
dataSourceType: DataSourceType;
/** 创建者 */
/** creator */
creator: MineActiveEnum;
/** @deprecated 工作流模板标签 */
/** @deprecated workflow template tag */
workflowTag: number;
/** @deprecated 商品标签 */
/** @deprecated product label */
productCategory: string;
/** 搜索关键字 */
/** Search keywords */
query: string;
/** @deprecated 是否请求当前空间流程 */
/** @Deprecated whether to request the current space flow */
isSpaceWorkflow: boolean;
/** 选中的 workflow 分类 */
/** Selected workflow category */
workflowCategory?: WorkflowCategory;
/** @deprecated 商店产品下的排序方式 */
/** Sort by @deprecated store products */
sortType?: SortType;
/** 弹窗内列表筛选的工作流类型,可以的值是 AllWorkflowChatflow。用于列表里工作流类型筛选,此时 Imageflow 已经合并到 Workflow 类型中了 */
/** The workflow type for list filtering in the pop-up window, the possible values are All, Workflow, Chatflow. Used for workflow type filtering in the list, at this time Imageflow has been merged into the Workflow type */
listFlowMode: WorkflowMode;
}
/** 流程弹窗 */
/** process pop-up */
export interface WorkFlowModalModeProps {
/** 当前弹窗来源,默认不传 */
/** The source of the current pop-up window is not uploaded by default. */
from?: WorkflowModalFrom;
/** 流程类型, 工作流还是图像流, 默认工作流 */
/** Process type, workflow or image flow, default workflow */
flowMode?: WorkflowMode;
/** 隐藏的流程 */
/** hidden flow */
excludedWorkflowIds?: string[];
/**
* filter 状态筛选组件是否显示全部状态选项,默认为 false
* Filter status Whether the filter component displays all status options, the default is false
*/
filterOptionShowAll?: boolean;
/**
* 是否隐藏侧边栏,默认 false。用于场景详情页选择 workflow
* Whether to hide the sidebar, the default is false. Use the scene details page to select workflow.
*/
hideSider?: boolean;
/* 是否隐藏作者筛选菜单 */
/* Whether to hide the author filter menu */
hideCreatorSelect?: boolean;
/**
* workflow item 是否显示删除按钮,默认 false用于场景 workflow 以及抖音分身工作流
* Whether the workflow item shows the delete button, the default is false, used for scene workflow and Douyin doppelganger workflow
*/
itemShowDelete?: boolean;
/** @deprecated 是否隐藏空间下 Workflow 列表模块 */
/** @Deprecated Whether to hide the Workflow list module under the space */
hiddenSpaceList?: boolean;
/**
* @deprecated 使用 hiddenWorkflowCategories
* 是否隐藏资源库模块
* @deprecated hiddenWorkflowCategories
* Whether to hide the library module
*/
hiddenLibrary?: boolean;
/** 是否隐藏创建工作流入口 */
/** Whether to hide the creation workflow entry */
hiddenCreate?: boolean;
/**
* @deprecated 探索分类已改为官方示例,使用 hiddenWorkflowCategories
* 隐藏探索分类
* @Deprecated Explore category has been changed to official example, using hiddenWorkflowCategories
* Hidden Exploration Classification
*/
hiddenExplore?: boolean;
/**
* 隐藏的工作流分类,用法同 hiddenLibraryhiddenExplore
* Hidden workflow classification, the usage is the same as hiddenLibrary, hiddenExplore,
*/
hiddenWorkflowCategories?: WorkflowCategory[];
/**
* 隐藏工作流列表类型筛选
* Hidden workflow list type filter
*/
hiddenListFlowModeFilter?: boolean;
/** 复制按钮文案, 默认「复制并添加」 */
/** Copy button copy, default "copy and add" */
dupText?: string;
/** 初始状态, 配置各筛选项 */
/** Initial state, configure each filter */
initState?: Partial<WorkflowModalState>;
/** 已选流程列表 */
/** list of selected processes */
workFlowList?: BotPluginWorkFlowItem[];
/** 已选流程列表变化 */
/** Selected process list changes */
onWorkFlowListChange?: (newList: BotPluginWorkFlowItem[]) => void;
/** 选择流程 */
/** selection process */
onAdd?: (
item: BotPluginWorkFlowItem,
config: {
/** 是否来源于复制 */
/** Does it come from copying? */
isDup: boolean;
/** 目标空间 */
/** Target space */
spaceId: string;
},
) => void;
/** 移除流程 */
/** removal process */
onRemove?: (item: BotPluginWorkFlowItem) => void;
/**
* 删除流程后的回调 hooks同时会执行 removeWorkflow 移除和 bot/场景 的关联
* Removes the callback hooks after the process, and removeWorkflow removes the association with the bot/scene
* @param item
*/
onDelete?: (item: BotPluginWorkFlowItem) => void;
/**
* 列表项点击
* List item click
*
* 配置可覆盖默认行为: 新开页面打开详情页
* @returns 返回 { handled: true } undefined 不执行默认操作,否则执行内部默认的点击事件
* Configuration overrides default behavior: Open a new page Open the details page
* @Returns returns {handled: true} or undefined does not perform the default action, otherwise the internal default click event is executed
*/
onItemClick?:
| ((
item: WorkflowItemType,
/** 弹窗状态, 可用于初始化弹窗 */
/** Pop-up status, which can be used to initialize the pop-up */
modalState: WorkflowModalState,
) => { handled: boolean })
| ((
item: WorkflowItemType,
/** 弹窗状态, 可用于初始化弹窗 */
/** Pop-up status, which can be used to initialize the pop-up */
modalState: WorkflowModalState,
) => void);
/**
* 创建流程成功
* Successful creation process
*
* 配置可覆盖默认行为: 新页面打开复制后的流程详情, 带参数 from=createSuccess
* Configuration can override default behavior: new page opens process details after replication, with parameter from = createSuccess
*/
onCreateSuccess?: (info: {
spaceId: string;
@@ -203,12 +203,12 @@ export interface WorkFlowModalModeProps {
flowMode: WorkflowMode;
}) => void;
/**
* 复制流程成功
* The replication process was successful.
*
* 配置可覆盖默认行为: Toast 提示复制成功, 继续编辑
* Configuration can override default behavior: Toast prompt Copy successful, continue editing
*/
onDupSuccess?: (item: BotPluginWorkFlowItem) => void;
/** 项目内引入资源库文件触发的回调 */
/** Callback triggered by introducing a repository file into the project */
onImport?: (
item: Pick<BotPluginWorkFlowItem, 'workflow_id' | 'name'>,
) => void;
@@ -217,10 +217,10 @@ export interface WorkFlowModalModeProps {
projectId?: string;
onClose?: () => void;
/**
* 创建 workflow 弹窗内命名校验
* Create name check in workflow pop-up
*/
nameValidators?: RuleItem[];
/** 自定义 i18n 文案 */
/** Custom i18n copy */
i18nMap?: Partial<Record<ModalI18nKey, I18nKey>>;
}

View File

@@ -17,7 +17,7 @@
import { type WorkflowModalState, WorkflowCategory } from './type';
/**
* workflow modal 当前是否选中了 project 工具流分类
* Workflow modal Whether the project toolflow category is currently selected
* @param modalState
*/
export const isSelectProjectCategory = (modalState?: WorkflowModalState) =>

View File

@@ -31,22 +31,22 @@ export interface WorkflowModalContextValue {
spaceType: SpaceType;
bindBizId?: string;
bindBizType?: BindBizType;
/** 当前项目 id只在项目内的 workflow 有该字段 */
/** The current project id, only the workflow within the project has this field */
projectId?: string;
/** 工作流类型,此参数由 WorkflowModal 弹窗创建时由 props 传进来,可能的值是 WorkflowImageflow。用于区分添加哪种工作流 */
/** Workflow type, this parameter is passed in by props when created by WorkflowModal pop-up window, possible values are Workflow, Imageflow. Used to distinguish which workflow to add */
flowMode: WorkflowMode;
modalState: WorkflowModalState;
/** 更新弹窗状态, merge 的模式 */
/** Update popup status, merge mode */
updateModalState: (newState: Partial<WorkflowModalState>) => void;
orderBy: OrderBy;
setOrderBy: React.Dispatch<React.SetStateAction<OrderBy>>;
createModalVisible: boolean;
setCreateModalVisible: React.Dispatch<React.SetStateAction<boolean>>;
/** 获取当前弹窗状态, 可用于恢复弹窗状态 */
/** Get the current pop-up state, which can be used to restore the pop-up state */
getModalState: (ctx: WorkflowModalContextValue) => WorkflowModalState;
/** 自定义 i18n 文案 */
/** Custom i18n copy */
i18nMap?: Partial<Record<ModalI18nKey, I18nKey>>;
}