@leikeduntech/leiai-js 3.4.2 → 3.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/build/index.js +12 -2
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -473,7 +473,14 @@ Current date: ${currentDate}`;
473
473
  if (this._apiOrg && this._manufacturer.toLowerCase() === "openai") {
474
474
  headers["OpenAI-Organization"] = this._apiOrg;
475
475
  }
476
- if (this._manufacturer.toLowerCase() !== "baidu" || pluginList && pluginList.indexOf("zhishiku") < 0) {
476
+ if (this._manufacturer.toLowerCase() === "baidu" && typeof pluginList === "string" && pluginList.indexOf("zhishiku") > -1) {
477
+ if (body.model)
478
+ delete body.model;
479
+ if (body.max_tokens)
480
+ delete body.max_tokens;
481
+ if (body.temperature)
482
+ delete body.temperature;
483
+ } else {
477
484
  if (typeof body.plugins !== void 0)
478
485
  delete body.plugins;
479
486
  }
@@ -537,6 +544,9 @@ Current date: ${currentDate}`;
537
544
  }
538
545
  try {
539
546
  const response = JSON.parse(data);
547
+ if (this._debug) {
548
+ console.log(`row data ${typeof response} : `, response, response == null ? void 0 : response.choices);
549
+ }
540
550
  if (this._manufacturer.toLowerCase() === "baidu") {
541
551
  if ((response == null ? void 0 : response.is_end) === true) {
542
552
  result.text += response.result.trim();
@@ -651,7 +661,7 @@ Current date: ${currentDate}`;
651
661
  }
652
662
  const response = await res.json();
653
663
  if (this._debug) {
654
- console.log(`row data ${typeof response} : `, response, (_b = response == null ? void 0 : response.choices[0]) == null ? void 0 : _b.message);
664
+ console.log(`row data ${typeof response} : `, response, (response == null ? void 0 : response.choices) && ((_b = response == null ? void 0 : response.choices[0]) == null ? void 0 : _b.message));
655
665
  }
656
666
  if (this._manufacturer.toLowerCase() === "aliyun") {
657
667
  if (response == null ? void 0 : response.request_id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leikeduntech/leiai-js",
3
- "version": "3.4.2",
3
+ "version": "3.4.3",
4
4
  "author": "liuhean",
5
5
  "repository": {
6
6
  "type": "git",