You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
388 B
TypeScript

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 }