mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
Fix terminal truncation to trim middle of long outputs instead of suffix (#9365)
Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
@@ -13,8 +13,10 @@ export function handleObservationMessage(message: ObservationMessage) {
|
||||
let { content } = message;
|
||||
|
||||
if (content.length > 5000) {
|
||||
const head = content.slice(0, 5000);
|
||||
content = `${head}\r\n\n... (truncated ${message.content.length - 5000} characters) ...`;
|
||||
const halfLength = 2500;
|
||||
const head = content.slice(0, halfLength);
|
||||
const tail = content.slice(content.length - halfLength);
|
||||
content = `${head}\r\n\n... (truncated ${message.content.length - 5000} characters) ...\r\n\n${tail}`;
|
||||
}
|
||||
|
||||
store.dispatch(appendOutput(content));
|
||||
|
||||
Reference in New Issue
Block a user