v0.11.9: 修复纯文本消息卡片丢失 + 子代理参数可配置
fix: 恢复纯文本消息的 else if 分支,修复 fed1e6d 重构后用户消息卡片不显示
fix: allVids 类型注解补充 base64 字段,消除 TS2322 编译错误
feat: 子代理最大轮次和超时接入设置面板(subAgentMaxLoops/subAgentTimeout)
chore: 版本号 0.11.7 → 0.11.9
This commit is contained in:
@@ -1018,7 +1018,7 @@ async function sendMessageWithAgentLoop(text: string, currentSession: ChatSessio
|
||||
} else if (pendingImages.length > 1) {
|
||||
apiParts.push(`[${pendingImages.length} 张图片: ${pendingImages.map(img => img.name).join(', ')}]`);
|
||||
}
|
||||
let allVids: Array<{ name: string; count: number; dur: number; frames: Array<{ timestampSeconds: number; name: string }> }> = [];
|
||||
let allVids: Array<{ name: string; count: number; dur: number; frames: Array<{ timestampSeconds: number; name: string; base64: string }> }> = [];
|
||||
if (hasVideos) {
|
||||
if (pendingVideoMeta && pendingVideoFrames.length > 0) {
|
||||
allVids.push({ name: pendingVideoMeta.fileName, count: pendingVideoFrames.length, dur: pendingVideoMeta.duration, frames: pendingVideoFrames });
|
||||
@@ -1052,6 +1052,18 @@ async function sendMessageWithAgentLoop(text: string, currentSession: ChatSessio
|
||||
msg._fileContents = pendingFiles.map(f => ({ language: f.language, content: f.content }));
|
||||
}
|
||||
msgsToAdd.push(msg);
|
||||
} else if (text || pendingFiles.length > 0) {
|
||||
// 纯文本/纯文件消息(无图片、视频附件)
|
||||
const msg: ChatMessage = {
|
||||
role: 'user',
|
||||
content: text || '',
|
||||
timestamp: now
|
||||
};
|
||||
if (userFiles.length > 0) {
|
||||
msg.files = userFiles;
|
||||
msg._fileContents = pendingFiles.map(f => ({ language: f.language, content: f.content }));
|
||||
}
|
||||
msgsToAdd.push(msg);
|
||||
}
|
||||
|
||||
const isFirstMsg = currentSession.messages.length === 0;
|
||||
|
||||
@@ -471,6 +471,29 @@ document.querySelector('#selectSubAgentModel')?.addEventListener('change', async
|
||||
logSetting('子代理默认模型', val || '跟随当前模型');
|
||||
});
|
||||
|
||||
// 子代理最大轮次
|
||||
const saveSubAgentMaxLoops = debounce(async () => {
|
||||
const db = state.get<ChatDB | null>(KEYS.DB);
|
||||
const val = (document.querySelector('#inputSubAgentMaxLoops') as HTMLInputElement).value.trim();
|
||||
const maxLoops = val ? parseInt(val) : 10;
|
||||
state.set('subAgentMaxLoops', maxLoops);
|
||||
if (db) await db.saveSetting('subAgentMaxLoops', maxLoops);
|
||||
logSetting('子代理最大轮次', `${maxLoops} 轮`);
|
||||
}, 500);
|
||||
document.querySelector('#inputSubAgentMaxLoops')?.addEventListener('input', saveSubAgentMaxLoops);
|
||||
|
||||
// 子代理超时(秒)
|
||||
const saveSubAgentTimeout = debounce(async () => {
|
||||
const db = state.get<ChatDB | null>(KEYS.DB);
|
||||
const val = (document.querySelector('#inputSubAgentTimeout') as HTMLInputElement).value.trim();
|
||||
const sec = val ? parseInt(val) : -1; // -1=默认
|
||||
const ms = sec >= 0 ? sec * 1000 : 300_000;
|
||||
state.set('subAgentTimeout', ms);
|
||||
if (db) await db.saveSetting('subAgentTimeout', sec);
|
||||
logSetting('子代理超时', sec >= 0 ? (sec === 0 ? '已禁用' : `${sec}s`) : '默认(300s)');
|
||||
}, 500);
|
||||
document.querySelector('#inputSubAgentTimeout')?.addEventListener('input', saveSubAgentTimeout);
|
||||
|
||||
function updateMemoryVectorStatus(): void {
|
||||
const statusEl = document.querySelector('#memoryVectorStatus');
|
||||
if (!statusEl) return;
|
||||
|
||||
Reference in New Issue
Block a user