feat: variables 2.0 state + L0 summary integration
This commit is contained in:
@@ -471,8 +471,6 @@ async function embedOnline(texts, provider, config, options = {}) {
|
||||
const providerConfig = ONLINE_PROVIDERS[provider];
|
||||
const baseUrl = (providerConfig?.baseUrl || url || '').replace(/\/+$/, '');
|
||||
|
||||
const reqId = Math.random().toString(36).slice(2, 6);
|
||||
|
||||
// 永远重试:指数退避 + 上限 + 抖动
|
||||
const BASE_WAIT_MS = 1200;
|
||||
const MAX_WAIT_MS = 15000;
|
||||
@@ -491,9 +489,6 @@ async function embedOnline(texts, provider, config, options = {}) {
|
||||
let attempt = 0;
|
||||
while (true) {
|
||||
attempt++;
|
||||
const startTime = Date.now();
|
||||
console.log(`[embed ${reqId}] send ${texts.length} items (attempt ${attempt})`);
|
||||
|
||||
try {
|
||||
let response;
|
||||
|
||||
@@ -526,8 +521,6 @@ async function embedOnline(texts, provider, config, options = {}) {
|
||||
});
|
||||
}
|
||||
|
||||
console.log(`[embed ${reqId}] status=${response.status} time=${Date.now() - startTime}ms`);
|
||||
|
||||
// 需要“永远重试”的典型状态:
|
||||
// - 429:限流
|
||||
// - 403:配额/风控/未实名等(你提到的硅基未认证)
|
||||
@@ -541,7 +534,6 @@ async function embedOnline(texts, provider, config, options = {}) {
|
||||
const exp = Math.min(MAX_WAIT_MS, BASE_WAIT_MS * Math.pow(2, Math.min(attempt, 6) - 1));
|
||||
const jitter = Math.floor(Math.random() * 350);
|
||||
const waitMs = exp + jitter;
|
||||
console.warn(`[embed ${reqId}] retryable error ${response.status}, wait ${waitMs}ms`);
|
||||
await sleepAbortable(waitMs);
|
||||
continue;
|
||||
}
|
||||
@@ -569,7 +561,6 @@ async function embedOnline(texts, provider, config, options = {}) {
|
||||
const exp = Math.min(MAX_WAIT_MS, BASE_WAIT_MS * Math.pow(2, Math.min(attempt, 6) - 1));
|
||||
const jitter = Math.floor(Math.random() * 350);
|
||||
const waitMs = exp + jitter;
|
||||
console.warn(`[embed ${reqId}] network/error, wait ${waitMs}ms then retry: ${e?.message || e}`);
|
||||
await sleepAbortable(waitMs);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user