fix(merge): restore ANTHROPIC_COMPATIBLE_PREFIX import + drop dead appendRequestLog call
Full-source eslint no-undef sweep over src/ + open-sse/ (config
listing node/web globals) found two remaining undeclared-variable
regressions of the same merge-loss family:
* api/providers/test-batch: branch commit f0adfb20 added a
providerId.startsWith(ANTHROPIC_COMPATIBLE_PREFIX) check but never
imported it; the master merge kept the buggy line. Every batch
test / provider-group filter touching a non-openai-compatible
provider threw ReferenceError (|| does not short-circuit).
* utils/stream.js finalizeStream: no-usage fallback called
appendRequestLog(), a stub upstream had marked no-op and whose
export chain was dropped by the merge. The call site only fires
when a stream ends without valid usage and now threw
ReferenceError inside the terminal callback. Removed the dead
call (behaviour identical: the stub wrote nothing).
All other no-undef reports are browser globals absent from the
scan config, not source bugs. next build --webpack passes; smoke
server boots and auth-rejects unauthenticated /v1 + /api traffic
as expected; unit suite 1746 pass / 103 fail (was 1738/111).
This commit is contained in:
@@ -98,9 +98,10 @@ export function createSSEStream(options = {}) {
|
|||||||
|
|
||||||
if (hasValidUsage(finalUsage)) {
|
if (hasValidUsage(finalUsage)) {
|
||||||
logUsage(isPassthrough ? provider : (state?.provider || targetFormat), finalUsage, model, connectionId, apiKey);
|
logUsage(isPassthrough ? provider : (state?.provider || targetFormat), finalUsage, model, connectionId, apiKey);
|
||||||
} else {
|
|
||||||
appendRequestLog({ model, provider, connectionId, tokens: null, status: "200 OK" }).catch(() => { });
|
|
||||||
}
|
}
|
||||||
|
// No else branch: the old appendRequestLog() fallback was a no-op stub
|
||||||
|
// (request log is derived from usageHistory on read) and was dropped by
|
||||||
|
// the master merge; logging a 200 with tokens:null was a cosmetic entry.
|
||||||
|
|
||||||
if (onStreamComplete) {
|
if (onStreamComplete) {
|
||||||
onStreamComplete({
|
onStreamComplete({
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
OAUTH_PROVIDERS,
|
OAUTH_PROVIDERS,
|
||||||
APIKEY_PROVIDERS,
|
APIKEY_PROVIDERS,
|
||||||
OPENAI_COMPATIBLE_PREFIX,
|
OPENAI_COMPATIBLE_PREFIX,
|
||||||
|
ANTHROPIC_COMPATIBLE_PREFIX,
|
||||||
} from "@/shared/constants/providers";
|
} from "@/shared/constants/providers";
|
||||||
import { testSingleConnection } from "../[id]/test/testUtils.js";
|
import { testSingleConnection } from "../[id]/test/testUtils.js";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user