diff --git a/src/chat/askAgentAboutActivityLog/askAgentAboutActivityLog.ts b/src/chat/askAgentAboutActivityLog/askAgentAboutActivityLog.ts index 80a7172cd..f67e2306f 100644 --- a/src/chat/askAgentAboutActivityLog/askAgentAboutActivityLog.ts +++ b/src/chat/askAgentAboutActivityLog/askAgentAboutActivityLog.ts @@ -5,6 +5,7 @@ import { IActionContext } from "@microsoft/vscode-azext-utils"; import * as vscode from "vscode"; +import { ensureCopilotChatReady } from "../../commands/copilotOnRails/openChatWithAgent"; import { ext } from "../../extensionVariables"; import { ActivityItem } from "../../tree/activityLog/ActivityItem"; import { TreeDataItem } from "../../tree/ResourceGroupsItem"; @@ -45,6 +46,10 @@ export async function askAgentAboutActivityLog(context: IActionContext, item?: A } } + if (!(await ensureCopilotChatReady())) { + return; + } + await vscode.commands.executeCommand("workbench.action.chat.newChat"); await vscode.commands.executeCommand("workbench.action.chat.open", { mode: 'agent', query: genericActivityLogPrompt }); } diff --git a/src/chat/askAgentAboutResource.ts b/src/chat/askAgentAboutResource.ts index e0b9d6b53..18bd3d6d3 100644 --- a/src/chat/askAgentAboutResource.ts +++ b/src/chat/askAgentAboutResource.ts @@ -5,6 +5,7 @@ import { IActionContext } from "@microsoft/vscode-azext-utils"; import * as vscode from "vscode"; +import { ensureCopilotChatReady } from "../commands/copilotOnRails/openChatWithAgent"; const agentName = "azure"; @@ -18,6 +19,10 @@ export const askAgentAboutResourcePrompt = vscode.l10n.t(`I'd like to ask you ab export async function askAgentAboutResource(_actionContext: IActionContext, node?: { id?: string, value?: { armId: string }, resource?: { kind?: string } }) { const resourceId = node?.id ?? node?.value?.armId; if (resourceId !== undefined) { + if (!(await ensureCopilotChatReady())) { + return; + } + const prompt = `@${agentName} ${askAgentAboutResourcePrompt}`; await vscode.commands.executeCommand("workbench.action.chat.newChat"); diff --git a/src/chat/askAzure.ts b/src/chat/askAzure.ts index 030806543..95a65e9b9 100644 --- a/src/chat/askAzure.ts +++ b/src/chat/askAzure.ts @@ -5,8 +5,13 @@ import { IActionContext } from "@microsoft/vscode-azext-utils"; import * as vscode from "vscode"; +import { ensureCopilotChatReady } from "../commands/copilotOnRails/openChatWithAgent"; export async function askAzureInCommandPalette(context: IActionContext, prompt?: string) { + if (!(await ensureCopilotChatReady())) { + return; + } + if (!prompt) { prompt = await context.ui.showInputBox({ prompt: vscode.l10n.t(`What do you want to ask about Azure?`) }); }