From 04955032e0c9f99a4ebfe4e97cf564469e849564 Mon Sep 17 00:00:00 2001 From: magicalastrogy Date: Mon, 22 Jun 2026 16:08:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E9=98=B2=20429?= =?UTF-8?q?=20=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/function/update/invoke_extra_model.ts | 5 ++- src/panel/update/Prompt.vue | 11 ++++++ src/store.ts | 1 + tests/extra_model_max_chat_history.test.ts | 41 ++++++++++++++++++---- tests/store_response_format.test.ts | 6 ++++ 5 files changed, 57 insertions(+), 7 deletions(-) diff --git a/src/function/update/invoke_extra_model.ts b/src/function/update/invoke_extra_model.ts index 9b805a3..5ca90b3 100644 --- a/src/function/update/invoke_extra_model.ts +++ b/src/function/update/invoke_extra_model.ts @@ -526,11 +526,14 @@ async function requestReply(generation_id?: string, batch_id?: string): Promise< ? SillyTavern.getChatCompletionModel() : store.settings.额外模型解析配置.模型名称; const is_gemini = model_name.toLowerCase().includes('gemini'); + const anti_429_header_prompts = store.settings.额外模型解析配置.开启防429 + ? [{ role: 'system' as const, content: batch_id ?? generateRandomHeader() }] + : []; const result = await generateRaw({ ...config, ordered_prompts: [ - { role: 'system', content: batch_id ?? generateRandomHeader() }, + ...anti_429_header_prompts, { role: 'system', content: is_gemini ? decoded_gemini_head : decoded_claude_head }, { role: 'system', content: '' }, 'persona_description', diff --git a/src/panel/update/Prompt.vue b/src/panel/update/Prompt.vue index 6b52f01..e36860f 100644 --- a/src/panel/update/Prompt.vue +++ b/src/panel/update/Prompt.vue @@ -19,6 +19,17 @@ + + + + 开启防 429 + + +