Closed srkirkland closed 3 months ago
In the recent update, the ChatInput
component and WonkActions
type were refactored to centralize the management of the focus
state within the AI state. This change improves the focus handling mechanism by updating the focus
from a single place, ensuring better synchronization and simplifying the function signatures in WonkActions
.
Files | Change Summary |
---|---|
src/components/.../chatInput.tsx |
- Imported Focus from @/models/focus .- Added newState to useAIState .- Refactored onFocusSelection to update the focus state.- Updated references to focus with aiState.focus .- Modified submitUserMessage call to use aiState.focus .- Adjusted event object in gtagEvent to exclude focus .- Replaced FocusBar props with aiState.focus and onFocusSelection . |
src/lib/actions.tsx |
- Updated submitUserMessage to only take userInput .- Retrieved focus from AI state within the function. |
sequenceDiagram
participant User
participant ChatInput Component
participant AI State
participant WonkActions
User->>ChatInput Component: Types a message
ChatInput Component->>AI State: Get aiState.focus
AI State-->>ChatInput Component: Returns focus
ChatInput Component->>WonkActions: submitUserMessage(userInput)
WonkActions->>AI State: Retrieve focus
AI State-->>WonkActions: Returns focus
WonkActions-->>ChatInput Component: Processes message
In the code, a change quite bright,
Focus unified in single light,
Messages sent with newfound grace,
Sync and simplicity, all in place.
With AI state, we lead the way,
For better chats, hip hip hooray!
🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
new set of questions for each focus, plus I fixed a bug where the subfocus would be lost when asking a new questions based on history.
closes #63
Summary by CodeRabbit
ChatInput
component by centralizing focus state management within the AI state.submitUserMessage
function to enhance code maintainability and readability.