Textgen: Add permissions check for TabbyAPI keys

There's no formal permissions checking in ST's UI, so add a temporary
check in the server endpoint before requesting a download.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri
2024-07-07 14:40:24 -04:00
parent 69077f6a6e
commit 0672c8422e
2 changed files with 21 additions and 1 deletions

View File

@@ -526,7 +526,10 @@ async function downloadTabbyModel() {
body: JSON.stringify(params),
});
if (!response.ok) {
if (response.status === 403) {
toastr.error("The provided key has invalid permissions. Please use an admin key for downloading.");
return;
} else if (!response.ok) {
throw new Error(response.statusText);
}