Skip to content
Closed
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
16 changes: 0 additions & 16 deletions apps/app/src/app/context/providers/provider-auth-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,6 @@ export default function ProviderAuthModal(props: ProviderAuthModalProps) {
return normalizedId === "openai" || normalizedName === "openai";
};

// TODO: remove once we upgrade to opencode 1.3.0 — the Claude Pro/Max OAuth
// method is dropped upstream there, so this client-side filter is no longer needed.
const isAnthropicProvider = (id: string, fallbackName?: string) => {
const normalizedId = id.trim().toLowerCase();
const normalizedName = fallbackName?.trim().toLowerCase() ?? "";
return normalizedId === "anthropic" || normalizedName === "anthropic";
};

const isClaudeProMaxMethod = (method: ProviderAuthMethod) => {
const label = method.label.toLowerCase();
return method.type === "oauth" && label.includes("pro/max");
};

const entries = createMemo<ProviderAuthEntry[]>(() => {
const methods = props.authMethods ?? {};
const connected = new Set(props.connectedProviderIds ?? []);
Expand All @@ -112,9 +99,6 @@ export default function ProviderAuthModal(props: ProviderAuthModalProps) {
.map((id): ProviderAuthEntry => {
const provider = providers.find((item) => item.id === id);
const entryMethods = (methods[id] ?? []).filter((method) => {
if (isAnthropicProvider(id, provider?.name) && isClaudeProMaxMethod(method)) {
return false;
}
if (!isOpenAiProvider(id, provider?.name)) return true;
if (method.type !== "oauth") return true;
if (isRemoteWorker()) return isOpenAiHeadlessMethod(method);
Expand Down
17 changes: 14 additions & 3 deletions apps/app/src/app/context/providers/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,12 @@ export function createProvidersStore(options: CreateProvidersStoreOptions) {
workerType: "local" | "remote",
cloudProviders: DenOrgLlmProvider[],
) => {
const isNamedProvider = (id: string, fallbackName: string | undefined, target: string) => {
const normalizedId = id.trim().toLowerCase();
const normalizedName = fallbackName?.trim().toLowerCase() ?? "";
return normalizedId === target || normalizedName === target;
};

const merged = Object.fromEntries(
Object.entries(methods ?? {}).map(([id, providerMethods]) => [
id,
Expand All @@ -355,9 +361,7 @@ export function createProvidersStore(options: CreateProvidersStoreOptions) {
}
for (const [id, providerMethods] of Object.entries(merged)) {
const provider = availableProviders.find((item) => item.id === id);
const normalizedId = id.trim().toLowerCase();
const normalizedName = provider?.name?.trim().toLowerCase() ?? "";
const isOpenAiProvider = normalizedId === "openai" || normalizedName === "openai";
const isOpenAiProvider = isNamedProvider(id, provider?.name, "openai");
if (!isOpenAiProvider) continue;
merged[id] = providerMethods.filter((method) => {
if (method.type !== "oauth") return true;
Expand All @@ -377,6 +381,13 @@ export function createProvidersStore(options: CreateProvidersStoreOptions) {
merged[id] = [...existing, buildCloudProviderMethod(provider)];
}

for (const [id, providerMethods] of Object.entries(merged)) {
const provider = availableProviders.find((item) => item.id === id);
if (!isNamedProvider(id, provider?.name, "anthropic")) continue;
// Anthropic no longer supports in-product key creation or subscription sign-in.
merged[id] = providerMethods.filter((method) => method.type === "api");
}

return merged;
};

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading