Skip to content
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

fix: return 'true' from enabled if API call returns 405 Method Not Allowed #79

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/llms/vector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ export const enabled = async () => {
// Finally, check if the vector search API is available.
try {
await getBackendSrv().get(`${LLM_PLUGIN_ROUTE}/resources/vector/search`, undefined, undefined, {
showSuccessAlert: false, showErrorAlert: false,
responseType: "text",
showSuccessAlert: false,
showErrorAlert: false,
});
return true;
} catch (e: unknown) {
Expand All @@ -125,6 +127,11 @@ export const enabled = async () => {
loggedWarning = true;
}
}
// If the backend returns 405 Method Not Allowed then we've made it through to the
// handler, and it must be enabled.
if ((e as FetchError).status === 405) {
return true;
}
return false;
}
};