[studio]: Fix tool reasoning trace in UI (#5314)
* fix thought for 1 second issue * gemini suggesion
This commit is contained in:
parent
fac2dc09b0
commit
848ede3d57
1 changed files with 18 additions and 5 deletions
|
|
@ -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 }) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue