chore: replace all cn comments of fe to en version by volc api (#320)
This commit is contained in:
@@ -13,11 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
/* eslint-disable max-lines */
|
||||
/* eslint-disable @coze-arch/max-line-per-function */
|
||||
|
||||
/* eslint-disable max-lines-per-function, complexity -- PluginItem 的 onApiToggle 后续可以提取优化 */
|
||||
/* eslint-disable max-lines-per-function, complexity -- onApiToggle of PluginItem can be extracted and optimized later */
|
||||
/* eslint-disable import/order */
|
||||
import {
|
||||
type MutableRefObject,
|
||||
@@ -182,13 +182,13 @@ export const PluginPanel: React.FC<PluginPanelProps> = ({
|
||||
const refTarget = useRef(null);
|
||||
const refHasReport = useRef(false);
|
||||
|
||||
// 记录当前点击插件的 apiId
|
||||
// Record the apiId of the currently clicked plugin
|
||||
const currentApiId = useRef('');
|
||||
|
||||
// 记录当前是否在拉取 store 的最新插件数据
|
||||
// Record whether the latest plug-in data of the store is currently being pulled
|
||||
const [isFetching, setIsFetching] = useState(false);
|
||||
|
||||
// 例如 { 'pluginID_apiID': [node1, node2, node3, ...] }
|
||||
// For example {'pluginID_apiID': [node1, node2, node3,...]}
|
||||
const pluginApiNodesMap = useMemo(
|
||||
() =>
|
||||
groupBy(workflowNodes || [], item => {
|
||||
@@ -300,7 +300,7 @@ export const PluginPanel: React.FC<PluginPanelProps> = ({
|
||||
<div className={s['header-main']}>
|
||||
<div className={s['header-name']}>
|
||||
<Space spacing={8} className="flex-1">
|
||||
{/* 插件名称最长30字符,无需ellipsis */}
|
||||
{/* Plugin name up to 30 characters, no ellipsis required */}
|
||||
<Typography.Text>
|
||||
<Highlight
|
||||
sourceString={name}
|
||||
@@ -370,7 +370,7 @@ export const PluginPanel: React.FC<PluginPanelProps> = ({
|
||||
|
||||
<div className="my-[8px] leading-[16px]">
|
||||
<Space spacing={4}>
|
||||
{/* 条件 */}
|
||||
{/* condition */}
|
||||
|
||||
{addonBefore}
|
||||
{productInfo?.plugin_type === ProductPluginType.LocalPlugin ? (
|
||||
@@ -523,7 +523,7 @@ export const PluginPanel: React.FC<PluginPanelProps> = ({
|
||||
});
|
||||
} else {
|
||||
let apiToSend: PluginApi | undefined;
|
||||
// api所在的plugin的信息,添加后存入store,避免GetPlaygroundPluginList多次请求
|
||||
// The information of the plugin where the api is located is added and stored in the store to avoid GetPlaygroundPluginList multiple requests
|
||||
const pluginInfo = {
|
||||
plugin_icon,
|
||||
plugin_type,
|
||||
@@ -532,7 +532,7 @@ export const PluginPanel: React.FC<PluginPanelProps> = ({
|
||||
version_name,
|
||||
version_ts,
|
||||
};
|
||||
// 检测当前要添加的 Plugins名称在已添加列表里是否有重名的情况(模型不支持,所以加此处理)
|
||||
// Check whether the name of the Plugins currently to be added has a duplicate name in the added list (the model does not support it, so this is added)
|
||||
if (
|
||||
pluginApiList
|
||||
.map(i => (i.plugin_name ?? '') + i.name)
|
||||
@@ -549,7 +549,7 @@ export const PluginPanel: React.FC<PluginPanelProps> = ({
|
||||
setIsFetching(true);
|
||||
currentApiId.current = api.api_id;
|
||||
|
||||
// 从market 过来的数据,需要重新拉取最新数据。
|
||||
// Data from the market needs to be re-pulled to the latest data.
|
||||
const result =
|
||||
await PluginDevelopApi.GetPlaygroundPluginList({
|
||||
page: 1,
|
||||
@@ -585,7 +585,7 @@ export const PluginPanel: React.FC<PluginPanelProps> = ({
|
||||
);
|
||||
}
|
||||
if (apiToSend) {
|
||||
// 如果仅可添加一次,则添加后调用callback,并且关闭弹窗
|
||||
// If it can only be added once, call callback after adding and close the pop-up window
|
||||
if (
|
||||
openMode === OpenModeType.OnlyOnceAdd ||
|
||||
(from &&
|
||||
@@ -599,14 +599,14 @@ export const PluginPanel: React.FC<PluginPanelProps> = ({
|
||||
...apiToSend,
|
||||
...pluginInfo,
|
||||
});
|
||||
/** 允许添加失败的场景 */
|
||||
/** Allow to add failed scenarios */
|
||||
if (isBoolean(cbResult)) {
|
||||
return cbResult;
|
||||
}
|
||||
return isSuccess;
|
||||
}
|
||||
if (!IS_OPEN_SOURCE) {
|
||||
// 添加plugin成功后,快速绑定预设卡片信息
|
||||
// After successfully adding the plugin, quickly bind the preset card information
|
||||
await PluginDevelopApi.QuickBindPluginPresetCard({
|
||||
plugin_id: apiToSend.plugin_id,
|
||||
api_name: apiToSend.name,
|
||||
|
||||
@@ -109,7 +109,7 @@ export const PluginItem: React.FC<PluginItemProps> = ({
|
||||
</UITag>
|
||||
);
|
||||
const isDisabled = marketStatus === ProductStatus?.Unlisted;
|
||||
// 端插件且未添加过 提示适用渠道
|
||||
// The end plug-in has not been added, and the applicable channel is prompted.
|
||||
const showAddConfirm =
|
||||
isLocalPlugin &&
|
||||
((!isFromWorkflow && !isAdded) || (isFromWorkflow && count === 0));
|
||||
@@ -131,7 +131,7 @@ export const PluginItem: React.FC<PluginItemProps> = ({
|
||||
>
|
||||
{name}
|
||||
</Typography.Text>
|
||||
{/* 预览预置卡片 */}
|
||||
{/* Preview preview card */}
|
||||
{pluginApi?.card_binding_info?.thumbnail ? (
|
||||
<CardThumbnailPopover
|
||||
url={pluginApi?.card_binding_info?.thumbnail}
|
||||
|
||||
@@ -57,7 +57,7 @@ export interface PluginContentListItem {
|
||||
productInfo?: SimplifyProductInfo;
|
||||
pluginInfo: PluginInfoForPlayground;
|
||||
belong_page?: number;
|
||||
isFromMarket?: boolean; //数据是从哪里获取的
|
||||
isFromMarket?: boolean; //Where is the data obtained from?
|
||||
commercial_setting?: CommercialSetting;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ const filterProductListParams = (key: string, value: unknown) => {
|
||||
if (!(key in keyMap)) {
|
||||
return value;
|
||||
}
|
||||
// keyMap 键对应 value 为 stringifyNumber 过滤掉非法值 ''
|
||||
// The keyMap key corresponds to the value stringifyNumber to filter out illegal values "'
|
||||
if (value === '') {
|
||||
return;
|
||||
}
|
||||
@@ -92,7 +92,7 @@ function formatPluginApiProductInfo(productInfo: ProductInfo) {
|
||||
plugin_id: pluginId,
|
||||
plugin_name: name,
|
||||
record_id: '',
|
||||
// 插件预设卡片信息
|
||||
// Plugin preset card information
|
||||
card_binding_info: {
|
||||
thumbnail: item?.card_info?.card_url,
|
||||
},
|
||||
@@ -150,7 +150,7 @@ function formatPluginProductInfo(
|
||||
};
|
||||
}
|
||||
|
||||
// 拉取 插件市场的 插件商品列表
|
||||
// Pull, Plugin Market, Plugin Product List
|
||||
async function getPluginFromMarket(
|
||||
// @ts-expect-error -- linter-disable-autofix
|
||||
queryParams,
|
||||
@@ -258,8 +258,8 @@ function getPluginFromMinOrTeam(
|
||||
res.data?.plugin_list?.map(item => ({
|
||||
pluginInfo: item,
|
||||
isFromMarket: false,
|
||||
// 当前数据属于第几页的数据,用于page数据替换
|
||||
// 如果后面用id + count代替page + size,可以把这个逻辑去掉
|
||||
// The current data belongs to the data of the page, which is used for page data replacement
|
||||
// If you replace page + size with id + count later, you can remove this logic.
|
||||
belong_page: nextPage,
|
||||
})) || [];
|
||||
const hasMore =
|
||||
|
||||
@@ -55,11 +55,11 @@ export interface PluginQuery {
|
||||
orderByPublic: SortType | OrderBy;
|
||||
mineActive: MineActiveEnum;
|
||||
orderByFavorite: SortType;
|
||||
// 后端规定传 undefined 才不拼 query,
|
||||
// The backend stipulates that passing undefined does not spell query.
|
||||
isOfficial: undefined | true;
|
||||
// multiAgent模式下传递
|
||||
// Transfer in multiAgent mode
|
||||
agentId?: string;
|
||||
// 根据bot推荐插件
|
||||
// Recommend plugins according to bot
|
||||
botInfo?: {
|
||||
current_entity_type?: product_common.ProductEntityType;
|
||||
current_entity_id?: Int64;
|
||||
@@ -68,29 +68,29 @@ export interface PluginQuery {
|
||||
pluginType?: PluginType;
|
||||
}
|
||||
|
||||
/** plugin 弹窗打开来源 */
|
||||
/** Plugin pop-up window open source */
|
||||
export enum From {
|
||||
/** 在 workflow 打开 */
|
||||
/** Open in workflow */
|
||||
WorkflowAddNode = 'workflow_addNode',
|
||||
|
||||
/** 在 bot skills 打开 */
|
||||
/** Open in bot skills */
|
||||
BotSkills = 'bot_skills',
|
||||
|
||||
/** 在 bot triggers 打开 */
|
||||
/** Open in bot triggers */
|
||||
BotTrigger = 'bot_trigger',
|
||||
|
||||
/** 在 project ide 打开 */
|
||||
/** Open in project ide */
|
||||
ProjectIde = 'project_ide',
|
||||
|
||||
/** 在 project workflow 打开 */
|
||||
/** Open in project workflow */
|
||||
ProjectWorkflow = 'project_workflow',
|
||||
}
|
||||
|
||||
export { OpenModeType };
|
||||
export interface PluginModalModeProps {
|
||||
/** 打开弹窗模式:
|
||||
* 默认不传
|
||||
* only_once_add:仅可添加一次后关闭,并返回callback函数
|
||||
/** Open pop-up mode:
|
||||
* Do not pass by default
|
||||
* only_once_add: close after adding only once and return the callback function
|
||||
*/
|
||||
openMode?: OpenModeType;
|
||||
from?: From;
|
||||
@@ -105,23 +105,23 @@ export interface PluginModalModeProps {
|
||||
showButton?: boolean;
|
||||
showCopyPlugin?: boolean;
|
||||
onCopyPluginCallback?: (val: { pluginID?: string; name?: string }) => void;
|
||||
// project ide 场景下传递需要传已选的插件,反显用
|
||||
// In the project ide scenario, you need to pass the selected plug-in, which is used inversely
|
||||
pluginApiList?: PluginApi[];
|
||||
// project ide 场景下传递projectId
|
||||
// Pass projectId in the project ide scene
|
||||
projectId?: string;
|
||||
// 关闭弹窗回调
|
||||
// Close pop-up callback
|
||||
closeCallback?: () => void;
|
||||
// project 场景下点击插件回调
|
||||
// Click on the plugin callback in the project scene
|
||||
clickProjectPluginCallback?: (
|
||||
val?: PluginInfoForPlayground & {
|
||||
listed_at?: Int64;
|
||||
},
|
||||
) => void;
|
||||
// 创建成功回调
|
||||
// Create a successful callback
|
||||
onCreateSuccess?: (val?: { spaceId?: string; pluginId?: string }) => void;
|
||||
// 是否展示商店插件
|
||||
// Whether to display store plugins
|
||||
isShowStorePlugin?: boolean;
|
||||
// 隐藏创建按钮
|
||||
// Hide create button
|
||||
hideCreateBtn?: boolean;
|
||||
initQuery?: Partial<PluginQuery>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user