mirror of
https://github.com/run-llama/chat-ui.git
synced 2026-07-22 11:45:34 -04:00
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:
@@ -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"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user