mirror of
https://github.com/langgenius/webapp-conversation.git
synced 2025-12-26 18:26:38 +08:00
fix: suggestion is not rendered
This commit is contained in:
@ -13,6 +13,7 @@ import type { ChatItem, MessageRating, VisionFile } from '@/types/app'
|
||||
import Tooltip from '@/app/components/base/tooltip'
|
||||
import WorkflowProcess from '@/app/components/workflow/workflow-process'
|
||||
import { Markdown } from '@/app/components/base/markdown'
|
||||
import Button from '@/app/components/base/button'
|
||||
import type { Emoji } from '@/types/tools'
|
||||
|
||||
const OperationBtn = ({ innerContent, onClick, className }: { innerContent: React.ReactNode; onClick?: () => void; className?: string }) => (
|
||||
@ -60,6 +61,7 @@ type IAnswerProps = {
|
||||
onFeedback?: FeedbackFunc
|
||||
isResponding?: boolean
|
||||
allToolIcons?: Record<string, string | Emoji>
|
||||
suggestionClick?: (suggestion: string) => void
|
||||
}
|
||||
|
||||
// The component needs to maintain its own state to control whether to display input component
|
||||
@ -69,8 +71,9 @@ const Answer: FC<IAnswerProps> = ({
|
||||
onFeedback,
|
||||
isResponding,
|
||||
allToolIcons,
|
||||
suggestionClick = () => { },
|
||||
}) => {
|
||||
const { id, content, feedback, agent_thoughts, workflowProcess } = item
|
||||
const { id, content, feedback, agent_thoughts, workflowProcess, suggestedQuestions = [] } = item
|
||||
const isAgentMode = !!agent_thoughts && agent_thoughts.length > 0
|
||||
|
||||
const { t } = useTranslation()
|
||||
@ -192,6 +195,17 @@ const Answer: FC<IAnswerProps> = ({
|
||||
: (
|
||||
<Markdown content={content} />
|
||||
))}
|
||||
{suggestedQuestions.length > 0 && (
|
||||
<div className='mt-3'>
|
||||
<div className='flex gap-1 mt-1 flex-wrap'>
|
||||
{suggestedQuestions.map((suggestion, index) => (
|
||||
<div key={index} className='flex items-center gap-1'>
|
||||
<Button className='text-sm' type='link' onClick={() => suggestionClick(suggestion)}>{suggestion}</Button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className='absolute top-[-14px] right-[-14px] flex flex-row justify-end gap-1'>
|
||||
{!feedbackDisabled && !item.feedbackDisabled && renderItemOperation()}
|
||||
|
||||
Reference in New Issue
Block a user