Skip to content

Commit

Permalink
fix: send request data when reload (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
thucpn authored Nov 29, 2024
1 parent 23482ea commit 8214bcd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
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

0 comments on commit 8214bcd

Please sign in to comment.