[studio]: Fix tool reasoning trace in UI (#5314)

* fix thought for 1 second issue

* gemini suggesion
This commit is contained in:
हिमांशु 2026-05-06 22:16:20 +05:30 committed by GitHub
commit 848ede3d57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -316,15 +316,28 @@ const ReasoningGroupImpl: ReasoningGroupComponent = ({
if (message.status?.type !== "running") {
return false;
}
const lastIndex = message.parts.length - 1;
if (lastIndex < 0) {
const parts = message.parts;
const len = parts.length;
if (len === 0) {
return false;
}
const lastType = message.parts[lastIndex]?.type;
if (lastType !== "reasoning") {
let groupHasReasoning = false;
for (let i = startIndex; i <= endIndex && i < len; i += 1) {
if (parts[i]?.type === "reasoning") {
groupHasReasoning = true;
break;
}
}
if (!groupHasReasoning) {
return false;
}
return lastIndex >= startIndex && lastIndex <= endIndex;
for (let i = endIndex + 1; i < len; i += 1) {
if (parts[i]?.type !== "tool-call") {
return false;
}
}
return true;
});
const persistedDuration = useAuiState(({ message }) => {