From 7948886c1d6577ee771aab694847e3dfb3c85980 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Sat, 25 Apr 2026 21:05:39 +0300 Subject: [PATCH] Add Tool Call Recurse Limit slider to Chat Completion settings (#5518) * feat: add Tool Call Recurse Limit slider to Chat/Message Handling settings Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/ecbde89f-8f4d-4e91-9189-a998d12ca76b Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com> * feat: move tool call recurse limit to openai_settings under Chat Completion settings Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/132e4c28-9564-47cd-92c1-e8ab50d88905 Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com> * refactor: use CSS :has() selector instead of JS toggle for tool_call_recurse_limit_block visibility Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/c562deb5-05ce-4ebf-84a0-9eeea9d24433 Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com> * fix: wrap tool_call_recurse_limit_block in range-block for correct layout Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/4d25a367-ac12-4e54-83b0-1543eb6f370a Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com> * fix: data-i18n attribute --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com> --- package-lock.json | 14 -------------- public/css/toggle-dependent.css | 4 ++++ public/index.html | 14 ++++++++++++++ public/scripts/openai.js | 10 ++++++++++ 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 709c19b64..4c18e660d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -549,7 +549,6 @@ "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.22.12.tgz", "integrity": "sha512-xcmww1O/JFP2MrlGUMd3Q78S3Qu6W3mYTXYuIqFq33EorgYHV/HqymHfXy9GjiCJ7OI+7lWx6nYFOzU7M4rd1Q==", "license": "MIT", - "peer": true, "dependencies": { "@jimp/core": "^0.22.12" } @@ -1011,7 +1010,6 @@ "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-1.6.0.tgz", "integrity": "sha512-uSUD1mqXN9i1SGSz5ov3keRZ7S9L32/mAQG08wUwZiEi5FpbV0K8A8l1zkazAIZi9IJzLlTauRNU41Mi8IF9fA==", "license": "MIT", - "peer": true, "dependencies": { "@jimp/core": "1.6.0", "@jimp/types": "1.6.0", @@ -1043,7 +1041,6 @@ "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.22.12.tgz", "integrity": "sha512-dghs92qM6MhHj0HrV2qAwKPMklQtjNpoYgAB94ysYpsXslhRTiPisueSIELRwZGEr0J0VUxpUY7HgJwlSIgGZw==", "license": "MIT", - "peer": true, "dependencies": { "@jimp/utils": "^0.22.12" }, @@ -1139,7 +1136,6 @@ "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.22.12.tgz", "integrity": "sha512-xslz2ZoFZOPLY8EZ4dC29m168BtDx95D6K80TzgUi8gqT7LY6CsajWO0FAxDwHz6h0eomHMfyGX0stspBrTKnQ==", "license": "MIT", - "peer": true, "dependencies": { "@jimp/utils": "^0.22.12" }, @@ -1176,7 +1172,6 @@ "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.22.12.tgz", "integrity": "sha512-xImhTE5BpS8xa+mAN6j4sMRWaUgUDLoaGHhJhpC+r7SKKErYDR0WQV4yCE4gP+N0gozD0F3Ka1LUSaMXrn7ZIA==", "license": "MIT", - "peer": true, "dependencies": { "@jimp/utils": "^0.22.12", "tinycolor2": "^1.6.0" @@ -1220,7 +1215,6 @@ "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.22.12.tgz", "integrity": "sha512-FNuUN0OVzRCozx8XSgP9MyLGMxNHHJMFt+LJuFjn1mu3k0VQxrzqbN06yIl46TVejhyAhcq5gLzqmSCHvlcBVw==", "license": "MIT", - "peer": true, "dependencies": { "@jimp/utils": "^0.22.12" }, @@ -1308,7 +1302,6 @@ "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.22.12.tgz", "integrity": "sha512-3NyTPlPbTnGKDIbaBgQ3HbE6wXbAlFfxHVERmrbqAi8R3r6fQPxpCauA8UVDnieg5eo04D0T8nnnNIX//i/sXg==", "license": "MIT", - "peer": true, "dependencies": { "@jimp/utils": "^0.22.12" }, @@ -1321,7 +1314,6 @@ "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.22.12.tgz", "integrity": "sha512-9YNEt7BPAFfTls2FGfKBVgwwLUuKqy+E8bDGGEsOqHtbuhbshVGxN2WMZaD4gh5IDWvR+emmmPPWGgaYNYt1gA==", "license": "MIT", - "peer": true, "dependencies": { "@jimp/utils": "^0.22.12" }, @@ -1922,7 +1914,6 @@ "integrity": "sha512-Crp6WY9aTYP3qPi2wGDo9iUe/rceX01UMhnF1jmwDcKCFM6cx7YhGP/Mpr3y9AASpfHixIG0E6azCcL5OcDHsQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/body-parser": "*", "@types/express-serve-static-core": "^4.17.33", @@ -2612,7 +2603,6 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -3232,7 +3222,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", @@ -4567,7 +4556,6 @@ "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", @@ -8125,7 +8113,6 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz", "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==", "license": "MIT", - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -9143,7 +9130,6 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/public/css/toggle-dependent.css b/public/css/toggle-dependent.css index 271ea21e9..731f57cc9 100644 --- a/public/css/toggle-dependent.css +++ b/public/css/toggle-dependent.css @@ -565,6 +565,10 @@ label[for="bind_preset_to_connection"]:has(input:checked) { display: none; } +#openai_settings:has(#openai_function_calling:not(:checked)) #tool_call_recurse_limit_block { + display: none; +} + #adaptive_p_block:has([data-tg-samplers="adaptive_target"][style*="display: none"]):has([data-tg-samplers="adaptive_decay"][style*="display: none"]) { display: none; } diff --git a/public/index.html b/public/index.html index f5a86dfd6..86928b536 100644 --- a/public/index.html +++ b/public/index.html @@ -2011,6 +2011,20 @@ Can be utilized by various extensions to provide additional functionality. Not supported when Prompt Post-Processing with "no tools" is used! +
+
+ Tool Call Recurse Limit +
+
+
+
+ +
+
+ +
+
+
diff --git a/public/scripts/openai.js b/public/scripts/openai.js index a1b0da67d..58cdcc766 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -383,6 +383,7 @@ export const settingsToUpdate = { continue_prefill: ['#continue_prefill', 'continue_prefill', true, false], continue_postfix: ['#continue_postfix', 'continue_postfix', false, false], function_calling: ['#openai_function_calling', 'function_calling', true, false], + tool_call_recurse_limit: ['#tool_call_recurse_limit', 'tool_call_recurse_limit', false, false], show_thoughts: ['#openai_show_thoughts', 'show_thoughts', true, false], reasoning_effort: ['#openai_reasoning_effort', 'reasoning_effort', false, false], verbosity: ['#openai_verbosity', 'verbosity', false, false], @@ -492,6 +493,7 @@ const default_settings = { bypass_status_check: false, continue_prefill: false, function_calling: false, + tool_call_recurse_limit: 5, names_behavior: character_names_behavior.DEFAULT, continue_postfix: continue_postfix_types.SPACE, custom_prompt_post_processing: custom_prompt_post_processing_types.NONE, @@ -4224,6 +4226,7 @@ function loadOpenAISettings(data, settings) { setNamesBehaviorControls(); setContinuePostfixControls(); setToolReasoningControls(); + ToolManager.RECURSE_LIMIT = oai_settings.tool_call_recurse_limit; $('#openrouter_providers_chat').trigger('change'); $('#openrouter_quantizations_chat').trigger('change'); @@ -6826,6 +6829,13 @@ export function initOpenAI() { saveSettingsDebounced(); }); + $('#tool_call_recurse_limit').on('input', function () { + oai_settings.tool_call_recurse_limit = Number($(this).val()); + $('#tool_call_recurse_limit_counter').val(oai_settings.tool_call_recurse_limit); + ToolManager.RECURSE_LIMIT = oai_settings.tool_call_recurse_limit; + saveSettingsDebounced(); + }); + $('#tool_reasoning_mode').on('input', function () { oai_settings.tool_reasoning_mode = getToolReasoningMode({ ...oai_settings,