mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix eslint
This commit is contained in:
@ -489,13 +489,13 @@ async function downloadTabbyModel() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const repoId = downloadHtml.find('input[name="hf_repo_id"]').val().toString()
|
const repoId = downloadHtml.find('input[name="hf_repo_id"]').val().toString();
|
||||||
if (!repoId) {
|
if (!repoId) {
|
||||||
toastr.error('A HuggingFace repo ID must be provided. Skipping Download.');
|
toastr.error('A HuggingFace repo ID must be provided. Skipping Download.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (repoId.split("/").length !== 2) {
|
if (repoId.split('/').length !== 2) {
|
||||||
toastr.error('A HuggingFace repo ID must be formatted as Author/Name. Please try again.');
|
toastr.error('A HuggingFace repo ID must be formatted as Author/Name. Please try again.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -505,18 +505,18 @@ async function downloadTabbyModel() {
|
|||||||
folder_name: downloadHtml.find('input[name="folder_name"]').val() || undefined,
|
folder_name: downloadHtml.find('input[name="folder_name"]').val() || undefined,
|
||||||
revision: downloadHtml.find('input[name="revision"]').val() || undefined,
|
revision: downloadHtml.find('input[name="revision"]').val() || undefined,
|
||||||
token: downloadHtml.find('input[name="hf_token"]').val() || undefined,
|
token: downloadHtml.find('input[name="hf_token"]').val() || undefined,
|
||||||
}
|
};
|
||||||
|
|
||||||
for (const suffix of ["include", "exclude"]) {
|
for (const suffix of ['include', 'exclude']) {
|
||||||
const patterns = downloadHtml.find(`textarea[name="tabby_download_${suffix}"]`).val().toString();
|
const patterns = downloadHtml.find(`textarea[name="tabby_download_${suffix}"]`).val().toString();
|
||||||
if (patterns) {
|
if (patterns) {
|
||||||
params[suffix] = patterns.split("\n");
|
params[suffix] = patterns.split('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Params for the server side of ST
|
// Params for the server side of ST
|
||||||
params['api_server'] = serverUrl;
|
params['api_server'] = serverUrl;
|
||||||
params['api_type'] = textgen_settings.type
|
params['api_type'] = textgen_settings.type;
|
||||||
|
|
||||||
toastr.info('Downloading. Check the Tabby console for progress reports.');
|
toastr.info('Downloading. Check the Tabby console for progress reports.');
|
||||||
|
|
||||||
@ -527,7 +527,7 @@ async function downloadTabbyModel() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (response.status === 403) {
|
if (response.status === 403) {
|
||||||
toastr.error("The provided key has invalid permissions. Please use an admin key for downloading.");
|
toastr.error('The provided key has invalid permissions. Please use an admin key for downloading.');
|
||||||
return;
|
return;
|
||||||
} else if (!response.ok) {
|
} else if (!response.ok) {
|
||||||
throw new Error(response.statusText);
|
throw new Error(response.statusText);
|
||||||
@ -536,7 +536,7 @@ async function downloadTabbyModel() {
|
|||||||
toastr.success('Download complete.');
|
toastr.success('Download complete.');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
toastr.error('Failed to download HuggingFace model in TabbyAPI. Please try again.')
|
toastr.error('Failed to download HuggingFace model in TabbyAPI. Please try again.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,13 +599,13 @@ tabby.post('/download', jsonParser, async function (request, response) {
|
|||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(request.body),
|
body: JSON.stringify(request.body),
|
||||||
timeout: 0,
|
timeout: 0,
|
||||||
}
|
};
|
||||||
|
|
||||||
setAdditionalHeaders(request, args, baseUrl);
|
setAdditionalHeaders(request, args, baseUrl);
|
||||||
|
|
||||||
// Check key permissions
|
// Check key permissions
|
||||||
const permissionResponse = await fetch(`${baseUrl}/v1/auth/permission`, {
|
const permissionResponse = await fetch(`${baseUrl}/v1/auth/permission`, {
|
||||||
headers: args.headers
|
headers: args.headers,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (permissionResponse.ok) {
|
if (permissionResponse.ok) {
|
||||||
|
Reference in New Issue
Block a user