Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions server/app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,12 @@ const mount = async (
runningScript = null;
}

const stateTools = (state.tools || []).filter((t) => t !== tool);
// find the root tool and then remove the tool
for (let block of script) {
if (block.type === 'tool') {
if (!block.tools) break;
const stateTools = (state.tools || []).filter((t) => t !== tool);
block.tools = [...new Set(block.tools, ...stateTools)];
block.tools = [...new Set(block.tools.filter((t) => t !== tool))];
break;
}
}
Expand All @@ -338,7 +338,7 @@ const mount = async (

opts.chatState = JSON.stringify(currentState);
state.chatState = JSON.stringify(currentState);
state.tools = state.tools.filter((t) => t !== tool);
state.tools = stateTools;

if (threadID) {
fs.writeFile(statePath, JSON.stringify(state), (err) => {
Expand Down