mirror of
https://github.com/langgenius/dify.git
synced 2026-04-12 14:10:42 +08:00
52 lines
994 B
TypeScript
52 lines
994 B
TypeScript
'use client'
|
|
|
|
import type { ReactNode } from 'react'
|
|
import type { ChatContextValue } from './context'
|
|
import { ChatContext } from './context'
|
|
|
|
type ChatContextProviderProps = {
|
|
children: ReactNode
|
|
} & ChatContextValue
|
|
|
|
export const ChatContextProvider = ({
|
|
children,
|
|
readonly = false,
|
|
config,
|
|
isResponding,
|
|
chatList,
|
|
showPromptLog,
|
|
questionIcon,
|
|
answerIcon,
|
|
onSend,
|
|
onRegenerate,
|
|
onAnnotationEdited,
|
|
onAnnotationAdded,
|
|
onAnnotationRemoved,
|
|
disableFeedback,
|
|
onFeedback,
|
|
getHumanInputNodeData,
|
|
}: ChatContextProviderProps) => {
|
|
return (
|
|
<ChatContext.Provider value={{
|
|
config,
|
|
readonly,
|
|
isResponding,
|
|
chatList: chatList || [],
|
|
showPromptLog,
|
|
questionIcon,
|
|
answerIcon,
|
|
onSend,
|
|
onRegenerate,
|
|
onAnnotationEdited,
|
|
onAnnotationAdded,
|
|
onAnnotationRemoved,
|
|
disableFeedback,
|
|
onFeedback,
|
|
getHumanInputNodeData,
|
|
}}
|
|
>
|
|
{children}
|
|
</ChatContext.Provider>
|
|
)
|
|
}
|