Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions open-sse/handlers/chatCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1395,10 +1395,13 @@ export async function handleChatCore({
// models, which is intentionally NOT `false` so the gate still preserves images.
supportsVision: getResolvedModelCapabilities({ provider, model: effectiveModel })
.supportsVision,
// Rota direta oficial ('anthropic') vs agregadores: o engine omniglyph
// exige 'direct' — agregadores redimensionam imagens (medido 2026-07-06).
// Rotas diretas oficiais ('anthropic' API key e 'claude' OAuth) vs agregadores:
// o engine omniglyph exige 'direct' — agregadores redimensionam imagens
// (medido 2026-07-06). OAuth 'claude' é rota direta oficial (#7863).
providerTransport:
provider === "anthropic" ? ("direct" as const) : ("aggregator" as const),
provider === "anthropic" || provider === "claude"
? ("direct" as const)
: ("aggregator" as const),
config: compressionConfig,
cachingContext: cacheCtx,
principalId: compressionPrincipalId,
Expand Down
1 change: 1 addition & 0 deletions src/shared/constants/visionModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const VISION_MODEL_ID_FRAGMENTS = [
"gemini-3",
"gemini-exp",
"claude-3",
"claude-fable",
"claude-opus-4",
"claude-sonnet-4",
"claude-haiku-4",
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/compression/omniglyph-chatcore-plumbing.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { readFileSync } from "node:fs";
import assert from "node:assert/strict";
import { test } from "node:test";

test("chatCore treats both Anthropic providers as direct OmniGlyph transports", () => {
const chatCore = readFileSync("open-sse/handlers/chatCore.ts", "utf8");

assert.match(
chatCore,
/providerTransport:\s*provider === "anthropic" \|\| provider === "claude"[\s\S]{0,80}?"direct"/
);
});
Comment on lines +5 to +12

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This unit test is highly fragile because it performs static analysis via regular expressions on the raw source code of 'chatCore.ts'. Any minor formatting change (such as those applied by Prettier, or refactoring the ternary operator into a helper function/variable) will break this test even if the runtime behavior remains completely correct. A more robust approach is to write a behavioral test that mocks the compression module or calls 'handleChatCore' with mocked dependencies to verify that the correct 'providerTransport' is passed.

5 changes: 2 additions & 3 deletions tests/unit/vision-detection-consistency.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const VISION = [
"llava-1.5-7b",
"qwen-vl-max",
"gpt-4o",
"claude-fable-5",
"glm-4v",
"kimi-vl-a3b",
"mistral-medium-3",
Expand All @@ -38,9 +39,7 @@ function imageBody() {
messages: [
{
role: "user",
content: [
{ type: "image_url", image_url: { url: "data:image/png;base64,iVBOR" } },
],
content: [{ type: "image_url", image_url: { url: "data:image/png;base64,iVBOR" } }],
},
],
};
Expand Down
Loading