feat: Page AI Reasonix desktop session alignment, settings IA cleanup, knowledge RAG hardening
- ACP client/session manager: Reasonix desktop live session context - Hermes tools: knowledge_rag tool manifest and skill updates - Browser runtime: sidebar page AI permission/profile/render/session/tree modules - Routes: hermes_client, hermes_tools, knowledge_rag, web_shell - Scripts: reasonix ACP wrapper, LightRAG MCP, smoke tasks 159/558/559/561/562 - Skills: mnote-knowledge-rag and mnote-lightrag-bridge SKILL.md updates
This commit is contained in:
@@ -356,11 +356,12 @@ function openEditorUploadFilePicker(detail, deps) {
|
||||
async function fetchWithTimeout(input, init, timeoutMs, label) {
|
||||
var controller = typeof AbortController === 'function' ? new AbortController() : null;
|
||||
var timer = 0;
|
||||
var timeout = Math.max(1000, Number(timeoutMs) || 15000);
|
||||
try {
|
||||
if (controller) {
|
||||
timer = window.setTimeout(function() {
|
||||
controller.abort();
|
||||
}, Math.max(1000, Number(timeoutMs) || 15000));
|
||||
}, timeout);
|
||||
}
|
||||
var nextInit = Object.assign({}, init || {});
|
||||
if (controller) nextInit.signal = controller.signal;
|
||||
@@ -375,6 +376,14 @@ async function fetchWithTimeout(input, init, timeoutMs, label) {
|
||||
}
|
||||
}
|
||||
|
||||
function uploadTimeoutMsForFile(file, requestedMs) {
|
||||
var requested = Number(requestedMs) || 0;
|
||||
var size = Number(file && file.size || 0);
|
||||
if (!Number.isFinite(size) || size <= 0) return Math.max(requested, 15000);
|
||||
var sizeBased = 15000 + Math.ceil(size / (1024 * 1024)) * 12000;
|
||||
return Math.min(10 * 60 * 1000, Math.max(requested, 60000, sizeBased));
|
||||
}
|
||||
|
||||
async function uploadLocalFolderAsset(file, plan, context) {
|
||||
var rootUri = String(context && context.rootUri || '').trim() || currentRootUri();
|
||||
var documentId = String(
|
||||
@@ -401,7 +410,7 @@ async function uploadLocalFolderAsset(file, plan, context) {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
body: localForm
|
||||
}, Number(context && context.timeoutMs) || 15000, '本地上传');
|
||||
}, uploadTimeoutMsForFile(file, context && context.timeoutMs), '本地上传');
|
||||
var localPayload = await localResponse.json().catch(function() { return null; });
|
||||
if (!localResponse.ok || !localPayload || !localPayload.asset) {
|
||||
throw new Error(localPayload && localPayload.error ? localPayload.error : '上传失败');
|
||||
@@ -552,7 +561,7 @@ async function uploadFileToMediaAsset(file, plan, options, deps) {
|
||||
var localResult = await uploadLocalFolderAsset(file, plan, {
|
||||
rootUri: rootUri,
|
||||
documentId: documentId,
|
||||
timeoutMs: 15000
|
||||
timeoutMs: uploadTimeoutMsForFile(file, 15000)
|
||||
});
|
||||
var localAsset = localResult && localResult.asset ? localResult.asset : null;
|
||||
if (!localAsset) {
|
||||
@@ -753,6 +762,7 @@ window.__mnoteLocalUploadRuntime = {
|
||||
editorRootFromUploadOptions: editorRootFromUploadOptions,
|
||||
openEditorUploadFilePicker: openEditorUploadFilePicker,
|
||||
fetchWithTimeout: fetchWithTimeout,
|
||||
uploadTimeoutMsForFile: uploadTimeoutMsForFile,
|
||||
uploadLocalFolderAsset: uploadLocalFolderAsset,
|
||||
uploadMediaAsset: uploadMediaAsset,
|
||||
insertUploadedAssetIntoEditor: insertUploadedAssetIntoEditor,
|
||||
|
||||
Reference in New Issue
Block a user