fix: send request data when reload (#35)

This commit is contained in:
Thuc Pham
2024-11-29 15:26:22 +07:00
committed by GitHub
parent 23482eac45
commit 8214bcd634
3 changed files with 12 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@llamaindex/chat-ui': patch
---
fix: send request data when reload
+6 -2
View File
@@ -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
@@ -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>
+1 -1
View File
@@ -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,