|
import got from 'got'; |
|
|
|
async function AlibabaTogether(message, { system_prompt = "" } = {}) { |
|
const response = await got.post('https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions', { |
|
headers: { |
|
'Authorization': 'Bearer ' + process.env['ALIBABA_API_KEY'], |
|
'Content-Type': 'application/json' |
|
}, |
|
json: { |
|
'model': 'qwen-plus', |
|
'messages': [ |
|
{"role": "system", "content": system_prompt}, |
|
|
|
{'role': 'user', 'content': message} |
|
], |
|
} |
|
}).json(); |
|
return response.choices[0].message.content; |
|
} |
|
export { AlibabaTogether }; |