w-dispatch-ai 1.0.36 → 1.0.37
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/README.md +10 -6
- package/dist/w-dispatch-ai.umd.js +2 -2
- package/dist/w-dispatch-ai.umd.js.map +1 -1
- package/docs/WDispatchAi.mjs.html +2 -2
- package/docs/adapters.mjs.html +2 -2
- package/docs/budgetFor.mjs.html +2 -2
- package/docs/buildValidator.mjs.html +2 -2
- package/docs/castPintOr.mjs.html +2 -2
- package/docs/checkTruncation.mjs.html +199 -0
- package/docs/dfTimeoutMs.mjs.html +2 -2
- package/docs/dispatchAi.mjs.html +2 -2
- package/docs/dispatchAiFallback.mjs.html +33 -8
- package/docs/dispatchAiWkf.mjs.html +2 -2
- package/docs/dispatchAntigravity.mjs.html +2 -2
- package/docs/dispatchApiOpenaiCompat.mjs.html +96 -29
- package/docs/dispatchApiOpenaiResponses.mjs.html +102 -25
- package/docs/dispatchApiTypesafeSystemone.mjs.html +23 -15
- package/docs/dispatchClaude.mjs.html +2 -2
- package/docs/dispatchCodex.mjs.html +2 -2
- package/docs/dispatchOpencode.mjs.html +2 -2
- package/docs/getCliArgs.mjs.html +2 -2
- package/docs/getErrorResult.mjs.html +2 -2
- package/docs/getErrorType.mjs.html +6 -4
- package/docs/global.html +1234 -115
- package/docs/index.html +2 -2
- package/docs/quota_dfQuotaTimeoutMs.mjs.html +2 -2
- package/docs/quota_fetchQuotaJson.mjs.html +2 -2
- package/docs/quota_fromCodexUsageHttp.mjs.html +2 -2
- package/docs/quota_getQuotaAntigravity.mjs.html +2 -2
- package/docs/quota_getQuotaClaude.mjs.html +2 -2
- package/docs/quota_getQuotaCodex.mjs.html +2 -2
- package/docs/quota_readJsonOrNull.mjs.html +2 -2
- package/docs/quota_toQuotaLabel.mjs.html +2 -2
- package/docs/quota_toQuotaResult.mjs.html +2 -2
- package/docs/quota_toQuotaScopedLabel.mjs.html +2 -2
- package/docs/quota_toQuotaWindow.mjs.html +2 -2
- package/docs/readEnvFile.mjs.html +2 -2
- package/docs/resolveProviders.mjs.html +2 -2
- package/docs/wkf_callAiWithFallback.mjs.html +63 -20
- package/docs/wkf_createFileStore.mjs.html +2 -2
- package/docs/wkf_createUsageCounter.mjs.html +2 -2
- package/docs/wkf_extractJsonLoose.mjs.html +2 -2
- package/docs/wkf_noSideEffectPrefix.mjs.html +2 -2
- package/docs/wkf_runFanout.mjs.html +4 -2
- package/docs/wkf_runFanoutPipeline.mjs.html +2 -2
- package/docs/wkf_runRolePipeline.mjs.html +2 -2
- package/docs/wkf_salvageTruncatedArray.mjs.html +11 -2
- package/package.json +1 -1
- package/src/checkTruncation.mjs +127 -0
- package/src/dispatchAiFallback.mjs +31 -6
- package/src/dispatchApiOpenaiCompat.mjs +94 -27
- package/src/dispatchApiOpenaiResponses.mjs +100 -23
- package/src/dispatchApiTypesafeSystemone.mjs +21 -13
- package/src/getErrorType.mjs +4 -2
- package/src/providers.mjs +1 -1
- package/src/wkf/callAiWithFallback.mjs +61 -18
- package/src/wkf/runFanout.mjs +2 -0
- package/src/wkf/salvageTruncatedArray.mjs +9 -0
- package/test/tools/fakeServerForApiTest.mjs +79 -2
- package/test/unit-dispatchApiOpenaiCompat.test.mjs +169 -1
- package/test/unit-dispatchApiOpenaiResponses.test.mjs +63 -5
- package/test/unit-dispatchApiTypesafeSystemone.test.mjs +17 -0
package/docs/global.html
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<nav >
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#NO_SIDE_EFFECT">NO_SIDE_EFFECT</a></li><li><a href="global.html#WDispatchAi">WDispatchAi</a></li><li><a href="global.html#adapters">adapters</a></li><li><a href="global.html#agyPrint">agyPrint</a></li><li><a href="global.html#attachErrorType">attachErrorType</a></li><li><a href="global.html#budgetFor">budgetFor</a></li><li><a href="global.html#buildChain">buildChain</a></li><li><a href="global.html#buildValidator">buildValidator</a></li><li><a href="global.html#callAiWithFallback">callAiWithFallback</a></li><li><a href="global.html#callOnce">callOnce</a></li><li><a href="global.html#castPintOr">castPintOr</a></li><li><a href="global.html#collectAdditional">collectAdditional</a></li><li><a href="global.html#createFileStore">createFileStore</a></li><li><a href="global.html#createUsageCounter">createUsageCounter</a></li><li><a href="global.html#decodeJwtPayload">decodeJwtPayload</a></li><li><a href="global.html#defaultIntegratePrompt">defaultIntegratePrompt</a></li><li><a href="global.html#dfQuotaTimeoutMs">dfQuotaTimeoutMs</a></li><li><a href="global.html#dfTimeoutMs">dfTimeoutMs</a></li><li><a href="global.html#directWindow">directWindow</a></li><li><a href="global.html#dispatchAi">dispatchAi</a></li><li><a href="global.html#dispatchAiFallback">dispatchAiFallback</a></li><li><a href="global.html#dispatchAiWkf">dispatchAiWkf</a></li><li><a href="global.html#dispatchAntigravity">dispatchAntigravity</a></li><li><a href="global.html#dispatchApiOpenaiCompat">dispatchApiOpenaiCompat</a></li><li><a href="global.html#dispatchApiOpenaiResponses">dispatchApiOpenaiResponses</a></li><li><a href="global.html#dispatchApiTypesafeSystemone">dispatchApiTypesafeSystemone</a></li><li><a href="global.html#dispatchClaude">dispatchClaude</a></li><li><a href="global.html#dispatchCodex">dispatchCodex</a></li><li><a href="global.html#dispatchOpencode">dispatchOpencode</a></li><li><a href="global.html#extractJsonLoose">extractJsonLoose</a></li><li><a href="global.html#extractOutputText">extractOutputText</a></li><li><a href="global.html#fetchQuotaJson">fetchQuotaJson</a></li><li><a href="global.html#firstStr">firstStr</a></li><li><a href="global.html#fromBucket">fromBucket</a></li><li><a href="global.html#fromCodexUsageHttp">fromCodexUsageHttp</a></li><li><a href="global.html#fromLimitItem">fromLimitItem</a></li><li><a href="global.html#fromRpcWindow">fromRpcWindow</a></li><li><a href="global.html#fromTopField">fromTopField</a></li><li><a href="global.html#fromWindow">fromWindow</a></li><li><a href="global.html#getCliArgs">getCliArgs</a></li><li><a href="global.html#getErrorResult">getErrorResult</a></li><li><a href="global.html#getErrorType">getErrorType</a></li><li><a href="global.html#getQuotaAntigravity">getQuotaAntigravity</a></li><li><a href="global.html#getQuotaClaude">getQuotaClaude</a></li><li><a href="global.html#getQuotaCodex">getQuotaCodex</a></li><li><a href="global.html#initState">initState</a></li><li><a href="global.html#isKeyIndependentFail">isKeyIndependentFail</a></li><li><a href="global.html#pickWindow">pickWindow</a></li><li><a href="global.html#readBodyCapped">readBodyCapped</a></li><li><a href="global.html#readEnvFile">readEnvFile</a></li><li><a href="global.html#readJsonOrNull">readJsonOrNull</a></li><li><a href="global.html#redactText">redactText</a></li><li><a href="global.html#reorderByCooling">reorderByCooling</a></li><li><a href="global.html#resolveProviders">resolveProviders</a></li><li><a href="global.html#runFanout">runFanout</a></li><li><a href="global.html#runFanoutPipeline">runFanoutPipeline</a></li><li><a href="global.html#runRolePipeline">runRolePipeline</a></li><li><a href="global.html#salvageTruncatedArray">salvageTruncatedArray</a></li><li><a href="global.html#toQuotaLabel">toQuotaLabel</a></li><li><a href="global.html#toQuotaResult">toQuotaResult</a></li><li><a href="global.html#toQuotaScopedLabel">toQuotaScopedLabel</a></li><li><a href="global.html#toQuotaWindow">toQuotaWindow</a></li><li><a href="global.html#viaAppServer">viaAppServer</a></li><li><a href="global.html#viaHttp">viaHttp</a></li><li><a href="global.html#windowToSeconds">windowToSeconds</a></li></ul>
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#NO_SIDE_EFFECT">NO_SIDE_EFFECT</a></li><li><a href="global.html#WDispatchAi">WDispatchAi</a></li><li><a href="global.html#adapters">adapters</a></li><li><a href="global.html#agyPrint">agyPrint</a></li><li><a href="global.html#attachErrorType">attachErrorType</a></li><li><a href="global.html#budgetFor">budgetFor</a></li><li><a href="global.html#buildChain">buildChain</a></li><li><a href="global.html#buildValidator">buildValidator</a></li><li><a href="global.html#callAiWithFallback">callAiWithFallback</a></li><li><a href="global.html#callOnce">callOnce</a></li><li><a href="global.html#castPintOr">castPintOr</a></li><li><a href="global.html#collectAdditional">collectAdditional</a></li><li><a href="global.html#createFileStore">createFileStore</a></li><li><a href="global.html#createUsageCounter">createUsageCounter</a></li><li><a href="global.html#decodeJwtPayload">decodeJwtPayload</a></li><li><a href="global.html#defaultIntegratePrompt">defaultIntegratePrompt</a></li><li><a href="global.html#dfQuotaTimeoutMs">dfQuotaTimeoutMs</a></li><li><a href="global.html#dfTimeoutMs">dfTimeoutMs</a></li><li><a href="global.html#directWindow">directWindow</a></li><li><a href="global.html#dispatchAi">dispatchAi</a></li><li><a href="global.html#dispatchAiFallback">dispatchAiFallback</a></li><li><a href="global.html#dispatchAiWkf">dispatchAiWkf</a></li><li><a href="global.html#dispatchAntigravity">dispatchAntigravity</a></li><li><a href="global.html#dispatchApiOpenaiCompat">dispatchApiOpenaiCompat</a></li><li><a href="global.html#dispatchApiOpenaiResponses">dispatchApiOpenaiResponses</a></li><li><a href="global.html#dispatchApiTypesafeSystemone">dispatchApiTypesafeSystemone</a></li><li><a href="global.html#dispatchClaude">dispatchClaude</a></li><li><a href="global.html#dispatchCodex">dispatchCodex</a></li><li><a href="global.html#dispatchOpencode">dispatchOpencode</a></li><li><a href="global.html#extractJsonLoose">extractJsonLoose</a></li><li><a href="global.html#extractOutputText">extractOutputText</a></li><li><a href="global.html#fetchQuotaJson">fetchQuotaJson</a></li><li><a href="global.html#finOf">finOf</a></li><li><a href="global.html#firstStr">firstStr</a></li><li><a href="global.html#fromBucket">fromBucket</a></li><li><a href="global.html#fromCodexUsageHttp">fromCodexUsageHttp</a></li><li><a href="global.html#fromLimitItem">fromLimitItem</a></li><li><a href="global.html#fromRpcWindow">fromRpcWindow</a></li><li><a href="global.html#fromTopField">fromTopField</a></li><li><a href="global.html#fromWindow">fromWindow</a></li><li><a href="global.html#getCliArgs">getCliArgs</a></li><li><a href="global.html#getErrorResult">getErrorResult</a></li><li><a href="global.html#getErrorType">getErrorType</a></li><li><a href="global.html#getQuotaAntigravity">getQuotaAntigravity</a></li><li><a href="global.html#getQuotaClaude">getQuotaClaude</a></li><li><a href="global.html#getQuotaCodex">getQuotaCodex</a></li><li><a href="global.html#initState">initState</a></li><li><a href="global.html#isKeyIndependentFail">isKeyIndependentFail</a></li><li><a href="global.html#judgeTruncated">judgeTruncated</a></li><li><a href="global.html#normalizeFinishReason">normalizeFinishReason</a></li><li><a href="global.html#pickWindow">pickWindow</a></li><li><a href="global.html#readBodyCapped">readBodyCapped</a></li><li><a href="global.html#readEnvFile">readEnvFile</a></li><li><a href="global.html#readJsonOrNull">readJsonOrNull</a></li><li><a href="global.html#redactText">redactText</a></li><li><a href="global.html#reorderByCooling">reorderByCooling</a></li><li><a href="global.html#resolveProviders">resolveProviders</a></li><li><a href="global.html#runFanout">runFanout</a></li><li><a href="global.html#runFanoutPipeline">runFanoutPipeline</a></li><li><a href="global.html#runRolePipeline">runRolePipeline</a></li><li><a href="global.html#safeValidate">safeValidate</a></li><li><a href="global.html#salvageTruncatedArray">salvageTruncatedArray</a></li><li><a href="global.html#toQuotaLabel">toQuotaLabel</a></li><li><a href="global.html#toQuotaResult">toQuotaResult</a></li><li><a href="global.html#toQuotaScopedLabel">toQuotaScopedLabel</a></li><li><a href="global.html#toQuotaWindow">toQuotaWindow</a></li><li><a href="global.html#viaAppServer">viaAppServer</a></li><li><a href="global.html#viaHttp">viaHttp</a></li><li><a href="global.html#windowToSeconds">windowToSeconds</a></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -737,7 +737,7 @@ console.log(dfTimeoutMs)
|
|
|
737
737
|
|
|
738
738
|
<dt class="tag-source">Source:</dt>
|
|
739
739
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
740
|
-
<a href="getErrorType.mjs.html">getErrorType.mjs</a>, <a href="getErrorType.mjs.html#
|
|
740
|
+
<a href="getErrorType.mjs.html">getErrorType.mjs</a>, <a href="getErrorType.mjs.html#line92">line 92</a>
|
|
741
741
|
</li></ul></dd>
|
|
742
742
|
|
|
743
743
|
|
|
@@ -1079,7 +1079,7 @@ console.log(budgetFor([{ timeoutMs: 180000 }, {}])) //未帶者以套件統一
|
|
|
1079
1079
|
|
|
1080
1080
|
<dt class="tag-source">Source:</dt>
|
|
1081
1081
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
1082
|
-
<a href="wkf_callAiWithFallback.mjs.html">wkf/callAiWithFallback.mjs</a>, <a href="wkf_callAiWithFallback.mjs.html#
|
|
1082
|
+
<a href="wkf_callAiWithFallback.mjs.html">wkf/callAiWithFallback.mjs</a>, <a href="wkf_callAiWithFallback.mjs.html#line68">line 68</a>
|
|
1083
1083
|
</li></ul></dd>
|
|
1084
1084
|
|
|
1085
1085
|
|
|
@@ -1455,7 +1455,7 @@ parse+check接進遞補層之validate——非法回覆視為該家失敗而
|
|
|
1455
1455
|
|
|
1456
1456
|
<dt class="tag-source">Source:</dt>
|
|
1457
1457
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
1458
|
-
<a href="wkf_callAiWithFallback.mjs.html">wkf/callAiWithFallback.mjs</a>, <a href="wkf_callAiWithFallback.mjs.html#
|
|
1458
|
+
<a href="wkf_callAiWithFallback.mjs.html">wkf/callAiWithFallback.mjs</a>, <a href="wkf_callAiWithFallback.mjs.html#line144">line 144</a>
|
|
1459
1459
|
</li></ul></dd>
|
|
1460
1460
|
|
|
1461
1461
|
|
|
@@ -1849,6 +1849,44 @@ await test()
|
|
|
1849
1849
|
|
|
1850
1850
|
|
|
1851
1851
|
|
|
1852
|
+
<tr>
|
|
1853
|
+
|
|
1854
|
+
<td class="name"><code>acceptTruncated</code></td>
|
|
1855
|
+
|
|
1856
|
+
|
|
1857
|
+
<td class="type">
|
|
1858
|
+
|
|
1859
|
+
|
|
1860
|
+
<span class="param-type">Boolean</span>
|
|
1861
|
+
|
|
1862
|
+
|
|
1863
|
+
|
|
1864
|
+
|
|
1865
|
+
</td>
|
|
1866
|
+
|
|
1867
|
+
|
|
1868
|
+
<td class="attributes">
|
|
1869
|
+
|
|
1870
|
+
<optional><br>
|
|
1871
|
+
|
|
1872
|
+
|
|
1873
|
+
|
|
1874
|
+
|
|
1875
|
+
|
|
1876
|
+
</td>
|
|
1877
|
+
|
|
1878
|
+
|
|
1879
|
+
|
|
1880
|
+
<td class="default">
|
|
1881
|
+
|
|
1882
|
+
</td>
|
|
1883
|
+
|
|
1884
|
+
|
|
1885
|
+
<td class="description last"><p>輸入是否接受REST文字類轉接器回報之截斷內容(交parse+check裁決)布林值,預設為「有給自訂parse且非rawText」(自訂parse即搶救策略之同意訊號,見salvageTruncatedArray.mjs),其餘情況截斷一律判失敗換家</p></td>
|
|
1886
|
+
</tr>
|
|
1887
|
+
|
|
1888
|
+
|
|
1889
|
+
|
|
1852
1890
|
<tr>
|
|
1853
1891
|
|
|
1854
1892
|
<td class="name"><code>promptPrefix</code></td>
|
|
@@ -2044,7 +2082,7 @@ await test()
|
|
|
2044
2082
|
</td>
|
|
2045
2083
|
|
|
2046
2084
|
|
|
2047
|
-
<td class="description last"><p>輸入同家重試次數非負整數,預設0(
|
|
2085
|
+
<td class="description last"><p>輸入同家重試次數非負整數,預設0(韌性交給遞補;端點不穩偶發空回之模型可調高令同鍵重試;截斷不重試)</p></td>
|
|
2048
2086
|
</tr>
|
|
2049
2087
|
|
|
2050
2088
|
|
|
@@ -2235,7 +2273,7 @@ await test()
|
|
|
2235
2273
|
|
|
2236
2274
|
|
|
2237
2275
|
<div class="param-desc">
|
|
2238
|
-
<p>回傳Promise,resolve回傳結果物件,內含ok(是否取得可用結果布林值)、json(解析後物件,rawText模式下為文字)、providerId(實際使用之名稱)、keyIndex、keyId、ms(總耗時毫秒)、tried(遞補嘗試歷程陣列)、usage(api類之token用量原樣透傳,CLI類為null)、error(錯誤訊息字串)、errorType(僅失敗時,機器可讀錯誤類別字串,一覽見getErrorType.mjs檔頭),本函數不會reject</p>
|
|
2276
|
+
<p>回傳Promise,resolve回傳結果物件,內含ok(是否取得可用結果布林值)、json(解析後物件,rawText模式下為文字)、providerId(實際使用之名稱)、keyIndex、keyId、ms(總耗時毫秒)、tried(遞補嘗試歷程陣列)、usage(api類之token用量原樣透傳,CLI類為null)、finishReason(REST文字類之正規化終止原因字串,CLI類為'')、truncated(是否為截斷內容布林值,接受搶救時ok亦可能為true)、error(錯誤訊息字串)、errorType(僅失敗時,機器可讀錯誤類別字串,一覽見getErrorType.mjs檔頭),本函數不會reject</p>
|
|
2239
2277
|
</div>
|
|
2240
2278
|
|
|
2241
2279
|
|
|
@@ -2262,7 +2300,7 @@ await test()
|
|
|
2262
2300
|
|
|
2263
2301
|
|
|
2264
2302
|
|
|
2265
|
-
<h4 class="name" id="callOnce"><span class="type-signature type-signature-async">(async) </span>callOnce<span class="signature">(url, headers, body, timeoutMs, validator)</span><span class="type-signature"> → {Promise}</span></h4>
|
|
2303
|
+
<h4 class="name" id="callOnce"><span class="type-signature type-signature-async">(async) </span>callOnce<span class="signature">(url, headers, body, timeoutMs, validator, acceptTruncated)</span><span class="type-signature"> → {Promise}</span></h4>
|
|
2266
2304
|
|
|
2267
2305
|
|
|
2268
2306
|
|
|
@@ -2278,7 +2316,7 @@ await test()
|
|
|
2278
2316
|
|
|
2279
2317
|
<dt class="tag-source">Source:</dt>
|
|
2280
2318
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
2281
|
-
<a href="dispatchApiOpenaiCompat.mjs.html">dispatchApiOpenaiCompat.mjs</a>, <a href="dispatchApiOpenaiCompat.mjs.html#
|
|
2319
|
+
<a href="dispatchApiOpenaiCompat.mjs.html">dispatchApiOpenaiCompat.mjs</a>, <a href="dispatchApiOpenaiCompat.mjs.html#line94">line 94</a>
|
|
2282
2320
|
</li></ul></dd>
|
|
2283
2321
|
|
|
2284
2322
|
|
|
@@ -2470,6 +2508,30 @@ await test()
|
|
|
2470
2508
|
</tr>
|
|
2471
2509
|
|
|
2472
2510
|
|
|
2511
|
+
|
|
2512
|
+
<tr>
|
|
2513
|
+
|
|
2514
|
+
<td class="name"><code>acceptTruncated</code></td>
|
|
2515
|
+
|
|
2516
|
+
|
|
2517
|
+
<td class="type">
|
|
2518
|
+
|
|
2519
|
+
|
|
2520
|
+
<span class="param-type">Boolean</span>
|
|
2521
|
+
|
|
2522
|
+
|
|
2523
|
+
|
|
2524
|
+
|
|
2525
|
+
</td>
|
|
2526
|
+
|
|
2527
|
+
|
|
2528
|
+
|
|
2529
|
+
|
|
2530
|
+
|
|
2531
|
+
<td class="description last"><p>輸入是否明示接受截斷內容</p></td>
|
|
2532
|
+
</tr>
|
|
2533
|
+
|
|
2534
|
+
|
|
2473
2535
|
</tbody>
|
|
2474
2536
|
</table>
|
|
2475
2537
|
|
|
@@ -2519,7 +2581,7 @@ await test()
|
|
|
2519
2581
|
|
|
2520
2582
|
|
|
2521
2583
|
|
|
2522
|
-
<h4 class="name" id="callOnce"><span class="type-signature type-signature-async">(async) </span>callOnce<span class="signature">(url, headers, body, timeoutMs, validator)</span><span class="type-signature"> → {Promise}</span></h4>
|
|
2584
|
+
<h4 class="name" id="callOnce"><span class="type-signature type-signature-async">(async) </span>callOnce<span class="signature">(url, headers, body, timeoutMs, validator, acceptTruncated)</span><span class="type-signature"> → {Promise}</span></h4>
|
|
2523
2585
|
|
|
2524
2586
|
|
|
2525
2587
|
|
|
@@ -2535,7 +2597,7 @@ await test()
|
|
|
2535
2597
|
|
|
2536
2598
|
<dt class="tag-source">Source:</dt>
|
|
2537
2599
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
2538
|
-
<a href="dispatchApiOpenaiResponses.mjs.html">dispatchApiOpenaiResponses.mjs</a>, <a href="dispatchApiOpenaiResponses.mjs.html#
|
|
2600
|
+
<a href="dispatchApiOpenaiResponses.mjs.html">dispatchApiOpenaiResponses.mjs</a>, <a href="dispatchApiOpenaiResponses.mjs.html#line129">line 129</a>
|
|
2539
2601
|
</li></ul></dd>
|
|
2540
2602
|
|
|
2541
2603
|
|
|
@@ -2727,6 +2789,30 @@ await test()
|
|
|
2727
2789
|
</tr>
|
|
2728
2790
|
|
|
2729
2791
|
|
|
2792
|
+
|
|
2793
|
+
<tr>
|
|
2794
|
+
|
|
2795
|
+
<td class="name"><code>acceptTruncated</code></td>
|
|
2796
|
+
|
|
2797
|
+
|
|
2798
|
+
<td class="type">
|
|
2799
|
+
|
|
2800
|
+
|
|
2801
|
+
<span class="param-type">Boolean</span>
|
|
2802
|
+
|
|
2803
|
+
|
|
2804
|
+
|
|
2805
|
+
|
|
2806
|
+
</td>
|
|
2807
|
+
|
|
2808
|
+
|
|
2809
|
+
|
|
2810
|
+
|
|
2811
|
+
|
|
2812
|
+
<td class="description last"><p>輸入是否明示接受截斷內容</p></td>
|
|
2813
|
+
</tr>
|
|
2814
|
+
|
|
2815
|
+
|
|
2730
2816
|
</tbody>
|
|
2731
2817
|
</table>
|
|
2732
2818
|
|
|
@@ -2792,7 +2878,7 @@ await test()
|
|
|
2792
2878
|
|
|
2793
2879
|
<dt class="tag-source">Source:</dt>
|
|
2794
2880
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
2795
|
-
<a href="dispatchApiTypesafeSystemone.mjs.html">dispatchApiTypesafeSystemone.mjs</a>, <a href="dispatchApiTypesafeSystemone.mjs.html#
|
|
2881
|
+
<a href="dispatchApiTypesafeSystemone.mjs.html">dispatchApiTypesafeSystemone.mjs</a>, <a href="dispatchApiTypesafeSystemone.mjs.html#line82">line 82</a>
|
|
2796
2882
|
</li></ul></dd>
|
|
2797
2883
|
|
|
2798
2884
|
|
|
@@ -4480,7 +4566,7 @@ let usage = createUsageCounter({ dir: './state' })
|
|
|
4480
4566
|
|
|
4481
4567
|
<dt class="tag-source">Source:</dt>
|
|
4482
4568
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
4483
|
-
<a href="wkf_runFanout.mjs.html">wkf/runFanout.mjs</a>, <a href="wkf_runFanout.mjs.html#
|
|
4569
|
+
<a href="wkf_runFanout.mjs.html">wkf/runFanout.mjs</a>, <a href="wkf_runFanout.mjs.html#line33">line 33</a>
|
|
4484
4570
|
</li></ul></dd>
|
|
4485
4571
|
|
|
4486
4572
|
|
|
@@ -5133,7 +5219,7 @@ await test()
|
|
|
5133
5219
|
providers陣列順序即優先序,排前面的先用;
|
|
5134
5220
|
條目本身即該次調用之opt(除id與keys外原樣透傳對應轉接器),與dispatchAi「條目直接當opt」同一約定;
|
|
5135
5221
|
條目給予keys(多把金鑰)時以游標輪替,某把失敗自動換下一把,全數失敗才遞補下一組;
|
|
5136
|
-
與金鑰無關之失敗(逾時/執行檔不存在/參數錯誤/輸出未過驗證/未知kind)直接整組跳過,不逐把空耗;
|
|
5222
|
+
與金鑰無關之失敗(逾時/執行檔不存在/參數錯誤/輸出未過驗證/未知kind/截斷/工具不支援)直接整組跳過,不逐把空耗;
|
|
5137
5223
|
跨次執行僅記憶游標(經store注入持久化),不設金鑰停用清單——額度視窗形態多樣(5小時滾動/逐時/逐日),
|
|
5138
5224
|
停用會把已恢復的金鑰閒置,而重探的代價僅一次快速失敗;
|
|
5139
5225
|
本函數不會reject,一律以結果物件之ok與error欄位回報成敗</p></li></ul></dd>
|
|
@@ -5142,7 +5228,7 @@ providers陣列順序即優先序,排前面的先用;
|
|
|
5142
5228
|
|
|
5143
5229
|
<dt class="tag-source">Source:</dt>
|
|
5144
5230
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
5145
|
-
<a href="dispatchAiFallback.mjs.html">dispatchAiFallback.mjs</a>, <a href="dispatchAiFallback.mjs.html#
|
|
5231
|
+
<a href="dispatchAiFallback.mjs.html">dispatchAiFallback.mjs</a>, <a href="dispatchAiFallback.mjs.html#line316">line 316</a>
|
|
5146
5232
|
</li></ul></dd>
|
|
5147
5233
|
|
|
5148
5234
|
|
|
@@ -6007,7 +6093,7 @@ await test()
|
|
|
6007
6093
|
|
|
6008
6094
|
|
|
6009
6095
|
<div class="param-desc">
|
|
6010
|
-
<p>回傳Promise,resolve回傳結果物件,除execCli既有欄位(ok、stdout、stderr、code、error、durationMs、attempts、pid)外,追加providerId(實際使用之群組)、keyIndex(實際使用之金鑰索引,無keys時為null)、kind、model、tried(全部嘗試歷程陣列,成功時亦回傳;失敗項含errorType、stdout與stderr供診斷被拒原因);失敗結果帶機器可讀之errorType(一覽見getErrorType.mjs檔頭);api類轉接器提供usage(token用量)時原樣流出於結果與tried各項,CLI
|
|
6096
|
+
<p>回傳Promise,resolve回傳結果物件,除execCli既有欄位(ok、stdout、stderr、code、error、durationMs、attempts、pid)外,追加providerId(實際使用之群組)、keyIndex(實際使用之金鑰索引,無keys時為null)、kind、model、tried(全部嘗試歷程陣列,成功時亦回傳;失敗項含errorType、stdout與stderr供診斷被拒原因);失敗結果帶機器可讀之errorType(一覽見getErrorType.mjs檔頭);api類轉接器提供usage(token用量)時原樣流出於結果與tried各項,CLI類無此欄;REST文字類轉接器另帶finishReason與truncated(是否截斷),同樣流出於結果與tried各項;本函數不會reject</p>
|
|
6011
6097
|
</div>
|
|
6012
6098
|
|
|
6013
6099
|
|
|
@@ -7096,7 +7182,7 @@ prompt走HTTP body,無命令列長度限制;
|
|
|
7096
7182
|
|
|
7097
7183
|
<dt class="tag-source">Source:</dt>
|
|
7098
7184
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
7099
|
-
<a href="dispatchApiOpenaiCompat.mjs.html">dispatchApiOpenaiCompat.mjs</a>, <a href="dispatchApiOpenaiCompat.mjs.html#
|
|
7185
|
+
<a href="dispatchApiOpenaiCompat.mjs.html">dispatchApiOpenaiCompat.mjs</a>, <a href="dispatchApiOpenaiCompat.mjs.html#line322">line 322</a>
|
|
7100
7186
|
</li></ul></dd>
|
|
7101
7187
|
|
|
7102
7188
|
|
|
@@ -7535,7 +7621,7 @@ await test()
|
|
|
7535
7621
|
</td>
|
|
7536
7622
|
|
|
7537
7623
|
|
|
7538
|
-
<td class="description last"><p
|
|
7624
|
+
<td class="description last"><p>輸入額外請求標頭物件,同名鍵覆寫預設標頭;預設標頭含'Accept-Encoding: identity'(防伺服器壓縮卻漏標Content-Encoding,見檔頭),要改回允許壓縮可給{'Accept-Encoding':'gzip, deflate, br'},預設{}</p></td>
|
|
7539
7625
|
</tr>
|
|
7540
7626
|
|
|
7541
7627
|
|
|
@@ -7616,7 +7702,47 @@ await test()
|
|
|
7616
7702
|
</td>
|
|
7617
7703
|
|
|
7618
7704
|
|
|
7619
|
-
<td class="description last"><p>輸入回覆內容驗證規則字串或自訂驗證函數,規則字串支援'nonempty'、'json'、'min:100'
|
|
7705
|
+
<td class="description last"><p>輸入回覆內容驗證規則字串或自訂驗證函數,規則字串支援'nonempty'、'json'、'min:100',多規則可用逗號串接,自訂函數拋錯視同驗證失敗,預設undefined代表不驗證</p></td>
|
|
7706
|
+
</tr>
|
|
7707
|
+
|
|
7708
|
+
|
|
7709
|
+
|
|
7710
|
+
<tr>
|
|
7711
|
+
|
|
7712
|
+
<td class="name"><code>acceptTruncated</code></td>
|
|
7713
|
+
|
|
7714
|
+
|
|
7715
|
+
<td class="type">
|
|
7716
|
+
|
|
7717
|
+
|
|
7718
|
+
<span class="param-type">Boolean</span>
|
|
7719
|
+
|
|
7720
|
+
|
|
7721
|
+
|
|
7722
|
+
|
|
7723
|
+
</td>
|
|
7724
|
+
|
|
7725
|
+
|
|
7726
|
+
<td class="attributes">
|
|
7727
|
+
|
|
7728
|
+
<optional><br>
|
|
7729
|
+
|
|
7730
|
+
|
|
7731
|
+
|
|
7732
|
+
|
|
7733
|
+
|
|
7734
|
+
</td>
|
|
7735
|
+
|
|
7736
|
+
|
|
7737
|
+
|
|
7738
|
+
<td class="default">
|
|
7739
|
+
|
|
7740
|
+
<code>false</code>
|
|
7741
|
+
|
|
7742
|
+
</td>
|
|
7743
|
+
|
|
7744
|
+
|
|
7745
|
+
<td class="description last"><p>輸入是否接受被截斷(finish_reason為length)之內容布林值,true代表交validate裁決(無validate則直接接受)且結果標truncated:true;content_filter與可見輸出為空者一律失敗,預設false代表截斷一律失敗(errorType incomplete)</p></td>
|
|
7620
7746
|
</tr>
|
|
7621
7747
|
|
|
7622
7748
|
|
|
@@ -7656,7 +7782,7 @@ await test()
|
|
|
7656
7782
|
</td>
|
|
7657
7783
|
|
|
7658
7784
|
|
|
7659
|
-
<td class="description last"><p>輸入失敗後最大重試次數非負整數,4xx(429除外)
|
|
7785
|
+
<td class="description last"><p>輸入失敗後最大重試次數非負整數,4xx(429除外)與截斷不重試,預設0</p></td>
|
|
7660
7786
|
</tr>
|
|
7661
7787
|
|
|
7662
7788
|
|
|
@@ -7729,7 +7855,7 @@ await test()
|
|
|
7729
7855
|
|
|
7730
7856
|
|
|
7731
7857
|
<div class="param-desc">
|
|
7732
|
-
<p>回傳Promise,resolve回傳結果物件,內含ok(是否成功布林值)、stdout(回覆內容字串)、stderr(失敗時之原始回應本體)、code(HTTP狀態碼,網路錯誤與逾時為null)、error(錯誤訊息字串,成功時為空字串)、errorType(僅失敗時,機器可讀錯誤類別字串,一覽見getErrorType.mjs檔頭)、durationMs(耗時毫秒)、attempts(實際嘗試次數)、usage(原始回應之token用量物件原樣透傳,無則null),本函數不會reject</p>
|
|
7858
|
+
<p>回傳Promise,resolve回傳結果物件,內含ok(是否成功布林值)、stdout(回覆內容字串)、stderr(失敗時之原始回應本體)、code(HTTP狀態碼,網路錯誤與逾時為null)、error(錯誤訊息字串,成功時為空字串)、errorType(僅失敗時,機器可讀錯誤類別字串,一覽見getErrorType.mjs檔頭)、durationMs(耗時毫秒)、attempts(實際嘗試次數)、usage(原始回應之token用量物件原樣透傳,無則null)、finishReason(已取得回應時之正規化終止原因字串,缺值為'')、truncated(已取得回應時是否被截斷布林值),本函數不會reject</p>
|
|
7733
7859
|
</div>
|
|
7734
7860
|
|
|
7735
7861
|
|
|
@@ -7780,7 +7906,7 @@ status非completed(如max_output_tokens耗盡)一律以INCOMPLETE_RESPONSE回報
|
|
|
7780
7906
|
|
|
7781
7907
|
<dt class="tag-source">Source:</dt>
|
|
7782
7908
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
7783
|
-
<a href="dispatchApiOpenaiResponses.mjs.html">dispatchApiOpenaiResponses.mjs</a>, <a href="dispatchApiOpenaiResponses.mjs.html#
|
|
7909
|
+
<a href="dispatchApiOpenaiResponses.mjs.html">dispatchApiOpenaiResponses.mjs</a>, <a href="dispatchApiOpenaiResponses.mjs.html#line391">line 391</a>
|
|
7784
7910
|
</li></ul></dd>
|
|
7785
7911
|
|
|
7786
7912
|
|
|
@@ -8208,7 +8334,7 @@ await test()
|
|
|
8208
8334
|
</td>
|
|
8209
8335
|
|
|
8210
8336
|
|
|
8211
|
-
<td class="description last"><p
|
|
8337
|
+
<td class="description last"><p>輸入額外請求標頭物件,同名鍵覆寫預設標頭;預設標頭含'Accept-Encoding: identity'(防伺服器壓縮卻漏標Content-Encoding,見檔頭),預設{}</p></td>
|
|
8212
8338
|
</tr>
|
|
8213
8339
|
|
|
8214
8340
|
|
|
@@ -8289,7 +8415,47 @@ await test()
|
|
|
8289
8415
|
</td>
|
|
8290
8416
|
|
|
8291
8417
|
|
|
8292
|
-
<td class="description last"><p>輸入回覆內容驗證規則字串或自訂驗證函數,規則字串支援'nonempty'、'json'、'min:100'
|
|
8418
|
+
<td class="description last"><p>輸入回覆內容驗證規則字串或自訂驗證函數,規則字串支援'nonempty'、'json'、'min:100',多規則可用逗號串接,自訂函數拋錯視同驗證失敗,預設undefined代表不驗證</p></td>
|
|
8419
|
+
</tr>
|
|
8420
|
+
|
|
8421
|
+
|
|
8422
|
+
|
|
8423
|
+
<tr>
|
|
8424
|
+
|
|
8425
|
+
<td class="name"><code>acceptTruncated</code></td>
|
|
8426
|
+
|
|
8427
|
+
|
|
8428
|
+
<td class="type">
|
|
8429
|
+
|
|
8430
|
+
|
|
8431
|
+
<span class="param-type">Boolean</span>
|
|
8432
|
+
|
|
8433
|
+
|
|
8434
|
+
|
|
8435
|
+
|
|
8436
|
+
</td>
|
|
8437
|
+
|
|
8438
|
+
|
|
8439
|
+
<td class="attributes">
|
|
8440
|
+
|
|
8441
|
+
<optional><br>
|
|
8442
|
+
|
|
8443
|
+
|
|
8444
|
+
|
|
8445
|
+
|
|
8446
|
+
|
|
8447
|
+
</td>
|
|
8448
|
+
|
|
8449
|
+
|
|
8450
|
+
|
|
8451
|
+
<td class="default">
|
|
8452
|
+
|
|
8453
|
+
<code>false</code>
|
|
8454
|
+
|
|
8455
|
+
</td>
|
|
8456
|
+
|
|
8457
|
+
|
|
8458
|
+
<td class="description last"><p>輸入是否接受被截斷(status為incomplete且reason為max_output_tokens)之內容布林值,true代表交validate裁決(無validate則直接接受)且結果標truncated:true;content_filter與可見輸出為空者一律失敗,預設false代表截斷一律失敗</p></td>
|
|
8293
8459
|
</tr>
|
|
8294
8460
|
|
|
8295
8461
|
|
|
@@ -8329,7 +8495,7 @@ await test()
|
|
|
8329
8495
|
</td>
|
|
8330
8496
|
|
|
8331
8497
|
|
|
8332
|
-
<td class="description last"><p>輸入失敗後最大重試次數非負整數,4xx(429除外)
|
|
8498
|
+
<td class="description last"><p>輸入失敗後最大重試次數非負整數,4xx(429除外)與截斷不重試,預設0</p></td>
|
|
8333
8499
|
</tr>
|
|
8334
8500
|
|
|
8335
8501
|
|
|
@@ -8402,7 +8568,7 @@ await test()
|
|
|
8402
8568
|
|
|
8403
8569
|
|
|
8404
8570
|
<div class="param-desc">
|
|
8405
|
-
<p>回傳Promise,resolve回傳結果物件,內含ok(是否成功布林值)、stdout(回覆內容字串)、stderr(失敗時之原始回應本體)、code(HTTP狀態碼,網路錯誤與逾時為null)、error(錯誤訊息字串,成功時為空字串)、errorType(僅失敗時,機器可讀錯誤類別字串,一覽見getErrorType.mjs檔頭)、durationMs(耗時毫秒)、attempts(實際嘗試次數)、usage(原始回應之token用量物件原樣透傳,欄位名為input_tokens/output_tokens/total_tokens,無則null),本函數不會reject</p>
|
|
8571
|
+
<p>回傳Promise,resolve回傳結果物件,內含ok(是否成功布林值)、stdout(回覆內容字串)、stderr(失敗時之原始回應本體)、code(HTTP狀態碼,網路錯誤與逾時為null)、error(錯誤訊息字串,成功時為空字串)、errorType(僅失敗時,機器可讀錯誤類別字串,一覽見getErrorType.mjs檔頭)、durationMs(耗時毫秒)、attempts(實際嘗試次數)、usage(原始回應之token用量物件原樣透傳,欄位名為input_tokens/output_tokens/total_tokens,無則null)、finishReason(已取得回應時之正規化終止原因字串,completed為'stop'、max_output_tokens為'length')、truncated(已取得回應時是否被截斷布林值,僅status為incomplete時為true),本函數不會reject</p>
|
|
8406
8572
|
</div>
|
|
8407
8573
|
|
|
8408
8574
|
|
|
@@ -8453,7 +8619,7 @@ stdout為answers之JSON字串,另於結果追加answers(已解析物件)與mod
|
|
|
8453
8619
|
|
|
8454
8620
|
<dt class="tag-source">Source:</dt>
|
|
8455
8621
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
8456
|
-
<a href="dispatchApiTypesafeSystemone.mjs.html">dispatchApiTypesafeSystemone.mjs</a>, <a href="dispatchApiTypesafeSystemone.mjs.html#
|
|
8622
|
+
<a href="dispatchApiTypesafeSystemone.mjs.html">dispatchApiTypesafeSystemone.mjs</a>, <a href="dispatchApiTypesafeSystemone.mjs.html#line278">line 278</a>
|
|
8457
8623
|
</li></ul></dd>
|
|
8458
8624
|
|
|
8459
8625
|
|
|
@@ -8894,7 +9060,7 @@ await test()
|
|
|
8894
9060
|
</td>
|
|
8895
9061
|
|
|
8896
9062
|
|
|
8897
|
-
<td class="description last"><p
|
|
9063
|
+
<td class="description last"><p>輸入額外請求標頭物件,同名鍵覆寫預設標頭;預設標頭含'Accept-Encoding: identity'(防伺服器壓縮卻漏標Content-Encoding,見檔頭),預設{}</p></td>
|
|
8898
9064
|
</tr>
|
|
8899
9065
|
|
|
8900
9066
|
|
|
@@ -8975,7 +9141,7 @@ await test()
|
|
|
8975
9141
|
</td>
|
|
8976
9142
|
|
|
8977
9143
|
|
|
8978
|
-
<td class="description last"><p>輸入stdout(answers之JSON字串)驗證規則字串或自訂驗證函數,規則字串支援'nonempty'、'json'、'min:100'
|
|
9144
|
+
<td class="description last"><p>輸入stdout(answers之JSON字串)驗證規則字串或自訂驗證函數,規則字串支援'nonempty'、'json'、'min:100',多規則可用逗號串接,自訂函數拋錯視同驗證失敗,預設undefined代表不驗證</p></td>
|
|
8979
9145
|
</tr>
|
|
8980
9146
|
|
|
8981
9147
|
|
|
@@ -11330,7 +11496,7 @@ console.log(extractJsonLoose('純文字回覆'))
|
|
|
11330
11496
|
|
|
11331
11497
|
<dt class="tag-source">Source:</dt>
|
|
11332
11498
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
11333
|
-
<a href="dispatchApiOpenaiResponses.mjs.html">dispatchApiOpenaiResponses.mjs</a>, <a href="dispatchApiOpenaiResponses.mjs.html#
|
|
11499
|
+
<a href="dispatchApiOpenaiResponses.mjs.html">dispatchApiOpenaiResponses.mjs</a>, <a href="dispatchApiOpenaiResponses.mjs.html#line94">line 94</a>
|
|
11334
11500
|
</li></ul></dd>
|
|
11335
11501
|
|
|
11336
11502
|
|
|
@@ -11989,7 +12155,7 @@ test()</code></pre>
|
|
|
11989
12155
|
|
|
11990
12156
|
|
|
11991
12157
|
|
|
11992
|
-
<h4 class="name" id="
|
|
12158
|
+
<h4 class="name" id="finOf"><span class="type-signature"></span>finOf<span class="signature">(r)</span><span class="type-signature"> → {Object}</span></h4>
|
|
11993
12159
|
|
|
11994
12160
|
|
|
11995
12161
|
|
|
@@ -11999,13 +12165,13 @@ test()</code></pre>
|
|
|
11999
12165
|
<dl class="details">
|
|
12000
12166
|
|
|
12001
12167
|
<dt class="tag-description">Description:</dt>
|
|
12002
|
-
<dd class="tag-description"><ul class="dummy"><li><p
|
|
12168
|
+
<dd class="tag-description"><ul class="dummy"><li><p>取結果之截斷資訊供tried各項記錄(REST文字類轉接器才帶, 其餘kind回空物件)</p></li></ul></dd>
|
|
12003
12169
|
|
|
12004
12170
|
|
|
12005
12171
|
|
|
12006
12172
|
<dt class="tag-source">Source:</dt>
|
|
12007
12173
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
12008
|
-
<a href="
|
|
12174
|
+
<a href="dispatchAiFallback.mjs.html">dispatchAiFallback.mjs</a>, <a href="dispatchAiFallback.mjs.html#line187">line 187</a>
|
|
12009
12175
|
</li></ul></dd>
|
|
12010
12176
|
|
|
12011
12177
|
|
|
@@ -12077,7 +12243,7 @@ test()</code></pre>
|
|
|
12077
12243
|
|
|
12078
12244
|
<tr>
|
|
12079
12245
|
|
|
12080
|
-
<td class="name"><code>
|
|
12246
|
+
<td class="name"><code>r</code></td>
|
|
12081
12247
|
|
|
12082
12248
|
|
|
12083
12249
|
<td class="type">
|
|
@@ -12094,31 +12260,7 @@ test()</code></pre>
|
|
|
12094
12260
|
|
|
12095
12261
|
|
|
12096
12262
|
|
|
12097
|
-
<td class="description last"><p
|
|
12098
|
-
</tr>
|
|
12099
|
-
|
|
12100
|
-
|
|
12101
|
-
|
|
12102
|
-
<tr>
|
|
12103
|
-
|
|
12104
|
-
<td class="name"><code>keys</code></td>
|
|
12105
|
-
|
|
12106
|
-
|
|
12107
|
-
<td class="type">
|
|
12108
|
-
|
|
12109
|
-
|
|
12110
|
-
<span class="param-type">Array</span>
|
|
12111
|
-
|
|
12112
|
-
|
|
12113
|
-
|
|
12114
|
-
|
|
12115
|
-
</td>
|
|
12116
|
-
|
|
12117
|
-
|
|
12118
|
-
|
|
12119
|
-
|
|
12120
|
-
|
|
12121
|
-
<td class="description last"><p>輸入鍵陣列</p></td>
|
|
12263
|
+
<td class="description last"><p>輸入dispatchAi結果物件</p></td>
|
|
12122
12264
|
</tr>
|
|
12123
12265
|
|
|
12124
12266
|
|
|
@@ -12144,7 +12286,7 @@ test()</code></pre>
|
|
|
12144
12286
|
|
|
12145
12287
|
|
|
12146
12288
|
<div class="param-desc">
|
|
12147
|
-
<p
|
|
12289
|
+
<p>回傳物件,含truncated與finishReason,或空物件</p>
|
|
12148
12290
|
</div>
|
|
12149
12291
|
|
|
12150
12292
|
|
|
@@ -12155,7 +12297,7 @@ test()</code></pre>
|
|
|
12155
12297
|
</dt>
|
|
12156
12298
|
<dd>
|
|
12157
12299
|
|
|
12158
|
-
<span class="param-type">
|
|
12300
|
+
<span class="param-type">Object</span>
|
|
12159
12301
|
|
|
12160
12302
|
|
|
12161
12303
|
|
|
@@ -12171,7 +12313,7 @@ test()</code></pre>
|
|
|
12171
12313
|
|
|
12172
12314
|
|
|
12173
12315
|
|
|
12174
|
-
<h4 class="name" id="
|
|
12316
|
+
<h4 class="name" id="firstStr"><span class="type-signature"></span>firstStr<span class="signature">(o, keys)</span><span class="type-signature"> → {String}</span></h4>
|
|
12175
12317
|
|
|
12176
12318
|
|
|
12177
12319
|
|
|
@@ -12181,13 +12323,13 @@ test()</code></pre>
|
|
|
12181
12323
|
<dl class="details">
|
|
12182
12324
|
|
|
12183
12325
|
<dt class="tag-description">Description:</dt>
|
|
12184
|
-
<dd class="tag-description"><ul class="dummy"><li><p
|
|
12326
|
+
<dd class="tag-description"><ul class="dummy"><li><p>取第一個為非空字串之鍵值</p></li></ul></dd>
|
|
12185
12327
|
|
|
12186
12328
|
|
|
12187
12329
|
|
|
12188
12330
|
<dt class="tag-source">Source:</dt>
|
|
12189
12331
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
12190
|
-
<a href="
|
|
12332
|
+
<a href="quota_fromCodexUsageHttp.mjs.html">quota/fromCodexUsageHttp.mjs</a>, <a href="quota_fromCodexUsageHttp.mjs.html#line36">line 36</a>
|
|
12191
12333
|
</li></ul></dd>
|
|
12192
12334
|
|
|
12193
12335
|
|
|
@@ -12259,7 +12401,7 @@ test()</code></pre>
|
|
|
12259
12401
|
|
|
12260
12402
|
<tr>
|
|
12261
12403
|
|
|
12262
|
-
<td class="name"><code>
|
|
12404
|
+
<td class="name"><code>o</code></td>
|
|
12263
12405
|
|
|
12264
12406
|
|
|
12265
12407
|
<td class="type">
|
|
@@ -12276,20 +12418,20 @@ test()</code></pre>
|
|
|
12276
12418
|
|
|
12277
12419
|
|
|
12278
12420
|
|
|
12279
|
-
<td class="description last"><p
|
|
12421
|
+
<td class="description last"><p>輸入物件</p></td>
|
|
12280
12422
|
</tr>
|
|
12281
12423
|
|
|
12282
12424
|
|
|
12283
12425
|
|
|
12284
12426
|
<tr>
|
|
12285
12427
|
|
|
12286
|
-
<td class="name"><code>
|
|
12428
|
+
<td class="name"><code>keys</code></td>
|
|
12287
12429
|
|
|
12288
12430
|
|
|
12289
12431
|
<td class="type">
|
|
12290
12432
|
|
|
12291
12433
|
|
|
12292
|
-
<span class="param-type">
|
|
12434
|
+
<span class="param-type">Array</span>
|
|
12293
12435
|
|
|
12294
12436
|
|
|
12295
12437
|
|
|
@@ -12300,7 +12442,7 @@ test()</code></pre>
|
|
|
12300
12442
|
|
|
12301
12443
|
|
|
12302
12444
|
|
|
12303
|
-
<td class="description last"><p
|
|
12445
|
+
<td class="description last"><p>輸入鍵陣列</p></td>
|
|
12304
12446
|
</tr>
|
|
12305
12447
|
|
|
12306
12448
|
|
|
@@ -12326,7 +12468,7 @@ test()</code></pre>
|
|
|
12326
12468
|
|
|
12327
12469
|
|
|
12328
12470
|
<div class="param-desc">
|
|
12329
|
-
<p
|
|
12471
|
+
<p>回傳字串, 皆無回傳''</p>
|
|
12330
12472
|
</div>
|
|
12331
12473
|
|
|
12332
12474
|
|
|
@@ -12337,10 +12479,7 @@ test()</code></pre>
|
|
|
12337
12479
|
</dt>
|
|
12338
12480
|
<dd>
|
|
12339
12481
|
|
|
12340
|
-
<span class="param-type">
|
|
12341
|
-
|
|
|
12342
|
-
|
|
12343
|
-
<span class="param-type">null</span>
|
|
12482
|
+
<span class="param-type">String</span>
|
|
12344
12483
|
|
|
12345
12484
|
|
|
12346
12485
|
|
|
@@ -12356,7 +12495,7 @@ test()</code></pre>
|
|
|
12356
12495
|
|
|
12357
12496
|
|
|
12358
12497
|
|
|
12359
|
-
<h4 class="name" id="
|
|
12498
|
+
<h4 class="name" id="fromBucket"><span class="type-signature"></span>fromBucket<span class="signature">(g, b)</span><span class="type-signature"> → {Object|null}</span></h4>
|
|
12360
12499
|
|
|
12361
12500
|
|
|
12362
12501
|
|
|
@@ -12366,16 +12505,13 @@ test()</code></pre>
|
|
|
12366
12505
|
<dl class="details">
|
|
12367
12506
|
|
|
12368
12507
|
<dt class="tag-description">Description:</dt>
|
|
12369
|
-
<dd class="tag-description"><ul class="dummy"><li><p
|
|
12370
|
-
<p>主窗口(rate_limit.primary_window / secondary_window)、程式碼審查限額(code_review_rate_limit)、
|
|
12371
|
-
以及寬容解析之additional_rate_limits皆納入windows;額外限額之窗口鍵為「<識別>:primary|secondary」,
|
|
12372
|
-
scope為其顯示名或識別。任何欄位缺漏皆略過該窗口而不拋錯</p></li></ul></dd>
|
|
12508
|
+
<dd class="tag-description"><ul class="dummy"><li><p>將群組內之單一桶正規化為統一窗口物件</p></li></ul></dd>
|
|
12373
12509
|
|
|
12374
12510
|
|
|
12375
12511
|
|
|
12376
12512
|
<dt class="tag-source">Source:</dt>
|
|
12377
12513
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
12378
|
-
<a href="
|
|
12514
|
+
<a href="quota_getQuotaAntigravity.mjs.html">quota/getQuotaAntigravity.mjs</a>, <a href="quota_getQuotaAntigravity.mjs.html#line99">line 99</a>
|
|
12379
12515
|
</li></ul></dd>
|
|
12380
12516
|
|
|
12381
12517
|
|
|
@@ -12420,20 +12556,6 @@ scope為其顯示名或識別。任何欄位缺漏皆略過該窗口而不拋錯
|
|
|
12420
12556
|
|
|
12421
12557
|
|
|
12422
12558
|
|
|
12423
|
-
<h5 class="h5-examples">Example</h5>
|
|
12424
|
-
|
|
12425
|
-
<pre class="prettyprint"><code>import fromCodexUsageHttp from './src/quota/fromCodexUsageHttp.mjs'
|
|
12426
|
-
|
|
12427
|
-
let m = fromCodexUsageHttp({
|
|
12428
|
-
email: 'a@b.c',
|
|
12429
|
-
plan_type: 'plus',
|
|
12430
|
-
rate_limit: { primary_window: { used_percent: 42, limit_window_seconds: 18000, reset_after_seconds: 100 } },
|
|
12431
|
-
additional_rate_limits: [{ limit_name: 'codex-spark', primary_window: { used_percent: 12, limit_window_seconds: 18000 } }],
|
|
12432
|
-
})
|
|
12433
|
-
console.log(m.windows.map((w) => `${w.key}=${w.label}`))
|
|
12434
|
-
// => [ 'primary=5小時', 'codex-spark:primary=5小時(codex-spark)' ]</code></pre>
|
|
12435
|
-
|
|
12436
|
-
|
|
12437
12559
|
|
|
12438
12560
|
|
|
12439
12561
|
<h5 class="h5-parameters">Parameters:</h5>
|
|
@@ -12461,7 +12583,7 @@ console.log(m.windows.map((w) => `${w.key}=${w.label}`))
|
|
|
12461
12583
|
|
|
12462
12584
|
<tr>
|
|
12463
12585
|
|
|
12464
|
-
<td class="name"><code>
|
|
12586
|
+
<td class="name"><code>g</code></td>
|
|
12465
12587
|
|
|
12466
12588
|
|
|
12467
12589
|
<td class="type">
|
|
@@ -12478,13 +12600,215 @@ console.log(m.windows.map((w) => `${w.key}=${w.label}`))
|
|
|
12478
12600
|
|
|
12479
12601
|
|
|
12480
12602
|
|
|
12481
|
-
<td class="description last"><p
|
|
12603
|
+
<td class="description last"><p>輸入群組物件</p></td>
|
|
12482
12604
|
</tr>
|
|
12483
12605
|
|
|
12484
12606
|
|
|
12485
|
-
|
|
12486
|
-
|
|
12487
|
-
|
|
12607
|
+
|
|
12608
|
+
<tr>
|
|
12609
|
+
|
|
12610
|
+
<td class="name"><code>b</code></td>
|
|
12611
|
+
|
|
12612
|
+
|
|
12613
|
+
<td class="type">
|
|
12614
|
+
|
|
12615
|
+
|
|
12616
|
+
<span class="param-type">Object</span>
|
|
12617
|
+
|
|
12618
|
+
|
|
12619
|
+
|
|
12620
|
+
|
|
12621
|
+
</td>
|
|
12622
|
+
|
|
12623
|
+
|
|
12624
|
+
|
|
12625
|
+
|
|
12626
|
+
|
|
12627
|
+
<td class="description last"><p>輸入桶物件</p></td>
|
|
12628
|
+
</tr>
|
|
12629
|
+
|
|
12630
|
+
|
|
12631
|
+
</tbody>
|
|
12632
|
+
</table>
|
|
12633
|
+
|
|
12634
|
+
|
|
12635
|
+
|
|
12636
|
+
|
|
12637
|
+
|
|
12638
|
+
|
|
12639
|
+
|
|
12640
|
+
|
|
12641
|
+
|
|
12642
|
+
|
|
12643
|
+
|
|
12644
|
+
|
|
12645
|
+
|
|
12646
|
+
|
|
12647
|
+
|
|
12648
|
+
|
|
12649
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
12650
|
+
|
|
12651
|
+
|
|
12652
|
+
<div class="param-desc">
|
|
12653
|
+
<p>回傳統一窗口物件, 桶無id或無剩餘比例回傳null</p>
|
|
12654
|
+
</div>
|
|
12655
|
+
|
|
12656
|
+
|
|
12657
|
+
|
|
12658
|
+
<dl class="param-type">
|
|
12659
|
+
<dt>
|
|
12660
|
+
Type
|
|
12661
|
+
</dt>
|
|
12662
|
+
<dd>
|
|
12663
|
+
|
|
12664
|
+
<span class="param-type">Object</span>
|
|
12665
|
+
|
|
|
12666
|
+
|
|
12667
|
+
<span class="param-type">null</span>
|
|
12668
|
+
|
|
12669
|
+
|
|
12670
|
+
|
|
12671
|
+
</dd>
|
|
12672
|
+
</dl>
|
|
12673
|
+
|
|
12674
|
+
|
|
12675
|
+
|
|
12676
|
+
|
|
12677
|
+
|
|
12678
|
+
|
|
12679
|
+
|
|
12680
|
+
|
|
12681
|
+
|
|
12682
|
+
|
|
12683
|
+
<h4 class="name" id="fromCodexUsageHttp"><span class="type-signature"></span>fromCodexUsageHttp<span class="signature">(data)</span><span class="type-signature"> → {Object}</span></h4>
|
|
12684
|
+
|
|
12685
|
+
|
|
12686
|
+
|
|
12687
|
+
|
|
12688
|
+
|
|
12689
|
+
|
|
12690
|
+
<dl class="details">
|
|
12691
|
+
|
|
12692
|
+
<dt class="tag-description">Description:</dt>
|
|
12693
|
+
<dd class="tag-description"><ul class="dummy"><li><p>將chatgpt.com之/wham/usage回應對映為統一結構</p>
|
|
12694
|
+
<p>主窗口(rate_limit.primary_window / secondary_window)、程式碼審查限額(code_review_rate_limit)、
|
|
12695
|
+
以及寬容解析之additional_rate_limits皆納入windows;額外限額之窗口鍵為「<識別>:primary|secondary」,
|
|
12696
|
+
scope為其顯示名或識別。任何欄位缺漏皆略過該窗口而不拋錯</p></li></ul></dd>
|
|
12697
|
+
|
|
12698
|
+
|
|
12699
|
+
|
|
12700
|
+
<dt class="tag-source">Source:</dt>
|
|
12701
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
12702
|
+
<a href="quota_fromCodexUsageHttp.mjs.html">quota/fromCodexUsageHttp.mjs</a>, <a href="quota_fromCodexUsageHttp.mjs.html#line176">line 176</a>
|
|
12703
|
+
</li></ul></dd>
|
|
12704
|
+
|
|
12705
|
+
|
|
12706
|
+
|
|
12707
|
+
|
|
12708
|
+
|
|
12709
|
+
|
|
12710
|
+
|
|
12711
|
+
|
|
12712
|
+
|
|
12713
|
+
|
|
12714
|
+
|
|
12715
|
+
|
|
12716
|
+
|
|
12717
|
+
|
|
12718
|
+
|
|
12719
|
+
|
|
12720
|
+
|
|
12721
|
+
|
|
12722
|
+
|
|
12723
|
+
|
|
12724
|
+
|
|
12725
|
+
|
|
12726
|
+
|
|
12727
|
+
|
|
12728
|
+
|
|
12729
|
+
|
|
12730
|
+
|
|
12731
|
+
|
|
12732
|
+
|
|
12733
|
+
|
|
12734
|
+
|
|
12735
|
+
</dl>
|
|
12736
|
+
|
|
12737
|
+
|
|
12738
|
+
|
|
12739
|
+
|
|
12740
|
+
|
|
12741
|
+
|
|
12742
|
+
|
|
12743
|
+
|
|
12744
|
+
|
|
12745
|
+
|
|
12746
|
+
|
|
12747
|
+
<h5 class="h5-examples">Example</h5>
|
|
12748
|
+
|
|
12749
|
+
<pre class="prettyprint"><code>import fromCodexUsageHttp from './src/quota/fromCodexUsageHttp.mjs'
|
|
12750
|
+
|
|
12751
|
+
let m = fromCodexUsageHttp({
|
|
12752
|
+
email: 'a@b.c',
|
|
12753
|
+
plan_type: 'plus',
|
|
12754
|
+
rate_limit: { primary_window: { used_percent: 42, limit_window_seconds: 18000, reset_after_seconds: 100 } },
|
|
12755
|
+
additional_rate_limits: [{ limit_name: 'codex-spark', primary_window: { used_percent: 12, limit_window_seconds: 18000 } }],
|
|
12756
|
+
})
|
|
12757
|
+
console.log(m.windows.map((w) => `${w.key}=${w.label}`))
|
|
12758
|
+
// => [ 'primary=5小時', 'codex-spark:primary=5小時(codex-spark)' ]</code></pre>
|
|
12759
|
+
|
|
12760
|
+
|
|
12761
|
+
|
|
12762
|
+
|
|
12763
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
12764
|
+
|
|
12765
|
+
|
|
12766
|
+
<table class="params">
|
|
12767
|
+
<thead>
|
|
12768
|
+
<tr>
|
|
12769
|
+
|
|
12770
|
+
<th>Name</th>
|
|
12771
|
+
|
|
12772
|
+
|
|
12773
|
+
<th>Type</th>
|
|
12774
|
+
|
|
12775
|
+
|
|
12776
|
+
|
|
12777
|
+
|
|
12778
|
+
|
|
12779
|
+
<th class="last">Description</th>
|
|
12780
|
+
</tr>
|
|
12781
|
+
</thead>
|
|
12782
|
+
|
|
12783
|
+
<tbody>
|
|
12784
|
+
|
|
12785
|
+
|
|
12786
|
+
<tr>
|
|
12787
|
+
|
|
12788
|
+
<td class="name"><code>data</code></td>
|
|
12789
|
+
|
|
12790
|
+
|
|
12791
|
+
<td class="type">
|
|
12792
|
+
|
|
12793
|
+
|
|
12794
|
+
<span class="param-type">Object</span>
|
|
12795
|
+
|
|
12796
|
+
|
|
12797
|
+
|
|
12798
|
+
|
|
12799
|
+
</td>
|
|
12800
|
+
|
|
12801
|
+
|
|
12802
|
+
|
|
12803
|
+
|
|
12804
|
+
|
|
12805
|
+
<td class="description last"><p>輸入/wham/usage之回應物件</p></td>
|
|
12806
|
+
</tr>
|
|
12807
|
+
|
|
12808
|
+
|
|
12809
|
+
</tbody>
|
|
12810
|
+
</table>
|
|
12811
|
+
|
|
12488
12812
|
|
|
12489
12813
|
|
|
12490
12814
|
|
|
@@ -13776,7 +14100,7 @@ console.log(getErrorResult(null).error)
|
|
|
13776
14100
|
|
|
13777
14101
|
<dt class="tag-source">Source:</dt>
|
|
13778
14102
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
13779
|
-
<a href="getErrorType.mjs.html">getErrorType.mjs</a>, <a href="getErrorType.mjs.html#
|
|
14103
|
+
<a href="getErrorType.mjs.html">getErrorType.mjs</a>, <a href="getErrorType.mjs.html#line58">line 58</a>
|
|
13780
14104
|
</li></ul></dd>
|
|
13781
14105
|
|
|
13782
14106
|
|
|
@@ -15648,7 +15972,7 @@ codex不存在或RPC失敗時退回直打chatgpt.com之用量端點。
|
|
|
15648
15972
|
|
|
15649
15973
|
<dt class="tag-source">Source:</dt>
|
|
15650
15974
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
15651
|
-
<a href="dispatchAiFallback.mjs.html">dispatchAiFallback.mjs</a>, <a href="dispatchAiFallback.mjs.html#
|
|
15975
|
+
<a href="dispatchAiFallback.mjs.html">dispatchAiFallback.mjs</a>, <a href="dispatchAiFallback.mjs.html#line114">line 114</a>
|
|
15652
15976
|
</li></ul></dd>
|
|
15653
15977
|
|
|
15654
15978
|
|
|
@@ -15806,7 +16130,7 @@ codex不存在或RPC失敗時退回直打chatgpt.com之用量端點。
|
|
|
15806
16130
|
|
|
15807
16131
|
<dt class="tag-source">Source:</dt>
|
|
15808
16132
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
15809
|
-
<a href="dispatchAiFallback.mjs.html">dispatchAiFallback.mjs</a>, <a href="dispatchAiFallback.mjs.html#
|
|
16133
|
+
<a href="dispatchAiFallback.mjs.html">dispatchAiFallback.mjs</a>, <a href="dispatchAiFallback.mjs.html#line198">line 198</a>
|
|
15810
16134
|
</li></ul></dd>
|
|
15811
16135
|
|
|
15812
16136
|
|
|
@@ -15948,7 +16272,7 @@ codex不存在或RPC失敗時退回直打chatgpt.com之用量端點。
|
|
|
15948
16272
|
|
|
15949
16273
|
|
|
15950
16274
|
|
|
15951
|
-
<h4 class="name" id="
|
|
16275
|
+
<h4 class="name" id="judgeTruncated"><span class="type-signature"></span>judgeTruncated<span class="signature">(o)</span><span class="type-signature"> → {Object}</span></h4>
|
|
15952
16276
|
|
|
15953
16277
|
|
|
15954
16278
|
|
|
@@ -15958,13 +16282,13 @@ codex不存在或RPC失敗時退回直打chatgpt.com之用量端點。
|
|
|
15958
16282
|
<dl class="details">
|
|
15959
16283
|
|
|
15960
16284
|
<dt class="tag-description">Description:</dt>
|
|
15961
|
-
<dd class="tag-description"><ul class="dummy"><li><p
|
|
16285
|
+
<dd class="tag-description"><ul class="dummy"><li><p>裁定一次已截斷之回應應失敗或放行(呼叫端先判定truncated為true才呼叫)</p></li></ul></dd>
|
|
15962
16286
|
|
|
15963
16287
|
|
|
15964
16288
|
|
|
15965
16289
|
<dt class="tag-source">Source:</dt>
|
|
15966
16290
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
15967
|
-
<a href="
|
|
16291
|
+
<a href="checkTruncation.mjs.html">checkTruncation.mjs</a>, <a href="checkTruncation.mjs.html#line96">line 96</a>
|
|
15968
16292
|
</li></ul></dd>
|
|
15969
16293
|
|
|
15970
16294
|
|
|
@@ -16009,6 +16333,17 @@ codex不存在或RPC失敗時退回直打chatgpt.com之用量端點。
|
|
|
16009
16333
|
|
|
16010
16334
|
|
|
16011
16335
|
|
|
16336
|
+
<h5 class="h5-examples">Example</h5>
|
|
16337
|
+
|
|
16338
|
+
<pre class="prettyprint"><code>import { judgeTruncated } from './src/checkTruncation.mjs'
|
|
16339
|
+
|
|
16340
|
+
console.log(judgeTruncated({ finishReason: 'length', content: '', reasoningTokens: 600, label: 'finish_reason=length' }).error)
|
|
16341
|
+
// => 'INCOMPLETE_RESPONSE: finish_reason=length; no visible output (reasoning may have used up the output token limit, reasoning_tokens=600)'
|
|
16342
|
+
|
|
16343
|
+
console.log(judgeTruncated({ finishReason: 'length', content: '[{"a":1},', acceptTruncated: true, label: 'finish_reason=length' }).accept)
|
|
16344
|
+
// => true</code></pre>
|
|
16345
|
+
|
|
16346
|
+
|
|
16012
16347
|
|
|
16013
16348
|
|
|
16014
16349
|
<h5 class="h5-parameters">Parameters:</h5>
|
|
@@ -16036,7 +16371,7 @@ codex不存在或RPC失敗時退回直打chatgpt.com之用量端點。
|
|
|
16036
16371
|
|
|
16037
16372
|
<tr>
|
|
16038
16373
|
|
|
16039
|
-
<td class="name"><code>
|
|
16374
|
+
<td class="name"><code>o</code></td>
|
|
16040
16375
|
|
|
16041
16376
|
|
|
16042
16377
|
<td class="type">
|
|
@@ -16053,14 +16388,37 @@ codex不存在或RPC失敗時退回直打chatgpt.com之用量端點。
|
|
|
16053
16388
|
|
|
16054
16389
|
|
|
16055
16390
|
|
|
16056
|
-
<td class="description last"><p
|
|
16057
|
-
|
|
16391
|
+
<td class="description last"><p>輸入設定物件</p>
|
|
16392
|
+
<h6>Properties</h6>
|
|
16393
|
+
|
|
16394
|
+
|
|
16395
|
+
<table class="params">
|
|
16396
|
+
<thead>
|
|
16397
|
+
<tr>
|
|
16398
|
+
|
|
16399
|
+
<th>Name</th>
|
|
16400
|
+
|
|
16401
|
+
|
|
16402
|
+
<th>Type</th>
|
|
16403
|
+
|
|
16404
|
+
|
|
16405
|
+
<th>Attributes</th>
|
|
16406
|
+
|
|
16407
|
+
|
|
16408
|
+
|
|
16409
|
+
<th>Default</th>
|
|
16410
|
+
|
|
16411
|
+
|
|
16412
|
+
<th class="last">Description</th>
|
|
16413
|
+
</tr>
|
|
16414
|
+
</thead>
|
|
16058
16415
|
|
|
16416
|
+
<tbody>
|
|
16059
16417
|
|
|
16060
16418
|
|
|
16061
16419
|
<tr>
|
|
16062
16420
|
|
|
16063
|
-
<td class="name"><code>
|
|
16421
|
+
<td class="name"><code>finishReason</code></td>
|
|
16064
16422
|
|
|
16065
16423
|
|
|
16066
16424
|
<td class="type">
|
|
@@ -16074,23 +16432,38 @@ codex不存在或RPC失敗時退回直打chatgpt.com之用量端點。
|
|
|
16074
16432
|
</td>
|
|
16075
16433
|
|
|
16076
16434
|
|
|
16435
|
+
<td class="attributes">
|
|
16436
|
+
|
|
16437
|
+
|
|
16438
|
+
|
|
16077
16439
|
|
|
16440
|
+
|
|
16441
|
+
</td>
|
|
16078
16442
|
|
|
16079
16443
|
|
|
16080
|
-
|
|
16444
|
+
|
|
16445
|
+
<td class="default">
|
|
16446
|
+
|
|
16447
|
+
</td>
|
|
16448
|
+
|
|
16449
|
+
|
|
16450
|
+
<td class="description last"><p>輸入正規化後之終止原因字串,'length'才可能放行</p></td>
|
|
16081
16451
|
</tr>
|
|
16082
16452
|
|
|
16083
16453
|
|
|
16084
16454
|
|
|
16085
16455
|
<tr>
|
|
16086
16456
|
|
|
16087
|
-
<td class="name"><code>
|
|
16457
|
+
<td class="name"><code>content</code></td>
|
|
16088
16458
|
|
|
16089
16459
|
|
|
16090
16460
|
<td class="type">
|
|
16091
16461
|
|
|
16092
16462
|
|
|
16093
16463
|
<span class="param-type">String</span>
|
|
16464
|
+
|
|
|
16465
|
+
|
|
16466
|
+
<span class="param-type">null</span>
|
|
16094
16467
|
|
|
16095
16468
|
|
|
16096
16469
|
|
|
@@ -16098,10 +16471,563 @@ codex不存在或RPC失敗時退回直打chatgpt.com之用量端點。
|
|
|
16098
16471
|
</td>
|
|
16099
16472
|
|
|
16100
16473
|
|
|
16474
|
+
<td class="attributes">
|
|
16475
|
+
|
|
16476
|
+
|
|
16477
|
+
|
|
16101
16478
|
|
|
16479
|
+
|
|
16480
|
+
</td>
|
|
16102
16481
|
|
|
16103
16482
|
|
|
16104
|
-
|
|
16483
|
+
|
|
16484
|
+
<td class="default">
|
|
16485
|
+
|
|
16486
|
+
</td>
|
|
16487
|
+
|
|
16488
|
+
|
|
16489
|
+
<td class="description last"><p>輸入可見輸出文字,null代表無</p></td>
|
|
16490
|
+
</tr>
|
|
16491
|
+
|
|
16492
|
+
|
|
16493
|
+
|
|
16494
|
+
<tr>
|
|
16495
|
+
|
|
16496
|
+
<td class="name"><code>acceptTruncated</code></td>
|
|
16497
|
+
|
|
16498
|
+
|
|
16499
|
+
<td class="type">
|
|
16500
|
+
|
|
16501
|
+
|
|
16502
|
+
<span class="param-type">Boolean</span>
|
|
16503
|
+
|
|
16504
|
+
|
|
16505
|
+
|
|
16506
|
+
|
|
16507
|
+
</td>
|
|
16508
|
+
|
|
16509
|
+
|
|
16510
|
+
<td class="attributes">
|
|
16511
|
+
|
|
16512
|
+
<optional><br>
|
|
16513
|
+
|
|
16514
|
+
|
|
16515
|
+
|
|
16516
|
+
|
|
16517
|
+
|
|
16518
|
+
</td>
|
|
16519
|
+
|
|
16520
|
+
|
|
16521
|
+
|
|
16522
|
+
<td class="default">
|
|
16523
|
+
|
|
16524
|
+
<code>false</code>
|
|
16525
|
+
|
|
16526
|
+
</td>
|
|
16527
|
+
|
|
16528
|
+
|
|
16529
|
+
<td class="description last"><p>輸入呼叫端是否明示接受截斷內容布林值</p></td>
|
|
16530
|
+
</tr>
|
|
16531
|
+
|
|
16532
|
+
|
|
16533
|
+
|
|
16534
|
+
<tr>
|
|
16535
|
+
|
|
16536
|
+
<td class="name"><code>validator</code></td>
|
|
16537
|
+
|
|
16538
|
+
|
|
16539
|
+
<td class="type">
|
|
16540
|
+
|
|
16541
|
+
|
|
16542
|
+
<span class="param-type">function</span>
|
|
16543
|
+
|
|
|
16544
|
+
|
|
16545
|
+
<span class="param-type">null</span>
|
|
16546
|
+
|
|
16547
|
+
|
|
16548
|
+
|
|
16549
|
+
|
|
16550
|
+
</td>
|
|
16551
|
+
|
|
16552
|
+
|
|
16553
|
+
<td class="attributes">
|
|
16554
|
+
|
|
16555
|
+
<optional><br>
|
|
16556
|
+
|
|
16557
|
+
|
|
16558
|
+
|
|
16559
|
+
|
|
16560
|
+
|
|
16561
|
+
</td>
|
|
16562
|
+
|
|
16563
|
+
|
|
16564
|
+
|
|
16565
|
+
<td class="default">
|
|
16566
|
+
|
|
16567
|
+
<code>null</code>
|
|
16568
|
+
|
|
16569
|
+
</td>
|
|
16570
|
+
|
|
16571
|
+
|
|
16572
|
+
<td class="description last"><p>輸入驗證函式,放行時交其裁決</p></td>
|
|
16573
|
+
</tr>
|
|
16574
|
+
|
|
16575
|
+
|
|
16576
|
+
|
|
16577
|
+
<tr>
|
|
16578
|
+
|
|
16579
|
+
<td class="name"><code>reasoningTokens</code></td>
|
|
16580
|
+
|
|
16581
|
+
|
|
16582
|
+
<td class="type">
|
|
16583
|
+
|
|
16584
|
+
|
|
16585
|
+
<span class="param-type">Number</span>
|
|
16586
|
+
|
|
|
16587
|
+
|
|
16588
|
+
<span class="param-type">null</span>
|
|
16589
|
+
|
|
16590
|
+
|
|
16591
|
+
|
|
16592
|
+
|
|
16593
|
+
</td>
|
|
16594
|
+
|
|
16595
|
+
|
|
16596
|
+
<td class="attributes">
|
|
16597
|
+
|
|
16598
|
+
<optional><br>
|
|
16599
|
+
|
|
16600
|
+
|
|
16601
|
+
|
|
16602
|
+
|
|
16603
|
+
|
|
16604
|
+
</td>
|
|
16605
|
+
|
|
16606
|
+
|
|
16607
|
+
|
|
16608
|
+
<td class="default">
|
|
16609
|
+
|
|
16610
|
+
<code>null</code>
|
|
16611
|
+
|
|
16612
|
+
</td>
|
|
16613
|
+
|
|
16614
|
+
|
|
16615
|
+
<td class="description last"><p>輸入推理token數,可見輸出為空時附於訊息</p></td>
|
|
16616
|
+
</tr>
|
|
16617
|
+
|
|
16618
|
+
|
|
16619
|
+
|
|
16620
|
+
<tr>
|
|
16621
|
+
|
|
16622
|
+
<td class="name"><code>label</code></td>
|
|
16623
|
+
|
|
16624
|
+
|
|
16625
|
+
<td class="type">
|
|
16626
|
+
|
|
16627
|
+
|
|
16628
|
+
<span class="param-type">String</span>
|
|
16629
|
+
|
|
16630
|
+
|
|
16631
|
+
|
|
16632
|
+
|
|
16633
|
+
</td>
|
|
16634
|
+
|
|
16635
|
+
|
|
16636
|
+
<td class="attributes">
|
|
16637
|
+
|
|
16638
|
+
|
|
16639
|
+
|
|
16640
|
+
|
|
16641
|
+
|
|
16642
|
+
</td>
|
|
16643
|
+
|
|
16644
|
+
|
|
16645
|
+
|
|
16646
|
+
<td class="default">
|
|
16647
|
+
|
|
16648
|
+
</td>
|
|
16649
|
+
|
|
16650
|
+
|
|
16651
|
+
<td class="description last"><p>輸入錯誤訊息主體字串,例如'finish_reason=length'或'status=incomplete (max_output_tokens)'</p></td>
|
|
16652
|
+
</tr>
|
|
16653
|
+
|
|
16654
|
+
|
|
16655
|
+
</tbody>
|
|
16656
|
+
</table>
|
|
16657
|
+
|
|
16658
|
+
</td>
|
|
16659
|
+
</tr>
|
|
16660
|
+
|
|
16661
|
+
|
|
16662
|
+
</tbody>
|
|
16663
|
+
</table>
|
|
16664
|
+
|
|
16665
|
+
|
|
16666
|
+
|
|
16667
|
+
|
|
16668
|
+
|
|
16669
|
+
|
|
16670
|
+
|
|
16671
|
+
|
|
16672
|
+
|
|
16673
|
+
|
|
16674
|
+
|
|
16675
|
+
|
|
16676
|
+
|
|
16677
|
+
|
|
16678
|
+
|
|
16679
|
+
|
|
16680
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
16681
|
+
|
|
16682
|
+
|
|
16683
|
+
<div class="param-desc">
|
|
16684
|
+
<p>回傳物件,內含accept(是否放行布林值)、error(不放行時之錯誤訊息字串)、threw(validate拋錯訊息字串)</p>
|
|
16685
|
+
</div>
|
|
16686
|
+
|
|
16687
|
+
|
|
16688
|
+
|
|
16689
|
+
<dl class="param-type">
|
|
16690
|
+
<dt>
|
|
16691
|
+
Type
|
|
16692
|
+
</dt>
|
|
16693
|
+
<dd>
|
|
16694
|
+
|
|
16695
|
+
<span class="param-type">Object</span>
|
|
16696
|
+
|
|
16697
|
+
|
|
16698
|
+
|
|
16699
|
+
</dd>
|
|
16700
|
+
</dl>
|
|
16701
|
+
|
|
16702
|
+
|
|
16703
|
+
|
|
16704
|
+
|
|
16705
|
+
|
|
16706
|
+
|
|
16707
|
+
|
|
16708
|
+
|
|
16709
|
+
|
|
16710
|
+
|
|
16711
|
+
<h4 class="name" id="normalizeFinishReason"><span class="type-signature"></span>normalizeFinishReason<span class="signature">(v)</span><span class="type-signature"> → {String}</span></h4>
|
|
16712
|
+
|
|
16713
|
+
|
|
16714
|
+
|
|
16715
|
+
|
|
16716
|
+
|
|
16717
|
+
|
|
16718
|
+
<dl class="details">
|
|
16719
|
+
|
|
16720
|
+
<dt class="tag-description">Description:</dt>
|
|
16721
|
+
<dd class="tag-description"><ul class="dummy"><li><p>正規化終止原因字串(去頭尾空白、轉小寫;非字串回傳空字串)</p></li></ul></dd>
|
|
16722
|
+
|
|
16723
|
+
|
|
16724
|
+
|
|
16725
|
+
<dt class="tag-source">Source:</dt>
|
|
16726
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
16727
|
+
<a href="checkTruncation.mjs.html">checkTruncation.mjs</a>, <a href="checkTruncation.mjs.html#line41">line 41</a>
|
|
16728
|
+
</li></ul></dd>
|
|
16729
|
+
|
|
16730
|
+
|
|
16731
|
+
|
|
16732
|
+
|
|
16733
|
+
|
|
16734
|
+
|
|
16735
|
+
|
|
16736
|
+
|
|
16737
|
+
|
|
16738
|
+
|
|
16739
|
+
|
|
16740
|
+
|
|
16741
|
+
|
|
16742
|
+
|
|
16743
|
+
|
|
16744
|
+
|
|
16745
|
+
|
|
16746
|
+
|
|
16747
|
+
|
|
16748
|
+
|
|
16749
|
+
|
|
16750
|
+
|
|
16751
|
+
|
|
16752
|
+
|
|
16753
|
+
|
|
16754
|
+
|
|
16755
|
+
|
|
16756
|
+
|
|
16757
|
+
|
|
16758
|
+
|
|
16759
|
+
|
|
16760
|
+
</dl>
|
|
16761
|
+
|
|
16762
|
+
|
|
16763
|
+
|
|
16764
|
+
|
|
16765
|
+
|
|
16766
|
+
|
|
16767
|
+
|
|
16768
|
+
|
|
16769
|
+
|
|
16770
|
+
|
|
16771
|
+
|
|
16772
|
+
<h5 class="h5-examples">Example</h5>
|
|
16773
|
+
|
|
16774
|
+
<pre class="prettyprint"><code>import { normalizeFinishReason } from './src/checkTruncation.mjs'
|
|
16775
|
+
|
|
16776
|
+
console.log(normalizeFinishReason(' LENGTH '), normalizeFinishReason(null))
|
|
16777
|
+
// => 'length' ''</code></pre>
|
|
16778
|
+
|
|
16779
|
+
|
|
16780
|
+
|
|
16781
|
+
|
|
16782
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
16783
|
+
|
|
16784
|
+
|
|
16785
|
+
<table class="params">
|
|
16786
|
+
<thead>
|
|
16787
|
+
<tr>
|
|
16788
|
+
|
|
16789
|
+
<th>Name</th>
|
|
16790
|
+
|
|
16791
|
+
|
|
16792
|
+
<th>Type</th>
|
|
16793
|
+
|
|
16794
|
+
|
|
16795
|
+
|
|
16796
|
+
|
|
16797
|
+
|
|
16798
|
+
<th class="last">Description</th>
|
|
16799
|
+
</tr>
|
|
16800
|
+
</thead>
|
|
16801
|
+
|
|
16802
|
+
<tbody>
|
|
16803
|
+
|
|
16804
|
+
|
|
16805
|
+
<tr>
|
|
16806
|
+
|
|
16807
|
+
<td class="name"><code>v</code></td>
|
|
16808
|
+
|
|
16809
|
+
|
|
16810
|
+
<td class="type">
|
|
16811
|
+
|
|
16812
|
+
|
|
16813
|
+
<span class="param-type">*</span>
|
|
16814
|
+
|
|
16815
|
+
|
|
16816
|
+
|
|
16817
|
+
|
|
16818
|
+
</td>
|
|
16819
|
+
|
|
16820
|
+
|
|
16821
|
+
|
|
16822
|
+
|
|
16823
|
+
|
|
16824
|
+
<td class="description last"><p>輸入原始終止原因</p></td>
|
|
16825
|
+
</tr>
|
|
16826
|
+
|
|
16827
|
+
|
|
16828
|
+
</tbody>
|
|
16829
|
+
</table>
|
|
16830
|
+
|
|
16831
|
+
|
|
16832
|
+
|
|
16833
|
+
|
|
16834
|
+
|
|
16835
|
+
|
|
16836
|
+
|
|
16837
|
+
|
|
16838
|
+
|
|
16839
|
+
|
|
16840
|
+
|
|
16841
|
+
|
|
16842
|
+
|
|
16843
|
+
|
|
16844
|
+
|
|
16845
|
+
|
|
16846
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
16847
|
+
|
|
16848
|
+
|
|
16849
|
+
<div class="param-desc">
|
|
16850
|
+
<p>回傳正規化字串</p>
|
|
16851
|
+
</div>
|
|
16852
|
+
|
|
16853
|
+
|
|
16854
|
+
|
|
16855
|
+
<dl class="param-type">
|
|
16856
|
+
<dt>
|
|
16857
|
+
Type
|
|
16858
|
+
</dt>
|
|
16859
|
+
<dd>
|
|
16860
|
+
|
|
16861
|
+
<span class="param-type">String</span>
|
|
16862
|
+
|
|
16863
|
+
|
|
16864
|
+
|
|
16865
|
+
</dd>
|
|
16866
|
+
</dl>
|
|
16867
|
+
|
|
16868
|
+
|
|
16869
|
+
|
|
16870
|
+
|
|
16871
|
+
|
|
16872
|
+
|
|
16873
|
+
|
|
16874
|
+
|
|
16875
|
+
|
|
16876
|
+
|
|
16877
|
+
<h4 class="name" id="pickWindow"><span class="type-signature"></span>pickWindow<span class="signature">(it, snake, camel)</span><span class="type-signature"> → {Object|null}</span></h4>
|
|
16878
|
+
|
|
16879
|
+
|
|
16880
|
+
|
|
16881
|
+
|
|
16882
|
+
|
|
16883
|
+
|
|
16884
|
+
<dl class="details">
|
|
16885
|
+
|
|
16886
|
+
<dt class="tag-description">Description:</dt>
|
|
16887
|
+
<dd class="tag-description"><ul class="dummy"><li><p>自單筆取出指定窗口(頂層、rate_limit、rateLimit之下, snake或camel)</p></li></ul></dd>
|
|
16888
|
+
|
|
16889
|
+
|
|
16890
|
+
|
|
16891
|
+
<dt class="tag-source">Source:</dt>
|
|
16892
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
16893
|
+
<a href="quota_fromCodexUsageHttp.mjs.html">quota/fromCodexUsageHttp.mjs</a>, <a href="quota_fromCodexUsageHttp.mjs.html#line111">line 111</a>
|
|
16894
|
+
</li></ul></dd>
|
|
16895
|
+
|
|
16896
|
+
|
|
16897
|
+
|
|
16898
|
+
|
|
16899
|
+
|
|
16900
|
+
|
|
16901
|
+
|
|
16902
|
+
|
|
16903
|
+
|
|
16904
|
+
|
|
16905
|
+
|
|
16906
|
+
|
|
16907
|
+
|
|
16908
|
+
|
|
16909
|
+
|
|
16910
|
+
|
|
16911
|
+
|
|
16912
|
+
|
|
16913
|
+
|
|
16914
|
+
|
|
16915
|
+
|
|
16916
|
+
|
|
16917
|
+
|
|
16918
|
+
|
|
16919
|
+
|
|
16920
|
+
|
|
16921
|
+
|
|
16922
|
+
|
|
16923
|
+
|
|
16924
|
+
|
|
16925
|
+
|
|
16926
|
+
</dl>
|
|
16927
|
+
|
|
16928
|
+
|
|
16929
|
+
|
|
16930
|
+
|
|
16931
|
+
|
|
16932
|
+
|
|
16933
|
+
|
|
16934
|
+
|
|
16935
|
+
|
|
16936
|
+
|
|
16937
|
+
|
|
16938
|
+
|
|
16939
|
+
|
|
16940
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
16941
|
+
|
|
16942
|
+
|
|
16943
|
+
<table class="params">
|
|
16944
|
+
<thead>
|
|
16945
|
+
<tr>
|
|
16946
|
+
|
|
16947
|
+
<th>Name</th>
|
|
16948
|
+
|
|
16949
|
+
|
|
16950
|
+
<th>Type</th>
|
|
16951
|
+
|
|
16952
|
+
|
|
16953
|
+
|
|
16954
|
+
|
|
16955
|
+
|
|
16956
|
+
<th class="last">Description</th>
|
|
16957
|
+
</tr>
|
|
16958
|
+
</thead>
|
|
16959
|
+
|
|
16960
|
+
<tbody>
|
|
16961
|
+
|
|
16962
|
+
|
|
16963
|
+
<tr>
|
|
16964
|
+
|
|
16965
|
+
<td class="name"><code>it</code></td>
|
|
16966
|
+
|
|
16967
|
+
|
|
16968
|
+
<td class="type">
|
|
16969
|
+
|
|
16970
|
+
|
|
16971
|
+
<span class="param-type">Object</span>
|
|
16972
|
+
|
|
16973
|
+
|
|
16974
|
+
|
|
16975
|
+
|
|
16976
|
+
</td>
|
|
16977
|
+
|
|
16978
|
+
|
|
16979
|
+
|
|
16980
|
+
|
|
16981
|
+
|
|
16982
|
+
<td class="description last"><p>輸入單筆物件</p></td>
|
|
16983
|
+
</tr>
|
|
16984
|
+
|
|
16985
|
+
|
|
16986
|
+
|
|
16987
|
+
<tr>
|
|
16988
|
+
|
|
16989
|
+
<td class="name"><code>snake</code></td>
|
|
16990
|
+
|
|
16991
|
+
|
|
16992
|
+
<td class="type">
|
|
16993
|
+
|
|
16994
|
+
|
|
16995
|
+
<span class="param-type">String</span>
|
|
16996
|
+
|
|
16997
|
+
|
|
16998
|
+
|
|
16999
|
+
|
|
17000
|
+
</td>
|
|
17001
|
+
|
|
17002
|
+
|
|
17003
|
+
|
|
17004
|
+
|
|
17005
|
+
|
|
17006
|
+
<td class="description last"><p>輸入snake鍵, 例如'primary_window'</p></td>
|
|
17007
|
+
</tr>
|
|
17008
|
+
|
|
17009
|
+
|
|
17010
|
+
|
|
17011
|
+
<tr>
|
|
17012
|
+
|
|
17013
|
+
<td class="name"><code>camel</code></td>
|
|
17014
|
+
|
|
17015
|
+
|
|
17016
|
+
<td class="type">
|
|
17017
|
+
|
|
17018
|
+
|
|
17019
|
+
<span class="param-type">String</span>
|
|
17020
|
+
|
|
17021
|
+
|
|
17022
|
+
|
|
17023
|
+
|
|
17024
|
+
</td>
|
|
17025
|
+
|
|
17026
|
+
|
|
17027
|
+
|
|
17028
|
+
|
|
17029
|
+
|
|
17030
|
+
<td class="description last"><p>輸入camel鍵, 例如'primaryWindow'</p></td>
|
|
16105
17031
|
</tr>
|
|
16106
17032
|
|
|
16107
17033
|
|
|
@@ -16883,7 +17809,7 @@ console.log(readJsonOrNull('./no-such-file.json'))
|
|
|
16883
17809
|
|
|
16884
17810
|
<dt class="tag-source">Source:</dt>
|
|
16885
17811
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
16886
|
-
<a href="dispatchAiFallback.mjs.html">dispatchAiFallback.mjs</a>, <a href="dispatchAiFallback.mjs.html#
|
|
17812
|
+
<a href="dispatchAiFallback.mjs.html">dispatchAiFallback.mjs</a>, <a href="dispatchAiFallback.mjs.html#line155">line 155</a>
|
|
16887
17813
|
</li></ul></dd>
|
|
16888
17814
|
|
|
16889
17815
|
|
|
@@ -17536,7 +18462,7 @@ providers與table同源產出故必然一致;
|
|
|
17536
18462
|
|
|
17537
18463
|
<dt class="tag-source">Source:</dt>
|
|
17538
18464
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
17539
|
-
<a href="wkf_runFanout.mjs.html">wkf/runFanout.mjs</a>, <a href="wkf_runFanout.mjs.html#
|
|
18465
|
+
<a href="wkf_runFanout.mjs.html">wkf/runFanout.mjs</a>, <a href="wkf_runFanout.mjs.html#line94">line 94</a>
|
|
17540
18466
|
</li></ul></dd>
|
|
17541
18467
|
|
|
17542
18468
|
|
|
@@ -19046,6 +19972,199 @@ await test()
|
|
|
19046
19972
|
|
|
19047
19973
|
|
|
19048
19974
|
|
|
19975
|
+
<h4 class="name" id="safeValidate"><span class="type-signature"></span>safeValidate<span class="signature">(validator, text)</span><span class="type-signature"> → {Object}</span></h4>
|
|
19976
|
+
|
|
19977
|
+
|
|
19978
|
+
|
|
19979
|
+
|
|
19980
|
+
|
|
19981
|
+
|
|
19982
|
+
<dl class="details">
|
|
19983
|
+
|
|
19984
|
+
<dt class="tag-description">Description:</dt>
|
|
19985
|
+
<dd class="tag-description"><ul class="dummy"><li><p>以不拋錯方式執行驗證函式(拋錯視同拒絕)</p></li></ul></dd>
|
|
19986
|
+
|
|
19987
|
+
|
|
19988
|
+
|
|
19989
|
+
<dt class="tag-source">Source:</dt>
|
|
19990
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
19991
|
+
<a href="checkTruncation.mjs.html">checkTruncation.mjs</a>, <a href="checkTruncation.mjs.html#line63">line 63</a>
|
|
19992
|
+
</li></ul></dd>
|
|
19993
|
+
|
|
19994
|
+
|
|
19995
|
+
|
|
19996
|
+
|
|
19997
|
+
|
|
19998
|
+
|
|
19999
|
+
|
|
20000
|
+
|
|
20001
|
+
|
|
20002
|
+
|
|
20003
|
+
|
|
20004
|
+
|
|
20005
|
+
|
|
20006
|
+
|
|
20007
|
+
|
|
20008
|
+
|
|
20009
|
+
|
|
20010
|
+
|
|
20011
|
+
|
|
20012
|
+
|
|
20013
|
+
|
|
20014
|
+
|
|
20015
|
+
|
|
20016
|
+
|
|
20017
|
+
|
|
20018
|
+
|
|
20019
|
+
|
|
20020
|
+
|
|
20021
|
+
|
|
20022
|
+
|
|
20023
|
+
|
|
20024
|
+
</dl>
|
|
20025
|
+
|
|
20026
|
+
|
|
20027
|
+
|
|
20028
|
+
|
|
20029
|
+
|
|
20030
|
+
|
|
20031
|
+
|
|
20032
|
+
|
|
20033
|
+
|
|
20034
|
+
|
|
20035
|
+
|
|
20036
|
+
<h5 class="h5-examples">Example</h5>
|
|
20037
|
+
|
|
20038
|
+
<pre class="prettyprint"><code>import { safeValidate } from './src/checkTruncation.mjs'
|
|
20039
|
+
|
|
20040
|
+
console.log(safeValidate((s) => s.length > 1, 'ab'))
|
|
20041
|
+
// => { pass: true, threw: '' }
|
|
20042
|
+
|
|
20043
|
+
console.log(safeValidate(() => { throw new Error('x') }, 'ab'))
|
|
20044
|
+
// => { pass: false, threw: 'x' }</code></pre>
|
|
20045
|
+
|
|
20046
|
+
|
|
20047
|
+
|
|
20048
|
+
|
|
20049
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
20050
|
+
|
|
20051
|
+
|
|
20052
|
+
<table class="params">
|
|
20053
|
+
<thead>
|
|
20054
|
+
<tr>
|
|
20055
|
+
|
|
20056
|
+
<th>Name</th>
|
|
20057
|
+
|
|
20058
|
+
|
|
20059
|
+
<th>Type</th>
|
|
20060
|
+
|
|
20061
|
+
|
|
20062
|
+
|
|
20063
|
+
|
|
20064
|
+
|
|
20065
|
+
<th class="last">Description</th>
|
|
20066
|
+
</tr>
|
|
20067
|
+
</thead>
|
|
20068
|
+
|
|
20069
|
+
<tbody>
|
|
20070
|
+
|
|
20071
|
+
|
|
20072
|
+
<tr>
|
|
20073
|
+
|
|
20074
|
+
<td class="name"><code>validator</code></td>
|
|
20075
|
+
|
|
20076
|
+
|
|
20077
|
+
<td class="type">
|
|
20078
|
+
|
|
20079
|
+
|
|
20080
|
+
<span class="param-type">function</span>
|
|
20081
|
+
|
|
20082
|
+
|
|
20083
|
+
|
|
20084
|
+
|
|
20085
|
+
</td>
|
|
20086
|
+
|
|
20087
|
+
|
|
20088
|
+
|
|
20089
|
+
|
|
20090
|
+
|
|
20091
|
+
<td class="description last"><p>輸入驗證函式(text)=>Boolean</p></td>
|
|
20092
|
+
</tr>
|
|
20093
|
+
|
|
20094
|
+
|
|
20095
|
+
|
|
20096
|
+
<tr>
|
|
20097
|
+
|
|
20098
|
+
<td class="name"><code>text</code></td>
|
|
20099
|
+
|
|
20100
|
+
|
|
20101
|
+
<td class="type">
|
|
20102
|
+
|
|
20103
|
+
|
|
20104
|
+
<span class="param-type">String</span>
|
|
20105
|
+
|
|
20106
|
+
|
|
20107
|
+
|
|
20108
|
+
|
|
20109
|
+
</td>
|
|
20110
|
+
|
|
20111
|
+
|
|
20112
|
+
|
|
20113
|
+
|
|
20114
|
+
|
|
20115
|
+
<td class="description last"><p>輸入待驗證文字</p></td>
|
|
20116
|
+
</tr>
|
|
20117
|
+
|
|
20118
|
+
|
|
20119
|
+
</tbody>
|
|
20120
|
+
</table>
|
|
20121
|
+
|
|
20122
|
+
|
|
20123
|
+
|
|
20124
|
+
|
|
20125
|
+
|
|
20126
|
+
|
|
20127
|
+
|
|
20128
|
+
|
|
20129
|
+
|
|
20130
|
+
|
|
20131
|
+
|
|
20132
|
+
|
|
20133
|
+
|
|
20134
|
+
|
|
20135
|
+
|
|
20136
|
+
|
|
20137
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
20138
|
+
|
|
20139
|
+
|
|
20140
|
+
<div class="param-desc">
|
|
20141
|
+
<p>回傳物件,內含pass(是否通過布林值)與threw(拋錯訊息字串,未拋錯為空字串)</p>
|
|
20142
|
+
</div>
|
|
20143
|
+
|
|
20144
|
+
|
|
20145
|
+
|
|
20146
|
+
<dl class="param-type">
|
|
20147
|
+
<dt>
|
|
20148
|
+
Type
|
|
20149
|
+
</dt>
|
|
20150
|
+
<dd>
|
|
20151
|
+
|
|
20152
|
+
<span class="param-type">Object</span>
|
|
20153
|
+
|
|
20154
|
+
|
|
20155
|
+
|
|
20156
|
+
</dd>
|
|
20157
|
+
</dl>
|
|
20158
|
+
|
|
20159
|
+
|
|
20160
|
+
|
|
20161
|
+
|
|
20162
|
+
|
|
20163
|
+
|
|
20164
|
+
|
|
20165
|
+
|
|
20166
|
+
|
|
20167
|
+
|
|
19049
20168
|
<h4 class="name" id="salvageTruncatedArray"><span class="type-signature"></span>salvageTruncatedArray<span class="signature">(text)</span><span class="type-signature"> → {Array|null}</span></h4>
|
|
19050
20169
|
|
|
19051
20170
|
|
|
@@ -19067,7 +20186,7 @@ await test()
|
|
|
19067
20186
|
|
|
19068
20187
|
<dt class="tag-source">Source:</dt>
|
|
19069
20188
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
19070
|
-
<a href="wkf_salvageTruncatedArray.mjs.html">wkf/salvageTruncatedArray.mjs</a>, <a href="wkf_salvageTruncatedArray.mjs.html#
|
|
20189
|
+
<a href="wkf_salvageTruncatedArray.mjs.html">wkf/salvageTruncatedArray.mjs</a>, <a href="wkf_salvageTruncatedArray.mjs.html#line49">line 49</a>
|
|
19071
20190
|
</li></ul></dd>
|
|
19072
20191
|
|
|
19073
20192
|
|
|
@@ -21418,7 +22537,7 @@ console.log(w.label, w.remainingPercent)
|
|
|
21418
22537
|
<br class="clear">
|
|
21419
22538
|
|
|
21420
22539
|
<footer>
|
|
21421
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Thu Sep 24 2026
|
|
22540
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Thu Sep 24 2026 14:02:35 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
21422
22541
|
</footer>
|
|
21423
22542
|
|
|
21424
22543
|
<script>prettyPrint();</script>
|