@kevisual/ai 0.0.17 → 0.0.18

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.
@@ -118,7 +118,11 @@ type BaseChatOptions<T = Record<string, any>> = {
118
118
  /**
119
119
  * 默认apiKey
120
120
  */
121
- apiKey: string;
121
+ apiKey?: string;
122
+ /**
123
+ * token
124
+ */
125
+ token?: string;
122
126
  /**
123
127
  * 是否在浏览器中使用
124
128
  */
@@ -18798,7 +18798,7 @@ class BaseChat {
18798
18798
  constructor(options) {
18799
18799
  this.baseURL = options.baseURL;
18800
18800
  this.model = options.model;
18801
- this.apiKey = options.apiKey;
18801
+ this.apiKey = options.token || options.apiKey;
18802
18802
  }
18803
18803
  post(url = "", opts = {}) {
18804
18804
  let _url = url.startsWith("http") ? url : this.baseURL + url;
@@ -19013,6 +19013,9 @@ class BailianChat extends BaseChat {
19013
19013
  static BASE_URL = "https://dashscope.aliyuncs.com/compatible-mode/v1";
19014
19014
  constructor(options) {
19015
19015
  const baseURL = options.baseURL || BailianChat.BASE_URL;
19016
+ if (!options.model) {
19017
+ options.model = "qwen-plus";
19018
+ }
19016
19019
  super({ ...options, baseURL });
19017
19020
  }
19018
19021
  }
@@ -19040,6 +19043,9 @@ class Kevisual extends BaseChat {
19040
19043
  static BASE_URL = "https://newapi.kevisual.cn/v1/";
19041
19044
  constructor(options) {
19042
19045
  const baseURL = options.baseURL || Kevisual.BASE_URL;
19046
+ if (!options.model) {
19047
+ options.model = "qwen-plus";
19048
+ }
19043
19049
  super({ ...options, baseURL });
19044
19050
  }
19045
19051
  }
@@ -118,7 +118,11 @@ type BaseChatOptions<T = Record<string, any>> = {
118
118
  /**
119
119
  * 默认apiKey
120
120
  */
121
- apiKey: string;
121
+ apiKey?: string;
122
+ /**
123
+ * token
124
+ */
125
+ token?: string;
122
126
  /**
123
127
  * 是否在浏览器中使用
124
128
  */
@@ -1358,7 +1358,7 @@ class BaseChat {
1358
1358
  constructor(options) {
1359
1359
  this.baseURL = options.baseURL;
1360
1360
  this.model = options.model;
1361
- this.apiKey = options.apiKey;
1361
+ this.apiKey = options.token || options.apiKey;
1362
1362
  }
1363
1363
  post(url = "", opts = {}) {
1364
1364
  let _url = url.startsWith("http") ? url : this.baseURL + url;
@@ -1573,6 +1573,9 @@ class BailianChat extends BaseChat {
1573
1573
  static BASE_URL = "https://dashscope.aliyuncs.com/compatible-mode/v1";
1574
1574
  constructor(options) {
1575
1575
  const baseURL = options.baseURL || BailianChat.BASE_URL;
1576
+ if (!options.model) {
1577
+ options.model = "qwen-plus";
1578
+ }
1576
1579
  super({ ...options, baseURL });
1577
1580
  }
1578
1581
  }
@@ -1600,6 +1603,9 @@ class Kevisual extends BaseChat {
1600
1603
  static BASE_URL = "https://newapi.kevisual.cn/v1/";
1601
1604
  constructor(options) {
1602
1605
  const baseURL = options.baseURL || Kevisual.BASE_URL;
1606
+ if (!options.model) {
1607
+ options.model = "qwen-plus";
1608
+ }
1603
1609
  super({ ...options, baseURL });
1604
1610
  }
1605
1611
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevisual/ai",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "AI Center Services",
5
5
  "main": "index.js",
6
6
  "basename": "/root/ai-center-services",
@@ -5,6 +5,9 @@ export class BailianChat extends BaseChat {
5
5
  static BASE_URL = 'https://dashscope.aliyuncs.com/compatible-mode/v1';
6
6
  constructor(options: BailianOptions) {
7
7
  const baseURL = options.baseURL || BailianChat.BASE_URL;
8
+ if (!options.model) {
9
+ options.model = 'qwen-plus'
10
+ }
8
11
  super({ ...(options as BaseChatOptions), baseURL: baseURL });
9
12
  }
10
13
  }
@@ -9,6 +9,9 @@ export class Kevisual extends BaseChat {
9
9
  static BASE_URL = 'https://newapi.kevisual.cn/v1/';
10
10
  constructor(options: KevisualOptions) {
11
11
  const baseURL = options.baseURL || Kevisual.BASE_URL;
12
+ if (!options.model) {
13
+ options.model = 'qwen-plus'
14
+ }
12
15
  super({ ...(options as BaseChatOptions), baseURL: baseURL });
13
16
  }
14
17
  }
@@ -22,7 +22,11 @@ export type BaseChatOptions<T = Record<string, any>> = {
22
22
  /**
23
23
  * 默认apiKey
24
24
  */
25
- apiKey: string;
25
+ apiKey?: string;
26
+ /**
27
+ * token
28
+ */
29
+ token?: string;
26
30
  /**
27
31
  * 是否在浏览器中使用
28
32
  */
@@ -54,7 +58,7 @@ export class BaseChat implements BaseChatInterface, BaseChatUsageInterface {
54
58
  constructor(options: BaseChatOptions) {
55
59
  this.baseURL = options.baseURL;
56
60
  this.model = options.model;
57
- this.apiKey = options.apiKey;
61
+ this.apiKey = options.token || options.apiKey;
58
62
  }
59
63
  post(url = '', opts: { headers?: Record<string, string>, data?: any } = {}) {
60
64
  let _url = url.startsWith('http') ? url : this.baseURL + url;