fix: click tool not show current

This commit is contained in:
Joel
2026-01-16 17:52:40 +08:00
parent 0b33381efb
commit 3147e850be
2 changed files with 17 additions and 1 deletions

View File

@ -333,6 +333,8 @@ const ToolBlockComponent: FC<ToolBlockComponentProps> = ({
onMouseDown={() => {
if (!currentProvider || !currentTool)
return
if (configuredToolValue)
setToolValue(configuredToolValue)
setIsSettingOpen(true)
}}
>

View File

@ -78,7 +78,21 @@ const SkillDocEditor: FC = () => {
return
if (dirtyMetadataIds.has(activeTabId))
return
storeApi.getState().setFileMetadata(activeTabId, fileContent.metadata ?? {})
let nextMetadata: Record<string, any> = {}
if (fileContent.metadata) {
if (typeof fileContent.metadata === 'string') {
try {
nextMetadata = JSON.parse(fileContent.metadata)
}
catch {
nextMetadata = {}
}
}
else {
nextMetadata = fileContent.metadata
}
}
storeApi.getState().setFileMetadata(activeTabId, nextMetadata)
storeApi.getState().clearDraftMetadata(activeTabId)
}, [activeTabId, dirtyMetadataIds, fileContent, storeApi])