release: v2.2.3 [2026-05-29 13:07:39]

### 新功能
- Function Call 填表开关下方新增公益站风险提示横幅:部分公益站会屏蔽 tools 参数,请确认支持情况避免被意外封禁
### 修复
- **Function Call 填表**:
  - 修复 ST 代理以 HTTP 200 + error body 形式返回错误、导致降级重试机制从未触发的问题
  - 修复思考模式模型(如 DeepSeek v4-flash)因 tool_choice 不兼容返回 Bad Request 后正确降级并重试
  - 重试时自动追加强制调用指令,防止思考模型绕过工具直接输出文本造成无效二次开销
- **超级记忆 / 翰林院**:
  - 修复 `getRagSettings()` 读写顶层路径而非嵌套路径,导致打开超级记忆面板后向量化、归档等开关在重载时被全默认值覆盖的问题
  - 修复自动归档失效问题
  - 修复归档管理器在同一事件中被三次触发的回归问题
  - 修复翰林院设置旧版迁移逻辑异常
This commit is contained in:
Jenkins CI
2026-05-29 13:07:39 +08:00
parent 08e1dbde85
commit 9bc2f694b0
9 changed files with 50 additions and 10 deletions

View File

@@ -985,7 +985,11 @@ export async function callAIForTools(messages, tool, options = {}) {
return null;
}
const buildFCBody = (withToolChoice, overrideMessages) => ({
// deepseek.com 域名或模型名含 deepseek 时,第一次调用主动关闭思考模式,
// 让 tool_choice 强制走 Function Call思考模式下 tool_choice 会报错/失败)
const isDeepSeek = /deepseek/i.test(finalOptions.apiUrl || '') || /deepseek/i.test(finalOptions.model || '');
const buildFCBody = (withToolChoice, overrideMessages, extraParams = {}) => ({
chat_completion_source: 'openai',
reverse_proxy: finalOptions.apiUrl,
proxy_password: finalOptions.apiKey,
@@ -995,15 +999,16 @@ export async function callAIForTools(messages, tool, options = {}) {
temperature: finalOptions.temperature ?? 1,
stream: false,
...(finalOptions.customParams || {}),
...extraParams,
tools: [tool],
...(withToolChoice ? { tool_choice: { type: 'function', function: { name: tool.function.name } } } : {}),
});
const doFCRequest = async (withToolChoice, overrideMessages) => {
const doFCRequest = async (withToolChoice, overrideMessages, extraParams) => {
const response = await fetch('/api/backends/chat-completions/generate', {
method: 'POST',
headers: { ...getRequestHeaders(), 'Content-Type': 'application/json' },
body: JSON.stringify(buildFCBody(withToolChoice, overrideMessages)),
body: JSON.stringify(buildFCBody(withToolChoice, overrideMessages, extraParams)),
});
if (!response.ok) {
const errorText = await response.text();
@@ -1026,7 +1031,10 @@ export async function callAIForTools(messages, tool, options = {}) {
let data;
try {
// 走 ST 后端代理,避免浏览器 CSP 拦截直连外部 URL
data = await doFCRequest(true);
// DeepSeek 思考模式与 tool_choice 不兼容,第一次请求时主动关闭思考模式
const firstAttemptExtra = isDeepSeek ? { thinking: { type: 'disabled' } } : {};
if (isDeepSeek) console.log('[Amily2-外交部] 检测到 DeepSeek 端点,首次 FC 请求附加 thinking:disabled');
data = await doFCRequest(true, undefined, firstAttemptExtra);
} catch (firstError) {
// 首次失败(含 ST 代理吞掉错误码场景)无条件去掉 tool_choice 重试一次
// 思考模式模型支持 tools 但不支持强制 tool_choice追加强制指令防止模型直接输出文本

View File

@@ -346,6 +346,20 @@ function getSettings() {
if (s.rerank?.priorityRetrieval && !s.rerank.priorityRetrieval.sources) {
s.rerank.priorityRetrieval.sources = structuredClone(ragDefaultSettings.rerank.priorityRetrieval.sources);
}
// 确保 sources 中每个来源条目完整(新增来源 / 新增字段时旧用户不会缺失)
if (s.rerank?.priorityRetrieval?.sources) {
const defaultSources = ragDefaultSettings.rerank.priorityRetrieval.sources;
for (const sourceName in defaultSources) {
if (!s.rerank.priorityRetrieval.sources[sourceName]) {
s.rerank.priorityRetrieval.sources[sourceName] = structuredClone(defaultSources[sourceName]);
} else {
const existing = s.rerank.priorityRetrieval.sources[sourceName];
for (const key in defaultSources[sourceName]) {
if (existing[key] === undefined) existing[key] = defaultSources[sourceName][key];
}
}
}
}
return s;
}

View File

@@ -417,7 +417,9 @@ export function startBatchFilling() {
manualStopRequested = false;
const context = getContext();
chatHistoryLength = context.chat.length;
threshold = parseInt(document.getElementById('batch-filling-threshold')?.value, 10) || 30;
threshold = extension_settings[extensionName]?.batch_filling_threshold
?? parseInt(/** @type {HTMLInputElement|null} */ (document.getElementById('batch-filling-threshold'))?.value, 10)
?? 30;
const ruleTemplate = getBatchFillerRuleTemplate();
const flowTemplate = getBatchFillerFlowTemplate();

View File

@@ -161,4 +161,7 @@ export const tableSystemDefaultSettings = {
// Function Call 填表
tableFillFunctionCall: false,
// 批量填表每批楼层数
batch_filling_threshold: 30,
};