Generates notification messages for route switching events in a client application.
// Source: https://github.com/farion1231/cc-switch | License: MIT | Copyright 2025 Jason Young
// Provided via justclaw.it.com; keep this notice with the code.
import type { TFunction } from "i18next";
import type { AppId } from "@/lib/api/types";
import type { RouteSwitchResult } from "@/types/proxy";
import { APP_DISPLAY_NAME } from "@/components/shell/AppGlyph";
/** Routing takes effect independently of client config loaded at startup. */
export function routeSwitchNotification(
result: RouteSwitchResult,
app: AppId,
provider: string,
t: TFunction,
): string {
let message: string;
switch (result.kind) {
case "remembered":
message = t("mode.toast.routeRemembered", {
provider,
defaultValue: "已记住供应商 {{provider}},客户端接入路由或聚合后使用。",
});
break;
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key