mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
Hide Gemini checkboxes on the welcome view (#6415)
This commit is contained in:
parent
09cf6d0996
commit
d7c1c74fef
3 changed files with 77 additions and 21 deletions
|
|
@ -448,7 +448,11 @@ const ApiOptions = ({
|
|||
)}
|
||||
|
||||
{selectedProvider === "gemini" && (
|
||||
<Gemini apiConfiguration={apiConfiguration} setApiConfigurationField={setApiConfigurationField} />
|
||||
<Gemini
|
||||
apiConfiguration={apiConfiguration}
|
||||
setApiConfigurationField={setApiConfigurationField}
|
||||
fromWelcomeView={fromWelcomeView}
|
||||
/>
|
||||
)}
|
||||
|
||||
{selectedProvider === "openai" && (
|
||||
|
|
|
|||
|
|
@ -12,9 +12,10 @@ import { inputEventTransform } from "../transforms"
|
|||
type GeminiProps = {
|
||||
apiConfiguration: ProviderSettings
|
||||
setApiConfigurationField: (field: keyof ProviderSettings, value: ProviderSettings[keyof ProviderSettings]) => void
|
||||
fromWelcomeView?: boolean
|
||||
}
|
||||
|
||||
export const Gemini = ({ apiConfiguration, setApiConfigurationField }: GeminiProps) => {
|
||||
export const Gemini = ({ apiConfiguration, setApiConfigurationField, fromWelcomeView }: GeminiProps) => {
|
||||
const { t } = useAppTranslation()
|
||||
|
||||
const [googleGeminiBaseUrlSelected, setGoogleGeminiBaseUrlSelected] = useState(
|
||||
|
|
@ -73,26 +74,30 @@ export const Gemini = ({ apiConfiguration, setApiConfigurationField }: GeminiPro
|
|||
/>
|
||||
)}
|
||||
|
||||
<Checkbox
|
||||
className="mt-6"
|
||||
data-testid="checkbox-url-context"
|
||||
checked={!!apiConfiguration.enableUrlContext}
|
||||
onChange={(checked: boolean) => setApiConfigurationField("enableUrlContext", checked)}>
|
||||
{t("settings:providers.geminiParameters.urlContext.title")}
|
||||
</Checkbox>
|
||||
<div className="text-sm text-vscode-descriptionForeground mb-3 mt-1.5">
|
||||
{t("settings:providers.geminiParameters.urlContext.description")}
|
||||
</div>
|
||||
{!fromWelcomeView && (
|
||||
<>
|
||||
<Checkbox
|
||||
className="mt-6"
|
||||
data-testid="checkbox-url-context"
|
||||
checked={!!apiConfiguration.enableUrlContext}
|
||||
onChange={(checked: boolean) => setApiConfigurationField("enableUrlContext", checked)}>
|
||||
{t("settings:providers.geminiParameters.urlContext.title")}
|
||||
</Checkbox>
|
||||
<div className="text-sm text-vscode-descriptionForeground mb-3 mt-1.5">
|
||||
{t("settings:providers.geminiParameters.urlContext.description")}
|
||||
</div>
|
||||
|
||||
<Checkbox
|
||||
data-testid="checkbox-grounding-search"
|
||||
checked={!!apiConfiguration.enableGrounding}
|
||||
onChange={(checked: boolean) => setApiConfigurationField("enableGrounding", checked)}>
|
||||
{t("settings:providers.geminiParameters.groundingSearch.title")}
|
||||
</Checkbox>
|
||||
<div className="text-sm text-vscode-descriptionForeground mb-3 mt-1.5">
|
||||
{t("settings:providers.geminiParameters.groundingSearch.description")}
|
||||
</div>
|
||||
<Checkbox
|
||||
data-testid="checkbox-grounding-search"
|
||||
checked={!!apiConfiguration.enableGrounding}
|
||||
onChange={(checked: boolean) => setApiConfigurationField("enableGrounding", checked)}>
|
||||
{t("settings:providers.geminiParameters.groundingSearch.title")}
|
||||
</Checkbox>
|
||||
<div className="text-sm text-vscode-descriptionForeground mb-3 mt-1.5">
|
||||
{t("settings:providers.geminiParameters.groundingSearch.description")}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -127,4 +127,51 @@ describe("Gemini", () => {
|
|||
expect(mockSetApiConfigurationField).toHaveBeenCalledWith("enableGrounding", true)
|
||||
})
|
||||
})
|
||||
|
||||
describe("fromWelcomeView prop", () => {
|
||||
it("should hide URL context and grounding checkboxes when fromWelcomeView is true, but keep custom base URL", () => {
|
||||
render(
|
||||
<Gemini
|
||||
apiConfiguration={defaultApiConfiguration}
|
||||
setApiConfigurationField={mockSetApiConfigurationField}
|
||||
fromWelcomeView={true}
|
||||
/>,
|
||||
)
|
||||
|
||||
// Should still render custom base URL checkbox
|
||||
expect(screen.getByTestId("checkbox-custom-base-url")).toBeInTheDocument()
|
||||
// Should not render URL context and grounding checkboxes
|
||||
expect(screen.queryByTestId("checkbox-url-context")).not.toBeInTheDocument()
|
||||
expect(screen.queryByTestId("checkbox-grounding-search")).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it("should show all checkboxes when fromWelcomeView is false", () => {
|
||||
render(
|
||||
<Gemini
|
||||
apiConfiguration={defaultApiConfiguration}
|
||||
setApiConfigurationField={mockSetApiConfigurationField}
|
||||
fromWelcomeView={false}
|
||||
/>,
|
||||
)
|
||||
|
||||
// Should render all checkboxes
|
||||
expect(screen.getByTestId("checkbox-custom-base-url")).toBeInTheDocument()
|
||||
expect(screen.getByTestId("checkbox-url-context")).toBeInTheDocument()
|
||||
expect(screen.getByTestId("checkbox-grounding-search")).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it("should show all checkboxes when fromWelcomeView is undefined (default behavior)", () => {
|
||||
render(
|
||||
<Gemini
|
||||
apiConfiguration={defaultApiConfiguration}
|
||||
setApiConfigurationField={mockSetApiConfigurationField}
|
||||
/>,
|
||||
)
|
||||
|
||||
// Should render all checkboxes (default behavior)
|
||||
expect(screen.getByTestId("checkbox-custom-base-url")).toBeInTheDocument()
|
||||
expect(screen.getByTestId("checkbox-url-context")).toBeInTheDocument()
|
||||
expect(screen.getByTestId("checkbox-grounding-search")).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue