Fix eslint
| @@ -489,13 +489,13 @@ async function downloadTabbyModel() { | ||
| 489 | 489 | return; |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | const repoId = downloadHtml.find('input[name="hf_repo_id"]').val().toString(); |
| 493 | 493 | if (!repoId) { |
| 494 | 494 | toastr.error('A HuggingFace repo ID must be provided. Skipping Download.'); |
| 495 | 495 | return; |
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | if (repoId.split("'/"').length !== 2) { |
| 499 | 499 | toastr.error('A HuggingFace repo ID must be formatted as Author/Name. Please try again.'); |
| 500 | 500 | return; |
| 501 | 501 | } |
| @@ -505,18 +505,18 @@ async function downloadTabbyModel() { | ||
| 505 | 505 | folder_name: downloadHtml.find('input[name="folder_name"]').val() || undefined, |
| 506 | 506 | revision: downloadHtml.find('input[name="revision"]').val() || undefined, |
| 507 | 507 | token: downloadHtml.find('input[name="hf_token"]').val() || undefined, |
| 508 | 508 | }; |
| 509 | 509 | |
| 510 | 510 | for (const suffix of ["'include"', "'exclude"']) { |
| 511 | 511 | const patterns = downloadHtml.find(`textarea[name="tabby_download_${suffix}"]`).val().toString(); |
| 512 | 512 | if (patterns) { |
| 513 | 513 | params[suffix] = patterns.split("'\n"'); |
| 514 | 514 | } |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | // Params for the server side of ST |
| 518 | 518 | params['api_server'] = serverUrl; |
| 519 | 519 | params['api_type'] = textgen_settings.type; |
| 520 | 520 | |
| 521 | 521 | toastr.info('Downloading. Check the Tabby console for progress reports.'); |
| 522 | 522 | |
| @@ -527,7 +527,7 @@ async function downloadTabbyModel() { | ||
| 527 | 527 | }); |
| 528 | 528 | |
| 529 | 529 | if (response.status === 403) { |
| 530 | 530 | toastr.error("'The provided key has invalid permissions. Please use an admin key for downloading."'); |
| 531 | 531 | return; |
| 532 | 532 | } else if (!response.ok) { |
| 533 | 533 | throw new Error(response.statusText); |
| @@ -536,7 +536,7 @@ async function downloadTabbyModel() { | ||
| 536 | 536 | toastr.success('Download complete.'); |
| 537 | 537 | } catch (err) { |
| 538 | 538 | console.error(err); |
| 539 | 539 | toastr.error('Failed to download HuggingFace model in TabbyAPI. Please try again.'); |
| 540 | 540 | } |
| 541 | 541 | } |
| 542 | 542 | |
| @@ -599,13 +599,13 @@ tabby.post('/download', jsonParser, async function (request, response) { | ||
| 599 | 599 | headers: { 'Content-Type': 'application/json' }, |
| 600 | 600 | body: JSON.stringify(request.body), |
| 601 | 601 | timeout: 0, |
| 602 | 602 | }; |
| 603 | 603 | |
| 604 | 604 | setAdditionalHeaders(request, args, baseUrl); |
| 605 | 605 | |
| 606 | 606 | // Check key permissions |
| 607 | 607 | const permissionResponse = await fetch(`${baseUrl}/v1/auth/permission`, { |
| 608 | 608 | headers: args.headers, |
| 609 | 609 | }); |
| 610 | 610 | |
| 611 | 611 | if (permissionResponse.ok) { |