@lynn123411/dsh-a6api 1.5.6 → 1.5.7
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/lib/client.js +521 -315
- package/lib/client.js.map +2 -2
- package/lib/index.js +93 -37
- package/lib/index.js.map +4 -4
- package/lib/types/client/store.d.ts +2 -2
- package/lib/types/server/a6api-client.d.ts +3 -1
- package/lib/types/server/net.d.ts +27 -0
- package/package.json +1 -1
|
@@ -95,8 +95,8 @@ declare class A6ApiStore {
|
|
|
95
95
|
ok: boolean;
|
|
96
96
|
error?: string;
|
|
97
97
|
}>;
|
|
98
|
-
/**
|
|
99
|
-
unpinModel(modelName: string): Promise<{
|
|
98
|
+
/** 取消该模型的固定(上游 pr195 起需要固定所属渠道 ID,随请求透传,服务端另做卡片缓存兜底) */
|
|
99
|
+
unpinModel(modelName: string, channelId?: number): Promise<{
|
|
100
100
|
ok: boolean;
|
|
101
101
|
error?: string;
|
|
102
102
|
}>;
|
|
@@ -45,9 +45,11 @@ export declare function marketplacePin(userId: string | undefined, accessToken:
|
|
|
45
45
|
model_name: string;
|
|
46
46
|
fallback_to_smart_routing: boolean;
|
|
47
47
|
}): Promise<MarketplaceActionResult>;
|
|
48
|
-
/** POST /api/marketplace/unpin — 取消某模型的固定
|
|
48
|
+
/** POST /api/marketplace/unpin — 取消某模型的固定
|
|
49
|
+
* 上游 pr195(2026-09-08)起 payload 必须携带 channel_id,缺字段一律 400 invalid_request */
|
|
49
50
|
export declare function marketplaceUnpin(userId: string | undefined, accessToken: string | undefined, payload: {
|
|
50
51
|
token_id: number;
|
|
52
|
+
channel_id: number;
|
|
51
53
|
model_name: string;
|
|
52
54
|
}): Promise<MarketplaceActionResult>;
|
|
53
55
|
/** POST /api/marketplace/channels/:id/disable?model= — 禁用某渠道对该模型的服务 */
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 上游网络层助手:网络级瞬断的单发自动重试。
|
|
3
|
+
*
|
|
4
|
+
* 实测依据(2026-09,Node 24 undici 全接口测试矩阵):
|
|
5
|
+
* A6API 上游 nginx/CDN 积极回收空闲 keep-alive 连接(实测阈值在 60~95s 之间),
|
|
6
|
+
* 连接池拿到被对端静默关闭的"死 socket"时,首个请求约 5s 后抛
|
|
7
|
+
* `TypeError: fetch failed`(cause: ECONNRESET),新连接重试立即成功;
|
|
8
|
+
* 热连接连发期 0/54 失败,随机整体约 2~5% 请求死在传输层。
|
|
9
|
+
*
|
|
10
|
+
* 这类错误发生在传输层——请求确定未收到任何响应(不会计费、无副作用),
|
|
11
|
+
* 是唯一适合盲重试的类别。超时(TimeoutError)不重试:请求可能已在上游处理。
|
|
12
|
+
*/
|
|
13
|
+
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
14
|
+
/** 网络级瞬断判定(确定未收到响应,可安全重试);超时/中止不在其列 */
|
|
15
|
+
export declare function isFlakyNetworkError(err: any): boolean;
|
|
16
|
+
export interface RetryFetchInit extends RequestInit {
|
|
17
|
+
/** 每次尝试独立的超时窗口(ms);设置后替代 init.signal,重试不会被首发耗尽的时间窗直接掐死 */
|
|
18
|
+
timeoutMs?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* fetch + 网络级瞬断自动重试(默认 1 次、间隔 800ms)。
|
|
22
|
+
* HTTP 状态错误(4xx/5xx)原样返回 Response 由调用方处理;只有抛出的传输层错误才重试。
|
|
23
|
+
*/
|
|
24
|
+
export declare function fetchWithNetRetry(url: string, init?: RetryFetchInit, opts?: {
|
|
25
|
+
retries?: number;
|
|
26
|
+
delayMs?: number;
|
|
27
|
+
}): Promise<Response>;
|