chore: replace all cn comments of fe to en version by volc api (#320)
This commit is contained in:
@@ -24,7 +24,7 @@ import {
|
||||
} from '../../typings/event';
|
||||
|
||||
/**
|
||||
* 内部使用的方法,不对外使用,用于抛出事件
|
||||
* Methods used internally, not externally, for throwing events
|
||||
*/
|
||||
export const useAgentModalTriggerEvent = () => {
|
||||
const { emit } = useEvent();
|
||||
|
||||
@@ -20,7 +20,7 @@ import { type AgentSkillKey } from '@coze-agent-ide/tool-config';
|
||||
import { useAbilityAreaContext } from '../../context/ability-area-context';
|
||||
|
||||
/**
|
||||
* @deprecated 内部使用,过渡期方案,针对非注册组件使用外部的skill设置
|
||||
* @Deprecated internal use, transition scenario, using external skill settings for non-registered components
|
||||
*/
|
||||
export const useHasAgentSkillWithPK = () => {
|
||||
const {
|
||||
@@ -35,7 +35,7 @@ export const useHasAgentSkillWithPK = () => {
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated 内部使用,过渡期
|
||||
* @deprecated internal use, transition period
|
||||
*/
|
||||
const setHasAgentSkill = (
|
||||
agentSkillKey: AgentSkillKey,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import { useAbilityConfigContext } from '../../context/ability-config-context';
|
||||
|
||||
/**
|
||||
* 用户内部获取ToolKey使用
|
||||
* Users obtain ToolKey usage internally
|
||||
*/
|
||||
export const useAbilityConfig = () => {
|
||||
const { abilityKey, scope } = useAbilityConfigContext();
|
||||
|
||||
@@ -19,7 +19,7 @@ import { type AgentSkillKey } from '@coze-agent-ide/tool-config';
|
||||
import { useAbilityAreaContext } from '../../context/ability-area-context';
|
||||
|
||||
/**
|
||||
* 用于内部注册AgentSkill使用
|
||||
* For internal registration AgentSkill use
|
||||
*/
|
||||
export const useRegisterAgentSkillKey = () => {
|
||||
const {
|
||||
|
||||
@@ -20,7 +20,7 @@ import { type IRegisteredToolKeyConfig } from '../../store/tool-area';
|
||||
import { useAbilityAreaContext } from '../../context/ability-area-context';
|
||||
|
||||
/**
|
||||
* 用于内部注册Tool使用
|
||||
* For Internal Registration Tool Use
|
||||
*/
|
||||
export const useRegisterToolKey = () => {
|
||||
const {
|
||||
|
||||
@@ -30,11 +30,11 @@ import { useAbilityConfig } from '../../builtin/use-ability-config';
|
||||
import { toolKeyToApiStatusKeyTransformer } from '../../../utils/tool-content-block';
|
||||
|
||||
/**
|
||||
* 用于校验当前模块默认展开收起状态
|
||||
* Used to verify the default expanded and stowed state of the current module
|
||||
*
|
||||
* @param blockKey 主键 - tool 插件化改造后无需传入
|
||||
* @param configured 是否有配置内容
|
||||
* @param when 是否校验
|
||||
* @Param blockKey primary key - no need to pass in after tool plugin transformation
|
||||
* @param configured whether there is configuration content
|
||||
* Check when @param
|
||||
*
|
||||
* @see
|
||||
*/
|
||||
@@ -56,18 +56,18 @@ export const useToolContentBlockDefaultExpand = (
|
||||
})),
|
||||
);
|
||||
return useMemo(() => {
|
||||
// 不做校验
|
||||
// No verification
|
||||
if (!$when) {
|
||||
return undefined;
|
||||
// 状态机未就绪
|
||||
// Finite-state machine not ready
|
||||
} else if (!init || size(botSkillBlockCollapsibleState) === 0) {
|
||||
return undefined;
|
||||
/**
|
||||
* @description 仅在满足以下条件时用户行为记录才能生效
|
||||
* @Description A user behavior record is only valid if the following conditions are met
|
||||
*
|
||||
* 1. 拥有编辑权限
|
||||
* 2. 不能是历史预览环境
|
||||
* 3. 必须已配置
|
||||
* 1. Have editing rights
|
||||
* 2. Cannot be a historical preview environment
|
||||
* 3. Must be configured
|
||||
*/
|
||||
} else if (editable && !isReadonly && configured) {
|
||||
const key = abilityKey ?? blockKey;
|
||||
|
||||
@@ -59,8 +59,8 @@ export const useToolValidData = () => {
|
||||
});
|
||||
|
||||
/**
|
||||
* 异常场景兜底,视图和服务端数据无法匹配,需要触发更新服务端数据
|
||||
* 有数据但是隐藏状态
|
||||
* Abnormal scene cover, view and server level data cannot match, need to trigger update server level data
|
||||
* There is data but hidden state
|
||||
*/
|
||||
if (toolStatus === TabStatus.Hide && hasValidData) {
|
||||
setBotSkillBlockCollapsibleState(
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { useEffect } from 'react';
|
||||
|
||||
import { useShallow } from 'zustand/react/shallow';
|
||||
@@ -40,7 +40,7 @@ const KEY_MAP = {
|
||||
[AbilityScope.AGENT_SKILL]: AGENT_SKILL_KEY_MAP,
|
||||
};
|
||||
|
||||
// 访问全局状态机中的状态
|
||||
// Access state in the global fine-state machine
|
||||
export function useToolStore<U>(selector: (state: BotSkillStore) => U): U {
|
||||
const { abilityKey } = useAbilityConfig();
|
||||
|
||||
@@ -51,7 +51,7 @@ export function useToolStore<U>(selector: (state: BotSkillStore) => U): U {
|
||||
return useBotSkillStore(selector) as U;
|
||||
}
|
||||
|
||||
// 访问全局状态机中的方法
|
||||
// Access methods in the global fine-state machine
|
||||
export function useToolStoreAction<U>(
|
||||
selector: (state: BotSkillAction) => U,
|
||||
): U {
|
||||
@@ -64,7 +64,7 @@ export function useToolStoreAction<U>(
|
||||
return useBotSkillStore(selector) as U;
|
||||
}
|
||||
|
||||
// 提交数据
|
||||
// submit data
|
||||
export function useToolDispatch<T>() {
|
||||
const { abilityKey, scope } = useAbilityConfig();
|
||||
|
||||
@@ -78,16 +78,16 @@ export function useToolDispatch<T>() {
|
||||
setState({
|
||||
[scope]: {
|
||||
...state[scope],
|
||||
// @ts-expect-error -- 以后想着解决一下这里的类型问题
|
||||
// @ts-expect-error -- I want to solve the type problem here in the future
|
||||
[KEY_MAP[scope][abilityKey]]: newState,
|
||||
},
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// 监听 tool 状态机数据变化,并同步到 bot detail store
|
||||
// Monitor tool fine-state machine data changes and sync to bot detail store
|
||||
export function useSubscribeToolStore(scope: AbilityScope, agentId?: string) {
|
||||
// bot detail store 更新方法
|
||||
// Bot detail store update method
|
||||
const { setBotSkill } = useBotSkillStore(
|
||||
useShallow(state => ({
|
||||
setBotSkill: state.setBotSkill,
|
||||
@@ -99,11 +99,11 @@ export function useSubscribeToolStore(scope: AbilityScope, agentId?: string) {
|
||||
})),
|
||||
);
|
||||
|
||||
// tools store 数据
|
||||
// Tools store data
|
||||
const { state } = useAbilityStoreContext();
|
||||
const newState = state[scope];
|
||||
|
||||
// 同步数据
|
||||
// synchronize data
|
||||
useEffect(() => {
|
||||
if (size(newState)) {
|
||||
if (!newState) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import { EventCenterEventName } from '../../typings/scoped-events';
|
||||
import { type IToggleContentBlockEventParams } from '../../typings/event';
|
||||
|
||||
/**
|
||||
* 私有的hooks,不对外暴露使用
|
||||
* Private hooks, not exposed to the outside world
|
||||
* @returns
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user