({toolOptions, disabled, dispatch, t})
| 112 | * @constructor |
| 113 | */ |
| 114 | export const SkillContent = ({toolOptions, disabled, dispatch, t}) => { |
| 115 | const shape = useShapeContext(); |
| 116 | |
| 117 | /** |
| 118 | * 根据标签类型返回不同的Icon |
| 119 | * |
| 120 | * @param tags 工具标签 |
| 121 | */ |
| 122 | const getIcon = (tags) => { |
| 123 | if (tags.includes(TOOL_TYPE.WATER_FLOW)) { |
| 124 | return WorkflowIcon; |
| 125 | } else { |
| 126 | return ToolIcon; |
| 127 | } |
| 128 | }; |
| 129 | |
| 130 | /** |
| 131 | * 获取工具类型 |
| 132 | * |
| 133 | * @param tags 工具标签 |
| 134 | * @returns {{}} 类型 |
| 135 | */ |
| 136 | const getType = (tags) => { |
| 137 | if (tags.includes(TOOL_TYPE.WATER_FLOW)) { |
| 138 | return 'workflow'; |
| 139 | } else { |
| 140 | return 'tool'; |
| 141 | } |
| 142 | }; |
| 143 | |
| 144 | /** |
| 145 | * 删除工具 |
| 146 | * |
| 147 | * @param itemId 知识库id |
| 148 | */ |
| 149 | const handleDelete = (itemId) => { |
| 150 | dispatch({type: 'deleteTool', value: itemId}); |
| 151 | }; |
| 152 | |
| 153 | /** |
| 154 | * 查看工具详情 |
| 155 | * |
| 156 | * @param item 条目,具体是一个工具的对象 |
| 157 | */ |
| 158 | const handleViewDetails = (e, item) => { |
| 159 | e.preventDefault(); |
| 160 | e.stopPropagation(); // 阻止事件冒泡 |
| 161 | |
| 162 | // 获取 appId 和 tenantId |
| 163 | const appId = item.appId; |
| 164 | const tenantId = item.tenantId; |
| 165 | |
| 166 | // 如果有 appId 和 tenantId,则跳转到工具流详情页 |
| 167 | if (appId && tenantId) { |
| 168 | // 获取 endpoint 配置 |
| 169 | const config = shape?.graph?.configs?.find(node => node.node === 'llmNodeState'); |
| 170 | const endpoint = config?.urls?.endpoint || window.location.origin; |
| 171 |
nothing calls this directly
no test coverage detected