Files
dify/web/app/components/base/chat/chat/context.ts
Stephen Zhou 36e840cd87 chore: knip fix (#34481)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-04-02 15:03:42 +00:00

29 lines
634 B
TypeScript

'use client'
import type { ChatProps } from './index'
import { createContext, useContext } from 'use-context-selector'
export type ChatContextValue = Pick<ChatProps, 'config'
| 'isResponding'
| 'chatList'
| 'showPromptLog'
| 'questionIcon'
| 'answerIcon'
| 'onSend'
| 'onRegenerate'
| 'onAnnotationEdited'
| 'onAnnotationAdded'
| 'onAnnotationRemoved'
| 'disableFeedback'
| 'onFeedback'
| 'getHumanInputNodeData'> & {
readonly?: boolean
}
export const ChatContext = createContext<ChatContextValue>({
chatList: [],
readonly: false,
})
export const useChatContext = () => useContext(ChatContext)