feat: 拆分以便扩展
							parent
							
								
									31ea7c5529
								
							
						
					
					
						commit
						35da3f1d1f
					
				| @ -0,0 +1,19 @@ | ||||
| import dotenv from 'dotenv' | ||||
| import { ChatGPTAPI } from 'chatgpt' | ||||
| 
 | ||||
| dotenv.config() | ||||
| 
 | ||||
| const apiKey = '' | ||||
| 
 | ||||
| /** | ||||
|  * More Info: https://github.com/transitive-bullshit/chatgpt-api
 | ||||
|  */ | ||||
| const api = new ChatGPTAPI({ apiKey: process.env.OPENAI_API_KEY || apiKey }) | ||||
| 
 | ||||
| async function chatReply(message: string) { | ||||
|   if (!message) | ||||
|     return | ||||
|   return await api.sendMessage(message) | ||||
| } | ||||
| 
 | ||||
| export { chatReply } | ||||
					Loading…
					
					
				
		Reference in New Issue