mirror of
https://github.com/nearai/ironclaw.git
synced 2026-09-02 23:56:24 +08:00
fix(gateway): keep engine threads out of chat sidebar (#2751)
* fix(gateway): keep engine threads out of chat sidebar * fix: address review findings (iteration 1) * fix: address review findings (iteration 2)
This commit is contained in:
@@ -79,6 +79,7 @@ let logEventSource = null;
|
||||
let currentTab = 'chat';
|
||||
let currentThreadId = null;
|
||||
let currentThreadIsReadOnly = false;
|
||||
const threadChannelHints = new Map();
|
||||
let assistantThreadId = null;
|
||||
let hasMore = false;
|
||||
let oldestTimestamp = null;
|
||||
|
||||
@@ -40,6 +40,10 @@ function loadHistory(before) {
|
||||
apiFetch(historyUrl).then((data) => {
|
||||
const container = document.getElementById('chat-messages');
|
||||
|
||||
if (!isPaginating && currentThreadId && data.channel) {
|
||||
threadChannelHints.set(currentThreadId, data.channel);
|
||||
}
|
||||
|
||||
if (!isPaginating) {
|
||||
// Fresh load: clear and render
|
||||
container.innerHTML = '';
|
||||
@@ -117,6 +121,16 @@ function loadHistory(before) {
|
||||
} else if (lastTurn && !lastTurn.response && lastTurn.state === 'Processing') {
|
||||
showActivityThinking(ActivityEntry.t('activity.processing', 'Processing...'));
|
||||
}
|
||||
const hintedChannel = currentThreadId
|
||||
? (data.channel || threadChannelHints.get(currentThreadId) || 'gateway')
|
||||
: 'gateway';
|
||||
currentThreadIsReadOnly = isReadOnlyChannel(hintedChannel);
|
||||
if (currentThreadIsReadOnly) {
|
||||
disableChatInputReadOnly();
|
||||
} else {
|
||||
enableChatInput();
|
||||
}
|
||||
|
||||
if (data.pending_gate) {
|
||||
handleGateRequired({
|
||||
...data.pending_gate,
|
||||
@@ -467,7 +481,10 @@ function loadThreads() {
|
||||
const currentThread = currentThreadId === assistantThreadId
|
||||
? data.assistant_thread
|
||||
: threads.find(t => t.id === currentThreadId);
|
||||
const ch = currentThread ? currentThread.channel : 'gateway';
|
||||
const hintedChannel = currentThread
|
||||
? currentThread.channel
|
||||
: threadChannelHints.get(currentThreadId);
|
||||
const ch = hintedChannel || 'gateway';
|
||||
currentThreadIsReadOnly = isReadOnlyChannel(ch);
|
||||
if (currentThreadIsReadOnly) {
|
||||
disableChatInputReadOnly();
|
||||
|
||||
Reference in New Issue
Block a user