Merge pull request #8584 from continuedev/dallin/slash-command-telemetry

fix: useSlashCommand telemetry
This commit is contained in:
Dallin Romney 2025-11-07 12:57:24 -08:00 • committed by GitHub
commit d75a3f34f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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];