mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-07-07 04:58:03 +02:00
Add files via upload
This commit is contained in:
@@ -597,6 +597,7 @@
|
||||
"knowledgeRetrievalTag": "Knowledge retrieval",
|
||||
"error": "Error",
|
||||
"streamNetworkErrorHint": "Connection lost ({{detail}}). A long task may still be running on the server; check running tasks at the top or refresh this conversation later.",
|
||||
"streamEndedWithoutDone": "The connection ended before a completion signal was received. The task may still be running on the server; check running tasks at the top or refresh this conversation.",
|
||||
"taskCancelled": "Task cancelled",
|
||||
"userInterruptContinueTitle": "⏸️ User interrupt & continue",
|
||||
"unknownTool": "Unknown tool",
|
||||
|
||||
@@ -585,6 +585,7 @@
|
||||
"knowledgeRetrievalTag": "知识检索",
|
||||
"error": "错误",
|
||||
"streamNetworkErrorHint": "连接已中断({{detail}})。长时间任务可能仍在后端执行,请查看顶部「运行中」任务或稍后刷新本对话。",
|
||||
"streamEndedWithoutDone": "连接提前结束,未收到任务完成信号。任务可能仍在后端执行,请查看顶部「运行中」任务或刷新当前对话。",
|
||||
"taskCancelled": "任务已取消",
|
||||
"userInterruptContinueTitle": "⏸️ 用户中断并继续",
|
||||
"unknownTool": "未知工具",
|
||||
|
||||
@@ -1105,7 +1105,11 @@ async function sendMessage() {
|
||||
const reader = response.body.getReader();
|
||||
const decoder = new TextDecoder();
|
||||
let buffer = '';
|
||||
let streamSawDone = false;
|
||||
const dispatchStreamEvent = function (eventData) {
|
||||
if (eventData && eventData.type === 'done') {
|
||||
streamSawDone = true;
|
||||
}
|
||||
handleStreamEvent(eventData, progressElement, progressId,
|
||||
() => assistantMessageId, (id) => { assistantMessageId = id; },
|
||||
() => mcpExecutionIds, (ids) => { mcpExecutionIds = ids; });
|
||||
@@ -1142,6 +1146,23 @@ async function sendMessage() {
|
||||
const lines = buffer.split('\n');
|
||||
await processSseLines(lines, dispatchStreamEvent);
|
||||
}
|
||||
if (!streamSawDone) {
|
||||
if (typeof loadActiveTasks === 'function') {
|
||||
loadActiveTasks();
|
||||
}
|
||||
const convId = currentConversationId || (body && body.conversationId) || null;
|
||||
let attached = false;
|
||||
if (convId && typeof window.attachRunningTaskEventStream === 'function') {
|
||||
window.__csAgentLiveStream = { active: false, conversationId: null, progressId: null };
|
||||
attached = await window.attachRunningTaskEventStream(convId).catch(() => false);
|
||||
}
|
||||
if (!attached) {
|
||||
const hint = typeof window.t === 'function'
|
||||
? window.t('chat.streamEndedWithoutDone')
|
||||
: '连接提前结束,未收到任务完成信号。任务可能仍在后端执行,请查看顶部运行中任务或刷新当前对话。';
|
||||
addMessage('system', hint);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
window.__csAgentLiveStream = { active: false, conversationId: null, progressId: null };
|
||||
if (window.CyberStrikeChatScroll) {
|
||||
|
||||
@@ -3331,7 +3331,11 @@ async function attachRunningTaskEventStream(conversationId) {
|
||||
const reader = response.body.getReader();
|
||||
const decoder = new TextDecoder();
|
||||
let buffer = '';
|
||||
let replaySawDone = false;
|
||||
const dispatchTaskEvent = function (eventData) {
|
||||
if (eventData && eventData.type === 'done') {
|
||||
replaySawDone = true;
|
||||
}
|
||||
handleStreamEvent(eventData, null, progressId, getAssistantIdFn, setAssistantIdFn, function () { return mcpIds; }, function (ids) { mcpIds = mergeMcpExecutionIDLists(mcpIds, ids || []); });
|
||||
};
|
||||
while (true) {
|
||||
@@ -3351,14 +3355,14 @@ async function attachRunningTaskEventStream(conversationId) {
|
||||
if (window.csTaskReplay && window.csTaskReplay.progressId === progressId) {
|
||||
clearCsTaskReplay();
|
||||
}
|
||||
if (progressTaskState.has(progressId)) {
|
||||
if (replaySawDone && progressTaskState.has(progressId)) {
|
||||
finalizeProgressTask(progressId, typeof window.t === 'function' ? window.t('tasks.statusCompleted') : '已完成');
|
||||
}
|
||||
if (window.CyberStrikeChatScroll && typeof window.CyberStrikeChatScroll.onTaskEventStreamEnd === 'function') {
|
||||
window.CyberStrikeChatScroll.onTaskEventStreamEnd();
|
||||
}
|
||||
if (typeof loadActiveTasks === 'function') loadActiveTasks();
|
||||
if (typeof window.loadConversation === 'function' && window.currentConversationId === conversationId) {
|
||||
if (replaySawDone && typeof window.loadConversation === 'function' && window.currentConversationId === conversationId) {
|
||||
await window.loadConversation(conversationId);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -805,7 +805,7 @@
|
||||
} else if (workflows.length) {
|
||||
fillWorkflowForm(workflows[0]);
|
||||
} else {
|
||||
newWorkflowDraft();
|
||||
newWorkflowDraft({ openMeta: false });
|
||||
return;
|
||||
}
|
||||
renderWorkflowList();
|
||||
@@ -815,7 +815,8 @@
|
||||
}
|
||||
};
|
||||
|
||||
window.newWorkflowDraft = function () {
|
||||
window.newWorkflowDraft = function (options) {
|
||||
const shouldOpenMeta = !options || options.openMeta !== false;
|
||||
currentWorkflowId = '';
|
||||
fillWorkflowForm({
|
||||
id: '',
|
||||
@@ -825,7 +826,9 @@
|
||||
graph_json: defaultGraph()
|
||||
});
|
||||
syncWorkflowMetaIdField(false, '');
|
||||
openWorkflowMetaModal();
|
||||
if (shouldOpenMeta) {
|
||||
openWorkflowMetaModal();
|
||||
}
|
||||
};
|
||||
|
||||
window.selectWorkflow = function (id) {
|
||||
@@ -1032,7 +1035,7 @@
|
||||
}
|
||||
currentWorkflowId = '';
|
||||
showNotification(_t('workflows.deleted'), 'success');
|
||||
newWorkflowDraft();
|
||||
newWorkflowDraft({ openMeta: false });
|
||||
await refreshWorkflows();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user