From f7e2d72ac7a4e009075d95ffeee8c8e282543553 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sun, 7 Jul 2024 22:40:03 +0300 Subject: [PATCH] Fix eslint --- public/scripts/textgen-models.js | 16 ++++++++-------- src/endpoints/backends/text-completions.js | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/public/scripts/textgen-models.js b/public/scripts/textgen-models.js index 4f65125f7..033633ef9 100644 --- a/public/scripts/textgen-models.js +++ b/public/scripts/textgen-models.js @@ -489,13 +489,13 @@ async function downloadTabbyModel() { 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) { toastr.error('A HuggingFace repo ID must be provided. Skipping Download.'); 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.'); return; } @@ -505,18 +505,18 @@ async function downloadTabbyModel() { folder_name: downloadHtml.find('input[name="folder_name"]').val() || undefined, revision: downloadHtml.find('input[name="revision"]').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(); if (patterns) { - params[suffix] = patterns.split("\n"); + params[suffix] = patterns.split('\n'); } } // Params for the server side of ST 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.'); @@ -527,7 +527,7 @@ async function downloadTabbyModel() { }); 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; } else if (!response.ok) { throw new Error(response.statusText); @@ -536,7 +536,7 @@ async function downloadTabbyModel() { toastr.success('Download complete.'); } catch (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.'); } } diff --git a/src/endpoints/backends/text-completions.js b/src/endpoints/backends/text-completions.js index 66ddb80db..ba1bba16d 100644 --- a/src/endpoints/backends/text-completions.js +++ b/src/endpoints/backends/text-completions.js @@ -599,13 +599,13 @@ tabby.post('/download', jsonParser, async function (request, response) { headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(request.body), timeout: 0, - } + }; setAdditionalHeaders(request, args, baseUrl); // Check key permissions const permissionResponse = await fetch(`${baseUrl}/v1/auth/permission`, { - headers: args.headers + headers: args.headers, }); if (permissionResponse.ok) {