@aqcq/chat3
v0.3.17
Published
Movetab Chatgpt
Downloads
119
Maintainers
Readme
Movetab GPT project
Example
Preview

Use Chat
import { Chat } from '@aqcq/chat3';
export default function App() {
return (
<div>
<Chat
width={1024}
height={768}
modelConfig={{
baseUrl: 'https://api.openai.com',
apiKey: 'your-api-key',
}}
/>
</div>
);
}Use ChatModal
import { useState } from 'react';
import { ChatModal } from '@aqcq/chat3';
export default function App() {
const [open, setOpen] = useState(false);
return (
<div>
<button onClick={() => setOpen(!open)}>{open ? 'close' : 'open'}</button>
<ChatModal
open={open}
onClose={() => setOpen(false)}
modelConfig={{
baseUrl: 'https://api.openai.com',
apiKey: 'your-api-key',
}}
/>
</div>
);
}Types
Chat Props
| Name | Description | Type | Default | | ------------ | ------------------------- | --------------------------------- | -------------- | | logo | Logo | React.Element | - | | width | Width | number | string | 1024 | | height | Height | number | string | 763 | | fullscreen | Whether it is full screen | boolean | false | | modelConfig | GPT model config | ModelConfig | - | | boxShadow | Box shadow | string | rgba(0,0,0,.2) | | onClose | Close callback | (event: React.MouseEvent) => void | - | | onFullscreen | Fullscreen callback | (event: React.MouseEvent) => void | - |
ChatModal Props
Inheritance ChatProps
| Name | Description | Type | Default | | ------------------ | ----------------------------- | -------------------------------- | ------- | | open | Whether it is open | boolean | false | | mask | Whether show mask | boolean | true | | maskCloseable | Whether close when click mask | boolean | true | | zIndex | CSS index | number | 1000 | | otherProps.mask | Mask component props | React.HTMLProps; | - | | otherProps.content | Wrapper component props | React.HTMLProps; | - | | otherProps.chat | ChatGpt component props | React.HTMLProps; | - |
ModelConfig
GPT model config
| Name | Description | Type | Default | | ----------------- | ----------------------- | ------- | ---------------------- | | baseUrl | Base url | string | https://api.openai.com | | apiKey | GPT secret key | string | | | stream | Whether to stream back | boolean | true | | model | Model name | string | gpt-4o-mini | | temperature | Model temperature | number | 0.5 | | top_p | Model top_p | number | 1 | | max_tokens | Model max tokens | number | 2048 | | presence_penalty | Model presence penalty | number | 0 | | frequency_penalty | Model frequency penalty | number | 0 |
