fix: send request data when submit suggested questions (#89)

* fix: send request data when submit suggested questions

* Create orange-ears-admire.md

* fix lint
This commit is contained in:
Thuc Pham
2025-05-23 14:20:02 +07:00
committed by GitHub
parent bacb75fc6e
commit 2332fa6994
3 changed files with 14 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@llamaindex/chat-ui': patch
---
fix: send request data when submit suggested questions
@@ -98,7 +98,7 @@ export function SourceAnnotations() {
}
export function SuggestedQuestionsAnnotations() {
const { append } = useChatUI()
const { append, requestData } = useChatUI()
const { message, isLast } = useChatMessage()
if (!isLast || !append) return null
@@ -112,7 +112,11 @@ export function SuggestedQuestionsAnnotations() {
: null
if (!suggestedQuestionsData?.[0]) return null
return (
<SuggestedQuestions questions={suggestedQuestionsData[0]} append={append} />
<SuggestedQuestions
questions={suggestedQuestionsData[0]}
append={append}
requestData={requestData}
/>
)
}
@@ -4,9 +4,11 @@ import { ChatHandler } from '../chat/chat.interface'
export function SuggestedQuestions({
questions,
append,
requestData,
}: {
questions: SuggestedQuestionsData
append: ChatHandler['append']
requestData?: any
}) {
const showQuestions = questions.length > 0
return (
@@ -16,7 +18,7 @@ export function SuggestedQuestions({
<a
key={index}
onClick={() => {
append({ role: 'user', content: question })
append({ role: 'user', content: question }, { data: requestData })
}}
className="cursor-pointer text-sm italic hover:underline"
>