Skip to content

Commit e3d608d

Browse files
committed
chore(browser): remove legacy browserCapability helper and tests; rely solely on supportsImages gating
1 parent f964953 commit e3d608d

File tree

7 files changed

+16
-70
lines changed

7 files changed

+16
-70
lines changed

packages/types/src/model.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ export const modelInfoSchema = z.object({
5757
maxThinkingTokens: z.number().nullish(),
5858
contextWindow: z.number(),
5959
supportsImages: z.boolean().optional(),
60-
6160
supportsPromptCache: z.boolean(),
6261
// Capability flag to indicate whether the model supports an output verbosity parameter
6362
supportsVerbosity: z.boolean().optional(),

src/core/task/Task.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ import { ClineApiReqCancelReason, ClineApiReqInfo } from "../../shared/Extension
5353
import { getApiMetrics, hasTokenUsageChanged } from "../../shared/getApiMetrics"
5454
import { ClineAskResponse } from "../../shared/WebviewMessage"
5555
import { defaultModeSlug, getModeBySlug, getGroupName } from "../../shared/modes"
56-
import { computeCanUseBrowserTool } from "../../shared/browserCapability"
5756
import { DiffStrategy } from "../../shared/tools"
5857
import { EXPERIMENT_IDS, experiments } from "../../shared/experiments"
5958
import { getModelMaxOutputTokens } from "../../shared/api"
@@ -2420,12 +2419,11 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
24202419
const modeConfig = getModeBySlug(mode ?? defaultModeSlug, customModes)
24212420
const modeSupportsBrowser = modeConfig?.groups.some((group) => getGroupName(group) === "browser") ?? false
24222421

2423-
const canUseBrowserTool = computeCanUseBrowserTool(
2424-
this.api.getModel().info,
2425-
modeSupportsBrowser,
2426-
browserToolEnabled,
2427-
apiConfiguration,
2428-
)
2422+
// Check if model supports browser capability (images)
2423+
const modelInfo = this.api.getModel().info
2424+
const modelSupportsBrowser = (modelInfo as any)?.supportsImages === true
2425+
2426+
const canUseBrowserTool = modelSupportsBrowser && modeSupportsBrowser && (browserToolEnabled ?? true)
24292427

24302428
return SYSTEM_PROMPT(
24312429
provider.context,

src/core/webview/generateSystemPrompt.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { WebviewMessage } from "../../shared/WebviewMessage"
33
import { defaultModeSlug, getModeBySlug, getGroupName } from "../../shared/modes"
44
import { buildApiHandler } from "../../api"
55
import { experiments as experimentsModule, EXPERIMENT_IDS } from "../../shared/experiments"
6-
import { computeCanUseBrowserTool } from "../../shared/browserCapability"
76

87
import { SYSTEM_PROMPT } from "../prompts/system"
98
import { MultiSearchReplaceDiffStrategy } from "../diff/strategies/multi-search-replace"
@@ -61,14 +60,12 @@ export const generateSystemPrompt = async (provider: ClineProvider, message: Web
6160
const modeConfig = getModeBySlug(mode, customModes)
6261
const modeSupportsBrowser = modeConfig?.groups.some((group) => getGroupName(group) === "browser") ?? false
6362

63+
// Check if model supports browser capability (images)
64+
const modelSupportsBrowser = modelInfo && (modelInfo as any)?.supportsImages === true
65+
6466
// Only enable browser tools if the model supports it, the mode includes browser tools,
6567
// and browser tools are enabled in settings
66-
const canUseBrowserTool = computeCanUseBrowserTool(
67-
modelInfo,
68-
modeSupportsBrowser,
69-
browserToolEnabled,
70-
apiConfiguration,
71-
)
68+
const canUseBrowserTool = modelSupportsBrowser && modeSupportsBrowser && (browserToolEnabled ?? true)
7269

7370
const systemPrompt = await SYSTEM_PROMPT(
7471
provider.context,

src/shared/__tests__/browserCapability.spec.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/shared/browserCapability.ts

Lines changed: 0 additions & 34 deletions
This file was deleted.

webview-ui/src/components/welcome/RooTips.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ const RooTips = () => {
2828
<Trans
2929
i18nKey="chat:about"
3030
components={{
31-
DocsLink: <span>the docs</span>,
31+
DocsLink: (
32+
<a href={buildDocLink("", "welcome")} target="_blank" rel="noopener noreferrer">
33+
the docs
34+
</a>
35+
),
3236
}}
3337
/>
3438
</p>

webview-ui/src/components/welcome/__tests__/RooTips.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ describe("RooTips Component", () => {
3939
})
4040

4141
test("renders only the top two tips", () => {
42-
// Ensure only the two tip links are present (docs text is no longer a link)
43-
expect(screen.getAllByRole("link")).toHaveLength(2)
42+
// Ensure only two tips are present plus the docs link in the Trans component (3 total links)
43+
expect(screen.getAllByRole("link")).toHaveLength(3)
4444
})
4545
})
4646
})

0 commit comments

Comments
 (0)