Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

index.ts: fold the teammate-skills stage line into the next one, so index.ts does not grow

milind-soni0695b1fd8eec
diff --git a/server/index.ts b/server/index.ts
index abbe149e79..d1e286b8f7 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -13410,8 +13410,7 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse) => {
if (!connectorThread(from.id, fromThreadId)) {
return json(res, 403, { error: "source conversation does not belong to sender" });
}
- if (received.action === "teammates") { const staged = teammateSkills.stage(from, fromThreadId, received, appliesDirectly(from.id, fromThreadId)); return json(res, staged.status, staged.body); }
- const everywhere = await allBotsSkills.stage(from, fromThreadId, received, () => appliesDirectly(from.id, fromThreadId), (asked) => importedSkillRequest(asked, fetch, callSignal, () => skillImportToken(gitAudience(fromThreadId))), () => internalCapabilityIsActive(internalCapability) && skillAuthoringEnabled(cfg), () => (CLOUD_TEAM ? actingPeople.requester(fromThreadId, internalCapability.generation) : null)); if (everywhere) return json(res, everywhere.status, everywhere.body); if (isSkillSwitchAction(received.action)) { const staged = skillSwitch.stage(from, fromThreadId, received.action, received, appliesDirectly(from.id, fromThreadId)); return json(res, staged.status, staged.body); }
+ if (received.action === "teammates") { const staged = teammateSkills.stage(from, fromThreadId, received, appliesDirectly(from.id, fromThreadId)); return json(res, staged.status, staged.body); } const everywhere = await allBotsSkills.stage(from, fromThreadId, received, () => appliesDirectly(from.id, fromThreadId), (asked) => importedSkillRequest(asked, fetch, callSignal, () => skillImportToken(gitAudience(fromThreadId))), () => internalCapabilityIsActive(internalCapability) && skillAuthoringEnabled(cfg), () => (CLOUD_TEAM ? actingPeople.requester(fromThreadId, internalCapability.generation) : null)); if (everywhere) return json(res, everywhere.status, everywhere.body); if (isSkillSwitchAction(received.action)) { const staged = skillSwitch.stage(from, fromThreadId, received.action, received, appliesDirectly(from.id, fromThreadId)); return json(res, staged.status, staged.body); }
const body = await importedSkillRequest(received, fetch, callSignal, () => skillImportToken(gitAudience(fromThreadId))); if ("importError" in body) return json(res, 422, { error: body.importError }); if (!internalCapabilityIsActive(internalCapability)) return json(res, 401, { error: TURN_ENDED_REFUSAL }); if (!skillAuthoringEnabled(cfg)) return json(res, 403, { error: "skill authoring is not enabled in Settings" });
const direct = appliesDirectly(from.id, fromThreadId);
const persistence = skillProposalPersistence(from.id, fromThreadId, !direct);