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

@@ -20,35 +20,35 @@ import {
ConnectorConfigStatus,
} from '@coze-arch/idl/intelligence_api';
// 未配置/授权场景
// Unconfigured/Authorized Scenario
export const getConnectorNotConfigured = (
connector: PublishConnectorInfo,
): boolean => {
const { bind_type, config_status } = connector;
// 未绑定&未授权
// Unbound & Unauthorized
const notConfigured =
[
ConnectorBindType.KvBind,
ConnectorBindType.AuthBind,
ConnectorBindType.KvAuthBind,
ConnectorBindType.TemplateBind, // mcp未配置时禁用模版始终为已配置
ConnectorBindType.TemplateBind, // Disable when mcp is not configured, the template is always configured
].includes(bind_type) &&
config_status === ConnectorConfigStatus.NotConfigured;
return notConfigured;
};
// 不能发布的场景:
// 1. 未绑定&未授权
// 2. 后端下发的不能发布没有workflow不能发api有私有插件不能发模板审核中不能发布的渠道
// Scenarios that cannot be published:
// 1. Unbound & Unauthorized
// 2. Those sent by the backend cannot be released (such as: APIs cannot be sent without workflow, templates cannot be sent with private plugins, and channels that cannot be released during review)
export const getDisabledPublish = (
connector: PublishConnectorInfo,
): boolean => {
const { allow_publish } = connector;
// 未绑定&未授权
// Unbound & Unauthorized
const notConfigured = getConnectorNotConfigured(connector);
const connectorDisabled = notConfigured || !allow_publish;
// 审核中不能发布渠道的场景后端下发 allow_publish
// The backend of the scenario where the channel cannot be released during the review is issued allow_publish
return connectorDisabled;
};

View File

@@ -72,12 +72,12 @@ export function formatConnectorGroups(
}
if (c.connector_union_id) {
const unionId = c.connector_union_id;
// 如果当前 union_id 已经被添加到分组中,则跳过
// If the current union_id has already been added to the group, skip
if (group.connectors.some(i => i.connector_union_id === unionId)) {
continue;
}
let connectorInfo = c;
// 优先取 union 选中的 connector否则取第一个
// Give priority to the connector selected by the union, otherwise take the first one.
const unionSelection = connectors.find(i => i.id === unions[unionId]);
if (unionSelection) {
connectorInfo = unionSelection;

View File

@@ -56,7 +56,7 @@ const getKvBindStatus = (record: PublishConnectorInfo): ConfigStatusUI => {
[ConnectorConfigStatus.NotConfigured]: I18n.t(
'bot_publish_columns_status_not_configured',
),
// 业务不会走到下面3个case
// Business will not go to the following 3 cases
[ConnectorConfigStatus.Configuring]: '',
[ConnectorConfigStatus.Disconnected]: '',
[ConnectorConfigStatus.NeedReconfiguring]: '',

View File

@@ -15,15 +15,15 @@
*/
export const incrementVersionNumber = (input: string) => {
// 定义正则表达式,匹配 "数字.数字.数字" 的模式
// Define regular expressions that match the pattern of "number. number. number"
const regex = /(\d+)\.(\d+)\.(\d+)/g;
// 使用 replace 方法和回调函数对匹配的部分进行替换
// Use the replace method and callback function to replace the matching part
// eslint-disable-next-line max-params
const result = input.replace(regex, (_match, p1, p2, p3) => {
// 将最后一个数字加 1
// Add 1 to the last number.
const incrementedP3 = parseInt(String(p3), 10) + 1;
// 返回新的字符串
// Return a new string
return `${p1}.${p2}.${incrementedP3}`;
});

View File

@@ -60,17 +60,17 @@ export async function initPublishStore(
const { connector_ids = [], connector_publish_config = {} } =
last_publish_info;
// 初始化默认选中的渠道
// Initialize the default selected channel
const initSelectedConnectors: string[] = [];
const initConnectors: Record<string, Record<string, string>> = {};
for (const id of connector_ids) {
const connector = connector_list.find(c => c.id === id);
// 过滤掉不允许发布的渠道
// Filter out channels that are not allowed to publish
if (!connector || getDisabledPublish(connector)) {
continue;
}
if (connector.connector_union_id) {
// 对于 union 的 connector ,选中其 union id
// For the connector of union, select its union id.
initSelectedConnectors.push(connector.connector_union_id);
initConnectors[connector.id] = connector.bind_info;
} else {
@@ -79,7 +79,7 @@ export async function initPublishStore(
}
}
// 初始化每个 union 选中的 connector如果上次没发布该渠道则选中第一个
// Initialize the connector selected by each union, and select the first one if the channel was not published last time
const initUnions: Record<string, string> = {};
for (const [unionId, info] of Object.entries(connector_union_info_map)) {
initUnions[unionId] =
@@ -87,9 +87,9 @@ export async function initPublishStore(
?.connector_id ?? info.connector_options[0].connector_id;
}
// 回填社交渠道选择的 chatflow优先级
// 1. draft 中保存的 chatflow
// 2. 上次发布的第一个 SocialPlatform 选择的 chatflow
// Backfill the chatflow of social channel selection, priority:
// 1. Saved chatflows in drafts
// 2. Chatflow selected by the first SocialPlatform released last time
let lastSocialPlatformChatflow: ConnectorPublishConfig | undefined;
if (draft?.socialPlatformConfig?.selected_workflows?.[0].workflow_id) {
lastSocialPlatformChatflow = draft.socialPlatformConfig;
@@ -109,7 +109,7 @@ export async function initPublishStore(
}
}
// 根据 draft 中保存的信息回填 WebSDK 渠道选择的 chatflow
// Backfill the chatflow selected by the WebSDK channel based on the information saved in the draft
if (draft?.sdkConfig?.selected_workflows?.[0].workflow_id) {
connector_publish_config[WEB_SDK_CONNECTOR_ID] = draft.sdkConfig;
}
@@ -119,7 +119,7 @@ export async function initPublishStore(
);
const lastPublishVersionNumber = last_publish_info.version_number;
// 用户没有 draft 并且存在发布过的版本 则将上一次发布的版本号进行处理
// If the user does not have a draft and there is a published version, the last released version number will be processed
const fixedVersionNumber = getFixedVersionNumber({
lastPublishVersionNumber,
draftVersionNumber: draft?.versionNumber,

View File

@@ -17,7 +17,7 @@
import { type StoreBindKey } from '@/store';
type SelfMapping<T extends string> = {
[K in T]: K; // 关键语法:将每个字面量类型映射为自己
[K in T]: K; // Key syntax: Mapping each literal type to itself
};
type KeyMapping = SelfMapping<StoreBindKey>;
@@ -25,7 +25,7 @@ type KeyMapping = SelfMapping<StoreBindKey>;
export const isStoreBindConfigured = (
config: Record<string, string>,
): boolean => {
// 防止 StoreBindKey 有变动导致 bug
// Prevent StoreBindKey changes from causing bugs
const { category_id, display_screen }: KeyMapping = {
category_id: 'category_id',
display_screen: 'display_screen',