chore: replace all cn comments of fe to en version by volc api (#320)
This commit is contained in:
@@ -34,19 +34,19 @@ const LazyBuilderChat = lazy(async () => {
|
||||
|
||||
export interface ChatHistoryProps {
|
||||
/**
|
||||
* 会话 id
|
||||
* session id
|
||||
*/
|
||||
conversationId?: string;
|
||||
/**
|
||||
* 会话名称
|
||||
* session name
|
||||
*/
|
||||
conversationName: string;
|
||||
/**
|
||||
* 渠道 id
|
||||
* Channel ID
|
||||
*/
|
||||
connectorId: string;
|
||||
/**
|
||||
* 创建会话的环境
|
||||
* Create a conversation environment
|
||||
*/
|
||||
createEnv: CreateEnv;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ export const ChatHistory: React.FC<ChatHistoryProps> = ({
|
||||
workflow={{}}
|
||||
project={innerProjectInfo}
|
||||
areaUi={{
|
||||
// 只看会话记录,不可操作
|
||||
// Only look at the session record, not operate
|
||||
isDisabled: true,
|
||||
isNeedClearContext: false,
|
||||
input: {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import { I18n } from '@coze-arch/i18n';
|
||||
|
||||
// 默认会话 unique_id
|
||||
// Default session unique_id
|
||||
export const DEFAULT_UNIQUE_ID = '0';
|
||||
|
||||
export const DEFAULT_CONVERSATION_NAME = 'Default';
|
||||
@@ -31,7 +31,7 @@ export enum ErrorCode {
|
||||
export const MAX_INPUT_LEN = 200;
|
||||
|
||||
/**
|
||||
* 调试的渠道 id
|
||||
* Debug channel id
|
||||
*/
|
||||
export const DEBUG_CONNECTOR_ID = '_10000010';
|
||||
|
||||
@@ -45,12 +45,12 @@ export const API_CONNECTOR_ID = '1024';
|
||||
export const CHAT_SDK_CONNECTOR_ID = '999';
|
||||
export const COZE_CONNECTOR_IDS = [COZE_CONNECTOR_ID, '10000122', '10000129'];
|
||||
/**
|
||||
* 不存在的会话
|
||||
* Conversation that does not exist
|
||||
*/
|
||||
export const DISABLED_CONVERSATION = '0';
|
||||
|
||||
/**
|
||||
* 只展示这些线上渠道,其他的后端不支持 @qiangshunliang
|
||||
* Only show these online channels, other backends do not support @qiangshunliang.
|
||||
*/
|
||||
export const ALLOW_CONNECTORS = [
|
||||
COZE_CONNECTOR_ID,
|
||||
|
||||
@@ -33,7 +33,7 @@ export const EditInput = ({
|
||||
}: {
|
||||
ref?: React.Ref<HTMLInputElement>;
|
||||
/**
|
||||
* 默认值
|
||||
* default value
|
||||
*/
|
||||
defaultValue?: string;
|
||||
/**
|
||||
@@ -41,11 +41,11 @@ export const EditInput = ({
|
||||
*/
|
||||
loading: boolean;
|
||||
/**
|
||||
* 失焦 / 回车后执行的行为
|
||||
* Behavior performed after out of focus/enter
|
||||
*/
|
||||
onBlur?: (input?: string, error?: ErrorCode) => void;
|
||||
/**
|
||||
* 校验函数,返回 true 标识校验通过
|
||||
* Verification function, returns true to indicate that the verification passed
|
||||
*/
|
||||
onValidate?: (input: string) => ErrorCode | undefined;
|
||||
}) => {
|
||||
|
||||
@@ -62,7 +62,7 @@ export const ConversationContent: React.FC<ConversationContentProps> = ({
|
||||
canEdit,
|
||||
}) => {
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
// 顶部的创建弹窗
|
||||
// Create pop-up window at the top
|
||||
const [inputVisible, setInputVisible] = useState(false);
|
||||
const [activateChat, setActivateChat] = useState<
|
||||
ProjectConversation | undefined
|
||||
@@ -97,7 +97,7 @@ export const ConversationContent: React.FC<ConversationContentProps> = ({
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
// 初始化选中接口返回数据。conversationId 可能为 0 要展示空
|
||||
// Initialize the selected interface to return data. conversationId may be 0 to display empty
|
||||
if (!activateChat && staticList?.length) {
|
||||
handleSelectChat(staticList[0]);
|
||||
}
|
||||
@@ -155,7 +155,7 @@ export const ConversationContent: React.FC<ConversationContentProps> = ({
|
||||
) : null;
|
||||
|
||||
useEffect(() => {
|
||||
// 判断会话页是否显示,实现切换tab时刷新列表效果
|
||||
// Determine whether the session page is displayed, and achieve the effect of refreshing the list when switching tabs
|
||||
const value = getURIPathByPathname(pathname);
|
||||
if (value && CONVERSATION_URI.displayName === value) {
|
||||
fetch();
|
||||
|
||||
@@ -134,7 +134,7 @@ export const DynamicChatList = ({
|
||||
!!canEdit &&
|
||||
!!list?.length &&
|
||||
!inBatch &&
|
||||
// 即将支持,敬请期待
|
||||
// Support soon, so stay tuned.
|
||||
FLAGS['bot.automation.conversation_batch_delete'];
|
||||
const exitBatch = () => {
|
||||
setInBatch(false);
|
||||
@@ -151,7 +151,7 @@ export const DynamicChatList = ({
|
||||
const handleBatchDelete = async (items: ProjectConversation[]) => {
|
||||
const ids = items.map(i => i.unique_id).filter((i): i is string => !!i);
|
||||
await onBatchDelete(ids);
|
||||
// 删除成功后退出批量操作模式
|
||||
// Exit batch operation mode after successful deletion
|
||||
exitBatch();
|
||||
};
|
||||
return (
|
||||
|
||||
@@ -70,12 +70,12 @@ const useConversationList = (params: ListProjectConversationDefParams) => {
|
||||
export const useConversationListWithConnector = (
|
||||
params: ConversationListWithConnectorParams,
|
||||
) => {
|
||||
// 静态
|
||||
// static
|
||||
const { list: staticList, fetch: fetchStatic } = useConversationList({
|
||||
create_method: CreateMethod.ManualCreate,
|
||||
...params,
|
||||
});
|
||||
// 动态
|
||||
// dynamic
|
||||
const { list: dynamicList, fetch: fetchDynamic } = useConversationList({
|
||||
create_method: CreateMethod.NodeCreate,
|
||||
...params,
|
||||
|
||||
@@ -68,7 +68,7 @@ export const useDeleteChat = ({
|
||||
}));
|
||||
|
||||
/**
|
||||
* 给外部的 check,用作 replace 请求
|
||||
* To an external check, used as a replace request
|
||||
*/
|
||||
const handleDelete = async (_chat?: ProjectConversation) => {
|
||||
setChat(_chat);
|
||||
@@ -109,7 +109,7 @@ export const useDeleteChat = ({
|
||||
setReplace([]);
|
||||
setVisible(false);
|
||||
Toast.success(I18n.t('wf_chatflow_112'));
|
||||
// 删除成功后刷新列表
|
||||
// Refresh the list after successful deletion
|
||||
manualRefresh();
|
||||
setActivateChat(undefined);
|
||||
} else {
|
||||
|
||||
@@ -59,7 +59,7 @@ export const StaticChatList = ({
|
||||
renderCreateInput: () => React.ReactNode;
|
||||
handleCreateInput?: () => void;
|
||||
}) => {
|
||||
// 存储 session_id
|
||||
// Storage session_id
|
||||
const [editingUniqueId, setEditingUniqueId] = useState('');
|
||||
|
||||
const handleEditSession = (inputStr?: string, error?: ErrorCode) => {
|
||||
@@ -74,8 +74,8 @@ export const StaticChatList = ({
|
||||
};
|
||||
|
||||
/**
|
||||
* ux @wangwenbo.me 设计,default 放在首位,
|
||||
* 剩余的接口返回按照创建先后顺序倒序排序(后创建的放前边)
|
||||
* UX @wangwenbo.me design, default first,
|
||||
* The remaining interfaces are returned in reverse order according to the order in which they were created (the ones created later are placed first).
|
||||
*/
|
||||
return (
|
||||
<>
|
||||
@@ -153,7 +153,7 @@ export const StaticChatList = ({
|
||||
handleSessionVisible(item.unique_id);
|
||||
}}
|
||||
/>
|
||||
{/* 默认会话不可删除 */}
|
||||
{/* Default session cannot be deleted */}
|
||||
<IconButton
|
||||
size="small"
|
||||
color="secondary"
|
||||
|
||||
@@ -36,7 +36,7 @@ export const workflowActions = [
|
||||
hint: '复制到资源库',
|
||||
},
|
||||
{
|
||||
// 切换为 chatflow
|
||||
// Switch to chatflow
|
||||
key: ProjectResourceActionKey.SwitchToChatflow,
|
||||
enable: true,
|
||||
},
|
||||
|
||||
@@ -50,7 +50,7 @@ export const useChangeFlowMode = () => {
|
||||
const uri = getURIByResource('workflow', workflowId);
|
||||
const widgetContext = view.getWidgetContextFromURI(uri);
|
||||
const widgetOpened = Boolean(widgetContext?.widget);
|
||||
// 已经打开的 widget,加 refresh 参数刷新,未打开的直接打开会刷新
|
||||
// For widgets that have been opened, add the refresh parameter to refresh. If they are not opened, they will be refreshed if they are opened directly.
|
||||
navigate(`/workflow/${workflowId}${widgetOpened ? '?refresh=true' : ''}`);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ export const useNameValidators = ({
|
||||
return [
|
||||
{
|
||||
validator(_, value) {
|
||||
// 过滤掉当前资源
|
||||
// Filter out current resources
|
||||
const otherResource = currentResourceRef?.current
|
||||
? workflowResource.filter(
|
||||
r => r.res_id !== currentResourceRef?.current?.res_id,
|
||||
|
||||
@@ -24,8 +24,8 @@ import {
|
||||
} from '@coze-project-ide/framework';
|
||||
|
||||
/**
|
||||
* 注入到 workflow 内 project api 的能力。
|
||||
* 注:非响应式
|
||||
* The ability to inject project APIs into workflow.
|
||||
* Note: non-responsive
|
||||
*/
|
||||
export const useProjectApi = () => {
|
||||
const { sendOpen } = useSendMessageEvent();
|
||||
|
||||
@@ -233,7 +233,7 @@ export const useWorkflowResource = (): UseWorkflowResourceReturn => {
|
||||
subType: WorkflowMode.Workflow,
|
||||
tooltip: <WorkflowTooltip flowMode={WorkflowMode.Workflow} />,
|
||||
},
|
||||
// 开源版本暂不支持对话流
|
||||
// The open-source version does not currently support conversation streaming
|
||||
IS_OPEN_SOURCE
|
||||
? null
|
||||
: {
|
||||
|
||||
@@ -23,7 +23,7 @@ export {
|
||||
|
||||
export { WorkflowWidgetRegistry } from './registry';
|
||||
/**
|
||||
* 会话管理 registry
|
||||
* Session management registry
|
||||
*/
|
||||
export { ConversationRegistry } from './conversation/registry';
|
||||
export { useWorkflowResource } from './hooks/use-workflow-resource';
|
||||
|
||||
Reference in New Issue
Block a user