mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 15:28:27 +00:00
TUI/Gateway: fix pi streaming + tool routing + model display + msg updating (#8432)
* TUI/Gateway: fix pi streaming + tool routing * Tests: clarify verbose tool output expectation * fix: avoid seq gaps for targeted tool events (#8432) (thanks @gumadeiras)
This commit is contained in:
committed by
GitHub
parent
a42e3cb78a
commit
38e6da1fe0
@@ -95,6 +95,7 @@ export async function runTui(opts: TuiOptions) {
|
||||
let wasDisconnected = false;
|
||||
let toolsExpanded = false;
|
||||
let showThinking = false;
|
||||
const localRunIds = new Set<string>();
|
||||
|
||||
const deliverDefault = opts.deliver ?? false;
|
||||
const autoMessage = opts.message?.trim();
|
||||
@@ -225,6 +226,29 @@ export async function runTui(opts: TuiOptions) {
|
||||
},
|
||||
};
|
||||
|
||||
const noteLocalRunId = (runId: string) => {
|
||||
if (!runId) {
|
||||
return;
|
||||
}
|
||||
localRunIds.add(runId);
|
||||
if (localRunIds.size > 200) {
|
||||
const [first] = localRunIds;
|
||||
if (first) {
|
||||
localRunIds.delete(first);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const forgetLocalRunId = (runId: string) => {
|
||||
localRunIds.delete(runId);
|
||||
};
|
||||
|
||||
const isLocalRunId = (runId: string) => localRunIds.has(runId);
|
||||
|
||||
const clearLocalRunIds = () => {
|
||||
localRunIds.clear();
|
||||
};
|
||||
|
||||
const client = new GatewayChatClient({
|
||||
url: opts.url,
|
||||
token: opts.token,
|
||||
@@ -522,9 +546,16 @@ export async function runTui(opts: TuiOptions) {
|
||||
updateFooter,
|
||||
updateAutocompleteProvider,
|
||||
setActivityStatus,
|
||||
clearLocalRunIds,
|
||||
});
|
||||
const { refreshAgents, refreshSessionInfo, loadHistory, setSession, abortActive } =
|
||||
sessionActions;
|
||||
const {
|
||||
refreshAgents,
|
||||
refreshSessionInfo,
|
||||
applySessionInfoFromPatch,
|
||||
loadHistory,
|
||||
setSession,
|
||||
abortActive,
|
||||
} = sessionActions;
|
||||
|
||||
const { handleChatEvent, handleAgentEvent } = createEventHandlers({
|
||||
chatLog,
|
||||
@@ -532,6 +563,10 @@ export async function runTui(opts: TuiOptions) {
|
||||
state,
|
||||
setActivityStatus,
|
||||
refreshSessionInfo,
|
||||
loadHistory,
|
||||
isLocalRunId,
|
||||
forgetLocalRunId,
|
||||
clearLocalRunIds,
|
||||
});
|
||||
|
||||
const { handleCommand, sendMessage, openModelSelector, openAgentSelector, openSessionSelector } =
|
||||
@@ -545,12 +580,15 @@ export async function runTui(opts: TuiOptions) {
|
||||
openOverlay,
|
||||
closeOverlay,
|
||||
refreshSessionInfo,
|
||||
applySessionInfoFromPatch,
|
||||
loadHistory,
|
||||
setSession,
|
||||
refreshAgents,
|
||||
abortActive,
|
||||
setActivityStatus,
|
||||
formatSessionKey,
|
||||
noteLocalRunId,
|
||||
forgetLocalRunId,
|
||||
});
|
||||
|
||||
const { runLocalShellLine } = createLocalShellRunner({
|
||||
|
||||
Reference in New Issue
Block a user