mirror of
https://github.com/langgenius/dify.git
synced 2026-04-29 04:26:30 +08:00
chore: handle suggestion readonly
This commit is contained in:
parent
b6bdcc7052
commit
9ff3310cb6
@ -2,6 +2,7 @@ import type { FC } from 'react'
|
|||||||
import { memo } from 'react'
|
import { memo } from 'react'
|
||||||
import type { ChatItem } from '../../types'
|
import type { ChatItem } from '../../types'
|
||||||
import { useChatContext } from '../context'
|
import { useChatContext } from '../context'
|
||||||
|
import cn from '@/utils/classnames'
|
||||||
|
|
||||||
type SuggestedQuestionsProps = {
|
type SuggestedQuestionsProps = {
|
||||||
item: ChatItem
|
item: ChatItem
|
||||||
@ -9,7 +10,7 @@ type SuggestedQuestionsProps = {
|
|||||||
const SuggestedQuestions: FC<SuggestedQuestionsProps> = ({
|
const SuggestedQuestions: FC<SuggestedQuestionsProps> = ({
|
||||||
item,
|
item,
|
||||||
}) => {
|
}) => {
|
||||||
const { onSend } = useChatContext()
|
const { onSend, readonly } = useChatContext()
|
||||||
|
|
||||||
const {
|
const {
|
||||||
isOpeningStatement,
|
isOpeningStatement,
|
||||||
@ -24,8 +25,11 @@ const SuggestedQuestions: FC<SuggestedQuestionsProps> = ({
|
|||||||
{suggestedQuestions.filter(q => !!q && q.trim()).map((question, index) => (
|
{suggestedQuestions.filter(q => !!q && q.trim()).map((question, index) => (
|
||||||
<div
|
<div
|
||||||
key={index}
|
key={index}
|
||||||
className='system-sm-medium mr-1 mt-1 inline-flex max-w-full shrink-0 cursor-pointer flex-wrap rounded-lg border-[0.5px] border-components-button-secondary-border bg-components-button-secondary-bg px-3.5 py-2 text-components-button-secondary-accent-text shadow-xs last:mr-0 hover:border-components-button-secondary-border-hover hover:bg-components-button-secondary-bg-hover'
|
className={cn(
|
||||||
onClick={() => onSend?.(question)}
|
'system-sm-medium mr-1 mt-1 inline-flex max-w-full shrink-0 cursor-pointer flex-wrap rounded-lg border-[0.5px] border-components-button-secondary-border bg-components-button-secondary-bg px-3.5 py-2 text-components-button-secondary-accent-text shadow-xs last:mr-0 hover:border-components-button-secondary-border-hover hover:bg-components-button-secondary-bg-hover',
|
||||||
|
readonly && 'pointer-events-none opacity-50',
|
||||||
|
)}
|
||||||
|
onClick={() => !readonly && onSend?.(question)}
|
||||||
>
|
>
|
||||||
{question}
|
{question}
|
||||||
</div>),
|
</div>),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user