Here is what you need to do
1. Create a node with a "raw input" this is where the user message is being stored,
2. add an execute code node and paste the code:
const apiKey = '
';
const {data} = await axios.post("https://api.openai.com/v1/chat/completions", {
"model": "gpt-3.5-turbo-0301",
"messages": [{"role": "user", "content": event.preview}]
}, { headers: {'Authorization':
Bearer ${apiKey}
}});
workflow.gptResponse = data.choices[0].message.content;
---> Make sure to replace
with the actual OpenAI APIKey
3. create another node with a 'text' and type {{workflow.gptResponnse}}
4. test