diff --git a/app/api/evaluations/[id]/improve-prompt/route.ts b/app/api/evaluations/[id]/improve-prompt/route.ts index ffbc2f1..ca9f4ce 100644 --- a/app/api/evaluations/[id]/improve-prompt/route.ts +++ b/app/api/evaluations/[id]/improve-prompt/route.ts @@ -30,19 +30,8 @@ export async function POST( try { const { id } = await params; - let userBody: Record = {}; - try { - const parsed = await request.json(); - if (parsed && typeof parsed === "object") { - userBody = parsed as Record; - } - } catch { - userBody = {}; - } - const payload = { - ...userBody, - callback_url: userBody.callback_url ?? resolveCallbackUrl(request), + callback_url: resolveCallbackUrl(request), }; const { status, data } = await apiClient( diff --git a/app/components/Sidebar.tsx b/app/components/Sidebar.tsx index 6cc7d44..db58556 100644 --- a/app/components/Sidebar.tsx +++ b/app/components/Sidebar.tsx @@ -21,7 +21,9 @@ import { SlidersIcon, ChatIcon, ChartBarIcon, + WarningTriangleIcon, } from "@/app/components/icons"; +import { InfoTooltip } from "@/app/components/ui"; import { MenuItem, SidebarProps } from "@/app/lib/types/nav"; import { LoginModal } from "@/app/components/auth"; import { Branding, UserMenuPopover } from "@/app/components/user-menu"; @@ -144,6 +146,7 @@ export default function Sidebar({ submenu: item.submenu, gateDescription: item.gateDescription, featureFlag: item.featureFlag, + disabledReason: item.disabledReason, })); const getGateDescription = (name: string): string => { @@ -182,7 +185,8 @@ export default function Sidebar({ const hasSubmenu = item.submenu && item.submenu.length > 0; const isExpanded = expandedMenus[item.name]; const isActive = activeRoute === item.route; - const gated = isItemGated(item); + const isDisabled = !!item.disabledReason; + const gated = !isDisabled && isItemGated(item); const hasActiveChild = hasSubmenu && @@ -194,8 +198,9 @@ export default function Sidebar({ ); return ( -
+
+ {isDisabled && ( + + + } + /> + + )} {hasSubmenu && isExpanded && !gated && (
diff --git a/app/components/ui/InfoTooltip.tsx b/app/components/ui/InfoTooltip.tsx index eeb711b..2b52bc4 100644 --- a/app/components/ui/InfoTooltip.tsx +++ b/app/components/ui/InfoTooltip.tsx @@ -12,9 +12,10 @@ import { TooltipIcon } from "@/app/components/icons"; interface InfoTooltipProps { text: ReactNode; + icon?: ReactNode; } -export default function InfoTooltip({ text }: InfoTooltipProps) { +export default function InfoTooltip({ text, icon }: InfoTooltipProps) { const [visible, setVisible] = useState(false); const [positioned, setPositioned] = useState(false); const [position, setPosition] = useState({ top: 0, left: 0 }); @@ -65,7 +66,7 @@ export default function InfoTooltip({ text }: InfoTooltipProps) { onBlur={() => setVisible(false)} className="w-4 h-4 rounded-full text-[10px] font-bold flex items-center justify-center leading-none select-none cursor-pointer" > - + {icon ?? } {visible && createPortal( diff --git a/app/lib/navConfig.ts b/app/lib/navConfig.ts index 6ddad7d..6344257 100644 --- a/app/lib/navConfig.ts +++ b/app/lib/navConfig.ts @@ -38,6 +38,8 @@ export const NAV_ITEMS: NavItemConfig[] = [ route: "/guardrails", icon: "shield", gateDescription: "Log in to manage guardrails and validators.", + disabledReason: + "Guardrails is temporarily disabled. We're making significant backend changes and things aren't in sync yet — it will be re-enabled once everything is aligned. To explore Guardrails, please contact the Kaapi team.", }, { name: "Chat", diff --git a/app/lib/types/nav.ts b/app/lib/types/nav.ts index 4296f2d..76cd125 100644 --- a/app/lib/types/nav.ts +++ b/app/lib/types/nav.ts @@ -14,6 +14,7 @@ export interface NavItemConfig { gateDescription?: string; superuserOnly?: boolean; featureFlag?: FeatureFlagKey; + disabledReason?: string; } export interface SubMenuItem { @@ -30,6 +31,7 @@ export interface MenuItem { submenu?: SubMenuItem[]; gateDescription?: string; featureFlag?: FeatureFlagKey; + disabledReason?: string; } export interface SidebarProps { diff --git a/middleware.ts b/middleware.ts index cabf951..5f39062 100644 --- a/middleware.ts +++ b/middleware.ts @@ -21,6 +21,9 @@ const FEATURE_GATED_PREFIXES: Array<{ flag: FeatureFlagKey; }> = [{ prefix: "/assessment", flag: FeatureFlag.ASSESSMENT }]; +// Temporarily disabled while backend changes are being synced; keep in sync with `disabledReason` in navConfig. +const DISABLED_PREFIXES = ["/guardrails"]; + const GUEST_ONLY_ROUTES = new Set(["/keystore"]); const HOME_ROUTE = "/chat"; @@ -57,6 +60,14 @@ export function middleware(request: NextRequest) { const isAuthenticated = hasApiKey || role === "superuser" || role === "user"; const isSuperuser = role === "superuser"; + if ( + DISABLED_PREFIXES.some( + (prefix) => pathname === prefix || pathname.startsWith(`${prefix}/`), + ) + ) { + return redirectHome(request); + } + if (GUEST_ONLY_ROUTES.has(pathname)) { if (isAuthenticated) { return redirectHome(request);