mirror of
https://github.com/langgenius/dify.git
synced 2026-03-25 08:18:02 +08:00
31 lines
662 B
TypeScript
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
|