diff --git a/.eslintrc.js b/.eslintrc.js index 8d9e36fe3..8d8386505 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -59,15 +59,18 @@ module.exports = { }, }, ], - // There are various vendored libraries that shouldn't be linted ignorePatterns: [ - 'public/lib/**/*', - '*.min.js', - 'src/ai_horde/**/*', - 'plugins/**/*', - 'data/**/*', - 'backups/**/*', - 'node_modules/**/*', + '**/node_modules/**', + '**/dist/**', + '**/.git/**', + 'public/lib/**', + 'backups/**', + 'data/**', + 'cache/**', + 'src/tokenizers/**', + 'docker/**', + 'plugins/**', + '**/*.min.js', ], rules: { 'no-unused-vars': ['error', { args: 'none' }], diff --git a/default/config.yaml b/default/config.yaml index a7e7a747e..b3057451a 100644 --- a/default/config.yaml +++ b/default/config.yaml @@ -121,6 +121,8 @@ extras: speechToTextModel: Xenova/whisper-small textToSpeechModel: Xenova/speecht5_tts # -- OPENAI CONFIGURATION -- +# A placeholder message to use in strict prompt post-processing mode when the prompt doesn't start with a user message +promptPlaceholder: "[Start a new chat]" openai: # Will send a random user ID to OpenAI completion API randomizeUserId: false diff --git a/jsconfig.json b/jsconfig.json index a48606f1f..0e554015b 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -11,15 +11,14 @@ "resolveJsonModule": true }, "exclude": [ - "node_modules", - "**/node_modules/*", - "public/lib", - "backups/*", - "data/*", - "**/dist/*", - "dist/*", - "cache/*", - "src/tokenizers/*", - "docker/*", + "**/node_modules/**", + "**/dist/**", + "**/.git/**", + "public/lib/**", + "backups/**", + "data/**", + "cache/**", + "src/tokenizers/**", + "docker/**" ] } diff --git a/package-lock.json b/package-lock.json index 94134d9b0..59b3cad86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -59,9 +59,10 @@ "sillytavern": "server.js" }, "devDependencies": { + "@types/dompurify": "^3.0.5", "@types/jquery": "^3.5.29", - "eslint": "^8.57.0", - "jquery": "^3.6.4" + "@types/toastr": "^2.1.43", + "eslint": "^8.57.0" }, "engines": { "node": ">= 18" @@ -960,6 +961,16 @@ "@types/responselike": "^1.0.0" } }, + "node_modules/@types/dompurify": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/dompurify/-/dompurify-3.0.5.tgz", + "integrity": "sha512-1Wg0g3BtQF7sSb27fJQAKck1HECM6zV1EB66j8JH9i3LCjYabJa0FSdiSgsD5K/RbrsR0SiraKacLB+T8ZVYAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/trusted-types": "*" + } + }, "node_modules/@types/http-cache-semantics": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.2.tgz", @@ -967,10 +978,11 @@ "license": "MIT" }, "node_modules/@types/jquery": { - "version": "3.5.29", - "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.29.tgz", - "integrity": "sha512-oXQQC9X9MOPRrMhPHHOsXqeQDnWeCDT3PelUIg/Oy8FAbzSZtFHRjc7IpbfFVmpLtJ+UOoywpRsuO5Jxjybyeg==", + "version": "3.5.31", + "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.31.tgz", + "integrity": "sha512-rf/iB+cPJ/YZfMwr+FVuQbm7IaWC4y3FVYfVDxRGqmUCFjjPII0HWaP0vTPJGp6m4o13AXySCcMbWfrWtBFAKw==", "dev": true, + "license": "MIT", "dependencies": { "@types/sizzle": "*" } @@ -1021,6 +1033,23 @@ "integrity": "sha512-0vWLNK2D5MT9dg0iOo8GlKguPAU02QjmZitPEsXRuJXU/OGIOt9vT9Fc26wtYuavLxtO45v9PGleoL9Z0k1LHg==", "dev": true }, + "node_modules/@types/toastr": { + "version": "2.1.43", + "resolved": "https://registry.npmjs.org/@types/toastr/-/toastr-2.1.43.tgz", + "integrity": "sha512-sLC2fr2OXeE1iyhUixpQ64wQ2tA26awmLidn4tXTLBz4yP/VhtYUKHpmiIyDtztKkHjucdiTLH8F5uRRyhNi2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/jquery": "*" + } + }, + "node_modules/@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "dev": true, + "license": "MIT" + }, "node_modules/@ungap/structured-clone": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", @@ -3881,13 +3910,6 @@ "integrity": "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==", "license": "BSD-3-Clause" }, - "node_modules/jquery": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.0.tgz", - "integrity": "sha512-umpJ0/k8X0MvD1ds0P9SfowREz2LenHsQaxSohMZ5OMNEU2r0tf8pdeEFTHMFxWVxKNyU9rTtK3CWzUCTKJUeQ==", - "dev": true, - "license": "MIT" - }, "node_modules/js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", diff --git a/package.json b/package.json index 382d6ab57..97ec01a9c 100644 --- a/package.json +++ b/package.json @@ -85,8 +85,9 @@ }, "main": "server.js", "devDependencies": { + "@types/dompurify": "^3.0.5", "@types/jquery": "^3.5.29", - "eslint": "^8.57.0", - "jquery": "^3.6.4" + "@types/toastr": "^2.1.43", + "eslint": "^8.57.0" } } diff --git a/public/css/st-tailwind.css b/public/css/st-tailwind.css index 69f5843a9..88e4ccb10 100644 --- a/public/css/st-tailwind.css +++ b/public/css/st-tailwind.css @@ -612,3 +612,7 @@ ul.li-padding-bot5 li { ul.li-padding-bot10 li { padding-bottom: 10px; } + +.wordBreakAll { + word-break: break-all; +} diff --git a/public/css/toggle-dependent.css b/public/css/toggle-dependent.css index 9ffc382cc..08bb08fe0 100644 --- a/public/css/toggle-dependent.css +++ b/public/css/toggle-dependent.css @@ -463,3 +463,14 @@ body.expandMessageActions .mes .mes_buttons .extraMesButtonsHint { label[for="trim_spaces"]:has(input:checked) i.warning { display: none; } + +#claude_function_prefill_warning { + display: none; +} + +#openai_settings:has(#openai_function_calling:checked):has(#claude_assistant_prefill:not(:placeholder-shown), #claude_assistant_impersonation:not(:placeholder-shown)) #claude_function_prefill_warning { + display: flex; + align-items: center; + gap: 5px; + margin: 10px 0; +} diff --git a/public/global.d.ts b/public/global.d.ts index c8bfe14c2..a33182d46 100644 --- a/public/global.d.ts +++ b/public/global.d.ts @@ -1,5 +1,4 @@ // Global namespace modules -declare var DOMPurify; declare var droll; declare var Handlebars; declare var hljs; @@ -1365,44 +1364,3 @@ declare namespace moment { declare global { const moment: typeof moment; } - -/** - * Callback data for the `LLM_FUNCTION_TOOL_REGISTER` event type that is triggered when a function tool can be registered. - */ -interface FunctionToolRegister { - /** - * The type of generation that is being used - */ - type?: string; - /** - * Generation data, including messages and sampling parameters - */ - data: Record; - /** - * Callback to register an LLM function tool. - */ - registerFunctionTool: typeof registerFunctionTool; -} - -/** - * Callback data for the `LLM_FUNCTION_TOOL_REGISTER` event type that is triggered when a function tool is registered. - * @param name Name of the function tool to register - * @param description Description of the function tool - * @param params JSON schema for the parameters of the function tool - * @param required Whether the function tool should be forced to be used - */ -declare function registerFunctionTool(name: string, description: string, params: object, required: boolean): Promise; - -/** - * Callback data for the `LLM_FUNCTION_TOOL_CALL` event type that is triggered when a function tool is called. - */ -interface FunctionToolCall { - /** - * Name of the function tool to call - */ - name: string; - /** - * JSON object with the parameters to pass to the function tool - */ - arguments: string; -} diff --git a/public/index.html b/public/index.html index 9a71ba897..afed83cab 100644 --- a/public/index.html +++ b/public/index.html @@ -1873,6 +1873,10 @@ +
+ + Prefills won't work when function calling is enabled and any tools are registered. +