mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-24 06:45:22 +00:00
fixes
This commit is contained in:
@@ -1710,8 +1710,8 @@ function Read(props: ToolProps<typeof ReadTool>) {
|
||||
if (props.part.state.status !== "completed") return []
|
||||
if (props.part.state.time.compacted) return []
|
||||
const value = props.metadata.loaded
|
||||
if (!value) return []
|
||||
return Array.isArray(value) ? value : [value]
|
||||
if (!value || !Array.isArray(value)) return []
|
||||
return value.filter((p): p is string => typeof p === "string")
|
||||
})
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -120,11 +120,9 @@ export namespace InstructionPrompt {
|
||||
if (part.type === "tool" && part.tool === "read" && part.state.status === "completed") {
|
||||
if (part.state.time.compacted) continue
|
||||
const loaded = part.state.metadata?.loaded
|
||||
if (!loaded) continue
|
||||
if (Array.isArray(loaded)) {
|
||||
loaded.forEach((p) => paths.add(p))
|
||||
} else {
|
||||
paths.add(loaded)
|
||||
if (!loaded || !Array.isArray(loaded)) continue
|
||||
for (const p of loaded) {
|
||||
if (typeof p === "string") paths.add(p)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user