mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
enable async tool discovery by making the registry accessor async; remove call to discoverTools that caused duplicate discovery (#691)
This commit is contained in:
@@ -42,7 +42,6 @@ describe('runNonInteractive', () => {
|
||||
startChat: vi.fn().mockResolvedValue(mockChat),
|
||||
} as unknown as GeminiClient;
|
||||
mockToolRegistry = {
|
||||
discoverTools: vi.fn().mockResolvedValue(undefined),
|
||||
getFunctionDeclarations: vi.fn().mockReturnValue([]),
|
||||
getTool: vi.fn(),
|
||||
} as unknown as ToolRegistry;
|
||||
@@ -82,7 +81,6 @@ describe('runNonInteractive', () => {
|
||||
await runNonInteractive(mockConfig, 'Test input');
|
||||
|
||||
expect(mockGeminiClient.startChat).toHaveBeenCalled();
|
||||
expect(mockToolRegistry.discoverTools).toHaveBeenCalled();
|
||||
expect(mockChat.sendMessageStream).toHaveBeenCalledWith({
|
||||
message: [{ text: 'Test input' }],
|
||||
config: {
|
||||
|
||||
@@ -40,8 +40,7 @@ export async function runNonInteractive(
|
||||
input: string,
|
||||
): Promise<void> {
|
||||
const geminiClient = new GeminiClient(config);
|
||||
const toolRegistry: ToolRegistry = config.getToolRegistry();
|
||||
await toolRegistry.discoverTools();
|
||||
const toolRegistry: ToolRegistry = await config.getToolRegistry();
|
||||
|
||||
const chat = await geminiClient.startChat();
|
||||
const abortController = new AbortController();
|
||||
|
||||
@@ -138,7 +138,7 @@ export async function handleAtCommand({
|
||||
const atPathToResolvedSpecMap = new Map<string, string>();
|
||||
const contentLabelsForDisplay: string[] = [];
|
||||
|
||||
const toolRegistry = config.getToolRegistry();
|
||||
const toolRegistry = await config.getToolRegistry();
|
||||
const readManyFilesTool = toolRegistry.getTool('read_many_files');
|
||||
const globTool = toolRegistry.getTool('glob');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user