Skip to content

Commit

Permalink
Improve error message for Ollama 403
Browse files Browse the repository at this point in the history
  • Loading branch information
kepano committed Jan 16, 2025
1 parent 6d7a820 commit c1da800
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/utils/interpreter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ export async function sendToLLM(promptContext: string, content: string, promptVa
if (!response.ok) {
const errorText = await response.text();
console.error(`${provider.name} error response:`, errorText);

// Add specific message for Ollama 403 errors
if (provider.name.toLowerCase().includes('ollama') && response.status === 403) {
throw new Error(
`Ollama cannot process requests originating from a browser extension without setting OLLAMA_ORIGINS. ` +
`See instructions at https://help.obsidian.md/web-clipper/interpreter`
);
}

throw new Error(`${provider.name} error: ${response.statusText} ${errorText}`);
}

Expand Down

0 comments on commit c1da800

Please sign in to comment.