fix: use most recent user message in Stop hook input (#849)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
jnjpng
2026-02-05 21:41:23 -08:00
committed by GitHub
parent 49aef11031
commit 820fac4668

View File

@@ -3427,11 +3427,11 @@ export default function App({
lastAssistant && "text" in lastAssistant
? lastAssistant.text
: undefined;
const firstUser = Array.from(buffersRef.current.byId.values()).find(
(item) => item.kind === "user" && "text" in item,
);
const lastUser = Array.from(
buffersRef.current.byId.values(),
).findLast((item) => item.kind === "user" && "text" in item);
const userMessage =
firstUser && "text" in firstUser ? firstUser.text : undefined;
lastUser && "text" in lastUser ? lastUser.text : undefined;
const precedingReasoning = buffersRef.current.lastReasoning;
buffersRef.current.lastReasoning = undefined; // Clear after use