Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: send request data when reload #35

Merged
merged 3 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/red-pumas-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@llamaindex/chat-ui': patch
---

fix: send request data when reload
8 changes: 6 additions & 2 deletions packages/chat-ui/src/chat/chat-messages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function ChatMessagesLoading(props: ChatMessagesLoadingProps) {
}

function ChatActions(props: ChatActionsProps) {
const { reload, stop } = useChatUI()
const { reload, stop, requestData } = useChatUI()
const { showReload, showStop } = useChatMessages()
if (!showStop && !showReload) return null

Expand All @@ -159,7 +159,11 @@ function ChatActions(props: ChatActionsProps) {
</Button>
)}
{showReload && (
<Button variant="outline" size="sm" onClick={reload}>
<Button
variant="outline"
size="sm"
onClick={() => reload?.({ data: requestData })}
>
<RefreshCw className="mr-2 h-4 w-4" />
Regenerate
</Button>
Expand Down
2 changes: 1 addition & 1 deletion packages/chat-ui/src/chat/chat.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type ChatHandler = {
setInput: (input: string) => void
isLoading: boolean
messages: Message[]
reload?: () => void
reload?: (chatRequestOptions?: { data?: any }) => void
stop?: () => void
append: (
message: Message,
Expand Down