@magicul/react-chat-stream
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -8,11 +8,2 @@ import { ChangeEvent, Dispatch, FormEvent, SetStateAction } from 'react'; | ||
}; | ||
type UseChatStreamResult = { | ||
messages: ChatMessage[]; | ||
setMessages: Dispatch<SetStateAction<ChatMessage[]>>; | ||
input: string; | ||
setInput: Dispatch<SetStateAction<string>>; | ||
handleInputChange: (event: ChangeEvent<HTMLInputElement>) => void; | ||
handleSubmit: (event?: FormEvent<HTMLFormElement>, newMessage?: string) => void; | ||
isLoading: boolean; | ||
}; | ||
export type UseChatStreamOptions = { | ||
@@ -33,4 +24,12 @@ url: string; | ||
}; | ||
declare const useChatStream: (input: UseChatStreamInput) => UseChatStreamResult; | ||
declare const useChatStream: (input: UseChatStreamInput) => { | ||
messages: ChatMessage[]; | ||
setMessages: Dispatch<SetStateAction<ChatMessage[]>>; | ||
input: string; | ||
setInput: Dispatch<SetStateAction<string>>; | ||
handleInputChange: (e: ChangeEvent<HTMLInputElement> | ChangeEvent<HTMLTextAreaElement>) => void; | ||
handleSubmit: (e?: FormEvent<HTMLFormElement>, newMessage?: string) => Promise<void>; | ||
isLoading: boolean; | ||
}; | ||
export default useChatStream; | ||
//# sourceMappingURL=useChatStream.d.ts.map |
{ | ||
"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", | ||
@@ -6,0 +6,0 @@ "types": "dist/index.d.ts", |
@@ -15,12 +15,2 @@ import { ChangeEvent, Dispatch, FormEvent, SetStateAction, useState } from 'react'; | ||
type UseChatStreamResult = { | ||
messages: ChatMessage[]; | ||
setMessages: Dispatch<SetStateAction<ChatMessage[]>> | ||
input: string; | ||
setInput: Dispatch<SetStateAction<string>>; | ||
handleInputChange: (event: ChangeEvent<HTMLInputElement>) => void; | ||
handleSubmit: (event?: FormEvent<HTMLFormElement>, newMessage?: string) => void; | ||
isLoading: boolean; | ||
} | ||
export type UseChatStreamOptions = { | ||
@@ -44,3 +34,3 @@ url: string; | ||
const useChatStream = (input: UseChatStreamInput): UseChatStreamResult => { | ||
const useChatStream = (input: UseChatStreamInput) => { | ||
const [messages, setMessages] = useState<ChatMessage[]>([]); | ||
@@ -50,3 +40,3 @@ const [message, setMessage] = useState(''); | ||
const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => { | ||
const handleInputChange = (e: ChangeEvent<HTMLInputElement> | ChangeEvent<HTMLTextAreaElement>) => { | ||
setMessage(e.target.value); | ||
@@ -53,0 +43,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35878
481