fix: useSlashCommand for all slash commands

This commit is contained in:
Dallin Romney 2025-11-03 23:44:05 -08:00
parent b1cd3e949c
commit e6541b63da
2 changed files with 11 additions and 7 deletions

View file

@ -60,13 +60,6 @@ export async function* llmStreamChat(
if (!slashCommand) {
throw new Error(`Unknown slash command ${command.name}`);
}
void Telemetry.capture(
"useSlashCommand",
{
name: command.name,
},
true,
);
if (!slashCommand.run) {
console.error(
`Slash command ${command.name} (${command.source}) has no run function`,

View file

@ -1,5 +1,6 @@
import { MessagePart, RangeInFile, SlashCommandDescWithSource } from "core";
import { stripImages } from "core/util/messageContent";
import posthog from "posthog-js";
import { IIdeMessenger } from "../../../../context/IdeMessenger";
import { renderMcpPrompt } from "./renderMcpPrompt";
import { getRenderedV1Prompt } from "./renderPromptv1";
@ -36,6 +37,16 @@ export async function renderSlashCommandPrompt(
return NO_COMMAND;
}
try {
posthog.capture("useSlashCommand", {
name: command.name,
source: command.source,
isLegacy: command.isLegacy,
});
} catch (e) {
console.error(e);
}
const nonTextParts = parts.filter((part) => part.type !== "text");
const textParts = parts.filter((part) => part.type === "text");
const slashedParts: MessagePart[] = [...nonTextParts];