import { getCurrentInstance } from 'vue';
const { proxy } = getCurrentInstance()
proxy.$http.post("https://api.openai.com/v1/chat/completions", {
model: 'gpt-3.5-turbo',
messages: [
{
role: 'user',
content: "你好",
},
],
temperature: 0.9,
max_tokens: 100,
},
{
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${API-KEY}`,
},
}).then((response)=>{
console.log(response.data.choices[0].message.content)
})前提是你本地能访问chatgpt的api,如何不能直接的话,可以访问镜像或中转站来实现。 网友回复


