From e6541b63da2da08e0a55a93dbc8a00a529057897 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 3 Nov 2025 23:44:05 -0800 Subject: [PATCH] fix: useSlashCommand for all slash commands --- core/llm/streamChat.ts | 7 ------- .../TipTapEditor/utils/renderSlashCommand.ts | 11 +++++++++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/core/llm/streamChat.ts b/core/llm/streamChat.ts index 4fba3b226..ec1f046c5 100644 --- a/core/llm/streamChat.ts +++ b/core/llm/streamChat.ts @@ -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`, diff --git a/gui/src/components/mainInput/TipTapEditor/utils/renderSlashCommand.ts b/gui/src/components/mainInput/TipTapEditor/utils/renderSlashCommand.ts index 8da2ed89d..da0c5736a 100644 --- a/gui/src/components/mainInput/TipTapEditor/utils/renderSlashCommand.ts +++ b/gui/src/components/mainInput/TipTapEditor/utils/renderSlashCommand.ts @@ -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];