Error [ERR_REQUIRE_ESM]: require() of ES Module D:\source\m-yuying-node\node_modules\@mistralai\mistralai\src\client.js from D:\source\m-yuying-node\utils\mistralai\index.js not supported.
Instead change the require of client.js in D:\source\m-yuying-node\utils\mistralai\index.js to a dynamic import() which
const esm = require('esm')
let mistralClient
(async () => {
let MistralClient = await import('@mistralai/mistralai');
MistralClient = MistralClient.default
console.log('MistralClient', MistralClient, esm)
if (global.isLocal) {
let apiKey = '1'
mistralClient = new MistralClient(apiKey);
} else if (global.isAzure) {
let apiKey = 'xxx'
mistralClient = new MistralClient(apiKey);
}
})();
const getMistralClient = () => {
return mistralClient
}
module.exports = {
getMistralClient,
}
我开发的chatgpt网站:
https://chat.xutongbao.top