mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-05 14:52:09 +03:00
chore: rename CC compatible feature flag
This commit is contained in:
@@ -21,7 +21,6 @@ import {
|
||||
isClaudeCodeCompatibleProvider,
|
||||
isOpenAICompatibleProvider,
|
||||
} from "@/shared/constants/providers";
|
||||
import { CC_COMPATIBLE_PROVIDER_ENABLED } from "@/shared/utils/featureFlags";
|
||||
import Link from "next/link";
|
||||
import { getErrorCode, getRelativeTime } from "@/shared/utils";
|
||||
import { useNotificationStore } from "@/store/notificationStore";
|
||||
@@ -102,6 +101,7 @@ function getConnectionErrorTag(connection) {
|
||||
export default function ProvidersPage() {
|
||||
const [connections, setConnections] = useState<any[]>([]);
|
||||
const [providerNodes, setProviderNodes] = useState<any[]>([]);
|
||||
const [ccCompatibleProviderEnabled, setCcCompatibleProviderEnabled] = useState(false);
|
||||
const [expirations, setExpirations] = useState<any>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [showAddCompatibleModal, setShowAddCompatibleModal] = useState(false);
|
||||
@@ -126,7 +126,10 @@ export default function ProvidersPage() {
|
||||
const nodesData = await nodesRes.json();
|
||||
const expirationsData = await expirationsRes.json();
|
||||
if (connectionsRes.ok) setConnections(connectionsData.connections || []);
|
||||
if (nodesRes.ok) setProviderNodes(nodesData.nodes || []);
|
||||
if (nodesRes.ok) {
|
||||
setProviderNodes(nodesData.nodes || []);
|
||||
setCcCompatibleProviderEnabled(nodesData.ccCompatibleProviderEnabled === true);
|
||||
}
|
||||
if (expirationsRes.ok && expirationsData) setExpirations(expirationsData);
|
||||
} catch (error) {
|
||||
console.log("Error fetching data:", error);
|
||||
@@ -514,7 +517,7 @@ export default function ProvidersPage() {
|
||||
{testingMode === "compatible" ? t("testing") : t("testAll")}
|
||||
</button>
|
||||
)}
|
||||
{CC_COMPATIBLE_PROVIDER_ENABLED && (
|
||||
{ccCompatibleProviderEnabled && (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
@@ -583,7 +586,7 @@ export default function ProvidersPage() {
|
||||
setShowAddAnthropicCompatibleModal(false);
|
||||
}}
|
||||
/>
|
||||
{CC_COMPATIBLE_PROVIDER_ENABLED && (
|
||||
{ccCompatibleProviderEnabled && (
|
||||
<AddCcCompatibleModal
|
||||
isOpen={showAddCcCompatibleModal}
|
||||
onClose={() => setShowAddCcCompatibleModal(false)}
|
||||
|
||||
@@ -29,7 +29,10 @@ function sanitizeAnthropicBaseUrl(baseUrl: string) {
|
||||
export async function GET() {
|
||||
try {
|
||||
const nodes = await getProviderNodes();
|
||||
return NextResponse.json({ nodes });
|
||||
return NextResponse.json({
|
||||
nodes,
|
||||
ccCompatibleProviderEnabled: isCcCompatibleProviderEnabled(),
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("Error fetching provider nodes:", error);
|
||||
return NextResponse.json({ error: "Failed to fetch provider nodes" }, { status: 500 });
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
export function isCcCompatibleProviderEnabled() {
|
||||
return process.env.NEXT_PUBLIC_ENABLE_CC_COMPATIBLE_PROVIDER === "true";
|
||||
return process.env.ENABLE_CC_COMPATIBLE_PROVIDER === "true";
|
||||
}
|
||||
|
||||
export const CC_COMPATIBLE_PROVIDER_ENABLED = isCcCompatibleProviderEnabled();
|
||||
|
||||
Reference in New Issue
Block a user