mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
12 lines
No EOL
337 B
JavaScript
12 lines
No EOL
337 B
JavaScript
require('dotenv').config();
|
|
|
|
const ask = async (question) => {
|
|
const { ChatGPTAPI } = await import('chatgpt');
|
|
const api = new ChatGPTAPI({ apiKey: process.env.OPENAI_KEY });
|
|
const res = await api.sendMessage(question, {
|
|
onProgress: (partialRes) => console.log(partialRes.text)
|
|
});
|
|
return res;
|
|
};
|
|
|
|
module.exports = { ask }; |