removing old api
This commit is contained in:
parent
a092033049
commit
ffe3584e98
@ -1,29 +0,0 @@
|
||||
import axios from 'axios';
|
||||
import dotenv from 'dotenv';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const OPENAI_API_KEY = process.env.OPENAI_API_KEY;
|
||||
const OPENAI_API_URL = 'https://api.openai.com/v1/chat/completions';
|
||||
|
||||
export const sendMessage = async (message, conversationContext) => {
|
||||
try {
|
||||
const response = await axios.post(OPENAI_API_URL, {
|
||||
model: 'o4-mini',
|
||||
messages: [
|
||||
...conversationContext,
|
||||
{ role: 'user', content: message }
|
||||
]
|
||||
}, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${OPENAI_API_KEY}`,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
|
||||
return response.data.choices[0].message.content;
|
||||
} catch (error) {
|
||||
console.error('Error communicating with OpenAI API:', error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user