refactor(core): Require model for utility calls (#7566)

This commit is contained in:
Abhi
2025-09-01 20:28:54 -04:00
committed by GitHub
parent 4fd1113905
commit 5bac855697
4 changed files with 34 additions and 19 deletions

View File

@@ -18,7 +18,7 @@ import {
import { ToolErrorType } from './tool-error.js';
import { getErrorMessage } from '../utils/errors.js';
import type { Config } from '../config/config.js';
import { ApprovalMode } from '../config/config.js';
import { ApprovalMode, DEFAULT_GEMINI_FLASH_MODEL } from '../config/config.js';
import { getResponseText } from '../utils/partUtils.js';
import { fetchWithTimeout, isPrivateIp } from '../utils/fetch.js';
import { convert } from 'html-to-text';
@@ -116,6 +116,7 @@ ${textContent}
[{ role: 'user', parts: [{ text: fallbackPrompt }] }],
{},
signal,
DEFAULT_GEMINI_FLASH_MODEL,
);
const resultText = getResponseText(result) || '';
return {
@@ -193,6 +194,7 @@ ${textContent}
[{ role: 'user', parts: [{ text: userPrompt }] }],
{ tools: [{ urlContext: {} }] },
signal, // Pass signal
DEFAULT_GEMINI_FLASH_MODEL,
);
console.debug(

View File

@@ -10,8 +10,9 @@ import { BaseDeclarativeTool, BaseToolInvocation, Kind } from './tools.js';
import { ToolErrorType } from './tool-error.js';
import { getErrorMessage } from '../utils/errors.js';
import type { Config } from '../config/config.js';
import { type Config } from '../config/config.js';
import { getResponseText } from '../utils/partUtils.js';
import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js';
interface GroundingChunkWeb {
uri?: string;
@@ -78,6 +79,7 @@ class WebSearchToolInvocation extends BaseToolInvocation<
[{ role: 'user', parts: [{ text: this.params.query }] }],
{ tools: [{ googleSearch: {} }] },
signal,
DEFAULT_GEMINI_FLASH_MODEL,
);
const responseText = getResponseText(response);