mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-06 08:18:39 +00:00
fix(ollama): pass baseUrl from UI when testing connection
This commit is contained in:
parent
dea2b72a0a
commit
87ccbe19ea
3 changed files with 13 additions and 3 deletions
|
|
@ -582,6 +582,8 @@ export interface WebviewMessage {
|
|||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
settings?: any
|
||||
url?: string // For openExternal
|
||||
ollamaBaseUrl?: string // For testOllamaConnection - allows passing current value from UI
|
||||
ollamaApiKey?: string // For testOllamaConnection - allows passing current value from UI
|
||||
mpItem?: MarketplaceItem
|
||||
mpInstallOptions?: InstallMarketplaceItemOptions
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
|
|
|
|||
|
|
@ -1030,8 +1030,12 @@ export const webviewMessageHandler = async (
|
|||
case "testOllamaConnection": {
|
||||
const { testOllamaConnection } = await import("../../api/providers/fetchers/ollama")
|
||||
const { apiConfiguration: ollamaApiConfig } = await provider.getState()
|
||||
// Use the baseUrl and apiKey from the message if provided (current UI values),
|
||||
// otherwise fall back to saved state
|
||||
const baseUrl = message.ollamaBaseUrl ?? ollamaApiConfig.ollamaBaseUrl
|
||||
const apiKey = message.ollamaApiKey ?? ollamaApiConfig.ollamaApiKey
|
||||
try {
|
||||
const result = await testOllamaConnection(ollamaApiConfig.ollamaBaseUrl, ollamaApiConfig.ollamaApiKey, {
|
||||
const result = await testOllamaConnection(baseUrl, apiKey, {
|
||||
timeout: ollamaApiConfig.ollamaModelDiscoveryTimeout ?? 10000,
|
||||
enableLogging: ollamaApiConfig.ollamaEnableLogging ?? false,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -117,8 +117,12 @@ export const Ollama = ({ apiConfiguration, setApiConfigurationField }: OllamaPro
|
|||
const handleTestConnection = useCallback(() => {
|
||||
setTestingConnection(true)
|
||||
setTestResult(null)
|
||||
vscode.postMessage({ type: "testOllamaConnection" })
|
||||
}, [])
|
||||
vscode.postMessage({
|
||||
type: "testOllamaConnection",
|
||||
ollamaBaseUrl: apiConfiguration?.ollamaBaseUrl || "",
|
||||
ollamaApiKey: apiConfiguration?.ollamaApiKey || "",
|
||||
})
|
||||
}, [apiConfiguration?.ollamaBaseUrl, apiConfiguration?.ollamaApiKey])
|
||||
|
||||
const handleRefreshModels = useCallback(() => {
|
||||
setRefreshingModels(true)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue