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,7 +20,7 @@ import classNames from 'classnames';
import s from './index.module.less';
// TODO 后续迭代扩展时props可细化
// Props can be refined when subsequent iterations of TODO are expanded
interface ActionBarHoverContainerProps {
style?: React.CSSProperties;
}

View File

@@ -47,16 +47,16 @@ export const CopyTextMessage: React.FC<
const [isCopySuccessful, setIsCopySuccessful] = useState<boolean>(false);
const trigger = useTooltipTrigger('hover');
// 单位s
// Unit s
const COUNT_DOWN_TIME = 3;
// 单位s转化为ms的倍数
// The unit's is converted to a multiple of ms
const TIMES = 1000;
const handleCopy = () => {
const resp = copy(content);
if (resp) {
// 复制成功
// Copy successful
setIsCopySuccessful(true);
setTimeout(() => setIsCopySuccessful(false), COUNT_DOWN_TIME * TIMES);
Toast.success({
@@ -68,7 +68,7 @@ export const CopyTextMessage: React.FC<
eventName: ReportEventNames.CopyTextMessage,
});
} else {
// 复制失败
// Copy failed
Toast.warning({
content: I18n.t('copy_failed'),
showClose: false,

View File

@@ -58,7 +58,7 @@ export const DeleteMessage: React.FC<PropsWithChildren<DeleteMessageProps>> = ({
/>
}
onClick={() => {
// 通过 groupId 索引即可
// Just index through groupId.
deleteMessageGroup(groupId);
}}
color="secondary"

View File

@@ -57,7 +57,7 @@ export interface FrownUponUIProps extends FrownUponProps {
isMobile: boolean;
}
// 点踩按钮
// Click the button
export const FrownUpon: React.FC<PropsWithChildren<FrownUponProps>> = ({
onClick,
isFrownUponPanelVisible,
@@ -81,7 +81,7 @@ export const FrownUpon: React.FC<PropsWithChildren<FrownUponProps>> = ({
: [MessageFeedbackDetailType.UnlikeDefault],
},
}).then(() => {
// 接口调用后再切换展示状态
// Switch the display state after the interface is called.
onClick?.();
});
};
@@ -108,7 +108,7 @@ export const FrownUponUI: React.FC<FrownUponUIProps> = ({
}) => {
const toolTipWrapperRef = useRef<HTMLDivElement>(null);
const isHovering = useHover(toolTipWrapperRef);
// 解决点踩填写原因面板展开收起过程中点踩按钮的tooltip展示错乱问题
// Solve the problem that the tooltip display of the click button is disordered during the process of clicking and filling in the reason panel.
useDispatchMouseLeave(toolTipWrapperRef, isFrownUponPanelVisible);
return (
<div style={{ position: 'relative' }} ref={toolTipWrapperRef}>
@@ -172,7 +172,7 @@ export interface FrownUponPanelUIProps {
wrapReasons: boolean | undefined;
style?: CSSProperties;
}
// 点踩填写原因面板
// Click to fill in the reason panel
export const FrownUponPanel: React.FC<
PropsWithChildren<FrownUponPanelProps>
> = ({ containerStyle, onCancel, onSubmit, wrapReasons }) => {
@@ -191,7 +191,7 @@ export const FrownUponPanel: React.FC<
: undefined,
},
}).then(() => {
// 接口调用后再切换展示状态
// Switch the display state after the interface is called.
onSubmit?.();
});
};

View File

@@ -43,7 +43,7 @@ export const MoreOperations: React.FC<MoreOperationsProps> = ({
disabled={isDeleteMessageLock}
icon={<IconCozTrashCan className="coz-fg-hglt-red" />}
onClick={() => {
// 通过 groupId 索引即可
// Just index through groupId.
deleteMessageGroup(groupId);
}}
type="danger"

View File

@@ -61,13 +61,13 @@ export const QuoteMessage: React.FC<
};
/**
* 哥哥们改动这里要小心一点喔,QuoteMessageImpl的前置依赖项是 message-grab
* Brothers, be careful with changes here. The pre-dependency of QuoteMessageImpl is message-grab.
*/
export const QuoteMessageImpl: React.FC<
PropsWithChildren<QuoteMessageProps>
> = ({ className, ...props }) => {
// INFO: 这里使用 as 是因为明确的知道 父组件提前尝试取 plugin 并且提前拦截的情况
// 后续如果有改动,请务必注意这里
// INFO: As is used here because it is clear that the parent component tries to fetch the plugin in advance and intercepts it in advance
// If there are any changes in the future, please be sure to pay attention here.
const plugin = useQuotePlugin() as WriteableChatAreaPlugin<
GrabPluginBizContext,
unknown

View File

@@ -65,7 +65,7 @@ export const ThumbsUp: React.FC<ThumbsUpProps> = ({
: MessageFeedbackType.Like,
},
}).then(() => {
// 接口调用后再切换展示状态
// Switch the display state after the interface is called.
onClick?.();
});
};

View File

@@ -17,10 +17,10 @@
import { type RefObject, useEffect } from 'react';
/**
* 点击赞、踩按钮,可以关闭打开原因填写面板
* 填写面板关闭的时候, 会造成一次 Reflow。此时赞、踩按钮的位置会发生变化 鼠标已经不在按钮上,但是对应按钮元素不会处罚 mouseleave 事件
* 由于不触发 mouseleave 造成按钮上的 tooltip 不消失、错位等问题
* 所以需要在面板 visible 变化时 patch 一个 mouseleave 事件
* Click the like and step on the button to close the reason for opening and fill in the panel.
* When the fill panel is closed, a Reflow will be caused. At this time, the position of the like and step buttons will change, and the mouse is no longer on the button, but the corresponding button element will not penalize the mouseleave event.
* Because the mouseleave is not triggered, the tooltip on the button does not disappear, misplaced, etc.
* So you need to patch a mouseleave event when the panel changes visible
*/
export const useDispatchMouseLeave = (
ref: RefObject<HTMLDivElement>,

View File

@@ -30,7 +30,7 @@ import { ReportEventNames } from '../report-events';
import { useReportMessageFeedbackFn } from '../context/report-message-feedback';
/**
* @description 消息点赞/点踩
* @description Message Like/Click
*/
export const useReportMessageFeedback = () => {
const { reporter } = useChatArea();
@@ -64,19 +64,19 @@ export const useReportMessageFeedback = () => {
};
/**
* @description 获取 点赞按钮组件/点踩按钮组件/点踩原因填写面板组件 props
* @description Get, like button component/click button component/click button reason Fill in the panel component props
*/
export const useReportMessageFeedbackHelpers = () => {
// 点赞成功标识
// Like success logo
const [isThumbsUpSuccessful, { toggle: toogleIsThumbsUpSuccessful }] =
useToggle<boolean>(false);
// 点踩成功标识
// Click on the success sign
const [isFrownUponSuccessful, { toggle: toogleIsFrownUponSuccessful }] =
useToggle<boolean>(false);
// 点踩原因填写面板展示
// Click on the reason to fill in the panel display
const [
isFrownUponPanelVisible,
{
@@ -85,20 +85,20 @@ export const useReportMessageFeedbackHelpers = () => {
},
] = useToggle<boolean>(false);
// 点赞按钮组件onClick事件
// Like button component onClick event
const thumbsUpOnClick = () => {
toogleIsThumbsUpSuccessful();
// 点赞/点踩互斥
// Like/click on mutual exclusion
if (!isThumbsUpSuccessful && isFrownUponSuccessful) {
toogleIsFrownUponSuccessful();
setIsFrownUponPanelVisibleFalse();
}
};
// 点踩按钮组件onClick事件
// Click button component onClick event
const frownUponOnClick = () => {
toogleIsFrownUponSuccessful();
// 点赞/点踩互斥
// Like/click on mutual exclusion
if (!isFrownUponSuccessful && isThumbsUpSuccessful) {
toogleIsThumbsUpSuccessful();
}
@@ -110,15 +110,15 @@ export const useReportMessageFeedbackHelpers = () => {
}
};
// 点踩原因填写面板组件onCancel事件
// Click on the reason to fill in the panel component onCancel event
const frownUponPanelonCancel = () => {
setIsFrownUponPanelVisibleFalse();
};
// 点踩原因填写面板组件onSubmit事件
// Click on the reason to fill in the panel component onSubmit event
const frownUponPanelonSubmit = () => {
setIsFrownUponPanelVisibleFalse();
// 点赞/点踩互斥
// Like/click on mutual exclusion
if (isThumbsUpSuccessful) {
toogleIsThumbsUpSuccessful();
}

View File

@@ -15,10 +15,10 @@
*/
export enum ReportEventNames {
/** 原名: chat_area_tts_voice_ws */
/** Original name: chat_area_tts_voice_ws */
TtsVoiceWs = 'chat_answer_action_start_TTS',
/** 原名: chat_area_report_message */
/** Original name: chat_area_report_message */
ReportMessage = 'chat_answer_action_message_feedback',
/** 原名: chat_area_copy_text_message */
/** Original name: chat_area_copy_text_message */
CopyTextMessage = 'chat_answer_action_copy_text_message',
}

View File

@@ -30,13 +30,13 @@ export const getShowFeedback = ({
>;
latestSectionId: string;
}): boolean => {
// 是否是推送的消息
// Is it a pushed message?
const isPushedMessage = getIsPushedMessage(message);
if (isPushedMessage) {
return false;
}
// 来自最后一个消息组的 final answer
// The final answer from the last message group
return (
meta.isGroupLastAnswerMessage &&
meta.isFromLatestGroup &&

View File

@@ -28,12 +28,12 @@ export const getShowRegenerate = ({
meta: Pick<MessageMeta, 'isFromLatestGroup' | 'sectionId'>;
latestSectionId: string;
}): boolean => {
// 是否是推送的消息
// Is it a pushed message?
const isPushedMessage = getIsPushedMessage(message);
if (isPushedMessage) {
return false;
}
// 来自最后一个消息组
// From the last message group
return getIsLastGroup({ meta, latestSectionId });
};