Files
dify/web/app/components/base/chat/chat/context.ts
2026-03-05 15:54:56 +08:00

31 lines
662 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)
export default ChatContext