@maiyunnet/kebab 3.2.22 → 3.2.24
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/index.d.ts +2 -2
- package/index.js +1 -1
- package/lib/ai.d.ts +0 -1
- package/lib/ai.js +0 -1
- package/lib/kv.d.ts +1 -0
- package/lib/kv.js +1 -0
- package/lib/net.js +3 -3
- package/lib/vector.d.ts +52 -0
- package/lib/vector.js +59 -0
- package/package.json +2 -1
- package/sys/child.js +4 -2
- package/sys/mod.d.ts +4 -0
- package/sys/mod.js +8 -1
- package/sys/route.d.ts +1 -1
- package/sys/route.js +2 -3
- package/www/example/ctr/test.d.ts +2 -0
- package/www/example/ctr/test.js +26 -2
package/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
6
6
|
*/
|
|
7
7
|
/** --- 当前系统版本号 --- */
|
|
8
|
-
export declare const VER = "3.2.
|
|
8
|
+
export declare const VER = "3.2.24";
|
|
9
9
|
/** --- 框架根目录,以 / 结尾 --- */
|
|
10
10
|
export declare const ROOT_PATH: string;
|
|
11
11
|
export declare const LIB_PATH: string;
|
|
@@ -52,7 +52,7 @@ export interface IConfig {
|
|
|
52
52
|
's3': Record<string, IConfigS3>;
|
|
53
53
|
'turnstile': IConfigTurnstile;
|
|
54
54
|
'ai': Record<string, IConfigAi>;
|
|
55
|
-
'vector':
|
|
55
|
+
'vector': IConfigVector;
|
|
56
56
|
[key: string]: Record<string, Json>;
|
|
57
57
|
}
|
|
58
58
|
export interface IUrlParse {
|
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
7
7
|
*/
|
|
8
8
|
/** --- 当前系统版本号 --- */
|
|
9
|
-
export const VER = '3.2.
|
|
9
|
+
export const VER = '3.2.24';
|
|
10
10
|
// --- 服务端用的路径 ---
|
|
11
11
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
12
12
|
/** --- /xxx/xxx --- */
|
package/lib/ai.d.ts
CHANGED
package/lib/ai.js
CHANGED
package/lib/kv.d.ts
CHANGED
package/lib/kv.js
CHANGED
package/lib/net.js
CHANGED
|
@@ -155,7 +155,7 @@ export async function request(u, data, opt = {}) {
|
|
|
155
155
|
const res = new lResponse.Response(null);
|
|
156
156
|
res.error = {
|
|
157
157
|
'name': 'Possible mProxy error',
|
|
158
|
-
'message': 'host not found'
|
|
158
|
+
'message': 'host not found',
|
|
159
159
|
};
|
|
160
160
|
return res;
|
|
161
161
|
}
|
|
@@ -165,7 +165,7 @@ export async function request(u, data, opt = {}) {
|
|
|
165
165
|
const res = new lResponse.Response(null);
|
|
166
166
|
res.error = {
|
|
167
167
|
'name': 'hosts error',
|
|
168
|
-
'message': 'hosts param error'
|
|
168
|
+
'message': 'hosts param error',
|
|
169
169
|
};
|
|
170
170
|
return res;
|
|
171
171
|
}
|
|
@@ -176,7 +176,7 @@ export async function request(u, data, opt = {}) {
|
|
|
176
176
|
'url': opt.mproxy ? opt.mproxy.url + (opt.mproxy.url.includes('?') ? '&' : '?') + lText.queryStringify({
|
|
177
177
|
'url': u,
|
|
178
178
|
'auth': opt.mproxy.auth,
|
|
179
|
-
'data': opt.mproxy.data ? lText.stringifyJson(opt.mproxy.data) : '{}'
|
|
179
|
+
'data': opt.mproxy.data ? lText.stringifyJson(opt.mproxy.data) : '{}',
|
|
180
180
|
}) : u,
|
|
181
181
|
'method': method,
|
|
182
182
|
'data': data,
|
package/lib/vector.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project: Kebab, User: JianSuoQiYue
|
|
3
|
+
* Date: 2025-10-28 15:18:41
|
|
4
|
+
* Last: 2025-10-28 15:18:44
|
|
5
|
+
*/
|
|
6
|
+
import * as milvus from '@zilliz/milvus2-sdk-node';
|
|
7
|
+
import * as sCtr from '#kebab/sys/ctr.js';
|
|
8
|
+
/** --- 选项 --- */
|
|
9
|
+
export interface IOptions {
|
|
10
|
+
/** --- 主机地址 --- */
|
|
11
|
+
'host'?: string;
|
|
12
|
+
/** --- 端口号 --- */
|
|
13
|
+
'port'?: number;
|
|
14
|
+
/** --- 数据库名称 --- */
|
|
15
|
+
'name'?: string;
|
|
16
|
+
/** --- 用户名 --- */
|
|
17
|
+
'user'?: string;
|
|
18
|
+
/** --- 密码 --- */
|
|
19
|
+
'pwd'?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare class Vector {
|
|
22
|
+
/** --- milvus 原生对象,建议只读 --- */
|
|
23
|
+
readonly link: milvus.MilvusClient;
|
|
24
|
+
constructor(ctr: sCtr.Ctr, opt?: IOptions);
|
|
25
|
+
/** --- 搜索 --- */
|
|
26
|
+
seach(data: {
|
|
27
|
+
/** --- 表名 --- */
|
|
28
|
+
'collection': string;
|
|
29
|
+
/** --- 查询的向量 --- */
|
|
30
|
+
'data': number[];
|
|
31
|
+
/** --- 过滤器,如 word_count > 0 --- */
|
|
32
|
+
'filter'?: string;
|
|
33
|
+
/** --- 返回的结果数量,默认为 20 --- */
|
|
34
|
+
'limit'?: number;
|
|
35
|
+
/** --- 计算两个向量相似度的度量,默认 L2 --- */
|
|
36
|
+
'metric'?: 'L2' | 'IP' | 'COSINE';
|
|
37
|
+
/** --- 输出的字段,如 ['book_id', 'word_count'],默认全部 --- */
|
|
38
|
+
'fields'?: string[];
|
|
39
|
+
}): Promise<false | milvus.SearchResults<{
|
|
40
|
+
collection_name: string;
|
|
41
|
+
data: number[];
|
|
42
|
+
filter: string | undefined;
|
|
43
|
+
limit: number;
|
|
44
|
+
metric_type: "L2" | "IP" | "COSINE";
|
|
45
|
+
output_fields: string[] | undefined;
|
|
46
|
+
}>>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* --- 创建一个 Vector 对象 ---
|
|
50
|
+
* @param opt 选项
|
|
51
|
+
*/
|
|
52
|
+
export declare function get(ctr: sCtr.Ctr, opt?: IOptions): Vector;
|
package/lib/vector.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project: Kebab, User: JianSuoQiYue
|
|
3
|
+
* Date: 2025-10-28 15:18:41
|
|
4
|
+
* Last: 2025-10-28 15:18:44
|
|
5
|
+
*/
|
|
6
|
+
import * as milvus from '@zilliz/milvus2-sdk-node';
|
|
7
|
+
/** --- milvus 的连接对象 --- */
|
|
8
|
+
const links = [];
|
|
9
|
+
export class Vector {
|
|
10
|
+
constructor(ctr, opt) {
|
|
11
|
+
const config = ctr.getPrototype('_config');
|
|
12
|
+
const host = opt?.host ?? config.vector?.host ?? '127.0.0.1';
|
|
13
|
+
const port = opt?.port ?? config.vector?.port ?? 19530;
|
|
14
|
+
const name = opt?.name ?? config.vector?.name ?? 'default';
|
|
15
|
+
const user = opt?.user ?? config.vector?.user ?? 'root';
|
|
16
|
+
const pwd = opt?.pwd ?? config.vector?.pwd ?? 'Milvue';
|
|
17
|
+
const token = `${host}-${port}-${name}-${user}`;
|
|
18
|
+
const link = links.find((item) => item.token === token);
|
|
19
|
+
if (link) {
|
|
20
|
+
this.link = link.link;
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
this.link = new milvus.MilvusClient({
|
|
24
|
+
'address': `${host}:${port}`,
|
|
25
|
+
'ssl': false,
|
|
26
|
+
'database': name,
|
|
27
|
+
'username': user,
|
|
28
|
+
'password': pwd,
|
|
29
|
+
});
|
|
30
|
+
links.push({
|
|
31
|
+
'token': token,
|
|
32
|
+
'link': this.link,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/** --- 搜索 --- */
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
37
|
+
async seach(data) {
|
|
38
|
+
try {
|
|
39
|
+
return await this.link.search({
|
|
40
|
+
'collection_name': data.collection,
|
|
41
|
+
'data': data.data,
|
|
42
|
+
'filter': data.filter,
|
|
43
|
+
'limit': data.limit ?? 20,
|
|
44
|
+
'metric_type': data.metric ?? 'L2',
|
|
45
|
+
'output_fields': data.fields,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* --- 创建一个 Vector 对象 ---
|
|
55
|
+
* @param opt 选项
|
|
56
|
+
*/
|
|
57
|
+
export function get(ctr, opt) {
|
|
58
|
+
return new Vector(ctr, opt);
|
|
59
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maiyunnet/kebab",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.24",
|
|
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": [
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"@litert/redis": "^3.0.5",
|
|
27
27
|
"@litert/websocket": "^0.2.7",
|
|
28
28
|
"@types/ssh2": "^1.15.5",
|
|
29
|
+
"@zilliz/milvus2-sdk-node": "^2.6.2",
|
|
29
30
|
"ejs": "^3.1.10",
|
|
30
31
|
"jszip": "^3.10.1",
|
|
31
32
|
"mysql2": "^3.15.3",
|
package/sys/child.js
CHANGED
|
@@ -90,7 +90,7 @@ async function run() {
|
|
|
90
90
|
const host = (req.headers[':authority'] ?? req.headers['host'] ?? '');
|
|
91
91
|
if (!host) {
|
|
92
92
|
lCore.writeHead(res, 403);
|
|
93
|
-
res.end();
|
|
93
|
+
res.end('403 Forbidden');
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
const key = host + req.url;
|
|
@@ -141,6 +141,7 @@ async function run() {
|
|
|
141
141
|
httpServer = http.createServer(function (req, res) {
|
|
142
142
|
const host = (req.headers['host'] ?? '');
|
|
143
143
|
if (!host) {
|
|
144
|
+
res.setHeader('x-kebab-error', '0');
|
|
144
145
|
lCore.writeHead(res, 403);
|
|
145
146
|
res.end();
|
|
146
147
|
return;
|
|
@@ -233,6 +234,7 @@ async function requestHandler(req, res, https) {
|
|
|
233
234
|
/** --- 当前的 vhost 配置文件 --- */
|
|
234
235
|
const vhost = await getVhostByHostname(uri.hostname ?? '');
|
|
235
236
|
if (!vhost) {
|
|
237
|
+
res.setHeader('x-kebab-error', '1');
|
|
236
238
|
lCore.writeHead(res, 403);
|
|
237
239
|
res.end();
|
|
238
240
|
return;
|
|
@@ -553,7 +555,7 @@ process.on('message', function (msg) {
|
|
|
553
555
|
for (const key in linkCount) {
|
|
554
556
|
str.push(key + ':' + linkCount[key].toString());
|
|
555
557
|
}
|
|
556
|
-
lCore.
|
|
558
|
+
lCore.debug(`[CHILD] Worker ${process.pid} busy: ${str.join(',')}.`);
|
|
557
559
|
lCore.log({}, `[CHILD] Worker ${process.pid} busy: ${str.join(',')}.`, '-warning');
|
|
558
560
|
await lCore.sleep(30_000);
|
|
559
561
|
waiting += 30_000;
|
package/sys/mod.d.ts
CHANGED
package/sys/mod.js
CHANGED
|
@@ -1184,7 +1184,7 @@ class Mod {
|
|
|
1184
1184
|
* --- 根据当前条件,筛选出当前条目该有的数据条数 ---
|
|
1185
1185
|
*/
|
|
1186
1186
|
async count() {
|
|
1187
|
-
const sql = this._sql.getSql().replace(/SELECT .+? FROM/, 'SELECT COUNT(
|
|
1187
|
+
const sql = this._sql.getSql().replace(/SELECT .+? FROM/, 'SELECT COUNT(0) AS `count` FROM');
|
|
1188
1188
|
const r = await this._db.query(sql, this._sql.getData());
|
|
1189
1189
|
if (r.rows === null) {
|
|
1190
1190
|
lCore.log(this._ctr ?? {}, '[count, mod] ' + lText.stringifyJson(r.error?.message ?? '').slice(1, -1).replace(/"/g, '""'), '-error');
|
|
@@ -1196,6 +1196,13 @@ class Mod {
|
|
|
1196
1196
|
}
|
|
1197
1197
|
return count;
|
|
1198
1198
|
}
|
|
1199
|
+
/**
|
|
1200
|
+
* --- 获取当前条件下的 count 的 SQL 语句 ---
|
|
1201
|
+
*/
|
|
1202
|
+
countSql() {
|
|
1203
|
+
const sql = this._sql.getSql().replace(/SELECT .+? FROM/, 'SELECT COUNT(0) AS `count` FROM');
|
|
1204
|
+
return this._sql.format(sql, this._sql.getData());
|
|
1205
|
+
}
|
|
1199
1206
|
/**
|
|
1200
1207
|
* @param f 表名
|
|
1201
1208
|
* @param s ON 信息
|
package/sys/route.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Project: Kebab, User: JianSuoQiYue
|
|
3
3
|
* Date: 2019-4-15 13:40
|
|
4
|
-
* Last: 2020-4-14 13:52:00, 2022-09-07 01:43:31, 2023-12-29 17:24:03, 2024-2-7 00:28:50, 2024-6-6 15:15:54, 2025-6-13 19:23:53, 2025-9-22 15:48:53, 2025-9-23 11:26:50
|
|
4
|
+
* Last: 2020-4-14 13:52:00, 2022-09-07 01:43:31, 2023-12-29 17:24:03, 2024-2-7 00:28:50, 2024-6-6 15:15:54, 2025-6-13 19:23:53, 2025-9-22 15:48:53, 2025-9-23 11:26:50, 2025-10-30 17:44:41
|
|
5
5
|
*/
|
|
6
6
|
import * as http from 'http';
|
|
7
7
|
import * as http2 from 'http2';
|
package/sys/route.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Project: Kebab, User: JianSuoQiYue
|
|
3
3
|
* Date: 2019-4-15 13:40
|
|
4
|
-
* Last: 2020-4-14 13:52:00, 2022-09-07 01:43:31, 2023-12-29 17:24:03, 2024-2-7 00:28:50, 2024-6-6 15:15:54, 2025-6-13 19:23:53, 2025-9-22 15:48:53, 2025-9-23 11:26:50
|
|
4
|
+
* Last: 2020-4-14 13:52:00, 2022-09-07 01:43:31, 2023-12-29 17:24:03, 2024-2-7 00:28:50, 2024-6-6 15:15:54, 2025-6-13 19:23:53, 2025-9-22 15:48:53, 2025-9-23 11:26:50, 2025-10-30 17:44:41
|
|
5
5
|
*/
|
|
6
6
|
import * as http from 'http';
|
|
7
7
|
import * as stream from 'stream';
|
|
@@ -12,7 +12,6 @@ import * as lFs from '#kebab/lib/fs.js';
|
|
|
12
12
|
import * as lZlib from '#kebab/lib/zlib.js';
|
|
13
13
|
import * as lCore from '#kebab/lib/core.js';
|
|
14
14
|
import * as lText from '#kebab/lib/text.js';
|
|
15
|
-
import * as lTime from '#kebab/lib/time.js';
|
|
16
15
|
import * as lResponse from '#kebab/lib/net/response.js';
|
|
17
16
|
import * as lWs from '#kebab/lib/ws.js';
|
|
18
17
|
import * as lLang from '#kebab/lib/lang.js';
|
|
@@ -567,7 +566,7 @@ export async function run(data) {
|
|
|
567
566
|
}
|
|
568
567
|
// --- 设置缓存 ---
|
|
569
568
|
if (!data.res.headersSent && (cacheTTL > 0)) {
|
|
570
|
-
data.res.setHeader('expires',
|
|
569
|
+
data.res.setHeader('expires', new Date(Date.now() + cacheTTL * 1_000).toUTCString());
|
|
571
570
|
data.res.setHeader('cache-control', 'max-age=' + cacheTTL.toString());
|
|
572
571
|
}
|
|
573
572
|
// --- 设置自定义 hcode ---
|
|
@@ -49,6 +49,7 @@ export default class extends sCtr.Ctr {
|
|
|
49
49
|
crypto(): Promise<string>;
|
|
50
50
|
db(): Promise<kebab.Json>;
|
|
51
51
|
private _dbTable;
|
|
52
|
+
vector(): Promise<any>;
|
|
52
53
|
kv(): Promise<kebab.Json>;
|
|
53
54
|
net(): Promise<string>;
|
|
54
55
|
netPipe(): Promise<kebab.Json>;
|
|
@@ -72,6 +73,7 @@ export default class extends sCtr.Ctr {
|
|
|
72
73
|
netHosts(): Promise<string>;
|
|
73
74
|
netMproxy(): Promise<string | boolean>;
|
|
74
75
|
netMproxy1(): Promise<string | boolean>;
|
|
76
|
+
netMproxy2(): any[];
|
|
75
77
|
netFilterheaders(): string;
|
|
76
78
|
scan(): Promise<kebab.Json>;
|
|
77
79
|
scan1(): Promise<kebab.Json>;
|
package/www/example/ctr/test.js
CHANGED
|
@@ -3,6 +3,7 @@ import * as kebab from '#kebab/index.js';
|
|
|
3
3
|
import * as lCore from '#kebab/lib/core.js';
|
|
4
4
|
import * as lNet from '#kebab/lib/net.js';
|
|
5
5
|
import * as lDb from '#kebab/lib/db.js';
|
|
6
|
+
import * as lVector from '#kebab/lib/vector.js';
|
|
6
7
|
import * as lFs from '#kebab/lib/fs.js';
|
|
7
8
|
import * as lText from '#kebab/lib/text.js';
|
|
8
9
|
import * as lCrypto from '#kebab/lib/crypto.js';
|
|
@@ -144,6 +145,8 @@ export default class extends sCtr.Ctr {
|
|
|
144
145
|
`<br><br><a href="${this._config.const.urlBase}test/crypto">View "test/crypto"</a>`,
|
|
145
146
|
'<br><br><b>Db:</b>',
|
|
146
147
|
`<br><br><a href="${this._config.const.urlBase}test/db">View "test/db"</a>`,
|
|
148
|
+
`<br><br><b>Vector:</b>`,
|
|
149
|
+
`<br><br><a href="${this._config.const.urlBase}test/vector">View "test/vector"</a>`,
|
|
147
150
|
'<br><br><b>Kv:</b>',
|
|
148
151
|
`<br><br><a href="${this._config.const.urlBase}test/kv">View "test/kv"</a>`,
|
|
149
152
|
'<br><br><b>Net:</b>',
|
|
@@ -1337,6 +1340,20 @@ exec: ${JSON.stringify(exec)}<br><br>`);
|
|
|
1337
1340
|
}
|
|
1338
1341
|
echo.push('</table>');
|
|
1339
1342
|
}
|
|
1343
|
+
async vector() {
|
|
1344
|
+
const vector = lVector.get(this);
|
|
1345
|
+
const res = await vector.seach({
|
|
1346
|
+
'collection': 'oas_wiki',
|
|
1347
|
+
'metric': 'COSINE',
|
|
1348
|
+
'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]
|
|
1349
|
+
});
|
|
1350
|
+
const echo = [`<pre>const res = await vector.seach({
|
|
1351
|
+
'collection': 'oas_wiki',
|
|
1352
|
+
'metric': 'COSINE',
|
|
1353
|
+
'data': [0.4100031323819555, 0.7188991736586672, 0.32890290245747833, ...]
|
|
1354
|
+
});</pre>res:<pre>${JSON.stringify(res, null, 4)}</pre>`];
|
|
1355
|
+
return echo.join('') + '<br>' + this._getEnd();
|
|
1356
|
+
}
|
|
1340
1357
|
async kv() {
|
|
1341
1358
|
const kv = lKv.get(this);
|
|
1342
1359
|
if (!await kv.ping()) {
|
|
@@ -1802,14 +1819,16 @@ error: <pre>${JSON.stringify(res.error, null, 4)}</pre>`);
|
|
|
1802
1819
|
}
|
|
1803
1820
|
async netMproxy() {
|
|
1804
1821
|
const echo = [];
|
|
1805
|
-
const res = await lNet.
|
|
1822
|
+
const res = await lNet.postJson(this._internalUrl + 'test/net-mproxy2', {
|
|
1823
|
+
'abc': 'ok',
|
|
1824
|
+
}, {
|
|
1806
1825
|
'mproxy': {
|
|
1807
1826
|
'url': this._internalUrl + 'test/net-mproxy1',
|
|
1808
1827
|
'auth': '123456',
|
|
1809
1828
|
'data': { 'test': '123' },
|
|
1810
1829
|
}
|
|
1811
1830
|
});
|
|
1812
|
-
echo.push(`<pre>lNet.get('
|
|
1831
|
+
echo.push(`<pre>lNet.get('${this._internalUrl}test/net-mproxy2', {
|
|
1813
1832
|
'mproxy': {
|
|
1814
1833
|
'url': '${this._internalUrl}test/net-mproxy1',
|
|
1815
1834
|
'auth': '123456',
|
|
@@ -1830,6 +1849,11 @@ error: <pre>${JSON.stringify(res.error, null, 4)}</pre>`);
|
|
|
1830
1849
|
}
|
|
1831
1850
|
return 'Nothing(' + rtn + ')';
|
|
1832
1851
|
}
|
|
1852
|
+
netMproxy2() {
|
|
1853
|
+
return [1, {
|
|
1854
|
+
'data': this._post,
|
|
1855
|
+
}];
|
|
1856
|
+
}
|
|
1833
1857
|
netFilterheaders() {
|
|
1834
1858
|
const echo = [];
|
|
1835
1859
|
const headers = {
|