fix: apply model-attached tools in multi-model chats

In multi-model (compare) chats, tools attached to a model were not applied because the per-model request builder derived tool IDs only from the composer's selected tools, which are not reliably populated per model in that mode. Union each model's own attached tool IDs (limited to installed tools) into its request payload so model tools apply regardless of the composer selection state.

Signed-off-by: Naveen R. Iyer <iyernaveenr@gmail.com>
This commit is contained in:
Naveen R. Iyer 2026-07-13 11:18:56 -05:00
parent 09d4cccb79
commit 4c2f73b648

View file

@ -2528,7 +2528,12 @@
const toolIds = [];
const toolServerIds = [];
for (const toolId of selectedToolIds) {
// Include this model's own attached tools so they apply in multi-model chats,
// independent of the composer's selectedToolIds lifecycle.
const modelDefaultToolIds = (model?.info?.meta?.toolIds ?? []).filter((id) =>
$tools.find((t) => t.id === id)
);
for (const toolId of [...new Set([...selectedToolIds, ...modelDefaultToolIds])]) {
if (toolId.startsWith('direct_server:')) {
let serverId = toolId.replace('direct_server:', '');
// Check if serverId is a number