MCPcopy Create free account
hub / github.com/ModelEngine-Group/app-platform / _SkillForm

Function _SkillForm

agent-flow/src/components/llm/SkillForm.jsx:29–92  ·  view source on GitHub ↗
({toolOptions, disabled})

Source from the content-addressed store, hash-verified

27 * @returns {JSX.Element} 大模型节点技能表单的DOM。
28 */
29const _SkillForm = ({toolOptions, disabled}) => {
30 const dispatch = useDispatch();
31 const shape = useShapeContext();
32 const {t} = useTranslation();
33
34 /**
35 * 添加添加技能的回调函数
36 *
37 * @param event 事件
38 */
39 const onAddSkillClick = event => {
40 event.preventDefault();
41 shape.page.triggerEvent({
42 type: 'SELECT_SKILL',
43 value: {
44 onSelect: onSelect,
45 },
46 });
47 event.stopPropagation();
48 };
49
50 /**
51 * 选择工具后的回调
52 *
53 * @param data 选择的工具数据
54 */
55 const onSelect = (data) => {
56 // 提取 appId 和 tenantId
57 const appId = data.runnables?.APP?.appId;
58 const tenantId = data.schema?.parameters?.properties?.tenantId?.default;
59
60 dispatch({
61 type: 'addSkill',
62 value: data.uniqueName || data,
63 appId: appId,
64 tenantId: tenantId,
65 });
66 };
67
68 return (
69 <JadeCollapse defaultActiveKey={['skillPanel']}>
70 {
71 <Panel
72 key={'skillPanel'}
73 header={
74 <div className='panel-header' style={{display: 'flex', alignItems: 'center', justifyContent: 'flex-start'}}>
75 <span className='jade-panel-header-font'>{t('skill')}</span>
76 <Button disabled={disabled}
77 type='text' className='icon-button jade-panel-header-icon-position'
78 onClick={(event) => {
79 onAddSkillClick(event);
80 }}>
81 <PlusOutlined/>
82 </Button>
83 </div>
84 }
85 className='jade-panel'
86 >

Callers

nothing calls this directly

Calls 3

useDispatchFunction · 0.90
useShapeContextFunction · 0.90
onAddSkillClickFunction · 0.85

Tested by

no test coverage detected