From 34a6d5550536552130a0a4789c0cb78b9d13a160 Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Fri, 10 May 2024 20:17:19 +0800 Subject: [PATCH 01/11] feat: add {{prompt:middletruncate:}} to title gen also harden the replacement logic --- src/lib/utils/index.ts | 47 ++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/src/lib/utils/index.ts b/src/lib/utils/index.ts index 03cbc6262..636349ed5 100644 --- a/src/lib/utils/index.ts +++ b/src/lib/utils/index.ts @@ -472,22 +472,39 @@ export const blobToFile = (blob, fileName) => { return file; }; -export const promptTemplate = (template: string, prompt: string) => { - prompt = prompt.replace(/{{prompt}}|{{prompt:start:\d+}}|{{prompt:end:\d+}}/g, ''); - - template = template.replace(/{{prompt}}/g, prompt); - - // Replace all instances of {{prompt:start:}} with the first characters of the prompt - template = template.replace(/{{prompt:start:(\d+)}}/g, (match, length) => - prompt.substring(0, parseInt(length)) +/** + * This function is used to replace placeholders in a template string with the provided prompt. + * The placeholders can be in the following formats: + * - `{{prompt}}`: This will be replaced with the entire prompt. + * - `{{prompt:start:}}`: This will be replaced with the first characters of the prompt. + * - `{{prompt:end:}}`: This will be replaced with the last characters of the prompt. + * - `{{prompt:middletruncate:}}`: This will be replaced with the prompt truncated to characters, with '...' in the middle. + * + * @param {string} template - The template string containing placeholders. + * @param {string} prompt - The string to replace the placeholders with. + * @returns {string} The template string with the placeholders replaced by the prompt. + */ +export const promptTemplate = (template: string, prompt: string): string => { + return template.replace( + /{{prompt}}|{{prompt:start:(\d+)}}|{{prompt:end:(\d+)}}|{{prompt:middletruncate:(\d+)}}/g, + (match, startLength, endLength, middleLength) => { + if (match === '{{prompt}}') { + return prompt; + } else if (match.startsWith('{{prompt:start:')) { + return prompt.substring(0, startLength); + } else if (match.startsWith('{{prompt:end:')) { + return prompt.slice(-endLength); + } else if (match.startsWith('{{prompt:middletruncate:')) { + if (prompt.length <= middleLength) { + return prompt; + } + const start = prompt.slice(0, Math.ceil(middleLength / 2)); + const end = prompt.slice(-Math.floor(middleLength / 2)); + return `${start}...${end}`; + } + return ''; + } ); - - // Replace all instances of {{prompt:end:}} with the last characters of the prompt - template = template.replace(/{{prompt:end:(\d+)}}/g, (match, length) => - prompt.slice(-parseInt(length)) - ); - - return template; }; export const approximateToHumanReadable = (nanoseconds: number) => { From a789b785b477aea3579fd7c79de1eb40e212efb5 Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Fri, 10 May 2024 20:31:17 +0800 Subject: [PATCH 02/11] feat: add unit tests for prompt templates --- .github/workflows/format-build-frontend.yaml | 18 + package-lock.json | 1002 +++++++++++++++++- package.json | 6 +- src/lib/constants.ts | 4 +- src/lib/utils/index.test.ts | 66 ++ 5 files changed, 1091 insertions(+), 5 deletions(-) create mode 100644 src/lib/utils/index.test.ts diff --git a/.github/workflows/format-build-frontend.yaml b/.github/workflows/format-build-frontend.yaml index eec1305e4..6f89f14a9 100644 --- a/.github/workflows/format-build-frontend.yaml +++ b/.github/workflows/format-build-frontend.yaml @@ -37,3 +37,21 @@ jobs: - name: Build Frontend run: npm run build + + test-frontend: + name: 'Frontend Unit Tests' + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Dependencies + run: npm ci + + - name: Run vitest + run: npm run test:frontend diff --git a/package-lock.json b/package-lock.json index be7ae0dc9..8f34cddf3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,7 +50,8 @@ "tailwindcss": "^3.3.3", "tslib": "^2.4.1", "typescript": "^5.0.0", - "vite": "^4.4.2" + "vite": "^4.4.2", + "vitest": "^1.6.0" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -759,6 +760,18 @@ "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, + "node_modules/@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.5", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", @@ -965,6 +978,220 @@ } } }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.17.2.tgz", + "integrity": "sha512-NM0jFxY8bB8QLkoKxIQeObCaDlJKewVlIEkuyYKm5An1tdVZ966w2+MPQ2l8LBZLjR+SgyV+nRkTIunzOYBMLQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.17.2.tgz", + "integrity": "sha512-yeX/Usk7daNIVwkq2uGoq2BYJKZY1JfyLTaHO/jaiSwi/lsf8fTFoQW/n6IdAsx5tx+iotu2zCJwz8MxI6D/Bw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.17.2.tgz", + "integrity": "sha512-kcMLpE6uCwls023+kknm71ug7MZOrtXo+y5p/tsg6jltpDtgQY1Eq5sGfHcQfb+lfuKwhBmEURDga9N0ol4YPw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.17.2.tgz", + "integrity": "sha512-AtKwD0VEx0zWkL0ZjixEkp5tbNLzX+FCqGG1SvOu993HnSz4qDI6S4kGzubrEJAljpVkhRSlg5bzpV//E6ysTQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.17.2.tgz", + "integrity": "sha512-3reX2fUHqN7sffBNqmEyMQVj/CKhIHZd4y631duy0hZqI8Qoqf6lTtmAKvJFYa6bhU95B1D0WgzHkmTg33In0A==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.17.2.tgz", + "integrity": "sha512-uSqpsp91mheRgw96xtyAGP9FW5ChctTFEoXP0r5FAzj/3ZRv3Uxjtc7taRQSaQM/q85KEKjKsZuiZM3GyUivRg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.17.2.tgz", + "integrity": "sha512-EMMPHkiCRtE8Wdk3Qhtciq6BndLtstqZIroHiiGzB3C5LDJmIZcSzVtLRbwuXuUft1Cnv+9fxuDtDxz3k3EW2A==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.17.2.tgz", + "integrity": "sha512-NMPylUUZ1i0z/xJUIx6VUhISZDRT+uTWpBcjdv0/zkp7b/bQDF+NfnfdzuTiB1G6HTodgoFa93hp0O1xl+/UbA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.17.2.tgz", + "integrity": "sha512-T19My13y8uYXPw/L/k0JYaX1fJKFT/PWdXiHr8mTbXWxjVF1t+8Xl31DgBBvEKclw+1b00Chg0hxE2O7bTG7GQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.17.2.tgz", + "integrity": "sha512-BOaNfthf3X3fOWAB+IJ9kxTgPmMqPPH5f5k2DcCsRrBIbWnaJCgX2ll77dV1TdSy9SaXTR5iDXRL8n7AnoP5cg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.17.2.tgz", + "integrity": "sha512-W0UP/x7bnn3xN2eYMql2T/+wpASLE5SjObXILTMPUBDB/Fg/FxC+gX4nvCfPBCbNhz51C+HcqQp2qQ4u25ok6g==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.17.2.tgz", + "integrity": "sha512-Hy7pLwByUOuyaFC6mAr7m+oMC+V7qyifzs/nW2OJfC8H4hbCzOX07Ov0VFk/zP3kBsELWNFi7rJtgbKYsav9QQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.17.2.tgz", + "integrity": "sha512-h1+yTWeYbRdAyJ/jMiVw0l6fOOm/0D1vNLui9iPuqgRGnXA0u21gAqOyB5iHjlM9MMfNOm9RHCQ7zLIzT0x11Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.17.2.tgz", + "integrity": "sha512-tmdtXMfKAjy5+IQsVtDiCfqbynAQE/TQRpWdVataHmhMb9DCoJxp9vLcCBjEQWMiUYxO1QprH/HbY9ragCEFLA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.17.2.tgz", + "integrity": "sha512-7II/QCSTAHuE5vdZaQEwJq2ZACkBpQDOmQsE6D6XUbnBHW8IAhm4eTufL6msLJorzrHDFv3CF8oCA/hSIRuZeQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.17.2.tgz", + "integrity": "sha512-TGGO7v7qOq4CYmSBVEYpI1Y5xDuCEnbVC5Vth8mOsW0gDSzxNrVERPc790IGHsrT2dQSimgMr9Ub3Y1Jci5/8w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true + }, "node_modules/@sveltejs/adapter-auto": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/@sveltejs/adapter-auto/-/adapter-auto-2.1.1.tgz", @@ -1381,6 +1608,111 @@ "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", "dev": true }, + "node_modules/@vitest/expect": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.6.0.tgz", + "integrity": "sha512-ixEvFVQjycy/oNgHjqsL6AZCDduC+tflRluaHIzKIsdbzkLn2U/iBnVeJwB6HsIjQBdfMR8Z0tRxKUsvFJEeWQ==", + "dev": true, + "dependencies": { + "@vitest/spy": "1.6.0", + "@vitest/utils": "1.6.0", + "chai": "^4.3.10" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.6.0.tgz", + "integrity": "sha512-P4xgwPjwesuBiHisAVz/LSSZtDjOTPYZVmNAnpHHSR6ONrf8eCJOFRvUwdHn30F5M1fxhqtl7QZQUk2dprIXAg==", + "dev": true, + "dependencies": { + "@vitest/utils": "1.6.0", + "p-limit": "^5.0.0", + "pathe": "^1.1.1" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner/node_modules/p-limit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-5.0.0.tgz", + "integrity": "sha512-/Eaoq+QyLSiXQ4lyYV23f14mZRQcXnxfHrN0vCai+ak9G0pp9iEQukIIZq5NccEvwRB8PUnZT0KsOoDCINS1qQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@vitest/runner/node_modules/yocto-queue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", + "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", + "dev": true, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@vitest/snapshot": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.6.0.tgz", + "integrity": "sha512-+Hx43f8Chus+DCmygqqfetcAZrDJwvTj0ymqjQq4CvmpKFSTVteEOBzCusu1x2tt4OJcvBflyHUE0DZSLgEMtQ==", + "dev": true, + "dependencies": { + "magic-string": "^0.30.5", + "pathe": "^1.1.1", + "pretty-format": "^29.7.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.6.0.tgz", + "integrity": "sha512-leUTap6B/cqi/bQkXUu6bQV5TZPx7pmMBKBQiI0rJA8c3pB56ZsaTbREnF7CJfmvAS4V2cXIBAh/3rVwrrCYgw==", + "dev": true, + "dependencies": { + "tinyspy": "^2.2.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.6.0.tgz", + "integrity": "sha512-21cPiuGMoMZwiOHa2i4LXkMkMkCGzA+MVFV70jRwHo95dL4x/ts5GZhML1QWuy7yfp3WzK3lRvZi3JnXTYqrBw==", + "dev": true, + "dependencies": { + "diff-sequences": "^29.6.3", + "estree-walker": "^3.0.3", + "loupe": "^2.3.7", + "pretty-format": "^29.7.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils/node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "dependencies": { + "@types/estree": "^1.0.0" + } + }, "node_modules/acorn": { "version": "8.11.3", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", @@ -1401,6 +1733,15 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/acorn-walk": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", + "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -1576,6 +1917,15 @@ "node": ">=0.8" } }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/astral-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", @@ -1959,6 +2309,15 @@ "@types/ws": "~8.5.10" } }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/cachedir": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.4.0.tgz", @@ -2031,6 +2390,24 @@ "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", "dev": true }, + "node_modules/chai": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", + "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", + "dev": true, + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", + "pathval": "^1.1.1", + "type-detect": "^4.0.8" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2047,6 +2424,18 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/check-error": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "dev": true, + "dependencies": { + "get-func-name": "^2.0.2" + }, + "engines": { + "node": "*" + } + }, "node_modules/check-more-types": { "version": "2.24.0", "resolved": "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz", @@ -2346,6 +2735,12 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "node_modules/confbox": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.7.tgz", + "integrity": "sha512-uJcB/FKZtBMCJpK8MQji6bJHgu1tixKPxRLeGkNzBoOZzpnZUJm0jm2/sBDWcuBx1dYgxV4JU+g5hmNxCyAmdA==", + "dev": true + }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", @@ -2591,6 +2986,18 @@ } } }, + "node_modules/deep-eql": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "dev": true, + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -2659,6 +3066,15 @@ "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", "dev": true }, + "node_modules/diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -3585,6 +4001,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-func-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/get-intrinsic": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", @@ -4366,6 +4791,12 @@ "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.10.1.tgz", "integrity": "sha512-5obBtsz9301ULlsgggLg542s/jqtddfOpV5KJc4hajc9JV8GeY2gZHSVpYBn4nWqAUTJ9v+xwtbJ1mIBgIH5Vw==" }, + "node_modules/js-tokens": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.0.tgz", + "integrity": "sha512-WriZw1luRMlmV3LGJaR6QOJjWwgLUTf89OwT2lUOyjX2dJGBwgmIkbcz+7WFZjrZM635JOIR517++e/67CP9dQ==", + "dev": true + }, "node_modules/js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", @@ -4600,6 +5031,22 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/local-pkg": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.5.0.tgz", + "integrity": "sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg==", + "dev": true, + "dependencies": { + "mlly": "^1.4.2", + "pkg-types": "^1.0.3" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, "node_modules/locate-character": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz", @@ -4735,6 +5182,15 @@ "node": ">=8" } }, + "node_modules/loupe": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", + "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", + "dev": true, + "dependencies": { + "get-func-name": "^2.0.1" + } + }, "node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -4930,6 +5386,18 @@ "node": ">0.9" } }, + "node_modules/mlly": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.0.tgz", + "integrity": "sha512-U9SDaXGEREBYQgfejV97coK0UL1r+qnF2SyO9A3qcI8MzKnsIFKHNVEkrDyNncQTKQQumsasmeq84eNMdBfsNQ==", + "dev": true, + "dependencies": { + "acorn": "^8.11.3", + "pathe": "^1.1.2", + "pkg-types": "^1.1.0", + "ufo": "^1.5.3" + } + }, "node_modules/mri": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", @@ -5272,6 +5740,21 @@ "node": ">=8" } }, + "node_modules/pathe": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", + "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", + "dev": true + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", @@ -5344,6 +5827,17 @@ "node": ">= 6" } }, + "node_modules/pkg-types": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.1.1.tgz", + "integrity": "sha512-ko14TjmDuQJ14zsotODv7dBlwxKhUKQEhuhmbqo1uCi9BB0Z2alo/wAXg6q1dTR5TyuqYyWhjtfe/Tsh+X28jQ==", + "dev": true, + "dependencies": { + "confbox": "^0.1.7", + "mlly": "^1.7.0", + "pathe": "^1.1.2" + } + }, "node_modules/postcss": { "version": "8.4.38", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz", @@ -5601,6 +6095,32 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -5768,6 +6288,12 @@ "rimraf": "bin.js" } }, + "node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true + }, "node_modules/read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", @@ -6189,6 +6715,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true + }, "node_modules/signal-exit": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", @@ -6314,6 +6846,18 @@ "node": ">=0.10.0" } }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true + }, + "node_modules/std-env": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.7.0.tgz", + "integrity": "sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==", + "dev": true + }, "node_modules/stream-composer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/stream-composer/-/stream-composer-1.0.2.tgz", @@ -6468,6 +7012,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/strip-literal": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-2.1.0.tgz", + "integrity": "sha512-Op+UycaUt/8FbN/Z2TWPBLge3jWrP3xj10f3fnYxf052bKuS3EKs1ZQcVGjnEMdsNVAM+plXRdmjrZ/KgG3Skw==", + "dev": true, + "dependencies": { + "js-tokens": "^9.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, "node_modules/sucrase": { "version": "3.35.0", "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.0.tgz", @@ -6923,6 +7479,30 @@ "globrex": "^0.1.2" } }, + "node_modules/tinybench": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.8.0.tgz", + "integrity": "sha512-1/eK7zUnIklz4JUUlL+658n58XO2hHLQfSk1Zf2LKieUjxidN16eKFEoDEfjHc3ohofSSqK3X5yO6VGb6iW8Lw==", + "dev": true + }, + "node_modules/tinypool": { + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.8.4.tgz", + "integrity": "sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ==", + "dev": true, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.2.1.tgz", + "integrity": "sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==", + "dev": true, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/tippy.js": { "version": "6.3.7", "resolved": "https://registry.npmjs.org/tippy.js/-/tippy.js-6.3.7.tgz", @@ -7049,6 +7629,15 @@ "node": ">= 0.8.0" } }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/type-fest": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", @@ -7074,6 +7663,12 @@ "node": ">=14.17" } }, + "node_modules/ufo": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.3.tgz", + "integrity": "sha512-Y7HYmWaFwPUmkoQCUIAYpKqkOf+SbVj/2fJJZ4RJMCfZp0rTGwRbzQD+HghfnhKOjL9E01okqz+ncJskGYfBNw==", + "dev": true + }, "node_modules/underscore.string": { "version": "3.3.6", "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.6.tgz", @@ -7343,6 +7938,118 @@ } } }, + "node_modules/vite-node": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.6.0.tgz", + "integrity": "sha512-de6HJgzC+TFzOu0NTC4RAIsyf/DY/ibWDYQUcuEA84EMHhcefTUGkjFHKKEJhQN4A+6I0u++kr3l36ZF2d7XRw==", + "dev": true, + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.3.4", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "vite": "^5.0.0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/vite-node/node_modules/rollup": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.17.2.tgz", + "integrity": "sha512-/9ClTJPByC0U4zNLowV1tMBe8yMEAxewtR3cUNX5BoEpGH3dQEWpJLr6CLp0fPdYRF/fzVOgvDb1zXuakwF5kQ==", + "dev": true, + "dependencies": { + "@types/estree": "1.0.5" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.17.2", + "@rollup/rollup-android-arm64": "4.17.2", + "@rollup/rollup-darwin-arm64": "4.17.2", + "@rollup/rollup-darwin-x64": "4.17.2", + "@rollup/rollup-linux-arm-gnueabihf": "4.17.2", + "@rollup/rollup-linux-arm-musleabihf": "4.17.2", + "@rollup/rollup-linux-arm64-gnu": "4.17.2", + "@rollup/rollup-linux-arm64-musl": "4.17.2", + "@rollup/rollup-linux-powerpc64le-gnu": "4.17.2", + "@rollup/rollup-linux-riscv64-gnu": "4.17.2", + "@rollup/rollup-linux-s390x-gnu": "4.17.2", + "@rollup/rollup-linux-x64-gnu": "4.17.2", + "@rollup/rollup-linux-x64-musl": "4.17.2", + "@rollup/rollup-win32-arm64-msvc": "4.17.2", + "@rollup/rollup-win32-ia32-msvc": "4.17.2", + "@rollup/rollup-win32-x64-msvc": "4.17.2", + "fsevents": "~2.3.2" + } + }, + "node_modules/vite-node/node_modules/vite": { + "version": "5.2.11", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.11.tgz", + "integrity": "sha512-HndV31LWW05i1BLPMUCE1B9E9GFbOu1MbenhS58FuK6owSO5qHm7GiCotrNY1YE5rMeQSFBGmT5ZaLEjFizgiQ==", + "dev": true, + "dependencies": { + "esbuild": "^0.20.1", + "postcss": "^8.4.38", + "rollup": "^4.13.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, "node_modules/vite/node_modules/@esbuild/android-arm": { "version": "0.18.20", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", @@ -7722,6 +8429,283 @@ } } }, + "node_modules/vitest": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.6.0.tgz", + "integrity": "sha512-H5r/dN06swuFnzNFhq/dnz37bPXnq8xB2xB5JOVk8K09rUtoeNN+LHWkoQ0A/i3hvbUKKcCei9KpbxqHMLhLLA==", + "dev": true, + "dependencies": { + "@vitest/expect": "1.6.0", + "@vitest/runner": "1.6.0", + "@vitest/snapshot": "1.6.0", + "@vitest/spy": "1.6.0", + "@vitest/utils": "1.6.0", + "acorn-walk": "^8.3.2", + "chai": "^4.3.10", + "debug": "^4.3.4", + "execa": "^8.0.1", + "local-pkg": "^0.5.0", + "magic-string": "^0.30.5", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "std-env": "^3.5.0", + "strip-literal": "^2.0.0", + "tinybench": "^2.5.1", + "tinypool": "^0.8.3", + "vite": "^5.0.0", + "vite-node": "1.6.0", + "why-is-node-running": "^2.2.2" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@types/node": "^18.0.0 || >=20.0.0", + "@vitest/browser": "1.6.0", + "@vitest/ui": "1.6.0", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, + "node_modules/vitest/node_modules/execa": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/vitest/node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "dev": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vitest/node_modules/human-signals": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", + "dev": true, + "engines": { + "node": ">=16.17.0" + } + }, + "node_modules/vitest/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vitest/node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vitest/node_modules/npm-run-path": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vitest/node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vitest/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vitest/node_modules/rollup": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.17.2.tgz", + "integrity": "sha512-/9ClTJPByC0U4zNLowV1tMBe8yMEAxewtR3cUNX5BoEpGH3dQEWpJLr6CLp0fPdYRF/fzVOgvDb1zXuakwF5kQ==", + "dev": true, + "dependencies": { + "@types/estree": "1.0.5" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.17.2", + "@rollup/rollup-android-arm64": "4.17.2", + "@rollup/rollup-darwin-arm64": "4.17.2", + "@rollup/rollup-darwin-x64": "4.17.2", + "@rollup/rollup-linux-arm-gnueabihf": "4.17.2", + "@rollup/rollup-linux-arm-musleabihf": "4.17.2", + "@rollup/rollup-linux-arm64-gnu": "4.17.2", + "@rollup/rollup-linux-arm64-musl": "4.17.2", + "@rollup/rollup-linux-powerpc64le-gnu": "4.17.2", + "@rollup/rollup-linux-riscv64-gnu": "4.17.2", + "@rollup/rollup-linux-s390x-gnu": "4.17.2", + "@rollup/rollup-linux-x64-gnu": "4.17.2", + "@rollup/rollup-linux-x64-musl": "4.17.2", + "@rollup/rollup-win32-arm64-msvc": "4.17.2", + "@rollup/rollup-win32-ia32-msvc": "4.17.2", + "@rollup/rollup-win32-x64-msvc": "4.17.2", + "fsevents": "~2.3.2" + } + }, + "node_modules/vitest/node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vitest/node_modules/vite": { + "version": "5.2.11", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.11.tgz", + "integrity": "sha512-HndV31LWW05i1BLPMUCE1B9E9GFbOu1MbenhS58FuK6owSO5qHm7GiCotrNY1YE5rMeQSFBGmT5ZaLEjFizgiQ==", + "dev": true, + "dependencies": { + "esbuild": "^0.20.1", + "postcss": "^8.4.38", + "rollup": "^4.13.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, "node_modules/vue-template-compiler": { "version": "2.7.16", "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.7.16.tgz", @@ -7784,6 +8768,22 @@ "node": ">= 8" } }, + "node_modules/why-is-node-running": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", + "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", + "dev": true, + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/wrap-ansi": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", diff --git a/package.json b/package.json index f8096269c..0709db510 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "format": "prettier --plugin-search-dir --write '**/*.{js,ts,svelte,css,md,html,json}'", "format:backend": "black . --exclude \"/venv/\"", "i18n:parse": "i18next --config i18next-parser.config.ts && prettier --write 'src/lib/i18n/**/*.{js,json}'", - "cy:open": "cypress open" + "cy:open": "cypress open", + "test:frontend": "vitest" }, "devDependencies": { "@sveltejs/adapter-auto": "^2.0.0", @@ -41,7 +42,8 @@ "tailwindcss": "^3.3.3", "tslib": "^2.4.1", "typescript": "^5.0.0", - "vite": "^4.4.2" + "vite": "^4.4.2", + "vitest": "^1.6.0" }, "type": "module", "dependencies": { diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 5adefe561..62ac2b8c3 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -1,8 +1,8 @@ -import { dev } from '$app/environment'; +import { browser, dev } from '$app/environment'; // import { version } from '../../package.json'; export const APP_NAME = 'Open WebUI'; -export const WEBUI_BASE_URL = dev ? `http://${location.hostname}:8080` : ``; +export const WEBUI_BASE_URL = browser ? (dev ? `http://${location.hostname}:8080` : ``) : ``; export const WEBUI_API_BASE_URL = `${WEBUI_BASE_URL}/api/v1`; diff --git a/src/lib/utils/index.test.ts b/src/lib/utils/index.test.ts new file mode 100644 index 000000000..f67449dcc --- /dev/null +++ b/src/lib/utils/index.test.ts @@ -0,0 +1,66 @@ +import { promptTemplate } from '$lib/utils/index'; +import { expect, test } from 'vitest'; + +test('promptTemplate correctly replaces {{prompt}} placeholder', () => { + const template = 'Hello {{prompt}}!'; + const prompt = 'world'; + const expected = 'Hello world!'; + const actual = promptTemplate(template, prompt); + expect(actual).toBe(expected); +}); + +test('promptTemplate correctly replaces {{prompt:start:}} placeholder', () => { + const template = 'Hello {{prompt:start:3}}!'; + const prompt = 'world'; + const expected = 'Hello wor!'; + const actual = promptTemplate(template, prompt); + expect(actual).toBe(expected); +}); + +test('promptTemplate correctly replaces {{prompt:end:}} placeholder', () => { + const template = 'Hello {{prompt:end:3}}!'; + const prompt = 'world'; + const expected = 'Hello rld!'; + const actual = promptTemplate(template, prompt); + expect(actual).toBe(expected); +}); + +test('promptTemplate correctly replaces {{prompt:middletruncate:}} placeholder when prompt length is greater than length', () => { + const template = 'Hello {{prompt:middletruncate:4}}!'; + const prompt = 'world'; + const expected = 'Hello wo...ld!'; + const actual = promptTemplate(template, prompt); + expect(actual).toBe(expected); +}); + +test('promptTemplate correctly replaces {{prompt:middletruncate:}} placeholder when prompt length is less than or equal to length', () => { + const template = 'Hello {{prompt:middletruncate:5}}!'; + const prompt = 'world'; + const expected = 'Hello world!'; + const actual = promptTemplate(template, prompt); + expect(actual).toBe(expected); +}); + +test('promptTemplate returns original template when no placeholders are present', () => { + const template = 'Hello world!'; + const prompt = 'world'; + const expected = 'Hello world!'; + const actual = promptTemplate(template, prompt); + expect(actual).toBe(expected); +}); + +test('promptTemplate does not replace placeholders inside of replaced placeholders', () => { + const template = 'Hello {{prompt}}!'; + const prompt = 'World, {{prompt}} injection'; + const expected = 'Hello World, {{prompt}} injection!'; + const actual = promptTemplate(template, prompt); + expect(actual).toBe(expected); +}); + +test('promptTemplate correctly replaces multiple placeholders', () => { + const template = 'Hello {{prompt}}! This is {{prompt:start:3}}!'; + const prompt = 'world'; + const expected = 'Hello world! This is wor!'; + const actual = promptTemplate(template, prompt); + expect(actual).toBe(expected); +}); From 9ad4605e5709cf9bf2f502198b8051e85f061ed4 Mon Sep 17 00:00:00 2001 From: Maksym Dmukhovskyy Date: Tue, 14 May 2024 20:56:04 +0400 Subject: [PATCH 03/11] fix: added missing translations for italian --- src/lib/i18n/locales/it-IT/translation.json | 274 ++++++++++---------- 1 file changed, 137 insertions(+), 137 deletions(-) diff --git a/src/lib/i18n/locales/it-IT/translation.json b/src/lib/i18n/locales/it-IT/translation.json index f66ca586a..a928d0214 100644 --- a/src/lib/i18n/locales/it-IT/translation.json +++ b/src/lib/i18n/locales/it-IT/translation.json @@ -1,34 +1,34 @@ { "'s', 'm', 'h', 'd', 'w' or '-1' for no expiration.": "'s', 'm', 'h', 'd', 'w' o '-1' per nessuna scadenza.", "(Beta)": "(Beta)", - "(e.g. `sh webui.sh --api`)": "", + "(e.g. `sh webui.sh --api`)": "(p.e. `sh webui.sh --api`)", "(latest)": "(ultima)", "{{modelName}} is thinking...": "{{modelName}} sta pensando...", - "{{user}}'s Chats": "", + "{{user}}'s Chats": "{{user}} Chat", "{{webUIName}} Backend Required": "{{webUIName}} Backend richiesto", "a user": "un utente", "About": "Informazioni", "Account": "Account", - "Accurate information": "", + "Accurate information": "Informazioni accurate", "Add a model": "Aggiungi un modello", "Add a model tag name": "Aggiungi un nome tag del modello", "Add a short description about what this modelfile does": "Aggiungi una breve descrizione di ciò che fa questo file modello", "Add a short title for this prompt": "Aggiungi un titolo breve per questo prompt", "Add a tag": "Aggiungi un tag", - "Add custom prompt": "", + "Add custom prompt": "Aggiungi un prompt custom", "Add Docs": "Aggiungi documenti", "Add Files": "Aggiungi file", "Add message": "Aggiungi messaggio", - "Add Model": "", - "Add Tags": "aggiungi tag", - "Add User": "", + "Add Model": "Aggiungi modello", + "Add Tags": "Aggiungi tag", + "Add User": "Aggiungi utente", "Adjusting these settings will apply changes universally to all users.": "La modifica di queste impostazioni applicherà le modifiche universalmente a tutti gli utenti.", "admin": "amministratore", "Admin Panel": "Pannello di amministrazione", "Admin Settings": "Impostazioni amministratore", "Advanced Parameters": "Parametri avanzati", "all": "tutti", - "All Documents": "", + "All Documents": "Tutti i documenti", "All Users": "Tutti gli utenti", "Allow": "Consenti", "Allow Chat Deletion": "Consenti l'eliminazione della chat", @@ -36,32 +36,32 @@ "Already have an account?": "Hai già un account?", "an assistant": "un assistente", "and": "e", - "and create a new shared link.": "", + "and create a new shared link.": "e crea un nuovo link condiviso.", "API Base URL": "URL base API", "API Key": "Chiave API", - "API Key created.": "", - "API keys": "", + "API Key created.": "Chiave API creata.", + "API keys": "Chiavi API", "API RPM": "API RPM", - "April": "", - "Archive": "", + "April": "Aprile", + "Archive": "Archivio", "Archived Chats": "Chat archiviate", "are allowed - Activate this command by typing": "sono consentiti - Attiva questo comando digitando", "Are you sure?": "Sei sicuro?", - "Attach file": "", - "Attention to detail": "", + "Attach file": "Allega file", + "Attention to detail": "Attenzione ai dettagli", "Audio": "Audio", - "August": "", + "August": "Agosto", "Auto-playback response": "Riproduzione automatica della risposta", "Auto-send input after 3 sec.": "Invio automatico dell'input dopo 3 secondi.", "AUTOMATIC1111 Base URL": "URL base AUTOMATIC1111", "AUTOMATIC1111 Base URL is required.": "L'URL base AUTOMATIC1111 è obbligatorio.", "available!": "disponibile!", "Back": "Indietro", - "Bad Response": "", - "before": "", - "Being lazy": "", + "Bad Response": "Risposta non valida", + "before": "prima", + "Being lazy": "Essere pigri", "Builder Mode": "Modalità costruttore", - "Bypass SSL verification for Websites": "", + "Bypass SSL verification for Websites": "Aggira la verifica SSL per i siti web", "Cancel": "Annulla", "Categories": "Categorie", "Change Password": "Cambia password", @@ -78,66 +78,66 @@ "Chunk Size": "Dimensione chunk", "Citation": "Citazione", "Click here for help.": "Clicca qui per aiuto.", - "Click here to": "", + "Click here to": "Clicca qui per", "Click here to check other modelfiles.": "Clicca qui per controllare altri file modello.", "Click here to select": "Clicca qui per selezionare", - "Click here to select a csv file.": "", + "Click here to select a csv file.": "Clicca qui per selezionare un file csv.", "Click here to select documents.": "Clicca qui per selezionare i documenti.", "click here.": "clicca qui.", "Click on the user role button to change a user's role.": "Clicca sul pulsante del ruolo utente per modificare il ruolo di un utente.", "Close": "Chiudi", "Collection": "Collezione", - "ComfyUI": "", - "ComfyUI Base URL": "", - "ComfyUI Base URL is required.": "", + "ComfyUI": "ComfyUI", + "ComfyUI Base URL": "URL base ComfyUI", + "ComfyUI Base URL is required.": "L'URL base ComfyUI è obbligatorio.", "Command": "Comando", "Confirm Password": "Conferma password", "Connections": "Connessioni", "Content": "Contenuto", "Context Length": "Lunghezza contesto", - "Continue Response": "", + "Continue Response": "Continua risposta", "Conversation Mode": "Modalità conversazione", - "Copied shared chat URL to clipboard!": "", - "Copy": "", + "Copied shared chat URL to clipboard!": "URL della chat condivisa copiato negli appunti!", + "Copy": "Copia", "Copy last code block": "Copia ultimo blocco di codice", "Copy last response": "Copia ultima risposta", - "Copy Link": "", + "Copy Link": "Copia link", "Copying to clipboard was successful!": "Copia negli appunti riuscita!", "Create a concise, 3-5 word phrase as a header for the following query, strictly adhering to the 3-5 word limit and avoiding the use of the word 'title':": "Crea una frase concisa di 3-5 parole come intestazione per la seguente query, aderendo rigorosamente al limite di 3-5 parole ed evitando l'uso della parola 'titolo':", "Create a modelfile": "Crea un file modello", "Create Account": "Crea account", - "Create new key": "", - "Create new secret key": "", + "Create new key": "Crea nuova chiave", + "Create new secret key": "Crea nuova chiave segreta", "Created at": "Creato il", - "Created At": "", + "Created At": "Creato il", "Current Model": "Modello corrente", "Current Password": "Password corrente", "Custom": "Personalizzato", "Customize Ollama models for a specific purpose": "Personalizza i modelli Ollama per uno scopo specifico", "Dark": "Scuro", - "Dashboard": "", + "Dashboard": "Pannello di controllo", "Database": "Database", "DD/MM/YYYY HH:mm": "DD/MM/YYYY HH:mm", - "December": "", + "December": "Dicembre", "Default": "Predefinito", "Default (Automatic1111)": "Predefinito (Automatic1111)", - "Default (SentenceTransformers)": "", + "Default (SentenceTransformers)": "Predefinito (SentenceTransformers)", "Default (Web API)": "Predefinito (API Web)", "Default model updated": "Modello predefinito aggiornato", "Default Prompt Suggestions": "Suggerimenti prompt predefiniti", "Default User Role": "Ruolo utente predefinito", "delete": "elimina", - "Delete": "", + "Delete": "Elimina", "Delete a model": "Elimina un modello", "Delete chat": "Elimina chat", - "Delete Chat": "", - "Delete Chats": "Elimina chat", - "delete this link": "", - "Delete User": "", + "Delete Chat": "Elimina chat", + "Delete Chats": "Elimina le chat", + "delete this link": "elimina questo link", + "Delete User": "Elimina utente", "Deleted {{deleteModelTag}}": "Eliminato {{deleteModelTag}}", - "Deleted {{tagName}}": "", + "Deleted {{tagName}}": "Eliminato {{tagName}}", "Description": "Descrizione", - "Didn't fully follow instructions": "", + "Didn't fully follow instructions": "Non ha seguito completamente le istruzioni", "Disabled": "Disabilitato", "Discover a modelfile": "Scopri un file modello", "Discover a prompt": "Scopri un prompt", @@ -150,28 +150,28 @@ "does not make any external connections, and your data stays securely on your locally hosted server.": "non effettua connessioni esterne e i tuoi dati rimangono al sicuro sul tuo server ospitato localmente.", "Don't Allow": "Non consentire", "Don't have an account?": "Non hai un account?", - "Don't like the style": "", - "Download": "", - "Download canceled": "", + "Don't like the style": "Non ti piace lo stile", + "Download": "Scarica", + "Download canceled": "Scaricamento annullato", "Download Database": "Scarica database", "Drop any files here to add to the conversation": "Trascina qui i file da aggiungere alla conversazione", "e.g. '30s','10m'. Valid time units are 's', 'm', 'h'.": "ad esempio '30s','10m'. Le unità di tempo valide sono 's', 'm', 'h'.", - "Edit": "", + "Edit": "Modifica", "Edit Doc": "Modifica documento", "Edit User": "Modifica utente", "Email": "Email", - "Embedding Model": "", - "Embedding Model Engine": "", - "Embedding model set to \"{{embedding_model}}\"": "", + "Embedding Model": "Modello di embedding", + "Embedding Model Engine": "Motore del modello di embedding", + "Embedding model set to \"{{embedding_model}}\"": "Modello di embedding impostato su \"{{embedding_model}}\"", "Enable Chat History": "Abilita cronologia chat", "Enable New Sign Ups": "Abilita nuove iscrizioni", "Enabled": "Abilitato", - "Ensure your CSV file includes 4 columns in this order: Name, Email, Password, Role.": "", + "Ensure your CSV file includes 4 columns in this order: Name, Email, Password, Role.": "Assicurati che il tuo file CSV includa 4 colonne in questo ordine: Nome, Email, Password, Ruolo.", "Enter {{role}} message here": "Inserisci il messaggio per {{role}} qui", "Enter Chunk Overlap": "Inserisci la sovrapposizione chunk", "Enter Chunk Size": "Inserisci la dimensione chunk", "Enter Image Size (e.g. 512x512)": "Inserisci la dimensione dell'immagine (ad esempio 512x512)", - "Enter language codes": "", + "Enter language codes": "Inserisci i codici lingua", "Enter LiteLLM API Base URL (litellm_params.api_base)": "Inserisci l'URL base dell'API LiteLLM (litellm_params.api_base)", "Enter LiteLLM API Key (litellm_params.api_key)": "Inserisci la chiave API LiteLLM (litellm_params.api_key)", "Enter LiteLLM API RPM (litellm_params.rpm)": "Inserisci LiteLLM API RPM (litellm_params.rpm)", @@ -179,45 +179,45 @@ "Enter Max Tokens (litellm_params.max_tokens)": "Inserisci Max Tokens (litellm_params.max_tokens)", "Enter model tag (e.g. {{modelTag}})": "Inserisci il tag del modello (ad esempio {{modelTag}})", "Enter Number of Steps (e.g. 50)": "Inserisci il numero di passaggi (ad esempio 50)", - "Enter Score": "", + "Enter Score": "Inserisci il punteggio", "Enter stop sequence": "Inserisci la sequenza di arresto", "Enter Top K": "Inserisci Top K", "Enter URL (e.g. http://127.0.0.1:7860/)": "Inserisci URL (ad esempio http://127.0.0.1:7860/)", - "Enter URL (e.g. http://localhost:11434)": "", + "Enter URL (e.g. http://localhost:11434)": "Inserisci URL (ad esempio http://localhost:11434)", "Enter Your Email": "Inserisci la tua email", "Enter Your Full Name": "Inserisci il tuo nome completo", "Enter Your Password": "Inserisci la tua password", - "Enter Your Role": "", + "Enter Your Role": "Inserisci il tuo ruolo", "Experimental": "Sperimentale", "Export All Chats (All Users)": "Esporta tutte le chat (tutti gli utenti)", "Export Chats": "Esporta chat", "Export Documents Mapping": "Esporta mappatura documenti", "Export Modelfiles": "Esporta file modello", "Export Prompts": "Esporta prompt", - "Failed to create API Key.": "", + "Failed to create API Key.": "Impossibile creare la chiave API.", "Failed to read clipboard contents": "Impossibile leggere il contenuto degli appunti", - "February": "", - "Feel free to add specific details": "", + "February": "Febbraio", + "Feel free to add specific details": "Sentiti libero/a di aggiungere dettagli specifici", "File Mode": "Modalità file", "File not found.": "File non trovato.", - "Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image.": "", + "Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image.": "Rilevato spoofing delle impronte digitali: impossibile utilizzare le iniziali come avatar. Ripristino all'immagine del profilo predefinita.", "Fluidly stream large external response chunks": "Trasmetti in modo fluido blocchi di risposta esterni di grandi dimensioni", "Focus chat input": "Metti a fuoco l'input della chat", - "Followed instructions perfectly": "", + "Followed instructions perfectly": "Ha seguito le istruzioni alla perfezione", "Format your variables using square brackets like this:": "Formatta le tue variabili usando parentesi quadre come questa:", "From (Base Model)": "Da (modello base)", "Full Screen Mode": "Modalità a schermo intero", "General": "Generale", "General Settings": "Impostazioni generali", - "Generation Info": "", - "Good Response": "", - "has no conversations.": "", + "Generation Info": "Informazioni generazione", + "Good Response": "Buona risposta", + "has no conversations.": "non ha conversazioni.", "Hello, {{name}}": "Ciao, {{name}}", - "Help": "", + "Help": "Aiuto", "Hide": "Nascondi", "Hide Additional Params": "Nascondi parametri aggiuntivi", "How can I help you today?": "Come posso aiutarti oggi?", - "Hybrid Search": "", + "Hybrid Search": "Ricerca ibrida", "Image Generation (Experimental)": "Generazione di immagini (sperimentale)", "Image Generation Engine": "Motore di generazione immagini", "Image Settings": "Impostazioni immagine", @@ -226,21 +226,21 @@ "Import Documents Mapping": "Importa mappatura documenti", "Import Modelfiles": "Importa file modello", "Import Prompts": "Importa prompt", - "Include `--api` flag when running stable-diffusion-webui": "", - "Input commands": "", + "Include `--api` flag when running stable-diffusion-webui": "Includi il flag `--api` quando esegui stable-diffusion-webui", + "Input commands": "Comandi di input", "Interface": "Interfaccia", - "Invalid Tag": "", - "January": "", + "Invalid Tag": "Tag non valido", + "January": "Gennaio", "join our Discord for help.": "unisciti al nostro Discord per ricevere aiuto.", "JSON": "JSON", - "July": "", - "June": "", + "July": "Luglio", + "June": "Giugno", "JWT Expiration": "Scadenza JWT", "JWT Token": "Token JWT", "Keep Alive": "Mantieni attivo", "Keyboard shortcuts": "Scorciatoie da tastiera", "Language": "Lingua", - "Last Active": "", + "Last Active": "Ultima attività", "Light": "Chiaro", "Listening...": "Ascolto...", "LLMs can make mistakes. Verify important information.": "Gli LLM possono commettere errori. Verifica le informazioni importanti.", @@ -249,22 +249,22 @@ "Manage LiteLLM Models": "Gestisci modelli LiteLLM", "Manage Models": "Gestisci modelli", "Manage Ollama Models": "Gestisci modelli Ollama", - "March": "", + "March": "Marzo", "Max Tokens": "Max token", "Maximum of 3 models can be downloaded simultaneously. Please try again later.": "È possibile scaricare un massimo di 3 modelli contemporaneamente. Riprova più tardi.", - "May": "", - "Messages you send after creating your link won't be shared. Users with the URL will beable to view the shared chat.": "", - "Minimum Score": "", + "May": "Maggio", + "Messages you send after creating your link won't be shared. Users with the URL will beable to view the shared chat.": "I messaggi che invii dopo aver creato il tuo link non verranno condivisi. Gli utenti con l'URL potranno visualizzare la chat condivisa.", + "Minimum Score": "Punteggio minimo", "Mirostat": "Mirostat", "Mirostat Eta": "Mirostat Eta", "Mirostat Tau": "Mirostat Tau", "MMMM DD, YYYY": "MMMM DD, YYYY", - "MMMM DD, YYYY HH:mm": "", + "MMMM DD, YYYY HH:mm": "MMMM DD, YYYY HH:mm", "Model '{{modelName}}' has been successfully downloaded.": "Il modello '{{modelName}}' è stato scaricato con successo.", "Model '{{modelTag}}' is already in queue for downloading.": "Il modello '{{modelTag}}' è già in coda per il download.", "Model {{modelId}} not found": "Modello {{modelId}} non trovato", "Model {{modelName}} already exists.": "Il modello {{modelName}} esiste già.", - "Model filesystem path detected. Model shortname is required for update, cannot continue.": "", + "Model filesystem path detected. Model shortname is required for update, cannot continue.": "Percorso del filesystem del modello rilevato. Il nome breve del modello è richiesto per l'aggiornamento, impossibile continuare.", "Model Name": "Nome modello", "Model not selected": "Modello non selezionato", "Model Tag Name": "Nome tag del modello", @@ -275,7 +275,7 @@ "Modelfile Content": "Contenuto del file modello", "Modelfiles": "File modello", "Models": "Modelli", - "More": "", + "More": "Altro", "My Documents": "I miei documenti", "My Modelfiles": "I miei file modello", "My Prompts": "I miei prompt", @@ -284,19 +284,19 @@ "Name your modelfile": "Assegna un nome al tuo file modello", "New Chat": "Nuova chat", "New Password": "Nuova password", - "No results found": "", + "No results found": "Nessun risultato trovato", "No source available": "Nessuna fonte disponibile", - "Not factually correct": "", + "Not factually correct": "Non corretto dal punto di vista fattuale", "Not sure what to add?": "Non sei sicuro di cosa aggiungere?", "Not sure what to write? Switch to": "Non sei sicuro di cosa scrivere? Passa a", - "Note: If you set a minimum score, the search will only return documents with a score greater than or equal to the minimum score.": "", + "Note: If you set a minimum score, the search will only return documents with a score greater than or equal to the minimum score.": "Nota: se imposti un punteggio minimo, la ricerca restituirà solo i documenti con un punteggio maggiore o uguale al punteggio minimo.", "Notifications": "Notifiche desktop", - "November": "", - "October": "", + "November": "Novembre", + "October": "Ottobre", "Off": "Disattivato", "Okay, Let's Go!": "Ok, andiamo!", - "OLED Dark": "", - "Ollama": "", + "OLED Dark": "OLED scuro", + "Ollama": "Ollama", "Ollama Base URL": "URL base Ollama", "Ollama Version": "Versione Ollama", "On": "Attivato", @@ -309,52 +309,52 @@ "Open AI": "Open AI", "Open AI (Dall-E)": "Open AI (Dall-E)", "Open new chat": "Apri nuova chat", - "OpenAI": "", + "OpenAI": "OpenAI", "OpenAI API": "API OpenAI", - "OpenAI API Config": "", + "OpenAI API Config": "Configurazione API OpenAI", "OpenAI API Key is required.": "La chiave API OpenAI è obbligatoria.", - "OpenAI URL/Key required.": "", + "OpenAI URL/Key required.": "URL/Chiave OpenAI obbligatori.", "or": "o", - "Other": "", - "Overview": "", + "Other": "Altro", + "Overview": "Panoramica", "Parameters": "Parametri", "Password": "Password", - "PDF document (.pdf)": "", + "PDF document (.pdf)": "Documento PDF (.pdf)", "PDF Extract Images (OCR)": "Estrazione immagini PDF (OCR)", "pending": "in sospeso", "Permission denied when accessing microphone: {{error}}": "Autorizzazione negata durante l'accesso al microfono: {{error}}", - "Plain text (.txt)": "", + "Plain text (.txt)": "Testo normale (.txt)", "Playground": "Terreno di gioco", - "Positive attitude": "", - "Previous 30 days": "", - "Previous 7 days": "", - "Profile Image": "", - "Prompt": "", - "Prompt (e.g. Tell me a fun fact about the Roman Empire)": "", + "Positive attitude": "Attitudine positiva", + "Previous 30 days": "Ultimi 30 giorni", + "Previous 7 days": "Ultimi 7 giorni", + "Profile Image": "Immagine del profilo", + "Prompt": "Prompt", + "Prompt (e.g. Tell me a fun fact about the Roman Empire)": "Prompt (ad esempio Dimmi un fatto divertente sull'Impero Romano)", "Prompt Content": "Contenuto del prompt", "Prompt suggestions": "Suggerimenti prompt", "Prompts": "Prompt", - "Pull \"{{searchValue}}\" from Ollama.com": "", + "Pull \"{{searchValue}}\" from Ollama.com": "Estrai \"{{searchValue}}\" da Ollama.com", "Pull a model from Ollama.com": "Estrai un modello da Ollama.com", "Pull Progress": "Avanzamento estrazione", "Query Params": "Parametri query", "RAG Template": "Modello RAG", "Raw Format": "Formato raw", - "Read Aloud": "", + "Read Aloud": "Leggi ad alta voce", "Record voice": "Registra voce", "Redirecting you to OpenWebUI Community": "Reindirizzamento alla comunità OpenWebUI", - "Refused when it shouldn't have": "", - "Regenerate": "", + "Refused when it shouldn't have": "Rifiutato quando non avrebbe dovuto", + "Regenerate": "Rigenera", "Release Notes": "Note di rilascio", - "Remove": "", - "Remove Model": "", - "Rename": "", + "Remove": "Rimuovi", + "Remove Model": "Rimuovi modello", + "Rename": "Rinomina", "Repeat Last N": "Ripeti ultimi N", "Repeat Penalty": "Penalità di ripetizione", "Request Mode": "Modalità richiesta", - "Reranking Model": "", - "Reranking model disabled": "", - "Reranking model set to \"{{reranking_model}}\"": "", + "Reranking Model": "Modello di riclassificazione", + "Reranking model disabled": "Modello di riclassificazione disabilitato", + "Reranking model set to \"{{reranking_model}}\"": "Modello di riclassificazione impostato su \"{{reranking_model}}\"", "Reset Vector Storage": "Reimposta archivio vettoriale", "Response AutoCopy to Clipboard": "Copia automatica della risposta negli appunti", "Role": "Ruolo", @@ -369,7 +369,7 @@ "Scan complete!": "Scansione completata!", "Scan for documents from {{path}}": "Cerca documenti da {{path}}", "Search": "Cerca", - "Search a model": "", + "Search a model": "Cerca un modello", "Search Documents": "Cerca documenti", "Search Prompts": "Cerca prompt", "See readme.md for instructions": "Vedi readme.md per le istruzioni", @@ -378,35 +378,35 @@ "Select a mode": "Seleziona una modalità", "Select a model": "Seleziona un modello", "Select an Ollama instance": "Seleziona un'istanza Ollama", - "Select model": "", + "Select model": "Seleziona modello", "Send a Message": "Invia un messaggio", "Send message": "Invia messaggio", - "September": "", + "September": "Settembre", "Server connection verified": "Connessione al server verificata", "Set as default": "Imposta come predefinito", "Set Default Model": "Imposta modello predefinito", - "Set embedding model (e.g. {{model}})": "", + "Set embedding model (e.g. {{model}})": "Imposta modello di embedding (ad esempio {{model}})", "Set Image Size": "Imposta dimensione immagine", "Set Model": "Imposta modello", - "Set reranking model (e.g. {{model}})": "", + "Set reranking model (e.g. {{model}})": "Imposta modello di riclassificazione (ad esempio {{model}})", "Set Steps": "Imposta passaggi", "Set Title Auto-Generation Model": "Imposta modello di generazione automatica del titolo", "Set Voice": "Imposta voce", "Settings": "Impostazioni", "Settings saved successfully!": "Impostazioni salvate con successo!", - "Share": "", - "Share Chat": "", + "Share": "Condividi", + "Share Chat": "Condividi chat", "Share to OpenWebUI Community": "Condividi con la comunità OpenWebUI", "short-summary": "riassunto-breve", "Show": "Mostra", "Show Additional Params": "Mostra parametri aggiuntivi", "Show shortcuts": "Mostra", - "Showcased creativity": "", + "Showcased creativity": "Creatività messa in mostra", "sidebar": "barra laterale", "Sign in": "Accedi", "Sign Out": "Esci", "Sign up": "Registrati", - "Signing in": "", + "Signing in": "Accesso in corso", "Source": "Fonte", "Speech recognition error: {{error}}": "Errore di riconoscimento vocale: {{error}}", "Speech-to-Text Engine": "Motore da voce a testo", @@ -414,37 +414,37 @@ "Stop Sequence": "Sequenza di arresto", "STT Settings": "Impostazioni STT", "Submit": "Invia", - "Subtitle (e.g. about the Roman Empire)": "", + "Subtitle (e.g. about the Roman Empire)": "Sottotitolo (ad esempio sull'Impero Romano)", "Success": "Successo", "Successfully updated.": "Aggiornato con successo.", - "Suggested": "", + "Suggested": "Suggerito", "Sync All": "Sincronizza tutto", "System": "Sistema", "System Prompt": "Prompt di sistema", "Tags": "Tag", - "Tell us more:": "", + "Tell us more:": "Raccontaci di più:", "Temperature": "Temperatura", "Template": "Modello", "Text Completion": "Completamento del testo", "Text-to-Speech Engine": "Motore da testo a voce", "Tfs Z": "Tfs Z", - "Thanks for your feedback!": "", - "The score should be a value between 0.0 (0%) and 1.0 (100%).": "", + "Thanks for your feedback!": "Grazie per il tuo feedback!", + "The score should be a value between 0.0 (0%) and 1.0 (100%).": "Il punteggio dovrebbe essere un valore compreso tra 0.0 (0%) e 1.0 (100%).", "Theme": "Tema", "This ensures that your valuable conversations are securely saved to your backend database. Thank you!": "Ciò garantisce che le tue preziose conversazioni siano salvate in modo sicuro nel tuo database backend. Grazie!", "This setting does not sync across browsers or devices.": "Questa impostazione non si sincronizza tra browser o dispositivi.", - "Thorough explanation": "", + "Thorough explanation": "Spiegazione dettagliata", "Tip: Update multiple variable slots consecutively by pressing the tab key in the chat input after each replacement.": "Suggerimento: aggiorna più slot di variabili consecutivamente premendo il tasto tab nell'input della chat dopo ogni sostituzione.", "Title": "Titolo", - "Title (e.g. Tell me a fun fact)": "", + "Title (e.g. Tell me a fun fact)": "Titolo (ad esempio Dimmi un fatto divertente)", "Title Auto-Generation": "Generazione automatica del titolo", - "Title cannot be an empty string.": "", + "Title cannot be an empty string.": "Il titolo non può essere una stringa vuota.", "Title Generation Prompt": "Prompt di generazione del titolo", "to": "a", "To access the available model names for downloading,": "Per accedere ai nomi dei modelli disponibili per il download,", "To access the GGUF models available for downloading,": "Per accedere ai modelli GGUF disponibili per il download,", "to chat input.": "all'input della chat.", - "Today": "", + "Today": "Oggi", "Toggle settings": "Attiva/disattiva impostazioni", "Toggle sidebar": "Attiva/disattiva barra laterale", "Top K": "Top K", @@ -454,7 +454,7 @@ "Type Hugging Face Resolve (Download) URL": "Digita l'URL di Hugging Face Resolve (Download)", "Uh-oh! There was an issue connecting to {{provider}}.": "Uh-oh! Si è verificato un problema durante la connessione a {{provider}}.", "Unknown File Type '{{file_type}}', but accepting and treating as plain text": "Tipo di file sconosciuto '{{file_type}}', ma accettato e trattato come testo normale", - "Update and Copy Link": "", + "Update and Copy Link": "Aggiorna e copia link", "Update password": "Aggiorna password", "Upload a GGUF model": "Carica un modello GGUF", "Upload files": "Carica file", @@ -462,7 +462,7 @@ "URL Mode": "Modalità URL", "Use '#' in the prompt input to load and select your documents.": "Usa '#' nell'input del prompt per caricare e selezionare i tuoi documenti.", "Use Gravatar": "Usa Gravatar", - "Use Initials": "", + "Use Initials": "Usa iniziali", "user": "utente", "User Permissions": "Autorizzazioni utente", "Users": "Utenti", @@ -471,11 +471,11 @@ "variable": "variabile", "variable to have them replaced with clipboard content.": "variabile per farli sostituire con il contenuto degli appunti.", "Version": "Versione", - "Warning: If you update or change your embedding model, you will need to re-import all documents.": "", + "Warning: If you update or change your embedding model, you will need to re-import all documents.": "Attenzione: se aggiorni o cambi il tuo modello di embedding, dovrai reimportare tutti i documenti.", "Web": "Web", - "Web Loader Settings": "", - "Web Params": "", - "Webhook URL": "", + "Web Loader Settings": "Impostazioni del caricatore Web", + "Web Params": "Parametri Web", + "Webhook URL": "URL webhook", "WebUI Add-ons": "Componenti aggiuntivi WebUI", "WebUI Settings": "Impostazioni WebUI", "WebUI will make requests to": "WebUI effettuerà richieste a", @@ -484,12 +484,12 @@ "Whisper (Local)": "Whisper (locale)", "Write a prompt suggestion (e.g. Who are you?)": "Scrivi un suggerimento per il prompt (ad esempio Chi sei?)", "Write a summary in 50 words that summarizes [topic or keyword].": "Scrivi un riassunto in 50 parole che riassume [argomento o parola chiave].", - "Yesterday": "", + "Yesterday": "Ieri", "You": "Tu", - "You have no archived conversations.": "", - "You have shared this chat": "", + "You have no archived conversations.": "Non hai conversazioni archiviate.", + "You have shared this chat": "Hai condiviso questa chat", "You're a helpful assistant.": "Sei un assistente utile.", "You're now logged in.": "Ora hai effettuato l'accesso.", - "Youtube": "", - "Youtube Loader Settings": "" + "Youtube": "Youtube", + "Youtube Loader Settings": "Impostazioni del caricatore Youtube" } From 39fdd95a0ce1686e6b8ed32555462015b499b075 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 14 May 2024 12:09:30 -1000 Subject: [PATCH 04/11] refac: styling --- src/lib/components/chat/ModelSelector.svelte | 4 +- .../chat/ModelSelector/Selector.svelte | 2 +- src/lib/components/layout/Navbar.svelte | 38 +++++++++++-- src/lib/components/layout/Sidebar.svelte | 57 +++++++++++++------ 4 files changed, 75 insertions(+), 26 deletions(-) diff --git a/src/lib/components/chat/ModelSelector.svelte b/src/lib/components/chat/ModelSelector.svelte index 86819afca..89efbd2c1 100644 --- a/src/lib/components/chat/ModelSelector.svelte +++ b/src/lib/components/chat/ModelSelector.svelte @@ -38,7 +38,7 @@ } -
+
{#each selectedModels as selectedModel, selectedModelIdx}
@@ -109,7 +109,7 @@
{#if showSetDefault} -
+ {/if} diff --git a/src/lib/components/chat/ModelSelector/Selector.svelte b/src/lib/components/chat/ModelSelector/Selector.svelte index 88b62a455..185f11302 100644 --- a/src/lib/components/chat/ModelSelector/Selector.svelte +++ b/src/lib/components/chat/ModelSelector/Selector.svelte @@ -204,7 +204,7 @@ diff --git a/src/lib/components/layout/Navbar.svelte b/src/lib/components/layout/Navbar.svelte index 57b09a19b..5c7d9b274 100644 --- a/src/lib/components/layout/Navbar.svelte +++ b/src/lib/components/layout/Navbar.svelte @@ -2,7 +2,7 @@ import { getContext } from 'svelte'; import { toast } from 'svelte-sonner'; - import { WEBUI_NAME, chatId, modelfiles, settings, showSettings } from '$lib/stores'; + import { WEBUI_NAME, chatId, modelfiles, settings, showSettings, showSidebar } from '$lib/stores'; import { slide } from 'svelte/transition'; import ShareChatModal from '../chat/ShareChatModal.svelte'; @@ -28,8 +28,34 @@