@maiyunnet/kebab 9.11.4 → 9.11.6
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 +74 -54
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/ai.d.ts +2 -0
- package/lib/ai.js +1 -0
- package/lib/net.js +7 -7
- package/lib/undici.d.ts +5 -3
- package/lib/undici.js +4 -3
- package/package.json +1 -1
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.
|
|
1363
|
+
> `const` **VER**: `"9.11.6"` = `'9.11.6'`
|
|
1364
1364
|
|
|
1365
1365
|
Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
|
|
1366
1366
|
|
|
@@ -1407,7 +1407,7 @@ lib/ai/classes/Ai.md
|
|
|
1407
1407
|
|
|
1408
1408
|
# Class: Ai
|
|
1409
1409
|
|
|
1410
|
-
Defined in: [lib/ai.ts:
|
|
1410
|
+
Defined in: [lib/ai.ts:69](https://github.com/maiyunnet/kebab/blob/master/lib/ai.ts#L69)
|
|
1411
1411
|
|
|
1412
1412
|
## Constructors
|
|
1413
1413
|
|
|
@@ -1415,7 +1415,7 @@ Defined in: [lib/ai.ts:67](https://github.com/maiyunnet/kebab/blob/master/lib/ai
|
|
|
1415
1415
|
|
|
1416
1416
|
> **new Ai**(`ctrEtc`, `opt`): `Ai`
|
|
1417
1417
|
|
|
1418
|
-
Defined in: [lib/ai.ts:
|
|
1418
|
+
Defined in: [lib/ai.ts:82](https://github.com/maiyunnet/kebab/blob/master/lib/ai.ts#L82)
|
|
1419
1419
|
|
|
1420
1420
|
#### Parameters
|
|
1421
1421
|
|
|
@@ -1437,7 +1437,7 @@ Defined in: [lib/ai.ts:80](https://github.com/maiyunnet/kebab/blob/master/lib/ai
|
|
|
1437
1437
|
|
|
1438
1438
|
> `readonly` **link**: `OpenAI`
|
|
1439
1439
|
|
|
1440
|
-
Defined in: [lib/ai.ts:
|
|
1440
|
+
Defined in: [lib/ai.ts:72](https://github.com/maiyunnet/kebab/blob/master/lib/ai.ts#L72)
|
|
1441
1441
|
|
|
1442
1442
|
openai 原生对象
|
|
1443
1443
|
|
|
@@ -1449,7 +1449,7 @@ openai 原生对象
|
|
|
1449
1449
|
|
|
1450
1450
|
> **get** **service**(): [`ESERVICE`](../enumerations/ESERVICE.md)
|
|
1451
1451
|
|
|
1452
|
-
Defined in: [lib/ai.ts:
|
|
1452
|
+
Defined in: [lib/ai.ts:167](https://github.com/maiyunnet/kebab/blob/master/lib/ai.ts#L167)
|
|
1453
1453
|
|
|
1454
1454
|
获取当前服务商
|
|
1455
1455
|
|
|
@@ -1467,7 +1467,7 @@ Defined in: [lib/ai.ts:164](https://github.com/maiyunnet/kebab/blob/master/lib/a
|
|
|
1467
1467
|
|
|
1468
1468
|
> **chat**(`body`): `Promise`\<`false` \| `APIPromise`\<`ChatCompletion`\>\>
|
|
1469
1469
|
|
|
1470
|
-
Defined in: [lib/ai.ts:
|
|
1470
|
+
Defined in: [lib/ai.ts:172](https://github.com/maiyunnet/kebab/blob/master/lib/ai.ts#L172)
|
|
1471
1471
|
|
|
1472
1472
|
创建非流式对话
|
|
1473
1473
|
|
|
@@ -1485,7 +1485,7 @@ Defined in: [lib/ai.ts:169](https://github.com/maiyunnet/kebab/blob/master/lib/a
|
|
|
1485
1485
|
|
|
1486
1486
|
> **chat**(`body`): `Promise`\<`false` \| `APIPromise`\<`Stream`\<`ChatCompletionChunk`\>\>\>
|
|
1487
1487
|
|
|
1488
|
-
Defined in: [lib/ai.ts:
|
|
1488
|
+
Defined in: [lib/ai.ts:176](https://github.com/maiyunnet/kebab/blob/master/lib/ai.ts#L176)
|
|
1489
1489
|
|
|
1490
1490
|
创建流式对话
|
|
1491
1491
|
|
|
@@ -1505,7 +1505,7 @@ Defined in: [lib/ai.ts:173](https://github.com/maiyunnet/kebab/blob/master/lib/a
|
|
|
1505
1505
|
|
|
1506
1506
|
> **embedding**(`body`): `Promise`\<`false` \| `APIPromise`\<`CreateEmbeddingResponse`\>\>
|
|
1507
1507
|
|
|
1508
|
-
Defined in: [lib/ai.ts:
|
|
1508
|
+
Defined in: [lib/ai.ts:225](https://github.com/maiyunnet/kebab/blob/master/lib/ai.ts#L225)
|
|
1509
1509
|
|
|
1510
1510
|
创建向量
|
|
1511
1511
|
|
|
@@ -1525,7 +1525,7 @@ Defined in: [lib/ai.ts:222](https://github.com/maiyunnet/kebab/blob/master/lib/a
|
|
|
1525
1525
|
|
|
1526
1526
|
> **image**(`opt`): `Promise`\<`false` \| \{ `list`: `object`[]; `request`: `string`; `seed`: `number`; \}\>
|
|
1527
1527
|
|
|
1528
|
-
Defined in: [lib/ai.ts:
|
|
1528
|
+
Defined in: [lib/ai.ts:241](https://github.com/maiyunnet/kebab/blob/master/lib/ai.ts#L241)
|
|
1529
1529
|
|
|
1530
1530
|
生成图像,不支持 GEMINI、GROK 服务商
|
|
1531
1531
|
|
|
@@ -1587,7 +1587,7 @@ Defined in: [lib/ai.ts:238](https://github.com/maiyunnet/kebab/blob/master/lib/a
|
|
|
1587
1587
|
|
|
1588
1588
|
> **poll**(`opt`): `Promise`\<`false` \| \{ `add?`: `number`; `end?`: `number`; `error?`: `string`; `start?`: `number`; `status`: `"PENDING"` \| `"RUNNING"` \| `"SUCCEEDED"` \| `"FAILED"` \| `"CANCELED"` \| `"UNKNOWN"`; `task`: `string`; `url?`: `string`; \}\>
|
|
1589
1589
|
|
|
1590
|
-
Defined in: [lib/ai.ts:
|
|
1590
|
+
Defined in: [lib/ai.ts:602](https://github.com/maiyunnet/kebab/blob/master/lib/ai.ts#L602)
|
|
1591
1591
|
|
|
1592
1592
|
轮询任务
|
|
1593
1593
|
|
|
@@ -1617,7 +1617,7 @@ Defined in: [lib/ai.ts:599](https://github.com/maiyunnet/kebab/blob/master/lib/a
|
|
|
1617
1617
|
|
|
1618
1618
|
> **response**(`body`): `Promise`\<`false` \| `APIPromise`\<`Response`\>\>
|
|
1619
1619
|
|
|
1620
|
-
Defined in: [lib/ai.ts:
|
|
1620
|
+
Defined in: [lib/ai.ts:199](https://github.com/maiyunnet/kebab/blob/master/lib/ai.ts#L199)
|
|
1621
1621
|
|
|
1622
1622
|
创建非流式 Response
|
|
1623
1623
|
|
|
@@ -1635,7 +1635,7 @@ Defined in: [lib/ai.ts:196](https://github.com/maiyunnet/kebab/blob/master/lib/a
|
|
|
1635
1635
|
|
|
1636
1636
|
> **response**(`body`): `Promise`\<`false` \| `APIPromise`\<`Stream`\<`ResponseStreamEvent`\>\>\>
|
|
1637
1637
|
|
|
1638
|
-
Defined in: [lib/ai.ts:
|
|
1638
|
+
Defined in: [lib/ai.ts:203](https://github.com/maiyunnet/kebab/blob/master/lib/ai.ts#L203)
|
|
1639
1639
|
|
|
1640
1640
|
创建流式 Response
|
|
1641
1641
|
|
|
@@ -1655,7 +1655,7 @@ Defined in: [lib/ai.ts:200](https://github.com/maiyunnet/kebab/blob/master/lib/a
|
|
|
1655
1655
|
|
|
1656
1656
|
> **video**(`opt`): `Promise`\<`false` \| \{ `request`: `string`; `seed`: `number`; `status`: `"PENDING"` \| `"RUNNING"` \| `"SUCCEEDED"` \| `"FAILED"` \| `"CANCELED"` \| `"UNKNOWN"`; `task`: `string`; \}\>
|
|
1657
1657
|
|
|
1658
|
-
Defined in: [lib/ai.ts:
|
|
1658
|
+
Defined in: [lib/ai.ts:431](https://github.com/maiyunnet/kebab/blob/master/lib/ai.ts#L431)
|
|
1659
1659
|
|
|
1660
1660
|
异步生成视频,仅支持 ALICN、ALIAS、ALINE
|
|
1661
1661
|
|
|
@@ -1883,7 +1883,7 @@ lib/ai/functions/get.md
|
|
|
1883
1883
|
|
|
1884
1884
|
> **get**(`ctrEtc`, `opt`): [`Ai`](../classes/Ai.md)
|
|
1885
1885
|
|
|
1886
|
-
Defined in: [lib/ai.ts:
|
|
1886
|
+
Defined in: [lib/ai.ts:660](https://github.com/maiyunnet/kebab/blob/master/lib/ai.ts#L660)
|
|
1887
1887
|
|
|
1888
1888
|
创建一个 AI 对象
|
|
1889
1889
|
|
|
@@ -1999,6 +1999,16 @@ Defined in: [lib/ai.ts:52](https://github.com/maiyunnet/kebab/blob/master/lib/ai
|
|
|
1999
1999
|
|
|
2000
2000
|
服务商 -
|
|
2001
2001
|
|
|
2002
|
+
***
|
|
2003
|
+
|
|
2004
|
+
### timeout?
|
|
2005
|
+
|
|
2006
|
+
> `optional` **timeout?**: `number`
|
|
2007
|
+
|
|
2008
|
+
Defined in: [lib/ai.ts:60](https://github.com/maiyunnet/kebab/blob/master/lib/ai.ts#L60)
|
|
2009
|
+
|
|
2010
|
+
请求超时,毫秒
|
|
2011
|
+
|
|
2002
2012
|
lib/buffer/classes/Reader.md
|
|
2003
2013
|
---
|
|
2004
2014
|
|
|
@@ -18095,7 +18105,7 @@ lib/undici/functions/filterHeaders.md
|
|
|
18095
18105
|
|
|
18096
18106
|
> **filterHeaders**(`headers`, `res?`, `filter?`): `Record`\<`string`, `string` \| `string`[]\>
|
|
18097
18107
|
|
|
18098
|
-
Defined in: [lib/undici.ts:
|
|
18108
|
+
Defined in: [lib/undici.ts:530](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L530)
|
|
18099
18109
|
|
|
18100
18110
|
剔除不代理的 header,返回新的 header
|
|
18101
18111
|
|
|
@@ -18136,7 +18146,7 @@ lib/undici/functions/getFormData.md
|
|
|
18136
18146
|
|
|
18137
18147
|
> **getFormData**(): [`FormData`](../formdata/classes/FormData.md)
|
|
18138
18148
|
|
|
18139
|
-
Defined in: [lib/undici.ts:
|
|
18149
|
+
Defined in: [lib/undici.ts:514](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L514)
|
|
18140
18150
|
|
|
18141
18151
|
创建 FormData 对象
|
|
18142
18152
|
|
|
@@ -18256,7 +18266,7 @@ lib/undici/functions/mproxyData.md
|
|
|
18256
18266
|
|
|
18257
18267
|
> **mproxyData**(`ctr`): `any`
|
|
18258
18268
|
|
|
18259
|
-
Defined in: [lib/undici.ts:
|
|
18269
|
+
Defined in: [lib/undici.ts:619](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L619)
|
|
18260
18270
|
|
|
18261
18271
|
获取 mproxy 的附加数据
|
|
18262
18272
|
|
|
@@ -18285,7 +18295,7 @@ lib/undici/functions/mproxy.md
|
|
|
18285
18295
|
|
|
18286
18296
|
> **mproxy**(`ctr`, `auth`, `opt?`): `Promise`\<`number`\>
|
|
18287
18297
|
|
|
18288
|
-
Defined in: [lib/undici.ts:
|
|
18298
|
+
Defined in: [lib/undici.ts:566](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L566)
|
|
18289
18299
|
|
|
18290
18300
|
正向 mproxy 代理,注意提前处理不要自动处理 post 数据,读取 get 的 url 为实际请求地址
|
|
18291
18301
|
get: url, auth
|
|
@@ -18514,7 +18524,7 @@ lib/undici/functions/rproxy.md
|
|
|
18514
18524
|
|
|
18515
18525
|
> **rproxy**(`ctr`, `route`, `opt?`): `Promise`\<`boolean`\>
|
|
18516
18526
|
|
|
18517
|
-
Defined in: [lib/undici.ts:
|
|
18527
|
+
Defined in: [lib/undici.ts:637](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L637)
|
|
18518
18528
|
|
|
18519
18529
|
反向代理,注意提前处理不要自动处理 post 数据,将本服务器的某个路由反代到其他网址
|
|
18520
18530
|
|
|
@@ -18591,7 +18601,7 @@ lib/undici/interfaces/IMproxyOptions.md
|
|
|
18591
18601
|
|
|
18592
18602
|
# Interface: IMproxyOptions
|
|
18593
18603
|
|
|
18594
|
-
Defined in: [lib/undici.ts:
|
|
18604
|
+
Defined in: [lib/undici.ts:723](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L723)
|
|
18595
18605
|
|
|
18596
18606
|
正向代理请求的传入参数选项
|
|
18597
18607
|
|
|
@@ -18601,7 +18611,7 @@ Defined in: [lib/undici.ts:720](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18601
18611
|
|
|
18602
18612
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
18603
18613
|
|
|
18604
|
-
Defined in: [lib/undici.ts:
|
|
18614
|
+
Defined in: [lib/undici.ts:732](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L732)
|
|
18605
18615
|
|
|
18606
18616
|
过滤 header,返回 true 则留下
|
|
18607
18617
|
|
|
@@ -18621,7 +18631,7 @@ Defined in: [lib/undici.ts:729](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18621
18631
|
|
|
18622
18632
|
> `optional` **follow?**: `number`
|
|
18623
18633
|
|
|
18624
|
-
Defined in: [lib/undici.ts:
|
|
18634
|
+
Defined in: [lib/undici.ts:726](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L726)
|
|
18625
18635
|
|
|
18626
18636
|
***
|
|
18627
18637
|
|
|
@@ -18629,7 +18639,7 @@ Defined in: [lib/undici.ts:723](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18629
18639
|
|
|
18630
18640
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
18631
18641
|
|
|
18632
|
-
Defined in: [lib/undici.ts:
|
|
18642
|
+
Defined in: [lib/undici.ts:730](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L730)
|
|
18633
18643
|
|
|
18634
18644
|
***
|
|
18635
18645
|
|
|
@@ -18637,7 +18647,7 @@ Defined in: [lib/undici.ts:727](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18637
18647
|
|
|
18638
18648
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
18639
18649
|
|
|
18640
|
-
Defined in: [lib/undici.ts:
|
|
18650
|
+
Defined in: [lib/undici.ts:728](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L728)
|
|
18641
18651
|
|
|
18642
18652
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
18643
18653
|
|
|
@@ -18647,7 +18657,7 @@ Defined in: [lib/undici.ts:725](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18647
18657
|
|
|
18648
18658
|
> `optional` **local?**: `string`
|
|
18649
18659
|
|
|
18650
|
-
Defined in: [lib/undici.ts:
|
|
18660
|
+
Defined in: [lib/undici.ts:729](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L729)
|
|
18651
18661
|
|
|
18652
18662
|
***
|
|
18653
18663
|
|
|
@@ -18655,7 +18665,7 @@ Defined in: [lib/undici.ts:726](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18655
18665
|
|
|
18656
18666
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
18657
18667
|
|
|
18658
|
-
Defined in: [lib/undici.ts:
|
|
18668
|
+
Defined in: [lib/undici.ts:734](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L734)
|
|
18659
18669
|
|
|
18660
18670
|
默认为 default
|
|
18661
18671
|
|
|
@@ -18665,9 +18675,9 @@ Defined in: [lib/undici.ts:731](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18665
18675
|
|
|
18666
18676
|
> `optional` **timeout?**: `number`
|
|
18667
18677
|
|
|
18668
|
-
Defined in: [lib/undici.ts:
|
|
18678
|
+
Defined in: [lib/undici.ts:725](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L725)
|
|
18669
18679
|
|
|
18670
|
-
|
|
18680
|
+
秒数,默认 300 秒
|
|
18671
18681
|
|
|
18672
18682
|
lib/undici/interfaces/IRequestOptions.md
|
|
18673
18683
|
---
|
|
@@ -18680,7 +18690,7 @@ lib/undici/interfaces/IRequestOptions.md
|
|
|
18680
18690
|
|
|
18681
18691
|
# Interface: IRequestOptions
|
|
18682
18692
|
|
|
18683
|
-
Defined in: [lib/undici.ts:
|
|
18693
|
+
Defined in: [lib/undici.ts:690](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L690)
|
|
18684
18694
|
|
|
18685
18695
|
请求的传入参数选项
|
|
18686
18696
|
|
|
@@ -18690,7 +18700,7 @@ Defined in: [lib/undici.ts:689](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18690
18700
|
|
|
18691
18701
|
> `optional` **cookie?**: `Record`\<`string`, [`ICookie`](../../cookie/interfaces/ICookie.md)\>
|
|
18692
18702
|
|
|
18693
|
-
Defined in: [lib/undici.ts:
|
|
18703
|
+
Defined in: [lib/undici.ts:715](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L715)
|
|
18694
18704
|
|
|
18695
18705
|
cookie 托管对象
|
|
18696
18706
|
|
|
@@ -18700,7 +18710,7 @@ cookie 托管对象
|
|
|
18700
18710
|
|
|
18701
18711
|
> `optional` **follow?**: `number`
|
|
18702
18712
|
|
|
18703
|
-
Defined in: [lib/undici.ts:
|
|
18713
|
+
Defined in: [lib/undici.ts:696](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L696)
|
|
18704
18714
|
|
|
18705
18715
|
追踪 location 次数,0 为不追踪,默认为 0
|
|
18706
18716
|
|
|
@@ -18710,7 +18720,7 @@ Defined in: [lib/undici.ts:695](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18710
18720
|
|
|
18711
18721
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
18712
18722
|
|
|
18713
|
-
Defined in: [lib/undici.ts:
|
|
18723
|
+
Defined in: [lib/undici.ts:701](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L701)
|
|
18714
18724
|
|
|
18715
18725
|
***
|
|
18716
18726
|
|
|
@@ -18718,7 +18728,7 @@ Defined in: [lib/undici.ts:700](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18718
18728
|
|
|
18719
18729
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
18720
18730
|
|
|
18721
|
-
Defined in: [lib/undici.ts:
|
|
18731
|
+
Defined in: [lib/undici.ts:698](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L698)
|
|
18722
18732
|
|
|
18723
18733
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
18724
18734
|
|
|
@@ -18728,7 +18738,7 @@ Defined in: [lib/undici.ts:697](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18728
18738
|
|
|
18729
18739
|
> `optional` **keep?**: `boolean`
|
|
18730
18740
|
|
|
18731
|
-
Defined in: [lib/undici.ts:
|
|
18741
|
+
Defined in: [lib/undici.ts:711](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L711)
|
|
18732
18742
|
|
|
18733
18743
|
连接是否保持长连接(即是否允许复用),默认为 true
|
|
18734
18744
|
|
|
@@ -18738,7 +18748,7 @@ Defined in: [lib/undici.ts:710](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18738
18748
|
|
|
18739
18749
|
> `optional` **local?**: `string`
|
|
18740
18750
|
|
|
18741
|
-
Defined in: [lib/undici.ts:
|
|
18751
|
+
Defined in: [lib/undici.ts:700](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L700)
|
|
18742
18752
|
|
|
18743
18753
|
***
|
|
18744
18754
|
|
|
@@ -18746,7 +18756,7 @@ Defined in: [lib/undici.ts:699](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18746
18756
|
|
|
18747
18757
|
> `optional` **log?**: `boolean`
|
|
18748
18758
|
|
|
18749
|
-
Defined in: [lib/undici.ts:
|
|
18759
|
+
Defined in: [lib/undici.ts:717](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L717)
|
|
18750
18760
|
|
|
18751
18761
|
若有异常写入文件日志,默认为 true
|
|
18752
18762
|
|
|
@@ -18756,7 +18766,7 @@ Defined in: [lib/undici.ts:716](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18756
18766
|
|
|
18757
18767
|
> `optional` **method?**: `"GET"` \| `"POST"` \| `"PUT"` \| `"DELETE"` \| `"OPTIONS"`
|
|
18758
18768
|
|
|
18759
|
-
Defined in: [lib/undici.ts:
|
|
18769
|
+
Defined in: [lib/undici.ts:691](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L691)
|
|
18760
18770
|
|
|
18761
18771
|
***
|
|
18762
18772
|
|
|
@@ -18764,7 +18774,7 @@ Defined in: [lib/undici.ts:690](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18764
18774
|
|
|
18765
18775
|
> `optional` **mproxy?**: `object`
|
|
18766
18776
|
|
|
18767
|
-
Defined in: [lib/undici.ts:
|
|
18777
|
+
Defined in: [lib/undici.ts:703](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L703)
|
|
18768
18778
|
|
|
18769
18779
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
18770
18780
|
|
|
@@ -18792,7 +18802,7 @@ Defined in: [lib/undici.ts:702](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18792
18802
|
|
|
18793
18803
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
18794
18804
|
|
|
18795
|
-
Defined in: [lib/undici.ts:
|
|
18805
|
+
Defined in: [lib/undici.ts:713](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L713)
|
|
18796
18806
|
|
|
18797
18807
|
复用池名/Agent,默认为 default
|
|
18798
18808
|
|
|
@@ -18802,7 +18812,17 @@ Defined in: [lib/undici.ts:712](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18802
18812
|
|
|
18803
18813
|
> `optional` **save?**: `string`
|
|
18804
18814
|
|
|
18805
|
-
Defined in: [lib/undici.ts:
|
|
18815
|
+
Defined in: [lib/undici.ts:699](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L699)
|
|
18816
|
+
|
|
18817
|
+
***
|
|
18818
|
+
|
|
18819
|
+
### signal?
|
|
18820
|
+
|
|
18821
|
+
> `optional` **signal?**: `AbortSignal`
|
|
18822
|
+
|
|
18823
|
+
Defined in: [lib/undici.ts:719](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L719)
|
|
18824
|
+
|
|
18825
|
+
请求中止信号
|
|
18806
18826
|
|
|
18807
18827
|
***
|
|
18808
18828
|
|
|
@@ -18810,9 +18830,9 @@ Defined in: [lib/undici.ts:698](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18810
18830
|
|
|
18811
18831
|
> `optional` **timeout?**: `number`
|
|
18812
18832
|
|
|
18813
|
-
Defined in: [lib/undici.ts:
|
|
18833
|
+
Defined in: [lib/undici.ts:694](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L694)
|
|
18814
18834
|
|
|
18815
|
-
秒数,默认
|
|
18835
|
+
秒数,默认 300 秒
|
|
18816
18836
|
|
|
18817
18837
|
***
|
|
18818
18838
|
|
|
@@ -18820,7 +18840,7 @@ Defined in: [lib/undici.ts:693](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18820
18840
|
|
|
18821
18841
|
> `optional` **type?**: `"form"` \| `"json"`
|
|
18822
18842
|
|
|
18823
|
-
Defined in: [lib/undici.ts:
|
|
18843
|
+
Defined in: [lib/undici.ts:692](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L692)
|
|
18824
18844
|
|
|
18825
18845
|
lib/undici/interfaces/IRproxyOptions.md
|
|
18826
18846
|
---
|
|
@@ -18833,7 +18853,7 @@ lib/undici/interfaces/IRproxyOptions.md
|
|
|
18833
18853
|
|
|
18834
18854
|
# Interface: IRproxyOptions
|
|
18835
18855
|
|
|
18836
|
-
Defined in: [lib/undici.ts:
|
|
18856
|
+
Defined in: [lib/undici.ts:738](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L738)
|
|
18837
18857
|
|
|
18838
18858
|
反向代理请求的传入参数选项
|
|
18839
18859
|
|
|
@@ -18843,7 +18863,7 @@ Defined in: [lib/undici.ts:735](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18843
18863
|
|
|
18844
18864
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
18845
18865
|
|
|
18846
|
-
Defined in: [lib/undici.ts:
|
|
18866
|
+
Defined in: [lib/undici.ts:747](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L747)
|
|
18847
18867
|
|
|
18848
18868
|
过滤 header,返回 true 则留下
|
|
18849
18869
|
|
|
@@ -18863,7 +18883,7 @@ Defined in: [lib/undici.ts:744](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18863
18883
|
|
|
18864
18884
|
> `optional` **follow?**: `number`
|
|
18865
18885
|
|
|
18866
|
-
Defined in: [lib/undici.ts:
|
|
18886
|
+
Defined in: [lib/undici.ts:741](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L741)
|
|
18867
18887
|
|
|
18868
18888
|
***
|
|
18869
18889
|
|
|
@@ -18871,7 +18891,7 @@ Defined in: [lib/undici.ts:738](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18871
18891
|
|
|
18872
18892
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
18873
18893
|
|
|
18874
|
-
Defined in: [lib/undici.ts:
|
|
18894
|
+
Defined in: [lib/undici.ts:745](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L745)
|
|
18875
18895
|
|
|
18876
18896
|
***
|
|
18877
18897
|
|
|
@@ -18879,7 +18899,7 @@ Defined in: [lib/undici.ts:742](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18879
18899
|
|
|
18880
18900
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
18881
18901
|
|
|
18882
|
-
Defined in: [lib/undici.ts:
|
|
18902
|
+
Defined in: [lib/undici.ts:743](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L743)
|
|
18883
18903
|
|
|
18884
18904
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
18885
18905
|
|
|
@@ -18889,7 +18909,7 @@ Defined in: [lib/undici.ts:740](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18889
18909
|
|
|
18890
18910
|
> `optional` **local?**: `string`
|
|
18891
18911
|
|
|
18892
|
-
Defined in: [lib/undici.ts:
|
|
18912
|
+
Defined in: [lib/undici.ts:744](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L744)
|
|
18893
18913
|
|
|
18894
18914
|
***
|
|
18895
18915
|
|
|
@@ -18897,7 +18917,7 @@ Defined in: [lib/undici.ts:741](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18897
18917
|
|
|
18898
18918
|
> `optional` **mproxy?**: `object`
|
|
18899
18919
|
|
|
18900
|
-
Defined in: [lib/undici.ts:
|
|
18920
|
+
Defined in: [lib/undici.ts:749](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L749)
|
|
18901
18921
|
|
|
18902
18922
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
18903
18923
|
|
|
@@ -18925,7 +18945,7 @@ Defined in: [lib/undici.ts:746](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18925
18945
|
|
|
18926
18946
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
18927
18947
|
|
|
18928
|
-
Defined in: [lib/undici.ts:
|
|
18948
|
+
Defined in: [lib/undici.ts:757](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L757)
|
|
18929
18949
|
|
|
18930
18950
|
默认为 default
|
|
18931
18951
|
|
|
@@ -18935,9 +18955,9 @@ Defined in: [lib/undici.ts:754](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18935
18955
|
|
|
18936
18956
|
> `optional` **timeout?**: `number`
|
|
18937
18957
|
|
|
18938
|
-
Defined in: [lib/undici.ts:
|
|
18958
|
+
Defined in: [lib/undici.ts:740](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L740)
|
|
18939
18959
|
|
|
18940
|
-
|
|
18960
|
+
秒数,默认 300 秒
|
|
18941
18961
|
|
|
18942
18962
|
lib/undici/request/classes/Request.md
|
|
18943
18963
|
---
|
|
@@ -19424,7 +19444,7 @@ lib/undici/type-aliases/THttpHeaders.md
|
|
|
19424
19444
|
|
|
19425
19445
|
> **THttpHeaders** = `http.IncomingHttpHeaders` & `object`
|
|
19426
19446
|
|
|
19427
|
-
Defined in: [lib/undici.ts:
|
|
19447
|
+
Defined in: [lib/undici.ts:762](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L762)
|
|
19428
19448
|
|
|
19429
19449
|
http headers
|
|
19430
19450
|
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
7
7
|
*/
|
|
8
8
|
/** --- 当前系统版本号 --- */
|
|
9
|
-
export const VER = '9.11.
|
|
9
|
+
export const VER = '9.11.6';
|
|
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
|
@@ -48,6 +48,8 @@ export interface IOptions {
|
|
|
48
48
|
'secretKey'?: string;
|
|
49
49
|
/** --- 自定义 fetch 函数 --- */
|
|
50
50
|
'fetch'?: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
51
|
+
/** --- 请求超时,毫秒 --- */
|
|
52
|
+
'timeout'?: number;
|
|
51
53
|
}
|
|
52
54
|
export declare class Ai {
|
|
53
55
|
/** --- openai 原生对象 --- */
|
package/lib/ai.js
CHANGED
package/lib/net.js
CHANGED
|
@@ -210,10 +210,7 @@ export async function fetch(input, init = {}) {
|
|
|
210
210
|
};
|
|
211
211
|
// --- 检查是否已中止(注意:请求发起后无法中止) ---
|
|
212
212
|
if (init.signal?.aborted) {
|
|
213
|
-
|
|
214
|
-
'status': 0,
|
|
215
|
-
'statusText': 'Aborted',
|
|
216
|
-
});
|
|
213
|
+
throw new DOMException('This operation was aborted', 'AbortError');
|
|
217
214
|
}
|
|
218
215
|
// --- 发起请求 ---
|
|
219
216
|
const res = await request(u, body, opt);
|
|
@@ -239,11 +236,14 @@ export async function fetch(input, init = {}) {
|
|
|
239
236
|
}
|
|
240
237
|
}
|
|
241
238
|
}
|
|
242
|
-
|
|
243
|
-
|
|
239
|
+
if (res.error) {
|
|
240
|
+
throw new TypeError(res.error.message ?? 'fetch failed');
|
|
241
|
+
}
|
|
242
|
+
const status = res.headers?.['http-code'] ?? 200;
|
|
243
|
+
if (!resStream) {
|
|
244
244
|
return new Response(null, {
|
|
245
245
|
'status': status,
|
|
246
|
-
'statusText':
|
|
246
|
+
'statusText': 'Unknown Error',
|
|
247
247
|
'headers': resHeaders,
|
|
248
248
|
});
|
|
249
249
|
}
|
package/lib/undici.d.ts
CHANGED
|
@@ -104,7 +104,7 @@ export declare function rproxy(ctr: sCtr.Ctr, route: Record<string, string>, opt
|
|
|
104
104
|
export interface IRequestOptions {
|
|
105
105
|
'method'?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'OPTIONS';
|
|
106
106
|
'type'?: 'form' | 'json';
|
|
107
|
-
/** --- 秒数,默认
|
|
107
|
+
/** --- 秒数,默认 300 秒 --- */
|
|
108
108
|
'timeout'?: number;
|
|
109
109
|
/** --- 追踪 location 次数,0 为不追踪,默认为 0 --- */
|
|
110
110
|
'follow'?: number;
|
|
@@ -129,10 +129,12 @@ export interface IRequestOptions {
|
|
|
129
129
|
'cookie'?: Record<string, lCookie.ICookie>;
|
|
130
130
|
/** --- 若有异常写入文件日志,默认为 true --- */
|
|
131
131
|
'log'?: boolean;
|
|
132
|
+
/** --- 请求中止信号 --- */
|
|
133
|
+
'signal'?: AbortSignal;
|
|
132
134
|
}
|
|
133
135
|
/** --- 正向代理请求的传入参数选项 --- */
|
|
134
136
|
export interface IMproxyOptions {
|
|
135
|
-
/** ---
|
|
137
|
+
/** --- 秒数,默认 300 秒 --- */
|
|
136
138
|
'timeout'?: number;
|
|
137
139
|
'follow'?: number;
|
|
138
140
|
/** --- 自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host --- */
|
|
@@ -146,7 +148,7 @@ export interface IMproxyOptions {
|
|
|
146
148
|
}
|
|
147
149
|
/** --- 反向代理请求的传入参数选项 --- */
|
|
148
150
|
export interface IRproxyOptions {
|
|
149
|
-
/** ---
|
|
151
|
+
/** --- 秒数,默认 300 秒 --- */
|
|
150
152
|
'timeout'?: number;
|
|
151
153
|
'follow'?: number;
|
|
152
154
|
/** --- 自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host --- */
|
package/lib/undici.js
CHANGED
|
@@ -223,9 +223,10 @@ export async function fetch(input, init = {}) {
|
|
|
223
223
|
'headers': headers,
|
|
224
224
|
'hosts': init.hosts,
|
|
225
225
|
'mproxy': init.mproxy,
|
|
226
|
+
'signal': init.signal ?? undefined,
|
|
226
227
|
'follow': init.redirect === 'follow' ? 10 : 0,
|
|
227
228
|
};
|
|
228
|
-
// ---
|
|
229
|
+
// --- 检查是否已中止 ---
|
|
229
230
|
if (init.signal?.aborted) {
|
|
230
231
|
throw new DOMException('This operation was aborted', 'AbortError');
|
|
231
232
|
}
|
|
@@ -271,7 +272,6 @@ export async function fetch(input, init = {}) {
|
|
|
271
272
|
});
|
|
272
273
|
}
|
|
273
274
|
/** --- 构建自定义 DNS 查询函数 --- */
|
|
274
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
275
275
|
function buildDnsLookup(hosts) {
|
|
276
276
|
if (!hosts) {
|
|
277
277
|
return undefined;
|
|
@@ -296,7 +296,7 @@ export async function request(u, data, opt = {}) {
|
|
|
296
296
|
const puri = opt.mproxy ? lText.parseUrl(opt.mproxy.url) : null;
|
|
297
297
|
const method = opt.method ?? 'GET';
|
|
298
298
|
const type = opt.type ?? 'form';
|
|
299
|
-
const timeout = opt.timeout ??
|
|
299
|
+
const timeout = opt.timeout ?? 300;
|
|
300
300
|
/** --- 追踪 location 次数,0 为不追踪,默认为 0 --- */
|
|
301
301
|
const follow = opt.follow ?? 0;
|
|
302
302
|
const hosts = opt.hosts ?? {};
|
|
@@ -373,6 +373,7 @@ export async function request(u, data, opt = {}) {
|
|
|
373
373
|
'headers': headers,
|
|
374
374
|
'headersTimeout': timeout * 1_000,
|
|
375
375
|
'bodyTimeout': timeout * 1_000,
|
|
376
|
+
'signal': opt.signal,
|
|
376
377
|
'dispatcher': agent,
|
|
377
378
|
});
|
|
378
379
|
}
|