🐛 fix(Playground): Fix reasoning panel auto-collapse behavior to allow user control

- Add `hasAutoCollapsed` flag to track auto-collapse state
- Modify reasoning panel to auto-collapse only once after thinking completion
- Allow users to manually toggle reasoning panel after auto-collapse
- Update message creation, streaming updates, and completion handlers
- Ensure consistent behavior across stream/non-stream requests and error cases

Previously, the reasoning/thinking panel would auto-collapse every time
the AI completed its thinking process, preventing users from reopening
it to review the reasoning content. Now it auto-collapses only once
when thinking is complete, then allows full user control.

Files changed:
- web/src/hooks/useApiRequest.js: Updated all message handling functions
- web/src/utils/messageUtils.js: Added hasAutoCollapsed to initial state
This commit is contained in:
Apple\Apple
2025-05-31 01:29:19 +08:00
parent 02bc3cde53
commit caff73a746
2 changed files with 27 additions and 5 deletions

View File

@@ -107,6 +107,7 @@ export const createLoadingAssistantMessage = () => createMessage(
reasoningContent: '',
isReasoningExpanded: true,
isThinkingComplete: false,
hasAutoCollapsed: false,
status: 'loading'
}
);