diff --git a/package.json b/package.json index b908301..533bf25 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@magicul/react-chat-stream", "description": "A React hook that lets you easily integrate your custom ChatGPT-like chat in React.", - "version": "0.2.0", + "version": "0.2.1", "main": "dist/index.js", "types": "dist/index.d.ts", "homepage": "https://github.com/XD2Sketch/react-chat-stream#readme", diff --git a/src/hooks/useChatStream.ts b/src/hooks/useChatStream.ts index 3dbceeb..7941736 100644 --- a/src/hooks/useChatStream.ts +++ b/src/hooks/useChatStream.ts @@ -12,16 +12,6 @@ type ChatMessage = { id: string; } -type UseChatStreamResult = { - messages: ChatMessage[]; - setMessages: Dispatch> - input: string; - setInput: Dispatch>; - handleInputChange: (event: ChangeEvent) => void; - handleSubmit: (event?: FormEvent, newMessage?: string) => void; - isLoading: boolean; -} - export type UseChatStreamOptions = { url: string; method: HttpMethod; @@ -40,12 +30,12 @@ type UseChatStreamInput = { method: UseChatStreamInputMethod, }; -const useChatStream = (input: UseChatStreamInput): UseChatStreamResult => { +const useChatStream = (input: UseChatStreamInput) => { const [messages, setMessages] = useState([]); const [message, setMessage] = useState(''); const [isLoading, setIsLoading] = useState(false); - const handleInputChange = (e: ChangeEvent) => { + const handleInputChange = (e: ChangeEvent | ChangeEvent) => { setMessage(e.target.value); };