[AI-BUILDER-22] refactor: auto-generate steps#1453
Conversation
c355b2b to
f44f443
Compare
517dddd to
d262e9a
Compare
pregnantboy
left a comment
There was a problem hiding this comment.
Currently there's an issue where the client still tries to call generateSteps when readiness check return false. not sure if it's in this PR or earlier PRs.
| const wasStreamingRef = useRef(isStreaming) | ||
| const scrollTickRef = useRef(false) | ||
|
|
||
| // Unified scroll function |
There was a problem hiding this comment.
Consider using https://www.npmjs.com/package/use-stick-to-bottom to implement auto scroll to bottom
|
to fix: scrolling |
f44f443 to
4bde4ac
Compare
d262e9a to
106e3ea
Compare
106e3ea to
d81a037
Compare
d81a037 to
6641a92
Compare
What changed?
Tests
|
pregnantboy
left a comment
There was a problem hiding this comment.
lgtm. just a quick question on when to use locationRef vs location
|
|
||
| navigate(`${URLS.EDITOR}/ai`, { | ||
| state: { | ||
| ...location.state, |
There was a problem hiding this comment.
not sure when to use location.state vs locationRef.current.state
There was a problem hiding this comment.
its updated in a later PR to use locationRef.current.state so it always references the latest value. onFinish is captured by useChat at initialisation and never recreated, so location.state inside it is a stale snapshot from when the stream started. Since StepsPreview can call navigate (writing output into location.state) before onFinish fires, using the ref ensures we don't clobber that update
Merge activity
|
## Auto-open workflow preview and improve chat scrolling behavior ### Changes - **Auto-open preview**: Workflow preview now automatically opens when AI response completes, eliminating the need for manual "Preview steps" button - **Clear output on new input**: Reset previous workflow output when submitting new chat messages to ensure fresh step generation - **Enhanced scroll behavior**: Improved auto-scrolling logic with better handling of user messages, streaming responses, and scroll position detection - **Removed manual preview trigger**: Eliminated the "Preview steps" button and drawer close functionality since preview now opens automatically - **Optimized initial scroll**: Added proper scroll-to-bottom behavior on component mount using requestAnimationFrame for better performance ### Tests New chat - [ ] When the chat messages display the steps of the workflow, the side drawer should automatically open and display the steps in the 'Pipe builder' layout - [ ] Entering a new messages that creates a new step triggers a generation of a new preview Refresh chat window - [ ] Steps preview opens if there was a preview before refresh - [ ] Steps preview does not open if there was no preview before refresh - [ ] Auto-scrolls to the bottom of messages Cleanup - [ ] No longer see the 'Preview steps' button

Auto-open workflow preview and improve chat scrolling behavior
Changes
Tests
New chat
Refresh chat window
Cleanup