@maiyunnet/kebab 9.11.0 → 9.11.1

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.
package/doc/kebab-rag.md CHANGED
@@ -1360,7 +1360,7 @@ index/variables/VER.md
1360
1360
 
1361
1361
  # Variable: VER
1362
1362
 
1363
- > `const` **VER**: `"9.11.0"` = `'9.11.0'`
1363
+ > `const` **VER**: `"9.11.1"` = `'9.11.1'`
1364
1364
 
1365
1365
  Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
1366
1366
 
@@ -3320,7 +3320,7 @@ lib/core/functions/clone.md
3320
3320
 
3321
3321
  > **clone**\<`T`\>(`obj`): `T`
3322
3322
 
3323
- Defined in: [lib/core.ts:1162](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1162)
3323
+ Defined in: [lib/core.ts:1164](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1164)
3324
3324
 
3325
3325
  完整的克隆一份数组/对象
3326
3326
 
@@ -3384,7 +3384,7 @@ lib/core/functions/debug.md
3384
3384
 
3385
3385
  > **debug**(`message?`, ...`optionalParams`): `void`
3386
3386
 
3387
- Defined in: [lib/core.ts:1196](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1196)
3387
+ Defined in: [lib/core.ts:1198](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1198)
3388
3388
 
3389
3389
  打印调试信息,线上环境不会打印
3390
3390
 
@@ -3419,7 +3419,7 @@ lib/core/functions/display.md
3419
3419
 
3420
3420
  > **display**(`message?`, ...`optionalParams`): `void`
3421
3421
 
3422
- Defined in: [lib/core.ts:1209](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1209)
3422
+ Defined in: [lib/core.ts:1211](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1211)
3423
3423
 
3424
3424
  向控制台直接显示内容,一般情况下禁止使用
3425
3425
 
@@ -3524,7 +3524,7 @@ lib/core/functions/getLog.md
3524
3524
 
3525
3525
  > **getLog**(`opt`): `Promise`\<`false` \| \{ `list`: `any`[] \| `string`[][]; `total`: `number`; \}\>
3526
3526
 
3527
- Defined in: [lib/core.ts:1074](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1074)
3527
+ Defined in: [lib/core.ts:1076](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1076)
3528
3528
 
3529
3529
  获取日志内容为一个数组
3530
3530
 
@@ -3659,7 +3659,7 @@ lib/core/functions/loadEnv.md
3659
3659
 
3660
3660
  > **loadEnv**(`dir`): `Promise`\<`void`\>
3661
3661
 
3662
- Defined in: [lib/core.ts:1261](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1261)
3662
+ Defined in: [lib/core.ts:1263](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1263)
3663
3663
 
3664
3664
  加载 .env 文件到 process.env,若文件不存在则跳过
3665
3665
 
@@ -3729,7 +3729,7 @@ lib/core/functions/ls.md
3729
3729
 
3730
3730
  > **ls**(`opt`): `Promise`\<`object`[]\>
3731
3731
 
3732
- Defined in: [lib/core.ts:1123](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1123)
3732
+ Defined in: [lib/core.ts:1125](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1125)
3733
3733
 
3734
3734
  获取目录内文件/文件夹列表
3735
3735
 
@@ -4090,7 +4090,7 @@ lib/core/functions/resolveEnvVars.md
4090
4090
 
4091
4091
  > **resolveEnvVars**(`obj`): `void`
4092
4092
 
4093
- Defined in: [lib/core.ts:1291](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1291)
4093
+ Defined in: [lib/core.ts:1293](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1293)
4094
4094
 
4095
4095
  将配置对象中的 ${ENV_VAR} 占位符替换为 process.env 的值
4096
4096
 
@@ -4532,7 +4532,7 @@ lib/core/functions/writeEventStreamHead.md
4532
4532
 
4533
4533
  > **writeEventStreamHead**(`res`): `void`
4534
4534
 
4535
- Defined in: [lib/core.ts:1231](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1231)
4535
+ Defined in: [lib/core.ts:1233](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1233)
4536
4536
 
4537
4537
  ## Parameters
4538
4538
 
@@ -4557,7 +4557,7 @@ lib/core/functions/writeHead.md
4557
4557
 
4558
4558
  > **writeHead**(`res`, `statusCode`, `headers?`): `void`
4559
4559
 
4560
- Defined in: [lib/core.ts:1220](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1220)
4560
+ Defined in: [lib/core.ts:1222](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1222)
4561
4561
 
4562
4562
  让 res 发送头部(前提是头部没有被发送才能调用本方法
4563
4563
 
@@ -4598,7 +4598,7 @@ lib/core/functions/write.md
4598
4598
 
4599
4599
  > **write**(`res`, `data`): `void`
4600
4600
 
4601
- Defined in: [lib/core.ts:1243](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1243)
4601
+ Defined in: [lib/core.ts:1245](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1245)
4602
4602
 
4603
4603
  向 res 发送数据
4604
4604
 
@@ -19531,9 +19531,9 @@ Defined in: [lib/vector.ts:85](https://github.com/maiyunnet/kebab/blob/master/li
19531
19531
 
19532
19532
  ***
19533
19533
 
19534
- ### seach()
19534
+ ### search()
19535
19535
 
19536
- > **seach**(`data`): `Promise`\<`false` \| `object`[]\>
19536
+ > **search**(`data`): `Promise`\<`false` \| `object`[]\>
19537
19537
 
19538
19538
  Defined in: [lib/vector.ts:35](https://github.com/maiyunnet/kebab/blob/master/lib/vector.ts#L35)
19539
19539
 
package/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * --- 本文件用来定义每个目录实体地址的常量 ---
6
6
  */
7
7
  /** --- 当前系统版本号 --- */
8
- export declare const VER = "9.11.0";
8
+ export declare const VER = "9.11.1";
9
9
  /** --- 框架根目录,以 / 结尾 --- */
10
10
  export declare const ROOT_PATH: string;
11
11
  /** --- 框架的 LIB,以 / 结尾 --- */
package/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * --- 本文件用来定义每个目录实体地址的常量 ---
7
7
  */
8
8
  /** --- 当前系统版本号 --- */
9
- export const VER = '9.11.0';
9
+ export const VER = '9.11.1';
10
10
  // --- 服务端用的路径 ---
11
11
  const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
12
12
  /** --- /xxx/xxx --- */
package/lib/core.js CHANGED
@@ -858,7 +858,9 @@ export function log(opt, msg, fend = '') {
858
858
  'cf': '',
859
859
  'x': ''
860
860
  };
861
- const [y, m, d, h] = lTime.format(null, 'Y-m-d-H').split('-');
861
+ /** --- 文件和内容统一使用同一时间点 --- */
862
+ const now = new Date();
863
+ const [y, m, d, h] = lTime.format(null, 'Y-m-d-H', now).split('-');
862
864
  let path = kebab.LOG_CWD + hostname + fend + '/' + y + '/' + m + '/' + d + '/';
863
865
  const rtn = await lFs.mkdir(path, 0o777);
864
866
  if (!rtn) {
@@ -869,8 +871,8 @@ export function log(opt, msg, fend = '') {
869
871
  // --- JSON Lines 格式 ---
870
872
  path += h + '.jsonl';
871
873
  const entry = lText.stringifyJson({
872
- 'time': lTime.format(null, 'H:i:s'),
873
- 'unix': lTime.stamp(),
874
+ 'time': lTime.format(null, 'H:i:s', now),
875
+ 'unix': lTime.stamp(now),
874
876
  'url': urlFull + wpath + (Object.keys(get).length ? '?' + lText.queryStringify(get) : ''),
875
877
  'cookie': cookie,
876
878
  'session': session,
@@ -900,8 +902,8 @@ export function log(opt, msg, fend = '') {
900
902
  }
901
903
  }
902
904
  await lFs.putContent(path, '"' +
903
- lText.csvescape(lTime.format(null, 'H:i:s')) + '","' +
904
- lText.csvescape(lTime.stamp().toString()) + '","' +
905
+ lText.csvescape(lTime.format(null, 'H:i:s', now)) + '","' +
906
+ lText.csvescape(lTime.stamp(now).toString()) + '","' +
905
907
  lText.csvescape(urlFull + wpath + (Object.keys(get).length ? '?' + lText.queryStringify(get) : '')) + '","' +
906
908
  lText.csvescape(lText.queryStringify(cookie)) + '","' +
907
909
  lText.csvescape(lText.stringifyJson(session)) + '","' +
@@ -31,7 +31,7 @@ export declare class Response {
31
31
  /**
32
32
  * --- 获取响应读取流对象 ---
33
33
  */
34
- getStream(): (import("undici/types/readable").default & undici.Dispatcher.BodyMixin) | zlib.Gunzip | zlib.Inflate | zlib.BrotliDecompress | null;
34
+ getStream(): zlib.BrotliDecompress | zlib.Gunzip | zlib.Inflate | (import("undici/types/readable").default & undici.Dispatcher.BodyMixin) | null;
35
35
  /**
36
36
  * --- 获取原生响应读取流对象 ---
37
37
  */
package/lib/vector.d.ts CHANGED
@@ -23,7 +23,7 @@ export declare class Vector {
23
23
  private readonly _etc;
24
24
  constructor(etc: kebab.IConfigVector);
25
25
  /** --- 搜索 --- */
26
- seach(data: {
26
+ search(data: {
27
27
  /** --- 表名 --- */
28
28
  'collection': string;
29
29
  /** --- 查询的向量 --- */
package/lib/vector.js CHANGED
@@ -8,7 +8,7 @@ export class Vector {
8
8
  this._etc = etc;
9
9
  }
10
10
  /** --- 搜索 --- */
11
- async seach(data) {
11
+ async search(data) {
12
12
  const body = {
13
13
  'dbName': this._etc.name,
14
14
  'collectionName': data.collection,
@@ -27,15 +27,15 @@ export class Vector {
27
27
  try {
28
28
  const res = await lUndici.postJsonResponseJson(`http://${this._etc.host}:${this._etc.port}/v2/vectordb/entities/search`, body, { 'headers': { 'Authorization': `Bearer ${this._etc.user}:${this._etc.pwd}` } });
29
29
  if (res?.code !== 0) {
30
- lCore.log({}, '[VECTOR][seach][error] ' + (res?.message ?? ''), '-error');
31
- lCore.debug('[VECTOR][seach]', res);
30
+ lCore.log({}, '[VECTOR][search][error] ' + (res?.message ?? ''), '-error');
31
+ lCore.debug('[VECTOR][search]', res);
32
32
  return false;
33
33
  }
34
34
  return res.data;
35
35
  }
36
36
  catch (e) {
37
- lCore.log({}, '[VECTOR][seach][error] ' + e.message, '-error');
38
- lCore.debug('[VECTOR][seach]', e);
37
+ lCore.log({}, '[VECTOR][search][error] ' + e.message, '-error');
38
+ lCore.debug('[VECTOR][search]', e);
39
39
  return false;
40
40
  }
41
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "9.11.0",
3
+ "version": "9.11.1",
4
4
  "description": "Simple, easy-to-use, and fully-featured Node.js framework that is ready-to-use out of the box.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -1729,12 +1729,12 @@ exec: ${JSON.stringify(exec)}<br><br>`);
1729
1729
  }
1730
1730
  async vector() {
1731
1731
  const vector = lVector.get(this);
1732
- const res = await vector.seach({
1732
+ const res = await vector.search({
1733
1733
  'collection': 'ai_wiki_content',
1734
1734
  'metric': 'COSINE',
1735
1735
  'data': [0.4100031323819555, 0.7188991736586672, 0.32890290245747833, 0.9187961849628559, 0.023142186415922916, 0.45239563148580797, 0.23537591588175988, 0.6848990771759962, 0.9865744633216178, 0.8239142304110896, 0.997768380245414, 0.3012929412655765, 0.13731236076734943, 0.5126131685642945, 0.9806290097015617, 0.1870468071764284, 0.17178642706602143, 0.4016660911946244, 0.15484433366942607, 0.29719222215610386, 0.3103748731148619, 0.6892950176658315, 0.01785695346759608, 0.08539564964986557, 0.2655959514380064, 0.9964617086704073, 0.2838371937684081, 0.14987010598298633, 0.6228479079557896, 0.8080833516756243, 0.15438562173495285, 0.5078008662168574, 0.27262149922940804, 0.23104911473240675, 0.6266656488428926, 0.8553958245035254, 0.11699454830789868, 0.2300336351244865, 0.3042943975707315, 0.20182231286864427, 0.14334825938359863, 0.5272057735967806, 0.6568390179350452, 0.11388912236667226, 0.4916225414998463, 0.4913046496135085, 0.6301252401085475, 0.26051075673874036, 0.17023441587522825, 0.371755148312803, 0.5831318953846139, 0.9756820442368113, 0.6818893859710211, 0.5188330204766185, 0.7868335112863099, 0.7263293211859105, 0.15777067513918275, 0.25071428052177835, 0.9055952502390328, 0.39066574162485046, 0.6694768856781026, 0.904527206408617, 0.5359679189729842, 0.42923033393177423, 0.6959492373261136, 0.4721197667950616, 0.6861043448179791, 0.05188999799541438, 0.7346607591003518, 0.1574483630625012, 0.9141756884547747, 0.9116789303557802, 0.7609450526832306, 0.7763073356227885, 0.7334996162535046, 0.8036447394427264, 0.21291521237560262, 0.4628513517221038, 0.005054981316060525, 0.6289756103407573, 0.9376033918403373, 0.79713161153396, 0.1795021378890418, 0.32421299215073773, 0.5585715705291334, 0.1964507020528392, 0.9170965358836494, 0.44199069294404825, 0.46924875851341463, 0.005915168915280544, 0.4519648598811945, 0.7817208441823769, 0.39630447274483926, 0.874803477246406, 0.02593537985516514, 0.03494415508402371, 0.6948556600612117, 0.02531235612016558, 0.3252859275909026, 0.6124602304575255, 0.6662991517754546, 0.054786469959723805, 0.09541281916656552, 0.047971618444194286, 0.9888851535738363, 0.09923862294731634, 0.37389883211204245, 0.0510449762242422, 0.5140187522339308, 0.9165108670272317, 0.473682888066292, 0.7553395418192084, 0.48450479101753663, 0.22080081972551513, 0.8461012374988566, 0.32711442729081885, 0.46740436391036244, 0.9330234279632854, 0.7456194346850014, 0.8575560505025164, 0.2617623984893922, 0.6418053194775086, 0.607749877895083, 0.2176063100000032, 0.5366633111896186, 0.9689538808794083, 0.8226310778269623, 0.4813948057818185]
1736
1736
  });
1737
- const echo = [`<pre>const res = await vector.seach({
1737
+ const echo = [`<pre>const res = await vector.search({
1738
1738
  'collection': 'oas_wiki',
1739
1739
  'metric': 'COSINE',
1740
1740
  'data': [0.4100031323819555, 0.7188991736586672, 0.32890290245747833, ...]