mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-17 17:41:24 -07:00
Disallow unnecessary awaits. (#15172)
This commit is contained in:
committed by
GitHub
parent
3e9a0a7628
commit
7f2d33458a
@@ -48,7 +48,7 @@ describe('chatCommand', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
mockGetHistory = vi.fn().mockReturnValue([]);
|
||||
mockGetChat = vi.fn().mockResolvedValue({
|
||||
mockGetChat = vi.fn().mockReturnValue({
|
||||
getHistory: mockGetHistory,
|
||||
});
|
||||
mockSaveCheckpoint = vi.fn().mockResolvedValue(undefined);
|
||||
|
||||
@@ -121,7 +121,7 @@ const saveCommand: SlashCommand = {
|
||||
}
|
||||
}
|
||||
|
||||
const chat = await config?.getGeminiClient()?.getChat();
|
||||
const chat = config?.getGeminiClient()?.getChat();
|
||||
if (!chat) {
|
||||
return {
|
||||
type: 'message',
|
||||
@@ -332,7 +332,7 @@ const shareCommand: SlashCommand = {
|
||||
};
|
||||
}
|
||||
|
||||
const chat = await context.services.config?.getGeminiClient()?.getChat();
|
||||
const chat = context.services.config?.getGeminiClient()?.getChat();
|
||||
if (!chat) {
|
||||
return {
|
||||
type: 'message',
|
||||
|
||||
@@ -15,7 +15,7 @@ export const copyCommand: SlashCommand = {
|
||||
kind: CommandKind.BUILT_IN,
|
||||
autoExecute: true,
|
||||
action: async (context, _args): Promise<SlashCommandActionReturn | void> => {
|
||||
const chat = await context.services.config?.getGeminiClient()?.getChat();
|
||||
const chat = context.services.config?.getGeminiClient()?.getChat();
|
||||
const history = chat?.getHistory();
|
||||
|
||||
// Get the last message from the AI (model role)
|
||||
|
||||
@@ -85,7 +85,7 @@ describe('mcpCommand', () => {
|
||||
}),
|
||||
getMcpServers: vi.fn().mockReturnValue({}),
|
||||
getBlockedMcpServers: vi.fn().mockReturnValue([]),
|
||||
getPromptRegistry: vi.fn().mockResolvedValue({
|
||||
getPromptRegistry: vi.fn().mockReturnValue({
|
||||
getAllPrompts: vi.fn().mockReturnValue([]),
|
||||
getPromptsByServer: vi.fn().mockReturnValue([]),
|
||||
}),
|
||||
|
||||
@@ -216,7 +216,7 @@ const listAction = async (
|
||||
const allTools = toolRegistry.getAllTools();
|
||||
const mcpTools = allTools.filter((tool) => tool instanceof DiscoveredMCPTool);
|
||||
|
||||
const promptRegistry = await config.getPromptRegistry();
|
||||
const promptRegistry = config.getPromptRegistry();
|
||||
const mcpPrompts = promptRegistry
|
||||
.getAllPrompts()
|
||||
.filter(
|
||||
|
||||
@@ -85,7 +85,7 @@ export const memoryCommand: SlashCommand = {
|
||||
);
|
||||
|
||||
try {
|
||||
const config = await context.services.config;
|
||||
const config = context.services.config;
|
||||
if (config) {
|
||||
const { memoryContent, fileCount } =
|
||||
await refreshServerHierarchicalMemory(config);
|
||||
|
||||
@@ -116,7 +116,7 @@ async function restoreAction(
|
||||
} else if (action.type === 'load_history' && loadHistory) {
|
||||
loadHistory(action.history);
|
||||
if (action.clientHistory) {
|
||||
await config?.getGeminiClient()?.setHistory(action.clientHistory);
|
||||
config?.getGeminiClient()?.setHistory(action.clientHistory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user