-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix: add error reporting and timeouts for Ollama external server connections #11470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ export const Ollama = ({ apiConfiguration, setApiConfigurationField }: OllamaPro | |
| const { t } = useAppTranslation() | ||
|
|
||
| const [ollamaModels, setOllamaModels] = useState<ModelRecord>({}) | ||
| const [connectionError, setConnectionError] = useState<string | undefined>() | ||
| const routerModels = useRouterModels() | ||
|
|
||
| const handleInputChange = useCallback( | ||
|
|
@@ -41,6 +42,8 @@ export const Ollama = ({ apiConfiguration, setApiConfigurationField }: OllamaPro | |
| { | ||
| const newModels = message.ollamaModels ?? {} | ||
| setOllamaModels(newModels) | ||
| // Surface connection errors from the backend | ||
| setConnectionError(message.error) | ||
| } | ||
| break | ||
| } | ||
|
|
@@ -100,6 +103,7 @@ export const Ollama = ({ apiConfiguration, setApiConfigurationField }: OllamaPro | |
| </div> | ||
| </VSCodeTextField> | ||
| )} | ||
| {connectionError && <div className="text-sm text-vscode-errorForeground">{connectionError}</div>} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicate error display: Fix it with Roo Code or mention @roomote and request a fix. |
||
| <ModelPicker | ||
| apiConfiguration={apiConfiguration} | ||
| setApiConfigurationField={setApiConfigurationField} | ||
|
|
@@ -108,7 +112,7 @@ export const Ollama = ({ apiConfiguration, setApiConfigurationField }: OllamaPro | |
| modelIdKey="ollamaModelId" | ||
| serviceName="Ollama" | ||
| serviceUrl="https://ollama.ai" | ||
| errorMessage={modelNotAvailableError} | ||
| errorMessage={connectionError ?? modelNotAvailableError} | ||
| hidePricing | ||
| /> | ||
| <VSCodeTextField | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
tryblock starting at line 85 encompasses both the/api/tagsrequest and thePromise.allof individual/api/showcalls. If/api/tagssucceeds but a single model's/api/showcall fails (e.g., times out on a large model),Promise.allrejects and this catch block produces a connection-level error like "Connection to Ollama at ... timed out" -- which is misleading since the server IS reachable. Consider wrapping individual/api/showcalls with their own error handling (or usingPromise.allSettled) so that one model's failure doesn't discard all successfully-fetched models and produce a false connection error.Fix it with Roo Code or mention @roomote and request a fix.